(event: HookEvent, matcherId: string)
| 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, |
no test coverage detected