How-to: set up the pre-commit gate¶
Wires the audit pipeline into git commit so every commit is validated before it lands.
One-time setup (per clone)¶
python scripts/setup_hooks.py # if already a git repo
python scripts/setup_hooks.py --init # initializes git first
This sets core.hooksPath to .githooks/ and chmods the hooks executable.
What runs on each commit¶
The pre-commit hook calls scripts/pre_commit_check.py, which runs:
scripts/sync_registry.py --dry-run(detects_metadrift)scripts/audit.py(structural)scripts/audit_semantic.py(semantic)
If any of these fail, the commit is aborted.
Standard pre-commit framework (optional, recommended)¶
The repo also ships a .pre-commit-config.yaml for the pre-commit framework:
This adds: trailing whitespace, end-of-file fix, JSON/YAML/TOML validation, ruff lint/format.
Bypass (not recommended)¶
CI will still catch it.