fix(hooks): resolve cubic review issues

- Replace two-pass env interpolation with single-pass combined regex to
  prevent re-interpolation of $-sequences in substituted header values
- Convert HookEntry to discriminated union so type: "http" requires url,
  preventing invalid configs from passing type checking
- Add regression test for double-interpolation edge case
This commit is contained in:
YeonGyu-Kim
2026-02-28 12:00:02 +09:00
parent 43dfdb2380
commit 3eb53adfc3
3 changed files with 16 additions and 21 deletions

View File

@@ -80,16 +80,11 @@ export interface PluginManifest {
/**
* Hooks configuration
*/
export interface HookEntry {
type: "command" | "prompt" | "agent" | "http"
command?: string
prompt?: string
agent?: string
url?: string
headers?: Record<string, string>
allowedEnvVars?: string[]
timeout?: number
}
export type HookEntry =
| { type: "command"; command?: string }
| { type: "prompt"; prompt?: string }
| { type: "agent"; agent?: string }
| { type: "http"; url: string; headers?: Record<string, string>; allowedEnvVars?: string[]; timeout?: number }
export interface HookMatcher {
matcher?: string