test(claude): extract uninstallMcpServer + cover the file-deletion edge cases#629
Merged
NagyVikt merged 2 commits intoJun 5, 2026
Conversation
added 2 commits
June 5, 2026 14:06
…mcp.json
The gx mcp agent radar only helps if agents have it registered; manual
`claude mcp add` per machine meant nobody turned it on. Now `gx claude install`
wires it into the repo alongside settings/hooks/commands.
- installMcpServer merges { mcpServers.gx: { command: gx, args: [mcp, serve] } }
into the target .mcp.json without clobbering other servers; idempotent.
- --no-mcp opts out.
- gx claude check warns when missing; doctor (check --fix) repairs via install.
- gx claude uninstall removes the gx server (drops .mcp.json if only ours).
- AGENTS.md repo-wiring bullet + usage updated.
Tests: 4 new (create/merge/idempotent/dry-run) in claude-install.test.js, 18/18;
no-new-failures vs base.
…ge cases
Addresses review note: the uninstall path (the error-prone 'delete file only if
it held nothing but ours' guard) had no coverage. Extracted uninstallMcpServer
so it is unit-testable; added 4 tests including the {$schema, mcpServers:{gx}}
case where an unrelated top-level key must block file deletion. 22/22 pass.
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.
Automated by gx branch finish (PR flow).