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

Method uninstall_global

atomic-agent/src/hooks/claude_code/mod.rs:131–159  ·  view source on GitHub ↗

Remove hooks from the global `~/.claude/settings.json`.

(&self)

Source from the content-addressed store, hash-verified

129
130 /// Remove hooks from the global `~/.claude/settings.json`.
131 pub fn uninstall_global(&self) -> AgentResult<()> {
132 let settings_path = match Self::global_settings_path() {
133 Some(p) => p,
134 None => return Ok(()),
135 };
136
137 if !settings_path.exists() {
138 return Ok(());
139 }
140
141 let (mut raw, mut hooks) = settings::read_settings(&settings_path)?;
142
143 settings::remove_atomic_hooks(&mut hooks.session_start);
144 settings::remove_atomic_hooks(&mut hooks.session_end);
145 settings::remove_atomic_hooks(&mut hooks.stop);
146 settings::remove_atomic_hooks(&mut hooks.user_prompt_submit);
147 settings::remove_atomic_hooks(&mut hooks.pre_tool_use);
148 settings::remove_atomic_hooks(&mut hooks.post_tool_use);
149
150 let hooks_val = serde_json::to_value(&hooks).map_err(|e| AgentError::ConfigError {
151 operation: "serialize hooks".to_string(),
152 path: settings_path.clone(),
153 reason: e.to_string(),
154 })?;
155 raw.insert("hooks".to_string(), hooks_val);
156 settings::write_settings(&settings_path, &raw)?;
157
158 Ok(())
159 }
160
161 /// Check if hooks are installed globally in `~/.claude/settings.json`.
162 pub fn is_installed_global(&self) -> bool {

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected