diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-28 09:11:47 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-28 09:11:47 -0500 |
| commit | 9f84ea2c7854e35ae30c0fb5fbd63f7b7115fb41 (patch) | |
| tree | c6cd922c6286c5a6a0c6803ed8311683a3e538af /Makefile | |
| parent | beb646e827802c0491b422ce03c7687eb66a717b (diff) | |
| download | rulesets-9f84ea2c7854e35ae30c0fb5fbd63f7b7115fb41.tar.gz rulesets-9f84ea2c7854e35ae30c0fb5fbd63f7b7115fb41.zip | |
feat(sync-check): canonical/mirror drift detection + pre-commit hook
scripts/sync-check.sh diffs claude-templates/.ai/{protocols.org,
workflows,scripts} against the .ai/ mirror. Exits 0 when clean, 1 with
a diff report on drift, 2 outside a rulesets-shaped repo or git
checkout. --fix mode rsyncs canonical -> mirror and re-checks, then
prompts to re-stage.
githooks/pre-commit wraps the script. Commits abort on drift so the
issue surfaces at publish time, not at the next session's startup
rsync.
Two new Makefile targets:
- make sync-check [FIX=1] runs the script (FIX=1 passes --fix
through).
- make install-githooks sets core.hooksPath=githooks (idempotent).
scripts/tests/sync-check.bats holds 8 tests covering clean,
drift-per-path, --fix, extra-file removal, missing canonical, and
outside-git. All eight pass.
This catches the exact drift I had to fix manually during this
morning's audit pass. The mirror's open-tasks.org PROPERTIES drawer
sat below a sub-heading because the mirror commit was older than
canonical.
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -431,6 +431,13 @@ audit: ## Verify project .ai/ dirs against canonical ([APPLY=1] [FORCE=1] [NO_DO $(if $(FORCE),--force) \ $(if $(NO_DOCTOR),--no-doctor) +sync-check: ## Verify claude-templates/.ai/ canonical matches .ai/ mirror ([FIX=1]) + @bash scripts/sync-check.sh $(if $(FIX),--fix) + +install-githooks: ## Point this repo's core.hooksPath at githooks/ (idempotent — enables pre-commit sync-check) + @git config core.hooksPath githooks + @echo "core.hooksPath=githooks (pre-commit will run scripts/sync-check.sh)" + install-ai: ## Bootstrap .ai/ in a fresh project ([PROJECT=<path>] [TRACK=1 | GITIGNORE=1]) @bash scripts/install-ai.sh \ $(if $(TRACK),--track) \ |
