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

Function install_hooks_at

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

Source from the content-addressed store, hash-verified

377}
378
379fn install_hooks_at(path: &Path, force: bool) -> AgentResult<usize> {
380 let mut config = read_hooks_file(path)?;
381 if force {
382 remove_atomic_hooks(&mut config.hooks);
383 }
384
385 let mut installed = 0;
386 for spec in CODEX_HOOK_DEFS {
387 let command = crate::hooks::guarded_hook_command(spec.command);
388 remove_stale_atomic_hooks_for_event(
389 &mut config.hooks,
390 spec.event,
391 &command,
392 spec.status_message,
393 spec.timeout_sec,
394 );
395 if add_hook(
396 &mut config.hooks,
397 spec.event,
398 &command,
399 spec.status_message,
400 spec.timeout_sec,
401 ) {
402 installed += 1;
403 }
404 }
405
406 write_hooks_file(path, &config)?;
407 Ok(installed)
408}
409
410fn uninstall_hooks_at(path: &Path) -> AgentResult<()> {
411 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