refactor: archive 阶段改用 PromptBuilder 组装提示词
This commit is contained in:
@@ -190,8 +190,10 @@ export async function assembleArchivePrompt(
|
||||
hint: "请在 .rune/config.yaml 中配置 stages.archive",
|
||||
});
|
||||
|
||||
const parts: string[] = [];
|
||||
parts.push(`# 归档阶段:${changeName}\n`);
|
||||
const builder = new PromptBuilder();
|
||||
|
||||
builder.head(`# 归档阶段:${changeName}`);
|
||||
builder.prompt(archive.prompt);
|
||||
|
||||
const changeDir = getChangeDir(projectRoot, changeName);
|
||||
const taskPath = join(changeDir, "task.md");
|
||||
@@ -201,15 +203,10 @@ export async function assembleArchivePrompt(
|
||||
const tasks = parseTasks(taskContent);
|
||||
const incompleteTasks = tasks.filter((t) => !t.checked);
|
||||
if (incompleteTasks.length > 0) {
|
||||
parts.push("## ⚠️ 警告:存在未完成的任务\n");
|
||||
parts.push("以下任务尚未完成:");
|
||||
for (const t of incompleteTasks) {
|
||||
parts.push(`- [ ] ${t.text}`);
|
||||
}
|
||||
parts.push("");
|
||||
parts.push("询问用户是否确认在任务未全部完成的情况下归档。");
|
||||
parts.push("如用户确认,则继续执行归档操作;否则中止并返回构建阶段。");
|
||||
parts.push("");
|
||||
const taskLines = incompleteTasks.map((t) => `- [ ] ${t.text}`).join("\n");
|
||||
builder.warn(
|
||||
`## ⚠️ 警告:存在未完成的任务\n\n以下任务尚未完成:\n${taskLines}\n\n询问用户是否确认在任务未全部完成的情况下归档。\n如用户确认,则继续执行归档操作;否则中止并返回构建阶段。`,
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
const code = (e as NodeJS.ErrnoException)?.code;
|
||||
@@ -219,6 +216,5 @@ export async function assembleArchivePrompt(
|
||||
}
|
||||
}
|
||||
|
||||
parts.push(archive.prompt);
|
||||
return applyCommandPrefix(parts.join("\n"), config);
|
||||
return applyCommandPrefix(builder.build(), config);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user