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)
| 611 | /// agy is intentionally absent: its plugin is inherently global and is |
| 612 | /// installed by the integrations engine via the standard `enable` path. |
| 613 | fn run_global(&self) -> CliResult<()> { |
| 614 | use atomic_agent::hooks::claude_code::ClaudeCodeHook; |
| 615 | use atomic_agent::hooks::codex::CodexHook; |
| 616 | use atomic_agent::hooks::gemini_cli::GeminiCliHook; |
| 617 | |
| 618 | let agent_name = self.agent.as_deref().unwrap_or("claude-code"); |
| 619 | |
| 620 | match agent_name { |
| 621 | "claude-code" => { |
| 622 | let hook = ClaudeCodeHook::new(); |
| 623 | |
| 624 | if !self.force && hook.is_installed_global() { |
| 625 | print_success("Global hooks already installed in ~/.claude/settings.json."); |
| 626 | println!(" Use --force to reinstall."); |
| 627 | return Ok(()); |
| 628 | } |
| 629 | |
| 630 | match hook.install_global(self.force) { |
| 631 | Ok(count) if count > 0 => { |
| 632 | print_success(&format!( |
| 633 | "Installed {} global hook{} for Claude Code", |
| 634 | count, |
| 635 | if count == 1 { "" } else { "s" }, |
| 636 | )); |
| 637 | println!(); |
| 638 | println!("Hooks written to: ~/.claude/settings.json"); |
| 639 | println!(); |
| 640 | println!("Every Claude Code session in a project with .atomic/ will now:"); |
| 641 | println!(" • Record each turn as an Atomic change with full provenance"); |
| 642 | println!(" • Track session metadata (turn number, timing, files)"); |
| 643 | println!(" • Create attestations at session end"); |
| 644 | } |
| 645 | Ok(_) => { |
| 646 | print_success("Global hooks already up to date."); |
| 647 | } |
| 648 | Err(e) => { |
| 649 | print_error(&format!("Failed to install global hooks: {}", e)); |
| 650 | } |
| 651 | } |
| 652 | } |
| 653 | |
| 654 | "gemini-cli" => { |
| 655 | let hook = GeminiCliHook::new(); |
| 656 | |
| 657 | if !self.force && hook.is_installed_global() { |
| 658 | print_success("Global hooks already installed in ~/.gemini/settings.json."); |
| 659 | println!(" Use --force to reinstall."); |
| 660 | return Ok(()); |
| 661 | } |
| 662 | |
| 663 | match hook.install_global(self.force) { |
| 664 | Ok(count) if count > 0 => { |
| 665 | print_success(&format!( |
| 666 | "Installed {} global hook{} for Gemini CLI", |
| 667 | count, |
| 668 | if count == 1 { "" } else { "s" }, |
| 669 | )); |
| 670 | println!(); |
no test coverage detected