fix(hooks): the HOOKS check reads what Claude Code reads and prints what can be pasted back - #222
Merged
Conversation
…hat can be pasted back - Reads the union of .claude/settings.json and .claude/settings.local.json (what Claude Code merges; user-level settings are never read). Hooks wired only locally are `local-only`: named in the note, not failing --strict (status.ts now gates on hookWiringFails, not on the note's presence). An unreadable project file is never guessed around. The "no PHARN hook is wired" claim is gone. - A symlinked project settings.json FILE is read through, as Claude Code does; a symlinked .claude/ and any upstream symlink are still refused. - Every settings file is opened O_NONBLOCK: a FIFO is refused instead of blocking status/update forever (test runs in a child with a timeout). - Each missing hook prints as the hook's own JSON under `Event [matcher]`, so exec form (command + args) and shell form differ and a pasted line satisfies the check (round trip tested, and verified on the real upstream settings.json). C0/C1/Cf characters and U+2028/2029 become \u JSON escapes; each line is capped at 300 characters. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0199owRmYfskqYQVQrVP679o
|
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 |
11 tasks
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
Plan D of the second batch from the PHARN-01..18 review, shipped through
/pharn-dev-ship. It covers findings F15, F16, F17 and F18, plus thestatus --stricthalf of F8..claude/settings.jsonand.claude/settings.local.json, which is what Claude Code merges. User-level settings are never read.local-onlystatus. The note names them ("they run for you, not for teammates or CI"), but they do not fail--strict.status.tsnow gates onhookWiringFails(diff)instead of on whether a note exists.unreadable, and the note names the file.settings.jsonfile (dotfiles) is now read through, as Claude Code does. A symlinked.claude/directory and any upstream symlink are still refused.O_NONBLOCK, andfstatrefuses non-regular files. A FIFO can no longer blockstatusorupdateforever. The test runs in a child with a hard timeout, so a regression fails fast instead of hanging CI.Event [matcher]:settings.json.\uXXXXJSON escapes, so the JSON still parses back to the exact upstream string. Each line is capped at 300 characters.Type 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
src/lib/hook-wiring.ts·src/commands/status.ts· tests ·docs/commands/status.md,docs/commands/update.md· CLAUDE.md · CHANGELOG ·.dev/features/hook-wiring-truth/Checklist
.js-extension import convention.docs/pages.Quality gates
npm run checkpasses locally (format:check+lint+typecheck+test) — 1568 tests.npm run buildsucceeds.npm run test:coveragepasses (coverage thresholds met).Notes for the reviewer
validateexit 0, regressno-regressions, verifyPASS, review GREEN with 2 minor advisory findings (.dev/features/hook-wiring-truth/REVIEW.md).settings.jsonrefused byinit) ships with plan B.🤖 Generated with Claude Code
https://claude.ai/code/session_0199owRmYfskqYQVQrVP679o
Generated by Claude Code