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

Function hook_matches_spec

atomic-agent/src/hooks/codex.rs:555–575  ·  view source on GitHub ↗
(
    hook: &Value,
    command: &str,
    status_message: Option<&str>,
    timeout_sec: Option<u64>,
)

Source from the content-addressed store, hash-verified

553}
554
555fn hook_matches_spec(
556 hook: &Value,
557 command: &str,
558 status_message: Option<&str>,
559 timeout_sec: Option<u64>,
560) -> bool {
561 if hook.get("command").and_then(Value::as_str) != Some(command) {
562 return false;
563 }
564 if let Some(message) = status_message {
565 if hook.get("statusMessage").and_then(Value::as_str) != Some(message) {
566 return false;
567 }
568 }
569 if let Some(timeout) = timeout_sec {
570 if hook.get("timeout").and_then(Value::as_u64) != Some(timeout) {
571 return false;
572 }
573 }
574 true
575}
576
577/// Remove only obsolete Atomic hooks for one event, preserving custom hooks
578/// and the exact current Atomic definition. This lets a normal `enable`

Callers 2

group_has_hook_specFunction · 0.85

Calls 1

getMethod · 0.65

Tested by

no test coverage detected