feat: 将 task 从 plan 文档提升为独立 SDD 阶段

This commit is contained in:
2026-06-10 22:38:19 +08:00
parent 289a7c6633
commit c4f83a3753
20 changed files with 318 additions and 353 deletions

View File

@@ -7,6 +7,7 @@ import { loadConfig, getChangeDir, getArchiveDir } from "../../src/core/config.t
import {
assembleDiscussPrompt,
assemblePlanPrompt,
assembleTaskPrompt,
assembleBuildPrompt,
assembleArchivePrompt,
} from "../../src/core/assembler.ts";
@@ -23,7 +24,7 @@ afterEach(async () => {
});
describe("完整 SDD 流程", () => {
it("init → discuss → plan → build → archive 完整流程", async () => {
it("init → discuss → plan → task → build → archive 完整流程", async () => {
await runInit(TMP_DIR, ["opencode"]);
expect(existsSync(join(TMP_DIR, ".rune", "config.yaml"))).toBe(true);
expect(existsSync(join(TMP_DIR, ".opencode", "commands", "rune-discuss.md"))).toBe(true);
@@ -39,6 +40,12 @@ describe("完整 SDD 流程", () => {
const changeDir = getChangeDir(TMP_DIR, changeName);
await writeFile(join(changeDir, "design.md"), "# 用户认证设计\n\n## 背景\n需要用户登录功能");
const taskPrompt = await assembleTaskPrompt(config, TMP_DIR, changeName);
expect(taskPrompt).toContain("user-auth");
expect(taskPrompt).toContain("task.md");
expect(taskPrompt).toContain("design.md");
await writeFile(join(changeDir, "task.md"), "- [ ] 实现登录 API\n- [ ] 编写登录测试");
const changes = await scanChanges(TMP_DIR, config);
@@ -97,9 +104,7 @@ describe("完整 SDD 流程", () => {
await writeFile(
join(TMP_DIR, ".rune", "config.yaml"),
`metadata:
tracked: false
stages:
`stages:
discuss:
prompt: 自定义讨论
plan:
@@ -121,6 +126,7 @@ stages:
expect(planPrompt).toContain("规格文档");
expect(planPrompt).not.toContain("design");
expect(config.stages.task).toBeDefined();
expect(config.stages.build).toBeDefined();
expect(config.stages.archive).toBeDefined();
});
@@ -139,11 +145,6 @@ stages:
const designDoc = changes[0].documents.find((d) => d.name === "design");
expect(designDoc).toBeDefined();
expect(designDoc!.completed).toBe(true);
const taskDoc = changes[0].documents.find((d) => d.name === "task");
expect(taskDoc).toBeDefined();
expect(taskDoc!.completed).toBe(false);
expect(taskDoc!.dependMet).toBe(true);
});
});