@boyingliu01/xp-gate 0.7.0 → 0.8.0
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/bin/xp-gate.js +4 -9
- package/lib/__tests__/audit-log.test.ts +107 -0
- package/lib/__tests__/detect-deps.test.js +212 -42
- package/lib/__tests__/doctor.test.js +1 -0
- package/lib/__tests__/gate-audit.test.ts +59 -0
- package/lib/__tests__/init.test.js +47 -1
- package/lib/__tests__/install-skill.test.js +1 -45
- package/lib/__tests__/ui-detector.test.ts +186 -26
- package/lib/__tests__/ui-review.test.ts +119 -0
- package/lib/__tests__/uninstall.test.js +1 -0
- package/lib/detect-deps.js +180 -37
- package/lib/doctor.js +7 -9
- package/lib/gate-audit.ts +26 -42
- package/lib/init.js +42 -13
- package/lib/install-skill.js +20 -48
- package/lib/rollback.js +1 -16
- package/lib/shared-paths.js +30 -0
- package/lib/shared-utils.js +25 -0
- package/lib/ui-detector.ts +20 -14
- package/lib/ui-review.ts +58 -53
- package/lib/uninstall.js +8 -9
- package/package.json +1 -1
- package/plugins/claude-code/.claude-plugin/plugin.json +1 -1
- package/plugins/claude-code/skills/admin-template-guidelines/SKILL.md +904 -0
- package/plugins/claude-code/skills/delphi-review/.delphi-config.json.example +45 -0
- package/plugins/claude-code/skills/delphi-review/AGENTS.md +66 -0
- package/plugins/claude-code/skills/delphi-review/INSTALL.md +152 -0
- package/plugins/claude-code/skills/delphi-review/SKILL.md +454 -0
- package/plugins/claude-code/skills/delphi-review/opencode.json.delphi.example +56 -0
- package/plugins/claude-code/skills/delphi-review/references/code-walkthrough.md +486 -0
- package/plugins/claude-code/skills/improve-codebase-architecture/SKILL.md +156 -0
- package/plugins/claude-code/skills/ralph-loop/SKILL.md +501 -0
- package/plugins/claude-code/skills/ralph-loop/references/components/memory.md +55 -0
- package/plugins/claude-code/skills/ralph-loop/references/components/middleware.md +54 -0
- package/plugins/claude-code/skills/ralph-loop/references/components/skill-invocations.md +39 -0
- package/plugins/claude-code/skills/ralph-loop/references/components/system-prompt.md +24 -0
- package/plugins/claude-code/skills/ralph-loop/references/components/tool-descriptions.md +32 -0
- package/plugins/claude-code/skills/ralph-loop/references/phase-2-build-ralph.md +89 -0
- package/plugins/claude-code/skills/ralph-loop/templates/progress-log.md +36 -0
- package/plugins/claude-code/skills/sprint-flow/AGENTS.md +68 -0
- package/plugins/claude-code/skills/sprint-flow/SKILL.md +1248 -0
- package/plugins/claude-code/skills/sprint-flow/references/components/memory.md +87 -0
- package/plugins/claude-code/skills/sprint-flow/references/components/middleware.md +72 -0
- package/plugins/claude-code/skills/sprint-flow/references/components/skill-invocations.md +104 -0
- package/plugins/claude-code/skills/sprint-flow/references/components/system-prompt.md +27 -0
- package/plugins/claude-code/skills/sprint-flow/references/components/tool-descriptions.md +96 -0
- package/plugins/claude-code/skills/sprint-flow/references/force-levels.md +203 -0
- package/plugins/claude-code/skills/sprint-flow/references/phase-0-think.md +115 -0
- package/plugins/claude-code/skills/sprint-flow/references/phase-1-plan.md +178 -0
- package/plugins/claude-code/skills/sprint-flow/references/phase-2-build.md +198 -0
- package/plugins/claude-code/skills/sprint-flow/references/phase-3-review.md +213 -0
- package/plugins/claude-code/skills/sprint-flow/references/phase-4-uat.md +125 -0
- package/plugins/claude-code/skills/sprint-flow/references/phase-5-feedback.md +100 -0
- package/plugins/claude-code/skills/sprint-flow/references/phase-6-ship.md +193 -0
- package/plugins/claude-code/skills/sprint-flow/references/phase-7-land.md +140 -0
- package/plugins/claude-code/skills/sprint-flow/references/phase-8-cleanup.md +192 -0
- package/plugins/claude-code/skills/sprint-flow/references/phase-minus-0-5-auto-estimate.md +257 -0
- package/plugins/claude-code/skills/sprint-flow/templates/auto-estimate-learning-log.md +136 -0
- package/plugins/claude-code/skills/sprint-flow/templates/auto-estimate-output-template.md +132 -0
- package/plugins/claude-code/skills/sprint-flow/templates/emergent-issues-template.md +120 -0
- package/plugins/claude-code/skills/sprint-flow/templates/pain-document-template.md +115 -0
- package/plugins/claude-code/skills/sprint-flow/templates/sprint-progress-template.md +151 -0
- package/plugins/claude-code/skills/sprint-flow/templates/sprint-summary-template.md +120 -0
- package/plugins/claude-code/skills/test-driven-development/SKILL.md +71 -0
- package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +56 -0
- package/plugins/claude-code/skills/test-specification-alignment/SKILL.md +702 -0
- package/plugins/claude-code/skills/test-specification-alignment/references/alignment-verification-algorithm.md +493 -0
- package/plugins/claude-code/skills/test-specification-alignment/references/phase2-constraint-enforcement.md +431 -0
- package/plugins/claude-code/skills/test-specification-alignment/references/specification-format.md +348 -0
- package/plugins/claude-code/skills/to-issues/SKILL.md +277 -0
- package/plugins/opencode/README.md +38 -0
- package/plugins/opencode/index.ts +85 -0
- package/plugins/opencode/package.json +18 -0
- package/plugins/opencode/skills/admin-template-guidelines/SKILL.md +904 -0
- package/plugins/opencode/skills/delphi-review/.delphi-config.json.example +45 -0
- package/plugins/opencode/skills/delphi-review/AGENTS.md +66 -0
- package/plugins/opencode/skills/delphi-review/INSTALL.md +152 -0
- package/plugins/opencode/skills/delphi-review/SKILL.md +454 -0
- package/plugins/opencode/skills/delphi-review/opencode.json.delphi.example +56 -0
- package/plugins/opencode/skills/delphi-review/references/code-walkthrough.md +486 -0
- package/plugins/opencode/skills/improve-codebase-architecture/SKILL.md +156 -0
- package/plugins/opencode/skills/ralph-loop/SKILL.md +501 -0
- package/plugins/opencode/skills/ralph-loop/references/components/memory.md +55 -0
- package/plugins/opencode/skills/ralph-loop/references/components/middleware.md +54 -0
- package/plugins/opencode/skills/ralph-loop/references/components/skill-invocations.md +39 -0
- package/plugins/opencode/skills/ralph-loop/references/components/system-prompt.md +24 -0
- package/plugins/opencode/skills/ralph-loop/references/components/tool-descriptions.md +32 -0
- package/plugins/opencode/skills/ralph-loop/references/phase-2-build-ralph.md +89 -0
- package/plugins/opencode/skills/ralph-loop/templates/progress-log.md +36 -0
- package/plugins/opencode/skills/sprint-flow/AGENTS.md +68 -0
- package/plugins/opencode/skills/sprint-flow/SKILL.md +1248 -0
- package/plugins/opencode/skills/sprint-flow/references/components/memory.md +87 -0
- package/plugins/opencode/skills/sprint-flow/references/components/middleware.md +72 -0
- package/plugins/opencode/skills/sprint-flow/references/components/skill-invocations.md +104 -0
- package/plugins/opencode/skills/sprint-flow/references/components/system-prompt.md +27 -0
- package/plugins/opencode/skills/sprint-flow/references/components/tool-descriptions.md +96 -0
- package/plugins/opencode/skills/sprint-flow/references/force-levels.md +203 -0
- package/plugins/opencode/skills/sprint-flow/references/phase-0-think.md +115 -0
- package/plugins/opencode/skills/sprint-flow/references/phase-1-plan.md +178 -0
- package/plugins/opencode/skills/sprint-flow/references/phase-2-build.md +198 -0
- package/plugins/opencode/skills/sprint-flow/references/phase-3-review.md +213 -0
- package/plugins/opencode/skills/sprint-flow/references/phase-4-uat.md +125 -0
- package/plugins/opencode/skills/sprint-flow/references/phase-5-feedback.md +100 -0
- package/plugins/opencode/skills/sprint-flow/references/phase-6-ship.md +193 -0
- package/plugins/opencode/skills/sprint-flow/references/phase-7-land.md +140 -0
- package/plugins/opencode/skills/sprint-flow/references/phase-8-cleanup.md +192 -0
- package/plugins/opencode/skills/sprint-flow/references/phase-minus-0-5-auto-estimate.md +257 -0
- package/plugins/opencode/skills/sprint-flow/templates/auto-estimate-learning-log.md +136 -0
- package/plugins/opencode/skills/sprint-flow/templates/auto-estimate-output-template.md +132 -0
- package/plugins/opencode/skills/sprint-flow/templates/emergent-issues-template.md +120 -0
- package/plugins/opencode/skills/sprint-flow/templates/pain-document-template.md +115 -0
- package/plugins/opencode/skills/sprint-flow/templates/sprint-progress-template.md +151 -0
- package/plugins/opencode/skills/sprint-flow/templates/sprint-summary-template.md +120 -0
- package/plugins/opencode/skills/test-driven-development/SKILL.md +71 -0
- package/plugins/opencode/skills/test-specification-alignment/AGENTS.md +56 -0
- package/plugins/opencode/skills/test-specification-alignment/SKILL.md +702 -0
- package/plugins/opencode/skills/test-specification-alignment/references/alignment-verification-algorithm.md +493 -0
- package/plugins/opencode/skills/test-specification-alignment/references/phase2-constraint-enforcement.md +431 -0
- package/plugins/opencode/skills/test-specification-alignment/references/specification-format.md +348 -0
- package/plugins/opencode/skills/to-issues/SKILL.md +277 -0
- package/plugins/opencode/tsconfig.json +15 -0
- package/plugins/qoder/skills/admin-template-guidelines/SKILL.md +904 -0
- package/plugins/qoder/skills/delphi-review/.delphi-config.json.example +45 -0
- package/plugins/qoder/skills/delphi-review/AGENTS.md +66 -0
- package/plugins/qoder/skills/delphi-review/INSTALL.md +152 -0
- package/plugins/qoder/skills/delphi-review/SKILL.md +454 -0
- package/plugins/qoder/skills/delphi-review/opencode.json.delphi.example +56 -0
- package/plugins/qoder/skills/delphi-review/references/code-walkthrough.md +486 -0
- package/plugins/qoder/skills/improve-codebase-architecture/SKILL.md +156 -0
- package/plugins/qoder/skills/ralph-loop/SKILL.md +501 -0
- package/plugins/qoder/skills/ralph-loop/references/components/memory.md +55 -0
- package/plugins/qoder/skills/ralph-loop/references/components/middleware.md +54 -0
- package/plugins/qoder/skills/ralph-loop/references/components/skill-invocations.md +39 -0
- package/plugins/qoder/skills/ralph-loop/references/components/system-prompt.md +24 -0
- package/plugins/qoder/skills/ralph-loop/references/components/tool-descriptions.md +32 -0
- package/plugins/qoder/skills/ralph-loop/references/phase-2-build-ralph.md +89 -0
- package/plugins/qoder/skills/ralph-loop/templates/progress-log.md +36 -0
- package/plugins/qoder/skills/sprint-flow/AGENTS.md +68 -0
- package/plugins/qoder/skills/sprint-flow/SKILL.md +1248 -0
- package/plugins/qoder/skills/sprint-flow/references/components/memory.md +87 -0
- package/plugins/qoder/skills/sprint-flow/references/components/middleware.md +72 -0
- package/plugins/qoder/skills/sprint-flow/references/components/skill-invocations.md +104 -0
- package/plugins/qoder/skills/sprint-flow/references/components/system-prompt.md +27 -0
- package/plugins/qoder/skills/sprint-flow/references/components/tool-descriptions.md +96 -0
- package/plugins/qoder/skills/sprint-flow/references/force-levels.md +203 -0
- package/plugins/qoder/skills/sprint-flow/references/phase-0-think.md +115 -0
- package/plugins/qoder/skills/sprint-flow/references/phase-1-plan.md +178 -0
- package/plugins/qoder/skills/sprint-flow/references/phase-2-build.md +198 -0
- package/plugins/qoder/skills/sprint-flow/references/phase-3-review.md +213 -0
- package/plugins/qoder/skills/sprint-flow/references/phase-4-uat.md +125 -0
- package/plugins/qoder/skills/sprint-flow/references/phase-5-feedback.md +100 -0
- package/plugins/qoder/skills/sprint-flow/references/phase-6-ship.md +193 -0
- package/plugins/qoder/skills/sprint-flow/references/phase-7-land.md +140 -0
- package/plugins/qoder/skills/sprint-flow/references/phase-8-cleanup.md +192 -0
- package/plugins/qoder/skills/sprint-flow/references/phase-minus-0-5-auto-estimate.md +257 -0
- package/plugins/qoder/skills/sprint-flow/templates/auto-estimate-learning-log.md +136 -0
- package/plugins/qoder/skills/sprint-flow/templates/auto-estimate-output-template.md +132 -0
- package/plugins/qoder/skills/sprint-flow/templates/emergent-issues-template.md +120 -0
- package/plugins/qoder/skills/sprint-flow/templates/pain-document-template.md +115 -0
- package/plugins/qoder/skills/sprint-flow/templates/sprint-progress-template.md +151 -0
- package/plugins/qoder/skills/sprint-flow/templates/sprint-summary-template.md +120 -0
- package/plugins/qoder/skills/test-driven-development/SKILL.md +71 -0
- package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +56 -0
- package/plugins/qoder/skills/test-specification-alignment/SKILL.md +702 -0
- package/plugins/qoder/skills/test-specification-alignment/references/alignment-verification-algorithm.md +493 -0
- package/plugins/qoder/skills/test-specification-alignment/references/phase2-constraint-enforcement.md +431 -0
- package/plugins/qoder/skills/test-specification-alignment/references/specification-format.md +348 -0
- package/plugins/qoder/skills/to-issues/SKILL.md +277 -0
- package/skills/admin-template-guidelines/SKILL.md +904 -0
- package/skills/delphi-review/SKILL.md +112 -77
- package/skills/improve-codebase-architecture/SKILL.md +156 -0
- package/skills/ralph-loop/SKILL.md +165 -34
- package/skills/sprint-flow/SKILL.md +448 -107
- package/skills/sprint-flow/references/components/skill-invocations.md +1 -1
- package/skills/sprint-flow/references/components/tool-descriptions.md +1 -1
- package/skills/sprint-flow/references/force-levels.md +203 -0
- package/skills/sprint-flow/references/phase-1-plan.md +4 -4
- package/skills/sprint-flow/references/phase-minus-0-5-auto-estimate.md +20 -1
- package/skills/sprint-flow/templates/auto-estimate-output-template.md +7 -5
- package/skills/sprint-flow/templates/sprint-progress-template.md +151 -0
- package/skills/test-driven-development/SKILL.md +71 -0
- package/skills/test-specification-alignment/SKILL.md +98 -24
- package/skills/to-issues/SKILL.md +277 -0
- package/plugins/qoder/AGENTS.md +0 -93
- package/plugins/qoder/README.md +0 -87
- package/plugins/qoder/widgets/quality-report.html +0 -163
- package/plugins/qoder/widgets/sprint-dashboard.html +0 -172
- package/skills/delphi-review/evals/evals.json +0 -82
- package/skills/delphi-review/references/qoder-multi-model.md +0 -191
- package/skills/ralph-loop/evals/evals.json +0 -311
- package/skills/ralph-loop/evolution-history.json +0 -59
- package/skills/ralph-loop/evolution-log.md +0 -16
- package/skills/sprint-flow/evals/evals.json +0 -130
- package/skills/sprint-flow/evolution-history.json +0 -39
- package/skills/sprint-flow/evolution-log.md +0 -23
- package/skills/sprint-flow/references/qoder-adaptation.md +0 -173
- package/skills/test-specification-alignment/evals/evals.json +0 -75
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
# Specification YAML 格式规范
|
|
2
|
+
|
|
3
|
+
## 标准格式
|
|
4
|
+
|
|
5
|
+
```yaml
|
|
6
|
+
specification:
|
|
7
|
+
id: "SPEC-XXX-XXX"
|
|
8
|
+
name: "模块/功能名称"
|
|
9
|
+
version: "1.0.0"
|
|
10
|
+
|
|
11
|
+
# 需求列表
|
|
12
|
+
requirements:
|
|
13
|
+
- id: "REQ-XXX-001"
|
|
14
|
+
description: "需求描述"
|
|
15
|
+
priority: "MUST" | "SHOULD" | "MAY"
|
|
16
|
+
|
|
17
|
+
# 验收标准 (Gherkin 格式)
|
|
18
|
+
acceptance_criteria:
|
|
19
|
+
- id: "AC-XXX-001-01"
|
|
20
|
+
given: "前置条件"
|
|
21
|
+
when: "触发动作"
|
|
22
|
+
then: "期望结果"
|
|
23
|
+
|
|
24
|
+
- id: "AC-XXX-001-02"
|
|
25
|
+
given: "..."
|
|
26
|
+
when: "..."
|
|
27
|
+
then: "..."
|
|
28
|
+
|
|
29
|
+
# 边界条件
|
|
30
|
+
edge_cases:
|
|
31
|
+
- "边界条件1"
|
|
32
|
+
- "边界条件2"
|
|
33
|
+
|
|
34
|
+
# 安全考虑
|
|
35
|
+
security_considerations:
|
|
36
|
+
- "安全要点1"
|
|
37
|
+
|
|
38
|
+
# 测试覆盖要求
|
|
39
|
+
test_coverage_requirements:
|
|
40
|
+
unit: true
|
|
41
|
+
integration: true
|
|
42
|
+
e2e: false
|
|
43
|
+
|
|
44
|
+
# 设计决策
|
|
45
|
+
design_decisions:
|
|
46
|
+
- id: "DD-XXX-001"
|
|
47
|
+
description: "设计决策描述"
|
|
48
|
+
rationale: "决策理由"
|
|
49
|
+
alternatives_considered:
|
|
50
|
+
- "备选方案1"
|
|
51
|
+
- "备选方案2"
|
|
52
|
+
|
|
53
|
+
# API 契约
|
|
54
|
+
api_contracts:
|
|
55
|
+
- endpoint: "POST /api/xxx"
|
|
56
|
+
description: "API 描述"
|
|
57
|
+
request:
|
|
58
|
+
body:
|
|
59
|
+
field1: "type"
|
|
60
|
+
field2: "type"
|
|
61
|
+
response:
|
|
62
|
+
success:
|
|
63
|
+
status: 200
|
|
64
|
+
body:
|
|
65
|
+
field1: "type"
|
|
66
|
+
failure:
|
|
67
|
+
status: 400
|
|
68
|
+
body:
|
|
69
|
+
error: "string"
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## 完整示例:用户认证模块
|
|
75
|
+
|
|
76
|
+
```yaml
|
|
77
|
+
specification:
|
|
78
|
+
id: "SPEC-AUTH-001"
|
|
79
|
+
name: "User Authentication Module"
|
|
80
|
+
version: "1.0.0"
|
|
81
|
+
|
|
82
|
+
requirements:
|
|
83
|
+
# REQ-1: 用户登录
|
|
84
|
+
- id: "REQ-AUTH-001"
|
|
85
|
+
description: "用户使用正确的用户名和密码可以成功登录"
|
|
86
|
+
priority: "MUST"
|
|
87
|
+
|
|
88
|
+
acceptance_criteria:
|
|
89
|
+
- id: "AC-AUTH-001-01"
|
|
90
|
+
given: "用户存在且密码正确"
|
|
91
|
+
when: "用户提交登录表单"
|
|
92
|
+
then: "系统返回 200 状态码和有效 JWT token"
|
|
93
|
+
|
|
94
|
+
- id: "AC-AUTH-001-02"
|
|
95
|
+
given: "用户存在且密码正确"
|
|
96
|
+
when: "用户提交登录表单"
|
|
97
|
+
then: "返回的 token 过期时间 >= 1小时"
|
|
98
|
+
|
|
99
|
+
- id: "AC-AUTH-001-03"
|
|
100
|
+
given: "用户存在且密码正确"
|
|
101
|
+
when: "用户提交登录表单"
|
|
102
|
+
then: "token 包含用户 ID 和角色信息"
|
|
103
|
+
|
|
104
|
+
edge_cases:
|
|
105
|
+
- "密码包含特殊字符 (@#$%^&*)"
|
|
106
|
+
- "用户名包含空格"
|
|
107
|
+
- "并发登录请求"
|
|
108
|
+
- "超长用户名 (>100字符)"
|
|
109
|
+
- "超长密码 (>200字符)"
|
|
110
|
+
|
|
111
|
+
security_considerations:
|
|
112
|
+
- "密码不能明文传输"
|
|
113
|
+
- "使用 HTTPS"
|
|
114
|
+
- "登录失败不暴露用户是否存在"
|
|
115
|
+
- "记录登录日志"
|
|
116
|
+
|
|
117
|
+
test_coverage_requirements:
|
|
118
|
+
unit: true
|
|
119
|
+
integration: true
|
|
120
|
+
e2e: true
|
|
121
|
+
|
|
122
|
+
# REQ-2: 登录失败
|
|
123
|
+
- id: "REQ-AUTH-002"
|
|
124
|
+
description: "用户使用错误的密码登录失败"
|
|
125
|
+
priority: "MUST"
|
|
126
|
+
|
|
127
|
+
acceptance_criteria:
|
|
128
|
+
- id: "AC-AUTH-002-01"
|
|
129
|
+
given: "用户存在但密码错误"
|
|
130
|
+
when: "用户提交登录表单"
|
|
131
|
+
then: "系统返回 401 状态码"
|
|
132
|
+
|
|
133
|
+
- id: "AC-AUTH-002-02"
|
|
134
|
+
given: "密码错误次数 >= 3"
|
|
135
|
+
when: "用户尝试登录"
|
|
136
|
+
then: "账户被锁定 15 分钟"
|
|
137
|
+
|
|
138
|
+
- id: "AC-AUTH-002-03"
|
|
139
|
+
given: "用户不存在"
|
|
140
|
+
when: "用户提交登录表单"
|
|
141
|
+
then: "系统返回 401 状态码(不暴露用户不存在)"
|
|
142
|
+
|
|
143
|
+
edge_cases:
|
|
144
|
+
- "密码错误 2 次后第 3 次正确"
|
|
145
|
+
- "锁定期间尝试登录"
|
|
146
|
+
- "锁定时间边界 (14分59秒, 15分00秒, 15分01秒)"
|
|
147
|
+
|
|
148
|
+
security_considerations:
|
|
149
|
+
- "不暴露具体错误原因(用户不存在 vs 密码错误)"
|
|
150
|
+
- "防暴力破解"
|
|
151
|
+
|
|
152
|
+
# REQ-3: Token 刷新
|
|
153
|
+
- id: "REQ-AUTH-003"
|
|
154
|
+
description: "用户可以刷新过期的 token"
|
|
155
|
+
priority: "SHOULD"
|
|
156
|
+
|
|
157
|
+
acceptance_criteria:
|
|
158
|
+
- id: "AC-AUTH-003-01"
|
|
159
|
+
given: "用户有有效的 refresh token"
|
|
160
|
+
when: "用户请求刷新 token"
|
|
161
|
+
then: "系统返回新的 access token"
|
|
162
|
+
|
|
163
|
+
- id: "AC-AUTH-003-02"
|
|
164
|
+
given: "用户的 refresh token 已过期"
|
|
165
|
+
when: "用户请求刷新 token"
|
|
166
|
+
then: "系统返回 401 状态码,要求重新登录"
|
|
167
|
+
|
|
168
|
+
design_decisions:
|
|
169
|
+
- id: "DD-AUTH-001"
|
|
170
|
+
description: "使用 JWT 进行身份认证"
|
|
171
|
+
rationale: "无状态,支持分布式部署,减少数据库查询"
|
|
172
|
+
alternatives_considered:
|
|
173
|
+
- "Session-based auth: 需要分布式 session 存储"
|
|
174
|
+
- "API Key: 不适合用户登录场景"
|
|
175
|
+
|
|
176
|
+
- id: "DD-AUTH-002"
|
|
177
|
+
description: "密码使用 bcrypt 哈希存储"
|
|
178
|
+
rationale: "安全性高,计算成本可调,防彩虹表"
|
|
179
|
+
|
|
180
|
+
- id: "DD-AUTH-003"
|
|
181
|
+
description: "双 token 机制 (access + refresh)"
|
|
182
|
+
rationale: "平衡安全性和用户体验,access token 短期有效"
|
|
183
|
+
|
|
184
|
+
api_contracts:
|
|
185
|
+
- endpoint: "POST /api/auth/login"
|
|
186
|
+
description: "用户登录"
|
|
187
|
+
request:
|
|
188
|
+
body:
|
|
189
|
+
username: "string (required, 1-100 chars)"
|
|
190
|
+
password: "string (required, 1-200 chars)"
|
|
191
|
+
response:
|
|
192
|
+
success:
|
|
193
|
+
status: 200
|
|
194
|
+
body:
|
|
195
|
+
token: "string (JWT)"
|
|
196
|
+
refreshToken: "string"
|
|
197
|
+
expiresIn: "number (seconds)"
|
|
198
|
+
failure:
|
|
199
|
+
status: 401
|
|
200
|
+
body:
|
|
201
|
+
error: "Invalid credentials"
|
|
202
|
+
attemptsRemaining: "number (optional)"
|
|
203
|
+
|
|
204
|
+
- endpoint: "POST /api/auth/logout"
|
|
205
|
+
description: "用户登出"
|
|
206
|
+
request:
|
|
207
|
+
headers:
|
|
208
|
+
Authorization: "Bearer <token>"
|
|
209
|
+
response:
|
|
210
|
+
success:
|
|
211
|
+
status: 200
|
|
212
|
+
body:
|
|
213
|
+
message: "Logged out successfully"
|
|
214
|
+
|
|
215
|
+
- endpoint: "POST /api/auth/refresh"
|
|
216
|
+
description: "刷新 token"
|
|
217
|
+
request:
|
|
218
|
+
body:
|
|
219
|
+
refreshToken: "string"
|
|
220
|
+
response:
|
|
221
|
+
success:
|
|
222
|
+
status: 200
|
|
223
|
+
body:
|
|
224
|
+
token: "string (new JWT)"
|
|
225
|
+
expiresIn: "number"
|
|
226
|
+
failure:
|
|
227
|
+
status: 401
|
|
228
|
+
body:
|
|
229
|
+
error: "Invalid or expired refresh token"
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## 测试标签格式
|
|
235
|
+
|
|
236
|
+
### TypeScript/JavaScript
|
|
237
|
+
|
|
238
|
+
```typescript
|
|
239
|
+
/**
|
|
240
|
+
* @test REQ-AUTH-001
|
|
241
|
+
* @intent 验证用户使用正确凭据可以成功登录
|
|
242
|
+
* @covers AC-AUTH-001-01, AC-AUTH-001-02, AC-AUTH-001-03
|
|
243
|
+
* @edge_cases password_with_special_chars, concurrent_login
|
|
244
|
+
*/
|
|
245
|
+
describe('REQ-AUTH-001: User Login', () => {
|
|
246
|
+
test('AC-AUTH-001-01: returns 200 and valid token', async () => {
|
|
247
|
+
// Given: 用户存在且密码正确
|
|
248
|
+
const user = await createTestUser({ password: 'correctpassword' });
|
|
249
|
+
|
|
250
|
+
// When: 用户提交登录表单
|
|
251
|
+
const response = await request(app)
|
|
252
|
+
.post('/api/auth/login')
|
|
253
|
+
.send({ username: user.username, password: 'correctpassword' });
|
|
254
|
+
|
|
255
|
+
// Then: 系统返回 200 状态码和有效 JWT token
|
|
256
|
+
expect(response.status).toBe(200);
|
|
257
|
+
expect(response.body.token).toBeDefined();
|
|
258
|
+
expect(() => jwt.verify(response.body.token, JWT_SECRET)).not.toThrow();
|
|
259
|
+
});
|
|
260
|
+
});
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### Python (pytest)
|
|
264
|
+
|
|
265
|
+
```python
|
|
266
|
+
# @test REQ-AUTH-001
|
|
267
|
+
# @intent 验证用户使用正确凭据可以成功登录
|
|
268
|
+
# @covers AC-AUTH-001-01, AC-AUTH-001-02
|
|
269
|
+
# @edge_cases password_with_special_chars, concurrent_login
|
|
270
|
+
class Test_REQ_AUTH_001_UserLogin:
|
|
271
|
+
"""
|
|
272
|
+
REQ-AUTH-001: 用户登录测试
|
|
273
|
+
|
|
274
|
+
@test REQ-AUTH-001
|
|
275
|
+
@intent 验证用户使用正确凭据可以成功登录
|
|
276
|
+
"""
|
|
277
|
+
|
|
278
|
+
def test_AC_AUTH_001_01_returns_200_and_token(self):
|
|
279
|
+
"""AC-AUTH-001-01: 返回 200 和有效 token"""
|
|
280
|
+
# Given: 用户存在且密码正确
|
|
281
|
+
user = create_test_user(password='correctpassword')
|
|
282
|
+
|
|
283
|
+
# When: 用户提交登录表单
|
|
284
|
+
response = client.post('/api/auth/login', json={
|
|
285
|
+
'username': user.username,
|
|
286
|
+
'password': 'correctpassword'
|
|
287
|
+
})
|
|
288
|
+
|
|
289
|
+
# Then: 系统返回 200 状态码和有效 JWT token
|
|
290
|
+
assert response.status_code == 200
|
|
291
|
+
assert 'token' in response.json
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### Go
|
|
295
|
+
|
|
296
|
+
```go
|
|
297
|
+
// @test REQ-AUTH-001
|
|
298
|
+
// @intent 验证用户使用正确凭据可以成功登录
|
|
299
|
+
// @covers AC-AUTH-001-01, AC-AUTH-001-02
|
|
300
|
+
// @edge_cases password_with_special_chars, concurrent_login
|
|
301
|
+
func Test_REQ_AUTH_001_UserLogin(t *testing.T) {
|
|
302
|
+
// AC-AUTH-001-01: 返回 200 和有效 token
|
|
303
|
+
|
|
304
|
+
// Given: 用户存在且密码正确
|
|
305
|
+
user := createTestUser(t, "correctpassword")
|
|
306
|
+
|
|
307
|
+
// When: 用户提交登录表单
|
|
308
|
+
resp := httptest.NewRecorder()
|
|
309
|
+
req := httptest.NewRequest("POST", "/api/auth/login",
|
|
310
|
+
strings.NewReader(fmt.Sprintf(`{"username":"%s","password":"correctpassword"}`, user.Username)))
|
|
311
|
+
router.ServeHTTP(resp, req)
|
|
312
|
+
|
|
313
|
+
// Then: 系统返回 200 状态码和有效 JWT token
|
|
314
|
+
assert.Equal(t, 200, resp.Code)
|
|
315
|
+
// ... 更多断言
|
|
316
|
+
}
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
## 必需字段检查清单
|
|
322
|
+
|
|
323
|
+
### Specification 层级
|
|
324
|
+
|
|
325
|
+
- [ ] `specification.id` - 唯一标识符
|
|
326
|
+
- [ ] `specification.name` - 模块名称
|
|
327
|
+
- [ ] `specification.version` - 版本号
|
|
328
|
+
- [ ] `specification.requirements` - 需求列表 (至少 1 个)
|
|
329
|
+
|
|
330
|
+
### Requirement 层级
|
|
331
|
+
|
|
332
|
+
- [ ] `requirements[].id` - REQ-XXX-XXX 格式
|
|
333
|
+
- [ ] `requirements[].description` - 需求描述
|
|
334
|
+
- [ ] `requirements[].priority` - MUST/SHOULD/MAY
|
|
335
|
+
- [ ] `requirements[].acceptance_criteria` - 验收标准 (至少 1 个)
|
|
336
|
+
|
|
337
|
+
### Acceptance Criteria 层级
|
|
338
|
+
|
|
339
|
+
- [ ] `acceptance_criteria[].id` - AC-XXX-XXX-XX 格式
|
|
340
|
+
- [ ] `acceptance_criteria[].given` - 前置条件
|
|
341
|
+
- [ ] `acceptance_criteria[].when` - 触发动作
|
|
342
|
+
- [ ] `acceptance_criteria[].then` - 期望结果
|
|
343
|
+
|
|
344
|
+
### 测试标签层级
|
|
345
|
+
|
|
346
|
+
- [ ] `@test REQ-XXX-XXX` - 关联 requirement
|
|
347
|
+
- [ ] `@intent 描述` - 测试意图
|
|
348
|
+
- [ ] `@covers AC-XXX-XX` - 覆盖的 AC (推荐)
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: to-issues
|
|
3
|
+
description: Break a plan, spec, or PRD into independently-grabbable issues using tracer-bullet vertical slices. Use when user wants to convert a plan into issues, create implementation tickets, or break down work into vertical slices. Integrates with XP-Gate sprint-flow Phase 1.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# To Issues — Vertical Slice Breakdown
|
|
7
|
+
|
|
8
|
+
将 PRD / specification.yaml / 设计文档拆解为 **独立的垂直切片 Issue**,每个切片是贯穿所有层的 **tracer bullet**,而非水平分层切片。
|
|
9
|
+
|
|
10
|
+
核心理念:每个 Issue 交付一条**狭窄但完整**的端到端路径(schema → API → UI → tests),完成后即可独立演示并通过质量门禁。
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## 术语(强制一致使用)
|
|
15
|
+
|
|
16
|
+
| 术语 | 定义 |
|
|
17
|
+
|------|------|
|
|
18
|
+
| **Vertical Slice** | 贯穿所有层(数据、API、UI、测试)的薄路径,交付端到端行为 |
|
|
19
|
+
| **Tracer Bullet** | 第一条完整的垂直切片,优先拆解以快速暴露 unknown unknowns |
|
|
20
|
+
| **HITL** | Human-In-The-Loop — 需要人工决策(架构选择、设计评审)才能继续 |
|
|
21
|
+
| **AFK** | Away-From-Keyboard — 可完全由 agent 自主实现并合并 |
|
|
22
|
+
| **Blocking** | 依赖关系:此切片必须在哪些切片完成后才能开始 |
|
|
23
|
+
| **Deep Module** | 封装大量功能于简单接口背后的模块(XP-Gate Principles 概念) |
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## 输入
|
|
28
|
+
|
|
29
|
+
- PRD 文件路径,或
|
|
30
|
+
- `specification.yaml`,或
|
|
31
|
+
- 最近对话中的设计文档(项目配置的 spec 路径,默认 `docs/superpowers/specs/*.md`)
|
|
32
|
+
|
|
33
|
+
## 输出(Machine-Readable)
|
|
34
|
+
|
|
35
|
+
### 1. 文本输出
|
|
36
|
+
|
|
37
|
+
- 一组垂直切片 Issue(GitHub Issue / 本地 `.issues/*.md` / 用户指定的 issue tracker 格式)
|
|
38
|
+
- 依赖关系图(拓扑排序后的执行顺序)
|
|
39
|
+
|
|
40
|
+
### 2. JSON Output Contract(供 ralph-loop / sprint-flow 下游消费)
|
|
41
|
+
|
|
42
|
+
写入 `.sprint-state/slices-manifest.json`:
|
|
43
|
+
|
|
44
|
+
```json
|
|
45
|
+
{
|
|
46
|
+
"version": 1,
|
|
47
|
+
"source": "specification.yaml 或 spec 文件路径",
|
|
48
|
+
"slices": [
|
|
49
|
+
{
|
|
50
|
+
"id": "slice-N",
|
|
51
|
+
"title": "一句话描述端到端行为",
|
|
52
|
+
"type": "HITL | AFK",
|
|
53
|
+
"blocked_by": ["slice-M"] | [],
|
|
54
|
+
"parent_story": "User Story 编号",
|
|
55
|
+
"what_it_delivers": "端到端行为描述",
|
|
56
|
+
"acceptance_criteria": ["标准1", "标准2", "标准3"],
|
|
57
|
+
"effort": "S | M | L",
|
|
58
|
+
"loc_budget": 200,
|
|
59
|
+
"file_budget": 20,
|
|
60
|
+
"status": "pending"
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
"execution_order": ["slice-1", "slice-2", "slice-3"],
|
|
64
|
+
"dependency_graph": {
|
|
65
|
+
"slice-1": [],
|
|
66
|
+
"slice-2": ["slice-1"],
|
|
67
|
+
"slice-3": ["slice-1"]
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## 流程
|
|
75
|
+
|
|
76
|
+
### 1. 收集上下文
|
|
77
|
+
|
|
78
|
+
从当前对话或输入的 PRD/spec 中提取:
|
|
79
|
+
- 需求列表 / User Stories
|
|
80
|
+
- 系统模块 / 架构设计
|
|
81
|
+
- 技术约束(语言、框架、数据库)
|
|
82
|
+
|
|
83
|
+
如果输入中包含 CONTEXT.md 或 ADRs,读取并尊重其中的领域术语和架构决策。
|
|
84
|
+
|
|
85
|
+
**PRD 完整性检查(降级规则)**:
|
|
86
|
+
```
|
|
87
|
+
IF PRD 缺少关键内容:
|
|
88
|
+
- 缺少数据模型 / schema 定义 → 标注所有数据相关切片为 HITL
|
|
89
|
+
- 缺少 API 契约 → 标注所有 API 相关切片为 HITL
|
|
90
|
+
- 缺少 UI 设计 / 交互说明 → 标注所有 UI 相关切片为 HITL
|
|
91
|
+
- 缺少验收标准 → 标注整体验证切片为 HITL
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### 2. 探索代码库
|
|
95
|
+
|
|
96
|
+
**Brownfield 项目(已存在代码)— 必须执行**:
|
|
97
|
+
- 读取 AGENTS.md CODE MAP + 目录结构
|
|
98
|
+
- 检查已有模块边界、路由定义、DB 模式
|
|
99
|
+
- 确认测试覆盖现状
|
|
100
|
+
|
|
101
|
+
**Greenfield 项目(新项目)— 可选**:
|
|
102
|
+
- 若为全新项目,跳过此步骤
|
|
103
|
+
- 建议采用 schema-first 切片顺序(先 DB schema → 再 API → 再 UI)
|
|
104
|
+
|
|
105
|
+
### 3. 起草垂直切片
|
|
106
|
+
|
|
107
|
+
将需求拆解为 **tracer bullet** 切片。规则:
|
|
108
|
+
|
|
109
|
+
- 每个切片交付**一条狭窄但完整**的端到端路径
|
|
110
|
+
- **优先 unknown unknowns**:优先拆解能快速暴露不确定因素的切片
|
|
111
|
+
- **切片必须可独立演示并完整通过 6 道质量门禁**(Code Quality + Dup Code + Complexity + Principles + Tests + Architecture)
|
|
112
|
+
- **标注依赖**:明确哪些切片阻塞哪些切片
|
|
113
|
+
- **识别 Deep Module 机会**:拆解时主动提出可封装为 deep module 的模块边界
|
|
114
|
+
|
|
115
|
+
**范围控制(硬上限)**:
|
|
116
|
+
| 约束 | 阈值 | 超限处理 |
|
|
117
|
+
|------|------|---------|
|
|
118
|
+
| 切片总数 | ≤15 / 功能模块 | 超过 → 按 epic 分组,组内拓扑排序 |
|
|
119
|
+
| 单切片变更量 | ≤200 LOC 或 ≤20 文件 | 超过 → 拆分为子切片 |
|
|
120
|
+
| 单切片工作量 | ≤4h 开发时间 | 超过 → 拆分为子切片 |
|
|
121
|
+
|
|
122
|
+
### 4. HITL / AFK 分类
|
|
123
|
+
|
|
124
|
+
**判定规则**(满足任一条件即为对应类型):
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
HITL 条件:
|
|
128
|
+
- 涉及架构决策(数据库选型、API 风格、auth 方案)
|
|
129
|
+
- 涉及 UI/UX 设计选择(布局、交互、品牌色)
|
|
130
|
+
- 涉及第三方服务集成选型(支付、短信、OAuth provider)
|
|
131
|
+
- PRD 降级规则触发(见步骤 1)
|
|
132
|
+
|
|
133
|
+
AFK 条件(必须同时满足全部):
|
|
134
|
+
- 纯实现、遵循项目中已有模式(如已有 adapter 的 CRUD)
|
|
135
|
+
- 接口契约已在 spec/PRD 中明确定义
|
|
136
|
+
- 无新增外部依赖(第三方 API、新库引入)
|
|
137
|
+
- 测试策略可复用已有测试适配器
|
|
138
|
+
|
|
139
|
+
否则 → HITL(保守默认)
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
**HITL → AFK 状态机**:
|
|
143
|
+
```
|
|
144
|
+
HITL (创建) → 人工确认 (ADRs / 设计决策产出) → 标记为 AFK-ready → AFK (agent 执行)
|
|
145
|
+
↓
|
|
146
|
+
AFK 执行遇到未预见依赖 → 回退 HITL → BLOCKED
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### 5. 依赖验证
|
|
150
|
+
|
|
151
|
+
在发布前执行以下检查:
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
1. 构建依赖图 (DAG)
|
|
155
|
+
2. 检测循环依赖 (A→B→C→A) → 报错并要求重新拆分
|
|
156
|
+
3. 拓扑排序 → 生成 execution_order
|
|
157
|
+
4. 检查每个切片的 blocked_by 引用是否存在
|
|
158
|
+
5. 验证第一个切片(tracer bullet)无阻塞
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
**跨切面关注点处理**:
|
|
162
|
+
Auth、logging、error handling、i18n 等贯穿所有切层的关注点:
|
|
163
|
+
- **首选**:在第一条 tracer bullet(通常是 slice-1)中内置这些横切关注点的基础设施
|
|
164
|
+
- **次选**:作为独立的前置 AFK 切片(如 "slice-0: 基础设施骨架")
|
|
165
|
+
- 不要将这些关注点分散到每个切片中 — 会导致重复实现和不一致
|
|
166
|
+
|
|
167
|
+
### 6. 向用户确认
|
|
168
|
+
|
|
169
|
+
以编号列表呈现拆解结果。每个切片包含:
|
|
170
|
+
|
|
171
|
+
```
|
|
172
|
+
### Slice N: [简短标题]
|
|
173
|
+
- **Type**: HITL / AFK
|
|
174
|
+
- **Effort**: S(~1h) / M(~2h) / L(~4h)
|
|
175
|
+
- **Blocked by**: Slice M / None
|
|
176
|
+
- **Parent Story**: User Story 编号
|
|
177
|
+
- **LOC Budget**: ~N 行
|
|
178
|
+
- **What it delivers**: 一句话描述端到端行为
|
|
179
|
+
- **Acceptance Criteria**: 1-3 条可验证行为
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
询问用户:
|
|
183
|
+
1. 粒度是否合适?(太粗 / 太细 / 正好)
|
|
184
|
+
2. 依赖关系是否正确?
|
|
185
|
+
3. 是否有切片应该合并或拆分?
|
|
186
|
+
4. HITL/AFK 标注是否准确?
|
|
187
|
+
|
|
188
|
+
**最多 2 轮迭代**。超过 2 轮未决则强制收敛:
|
|
189
|
+
- 第一轮:完整列表展示
|
|
190
|
+
- 后续轮次:仅展示变更部分(Diff 视图:新增 / 合并 / 拆分项对比)
|
|
191
|
+
|
|
192
|
+
### 7. 发布切片
|
|
193
|
+
|
|
194
|
+
用户批准后,生成切片 Issue 并写入 `slices-manifest.json`。
|
|
195
|
+
|
|
196
|
+
**GitHub Issue 格式**:
|
|
197
|
+
```markdown
|
|
198
|
+
## Parent
|
|
199
|
+
[父 issue 编号或 PRD 链接]
|
|
200
|
+
|
|
201
|
+
## Slice ID
|
|
202
|
+
slice-N
|
|
203
|
+
|
|
204
|
+
## What to build
|
|
205
|
+
[端到端行为描述,非逐层实现描述]
|
|
206
|
+
|
|
207
|
+
## Acceptance criteria
|
|
208
|
+
- [ ] 标准 1(端到端行为可验证)
|
|
209
|
+
- [ ] 标准 2
|
|
210
|
+
- [ ] 标准 3
|
|
211
|
+
|
|
212
|
+
## Technical Notes
|
|
213
|
+
[可选:接口设计、schema 变更、架构决策]
|
|
214
|
+
|
|
215
|
+
## Blocked by
|
|
216
|
+
[#N - 阻塞 issue 编号 / None — 可以立即开始]
|
|
217
|
+
|
|
218
|
+
## Type / Effort
|
|
219
|
+
[HITL | AFK] / [S | M | L]
|
|
220
|
+
|
|
221
|
+
## Gate-Compliant DoD ⚠️
|
|
222
|
+
此切片完成后必须通过全部 6 道质量门禁:
|
|
223
|
+
- [ ] Gate 1: Code Quality (lint 无错误)
|
|
224
|
+
- [ ] Gate 2: Dup Code (≤5% 相似度)
|
|
225
|
+
- [ ] Gate 3: Complexity (≤5 警告)
|
|
226
|
+
- [ ] Gate 4: Principles (Clean Code + SOLID 零错误)
|
|
227
|
+
- [ ] Gate 5: Tests (全部通过 + ≥80% 覆盖率)
|
|
228
|
+
- [ ] Gate 6: Architecture (无新增警告 + 童子军规则)
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
**按拓扑排序顺序发布**:先发布无阻塞的切片,再发布被阻塞的切片。
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## 与 XP-Gate Sprint Flow 集成
|
|
236
|
+
|
|
237
|
+
完整 7 阶段流程中 to-issues 的位置及切片在各阶段的生命周期:
|
|
238
|
+
|
|
239
|
+
```
|
|
240
|
+
Phase 0: THINK → brainstorming → 设计文档 → APPROVED
|
|
241
|
+
Phase 1: PLAN → autoplan → delphi-review → specification.yaml
|
|
242
|
+
→ **/to-issues** → slices-manifest.json + Issue 列表
|
|
243
|
+
Phase 2: BUILD → 按 execution_order 逐个切片执行
|
|
244
|
+
→ 每个切片 = 一个 REQ(ralph-loop 模式)
|
|
245
|
+
→ 或通过 dispatching-parallel-agents 并行(无依赖的 AFK 切片)
|
|
246
|
+
Phase 3: REVIEW → **整体 review**(全部切片完成后统一 code-walkthrough)
|
|
247
|
+
→ browse / QA 验证端到端行为
|
|
248
|
+
Phase 4: USER ACC → 人工验收(全部切片集成后的完整功能)
|
|
249
|
+
Phase 5: FEEDBACK → learn + retro(按切片统计通过率/返工率)
|
|
250
|
+
Phase 6: SHIP → 全部切片合并后一次性 merge(或按 epic 分批 merge)
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
**切片与 REQ 的映射**(ralph-loop 模式):
|
|
254
|
+
```
|
|
255
|
+
每个切片 → 生成一个 REQ 实例:
|
|
256
|
+
REQ-N:
|
|
257
|
+
- source_slice: slice-N
|
|
258
|
+
- input: slices-manifest.json 中对应切片的 acceptance_criteria
|
|
259
|
+
- constraints: LOC_budget, file_budget, type (HITL/AFK)
|
|
260
|
+
- output: 通过 6 gates 的增量 diff
|
|
261
|
+
- verification: test-specification-alignment + gate verification
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
---
|
|
265
|
+
|
|
266
|
+
## Anti-Patterns
|
|
267
|
+
|
|
268
|
+
| ❌ 错误 | ✅ 正确 |
|
|
269
|
+
|---------|---------|
|
|
270
|
+
| 按技术层拆分("先做 DB"、"再做 API"、"最后做 UI") | 按端到端行为拆分("用户可以通过邮箱注册") |
|
|
271
|
+
| 伪装成垂直切片的水平拆分(标题是用户故事,执行时仍分层) | 每个切片的 acceptance criteria 必须包含全层验证 |
|
|
272
|
+
| 切片完成后无法独立演示 | 每个切片必须可验证 + 通过 6 道质量门禁 |
|
|
273
|
+
| 一个切片包含过多用户故事(>2 个) | 一个切片聚焦 1-2 个用户故事 |
|
|
274
|
+
| 忽略或随意标注依赖关系 | 拓扑排序验证 + 循环检测 |
|
|
275
|
+
| HITL 切片被当作 AFK 执行 | 人工输出 ADR/决策后 → 标记 AFK-ready → 执行 |
|
|
276
|
+
| 切片标题模糊("实现功能X") | 切片标题描述行为("用户可通过邮箱注册账号") |
|
|
277
|
+
| 切片超出 200 LOC / 20 文件 / 4h 预算 | 拆分为子切片 |
|