fix(init): --hook installs hooks, and an absent MCP server is not a fault - #772
Merged
Conversation
…ault The flag has said 'Only install hooks' since it shipped and installed the MCP server too, which is #151 wearing a different name: the parser accepts a flag the code ignores. Then doctor called the state that flag produced a broken install, and doctor --fix undid it. Three ways of overruling a choice the CLI offered. On Claude Code the hooks are what shortens output. The MCP server is a convenience whose two tool definitions sit in the prefix of every request, and the host discards the whole prompt cache when an MCP server connects or disconnects with its tools loaded, so wanting one without the other is an ordinary preference. The decision is a function rather than a condition inline at the dispatch, because the table is what was wrong and a table can be tested. Closes #757
#740 had to tell readers to delete a line from ~/.claude.json and warn them it would not stick. omni init --hook does it, doctor reports the result instead of failing on it, and nothing puts it back.
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.
omni init --hookhas read "Only install hooks" since it shipped and registered the MCPserver as well. The parser accepted the flag and the code ignored it, which is #151 wearing
a different name. Then
omni doctorcalled the state that flag produces a broken installand pushed
MCP Server is not configured. Run omni init, andomni doctor --fixreinstalled it. Three ways of overruling a choice the CLI offered in the first place.
--hookand--mcpnow install the half they name. Naming the host, naming both halves,or naming neither still installs both, which is the table:
--hook--mcp--hook --mcp--claude,--all, or neitherAn absent MCP registration on Claude Code is now reported as what it is rather than as a
fault, and
--fixdoes not repair what nobody broke. That is not leniency: on this host thehooks are what shortens output, while the MCP server is a convenience whose two tool
definitions sit in the prefix of every request, and the host discards the whole prompt
cache when an MCP server connects or disconnects with its tools loaded (#740). Wanting one
without the other is an ordinary preference.
docs/websitein both trees stops telling readers to delete a line from~/.claude.jsonand warning them it will not stick, since there is a flag now.
The first test I wrote was toothless and is not in this PR. It asserted that the hooks
half leaves
mcpServersout ofsettings.json, which was already true onmainbecausethe MCP registration lives in a different file. The decision is a function now,
claude_halves, and the test is the table above. Break-tested: forcing it to answer(true, true)fails atclaude_halves(false, false, true, false) has to be (true, false).Verification:
make cigreen,smoke_test.sh70/70,check_translations.shgreen.Closes #757
Greptile Summary
This PR separates Claude hook and MCP installation so
--hookand--mcpcan install only their named half, and makes an absent Claude MCP registration informational rather than unhealthy.Confidence Score: 4/5
The PR should not merge until Claude hook repair preserves a hooks-only installation instead of restoring the optional MCP server.
The primary init path correctly separates the two installation halves, but every Claude hook-repair path still calls the full installer and therefore reverses the new hooks-only choice.
Files Needing Attention: src/agents/claude.rs
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[omni init flags] --> B{Claude halves} B -->|hook only| C[Install Claude hooks] B -->|MCP only| D[Register MCP server] B -->|both| E[Full Claude installer] F[omni doctor --fix] --> G{Hooks need repair?} G -->|yes| E E --> C E --> DComments Outside Diff (1)
src/agents/claude.rs, line 177 (link)When a hooks-only installation has missing hooks and the user runs
omni doctor --fix, this branch calls the fullinstall()method, which also registers the MCP server, causing.claude.jsonto regain the entry that--hookwas intended to omit. The other hook-repair branches have the same behavior.Knowledge Base Used:
Prompt To Fix With AI
Prompt To Fix All With AI
Reviews (1): Last reviewed commit: "docs(manual): the hooks-only route is a ..." | Re-trigger Greptile
Context used (3)