diff --git a/src/__tests__/cli-routing-issue-resolve.test.ts b/src/__tests__/cli-routing-issue-resolve.test.ts index 522b7e9..1ba690b 100644 --- a/src/__tests__/cli-routing-issue-resolve.test.ts +++ b/src/__tests__/cli-routing-issue-resolve.test.ts @@ -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 () => { diff --git a/src/app/cli/routing.ts b/src/app/cli/routing.ts index aae09e7..140b16e 100644 --- a/src/app/cli/routing.ts +++ b/src/app/cli/routing.ts @@ -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,9 +168,15 @@ export async function executeDefaultAction(task?: string): Promise { let selectedSessionId: string | undefined; const provider = globalConfig.provider; if (provider === 'claude') { - const sessionId = await selectRecentSession(resolvedCwd, lang); - if (sessionId) { - selectedSessionId = sessionId; + 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); diff --git a/src/shared/i18n/labels_en.yaml b/src/shared/i18n/labels_en.yaml index f85f8bc..5826eb6 100644 --- a/src/shared/i18n/labels_en.yaml +++ b/src/shared/i18n/labels_en.yaml @@ -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" diff --git a/src/shared/i18n/labels_ja.yaml b/src/shared/i18n/labels_ja.yaml index 1931d87..8239e7d 100644 --- a/src/shared/i18n/labels_ja.yaml +++ b/src/shared/i18n/labels_ja.yaml @@ -36,6 +36,7 @@ interactive: passthrough: "パススルー" passthroughDescription: "入力をそのままタスクとして渡す" sessionSelector: + confirm: "前回セッションを選択しますか?" prompt: "直近のセッションを引き継ぎますか?" newSession: "新しいセッション" newSessionDescription: "新しい会話を始める"