fix: harden the bundle lifecycle per code review
The path-escape guard that uninstall applies to recorded paths now also covers update's obsolete-file deletion through a shared check, so a tampered store cannot turn either delete site into an arbitrary file removal. Updates gain a working non-interactive path: --yes now applies to --update-bundle (locally modified files, obsolete files, and modified mcp entries are all kept; everything else refreshes), owned mcp entries whose recorded hash still matches the local entry take the remote side without prompting, and the non-TTY conflict bails name the flag that actually works per surface. An update records its new commit and version only after files and mcp entries land, so an aborted update cannot claim content it never wrote. The store gains a version field and rejects stores from newer builds, the corrupt-store error no longer advises the removal that would forfeit ownership tracking, and duplicate records tracking one source abort a rename instead of overwriting a record. Reinstalling from a source URL reclassifies owned unmodified files as silent refreshes just like updates. git runs with GIT_TERMINAL_PROMPT=0 and a null stdin so private or mistyped URLs fail instead of hanging. File comparison fills buffers fully before comparing, deleting an obsolete file prunes emptied directories, mcp.json backfill uses the fsynced atomic writer, --list-bundles no longer triggers builtin backfill, bundle-name completion logs store errors instead of swallowing them and offers --yes, and REPL .uninstall rejects unknown flags.
This commit is contained in:
+2
-3
@@ -493,9 +493,8 @@ impl Functions {
|
||||
|
||||
let serialized =
|
||||
serde_json::to_string_pretty(&merged).context("failed to serialize merged mcp.json")?;
|
||||
let tmp = file_path.with_extension("json.tmp");
|
||||
fs::write(&tmp, &serialized).context("failed to write temporary mcp.json")?;
|
||||
fs::rename(&tmp, &file_path).context("failed to finalize mcp.json")?;
|
||||
write_file_atomic(&file_path, &serialized, None)
|
||||
.context("failed to write merged mcp.json")?;
|
||||
|
||||
if !added.is_empty() {
|
||||
println!(" + new MCP servers: {}", added.join(", "));
|
||||
|
||||
Reference in New Issue
Block a user