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

Function write_json_file

src/agents/mod.rs:714–719  ·  view source on GitHub ↗

Write a JSON value to a file with pretty formatting. Creates a backup, writes atomically, and restores on failure.

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

Source from the content-addressed store, hash-verified

712/// Write a JSON value to a file with pretty formatting.
713/// Creates a backup, writes atomically, and restores on failure.
714pub fn write_json_file(path: &Path, value: &serde_json::Value) -> Result<()> {
715 let backup = backup_config_file(path)?;
716 safe_write_json_file(path, value, backup.as_deref())?;
717 eprintln!("\x1b[32m✔\x1b[0m Wrote {}", path.display());
718 Ok(())
719}
720
721/// Best-effort "back up and write" for uninstall paths.
722///

Callers 5

installMethod · 0.85
update_pluginMethod · 0.85
register_marketplaceFunction · 0.85
test_write_json_fileFunction · 0.85

Calls 2

backup_config_fileFunction · 0.85
safe_write_json_fileFunction · 0.85

Tested by 2

test_write_json_fileFunction · 0.68