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

Method uninstall_from

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

Uninstall hooks from a settings file.

(settings_path: &Path)

Source from the content-addressed store, hash-verified

446
447 /// Uninstall hooks from a settings file.
448 fn uninstall_from(settings_path: &Path) -> AgentResult<()> {
449 if !settings_path.exists() {
450 return Ok(());
451 }
452
453 let (mut raw, mut hooks) = Self::read_settings(settings_path)?;
454
455 remove_atomic_hooks(&mut hooks.session_start);
456 remove_atomic_hooks(&mut hooks.session_end);
457 remove_atomic_hooks(&mut hooks.before_agent);
458 remove_atomic_hooks(&mut hooks.after_agent);
459 remove_atomic_hooks(&mut hooks.before_tool);
460 remove_atomic_hooks(&mut hooks.after_tool);
461
462 let hooks_val = serde_json::to_value(&hooks).map_err(|e| AgentError::ConfigError {
463 operation: "serialize hooks".to_string(),
464 path: settings_path.to_path_buf(),
465 reason: e.to_string(),
466 })?;
467 raw.insert("hooks".to_string(), hooks_val);
468
469 Self::write_settings(settings_path, &raw)?;
470
471 Ok(())
472 }
473
474 /// Check if Atomic hooks are installed in a settings file.
475 fn is_installed_in(settings_path: &Path) -> bool {

Callers

nothing calls this directly

Calls 5

read_settingsFunction · 0.85
write_settingsFunction · 0.85
remove_atomic_hooksFunction · 0.70
existsMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected