0a20844bd4
- Apply mcp_env_allowlist to plugin hooks: intersect HTTP allowedEnvVars with MCP allowlist, set command allowedEnvVars to full MCP allowlist - Scrub process.env in executeHookCommand when allowedEnvVars provided - Add PluginHooksState class with per-directory Map storage - Add PluginHooksConfig interface for typed boundary layer - Pass directory context through hook-config-handler - Add 16 tests across 4 files (40 assertions) covering allowlist filtering, env scrubbing, directory isolation, and edge cases - Remove unnecessary 'as' type assertions, use discriminated union narrowing instead
20 lines
646 B
TypeScript
20 lines
646 B
TypeScript
import type { PluginComponents } from "./plugin-components-loader"
|
|
import { setPluginHooksConfigs } from "../hooks/claude-code-hooks/config"
|
|
import { log } from "../shared"
|
|
|
|
export function applyHookConfig(params: {
|
|
pluginComponents: PluginComponents;
|
|
ctx: { directory: string };
|
|
}): void {
|
|
const { pluginComponents, ctx } = params
|
|
|
|
if (pluginComponents.hooksConfigs.length > 0) {
|
|
log("[hook-config-handler] Merging plugin hooks configs", {
|
|
count: pluginComponents.hooksConfigs.length,
|
|
plugins: pluginComponents.plugins.map(p => p.name),
|
|
})
|
|
}
|
|
|
|
setPluginHooksConfigs(ctx.directory, pluginComponents.hooksConfigs)
|
|
}
|