セッションが見つからない場合に info メッセージを表示
This commit is contained in:
parent
b4a224c0f0
commit
0d73007c3f
@ -19,10 +19,17 @@ vi.mock('../shared/prompt/index.js', () => ({
|
|||||||
selectOption: (...args: [string, unknown[]]) => mockSelectOption(...args),
|
selectOption: (...args: [string, unknown[]]) => mockSelectOption(...args),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
const mockInfo = vi.fn<(message: string) => void>();
|
||||||
|
|
||||||
|
vi.mock('../shared/ui/index.js', () => ({
|
||||||
|
info: (...args: [string]) => mockInfo(...args),
|
||||||
|
}));
|
||||||
|
|
||||||
vi.mock('../shared/i18n/index.js', () => ({
|
vi.mock('../shared/i18n/index.js', () => ({
|
||||||
getLabel: (key: string, _lang: string, params?: Record<string, string>) => {
|
getLabel: (key: string, _lang: string, params?: Record<string, string>) => {
|
||||||
if (key === 'interactive.sessionSelector.newSession') return 'New session';
|
if (key === 'interactive.sessionSelector.newSession') return 'New session';
|
||||||
if (key === 'interactive.sessionSelector.newSessionDescription') return 'Start a new conversation';
|
if (key === 'interactive.sessionSelector.newSessionDescription') return 'Start a new conversation';
|
||||||
|
if (key === 'interactive.sessionSelector.noSessions') return 'No sessions found';
|
||||||
if (key === 'interactive.sessionSelector.messages') return `${params?.count} messages`;
|
if (key === 'interactive.sessionSelector.messages') return `${params?.count} messages`;
|
||||||
if (key === 'interactive.sessionSelector.lastResponse') return `Last: ${params?.response}`;
|
if (key === 'interactive.sessionSelector.lastResponse') return `Last: ${params?.response}`;
|
||||||
if (key === 'interactive.sessionSelector.prompt') return 'Select a session';
|
if (key === 'interactive.sessionSelector.prompt') return 'Select a session';
|
||||||
@ -44,6 +51,7 @@ describe('selectRecentSession', () => {
|
|||||||
|
|
||||||
expect(result).toBeNull();
|
expect(result).toBeNull();
|
||||||
expect(mockSelectOption).not.toHaveBeenCalled();
|
expect(mockSelectOption).not.toHaveBeenCalled();
|
||||||
|
expect(mockInfo).toHaveBeenCalledWith('No sessions found');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return null when user selects __new__', async () => {
|
it('should return null when user selects __new__', async () => {
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
import { loadSessionIndex, extractLastAssistantResponse } from '../../infra/claude/session-reader.js';
|
import { loadSessionIndex, extractLastAssistantResponse } from '../../infra/claude/session-reader.js';
|
||||||
import { selectOption, type SelectOptionItem } from '../../shared/prompt/index.js';
|
import { selectOption, type SelectOptionItem } from '../../shared/prompt/index.js';
|
||||||
import { getLabel } from '../../shared/i18n/index.js';
|
import { getLabel } from '../../shared/i18n/index.js';
|
||||||
|
import { info } from '../../shared/ui/index.js';
|
||||||
|
|
||||||
/** Maximum number of sessions to display */
|
/** Maximum number of sessions to display */
|
||||||
const MAX_DISPLAY_SESSIONS = 10;
|
const MAX_DISPLAY_SESSIONS = 10;
|
||||||
@ -53,6 +54,7 @@ export async function selectRecentSession(
|
|||||||
const sessions = loadSessionIndex(cwd);
|
const sessions = loadSessionIndex(cwd);
|
||||||
|
|
||||||
if (sessions.length === 0) {
|
if (sessions.length === 0) {
|
||||||
|
info(getLabel('interactive.sessionSelector.noSessions', lang));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -40,6 +40,7 @@ interactive:
|
|||||||
prompt: "Resume from a recent session?"
|
prompt: "Resume from a recent session?"
|
||||||
newSession: "New session"
|
newSession: "New session"
|
||||||
newSessionDescription: "Start a fresh conversation"
|
newSessionDescription: "Start a fresh conversation"
|
||||||
|
noSessions: "No resumable sessions were found. Starting a new session."
|
||||||
lastResponse: "Last: {response}"
|
lastResponse: "Last: {response}"
|
||||||
messages: "{count} messages"
|
messages: "{count} messages"
|
||||||
previousTask:
|
previousTask:
|
||||||
|
|||||||
@ -40,6 +40,7 @@ interactive:
|
|||||||
prompt: "直近のセッションを引き継ぎますか?"
|
prompt: "直近のセッションを引き継ぎますか?"
|
||||||
newSession: "新しいセッション"
|
newSession: "新しいセッション"
|
||||||
newSessionDescription: "新しい会話を始める"
|
newSessionDescription: "新しい会話を始める"
|
||||||
|
noSessions: "引き継げるセッションが見つかりませんでした。新しいセッションで開始します。"
|
||||||
lastResponse: "最後: {response}"
|
lastResponse: "最後: {response}"
|
||||||
messages: "{count}メッセージ"
|
messages: "{count}メッセージ"
|
||||||
previousTask:
|
previousTask:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user