Repository navigation
Add proofline agent remove to unregister the MCP server - #120
Open
stevyhacker wants to merge 1 commit into
Open
stevyhacker wants to merge 1 commit into
stevyhacker wants to merge 1 commit into
Conversation
`agent install` never replaces an existing proofline entry, so an entry that points at an old executable could only be fixed by editing the client's file by hand. `agent remove CLIENT` previews the entry and file, asks [y/N] (or takes --yes, or previews only with --print), and removes only the proofline server. JSON files lose exactly the member's bytes; Codex TOML is edited with toml_edit, so comments and layout stay. The write reuses the installer's lock, Git working-tree and symlink refusals, 1 MiB limit, change detection and atomic replace. When install finds an entry for another executable, it now names that path and suggests remove, then install.
This branch has not been deployed
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
proofline agent installnever changes an existingprooflineentry, and nothing removes one. If the entry starts an old executable, for example after moving from a source build to the installer,installsays the entry stays unchanged and the only fix is hand-editing~/.claude.jsonor~/.codex/config.toml. Anyone uninstalling Proofline has the same problem.What changes
proofline agent remove CLIENTpreviews the entry and its file, asks[y/N], and removes only theprooflineserver.--yesskips the prompt and--printpreviews without writing.installfinds an entry that starts a different executable, it names that path and suggestsagent removeand thenagent install.flowchart TD A["agent remove CLIENT"] --> B{"custom CLAUDE_CONFIG_DIR<br/>or CODEX_HOME?"} B -- yes --> X1["refuse, exit 1"] B -- no --> C["read the file with install's checks<br/>Git work tree, symlink, regular file, 1 MiB"] C -- fails --> X2["refuse, exit 1"] C --> D{"parses?"} D -- no --> X3["refuse, exit 1, file unchanged"] D -- yes --> E{"proofline entry?"} E -- no --> X4["nothing to remove, exit 0"] E -- yes --> F{"--print?"} F -- yes --> X5["print the entry, exit 0"] F -- no --> G{"y at the prompt, or --yes?"} G -- no --> X6["nothing written, exit 0"] G -- yes --> H["lock, re-read, compare with the preview"] H -- changed --> X7["refuse, exit 1"] H -- same --> W["temp file and atomic rename"] style W stroke-width:2pxWhat it looks like for an entry left by an older install:
Decisions
RawValues, so each value's position in the text is known. Remove cuts"proofline": {…}and the comma next to it and keeps every other byte, including indentation, key order and long numbers. Going throughserde_json::Valuewould round numbers like184467440737095516170, which an existing install test already guards.toml_edit. Comments, blank lines and other servers stay. A[mcp_servers.proofline.env]subtable goes with the entry. In an inline table the space before}is kept."mcpServers": {}or an empty[mcp_servers]is left in place, since remove only takes out what it was asked to.prooflineentry and nothing else. Tests plant a secret in another server and check it never reaches stdout, stderr or an error.CLAUDE_CONFIG_DIRrefuses even--print. The preview reads~/.claude.json, which Claude Code ignores while that variable is set. ACODEX_HOMEoutside~/.codexrefuses the same way./varand/private/varcount as the same file (the path issue behind test(agent): resolve recorded executable path before comparing #116).Layout::replacereuses the lock, change checks, temp file and atomic rename, and keeps file permissions.Layout::saveis unchanged. The[y/N]prompt moved into a sharedconfirm().installalready writesmcpServersback on one line when it adds an entry.How it was verified
Run on Linux (Ubuntu 24.04, toolchain 1.100.0 from
rust-toolchain.toml).cargo fmt --checkcargo clippy --locked --all-targets -- -D warningscargo test --lockedpre-commithook test intests/hooks.rs, ignored in the source)src/agent/tests.rstests/agent_remove.rscargo deny checkInstall-then-remove round trip with a temporary
HOMEand the built binary copied to$TMP/bin/proofline:config.tomlwith comments, a profile and another server~/.claude.jsonin Claude Code's own format, reformatted by Claude Code after install~/.claude.jsonremoved right after installmcpServersstays on the one line install wrote/opt/proofline-0.9/bin/prooflineCLAUDE_CONFIG_DIR,CODEX_HOME, symlinked file, home in a Git work treecmp)Not run on macOS or Windows.
Files
src/agent.rsremovesubcommand, sharedconfirm(), install hintsrc/agent/config.rssrc/agent/store.rsLayout::replacesrc/agent/tests.rstests/agent_remove.rs--yes,--printand the env refusalsREADME.md