MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / run_global

Method run_global

atomic-cli/src/commands/agent/disable.rs:214–326  ·  view source on GitHub ↗

Remove hooks from global agent settings. Supports: - `claude-code` → `~/.claude/settings.json` - `gemini-cli` → `~/.gemini/settings.json` - `agy` → `~/.gemini/config/plugins/atomic/` (plugin) - No `--agent` flag → removes from all agents that have global hooks

(&self)

Source from the content-addressed store, hash-verified

212 /// - `agy` → `~/.gemini/config/plugins/atomic/` (plugin)
213 /// - No `--agent` flag → removes from all agents that have global hooks
214 fn run_global(&self) -> CliResult<()> {
215 use atomic_agent::hooks::agy::AgyHook;
216 use atomic_agent::hooks::claude_code::ClaudeCodeHook;
217 use atomic_agent::hooks::gemini_cli::GeminiCliHook;
218
219 let agents: Vec<&str> = if let Some(ref name) = self.agent {
220 vec![name.as_str()]
221 } else {
222 // No agent specified — check all supported agents
223 let mut found = Vec::new();
224 if ClaudeCodeHook::new().is_installed_global() {
225 found.push("claude-code");
226 }
227 if GeminiCliHook::new().is_installed_global() {
228 found.push("gemini-cli");
229 }
230 if AgyHook::new().is_installed_global() {
231 found.push("agy");
232 }
233 found
234 };
235
236 if agents.is_empty() {
237 println!("No global hooks installed.");
238 return Ok(());
239 }
240
241 let mut total_removed = 0;
242
243 for agent_name in &agents {
244 match *agent_name {
245 "claude-code" => {
246 let hook = ClaudeCodeHook::new();
247 if !hook.is_installed_global() {
248 continue;
249 }
250 match hook.uninstall_global() {
251 Ok(()) => {
252 print_success("Removed global hooks from ~/.claude/settings.json");
253 total_removed += 1;
254 }
255 Err(e) => {
256 print_error(&format!(
257 "Failed to remove Claude Code global hooks: {}",
258 e
259 ));
260 }
261 }
262 }
263 "gemini-cli" => {
264 let hook = GeminiCliHook::new();
265 if !hook.is_installed_global() {
266 continue;
267 }
268 match hook.uninstall_global() {
269 Ok(()) => {
270 print_success("Removed global hooks from ~/.gemini/settings.json");
271 total_removed += 1;

Callers 1

runMethod · 0.45

Calls 7

print_successFunction · 0.85
print_errorFunction · 0.85
print_warningFunction · 0.85
is_installed_globalMethod · 0.45
pushMethod · 0.45
is_emptyMethod · 0.45
uninstall_globalMethod · 0.45

Tested by

no test coverage detected