feat: archive 阶段根据 tracked 分支处理

This commit is contained in:
2026-06-10 09:16:57 +08:00
parent 3789d0a7b3
commit 641d23b7c8
2 changed files with 57 additions and 18 deletions

View File

@@ -136,29 +136,30 @@ export async function assembleArchivePrompt(
hint: "请在 .rune/config.yaml 中配置 stages.archive",
});
const changeDir = getChangeDir(projectRoot, changeName);
const taskPath = join(changeDir, "task.md");
const parts: string[] = [];
parts.push(`# 归档阶段:${changeName}\n`);
try {
const taskContent = await readFile(taskPath, "utf-8");
const tasks = parseTasks(taskContent);
const incompleteTasks = tasks.filter((t) => !t.checked);
if (incompleteTasks.length > 0) {
parts.push("## ⚠️ 警告:存在未完成的任务\n");
parts.push(`以下 ${incompleteTasks.length} 个任务尚未完成:`);
for (const t of incompleteTasks) {
parts.push(`- [ ] ${t.text}`);
if (config.metadata?.tracked) {
const changeDir = getChangeDir(projectRoot, changeName);
const taskPath = join(changeDir, "task.md");
try {
const taskContent = await readFile(taskPath, "utf-8");
const tasks = parseTasks(taskContent);
const incompleteTasks = tasks.filter((t) => !t.checked);
if (incompleteTasks.length > 0) {
parts.push("## ⚠️ 警告:存在未完成的任务\n");
parts.push(`以下 ${incompleteTasks.length} 个任务尚未完成:`);
for (const t of incompleteTasks) {
parts.push(`- [ ] ${t.text}`);
}
parts.push("");
parts.push("请询问用户是否确认在任务未全部完成的情况下归档。");
parts.push("如用户确认,则继续归档;否则中止并返回构建阶段。");
parts.push("");
}
parts.push("");
parts.push("请询问用户是否确认在任务未全部完成的情况下归档。");
parts.push("如用户确认,则继续归档;否则中止并返回构建阶段。");
parts.push("");
} catch {
// task.md 不存在时不追加警告
}
} catch {
// task.md 不存在时不追加警告
}
parts.push(archive.prompt);