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

Function hook_matches_spec

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

Source from the content-addressed store, hash-verified

539}
540
541fn hook_matches_spec(
542 hook: &Value,
543 command: &str,
544 status_message: Option<&str>,
545 timeout_sec: Option<u64>,
546) -> bool {
547 if hook.get("command").and_then(Value::as_str) != Some(command) {
548 return false;
549 }
550 if let Some(message) = status_message {
551 if hook.get("statusMessage").and_then(Value::as_str) != Some(message) {
552 return false;
553 }
554 }
555 if let Some(timeout) = timeout_sec {
556 if hook.get("timeout").and_then(Value::as_u64) != Some(timeout) {
557 return false;
558 }
559 }
560 true
561}
562
563/// Remove only obsolete Atomic hooks for one event, preserving custom hooks
564/// 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