feat: archive 阶段根据 tracked 分支处理
This commit is contained in:
@@ -204,6 +204,44 @@ describe("assembleArchivePrompt", () => {
|
||||
expect(prompt).toContain("user-auth");
|
||||
expect(prompt).toContain("归档");
|
||||
});
|
||||
|
||||
it("tracked=false 时不读取 task.md,只输出通用提示词", async () => {
|
||||
const changeDir = join(TMP_DIR, ".rune", "changes", "user-auth");
|
||||
await mkdir(changeDir, { recursive: true });
|
||||
await writeFile(join(changeDir, "task.md"), "- [ ] 未完成任务");
|
||||
const config: RuneConfig = {
|
||||
stages: { archive: { prompt: "确认归档" } },
|
||||
metadata: { tracked: false },
|
||||
};
|
||||
const prompt = await assembleArchivePrompt(config, TMP_DIR, "user-auth");
|
||||
expect(prompt).toContain("确认归档");
|
||||
expect(prompt).not.toContain("未完成");
|
||||
});
|
||||
|
||||
it("tracked=true 时读取 task.md 并注入未完成任务警告", async () => {
|
||||
const changeDir = join(TMP_DIR, ".rune", "changes", "user-auth");
|
||||
await mkdir(changeDir, { recursive: true });
|
||||
await writeFile(join(changeDir, "task.md"), "- [ ] 未完成任务");
|
||||
const config: RuneConfig = {
|
||||
stages: { archive: { prompt: "归档阶段" } },
|
||||
metadata: { tracked: true },
|
||||
};
|
||||
const prompt = await assembleArchivePrompt(config, TMP_DIR, "user-auth");
|
||||
expect(prompt).toContain("未完成");
|
||||
expect(prompt).toContain("未完成任务");
|
||||
});
|
||||
|
||||
it("tracked=true 且所有任务完成时不注入警告", async () => {
|
||||
const changeDir = join(TMP_DIR, ".rune", "changes", "user-auth");
|
||||
await mkdir(changeDir, { recursive: true });
|
||||
await writeFile(join(changeDir, "task.md"), "- [x] 已完成任务");
|
||||
const config: RuneConfig = {
|
||||
stages: { archive: { prompt: "归档阶段" } },
|
||||
metadata: { tracked: true },
|
||||
};
|
||||
const prompt = await assembleArchivePrompt(config, TMP_DIR, "user-auth");
|
||||
expect(prompt).not.toContain("未完成");
|
||||
});
|
||||
});
|
||||
|
||||
describe("命令前缀替换", () => {
|
||||
|
||||
Reference in New Issue
Block a user