Skip to content

chore(hooks): rebuild dist before pre-commit tests#23

Merged
renezander030 merged 1 commit into
masterfrom
fix/precommit-stale-dist
Jun 3, 2026
Merged

chore(hooks): rebuild dist before pre-commit tests#23
renezander030 merged 1 commit into
masterfrom
fix/precommit-stale-dist

Conversation

@renezander030
Copy link
Copy Markdown
Owner

Problem

The pre-commit hook ran npm run test:fast, which runs node --test without building. So the suite tested whatever was in dist/ 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/ made showTemplates.test.mjs report failures on an unrelated commit, even though a fresh build is fully green.

Fix

Use npm test, which runs tsc (+ copies enums.json) before node --test, so dist/ always matches src/ 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

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>
@renezander030 renezander030 merged commit cf10bca into master Jun 3, 2026
4 checks passed
@renezander030 renezander030 deleted the fix/precommit-stale-dist branch June 3, 2026 09:22
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>
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.

1 participant