chore: add doc/code sync gate (make gen + make check + pre-commit hook)
- bin/pos: usage() CATEGORIES now auto-derived from pos-* filenames (kill the stale cheat-sheet bug class); only EXAMPLES stays hand-written - # POS: / # POS_FLAGS: headers on all 15 tools = single source of truth for generated docs; template updated - scripts/gen-docs.sh: regenerates GEN-marker sections (bin tree, dispatch table, no-common.sh list, line-count table, completion flags) - scripts/check-sync.sh: bash -n + exec bits + doc/code drift + smoke - Makefile: make gen / make check; scripts/install-hooks.sh: opt-in hook - DEV.md + AGENT_Context: add-a-tool flow is now header + make check
This commit is contained in:
+4
-9
@@ -90,18 +90,13 @@ gen_posflags() {
|
||||
}
|
||||
|
||||
# ── Replace (write) or verify (check) one marker block ──────────
|
||||
markers() {
|
||||
# bash files use '#' comment markers, markdown uses HTML comments
|
||||
case "$1" in
|
||||
*.bash|*.sh) echo "# GEN:START $2" "# GEN:END $2" ;;
|
||||
*) echo "<!-- GEN:START $2 -->" "<!-- GEN:END $2 -->" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
regen_block() {
|
||||
local file="$1" name="$2"
|
||||
local start end newfile tmp
|
||||
read -r start end <<<"$(markers "$file" "$name")"
|
||||
case "$file" in
|
||||
*.bash|*.sh) start="# GEN:START $name"; end="# GEN:END $name" ;;
|
||||
*) start="<!-- GEN:START $name -->"; end="<!-- GEN:END $name -->" ;;
|
||||
esac
|
||||
newfile="$(mktemp)"
|
||||
"gen_$name" > "$newfile"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user