feat(hooks): add HTTP hook handler support

Add type: "http" hook support matching Claude Code's HTTP hook specification.
HTTP hooks send POST requests with JSON body, support env var interpolation
in headers via allowedEnvVars, and configurable timeout.

New files:
- execute-http-hook.ts: HTTP hook execution with env var interpolation
- dispatch-hook.ts: Unified dispatcher for command and HTTP hooks
- execute-http-hook.test.ts: 14 tests covering all HTTP hook scenarios

Modified files:
- types.ts: Added HookHttp interface, HookAction union type
- config.ts: Updated to accept HookAction in raw hook matchers
- pre-tool-use/post-tool-use/stop/user-prompt-submit/pre-compact:
  Updated all 5 executors to dispatch HTTP hooks via dispatchHook()
- plugin-loader/types.ts: Added "http" to HookEntry type union
This commit is contained in:
YeonGyu-Kim
2026-02-28 11:38:34 +09:00
parent 866bd50dca
commit 43dfdb2380
11 changed files with 397 additions and 57 deletions
@@ -81,10 +81,14 @@ export interface PluginManifest {
* Hooks configuration
*/
export interface HookEntry {
type: "command" | "prompt" | "agent"
type: "command" | "prompt" | "agent" | "http"
command?: string
prompt?: string
agent?: string
url?: string
headers?: Record<string, string>
allowedEnvVars?: string[]
timeout?: number
}
export interface HookMatcher {