@boyingliu01/xp-gate 0.18.5 → 0.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/adapter-common.sh +27 -0
- package/adapters/gate-3.sh +0 -0
- package/adapters/gate-4.sh +0 -0
- package/adapters/gate-7.sh +0 -0
- package/adapters/gate-8.sh +0 -0
- package/adapters/gate-9.sh +0 -0
- package/adapters/powershell.sh +114 -35
- package/adapters/typescript.sh +8 -8
- package/build-integrity/__tests__/import-resolver.test.ts +22 -0
- package/build-integrity/__tests__/orchestrator.test.ts +1 -2
- package/build-integrity/gate-10.ts +7 -0
- package/gate-12-file-hygiene.sh +230 -0
- package/hooks/adapter-common.sh +27 -0
- package/hooks/gate-10.sh +105 -0
- package/hooks/gate-12-file-hygiene.sh +0 -0
- package/hooks/lib/validate-code-walkthrough.cjs +125 -0
- package/hooks/pre-commit +130 -33
- package/hooks/pre-push +15 -91
- package/lib/__tests__/check-version.test.js +67 -46
- package/lib/__tests__/doctor.test.js +7 -6
- package/lib/__tests__/gate-runner.test.js +267 -0
- package/lib/__tests__/init.test.js +32 -0
- package/lib/__tests__/npm-package.test.js +13 -0
- package/lib/__tests__/phase-transition.test.js +604 -12
- package/lib/__tests__/sprint-discovery.test.ts +0 -1
- package/lib/__tests__/sprint-status-rework.test.js +100 -1
- package/lib/__tests__/update-hooks.test.js +143 -10
- package/lib/__tests__/upgrade-exec.test.js +73 -45
- package/lib/__tests__/upgrade-skill-sync.test.js +1 -1
- package/lib/__tests__/upgrade.test.js +12 -11
- package/lib/doctor.js +2 -1
- package/lib/gate-runner.js +68 -23
- package/lib/init.js +34 -5
- package/lib/install-skill.js +1 -0
- package/lib/mattpocock-license-verdict.json +1 -1
- package/lib/phase-transition.js +203 -23
- package/lib/shared-paths.js +2 -0
- package/lib/sprint-status.js +15 -4
- package/lib/test-alignment.ts +3 -13
- package/lib/update-hooks.js +129 -15
- package/mock-policy/AGENTS.md +4 -4
- package/mock-policy/__tests__/gate-m3.test.ts +0 -5
- package/mock-policy/__tests__/scope-scanner.test.ts +8 -2
- package/mutation/AGENTS.md +3 -3
- package/mutation/__tests__/mutmut-runner.test.ts +443 -2
- package/mutation/__tests__/update-baseline.test.ts +0 -2
- package/mutation/runners/mutmut-runner.ts +67 -17
- package/package.json +9 -3
- package/plugins/claude-code/.claude-plugin/plugin.json +1 -1
- package/plugins/claude-code/skills/clipboard-vision/SKILL.md +47 -0
- package/plugins/claude-code/skills/clipboard-vision/__tests__/clipboard-vision-distribution.test.cjs +65 -0
- package/plugins/claude-code/skills/clipboard-vision/__tests__/clipboard-vision-security.test.cjs +185 -0
- package/plugins/claude-code/skills/clipboard-vision/__tests__/clipboard-vision.Tests.ps1 +138 -0
- package/plugins/claude-code/skills/clipboard-vision/__tests__/clipboard-vision.test.cjs +273 -0
- package/plugins/claude-code/skills/clipboard-vision/describe-clipboard.ps1 +115 -0
- package/plugins/claude-code/skills/clipboard-vision/describe-clipboard.sh +161 -0
- package/plugins/claude-code/skills/clipboard-vision/scripts/clipboard-vision.ps1 +86 -0
- package/plugins/claude-code/skills/clipboard-vision/scripts/clipboard-vision.sh +137 -0
- package/plugins/claude-code/skills/delphi-review/.delphi-config.json.example +24 -27
- package/plugins/claude-code/skills/delphi-review/AGENTS.md +12 -11
- package/plugins/claude-code/skills/delphi-review/INSTALL.md +15 -17
- package/plugins/claude-code/skills/delphi-review/SKILL.md +30 -29
- package/plugins/claude-code/skills/delphi-review/opencode.json.delphi.example +6 -10
- package/plugins/claude-code/skills/delphi-review/references/code-walkthrough.md +33 -49
- package/plugins/claude-code/skills/delphi-review/references/requirements.md +66 -54
- package/plugins/claude-code/skills/delphi-review/references/round-templates.md +7 -7
- package/plugins/claude-code/skills/sprint-flow/AGENTS.md +4 -4
- package/plugins/claude-code/skills/sprint-flow/SKILL.md +4 -4
- package/plugins/claude-code/skills/sprint-flow/references/components/skill-invocations.md +2 -2
- package/plugins/claude-code/skills/sprint-flow/references/force-levels.md +37 -35
- package/plugins/claude-code/skills/sprint-flow/references/orchestration-rules.md +1 -1
- package/plugins/claude-code/skills/sprint-flow/references/phase-1-prep.md +1 -1
- package/plugins/claude-code/skills/sprint-flow/references/phase-2-design.md +24 -14
- package/plugins/claude-code/skills/sprint-flow/references/phase-4-verify.md +6 -6
- package/plugins/claude-code/skills/sprint-flow/references/phase-overview.md +2 -2
- package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +3 -3
- package/plugins/dsh/README.md +25 -0
- package/plugins/dsh/cordis.patch.yml +7 -0
- package/plugins/dsh/package.json +70 -0
- package/plugins/dsh/scripts/prepack.cjs +82 -0
- package/plugins/dsh/skills/admin-template-guidelines/SKILL.md +113 -0
- package/plugins/dsh/skills/admin-template-guidelines/references/rule-1.md +91 -0
- package/plugins/dsh/skills/admin-template-guidelines/references/rule-2.md +155 -0
- package/plugins/dsh/skills/admin-template-guidelines/references/rule-3.md +70 -0
- package/plugins/dsh/skills/admin-template-guidelines/references/rule-4.md +154 -0
- package/plugins/dsh/skills/admin-template-guidelines/references/rule-5.md +126 -0
- package/plugins/dsh/skills/admin-template-guidelines/references/rule-6.md +180 -0
- package/plugins/dsh/skills/batch-grill-me/SKILL.md +15 -0
- package/plugins/dsh/skills/clipboard-vision/SKILL.md +47 -0
- package/plugins/dsh/skills/clipboard-vision/__tests__/clipboard-vision-distribution.test.cjs +65 -0
- package/plugins/dsh/skills/clipboard-vision/__tests__/clipboard-vision-security.test.cjs +185 -0
- package/plugins/dsh/skills/clipboard-vision/__tests__/clipboard-vision.Tests.ps1 +138 -0
- package/plugins/dsh/skills/clipboard-vision/__tests__/clipboard-vision.test.cjs +273 -0
- package/plugins/dsh/skills/clipboard-vision/describe-clipboard.ps1 +115 -0
- package/plugins/dsh/skills/clipboard-vision/describe-clipboard.sh +161 -0
- package/plugins/dsh/skills/clipboard-vision/scripts/clipboard-vision.ps1 +86 -0
- package/plugins/dsh/skills/clipboard-vision/scripts/clipboard-vision.sh +137 -0
- package/plugins/dsh/skills/delphi-review/.delphi-config.json.example +70 -0
- package/plugins/dsh/skills/delphi-review/AGENTS.md +67 -0
- package/plugins/dsh/skills/delphi-review/INSTALL.md +150 -0
- package/plugins/dsh/skills/delphi-review/SKILL.md +559 -0
- package/plugins/dsh/skills/delphi-review/hooks.md +19 -0
- package/plugins/dsh/skills/delphi-review/opencode.json.delphi.example +52 -0
- package/plugins/dsh/skills/delphi-review/references/code-walkthrough.md +470 -0
- package/plugins/dsh/skills/delphi-review/references/orchestrator-dispatch.md +64 -0
- package/plugins/dsh/skills/delphi-review/references/requirements.md +402 -0
- package/plugins/dsh/skills/delphi-review/references/round-templates.md +134 -0
- package/plugins/dsh/skills/delphi-review/scripts/verify-consensus.sh +43 -0
- package/plugins/dsh/skills/delphi-review/tools.md +29 -0
- package/plugins/dsh/skills/domain-modeling/ADR-FORMAT.md +64 -0
- package/plugins/dsh/skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
- package/plugins/dsh/skills/domain-modeling/SKILL.md +74 -0
- package/plugins/dsh/skills/grill-with-docs/SKILL.md +7 -0
- package/plugins/dsh/skills/grilling/SKILL.md +12 -0
- package/plugins/dsh/skills/improve-codebase-architecture/SKILL.md +156 -0
- package/plugins/dsh/skills/ralph-loop/SKILL.md +198 -0
- package/plugins/dsh/skills/ralph-loop/references/components.md +113 -0
- package/plugins/dsh/skills/ralph-loop/references/phase-2-build-ralph.md +89 -0
- package/plugins/dsh/skills/ralph-loop/references/workflow-details.md +99 -0
- package/plugins/dsh/skills/ralph-loop/templates/progress-log.md +36 -0
- package/plugins/dsh/skills/sprint-flow/AGENTS.md +103 -0
- package/plugins/dsh/skills/sprint-flow/SKILL.md +411 -0
- package/plugins/dsh/skills/sprint-flow/__tests__/sprint-flow.test.cjs +457 -0
- package/plugins/dsh/skills/sprint-flow/hooks.md +18 -0
- package/plugins/dsh/skills/sprint-flow/references/components/memory.md +87 -0
- package/plugins/dsh/skills/sprint-flow/references/components/middleware.md +75 -0
- package/plugins/dsh/skills/sprint-flow/references/components/skill-invocations.md +105 -0
- package/plugins/dsh/skills/sprint-flow/references/components/system-prompt.md +27 -0
- package/plugins/dsh/skills/sprint-flow/references/components/tool-descriptions.md +95 -0
- package/plugins/dsh/skills/sprint-flow/references/force-levels.md +204 -0
- package/plugins/dsh/skills/sprint-flow/references/orchestration-rules.md +236 -0
- package/plugins/dsh/skills/sprint-flow/references/phase-1-prep.md +294 -0
- package/plugins/dsh/skills/sprint-flow/references/phase-2-design.md +273 -0
- package/plugins/dsh/skills/sprint-flow/references/phase-3-build.md +348 -0
- package/plugins/dsh/skills/sprint-flow/references/phase-4-verify.md +225 -0
- package/plugins/dsh/skills/sprint-flow/references/phase-5-ship.md +222 -0
- package/plugins/dsh/skills/sprint-flow/references/phase-6-close.md +266 -0
- package/plugins/dsh/skills/sprint-flow/references/phase-overview.md +486 -0
- package/plugins/dsh/skills/sprint-flow/scripts/verify-sprint-state.sh +38 -0
- package/plugins/dsh/skills/sprint-flow/templates/auto-estimate-learning-log.md +136 -0
- package/plugins/dsh/skills/sprint-flow/templates/auto-estimate-output-template.md +110 -0
- package/plugins/dsh/skills/sprint-flow/templates/emergent-issues-template.md +120 -0
- package/plugins/dsh/skills/sprint-flow/templates/pain-document-template.md +115 -0
- package/plugins/dsh/skills/sprint-flow/templates/sprint-progress-template.md +140 -0
- package/plugins/dsh/skills/sprint-flow/templates/sprint-summary-template.md +121 -0
- package/plugins/dsh/skills/sprint-flow/tools.md +29 -0
- package/plugins/dsh/skills/test-driven-development/SKILL.md +371 -0
- package/plugins/dsh/skills/test-driven-development/testing-anti-patterns.md +299 -0
- package/plugins/dsh/skills/test-specification-alignment/AGENTS.md +56 -0
- package/plugins/dsh/skills/test-specification-alignment/SKILL.md +205 -0
- package/plugins/dsh/skills/test-specification-alignment/references/alignment-verification-algorithm.md +493 -0
- package/plugins/dsh/skills/test-specification-alignment/references/phase2-constraint-enforcement.md +431 -0
- package/plugins/dsh/skills/test-specification-alignment/references/specification-format.md +348 -0
- package/plugins/dsh/skills/to-issues/SKILL.md +277 -0
- package/plugins/dsh/src/command.test.ts +102 -0
- package/plugins/dsh/src/command.ts +75 -0
- package/plugins/dsh/src/contract.test.ts +62 -0
- package/plugins/dsh/src/gate-runner.test.ts +100 -0
- package/plugins/dsh/src/gate-runner.ts +58 -0
- package/plugins/dsh/src/index.test.ts +97 -0
- package/plugins/dsh/src/index.ts +94 -0
- package/plugins/dsh/src/skills.test.ts +58 -0
- package/plugins/dsh/tsconfig.build.json +13 -0
- package/plugins/dsh/tsconfig.json +19 -0
- package/plugins/dsh/vitest.config.ts +8 -0
- package/plugins/opencode/package.json +1 -1
- package/plugins/opencode/scripts/prepack.cjs +1 -0
- package/plugins/opencode/skills/clipboard-vision/SKILL.md +47 -0
- package/plugins/opencode/skills/clipboard-vision/__tests__/clipboard-vision-distribution.test.cjs +65 -0
- package/plugins/opencode/skills/clipboard-vision/__tests__/clipboard-vision-security.test.cjs +185 -0
- package/plugins/opencode/skills/clipboard-vision/__tests__/clipboard-vision.Tests.ps1 +138 -0
- package/plugins/opencode/skills/clipboard-vision/__tests__/clipboard-vision.test.cjs +273 -0
- package/plugins/opencode/skills/clipboard-vision/describe-clipboard.ps1 +115 -0
- package/plugins/opencode/skills/clipboard-vision/describe-clipboard.sh +161 -0
- package/plugins/opencode/skills/clipboard-vision/scripts/clipboard-vision.ps1 +86 -0
- package/plugins/opencode/skills/clipboard-vision/scripts/clipboard-vision.sh +137 -0
- package/plugins/opencode/skills/delphi-review/.delphi-config.json.example +24 -27
- package/plugins/opencode/skills/delphi-review/AGENTS.md +12 -11
- package/plugins/opencode/skills/delphi-review/INSTALL.md +15 -17
- package/plugins/opencode/skills/delphi-review/SKILL.md +30 -29
- package/plugins/opencode/skills/delphi-review/opencode.json.delphi.example +6 -10
- package/plugins/opencode/skills/delphi-review/references/code-walkthrough.md +33 -49
- package/plugins/opencode/skills/delphi-review/references/requirements.md +66 -54
- package/plugins/opencode/skills/delphi-review/references/round-templates.md +7 -7
- package/plugins/opencode/skills/sprint-flow/AGENTS.md +4 -4
- package/plugins/opencode/skills/sprint-flow/SKILL.md +4 -4
- package/plugins/opencode/skills/sprint-flow/references/components/skill-invocations.md +2 -2
- package/plugins/opencode/skills/sprint-flow/references/force-levels.md +37 -35
- package/plugins/opencode/skills/sprint-flow/references/orchestration-rules.md +1 -1
- package/plugins/opencode/skills/sprint-flow/references/phase-1-prep.md +1 -1
- package/plugins/opencode/skills/sprint-flow/references/phase-2-design.md +24 -14
- package/plugins/opencode/skills/sprint-flow/references/phase-4-verify.md +6 -6
- package/plugins/opencode/skills/sprint-flow/references/phase-overview.md +2 -2
- package/plugins/opencode/skills/test-specification-alignment/AGENTS.md +3 -3
- package/plugins/qoder/plugin.json +1 -1
- package/plugins/qoder/skills/clipboard-vision/SKILL.md +47 -0
- package/plugins/qoder/skills/clipboard-vision/__tests__/clipboard-vision-distribution.test.cjs +65 -0
- package/plugins/qoder/skills/clipboard-vision/__tests__/clipboard-vision-security.test.cjs +185 -0
- package/plugins/qoder/skills/clipboard-vision/__tests__/clipboard-vision.Tests.ps1 +138 -0
- package/plugins/qoder/skills/clipboard-vision/__tests__/clipboard-vision.test.cjs +273 -0
- package/plugins/qoder/skills/clipboard-vision/clipboard-vision/SKILL.md +47 -0
- package/plugins/qoder/skills/clipboard-vision/clipboard-vision/__tests__/clipboard-vision-distribution.test.cjs +65 -0
- package/plugins/qoder/skills/clipboard-vision/clipboard-vision/__tests__/clipboard-vision-security.test.cjs +185 -0
- package/plugins/qoder/skills/clipboard-vision/clipboard-vision/__tests__/clipboard-vision.Tests.ps1 +138 -0
- package/plugins/qoder/skills/clipboard-vision/clipboard-vision/__tests__/clipboard-vision.test.cjs +273 -0
- package/plugins/qoder/skills/clipboard-vision/clipboard-vision/scripts/clipboard-vision.ps1 +86 -0
- package/plugins/qoder/skills/clipboard-vision/clipboard-vision/scripts/clipboard-vision.sh +137 -0
- package/plugins/qoder/skills/clipboard-vision/scripts/clipboard-vision.ps1 +86 -0
- package/plugins/qoder/skills/clipboard-vision/scripts/clipboard-vision.sh +137 -0
- package/plugins/qoder/skills/delphi-review/.delphi-config.json.example +3 -11
- package/plugins/qoder/skills/delphi-review/AGENTS.md +14 -16
- package/plugins/qoder/skills/delphi-review/INSTALL.md +12 -12
- package/plugins/qoder/skills/delphi-review/SKILL.md +58 -25
- package/plugins/qoder/skills/delphi-review/opencode.json.delphi.example +1 -1
- package/plugins/qoder/skills/delphi-review/references/code-walkthrough.md +33 -49
- package/plugins/qoder/skills/sprint-flow/AGENTS.md +4 -4
- package/plugins/qoder/skills/sprint-flow/SKILL.md +2 -2
- package/plugins/qoder/skills/sprint-flow/references/force-levels.md +38 -35
- package/plugins/qoder/skills/sprint-flow/references/phase-1-prep.md +1 -1
- package/plugins/qoder/skills/sprint-flow/references/phase-2-design.md +48 -6
- package/plugins/qoder/skills/sprint-flow/references/phase-4-verify.md +5 -6
- package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +3 -3
- package/principles/AGENTS.md +3 -3
- package/scripts/__tests__/sync-package-content.test.js +30 -0
- package/scripts/delphi-external-review.cjs +194 -63
- package/scripts/sync-package-content.js +9 -2
- package/skills/clipboard-vision/SKILL.md +47 -0
- package/skills/clipboard-vision/__tests__/clipboard-vision-distribution.test.cjs +65 -0
- package/skills/clipboard-vision/__tests__/clipboard-vision-security.test.cjs +185 -0
- package/skills/clipboard-vision/__tests__/clipboard-vision.Tests.ps1 +138 -0
- package/skills/clipboard-vision/__tests__/clipboard-vision.test.cjs +273 -0
- package/skills/clipboard-vision/describe-clipboard.ps1 +115 -0
- package/skills/clipboard-vision/describe-clipboard.sh +161 -0
- package/skills/clipboard-vision/scripts/clipboard-vision.ps1 +86 -0
- package/skills/clipboard-vision/scripts/clipboard-vision.sh +137 -0
- package/skills/delphi-review/.delphi-config.json.example +24 -27
- package/skills/delphi-review/AGENTS.md +12 -11
- package/skills/delphi-review/INSTALL.md +15 -17
- package/skills/delphi-review/SKILL.md +30 -29
- package/skills/delphi-review/opencode.json.delphi.example +6 -10
- package/skills/delphi-review/references/code-walkthrough.md +33 -49
- package/skills/delphi-review/references/requirements.md +66 -54
- package/skills/delphi-review/references/round-templates.md +7 -7
- package/skills/sprint-flow/AGENTS.md +4 -4
- package/skills/sprint-flow/SKILL.md +4 -4
- package/skills/sprint-flow/references/components/skill-invocations.md +2 -2
- package/skills/sprint-flow/references/force-levels.md +37 -35
- package/skills/sprint-flow/references/orchestration-rules.md +1 -1
- package/skills/sprint-flow/references/phase-1-prep.md +1 -1
- package/skills/sprint-flow/references/phase-2-design.md +24 -14
- package/skills/sprint-flow/references/phase-4-verify.md +6 -6
- package/skills/sprint-flow/references/phase-overview.md +2 -2
- package/skills/test-specification-alignment/AGENTS.md +3 -3
- package/sprint-gate.sh +291 -0
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
# Phase 1/6: PREP(准备工作 — worktree 隔离 + 规模评估)
|
|
2
|
+
|
|
3
|
+
**执行时机**: `/sprint-flow` 启动后、Phase 2/6 DESIGN 之前。**自动执行**。
|
|
4
|
+
|
|
5
|
+
**目的**: 默认在 git worktree 中隔离 sprint 工作,防止在保护分支上直接运行造成代码污染。随后自动评估需求规模,匹配适度流程,避免小需求走重量级流程造成资源浪费。
|
|
6
|
+
|
|
7
|
+
**对应旧模型**: Phase -1 ISOLATE + Phase -0.5 AUTO-ESTIMATE
|
|
8
|
+
|
|
9
|
+
**核心原则**:
|
|
10
|
+
- **隔离优先**: 默认 worktree 隔离,防止保护分支污染
|
|
11
|
+
- **客观指标 > 主观判断**: 依赖代码结构分析,不依赖人/AI 的主观直觉
|
|
12
|
+
- **显式告知**: 用户看到客观指标,不是 AI 主观结论
|
|
13
|
+
- **可纠偏**: 用户可接受/修改/取消
|
|
14
|
+
- **学习闭环**: 记录用户 override,优化阈值
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Part A: ISOLATE(git worktree 隔离)
|
|
19
|
+
|
|
20
|
+
**AI agent 直接执行 bash 命令**(不需要调用外部 skill),步骤如下:
|
|
21
|
+
|
|
22
|
+
| 步骤 | 动作 | 说明 |
|
|
23
|
+
|------|------|------|
|
|
24
|
+
| 0 | **检测当前环境** | 运行 `git rev-parse --git-dir` 和 `git rev-parse --git-common-dir`。如果 `GIT_DIR != GIT_COMMON`:已在 worktree 中 → 输出 "Already in isolated worktree" → 进入 Part B |
|
|
25
|
+
| 0.5 | **Sprint Lock 检测(Issue #144)** | 检查 `.sprint-state/sprint.lock` 是否存在: `[ -f .sprint-state/sprint.lock ]`。如果存在: 读取锁内容,检查是否 stale(超过 24 小时或 worktree 目录不存在)→ stale → 输出 `[WARN] 发现过期 sprint lock,将覆盖` → 更新锁。非 stale → 输出 `[BLOCK] 已有活跃 sprint (ID: {sprint_id}, started: {started_at})。请先完成当前 sprint 或手动删除 .sprint-state/sprint.lock` → 退出。锁不存在 → 创建锁: `echo '{"sprint_id":"sprint-YYYY-MM-DD-NN","started_at":"<ISO8601>"}' > .sprint-state/sprint.lock` |
|
|
26
|
+
| 1 | **检查保护分支** | 获取当前分支名 `git branch --show-current`。保护分支列表: `main, master, develop, trunk, mainline`。保护分支 → 强制创建 worktree。非保护分支 → 依然创建 worktree(推荐,不阻断) |
|
|
27
|
+
| 2 | **创建 worktree** | 创建目录: `mkdir -p .worktrees/sprint`。检测已有 NN 编号: `ls .worktrees/sprint/ 2>/dev/null \| grep -oE '[0-9]{2}$' \| sort -n \| tail -1`(取最后两位数字,数值排序,取最大),NN = 结果 + 1(无结果则从 01 开始)。运行 `git worktree add .worktrees/sprint/sprint-YYYY-MM-DD-NN -b sprint/YYYY-MM-DD-NN`。**注意**: `cd` 在 AI agent 单次工具调用中不保持状态,步骤 3-6 必须通过 `workdir` 参数或 `&&` 链式命令在新 worktree 目录下执行 |
|
|
28
|
+
| 3 | **项目 setup** | 在 worktree 目录下: 检测项目类型: `package.json` → `npm install`, `go.mod` → `go mod download`, `pyproject.toml` → `pip/poetry install` |
|
|
29
|
+
| 4 | **.gitignore 校验** | 在**仓库根目录**(非 worktree)执行: `git check-ignore -q .worktrees`。如果未忽略 → 将 `.worktrees/` 添加到 `.gitignore` → `git add .gitignore` → `git commit -m 'chore: ignore .worktrees directory'` |
|
|
30
|
+
| 5 | **Sprint State 记录** | `mkdir -p .sprint-state` 在 worktree 目录下。写入 `.sprint-state/sprint-state.json`(如已存在则合并,保留原有字段),新增/更新 `isolation` 对象,设置 `phase: 1`,`status: "running"` |
|
|
31
|
+
| 6 | **基线验证** | 在 worktree 目录下: 检测测试方式(package.json 有 "test" script → `npm test`, go.mod → `go test ./...`, pyproject.toml → `pytest`)。测试失败 → 输出失败信息 → 询问用户是否继续 |
|
|
32
|
+
|
|
33
|
+
### 参数处理
|
|
34
|
+
|
|
35
|
+
- `--no-isolate`: 跳过自动创建,输出 ⚠️ 警告 `'[WARN] 未创建 worktree 隔离,在 {branch} 分支上直接运行 sprint 有污染风险'` → 进入 Part B
|
|
36
|
+
- `--branch-name <name>`: 使用自定义分支名(默认自动生成 `sprint/YYYY-MM-DD-NN`),分支名中的 `/` 在 worktree 路径中自动替换为 `-`(如 `feat/user-login` → 分支名 `feat/user-login`,路径 `.worktrees/sprint/feat-user-login`)
|
|
37
|
+
- `--force`: 强制在当前分支继续(即使已是保护分支),**要求用户显式确认**: 输出 ⚠️ 警告 `'[WARN] 使用 --force 在 {branch} 分支上直接运行 sprint。此操作绕过隔离保护,请确认风险。'` → 等待用户确认("继续" / "取消") → 确认后进入 Part B
|
|
38
|
+
|
|
39
|
+
### 参数交互规则
|
|
40
|
+
|
|
41
|
+
| 参数组合 | 行为 |
|
|
42
|
+
|---------|------|
|
|
43
|
+
| `--no-isolate` 单独 | 跳过隔离,输出警告 → Part B |
|
|
44
|
+
| `--force` 单独 | 跳过隔离,要求确认 → Part B |
|
|
45
|
+
| `--no-isolate` + `--branch-name` | `--branch-name` 忽略,仅 `--no-isolate` 生效 |
|
|
46
|
+
| `--force` + `--branch-name` | `--branch-name` 忽略,仅 `--force` 生效 |
|
|
47
|
+
| `--no-isolate` + `--force` | 等效,输出 `--no-isolate` 警告 → Part B |
|
|
48
|
+
| `--resume-from build` + `--no-isolate` | `--resume-from` 优先,直接跳过 PREP |
|
|
49
|
+
|
|
50
|
+
### 错误处理和回退
|
|
51
|
+
|
|
52
|
+
| 错误场景 | 回退行为 |
|
|
53
|
+
|---------|---------|
|
|
54
|
+
| `git worktree add` 失败(沙箱/权限问题) | 输出 `[ERROR] git worktree add 失败: {error}` → `[WARN] 无法创建 worktree 隔离,将在当前目录继续。请手动设置隔离分支。` → 在当前目录继续 |
|
|
55
|
+
| `.gitignore` 自动添加失败 | 输出 `[WARN] 无法自动添加 .gitignore,请手动将 .worktrees/ 添加到 .gitignore` → 继续 |
|
|
56
|
+
| 基线测试失败 | 输出 `[FAIL] 基线测试未通过:` + 失败详情 → 询问用户 `'基线测试失败,是否继续 sprint?(y/N)'` |
|
|
57
|
+
|
|
58
|
+
### sprint-state.json isolation 对象格式
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"isolation": {
|
|
63
|
+
"worktree_path": ".worktrees/sprint/sprint-2026-05-24-01",
|
|
64
|
+
"branch": "sprint/2026-05-24-01",
|
|
65
|
+
"created_from": "main",
|
|
66
|
+
"created_from_commit": "abc123def..."
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Part B: AUTO-ESTIMATE(自动化规模评估与流程路由)
|
|
74
|
+
|
|
75
|
+
### 步骤 1: 识别需求类型
|
|
76
|
+
|
|
77
|
+
分析用户输入的需求描述,判定变更类型:
|
|
78
|
+
|
|
79
|
+
| 关键词模式 | 变更类型 | AUTO-ESTIMATE 时机 |
|
|
80
|
+
|-----------|---------|-------------------|
|
|
81
|
+
| 删除、移除、去掉、砍掉、清理 + 已有模块名 | 删除已存在代码 | 立即执行 |
|
|
82
|
+
| 修改、改、调整、重构、优化 + 已有模块名 | 修改已存在代码 | 立即执行 |
|
|
83
|
+
| 新增、添加、开发、实现、创建 + 新模块名 | 新增功能 | brainstorming 后执行 |
|
|
84
|
+
| 修复、fix、bug | Bug 修复 | 立即执行 |
|
|
85
|
+
| 无法判断 | 询问用户 | — |
|
|
86
|
+
|
|
87
|
+
**IF 新增功能**: 跳过当前 AUTO-ESTIMATE,先执行 Phase 2/6 DESIGN brainstorming,brainstorming 完成后以设计文档为输入重新执行 AUTO-ESTIMATE。
|
|
88
|
+
|
|
89
|
+
**IF 删除/修改/Bug 修复**: 继续执行以下步骤。
|
|
90
|
+
|
|
91
|
+
### 步骤 2: 收集指标
|
|
92
|
+
|
|
93
|
+
#### 2.1 引用计数
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
grep -rn "{target_pattern}" --include="*.{ext}" . | grep -v node_modules | grep -v .git | wc -l
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**阈值**: ≤3: 轻量 | 4-10: 标准 | >10: 复杂
|
|
100
|
+
|
|
101
|
+
#### 2.2 跨模块依赖
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
grep -rn "{target_pattern}" --include="*.{ext}" . | grep -v node_modules | grep -v .git | \
|
|
105
|
+
awk -F: '{print $1}' | sed 's|/[^/]*$||' | sort -u
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**阈值**: 1 个目录: 轻量 | 2 个目录: 标准 | 3+ 个目录: 复杂
|
|
109
|
+
|
|
110
|
+
#### 2.3 循环依赖检测
|
|
111
|
+
|
|
112
|
+
简单检查:如果 A 引用 B 且 B 引用 A,则存在循环依赖。
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
grep -rn "import.*{target}" --include="*.ts" --include="*.tsx" .
|
|
116
|
+
grep -rn "import.*{caller}" --include="*.ts" --include="*.tsx" {target_dir}/
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**阈值**: 无: 正常 | 存在: 高风险 → 无论如何输出风险警告
|
|
120
|
+
|
|
121
|
+
#### 2.4 Public API 暴露
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
grep -rn "^export " {target_dir}/ --include="*.ts" | wc -l
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
**阈值**: ≤2: 低影响 | 3-5: 中影响 | >5: 高影响 → 输出风险警告
|
|
128
|
+
|
|
129
|
+
#### 2.5 相关测试文件
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
find . -name "*{target}*.test.*" -o -name "*{target}*.spec.*" | grep -v node_modules | wc -l
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**阈值**: 0: 无测试覆盖(风险提示) | 1-2: 正常 | >3: 重构工作量大 → 提示
|
|
136
|
+
|
|
137
|
+
### 步骤 3: 汇总评估
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
总分计算:
|
|
141
|
+
- 引用计数:轻量=1, 标准=2, 复杂=3
|
|
142
|
+
- 跨模块:轻量=1, 标准=2, 复杂=3
|
|
143
|
+
- 循环依赖:无=0, 存在=5(强制复杂)
|
|
144
|
+
- Public API:低=0, 中=1, 高=2
|
|
145
|
+
- 测试文件:正常=0, 多=1
|
|
146
|
+
|
|
147
|
+
总分:1-3 = 轻量 | 4-6 = 标准 | 7+ 或 循环依赖存在 = 复杂
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### 步骤 4: 输出评估结果
|
|
151
|
+
|
|
152
|
+
使用 `templates/auto-estimate-output-template.md` 的标准格式向用户展示评估结果。
|
|
153
|
+
|
|
154
|
+
**MUST** 遵循模板格式,包含:
|
|
155
|
+
- 需求描述 + 变更类型
|
|
156
|
+
- 影响级别标识
|
|
157
|
+
- 各项指标的具体数值
|
|
158
|
+
- 建议流程
|
|
159
|
+
- 风险警告(如有)
|
|
160
|
+
- 用户操作选项
|
|
161
|
+
|
|
162
|
+
### 步骤 5: 处理用户选择
|
|
163
|
+
|
|
164
|
+
#### 用户选择「接受建议」
|
|
165
|
+
按推荐流程执行。保存评估结果到 sprint-state.json。
|
|
166
|
+
|
|
167
|
+
```json
|
|
168
|
+
{
|
|
169
|
+
"auto_estimate": {
|
|
170
|
+
"change_type": "删除已存在代码",
|
|
171
|
+
"metrics": {
|
|
172
|
+
"ref_count": 12,
|
|
173
|
+
"cross_module_count": 3,
|
|
174
|
+
"modules": ["auth", "user", "admin"],
|
|
175
|
+
"circular_dep": true,
|
|
176
|
+
"public_api_count": 5,
|
|
177
|
+
"test_file_count": 4
|
|
178
|
+
},
|
|
179
|
+
"estimated_level": "复杂",
|
|
180
|
+
"recommended_flow": "完整 Sprint Flow (6 phases)",
|
|
181
|
+
"risk_warnings": ["循环依赖: user ↔ plane"],
|
|
182
|
+
"user_decision": "accepted"
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
#### 用户选择「修改流程」
|
|
188
|
+
展示修改流程子菜单(3 个选项:轻量/标准/完整)。要求用户输入修改原因(必填)。
|
|
189
|
+
|
|
190
|
+
记录到学习日志:
|
|
191
|
+
```json
|
|
192
|
+
{
|
|
193
|
+
"sprint_id": "{sprint_id}",
|
|
194
|
+
"task_description": "{需求描述}",
|
|
195
|
+
"estimated_level": "标准",
|
|
196
|
+
"user_override_level": "轻量",
|
|
197
|
+
"override_reason": "{用户输入原因}",
|
|
198
|
+
"timestamp": "{当前时间}"
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
数据写入 `.sprint-state/auto-estimate-learning.json`(追加模式)。
|
|
203
|
+
|
|
204
|
+
#### 用户选择「取消」
|
|
205
|
+
停止本次 sprint。输出:`[CANCELLED] 用户取消 Sprint,AUTO-ESTIMATE 评估结果为 {estimated_level}`。
|
|
206
|
+
|
|
207
|
+
### 步骤 6: 路由执行
|
|
208
|
+
|
|
209
|
+
根据最终确定的流程级别,进入对应 Phase:
|
|
210
|
+
|
|
211
|
+
| 流程级别 | 路由 |
|
|
212
|
+
|---------|------|
|
|
213
|
+
| **轻量** | → Phase 2/6 DESIGN(reduced-intensity 流程,见 references/force-levels.md) |
|
|
214
|
+
| **标准** | → Phase 2/6 DESIGN(正常流程) |
|
|
215
|
+
| **复杂** | → Phase 2/6 DESIGN(完整流程 + 风险警告提示) |
|
|
216
|
+
|
|
217
|
+
**DELPHI-GATE invariant**: 所有流程级别(轻量/标准/复杂)的 Phase 3/6 BUILD 启动前,**必须**检查 `.sprint-state/delphi-reviewed.json` 的 verdict 为 `APPROVED`。未通过 delphi-review 直接路由到 BUILD 属于严重违规。
|
|
218
|
+
|
|
219
|
+
**轻量级的正确理解**: 轻量级意味着 reduced-intensity 的 delphi-review(**3 专家、最多 5 轮、≥90% 聚合共识、较短上下文**),**不是**跳过 delphi-review,**不是**减少专家或模型执行。见 references/force-levels.md 的轻量级流程定义。
|
|
220
|
+
|
|
221
|
+
**自动 escalation 规则**(检测到以下情况时,自动提升流程级别):
|
|
222
|
+
|
|
223
|
+
| 触发条件 | 原级别 | 提升级别 | 理由 |
|
|
224
|
+
|---------|--------|---------|------|
|
|
225
|
+
| 风险警告(循环依赖、Public API > 5) | 轻量 | 标准 | 技术风险需要标准流程 |
|
|
226
|
+
| 多位专家 disagreement 或 REQUEST_CHANGES | 轻量/标准 | 复杂 | 意见分歧需要更全面评审 |
|
|
227
|
+
| 涉及文件数 > 10 或 LOC > 500 | 轻量 | 标准 | 超出轻量级预算 |
|
|
228
|
+
| 修改公共 API(export 接口) | 轻量/标准 | 复杂 | API 变更影响范围广 |
|
|
229
|
+
| 检测到循环依赖 | 任何级别 | 复杂 | 架构风险强制复杂流程 |
|
|
230
|
+
| 相关测试文件缺失或覆盖率 < 80% | 轻量/标准 | 标准 | 需要补充测试 |
|
|
231
|
+
|
|
232
|
+
**跨参考**: 详见 references/force-levels.md 的各级别流程定义和强制规则。
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
## 特殊场景处理
|
|
237
|
+
|
|
238
|
+
### 场景 1: 小改动(总计 < 20 行新增/删除代码)
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
git diff --stat HEAD 2>/dev/null
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
**处理**: 如果预估改动 < 20 行且涉及 ≤ 2 个文件,自动判定为「轻量」并告知用户,不强制展示完整 AUTO-ESTIMATE 面板。
|
|
245
|
+
|
|
246
|
+
**注意**: 轻量级仍需要完整的 Sprint Flow 流程(包括 delphi-review),只是 reduced-intensity。**不会**绕过 DELPHI-GATE 直接路由到 BUILD。
|
|
247
|
+
|
|
248
|
+
### 场景 2: 无法提取目标关键词
|
|
249
|
+
|
|
250
|
+
**处理**: 询问用户「无法自动识别目标模块,请指定要分析的关键词(函数名/类名/模块名):」
|
|
251
|
+
|
|
252
|
+
### 场景 3: 用户输入包含多个独立需求
|
|
253
|
+
|
|
254
|
+
**处理**: 提示用户「检测到多个独立需求,建议分别执行 sprint。是否拆分?」→ 等待确认
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
## 编排注意事项
|
|
259
|
+
|
|
260
|
+
PREP 经常使用并行 background explore agents 评估代码影响范围。Agent dispatch 后必须遵循 **Background Task Resume Protocol**(参见 `orchestration-rules.md`),在所有 background task 返回后自动恢复继续,不得等待人工消息(Issue #248)。
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
## 与学习循环的集成
|
|
265
|
+
|
|
266
|
+
### 数据收集
|
|
267
|
+
|
|
268
|
+
每次 sprint 完成(Phase 6/6 CLOSE)后,将以下数据记录到 `.sprint-state/auto-estimate-learning.json`:
|
|
269
|
+
|
|
270
|
+
```json
|
|
271
|
+
{
|
|
272
|
+
"entries": [
|
|
273
|
+
{
|
|
274
|
+
"sprint_id": "sprint-YYYY-MM-DD-NN",
|
|
275
|
+
"estimated_level": "标准",
|
|
276
|
+
"user_decision": "accepted",
|
|
277
|
+
"actual_effort_phase_count": 5,
|
|
278
|
+
"actual_duration_minutes": 45,
|
|
279
|
+
"was_accurate": true
|
|
280
|
+
}
|
|
281
|
+
]
|
|
282
|
+
}
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### 阈值优化
|
|
286
|
+
|
|
287
|
+
当积累 ≥ 20 条记录后,提示用户可以运行阈值分析:
|
|
288
|
+
|
|
289
|
+
> 已积累 {n} 条 AUTO-ESTIMATE 记录。是否运行阈值优化分析?
|
|
290
|
+
> 分析会检查:过度估计(建议标准但实际轻量)、低估(建议轻量但实际复杂),并推荐阈值调整。
|
|
291
|
+
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
> **清理提示**: Sprint 完成后,Phase 6/6 CLOSE 执行 `git worktree remove <worktree_path>` 清理 worktree 目录,同时保留 `.sprint-state/` 中的历史记录。
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
# Phase 2/6: DESIGN(设计 — 需求探索 + 双点评审)
|
|
2
|
+
|
|
3
|
+
**执行时机**: Phase 1/6 PREP 完成后、Phase 3/6 BUILD 之前。
|
|
4
|
+
**对应旧模型**: Phase 0 THINK + Phase 1 PLAN
|
|
5
|
+
|
|
6
|
+
## 目标
|
|
7
|
+
|
|
8
|
+
使用 grill-with-docs 进行结构化需求探索(含 CONTEXT.md/ADR 沉淀),经 R1 需求评审验证需求完整性,输出经用户批准的设计文档。然后通过 batch-grill-me 批量前置决策 + R2 delphi-review 达成 ≥90% 共识,生成 specification.yaml。
|
|
9
|
+
|
|
10
|
+
**新链(v0.18.0+,零外部依赖,双点评审)**:
|
|
11
|
+
```
|
|
12
|
+
grill-with-docs → R1 需求评审(轻量) → 原生设计文档+APPROVAL门 → batch-grill-me → R2 delphi-review(设计维度) → to-issues
|
|
13
|
+
↓ ↓ #368 ↓ HARD-GATE ↓ ↓ HARD-GATE
|
|
14
|
+
CONTEXT.md+ADR 需求完整性/AC覆盖 用户审批设计文档 批量前置决策 ≥90% 共识
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Part A: THINK(需求探索 + 需求评审)
|
|
20
|
+
|
|
21
|
+
### Step 0: CONTEXT.md 预检(v0.14.9+ — Issue #322)
|
|
22
|
+
|
|
23
|
+
在进入 grill 访谈前,检查 `CONTEXT.md` 是否已存在:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
IF CONTEXT.md 存在于项目根目录:
|
|
27
|
+
→ 读取已有设计上下文
|
|
28
|
+
→ SKIP grill-with-docs 访谈(设计上下文已存在,避免重复探索)
|
|
29
|
+
→ ⚠️ R1 需求评审仍执行(Round 1 修订:CONTEXT.md 可能陈旧,快速路径同样需要需求评审)
|
|
30
|
+
→ 评审对象为 CONTEXT.md + 本次需求陈述
|
|
31
|
+
→ 输出: "[sprint-flow] CONTEXT.md 已存在,跳过需求访谈,进入 R1 需求评审"
|
|
32
|
+
ELSE:
|
|
33
|
+
→ 继续执行 Step 1(结构化需求探索)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**CONTEXT.md 预检路由表**:
|
|
37
|
+
|
|
38
|
+
| CONTEXT.md 状态 | grill-with-docs | R1 需求评审 | 输入到 Part B | 说明 |
|
|
39
|
+
|----------------|-----------------|-------------|---------------|------|
|
|
40
|
+
| 不存在 | ✅ 执行 | ✅ 执行 | grill 输出 + R1 结论 | 标准路径 |
|
|
41
|
+
| 存在 | ❌ SKIP | ✅ 执行 | 已有 CONTEXT.md + R1 结论 | 快速路径 (Issue #322) |
|
|
42
|
+
|
|
43
|
+
### Step 1: 调用 grill-with-docs(需求访谈)
|
|
44
|
+
|
|
45
|
+
**仅当 CONTEXT.md 不存在时执行。**
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
skill(name="grill-with-docs", user_message="[需求描述]")
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
grill-with-docs 执行:
|
|
52
|
+
1. **逐个追问决策树** — 每题附推荐答案;事实自行探查,决策留给用户
|
|
53
|
+
2. **同步维护 CONTEXT.md** — 项目上下文沉淀(`domain-modeling` 内置)
|
|
54
|
+
3. **同步维护 ADR** — `docs/adr/ADR-NNNN-*.md` 架构决策记录
|
|
55
|
+
4. **达成共享理解** — 需求边界、用户场景、验收标准清晰化
|
|
56
|
+
|
|
57
|
+
### Step 2: R1 需求评审(#368 恢复的第一点评审)
|
|
58
|
+
|
|
59
|
+
grill 访谈达成共享理解后(或 CONTEXT.md 快速路径下读取已有上下文后)、设计文档生成前,调用需求评审:
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
/delphi-review --mode requirements
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
这是 Agent skill 调用,不是 `xp-gate` npm CLI 子命令。Skill orchestrator 必须分别调用 per-expert runner 三次,每次保留 `--expert <architecture|technical|feasibility> --mode requirements`,再聚合三份结果;禁止用一个 runner 进程执行全部模型。
|
|
66
|
+
|
|
67
|
+
**评审配置**:
|
|
68
|
+
- 复用现有 3 专家(architecture/feasibility/technical),`--mode requirements` 切换评审焦点提示词
|
|
69
|
+
- 所有路径固定使用 3 专家,Round 1 独立执行并验证 distinct model IDs,最多 5 轮
|
|
70
|
+
- force level 只调整上下文深度与迭代预算;所有路径都执行 R1,不减少专家数
|
|
71
|
+
|
|
72
|
+
**评审焦点**:
|
|
73
|
+
- 用户场景遗漏
|
|
74
|
+
- 验收标准覆盖度与可测试性
|
|
75
|
+
- 用户画像清晰度
|
|
76
|
+
- 需求边界
|
|
77
|
+
|
|
78
|
+
**阻塞语义(程序化)**:
|
|
79
|
+
|
|
80
|
+
输出 `.sprint-state/phase-outputs/requirements-reviewed.json`:
|
|
81
|
+
|
|
82
|
+
```json
|
|
83
|
+
{
|
|
84
|
+
"verdict": "APPROVED | GAPS_FOUND",
|
|
85
|
+
"timestamp": "<ISO 8601>",
|
|
86
|
+
"requirements_statement": "<被评审的原始需求陈述>",
|
|
87
|
+
"context_file_used": "CONTEXT.md | null",
|
|
88
|
+
"requirements_hash": "<SHA-256 of requirements_statement + context file exact UTF-8 content if used + timestamp YYYY-MM-DD>",
|
|
89
|
+
"head_commit": "<git rev-parse HEAD>",
|
|
90
|
+
"consensus_ratio": 1.0,
|
|
91
|
+
"expert_verdicts": [
|
|
92
|
+
{ "role": "architecture", "verdict": "APPROVED", "result_type": "delphi_expert_result", "requested_model": "provider/model-a" },
|
|
93
|
+
{ "role": "technical", "verdict": "APPROVED", "result_type": "delphi_expert_result", "requested_model": "provider/model-b" },
|
|
94
|
+
{ "role": "feasibility", "verdict": "APPROVED", "result_type": "delphi_expert_result", "requested_model": "provider/model-c" }
|
|
95
|
+
],
|
|
96
|
+
"rounds": 1,
|
|
97
|
+
"gaps": []
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**GAPS_FOUND 处理**:
|
|
102
|
+
- 回到 Step 1 补充访谈(或补充 CONTEXT.md 内容)
|
|
103
|
+
- 最多 5 轮循环后升级给用户决策
|
|
104
|
+
|
|
105
|
+
**程序化校验**:
|
|
106
|
+
- `phase-transition 2 completed` 校验 schema-v2 必填字段、`verdict=APPROVED`、三份专家证据、`consensus_ratio`、当前 HEAD,并从需求陈述、可选 context 文件和 timestamp 日期重新计算 `requirements_hash`
|
|
107
|
+
- 不匹配 → BLOCK(防陈旧绑定)
|
|
108
|
+
|
|
109
|
+
### Step 3: 原生设计文档生成
|
|
110
|
+
|
|
111
|
+
orchestrator 基于访谈记录 + CONTEXT.md + R1 评审结论生成设计文档:
|
|
112
|
+
|
|
113
|
+
**路径**: `docs/plans/YYYY-MM-DD-<topic>-design.md`
|
|
114
|
+
|
|
115
|
+
**内容结构**:
|
|
116
|
+
1. 需求摘要(来自 grill 访谈 + R1 评审结论)
|
|
117
|
+
2. 2–3 候选方案与 trade-offs
|
|
118
|
+
3. 推荐方案
|
|
119
|
+
4. 成功标准
|
|
120
|
+
|
|
121
|
+
### Step 4: HARD-GATE — 用户审批设计文档
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
⚠️ HARD-GATE: 设计未 APPROVED → 不可进入 Part B
|
|
125
|
+
|
|
126
|
+
等待用户审批设计文档。
|
|
127
|
+
用户 APPROVE 前,禁止进入 Part B (PLAN) 或任何实现。
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
**sprint-flow 编排层行为**:
|
|
131
|
+
- 收到用户 APPROVED 后,自动进入 Part B
|
|
132
|
+
- 如果用户未 APPROVED,BLOCK 并等待
|
|
133
|
+
|
|
134
|
+
### 暂停点
|
|
135
|
+
|
|
136
|
+
| 暂停点 | 触发条件 | 用户操作 | 自动恢复条件 |
|
|
137
|
+
|--------|---------|---------|-------------|
|
|
138
|
+
| R1 GAPS_FOUND | 需求评审发现缺口 | 补充访谈/上下文 | 重新 R1 评审(最多 5 轮) |
|
|
139
|
+
| **HARD-GATE** | 设计文档未 APPROVED | 用户审批设计文档 | 设计 APPROVED 后自动进入 Part B |
|
|
140
|
+
|
|
141
|
+
### 输出
|
|
142
|
+
|
|
143
|
+
- CONTEXT.md(项目上下文沉淀)
|
|
144
|
+
- ADR 文件(`docs/adr/ADR-NNNN-*.md`)
|
|
145
|
+
- requirements-reviewed.json(`.sprint-state/phase-outputs/`)
|
|
146
|
+
- Design Document(`docs/plans/YYYY-MM-DD-<topic>-design.md`)
|
|
147
|
+
- 进入 Part B 自动执行(使用设计文档作为输入)
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Part B: PLAN(共识评审)
|
|
152
|
+
|
|
153
|
+
### Step 5: 路由分叉(v0.14.0+ — Issue #306, #322)
|
|
154
|
+
|
|
155
|
+
根据 Phase 1/6 PREP (AUTO-ESTIMATE) 的 `change_type` 决定路径:
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
读取 .sprint-state/sprint-state.json → auto_estimate.change_type
|
|
159
|
+
|
|
160
|
+
IF change_type == "修改已存在代码":
|
|
161
|
+
→ 增量优化路径: SKIP batch-grill-me
|
|
162
|
+
→ 直接进入 Step 7: R2 delphi-review(3 专家,最多 5 轮)
|
|
163
|
+
ELSE (change_type == "新增功能" 或 未定义):
|
|
164
|
+
→ 标准路径: 继续 Step 6 (batch-grill-me) → Step 7
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
**路由决策表**:
|
|
168
|
+
|
|
169
|
+
| change_type | batch-grill-me | R2 delphi-review |
|
|
170
|
+
|------------|----------------|------------------|
|
|
171
|
+
| `修改已存在代码` | ❌ SKIP | 3 专家,最多 5 轮 |
|
|
172
|
+
| `新增功能` | ✅ 执行 | 标准 (3 专家) |
|
|
173
|
+
| `undefined` / 缺失 | ✅ 执行 | 标准 (3 专家) |
|
|
174
|
+
|
|
175
|
+
**HARD-GATE 不变**: 两条路径最终都必须产出 APPROVED 的 delphi-reviewed.json。
|
|
176
|
+
|
|
177
|
+
### Step 6: 调用 batch-grill-me(仅标准路径)
|
|
178
|
+
|
|
179
|
+
**仅当 change_type != "修改已存在代码" 时执行。**
|
|
180
|
+
|
|
181
|
+
```
|
|
182
|
+
skill(name="batch-grill-me", user_message="[设计文档 + 待确认决策列表]")
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
batch-grill-me 替代 autoplan 的 taste_decisions 功能:
|
|
186
|
+
- 前置已确定决策整批提出
|
|
187
|
+
- 用户一轮确认
|
|
188
|
+
- 输出批量决策结果
|
|
189
|
+
|
|
190
|
+
### Step 7: R2 设计评审(delphi-review,原生 HARD-GATE)
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
# 标准路径(3 专家)
|
|
194
|
+
skill(name="delphi-review", user_message="[设计文档 + batch-grill-me 决策结果]")
|
|
195
|
+
|
|
196
|
+
# 增量优化路径(3 专家,最多 5 轮)
|
|
197
|
+
skill(name="delphi-review", user_message="[设计文档]", experts=3, max_rounds=5)
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
- **标准路径**: Round 1: 3 专家匿名独立评审 → Round 2+: 交换意见直到共识
|
|
201
|
+
- **增量优化路径**: 3 专家,最多 5 轮
|
|
202
|
+
- ≥90% 共识 + APPROVED 才通过
|
|
203
|
+
- 输出: APPROVED / REQUEST_CHANGES
|
|
204
|
+
|
|
205
|
+
**如果 REQUEST_CHANGES**: 暂停等待用户处理 → 修复后重新评审 → 直到 APPROVED
|
|
206
|
+
|
|
207
|
+
### Step 8: 调用 to-issues(原生保留)
|
|
208
|
+
|
|
209
|
+
```
|
|
210
|
+
skill(name="to-issues")
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
垂直切片 Issue 拆分 → `slices-manifest.json`(格式不变,ralph-loop 零改动)
|
|
214
|
+
|
|
215
|
+
to-issues 原生能力:blocked_by/dependency_graph/DAG 循环检测/拓扑排序 → Phase 3/6 BUILD 按 execution_order 执行
|
|
216
|
+
|
|
217
|
+
### Step 9: 生成 specification.yaml
|
|
218
|
+
|
|
219
|
+
从 APPROVED 设计文档提取:
|
|
220
|
+
|
|
221
|
+
```yaml
|
|
222
|
+
specification:
|
|
223
|
+
requirements:
|
|
224
|
+
- id: REQ-001
|
|
225
|
+
description: [需求描述]
|
|
226
|
+
priority: [critical/high/medium/low]
|
|
227
|
+
acceptance_criteria:
|
|
228
|
+
- id: AC-001
|
|
229
|
+
requirement: REQ-001
|
|
230
|
+
criteria: [验收标准] # #368: 每个 REQ 必须含清晰验收标准
|
|
231
|
+
test_type: [unit/integration/e2e]
|
|
232
|
+
design_decisions:
|
|
233
|
+
- id: DD-001
|
|
234
|
+
decision: [设计决策]
|
|
235
|
+
rationale: [理由]
|
|
236
|
+
alternatives_considered: [备选方案]
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### Step 10: 保存产出物
|
|
240
|
+
|
|
241
|
+
保存到 `<project-root>/.sprint-state/phase-outputs/`:
|
|
242
|
+
- `specification.yaml`
|
|
243
|
+
- `slices-manifest.json`(to-issues 输出)
|
|
244
|
+
|
|
245
|
+
### Web 前端项目额外注入
|
|
246
|
+
|
|
247
|
+
**IF project_type is web-nextjs / web-react / web-vue / mobile-flutter / mobile-react-native:**
|
|
248
|
+
|
|
249
|
+
OPTIONAL: 若检测到 `design-shotgun` skill 已安装,可生成多版 UI 设计变体辅助设计评审。未安装则 SKIP。
|
|
250
|
+
|
|
251
|
+
### 暂停点
|
|
252
|
+
|
|
253
|
+
| 暂停点 | 触发条件 | 用户操作 |
|
|
254
|
+
|--------|---------|---------|
|
|
255
|
+
| batch-grill-me 决策确认 | 批量决策需要用户确认 | 用户一轮确认所有决策 |
|
|
256
|
+
| R2 delphi-review APPROVED | Round 结果 REQUEST_CHANGES | 用户修复并重新评审 |
|
|
257
|
+
|
|
258
|
+
### 输出
|
|
259
|
+
|
|
260
|
+
- specification.yaml(每 REQ 含验收标准 — #368)
|
|
261
|
+
- slices-manifest.json
|
|
262
|
+
- 进入 Phase 3/6 BUILD(除非 `--stop-at design`)
|
|
263
|
+
|
|
264
|
+
---
|
|
265
|
+
|
|
266
|
+
## 证据文件汇总
|
|
267
|
+
|
|
268
|
+
| 证据文件 | 路径 | 校验时机 | 防陈旧绑定 |
|
|
269
|
+
|----------|------|----------|-----------|
|
|
270
|
+
| requirements-reviewed.json | `.sprint-state/phase-outputs/` | `phase-transition 2 completed` | `requirements_hash`(SHA-256) |
|
|
271
|
+
| delphi-reviewed.json | `.sprint-state/` | DELPHI-GATE (Phase 2→3) | verdict + timestamp |
|
|
272
|
+
| specification.yaml | `.sprint-state/phase-outputs/` | `phase-transition 3 in_progress` | slice↔REQ 一致性 |
|
|
273
|
+
| slices-manifest.json | `.sprint-state/phase-outputs/` | `phase-transition 3 in_progress` | schema + REQ 引用校验 |
|