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

Function install_hooks_at

atomic-agent/src/hooks/codex.rs:365–394  ·  view source on GitHub ↗
(path: &Path, force: bool)

Source from the content-addressed store, hash-verified

363}
364
365fn install_hooks_at(path: &Path, force: bool) -> AgentResult<usize> {
366 let mut config = read_hooks_file(path)?;
367 if force {
368 remove_atomic_hooks(&mut config.hooks);
369 }
370
371 let mut installed = 0;
372 for spec in CODEX_HOOK_DEFS {
373 let command = crate::hooks::guarded_hook_command(spec.command);
374 remove_stale_atomic_hooks_for_event(
375 &mut config.hooks,
376 spec.event,
377 &command,
378 spec.status_message,
379 spec.timeout_sec,
380 );
381 if add_hook(
382 &mut config.hooks,
383 spec.event,
384 &command,
385 spec.status_message,
386 spec.timeout_sec,
387 ) {
388 installed += 1;
389 }
390 }
391
392 write_hooks_file(path, &config)?;
393 Ok(installed)
394}
395
396fn uninstall_hooks_at(path: &Path) -> AgentResult<()> {
397 if !path.exists() {

Calls 6

read_hooks_fileFunction · 0.85
guarded_hook_commandFunction · 0.85
add_hookFunction · 0.85
write_hooks_fileFunction · 0.85
remove_atomic_hooksFunction · 0.70