chore(hooks): rebuild dist before pre-commit tests#23
Merged
Conversation
The pre-commit hook ran test:fast, which skips the build step, so tests ran against a stale dist/ — green-or-red on code that wasn't being committed (e.g. a stale templates command after #18-#20). The comment already claimed "build first" but nothing did. Switch to `npm test`, which rebuilds dist/ first. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Merged
renezander030
added a commit
that referenced
this pull request
Jun 3, 2026
Roll up the unreleased work into 0.8.0 and backfill the missing 0.7.0 changelog section. 0.8.0 — global --dry-run (#15), restore (#16), shell completions (#18-20), track-order fix (#21), pre-commit dist rebuild (#23), docs + CONTRIBUTING. Adds CONTRIBUTING.md. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The pre-commit hook ran
npm run test:fast, which runsnode --testwithout building. So the suite tested whatever was indist/from a previous build, not the code being committed. The hook comment even claimed "Build first so dist/ matches src/" — but nothing did.Symptom seen in practice: after the shell-completions work (#18–#20) added new templates, a stale
dist/madeshowTemplates.test.mjsreport failures on an unrelated commit, even though a fresh build is fully green.Fix
Use
npm test, which runstsc(+ copiesenums.json) beforenode --test, sodist/always matchessrc/when the gate runs.Verification
Committing this change exercised the updated hook itself: it built and ran the full suite (124/124 pass, ~10s) before the commit was allowed.
🤖 Generated with Claude Code