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)
| 511 | /// agy is intentionally absent: its plugin is inherently global and is |
| 512 | /// installed by the integrations engine via the standard `enable` path. |
| 513 | fn run_global(&self) -> CliResult<()> { |
| 514 | use atomic_agent::hooks::claude_code::ClaudeCodeHook; |
| 515 | use atomic_agent::hooks::codex::CodexHook; |
| 516 | use atomic_agent::hooks::gemini_cli::GeminiCliHook; |
| 517 | |
| 518 | let agent_name = self.agent.as_deref().unwrap_or("claude-code"); |
| 519 | |
| 520 | match agent_name { |
| 521 | "claude-code" => { |
| 522 | let hook = ClaudeCodeHook::new(); |
| 523 | |
| 524 | if !self.force && hook.is_installed_global() { |
| 525 | print_success("Global hooks already installed in ~/.claude/settings.json."); |
| 526 | println!(" Use --force to reinstall."); |
| 527 | return Ok(()); |
| 528 | } |
| 529 | |
| 530 | match hook.install_global(self.force) { |
| 531 | Ok(count) if count > 0 => { |
| 532 | print_success(&format!( |
| 533 | "Installed {} global hook{} for Claude Code", |
| 534 | count, |
| 535 | if count == 1 { "" } else { "s" }, |
| 536 | )); |
| 537 | println!(); |
| 538 | println!("Hooks written to: ~/.claude/settings.json"); |
| 539 | println!(); |
| 540 | println!("Every Claude Code session in a project with .atomic/ will now:"); |
| 541 | println!(" • Record each turn as an Atomic change with full provenance"); |
| 542 | println!(" • Track session metadata (turn number, timing, files)"); |
| 543 | println!(" • Create attestations at session end"); |
| 544 | } |
| 545 | Ok(_) => { |
| 546 | print_success("Global hooks already up to date."); |
| 547 | } |
| 548 | Err(e) => { |
| 549 | print_error(&format!("Failed to install global hooks: {}", e)); |
| 550 | } |
| 551 | } |
| 552 | } |
| 553 | |
| 554 | "gemini-cli" => { |
| 555 | let hook = GeminiCliHook::new(); |
| 556 | |
| 557 | if !self.force && hook.is_installed_global() { |
| 558 | print_success("Global hooks already installed in ~/.gemini/settings.json."); |
| 559 | println!(" Use --force to reinstall."); |
| 560 | return Ok(()); |
| 561 | } |
| 562 | |
| 563 | match hook.install_global(self.force) { |
| 564 | Ok(count) if count > 0 => { |
| 565 | print_success(&format!( |
| 566 | "Installed {} global hook{} for Gemini CLI", |
| 567 | count, |
| 568 | if count == 1 { "" } else { "s" }, |
| 569 | )); |
| 570 | println!(); |
no test coverage detected