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

Method run_global

atomic-cli/src/commands/agent/disable.rs:213–299  ·  view source on GitHub ↗

Remove hooks from global agent settings. Supports: - `claude-code` → `~/.claude/settings.json` - `gemini-cli` → `~/.gemini/settings.json` - No `--agent` flag → removes from all agents that have global hooks

(&self)

Source from the content-addressed store, hash-verified

211 /// - `gemini-cli` → `~/.gemini/settings.json`
212 /// - No `--agent` flag → removes from all agents that have global hooks
213 fn run_global(&self) -> CliResult<()> {
214 use atomic_agent::hooks::claude_code::ClaudeCodeHook;
215 use atomic_agent::hooks::gemini_cli::GeminiCliHook;
216
217 let agents: Vec<&str> = if let Some(ref name) = self.agent {
218 vec![name.as_str()]
219 } else {
220 // No agent specified — check all supported agents
221 let mut found = Vec::new();
222 if ClaudeCodeHook::new().is_installed_global() {
223 found.push("claude-code");
224 }
225 if GeminiCliHook::new().is_installed_global() {
226 found.push("gemini-cli");
227 }
228 found
229 };
230
231 if agents.is_empty() {
232 println!("No global hooks installed.");
233 return Ok(());
234 }
235
236 let mut total_removed = 0;
237
238 for agent_name in &agents {
239 match *agent_name {
240 "claude-code" => {
241 let hook = ClaudeCodeHook::new();
242 if !hook.is_installed_global() {
243 continue;
244 }
245 match hook.uninstall_global() {
246 Ok(()) => {
247 print_success("Removed global hooks from ~/.claude/settings.json");
248 total_removed += 1;
249 }
250 Err(e) => {
251 print_error(&format!(
252 "Failed to remove Claude Code global hooks: {}",
253 e
254 ));
255 }
256 }
257 }
258 "gemini-cli" => {
259 let hook = GeminiCliHook::new();
260 if !hook.is_installed_global() {
261 continue;
262 }
263 match hook.uninstall_global() {
264 Ok(()) => {
265 print_success("Removed global hooks from ~/.gemini/settings.json");
266 total_removed += 1;
267 }
268 Err(e) => {
269 print_error(&format!(
270 "Failed to remove Gemini CLI global hooks: {}",

Callers 1

runMethod · 0.45

Calls 7

print_successFunction · 0.85
print_errorFunction · 0.85
print_warningFunction · 0.85
is_installed_globalMethod · 0.45
pushMethod · 0.45
is_emptyMethod · 0.45
uninstall_globalMethod · 0.45

Tested by

no test coverage detected