MCPcopy Create free account
hub / github.com/winfunc/opcode / addMatcher

Function addMatcher

src/components/HooksEditor.tsx:332–347  ·  view source on GitHub ↗
(event: HookEvent)

Source from the content-addressed store, hash-verified

330 };
331
332 const addMatcher = (event: HookEvent) => {
333 // Only for events with matchers
334 if (!matcherEvents.includes(event as any)) return;
335
336 const newMatcher: EditableHookMatcher = {
337 id: HooksManager.generateId(),
338 matcher: '',
339 hooks: [],
340 expanded: true
341 };
342
343 setEditableHooks(prev => ({
344 ...prev,
345 [event]: [...(prev[event as 'PreToolUse' | 'PostToolUse'] as EditableHookMatcher[]), newMatcher]
346 }));
347 };
348
349 const addDirectCommand = (event: HookEvent) => {
350 // Only for events without matchers

Callers 1

HooksEditorFunction · 0.85

Calls 1

generateIdMethod · 0.80

Tested by

no test coverage detected