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

Function getMatchQuery

src/core/hooks.ts:267–281  ·  view source on GitHub ↗

The event field a matcher's regex is tested against, per Claude Code.

(event: HookEvent, fields: Record<string, unknown>)

Source from the content-addressed store, hash-verified

265
266/** The event field a matcher's regex is tested against, per Claude Code. */
267function getMatchQuery(event: HookEvent, fields: Record<string, unknown>): string | undefined {
268 switch (event) {
269 case "PreToolUse":
270 case "PostToolUse":
271 return typeof fields.tool_name === "string" ? fields.tool_name : undefined
272 case "PreCompact":
273 return typeof fields.trigger === "string" ? fields.trigger : undefined
274 case "SessionStart":
275 return typeof fields.source === "string" ? fields.source : undefined
276 case "SessionEnd":
277 return typeof fields.reason === "string" ? fields.reason : undefined
278 default:
279 return undefined
280 }
281}
282
283function matcherMatches(matcher: string | undefined, query: string | undefined): boolean {
284 if (!matcher || matcher === "*") return true

Callers 1

runMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected