MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / write_json_object

Function write_json_object

atomic-agent/src/hooks/manifest.rs:272–291  ·  view source on GitHub ↗
(path: &Path, root: &Map<String, Value>)

Source from the content-addressed store, hash-verified

270}
271
272fn write_json_object(path: &Path, root: &Map<String, Value>) -> AgentResult<()> {
273 if let Some(parent) = path.parent() {
274 std::fs::create_dir_all(parent).map_err(|e| AgentError::ConfigError {
275 operation: "create directory".to_string(),
276 path: parent.to_path_buf(),
277 reason: e.to_string(),
278 })?;
279 }
280 let mut content = serde_json::to_string_pretty(root).map_err(|e| AgentError::ConfigError {
281 operation: "serialize".to_string(),
282 path: path.to_path_buf(),
283 reason: e.to_string(),
284 })?;
285 content.push('\n');
286 std::fs::write(path, content).map_err(|e| AgentError::ConfigError {
287 operation: "write".to_string(),
288 path: path.to_path_buf(),
289 reason: e.to_string(),
290 })
291}
292
293/// Command-carrying keys across agent schemas: Claude/Codex/Cursor use
294/// `command`; Copilot uses `bash`/`powershell`.

Callers 3

install_from_manifestFunction · 0.85
uninstall_from_manifestFunction · 0.85
uninstall_prefixedFunction · 0.85

Calls 3

writeFunction · 0.85
parentMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected