fix(#954): wire setup-git-hooks into root postinstall#984
Merged
Conversation
Fresh contributors who clone + `npm install` at the repo root were silently bypassing the pre-commit gate. src/package.json had a postinstall that runs setup-git-hooks, but it only fires when running `npm install` from `src/` — a fresh contributor running `npm install` at the root never triggered it. Add a postinstall to root package.json that runs the same script. Idempotent (the script itself early-exits when not in a git checkout and is safe to re-run when hooks already exist). Output visible unlike src/'s suppressed variant — if hook setup fails the user sees the warning + the manual command, per never-swallow-errors. Smoke-tested locally: hook setup runs, installs pre-commit + pre-push, skips post-commit (target script intentionally absent). Co-Authored-By: Claude Opus 4.7 (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.
Fresh contributors who clone + `npm install` at the repo root were silently bypassing the pre-commit gate. `src/package.json` already had a postinstall that runs `setup-git-hooks`, but it only fires when running `npm install` from `src/` — a fresh contributor running `npm install` at the root never triggered it.
Add a `postinstall` to root `package.json` that runs the same script.
Why this works
Smoke-tested
```
$ bash src/scripts/setup-git-hooks.sh
📁 Installed: pre-commit pre-push
⏭️ Skipped (target script missing): post-commit
```
Closes #954.