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

Method write_settings

atomic-agent/src/hooks/gemini_cli.rs:345–373  ·  view source on GitHub ↗

Write settings back to `.gemini/settings.json`.

(
        settings_path: &Path,
        raw: &serde_json::Map<String, serde_json::Value>,
    )

Source from the content-addressed store, hash-verified

343
344 /// Write settings back to `.gemini/settings.json`.
345 fn write_settings(
346 settings_path: &Path,
347 raw: &serde_json::Map<String, serde_json::Value>,
348 ) -> AgentResult<()> {
349 // Ensure parent directory exists
350 if let Some(parent) = settings_path.parent() {
351 if !parent.exists() {
352 std::fs::create_dir_all(parent).map_err(|e| AgentError::ConfigError {
353 operation: "create directory".to_string(),
354 path: parent.to_path_buf(),
355 reason: e.to_string(),
356 })?;
357 }
358 }
359
360 let content = serde_json::to_string_pretty(raw).map_err(|e| AgentError::ConfigError {
361 operation: "serialize".to_string(),
362 path: settings_path.to_path_buf(),
363 reason: e.to_string(),
364 })?;
365
366 std::fs::write(settings_path, content.as_bytes()).map_err(|e| AgentError::ConfigError {
367 operation: "write".to_string(),
368 path: settings_path.to_path_buf(),
369 reason: e.to_string(),
370 })?;
371
372 Ok(())
373 }
374
375 /// Install hooks into a settings file (project or global).
376 fn install_to(settings_path: &Path, force: bool) -> AgentResult<usize> {

Callers

nothing calls this directly

Calls 4

writeFunction · 0.85
parentMethod · 0.80
existsMethod · 0.45
as_bytesMethod · 0.45

Tested by

no test coverage detected