Files
Rune-Spec/openspec/changes/configurable-pipeline/tasks.md
lanyuanxiaoyao a6b76b690a docs: 新增 configurable-pipeline 变更提案,探索可配置多阶段流水线模型
- proposal/design/specs/tasks:将固定 5 阶段重构为可配置 pipeline(discuss + pipeline + archive 三明治结构)
- 引入 stage 完成判定(文档落地基线 + 可选 validate 实质门禁)与 finish 硬门禁
- 保留 explore 会话记录 session-ses_1357.md 作为思考溯源
2026-06-15 19:04:03 +08:00

57 lines
3.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## 1. 类型与数据模型
- [ ] 1.1 在 `src/types.ts` 中定义 StageConfig、PipelineConfig、StageStatus、ChangeStatus 接口(按 design.md D9 数据模型)
- [ ] 1.2 从 `src/types.ts` 移除 STAGES 常量和 5 个旧 Stage 接口DiscussStage/PlanStage/TaskStage/BuildStage/ArchiveStage
- [ ] 1.3 清理文件路径常量:移除旧 stage 专用路径保留通用路径changes/、archive/
## 2. 配置系统
- [ ] 2.1 重写 `src/core/config.ts` 加载逻辑:解析新 `stages` 数组格式,返回 PipelineConfig
- [ ] 2.2 实现 config schema 校验stage id 格式(`^[a-z][a-z-]*$`、唯一性、保留字discuss/finish/status/archive/init、pipeline 至少 1 个 stage、validate 可构造为 AsyncFunction
- [ ] 2.3 重写 `src/defaults/config.ts`:默认 5 阶段 pipelinerequirements/design/plan/task/build每个 stage 含对应默认 prompt
- [ ] 2.4 实现配置合并:默认配置 + 用户 `.rune/config.yaml` 覆盖
## 3. 完成判定引擎
- [ ] 3.1 实现 validate 执行器:`new AsyncFunction('ctx', body)`,注入 `ctx.changeDir`,返回 `{ passed: boolean, reason: string | null }`
- [ ] 3.2 重写 `src/core/scanner.ts`:遍历 pipeline stages检查 `<id>.md` 存在性 + 执行 validate若有派生 StageStatus[]
- [ ] 3.3 派生 ChangeStatus计算 currentIndex第一个未 done 的索引)和 allDone
## 4. 提示词组装
- [ ] 4.1 用通用 `assembleStagePrompt(stage: StageConfig, changeDir: string)` 替换 `src/core/assembler.ts` 中 5 个专用 assembleXxxPrompt 函数
## 5. CLI 命令层
- [ ] 5.1 重写 `src/cli.ts`:启动时读取配置,为每个 pipeline stage 动态注册 `rune <stage-id> <change>` 命令
- [ ] 5.2 实现 stage 命令软门禁:检查该 stage 所有前置 fully-done 才输出提示词,否则报错指引
- [ ] 5.3 重写 finish 命令硬门禁:检查所有 stage fully-done列出全部未完成项及原因通过后移动变更目录到 archive/
- [ ] 5.4 保留 discuss 命令:行为与 0.1.x 一致(输出探索模式 prompt无门禁不产文档
- [ ] 5.5 实现 status 命令:输出每阶段状态(文档存在/validate 通过/done+ 整体进度currentIndex/allDone
## 6. 适配器层
- [ ] 6.1 更新 `src/adapters/opencode.ts`:从配置动态注入 stage 命令和 skill 文件(替换 `for (stage of STAGES)`
- [ ] 6.2 更新 `src/adapters/claude-code.ts`:同上,动态注入
## 7. init 命令
- [ ] 7.1 更新 `src/commands/init.ts`:生成新格式 `.rune/config.yaml`(默认 5 阶段 pipeline 配置)
## 8. 测试
- [ ] 8.1 配置校验测试:合法/非法 id、重复 id、保留字、空 pipeline、validate 语法错误
- [ ] 8.2 validate 执行器测试truthy 返回通过、falsy 返回失败、异常捕获含 message、异步函数、ctx.changeDir 正确注入
- [ ] 8.3 scanner 测试空目录全未完成、部分完成、全完成、validate 失败场景、currentIndex/allDone 计算
- [ ] 8.4 软门禁测试:前置全完成放行、前置有未完成拒绝并报错、首阶段无门禁
- [ ] 8.5 finish 硬门禁测试:全完成时归档移动目录、有未完成时拒绝并列出全部未完成项及原因
- [ ] 8.6 动态命令注册测试:从配置生成正确命令集、自定义 stage id 注册为命令
## 9. 质量保障与文档
- [ ] 9.1 运行 `bun test` 确保全量测试通过
- [ ] 9.2 运行 `oxlint` 确保无 lint 错误
- [ ] 9.3 运行 `oxfmt` 确保格式一致
- [ ] 9.4 更新 README.md新配置格式、三明治流程说明、命令列表
- [ ] 9.5 编写迁移指引:旧用户从 0.1.x 升级(重新 init + 手动迁移变更内容)