Install hooks globally to the agent's user-level settings. Supports: - `claude-code` → `~/.claude/settings.json` - `gemini-cli` → `~/.gemini/settings.json` - `codex` → `~/.codex/hooks.json` agy is intentionally absent: its plugin is inherently global and is installed by the integrations engine via the standard `enable` path.
(&self)
| 440 | /// agy is intentionally absent: its plugin is inherently global and is |
| 441 | /// installed by the integrations engine via the standard `enable` path. |
| 442 | fn run_global(&self) -> CliResult<()> { |
| 443 | use atomic_agent::hooks::claude_code::ClaudeCodeHook; |
| 444 | use atomic_agent::hooks::codex::CodexHook; |
| 445 | use atomic_agent::hooks::gemini_cli::GeminiCliHook; |
| 446 | |
| 447 | let agent_name = self.agent.as_deref().unwrap_or("claude-code"); |
| 448 | |
| 449 | match agent_name { |
| 450 | "claude-code" => { |
| 451 | let hook = ClaudeCodeHook::new(); |
| 452 | |
| 453 | if !self.force && hook.is_installed_global() { |
| 454 | print_success("Global hooks already installed in ~/.claude/settings.json."); |
| 455 | println!(" Use --force to reinstall."); |
| 456 | return Ok(()); |
| 457 | } |
| 458 | |
| 459 | match hook.install_global(self.force) { |
| 460 | Ok(count) if count > 0 => { |
| 461 | print_success(&format!( |
| 462 | "Installed {} global hook{} for Claude Code", |
| 463 | count, |
| 464 | if count == 1 { "" } else { "s" }, |
| 465 | )); |
| 466 | println!(); |
| 467 | println!("Hooks written to: ~/.claude/settings.json"); |
| 468 | println!(); |
| 469 | println!("Every Claude Code session in a project with .atomic/ will now:"); |
| 470 | println!(" • Record each turn as an Atomic change with full provenance"); |
| 471 | println!(" • Track session metadata (turn number, timing, files)"); |
| 472 | println!(" • Create attestations at session end"); |
| 473 | } |
| 474 | Ok(_) => { |
| 475 | print_success("Global hooks already up to date."); |
| 476 | } |
| 477 | Err(e) => { |
| 478 | print_error(&format!("Failed to install global hooks: {}", e)); |
| 479 | } |
| 480 | } |
| 481 | } |
| 482 | |
| 483 | "gemini-cli" => { |
| 484 | let hook = GeminiCliHook::new(); |
| 485 | |
| 486 | if !self.force && hook.is_installed_global() { |
| 487 | print_success("Global hooks already installed in ~/.gemini/settings.json."); |
| 488 | println!(" Use --force to reinstall."); |
| 489 | return Ok(()); |
| 490 | } |
| 491 | |
| 492 | match hook.install_global(self.force) { |
| 493 | Ok(count) if count > 0 => { |
| 494 | print_success(&format!( |
| 495 | "Installed {} global hook{} for Gemini CLI", |
| 496 | count, |
| 497 | if count == 1 { "" } else { "s" }, |
| 498 | )); |
| 499 | println!(); |
no test coverage detected