Repository navigation
fix(use): apply the use command audit findings - #4254
Merged
Merged
Conversation
The sync inside use kept .mcp.json as .mcp.json.bak and warned that it overwrote a hand edit, though the import one step earlier had read every server and the new file differed only in spacing and key order. use now tells its sync pass which tools it imported. An MCP file one of them read whose JSON equals what the pass writes is no longer backed up or reported. A file the import read in another form, and an edit made to a generated file before the run, are still kept and reported. sync and import run on their own are unchanged. Related to #4188
A location over 22 characters pushed the names against it with one space, and a kind with one spec showed its file where other tools showed the folder. While use runs, the location column is as wide as the longest location of the tool, and the only file inside a tool's kind folder is shown as that folder. The table a sync prints on its own keeps its layout until the sync audit decides on it. Related to #4188
A refused import printed 'added claude to targets' and then took claude out again, with the rollback note in brackets at the end of a long line. The added line is now printed after the import, and names only the tools that stay in targets. The rollback note keeps its words and is the last line of the error on its own. Related to #4188
The already in use line said 'what it reads' for a list of tools. Related to #4188
A quiet use left its tools out of the state file's listed set, so the next run about another tool printed their 'now reads' block as if it had just set them up. A quiet use that adds a tool now records the targets as listed. A quiet sync on its own still leaves the list for the next sync. Related to #4188
The short help read as if use launched the tool, and the long help did not say that the sync replaces native files or that a run without a terminal git-ignores generated files. An unknown tool printed fix text about sync -t and external adapters, which use does not take. The help now names the files that change and the tools use takes. An unknown name lists those tools and points at use --help. The error no longer carries the AAI-301 code, whose fix text is written for sync. Related to #4188
Adds the changelog entry and updates the use section of the CLI reference for the output changes. Related to #4188
use dropped an imported MCP file from the edit guard once its JSON compared equal, so an edit saved between that comparison and the write was replaced with no backup. The path now stays in the guard with the sum of the bytes that were compared. The write keeps a .bak and reports the edit when the bytes on disk are no longer those. Related to #4188
The comparison used the render of the first target that writes the path. With collision-policy prefer-spec the sync writes the last target's render, so a file that matched only the losing render lost its backup. The backup is now skipped only when every target that writes the path renders the same whole file. Related to #4188
Decoding collapses a key named twice to its last value, so a file with two definitions under one server name compared equal to the new file and lost its backup, and with it the first definition. A document that repeats a key in any object now equals nothing, so its backup and the report stay. Related to #4188
The importer lookup knew the fixed MCP paths only. Antigravity's file is resolved from the config, so use still kept a .bak and reported a hand edit for a file it had just imported. The lookup now also matches Antigravity's file, at its default path or the one outputs.antigravity.mcp-file sets, as mcpKeepStep does. Related to #4188
The unknown-tool error had lost its released code so that the registry's fix text, written for sync, would not print. A script may match the code, so it is back. The message keeps the list of tools use takes, and the fix text stays as main prints it until an error can bring its own. Related to #4188
A package variable switched the aligned table on while use ran. The layout is now an argument of printToolReads, which use sets itself and hands to its sync pass as an option. A sync run on its own passes false and keeps its layout. Related to #4188
Decoding replaces invalid UTF-8 and an unpaired surrogate escape with U+FFFD. A file with such a value compared equal to the new file, so use wrote over the only copy of the original text. A document that is not valid UTF-8, or holds any surrogate escape, now equals nothing, so its backup and the report stay. Related to #4188
With outputs.antigravity.mcp-file set to .mcp.json and Claude no target, the lookup answered claude from the fixed-path table before it checked Antigravity's file. The file Antigravity had just imported then kept a .bak and was reported as a hand edit. The check now asks whether any tool imported in this run reads the path. Related to #4188
A quiet use marked every configured target as listed, so the list an earlier quiet sync had left for another tool was never shown. It now marks only the targets that were not configured before the run: the named tools, and on a new project the detected ones too. Related to #4188
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.
Outcome
Fixes six findings of the
usecommand audit. The seventh asks for a new--dry-runflag and is left for a decision.useno longer warns "overwrote a hand edit" about a file its own import just read. A hand edit made before the run is still reported and still backed up.usetakes, and the help says whatusewrites.Decisions
syncandimportrun on their own print what they printed before.AAI-301code and its fix line.Review
-t. Changing it needs the shared error text, which another open change edits.--dry-runflag the issue asks for, since it is a new flag.Checks
macOS arm64, Go 1.27.4.
make ci-local: ok.TestUse_DoesNotCallItsOwnImportAHandEdit,TestUse_StillReportsAHandEditMadeBeforeTheRun,TestUse_KeepsABackupWhenTheImportChangedTheServers,TestPrintToolReads_NamesShareAColumnWithALongLocation,TestPrintToolReads_OneSpecShowsItsFolder,TestPrintToolReads_SyncKeepsItsLayout,TestUse_ARefusedImportDoesNotSayItAddedTheTool,TestUse_SaysItAddedTheToolOnceTheImportPassed,TestUse_AlreadyInUseCountsTheTools,TestUse_AQuietRunIsNotAnnouncedByALaterRun,TestUse_AQuietStartIsNotAnnouncedByALaterRun,TestSync_AQuietSyncStillLeavesTheListForTheNextOne,TestUse_AnUnknownToolListsTheToolsItTakes,TestUse_AMistypedToolSuggestsWithoutSyncAdvice,TestUse_HelpSaysWhatItWrites,TestUse_KeepsAnEditSavedBetweenTheComparisonAndTheWrite,TestImportedMCPBaselines_KeepsTheBackupWhenOnlyTheLosingRenderMatches,TestUse_KeepsABackupOfAnMCPFileWithADuplicateServerName,TestUse_KeepsABackupOfAnMCPFileWithTextThatIsNotUnicode,TestUse_DoesNotCallAnImportedAntigravityMCPFileAHandEdit,TestUse_AMistypedToolKeepsItsCode,TestUse_AQuietRunKeepsTheListAnEarlierQuietSyncLeft.Related to #4188