mirror of
https://github.com/wu736139669/hapi.git
synced 2026-11-23 04:37:09 +00:00
feat(opencode): accept -s/--session as resume aliases (#1042)
Map OpenCode-native session flags to resumeSessionId so `hapi opencode -s <id>` restores the session like --resume.
This commit is contained in:
@@ -68,6 +68,30 @@ describe('parseRemoteAgentCommandOptions', () => {
|
||||
expect(() => parseRemoteAgentCommandOptions(['--model'], OPENCODE_PERMISSION_MODES)).toThrow('Missing --model value')
|
||||
expect(() => parseRemoteAgentCommandOptions(['--model-reasoning-effort'], OPENCODE_PERMISSION_MODES)).toThrow('Missing --model-reasoning-effort value')
|
||||
})
|
||||
|
||||
it('accepts OpenCode-native -s / --session as resume aliases', () => {
|
||||
expect(parseRemoteAgentCommandOptions(
|
||||
['-s', 'opencode-sess-1'],
|
||||
OPENCODE_PERMISSION_MODES
|
||||
).resumeSessionId).toBe('opencode-sess-1')
|
||||
|
||||
expect(parseRemoteAgentCommandOptions(
|
||||
['--session', 'opencode-sess-2'],
|
||||
OPENCODE_PERMISSION_MODES
|
||||
).resumeSessionId).toBe('opencode-sess-2')
|
||||
})
|
||||
|
||||
it('rejects -s / --session with no value', () => {
|
||||
expect(() => parseRemoteAgentCommandOptions(['-s'], OPENCODE_PERMISSION_MODES)).toThrow('Missing -s value')
|
||||
expect(() => parseRemoteAgentCommandOptions(['--session'], OPENCODE_PERMISSION_MODES)).toThrow('Missing --session value')
|
||||
})
|
||||
|
||||
it('a later -s overrides a prior --resume (last-write-wins)', () => {
|
||||
expect(parseRemoteAgentCommandOptions(
|
||||
['--resume', 'first', '-s', 'second'],
|
||||
OPENCODE_PERMISSION_MODES
|
||||
).resumeSessionId).toBe('second')
|
||||
})
|
||||
})
|
||||
|
||||
describe('parseRemoteAgentCommandOptions — pi flavor', () => {
|
||||
|
||||
Reference in New Issue
Block a user