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:
@@ -79,7 +79,7 @@ export type ClaudeHookAgent = {
|
||||
export type ClaudeHookEntry = ClaudeHookCommand | ClaudeHookPrompt | ClaudeHookAgent
|
||||
|
||||
export type ClaudeHookMatcher = {
|
||||
matcher: string
|
||||
matcher?: string
|
||||
hooks: ClaudeHookEntry[]
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user