✨ feat(vscode): 头脑风暴会话一键续聊,终端开着直接打进去、关了带提示词恢复
详情面板「头脑风暴会话id」行的 ▶ 改为续聊:规划终端还开着就把续聊提示词 打进去;终端关了但有会话 id 就 `claude --resume <id>` 带提示词恢复;没会话 才新开。属性行右侧按钮改为数组,续聊与关闭 tab 可并存。 Claude-Session: https://claude.ai/code/session_01KDcq9HcrVLs2c9tkRxasub
This commit is contained in:
1 parent
90600cf070
commit
ae875756a9
15 files changed
+307
-297
No files matched your search
@@ -0,0 +1,23 @@
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import { buildCcCommand } from '../../src/cc/ccCommand'
|
||||
|
||||
vi.mock('../../src/cc/claudeBin', () => ({
|
||||
resolveClaudeBin: () => 'claude',
|
||||
}))
|
||||
|
||||
describe('buildCcCommand', () => {
|
||||
it('appends the prompt as a positional arg for a fresh session', () => {
|
||||
expect(buildCcCommand({ profilePath: '/p.json', prompt: 'hello' }))
|
||||
.toBe('claude --dangerously-skip-permissions --settings \'/p.json\' \'hello\'')
|
||||
})
|
||||
|
||||
it('resumes without a prompt when only a session id is given', () => {
|
||||
expect(buildCcCommand({ profilePath: '/p.json', resumeSessionId: 'abc' }))
|
||||
.toBe('claude --dangerously-skip-permissions --settings \'/p.json\' --resume abc')
|
||||
})
|
||||
|
||||
it('resumes and hands the prompt to the restored session', () => {
|
||||
expect(buildCcCommand({ profilePath: '/p.json', resumeSessionId: 'abc', prompt: 'go on' }))
|
||||
.toBe('claude --dangerously-skip-permissions --settings \'/p.json\' --resume abc \'go on\'')
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,20 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { pickBrainstormContinuePath } from '../../src/panel/brainstormContinue'
|
||||
|
||||
describe('pickBrainstormContinuePath', () => {
|
||||
it('types the prompt into the live terminal when the brainstorm tab is still open', () => {
|
||||
expect(pickBrainstormContinuePath({ liveTerminal: true, sessionId: 'abc' })).toBe('inject')
|
||||
})
|
||||
|
||||
it('resumes the recorded session with the prompt when the tab is closed', () => {
|
||||
expect(pickBrainstormContinuePath({ liveTerminal: false, sessionId: 'abc' })).toBe('resume')
|
||||
})
|
||||
|
||||
it('starts a fresh session when the issue has no brainstorm session yet', () => {
|
||||
expect(pickBrainstormContinuePath({ liveTerminal: false, sessionId: undefined })).toBe('fresh')
|
||||
})
|
||||
|
||||
it('prefers the live terminal even when no session id has been recorded yet', () => {
|
||||
expect(pickBrainstormContinuePath({ liveTerminal: true, sessionId: undefined })).toBe('inject')
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user