Files
orca/src/main/codebuddy/hook-service.ts
T
OrcaWinandOrca Worker b0e73d9342 fix(codebuddy): run Windows hooks without requiring PowerShell 7 (#27626)
CodeBuddy spawns hooks registered with shell: 'powershell' as a bare
`pwsh`, so on Windows without PowerShell 7 every hook failed with
spawn pwsh ENOENT and the failed UserPromptSubmit hook blocked prompts.
Register CodeBuddy's hooks the way Claude's are: the managed .cmd path
on cmd-safe profiles (runs under CodeBuddy's Git Bash or Windows
PowerShell default shell) and the absolute powershell.exe encoded
launcher otherwise. The next install rewrites existing registrations.

Fixes #27182

Co-authored-by: Orca Worker <orca-worker@localhost>
2026-10-12 10:47:16 -07:00

35 lines
971 B
TypeScript

import type { ClaudeManagedHookPlan } from '../claude/claude-managed-hook-events'
import { ClaudeHookService } from '../claude/hook-service'
export const CODEBUDDY_HOOK_EVENTS = [
'SessionStart',
'SessionEnd',
'UserPromptSubmit',
'PreToolUse',
'PostToolUse',
'PostToolUseFailure',
'PermissionRequest',
'Stop',
'StopFailure',
'Notification'
] as const
export const CODEBUDDY_MANAGED_HOOK_PLAN: ClaudeManagedHookPlan = {
install: CODEBUDDY_HOOK_EVENTS.map((eventName) => ({ eventName, definition: {} })),
retire: [],
statusLine: 'leave'
}
export const codebuddyHookService = new ClaudeHookService({
agent: 'codebuddy',
source: 'codebuddy',
displayName: 'CodeBuddy',
settings: {
configDirName: '.codebuddy',
scriptBaseName: 'codebuddy-hook',
// No `shell: 'powershell'`: CodeBuddy runs that as bare `pwsh`, absent on stock Windows (#27182).
usesWindowsCompatLauncher: true
},
hookPlan: CODEBUDDY_MANAGED_HOOK_PLAN
})