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

Function addDirectCommand

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

Source from the content-addressed store, hash-verified

347 };
348
349 const addDirectCommand = (event: HookEvent) => {
350 // Only for events without matchers
351 if (!directEvents.includes(event as any)) return;
352
353 const newCommand: EditableHookCommand = {
354 id: HooksManager.generateId(),
355 type: 'command',
356 command: ''
357 };
358
359 setEditableHooks(prev => ({
360 ...prev,
361 [event]: [...(prev[event as 'Notification' | 'Stop' | 'SubagentStop'] as EditableHookCommand[]), newCommand]
362 }));
363 };
364
365 const updateMatcher = (event: HookEvent, matcherId: string, updates: Partial<EditableHookMatcher>) => {
366 if (!matcherEvents.includes(event as any)) return;

Callers 1

HooksEditorFunction · 0.85

Calls 1

generateIdMethod · 0.80

Tested by

no test coverage detected