MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / backup_and_write_json

Function backup_and_write_json

src/agents/mod.rs:729–732  ·  view source on GitHub ↗

Best-effort "back up and write" for uninstall paths. Mirrors the install pattern (`backup_config_file` then `safe_write_json_file`) but swallows errors so the rest of the uninstall can continue. Returns `true` when the new content reached disk. Issue #63: every config rewrite must leave a `.bak` so the user can recover if anything goes wrong.

(path: &Path, value: &serde_json::Value)

Source from the content-addressed store, hash-verified

727/// Issue #63: every config rewrite must leave a `.bak` so the user can
728/// recover if anything goes wrong.
729pub fn backup_and_write_json(path: &Path, value: &serde_json::Value) -> bool {
730 let backup = backup_config_file(path).ok().flatten();
731 safe_write_json_file(path, value, backup.as_deref()).is_ok()
732}
733
734/// Finds the tracedecay binary path.
735///

Callers 15

uninstall_cli_mcp_serverFunction · 0.85
uninstall_mcp_serverFunction · 0.85
uninstall_mcp_serverFunction · 0.85
uninstall_mcp_serverFunction · 0.85
uninstall_mcp_serverFunction · 0.85
uninstall_default_agentFunction · 0.85
uninstall_mcp_serverFunction · 0.85
uninstall_mcp_serverFunction · 0.85
migrate_remove_loose_mcpFunction · 0.85
migrate_remove_hooksFunction · 0.85

Calls 3

backup_config_fileFunction · 0.85
safe_write_json_fileFunction · 0.85
is_okMethod · 0.80

Tested by

no test coverage detected