MCPcopy Create free account
hub / github.com/AI45Lab/Code / matches_path_pattern

Method matches_path_pattern

core/src/hooks/matcher.rs:159–175  ·  view source on GitHub ↗

Check if event matches a path pattern (glob)

(&self, event: &HookEvent, pattern: &str)

Source from the content-addressed store, hash-verified

157
158 /// Check if event matches a path pattern (glob)
159 fn matches_path_pattern(&self, event: &HookEvent, pattern: &str) -> bool {
160 let args = match event.tool_args() {
161 Some(args) => args,
162 None => return false,
163 };
164
165 // Look for common path fields
166 let path = args
167 .get("file_path")
168 .or_else(|| args.get("path"))
169 .and_then(|v| v.as_str());
170
171 match path {
172 Some(p) => self.glob_match(pattern, p),
173 None => false,
174 }
175 }
176
177 /// Check if event matches a command pattern (regex)
178 fn matches_command_pattern(&self, event: &HookEvent, pattern: &str) -> bool {

Callers 1

matchesMethod · 0.80

Calls 4

tool_argsMethod · 0.80
getMethod · 0.45
as_strMethod · 0.45
glob_matchMethod · 0.45

Tested by

no test coverage detected