feat: archive 阶段校验 task 完成状态,未完成时注入警告提示词
This commit is contained in:
@@ -63,7 +63,7 @@ describe("完整 SDD 流程", () => {
|
||||
const buildPrompt2 = await assembleBuildPrompt(config, TMP_DIR, changeName);
|
||||
expect(buildPrompt2).toContain("已完成");
|
||||
|
||||
const archivePrompt = assembleArchivePrompt(config, changeName);
|
||||
const archivePrompt = await assembleArchivePrompt(config, TMP_DIR, changeName);
|
||||
expect(archivePrompt).toContain("归档");
|
||||
const today = new Date().toISOString().slice(0, 10);
|
||||
const src = getChangeDir(TMP_DIR, changeName);
|
||||
@@ -174,3 +174,46 @@ describe("变更名校验", () => {
|
||||
expect(validRegex.test("")).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("archive 校验", () => {
|
||||
it("task 未全部完成时注入警告提示词", async () => {
|
||||
await runInit(TMP_DIR, ["opencode"]);
|
||||
const config = await loadConfig(TMP_DIR);
|
||||
|
||||
const changeDir = getChangeDir(TMP_DIR, "incomplete-task");
|
||||
await mkdir(changeDir, { recursive: true });
|
||||
await writeFile(join(changeDir, "design.md"), "# 设计");
|
||||
await writeFile(join(changeDir, "task.md"), "- [x] 已完成任务\n- [ ] 未完成任务");
|
||||
|
||||
const prompt = await assembleArchivePrompt(config, TMP_DIR, "incomplete-task");
|
||||
expect(prompt).toContain("警告");
|
||||
expect(prompt).toContain("未完成任务");
|
||||
expect(prompt).toContain("是否确认");
|
||||
});
|
||||
|
||||
it("task 全部完成时不注入警告", async () => {
|
||||
await runInit(TMP_DIR, ["opencode"]);
|
||||
const config = await loadConfig(TMP_DIR);
|
||||
|
||||
const changeDir = getChangeDir(TMP_DIR, "complete-task");
|
||||
await mkdir(changeDir, { recursive: true });
|
||||
await writeFile(join(changeDir, "design.md"), "# 设计");
|
||||
await writeFile(join(changeDir, "task.md"), "- [x] 已完成任务");
|
||||
|
||||
const prompt = await assembleArchivePrompt(config, TMP_DIR, "complete-task");
|
||||
expect(prompt).not.toContain("警告");
|
||||
expect(prompt).toContain("归档阶段");
|
||||
});
|
||||
|
||||
it("task.md 不存在时不追加警告", async () => {
|
||||
await runInit(TMP_DIR, ["opencode"]);
|
||||
const config = await loadConfig(TMP_DIR);
|
||||
|
||||
const changeDir = getChangeDir(TMP_DIR, "no-task");
|
||||
await mkdir(changeDir, { recursive: true });
|
||||
await writeFile(join(changeDir, "design.md"), "# 设计");
|
||||
|
||||
const prompt = await assembleArchivePrompt(config, TMP_DIR, "no-task");
|
||||
expect(prompt).not.toContain("警告");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user