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)
| 584 | /// agy is intentionally absent: its plugin is inherently global and is |
| 585 | /// installed by the integrations engine via the standard `enable` path. |
| 586 | fn run_global(&self) -> CliResult<()> { |
| 587 | use atomic_agent::hooks::claude_code::ClaudeCodeHook; |
| 588 | use atomic_agent::hooks::codex::CodexHook; |
| 589 | use atomic_agent::hooks::gemini_cli::GeminiCliHook; |
| 590 | |
| 591 | let agent_name = self.agent.as_deref().unwrap_or("claude-code"); |
| 592 | |
| 593 | match agent_name { |
| 594 | "claude-code" => { |
| 595 | let hook = ClaudeCodeHook::new(); |
| 596 | |
| 597 | if !self.force && hook.is_installed_global() { |
| 598 | print_success("Global hooks already installed in ~/.claude/settings.json."); |
| 599 | println!(" Use --force to reinstall."); |
| 600 | return Ok(()); |
| 601 | } |
| 602 | |
| 603 | match hook.install_global(self.force) { |
| 604 | Ok(count) if count > 0 => { |
| 605 | print_success(&format!( |
| 606 | "Installed {} global hook{} for Claude Code", |
| 607 | count, |
| 608 | if count == 1 { "" } else { "s" }, |
| 609 | )); |
| 610 | println!(); |
| 611 | println!("Hooks written to: ~/.claude/settings.json"); |
| 612 | println!(); |
| 613 | println!("Every Claude Code session in a project with .atomic/ will now:"); |
| 614 | println!(" • Record each turn as an Atomic change with full provenance"); |
| 615 | println!(" • Track session metadata (turn number, timing, files)"); |
| 616 | println!(" • Create attestations at session end"); |
| 617 | } |
| 618 | Ok(_) => { |
| 619 | print_success("Global hooks already up to date."); |
| 620 | } |
| 621 | Err(e) => { |
| 622 | print_error(&format!("Failed to install global hooks: {}", e)); |
| 623 | } |
| 624 | } |
| 625 | } |
| 626 | |
| 627 | "gemini-cli" => { |
| 628 | let hook = GeminiCliHook::new(); |
| 629 | |
| 630 | if !self.force && hook.is_installed_global() { |
| 631 | print_success("Global hooks already installed in ~/.gemini/settings.json."); |
| 632 | println!(" Use --force to reinstall."); |
| 633 | return Ok(()); |
| 634 | } |
| 635 | |
| 636 | match hook.install_global(self.force) { |
| 637 | Ok(count) if count > 0 => { |
| 638 | print_success(&format!( |
| 639 | "Installed {} global hook{} for Gemini CLI", |
| 640 | count, |
| 641 | if count == 1 { "" } else { "s" }, |
| 642 | )); |
| 643 | println!(); |
no test coverage detected