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

Method uninstall_from

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

Uninstall hooks from a settings file.

(settings_path: &Path)

Source from the content-addressed store, hash-verified

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