Repository navigation
feat(status,update): report upstream hooks missing from settings.json (PHARN-04) - #198
Merged
Merged
Conversation
… (PHARN-04) Upstream re-wired its hooks twice (6.1.0 anchored both guards on CLAUDE_PROJECT_DIR because the relative form was silently off after a cd; 6.12.0 added an exec-form Stop hook). `update` installed the new hook scripts but never looks at settings.json (user-owned, never overwritten), and `status --strict` stayed green — so existing installs kept dead or broken wiring with no signal at all. New lib/hook-wiring.ts compares the `hooks` block of the project's settings.json with the fetched upstream one (exact Event/matcher/command/args set difference; both files size-capped, symlink-refused, parsed as data): - `status` prints a HOOKS section and `--strict` exits 1 while an upstream hook is unwired (extra user hooks never count); - `update` prints the same HOOKS note — and still never writes the file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TvcuVhk8hTeDskp5pAJhnc
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
What this changes
Upstream
pharn-osschanged its hook wiring twice:CLAUDE_PROJECT_DIR. The old relative commands stopped running after acdinto a subdirectory, silently.Stophook.updateinstalls the new hook scripts but never looks at.claude/settings.json, which is user-owned and never overwritten. Reproduced going from 6.0.0 to 6.17.1:settings.jsonwas byte-identical afterwards, with the old relative commands and noStophook.status --strictstill exited 0 with "No drift", so existing installs kept outdated hook wiring with no warning.New module
src/lib/hook-wiring.ts(diffHookWiring) compares thehooksblock of the project'ssettings.jsonwith the upstream one:How the commands use it:
status: a newHOOKSsection;--strictexits 1 while any upstream hook is not wired.update: prints the sameHOOKSnote, and still never writessettings.json.docs/commands/status.md,docs/commands/update.mdandCLAUDE.mdupdated.Built with
/pharn-dev-ship; stage artifacts are in.dev/features/hook-wiring-drift/. Results:no-regressionsPASSType of change
feat— new stack option, wizard step, or command capabilityfix— bug fixdocs— docs-only changechore/refactor— tooling or internal restructure, no behavior changeArea(s) touched
lib/hook-wiring (new) | commands/status, update | docs
Checklist
.js-extension import convention.tests/hook-wiring.test.ts(13 cases) and new cases instatusandupdatetests. The command-level cases fail on the old source.docs/pages.Quality gates
npm run checkpasses locally (1321/1321; non-root user, node 22).npm run buildsucceeds (left to CI).npm run test:coveragepasses (left to CI).Notes for the reviewer
status --strictnow goes red for any install whosesettings.jsonpredates upstream's hook changes, until the user merges the hooks by hand. This is intended, but CI pipelines that run--strictwill notice.updateonly shows the note on runs that fetch upstream; when it is already up to date it does not fetch, sostatusis the command that always checks.🤖 Generated with Claude Code
https://claude.ai/code/session_01TvcuVhk8hTeDskp5pAJhnc
Generated by Claude Code