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

Method uninstall_from

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

Uninstall hooks from a settings file.

(settings_path: &Path)

Source from the content-addressed store, hash-verified

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