( handler: HookHandler, input: HookInput, cwd: string, )
| 208 | } |
| 209 | |
| 210 | async function executeHandler( |
| 211 | handler: HookHandler, |
| 212 | input: HookInput, |
| 213 | cwd: string, |
| 214 | ): Promise<HookExecutionResult> { |
| 215 | switch (handler.type) { |
| 216 | case "command": |
| 217 | return executeCommandHook(handler, input, cwd); |
| 218 | case "http": |
| 219 | return executeHttpHook(handler, input); |
| 220 | case "prompt": |
| 221 | case "agent": |
| 222 | // Prompt and agent hooks are not yet implemented |
| 223 | logger.debug( |
| 224 | `Hook type "${handler.type}" is not yet supported, skipping`, |
| 225 | ); |
| 226 | return { |
| 227 | output: null, |
| 228 | stdout: "", |
| 229 | stderr: "", |
| 230 | exitCode: 0, |
| 231 | blocked: false, |
| 232 | }; |
| 233 | default: |
| 234 | logger.warn(`Unknown hook handler type: ${(handler as any).type}`); |
| 235 | return { |
| 236 | output: null, |
| 237 | stdout: "", |
| 238 | stderr: "", |
| 239 | exitCode: 0, |
| 240 | blocked: false, |
| 241 | }; |
| 242 | } |
| 243 | } |
| 244 | |
| 245 | function getHandlerDedupeKey(handler: HookHandler): string { |
| 246 | switch (handler.type) { |
no test coverage detected