docs(reference): fix contradictions and document the hooks#37
Merged
Conversation
reference.md calls itself "a per-file, per-module map of what the codebase
does." It documented neither the seven hooks nor the two test files that cover
them, and it contradicted the code in three places.
Contradictions:
- Marked `.mcp.json`, `.cursor/mcp.json`, and `opencode.json` "Do not edit."
Sync writes them when MCP sources exist and never deletes them (D20); they may
carry the user's own servers. protect-generated-dirs deliberately allows
editing them. Three files disagreed about whether you may touch them.
- "Wipe the entire .cursor/ directory. Cursor stores no per-user state in this
tree." That belief is what deleted .cursor/environment.json on every sync until
the previous commit fixed it.
- Listed `hooks/<name>.{sh,js}`. All seven hooks are .js; there has never been a
.sh hook.
Staleness:
- Test inventory listed five files and the CI section claimed "98 unit tests."
Seven files, 243 cases. Adds sections for the two hook test files, including
why they spawn a child process instead of importing a function.
- The .claude/ wipe list omitted .claude/hooks/, which syncClaude does wipe.
- The inventory had no row for LICENSE, SECURITY.md, CODE_OF_CONDUCT.md,
release.yml, dependabot.yml, or the PR and issue templates, and no row for the
per-user state each harness keeps at the top of its directory.
Adds a Hook reference section: the process contract (JSON on stdin, exit 0
allow / 2 block, fail open), the fact that sync copies hooks but nothing enables
them, that none inspects tool_name because the settings.json matcher routes
them, and a table of what each blocks -- including the boundaries each
deliberately does not cross.
Every figure verified against the tree: 243 tests, 49 and 96 cases in the two
hook files, the permissions block on each workflow, and all 11 rmGenerated calls
against the four per-adapter wipe lists.
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.
Why
docs/reference.mdopens by calling itself:It documented neither the seven hooks nor the two test files that cover them, and it contradicted the code in three places.
Contradictions
1. "Do not edit" on three files sync deliberately preserves.
Three files disagreed about whether you may touch
.mcp.json,.cursor/mcp.json, andopencode.json. They are written when MCP sources exist, never deleted, and may carry your own servers.2. "Wipe the entire
.cursor/directory. Cursor stores no per-user state in this tree."That sentence is the bug fixed in the previous PR. It deleted
.cursor/environment.jsonon every sync.3.
hooks/<name>.{sh,js}— all seven hooks are.js. There has never been a.shhook.Staleness
.claude/wipe list omitted.claude/hooks/, whichsyncClaudedoes wipe.LICENSE,SECURITY.md,CODE_OF_CONDUCT.md,release.yml,dependabot.yml, the PR template, or the issue forms.New: a Hook reference section
Seven executable guards, previously absent from the map. Documents the process contract (JSON on stdin, exit
0allow /2block, stderr surfaces to Claude, fail open on malformed input), that sync copies hooks but nothing enables them, that none inspectstool_namebecause thesettings.jsonmatcherdoes the routing, and a table of what each blocks — including the lines each deliberately does not cross (rm -rf ./buildis fine; a feature branch may be force-pushed).Plus a Release-workflow section recording the two facts that are easy to get wrong: a tag push runs the workflow as it existed at the tagged commit, and only the
chore(sync): regenerate harness outputs for Xcommit is sync-clean — thechore(release): Xcommit bumps the version before the output is regenerated.Verification
Every figure checked against the tree, not from memory:
All 7 newly-referenced files exist. The one in-page anchor (
#hook-reference) resolves. And all 11rmGeneratedcalls were diffed against the four per-adapter wipe lists — they now agree line for line.Docs-only — no source or generated output changes.