mirror of
https://github.com/stablyai/orca.git
synced 2026-10-03 08:02:12 +00:00
Respect disabled OpenCode variants and refresh WSL settings safely (#23328)
Respect disabled OpenCode variants, preserve explicit config ownership, and refresh WSL guest settings safely across reconnects. Based on Harshul Rathod proposal #22805. Co-authored-by: Harshul Rathod <harshulrathod1640@gmail.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { isOpenCode2LaunchCommand } from './opencode-launch-command'
|
||||
import { isOpenCode2LaunchCommand, selectOpenCodeHookAgent } from './opencode-launch-command'
|
||||
|
||||
describe('isOpenCode2LaunchCommand', () => {
|
||||
it.each(['opencode2', '/usr/local/bin/opencode2', 'opencode2.exe', 'opencode2.cmd'])(
|
||||
@@ -13,3 +13,19 @@ describe('isOpenCode2LaunchCommand', () => {
|
||||
expect(isOpenCode2LaunchCommand(command)).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
describe('OpenCode hook selection', () => {
|
||||
it.each([
|
||||
'opencode --session fixture',
|
||||
'"C:\\tools\\opencode.exe" --session fixture',
|
||||
'/usr/local/bin/opencode'
|
||||
])('preserves disabled v1 identity for %s', (command) => {
|
||||
expect(selectOpenCodeHookAgent(undefined, command, (agent) => agent === 'opencode2')).toBeNull()
|
||||
})
|
||||
it('trusts the supplied identity for wrapped or renamed commands', () => {
|
||||
expect(selectOpenCodeHookAgent('opencode', 'opencode2', () => true)).toBe('opencode')
|
||||
expect(
|
||||
selectOpenCodeHookAgent('opencode2', 'my-wrapper', (agent) => agent === 'opencode2')
|
||||
).toBe('opencode2')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user