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

Function write_json_object

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

Source from the content-addressed store, hash-verified

232}
233
234fn write_json_object(path: &Path, root: &Map<String, Value>) -> AgentResult<()> {
235 if let Some(parent) = path.parent() {
236 std::fs::create_dir_all(parent).map_err(|e| AgentError::ConfigError {
237 operation: "create directory".to_string(),
238 path: parent.to_path_buf(),
239 reason: e.to_string(),
240 })?;
241 }
242 let mut content = serde_json::to_string_pretty(root).map_err(|e| AgentError::ConfigError {
243 operation: "serialize".to_string(),
244 path: path.to_path_buf(),
245 reason: e.to_string(),
246 })?;
247 content.push('\n');
248 std::fs::write(path, content).map_err(|e| AgentError::ConfigError {
249 operation: "write".to_string(),
250 path: path.to_path_buf(),
251 reason: e.to_string(),
252 })
253}
254
255/// Command-carrying keys across agent schemas: Claude/Codex/Cursor use
256/// `command`; Copilot uses `bash`/`powershell`.

Callers 2

install_from_manifestFunction · 0.85
uninstall_from_manifestFunction · 0.85

Calls 3

writeFunction · 0.85
parentMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected