You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
hook: the compiled-file skip in both pre-commit hooks is dead code — tidy is invoked without --source #320
Found during the review of #319 (fixing #296). Pre-existing, not introduced by that PR.
The compiled-file skip in both hooks has never done anything
.githooks/pre-commit:14-19 and the generated equivalent in packages/cli/src/commands/hook.ts:53-59 both filter compiled vendor files out of the staged list:
if [ -f"$vf" ] && grep -q 'GENERATED by charter adf compile'"$vf";thencontinuefi
STAGED_VENDORS="$STAGED_VENDORS$vf"
Two lines later, the tidy invocation passes no --source:
So STAGED_VENDORS never reaches tidy. It is used only for the echo on the preceding line and for re-staging afterwards. Every vendor file on disk is scanned regardless of what the filter excluded.
Why it matters
This is why #296 escaped the hook. The grep reads as protection — it was cited as evidence that skipping compiled files was already proven in the field — but it only ever suppressed the reporting path. tidy still ingested compiled output on every commit, which is exactly the corruption #296 reported.
The real fix landed in #319 at adf-tidy.ts:263, inside the command, where it applies to every caller rather than to a list the command never receives.
Options
Delete both greps. They are now genuinely redundant — adf tidy skips compiled files itself as of fix(adf): stop tidy ingesting compiled vendor output #319. Smallest change, removes a comment that actively misleads the next reader.
Pass --source per staged file. Makes the hook do what it looks like it does, and narrows tidy to staged files rather than the whole tree — arguably the better behavior, since a pre-commit hook rewriting unstaged files is surprising. Bigger change; needs a loop and care about the re-staging step.
Option 1 unless there is appetite for the scoping change in option 2. Either way the two copies (.githooks/pre-commit and the generator in hook.ts) must move together, or a charter hook install --pre-commit will silently reintroduce the old text.
Note
packages/cli/src/__tests__/integration/precommit-hook.test.ts:117 pins the totalExtracted grep string, so changes here should keep that passing or update it deliberately.
Investigated via constellation-loop: the compiled-file grep in both pre-commit hooks is not dead code, so option 1 (delete it) would be a regression.
tidy skipping compiled files itself (#319) only matters once tidy runs. The grep's real job is upstream of that: it keeps compiled files out of STAGED_VENDORS, and if [ -n "$STAGED_VENDORS" ] gates the entire tidy block. For a commit that stages only compiled output (the normal adf compile --write flow), main skips tidy and the git add .ai/*.adf re-stage entirely. With the grep removed, that commit would run a whole-tree tidy and sweep unrelated unstaged .ai/*.adf edits (and newly extracted modules) into the commit — reproduced with a scratch repo.
#336 keeps the grep, rewrites the misleading comment in both copies to say what it actually does, and adds a test pinning the grep's presence and the parity between .githooks/pre-commit and the hook charter hook install generates.
Leaving this open for option 2 (pass --source per staged vendor file and re-stage only modules tidy changed), which would also fix the over-staging main already does when a non-compiled vendor file is staged. That's a behavior change worth a deliberate design pass rather than an auto-loop fix.
Activity
docs: correct the adf tidy note and document score, telemetry, stamp-…
fix(hook): document why the compiled-file skip gates tidy (refs #320)
stackbilt-admin commentedon Oct 15, 2026
Investigated via constellation-loop: the compiled-file
grepin both pre-commit hooks is not dead code, so option 1 (delete it) would be a regression.tidyskipping compiled files itself (#319) only matters once tidy runs. The grep's real job is upstream of that: it keeps compiled files out ofSTAGED_VENDORS, andif [ -n "$STAGED_VENDORS" ]gates the entire tidy block. For a commit that stages only compiled output (the normaladf compile --writeflow), main skips tidy and thegit add .ai/*.adfre-stage entirely. With the grep removed, that commit would run a whole-tree tidy and sweep unrelated unstaged.ai/*.adfedits (and newly extracted modules) into the commit — reproduced with a scratch repo.#336 keeps the grep, rewrites the misleading comment in both copies to say what it actually does, and adds a test pinning the grep's presence and the parity between
.githooks/pre-commitand the hookcharter hook installgenerates.Leaving this open for option 2 (pass
--sourceper staged vendor file and re-stage only modules tidy changed), which would also fix the over-staging main already does when a non-compiled vendor file is staged. That's a behavior change worth a deliberate design pass rather than an auto-loop fix.fix(hook): document why the compiled-file skip gates tidy, pin hook p…
fix(hook): never abort on staging; explain skipped tidy and gate bloc…