fix: wire claudeCodeHooks into createHooks() to enable .claude/settings.json hooks
createClaudeCodeHooksHook() was fully implemented but never instantiated
in createHooks(). All .claude/settings.json hooks (PreToolUse, PostToolUse,
Stop, UserPromptSubmit) were silently skipped because hooks.claudeCodeHooks
was always undefined (optional chaining masked the issue).
Add claudeCodeHooks creation to createHooks() using the existing
isHookEnabled('claude-code-hooks') gate and safeCreateHook wrapper.
Note: This is a necessary fix but may require additional debugging for
full hook execution — the dispatch/stdin format compatibility between
OpenCode and Claude Code hook scripts needs runtime verification.
Fixes #3297
This commit is contained in:
@@ -8,6 +8,8 @@ import type { ModelCacheState } from "./plugin-state"
|
|||||||
import { createCoreHooks } from "./plugin/hooks/create-core-hooks"
|
import { createCoreHooks } from "./plugin/hooks/create-core-hooks"
|
||||||
import { createContinuationHooks } from "./plugin/hooks/create-continuation-hooks"
|
import { createContinuationHooks } from "./plugin/hooks/create-continuation-hooks"
|
||||||
import { createSkillHooks } from "./plugin/hooks/create-skill-hooks"
|
import { createSkillHooks } from "./plugin/hooks/create-skill-hooks"
|
||||||
|
import { createClaudeCodeHooksHook } from "./hooks/claude-code-hooks"
|
||||||
|
import { safeCreateHook } from "./shared/safe-create-hook"
|
||||||
|
|
||||||
export type CreatedHooks = ReturnType<typeof createHooks>
|
export type CreatedHooks = ReturnType<typeof createHooks>
|
||||||
|
|
||||||
@@ -78,10 +80,17 @@ export function createHooks(args: {
|
|||||||
availableSkills,
|
availableSkills,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const claudeCodeHooks = isHookEnabled("claude-code-hooks")
|
||||||
|
? safeHookEnabled
|
||||||
|
? safeCreateHook("claude-code-hooks", () => createClaudeCodeHooksHook(ctx, {}), { enabled: true })
|
||||||
|
: createClaudeCodeHooksHook(ctx, {})
|
||||||
|
: null
|
||||||
|
|
||||||
const hooks = {
|
const hooks = {
|
||||||
...core,
|
...core,
|
||||||
...continuation,
|
...continuation,
|
||||||
...skill,
|
...skill,
|
||||||
|
claudeCodeHooks,
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user