* Lightweight existence check for hooks on a given event. Mirrors the sources * assembled by getHooksConfig() but stops at the first hit without building * the full merged config. * * Intentionally over-approximates: returns true if any matcher exists for the * event, even if managed-only filte
( hookEvent: HookEvent, appState: AppState | undefined, sessionId: string, )
| 1584 | * See hasInstructionsLoadedHook / hasWorktreeCreateHook for the same pattern. |
| 1585 | */ |
| 1586 | function hasHookForEvent( |
| 1587 | hookEvent: HookEvent, |
| 1588 | appState: AppState | undefined, |
| 1589 | sessionId: string, |
| 1590 | ): boolean { |
| 1591 | const snap = getHooksConfigFromSnapshot()?.[hookEvent] |
| 1592 | if (snap && snap.length > 0) return true |
| 1593 | const reg = getRegisteredHooks()?.[hookEvent] |
| 1594 | if (reg && reg.length > 0) return true |
| 1595 | if (appState?.sessionHooks.get(sessionId)?.hooks[hookEvent]) return true |
| 1596 | return false |
| 1597 | } |
| 1598 | |
| 1599 | /** |
| 1600 | * Get hook commands that match the given query |
no test coverage detected