* Fire a hook event and return the aggregated result. * * This is the main entry point used by all integration points. * Returns a no-op result if hooks are disabled.
(input: HookInput)
| 75 | * Returns a no-op result if hooks are disabled. |
| 76 | */ |
| 77 | async fireEvent(input: HookInput): Promise<HookEventResult> { |
| 78 | if (this.currentState.disabled) { |
| 79 | return { blocked: false, results: [] }; |
| 80 | } |
| 81 | |
| 82 | if (Object.keys(this.currentState.config).length === 0) { |
| 83 | return { blocked: false, results: [] }; |
| 84 | } |
| 85 | |
| 86 | try { |
| 87 | const result = await runHooks(this.currentState.config, input, this.cwd); |
| 88 | return result; |
| 89 | } catch (error) { |
| 90 | logger.warn(`Hook event ${input.hook_event_name} failed:`, error); |
| 91 | // Hook errors should not break the main flow |
| 92 | return { blocked: false, results: [] }; |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | /** |
| 97 | * Reload hooks config from disk (e.g., after config file changes). |
no test coverage detected