interactive.tsからsummary/runSelector/runSessionReader/selectorUtilsを分離し、 run session参照をrouting層からinstructMode層に移動。instructBranchで新タスク 作成の代わりに既存タスクのrequeueを使用する方式に変更。worktree確認プロンプトを 廃止し常時有効化。
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
import { confirm } from '../../../shared/prompt/index.js';
|
|
import { getLabel } from '../../../shared/i18n/index.js';
|
|
import {
|
|
selectRun,
|
|
loadRunSessionContext,
|
|
listRecentRuns,
|
|
type RunSessionContext,
|
|
} from '../../interactive/index.js';
|
|
|
|
export function appendRetryNote(existing: string | undefined, additional: string): string {
|
|
const trimmedAdditional = additional.trim();
|
|
if (trimmedAdditional === '') {
|
|
throw new Error('Additional instruction is empty.');
|
|
}
|
|
if (!existing || existing.trim() === '') {
|
|
return trimmedAdditional;
|
|
}
|
|
return `${existing}\n\n${trimmedAdditional}`;
|
|
}
|
|
|
|
export async function selectRunSessionContext(
|
|
projectDir: string,
|
|
lang: 'en' | 'ja',
|
|
): Promise<RunSessionContext | undefined> {
|
|
if (listRecentRuns(projectDir).length === 0) {
|
|
return undefined;
|
|
}
|
|
|
|
const shouldReferenceRun = await confirm(
|
|
getLabel('interactive.runSelector.confirm', lang),
|
|
false,
|
|
);
|
|
if (!shouldReferenceRun) {
|
|
return undefined;
|
|
}
|
|
|
|
const selectedSlug = await selectRun(projectDir, lang);
|
|
if (!selectedSlug) {
|
|
return undefined;
|
|
}
|
|
|
|
return loadRunSessionContext(projectDir, selectedSlug);
|
|
}
|