e969234ca5
gates / consistency-and-conventions (push) Successful in 1m28s
- lib/registry.sh: shared query API over POS_* headers (reg_scan, reg_list, reg_lookup, reg_tools_in, reg_each, reg_config_scopes/keys). Replaces per-consumer sed/grep header parsing. - bin/pos-tree + bin/pos _pos_category_help(): migrated to registry API. Category help now shows [deps: ...] annotations. Tree output preserved. - New optional headers # POS_DEPS: and # POS_EXAMPLES: in tool metadata. Added to pos-network-download (aria2c jq curl), pos-media-sync (lsblk jq), pos-system-backup (tar), pos-docker-ps (docker) as initial adopters. - scripts/gen-docs.sh: extended tools array with deps/examples fields; conditional column rendering in gen_dispatch; deps annotation in gen_tree. Fixed URL-unsafe // joiner (→ middle dot ·) and \x1f caption delimiter collision in config-ui. - bin/pos-ai-alias: rewrote activation from bash aliases (source-time-frozen) to executable wrapper scripts at ~/.local/bin. Staleness eliminated: edits apply on next invocation with no shell reload. _alias_sync() reconciliation on every subcommand, marker-guarded lifecycle, collision refusal, legacy .sh retirement. Fixed dup-table bug (option 4 no-op). - lib/config-ui.sh: @caption/@[KEY=alt] conditional captions, *providers=<tag> tagged wildcards, uniform typography tier (bold/cyan/dim), honest prompt. Active provider keys bold, inactive dimmed with reason. Backward-compatible. - bin/pos-system-uninstall: marker-scan for wrapper script cleanup. - Docs synced: AGENTS.md (new headers + registry), DOC/SCRIPTS.md (registry section + lib list), DOC/POS.md (alias wrapper activation), MAINTENANCE.md (M-024). Lint fixed: pos-ai-alias registered in INTERACTIVE_CMDS. Gates: make gen && make check && make lint = 0 FAIL, 0 WARN
7.1 KiB
7.1 KiB
Linux_post_install — Agent Instructions
Personal bootstrap & homelab toolkit for Debian/Ubuntu (Bash). install.sh bootstraps a machine; bin/pos is the unified CLI.
External File Loading
CRITICAL: real guidance lives in DOC/. When you encounter a reference below, use your Read tool to load it on a need-to-know basis — do NOT preemptively load all of them. Once loaded, treat the content as mandatory instructions.
- @DOC/AGENT_Context_Project.md — project overview, directory structure,
posdispatch table, "How to modify" table. Read FIRST for any non-trivial task. It opens with a Document Map (auto-generated line ranges for every section) — use it to jump straight to the relevant section. - @DOC/DEV.md — conventions, verification, and the "Adding a new Feature/App/Tool" checklists. Read before creating or changing code/docs.
- @DOC/POS.md —
posCLI reference (dispatcher + every command). Read when working onbin/pos*scripts or their docs. - @DOC/README.md — index of all docs. Read to find the right doc.
- @DOC/HOWTO.md — hands-on per-category guides (ai, network, docker, media, system, ssh, share, communication, entertainment). Read when a task is about using
posday-to-day rather than extending it.
Quick facts
- Tool model:
bin/pos-<category>-<command>, or category-lessbin/pos-<cmd>for dispatcher/dev-level commands that fit no category (pos-config,pos-tree) — they dispatch like any tool and show with an empty category in the generated tables.bin/posdispatches by longest-prefix arg matching. New tools are auto-discovered but must be executable (100755) and carry a# POS: <cat> <cmd> — <desc>header right after the shebang;make genonly uses the text after the first—(the leading words are convention-only), so keep the one-line description concise.# POS_FLAGS:/# POS_SUBCMDS:/# POS_CONFIG:headers feed tab-completion and thepos configscope registry; optional# POS_DEPS: <binary…>declares space-separated runtime binaries the tool hard-requires viacommand -vguards, and optional# POS_EXAMPLES: <command> | <description>adds curated usage examples, one per line.lib/registry.shis the shared query API over allPOS_*headers — consumers source it (reg_scan+reg_list/reg_lookup/…) instead of re-implementing sed/grep header parsing; new consumers should prefer it. A missing# POS:header hard-failsmake gen. Legacybin/wr-*,mp3,mp4,vbox,ssh-load-allare thin forwarders topos— keep them that way. - Categories:
ai,communication,docker,entertainment,media,network,share(usb, nfs, smb),ssh,system, plus category-lessconfig/tree.pos tree(bin/pos-tree) is the authoritative structure — it derives the hierarchy frombin/pos-*filenames +# POS:/# POS_SUBCMDS:headers, reads the metadata throughlib/registry.sh, and annotates each command's declared# POS_DEPS:. - Generated code: blocks between
GEN:START/GEN:ENDmarkers inDOC/AGENT_Context_Project.md(tree, dispatch, selfcontained, filetable, docmap) andcompletions/pos.bash(flags, subcmds, config scopes) aremake genoutput — never hand-edit them. Generators must be byte-order deterministic (sort withLC_ALL=C, asscripts/gen-docs.shdoes) or CI'sgit diff --exit-codetrips on a locale that collates differently. After touchingbin/pos-*, runmake gen, thenmake check, thenmake lint(definition of done: check green + lint ends0 FAIL, 0 WARN).make check(scripts/check-sync.sh) is the self-consistency gate — bash -n + exec-bit check + doc-sync + dispatch smoke;make lint(scripts/lint-conventions.sh) is the convention gate — it enforces every rule in this file (shebang/strict-mode, exec bits,# POS:headers,-h|--helppresent and after deps guards, stdin-readers inINTERACTIVE_CMDS, POS.md coverage, plugin/app/unit/wrapper/secrets/env-seam classes — seeDOC/DEV.md → Convention Lint Gate). Hand-maintained, not gen-checked:DOC/POS.md, the line-count rows above the filetable marker inDOC/AGENT_Context_Project.md(the non-pos-*files —install.sh,preinstall.sh,postinstall.sh,lib/*,features/*; bump a row's count only when that file's length changes),bin/posusage() EXAMPLES, root README. CI (.gitea/workflows/lint.yml, jobgates) runs the same four commands on every push to main and PR, then records the result as a git tag on the commit:ci-ok/<sha>orci-fail/<sha>(pushes only — query withscripts/ci-status.sh [--wait] [<sha>]; exit 0 green / 1 red / 2 pending). A red run means gen drift or a gate failure and is a merge-blocker; still run the gates locally too (lint isn't in the pre-commit hook). - Stdin gotcha: any tool that reads stdin must be added to
INTERACTIVE_CMDSinbin/pos— otherwise the loggingteepipe hangs on (or swallows) the prompt. - Deps: apt packages →
PACKAGESarray inpreinstall.sh; non-apt/manual installers (e.g.usbsrv) →command -v <bin> || err "…"guard inside the tool, never in PACKAGES. Hotspot binaries (create_ap,wihotspot*) are prebuilt inx64_bin/(orarm64_bin/) and copied byinstall.sh— not apt packages. - Secrets: never commit keys/tokens.
config/authorized_keysandconfig/rclone.confare gitignored; runtime tool config is~/.config/linux_post_install/<tool>.env(chmod 600, env-var precedence). Mask tokens inconfigoutput. - entertainment plugins: standalone scripts in
entertainment/that must NOT sourcelib/common.sh— stdout is the message that gets sent to Telegram (helper chatter would leak into it). Markers:# POS_PLUGIN: <name>+# POS_KEYS:declarations. They aren'tpos-*tools, somake genskips them (no headers/doc tables) — verify withbash -n+ a livepos entertainment send <name> --print. - ScaleTail templates are a git submodule (
compose/scale-tail), absent on fresh clones — rungit submodule update --initfirst (only needed forpos docker compose *). - Doc conflicts: resolve by the authority order in
MAINTENANCE.md → Phase 0:templates/*.share the codified current convention and the required starting point for new work (cp templates/pos-tool.sh bin/pos-<cat>-<cmd>, likewiseapp.sh/feature.sh); then DEV.md wins on detail, AGENTS.md on process facts; code +# POS:headers are ground truth for behavior and allGEN:blocks; drift in POS/HOWTO/README/SCRIPTS/SYSTEMD/APPS is a doc bug — fix the doc. - Conventions:
set -euo pipefail,-h|--helpvia case, idempotent writes, userun/spawnhelpers (respect$DRY_RUN),make hookinstalls the opt-in pre-commit gate.command -vdeps guards sit before the-h|--helpdispatch — help also errors on a box missing the dependency (matches all existing deps-gated tools). Tools must run standalone from/usr/local/binafter install (sourcelib/common.shvia the$(dirname "$0")/../lib/common.shfallback chain). Commits use conventional prefixes (feat:/fix:/docs:/chore:/refactor:). - Maintain
AGENT_TODO.md(Now / Next / Later / Done): when you finish a task, move it to Done (dated) in the same commit.