MCPcopy Create free account
hub / github.com/MatterAIOrg/OrbCode / matcherMatches

Function matcherMatches

src/core/hooks.ts:283–295  ·  view source on GitHub ↗
(matcher: string | undefined, query: string | undefined)

Source from the content-addressed store, hash-verified

281}
282
283function matcherMatches(matcher: string | undefined, query: string | undefined): boolean {
284 if (!matcher || matcher === "*") return true
285 if (query === undefined) return false
286 try {
287 // Auto-anchor so "execute_command" matches exactly that tool name, not
288 // "execute_command_extra". Alternation ("a|b") still works because the
289 // anchors wrap a non-capturing group: ^(?:a|b)$.
290 return new RegExp(`^(?:${matcher})$`).test(query)
291 } catch {
292 // An invalid regex degrades to an exact-string comparison.
293 return matcher === query
294 }
295}
296
297function parseHookOutput(stdout: string): { json?: HookJsonOutput; plainText?: string } {
298 const trimmed = stdout.trim()

Callers 1

runMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected