Fix crash when hook entries have no matcher (#160)

Claude Code allows hook entries without a `matcher` field (e.g.,
SessionStart and SubagentStop hooks don't need one). The OpenCode
converter assumed `matcher.matcher` was always present, causing
"undefined is not an object (evaluating 'matcher.matcher.split')"
when converting plugins with matcher-less hooks.

Make `matcher` optional in the type and guard all accesses.
This commit is contained in:
Roberto Mello
2026-02-08 15:59:57 -07:00
committed by GitHub
parent c69c47fe9b
commit f7cab16b06
2 changed files with 8 additions and 6 deletions

View File

@@ -79,7 +79,7 @@ export type ClaudeHookAgent = {
export type ClaudeHookEntry = ClaudeHookCommand | ClaudeHookPrompt | ClaudeHookAgent
export type ClaudeHookMatcher = {
matcher: string
matcher?: string
hooks: ClaudeHookEntry[]
}