Files
Your Name 7e2ecba219 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
2026-08-05 14:11:14 +00:00

20 lines
520 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# Opt-in git pre-commit hook that runs `make check` before every commit.
# Run `make hook` (or ./scripts/install-hooks.sh) once per clone.
#
# Skips itself when the commit is purely merge/conflict-resolution driven.
root="$(cd "$(dirname "$0")/.." && pwd)"
hook="$root/.git/hooks/pre-commit"
cat > "$hook" <<'EOF'
#!/usr/bin/env bash
set -euo pipefail
root="$(git rev-parse --show-toplevel)"
cd "$root"
exec make check
EOF
chmod +x "$hook"
echo "pre-commit hook installed: $hook"