This commit is contained in:
nrslib 2026-02-11 13:18:41 +09:00
parent ee7f7365db
commit 3ffae2ffc2
4 changed files with 34 additions and 3 deletions

View File

@ -329,6 +329,7 @@ describe('Issue resolution in routing', () => {
it('should pass selected session ID to interactiveMode when provider is claude', async () => {
// Given
mockLoadGlobalConfig.mockReturnValue({ interactivePreviewMovements: 3, provider: 'claude' });
mockConfirm.mockResolvedValue(true);
mockSelectRecentSession.mockResolvedValue('session-xyz');
// When
@ -344,6 +345,27 @@ describe('Issue resolution in routing', () => {
expect.anything(),
'session-xyz',
);
expect(mockConfirm).toHaveBeenCalledWith('Choose a previous session?', false);
});
it('should not call selectRecentSession when user selects no in confirmation', async () => {
// Given
mockLoadGlobalConfig.mockReturnValue({ interactivePreviewMovements: 3, provider: 'claude' });
mockConfirm.mockResolvedValue(false);
// When
await executeDefaultAction();
// Then
expect(mockConfirm).toHaveBeenCalledWith('Choose a previous session?', false);
expect(mockSelectRecentSession).not.toHaveBeenCalled();
expect(mockInteractiveMode).toHaveBeenCalledWith(
'/test/cwd',
undefined,
expect.anything(),
undefined,
);
});
it('should not call selectRecentSession when provider is not claude', async () => {

View File

@ -6,6 +6,7 @@
*/
import { info, error, withProgress } from '../../shared/ui/index.js';
import { confirm } from '../../shared/prompt/index.js';
import { getErrorMessage } from '../../shared/utils/index.js';
import { getLabel } from '../../shared/i18n/index.js';
import { fetchIssue, formatIssueAsTask, checkGhCli, parseIssueNumbers, type GitHubIssue } from '../../infra/github/index.js';
@ -167,11 +168,17 @@ export async function executeDefaultAction(task?: string): Promise<void> {
let selectedSessionId: string | undefined;
const provider = globalConfig.provider;
if (provider === 'claude') {
const shouldSelectSession = await confirm(
getLabel('interactive.sessionSelector.confirm', lang),
false,
);
if (shouldSelectSession) {
const sessionId = await selectRecentSession(resolvedCwd, lang);
if (sessionId) {
selectedSessionId = sessionId;
}
}
}
result = await interactiveMode(resolvedCwd, initialInput, pieceContext, selectedSessionId);
break;
}

View File

@ -36,6 +36,7 @@ interactive:
passthrough: "Passthrough"
passthroughDescription: "Pass your input directly as task text"
sessionSelector:
confirm: "Choose a previous session?"
prompt: "Resume from a recent session?"
newSession: "New session"
newSessionDescription: "Start a fresh conversation"

View File

@ -36,6 +36,7 @@ interactive:
passthrough: "パススルー"
passthroughDescription: "入力をそのままタスクとして渡す"
sessionSelector:
confirm: "前回セッションを選択しますか?"
prompt: "直近のセッションを引き継ぎますか?"
newSession: "新しいセッション"
newSessionDescription: "新しい会話を始める"