| 163 | } |
| 164 | |
| 165 | pub(crate) fn add_hook_to_matcher( |
| 166 | matchers: &mut Vec<ClaudeHookMatcher>, |
| 167 | matcher_name: &str, |
| 168 | command: &str, |
| 169 | ) { |
| 170 | let entry = ClaudeHookEntry { |
| 171 | hook_type: "command".to_string(), |
| 172 | command: command.to_string(), |
| 173 | }; |
| 174 | |
| 175 | if let Some(matcher) = matchers.iter_mut().find(|m| m.matcher == matcher_name) { |
| 176 | matcher.hooks.push(entry); |
| 177 | return; |
| 178 | } |
| 179 | |
| 180 | matchers.push(ClaudeHookMatcher { |
| 181 | matcher: matcher_name.to_string(), |
| 182 | hooks: vec![entry], |
| 183 | }); |
| 184 | } |
| 185 | |
| 186 | pub(crate) fn has_any_atomic_hook(matchers: &[ClaudeHookMatcher]) -> bool { |
| 187 | matchers |