Remove hooks from global agent settings. Supports: - `claude-code` → `~/.claude/settings.json` - `gemini-cli` → `~/.gemini/settings.json` - `agy` → `~/.gemini/config/plugins/atomic/` (plugin) - `codex` → `~/.codex/hooks.json` - No `--agent` flag → removes from all agents that have global hooks
(&self)
| 267 | /// - `codex` → `~/.codex/hooks.json` |
| 268 | /// - No `--agent` flag → removes from all agents that have global hooks |
| 269 | fn run_global(&self) -> CliResult<()> { |
| 270 | use atomic_agent::hooks::claude_code::ClaudeCodeHook; |
| 271 | use atomic_agent::hooks::codex::CodexHook; |
| 272 | use atomic_agent::hooks::gemini_cli::GeminiCliHook; |
| 273 | |
| 274 | let agents: Vec<&str> = if let Some(ref name) = self.agent { |
| 275 | vec![name.as_str()] |
| 276 | } else { |
| 277 | // No agent specified — check all supported agents |
| 278 | let mut found = Vec::new(); |
| 279 | if ClaudeCodeHook::new().is_installed_global() { |
| 280 | found.push("claude-code"); |
| 281 | } |
| 282 | if GeminiCliHook::new().is_installed_global() { |
| 283 | found.push("gemini-cli"); |
| 284 | } |
| 285 | // agy's global plugin is integration-installed; check its receipt. |
| 286 | if atomic_agent::integrations::Receipt::load("agy") |
| 287 | .map(|r| r.is_some()) |
| 288 | .unwrap_or(false) |
| 289 | { |
| 290 | found.push("agy"); |
| 291 | } |
| 292 | if CodexHook::new().is_installed_global() { |
| 293 | found.push("codex"); |
| 294 | } |
| 295 | found |
| 296 | }; |
| 297 | |
| 298 | if agents.is_empty() { |
| 299 | println!("No global hooks installed."); |
| 300 | return Ok(()); |
| 301 | } |
| 302 | |
| 303 | let mut total_removed = 0; |
| 304 | |
| 305 | for agent_name in &agents { |
| 306 | match *agent_name { |
| 307 | "claude-code" => { |
| 308 | let hook = ClaudeCodeHook::new(); |
| 309 | if !hook.is_installed_global() { |
| 310 | continue; |
| 311 | } |
| 312 | match hook.uninstall_global() { |
| 313 | Ok(()) => { |
| 314 | print_success("Removed global hooks from ~/.claude/settings.json"); |
| 315 | total_removed += 1; |
| 316 | } |
| 317 | Err(e) => { |
| 318 | print_error(&format!( |
| 319 | "Failed to remove Claude Code global hooks: {}", |
| 320 | e |
| 321 | )); |
| 322 | } |
| 323 | } |
| 324 | } |
| 325 | "gemini-cli" => { |
| 326 | let hook = GeminiCliHook::new(); |
no test coverage detected