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

Function addCommand

src/components/HooksEditor.tsx:457–474  ·  view source on GitHub ↗
(event: HookEvent, matcherId: string)

Source from the content-addressed store, hash-verified

455 }, [hooks]);
456
457 const addCommand = (event: HookEvent, matcherId: string) => {
458 if (!matcherEvents.includes(event as any)) return;
459
460 const newCommand: EditableHookCommand = {
461 id: HooksManager.generateId(),
462 type: 'command',
463 command: ''
464 };
465
466 setEditableHooks(prev => ({
467 ...prev,
468 [event]: (prev[event as 'PreToolUse' | 'PostToolUse'] as EditableHookMatcher[]).map(matcher =>
469 matcher.id === matcherId
470 ? { ...matcher, hooks: [...matcher.hooks, newCommand] }
471 : matcher
472 )
473 }));
474 };
475
476 const updateCommand = (
477 event: HookEvent,

Callers 1

renderMatcherFunction · 0.85

Calls 1

generateIdMethod · 0.80

Tested by

no test coverage detected