fix(hooks): merge marketplace plugin hooksConfigs into claude-code-hooks at config time
Previously, loadPluginHooksConfigs() loaded plugin hooks from marketplace plugins (hookify, superpowers, zzcommon, zzfe, etc.) into pluginComponents.hooksConfigs, but config-handler.ts never consumed them. This meant plugin hooks were discovered but never merged into the runtime hooks dispatch system. Changes: - Extend ClaudeHookEvent and ClaudeHooksConfig to support all 12 event types (PostToolUseFailure, PermissionRequest, Notification, SubagentStart, SubagentStop, SessionStart, SessionEnd) in addition to the existing 5 - Add ALL_HOOK_EVENT_TYPES constant as single source of truth for event type iteration - Add mergePluginHooksConfigs() to unwrap plugin HooksConfig (with hooks wrapper) into flat ClaudeHooksConfig, filtering out unsupported prompt/agent hook types - Add setPluginHooksConfigs() to store pending plugin configs and invalidate the config cache - Create applyHookConfig() handler following existing applyXxxConfig pattern, wired into config-handler after loadPluginComponents() - Extend DisabledHooksConfig and mergeDisabledHooks for all 12 events Closes #4179
This commit is contained in:
@@ -4,6 +4,7 @@ import type { ModelCacheState } from "../plugin-state";
|
||||
import { log } from "../shared";
|
||||
import { applyAgentConfig } from "./agent-config-handler";
|
||||
import { applyCommandConfig } from "./command-config-handler";
|
||||
import { applyHookConfig } from "./hook-config-handler";
|
||||
import { applyMcpConfig } from "./mcp-config-handler";
|
||||
import { applyProviderConfig } from "./provider-config-handler";
|
||||
import { loadPluginComponents } from "./plugin-components-loader";
|
||||
@@ -30,6 +31,8 @@ export function createConfigHandler(deps: ConfigHandlerDeps) {
|
||||
|
||||
const pluginComponents = await loadPluginComponents({ pluginConfig });
|
||||
|
||||
applyHookConfig({ pluginComponents });
|
||||
|
||||
const agentResult = await applyAgentConfig({
|
||||
config,
|
||||
pluginConfig,
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
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;
|
||||
}): void {
|
||||
const { pluginComponents } = 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(pluginComponents.hooksConfigs)
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ export * from "./provider-config-handler";
|
||||
export * from "./agent-config-handler";
|
||||
export * from "./tool-config-handler";
|
||||
export * from "./mcp-config-handler";
|
||||
export * from "./hook-config-handler";
|
||||
export * from "./command-config-handler";
|
||||
export * from "./plugin-components-loader";
|
||||
export * from "./category-config-resolver";
|
||||
|
||||
Reference in New Issue
Block a user