Skip to content

fix(hook): document why the compiled-file skip gates tidy, pin hook parity - #336

Merged
stackbilt-admin merged 3 commits into
mainfrom
auto/bugfix/issue-320
Oct 15, 2026
Merged

stackbilt-admin merged 3 commits into
mainfrom
auto/bugfix/issue-320

Conversation

@stackbilt-admin

@stackbilt-admin stackbilt-admin commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Refs #320

The premise of #320 was wrong: the compiled-file grep in the pre-commit hooks is not dead code. adf tidy is indeed called without --source, so STAGED_VENDORS never narrows what tidy scans. But the whole tidy block is wrapped in if [ -n "$STAGED_VENDORS" ]. Removing compiled files from STAGED_VENDORS means a commit that stages only compiled output (the normal adf compile --write flow) never runs tidy and never runs git add .ai/*.adf. Without the grep, such a commit would run tidy over the whole tree and pick up unrelated .ai/*.adf edits that were never staged. A review reproduced exactly that against the built dist.

This PR:

  • Keeps the grep in .githooks/pre-commit and in the hook text that packages/cli/src/commands/hook.ts generates. In both copies, the misleading comment is replaced with one that says what the grep actually does: it gates the whole tidy run. When tidy does run because a non-compiled vendor file is staged, tidy's own compiled-file skip (fix(adf): stop tidy ingesting compiled vendor output #319) handles compiled files.
  • Adds a test in hook.test.ts:
    • It checks that the generated pre-commit hook still contains the compiled-file grep, so deleting it again fails the test.
    • It checks that the generated hook still contains the totalExtracted grep.
    • It checks that the generated staged-vendor loop matches .githooks/pre-commit line for line, so the two copies can't drift apart.

Follow-up, not in this PR: option 2 from the issue. That means passing --source for each staged file and re-staging only the modules tidy changed. When a non-compiled vendor file is staged, the hook still runs tidy over the whole tree and re-stages all .ai/*.adf.

Implemented via constellation-loop.

🤖 Generated with Claude Code

@stackbilt-admin stackbilt-admin changed the title fix: remove dead compiled-file skip from pre-commit hooks fix(hook): document why the compiled-file skip gates tidy, pin hook parity Oct 15, 2026
@stackbilt-admin
stackbilt-admin merged commit af7776c into main Oct 15, 2026
5 checks passed
@stackbilt-admin
stackbilt-admin deleted the auto/bugfix/issue-320 branch October 15, 2026 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants