@zhuan-ai/zhuanspec 2.11.3 → 2.11.6

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.
@@ -74,6 +74,12 @@ Answer: <!-- user answer -->
74
74
 
75
75
  ## 任务格式说明
76
76
 
77
+ ⚠️ **所有任务项必须使用 GitHub Flavored Markdown 复选框格式**:
78
+ - 待完成:\`- [ ] N.M 描述\`
79
+ - 已完成:\`- [x] N.M 描述\`
80
+ - **严禁使用** \`#### Task N.M:\` 或 \`#### T1:\` 标题格式
81
+ - **严禁使用** ✅ emoji 标记完成,必须用 \`[x]\`
82
+
77
83
  每个任务按类型使用对应的固定模板,必须填满所有字段:
78
84
 
79
85
  ### 类型 A:新增文件
@@ -169,6 +175,7 @@ Wave assignment logic:
169
175
  - Wave 2: @depends:1.x → depends on Wave 1
170
176
  - Wave 3: @depends:2.x → depends on Wave 2
171
177
 
178
+
172
179
  ## File Conflict Analysis
173
180
 
174
181
  <!-- 当多个任务修改同一文件时,在此声明冲突并指定隔离策略 -->
@@ -214,51 +221,7 @@ flowchart TD
214
221
  \`\`\`
215
222
  `;
216
223
  }
217
- /**
218
- * Get the minimal tasks.md template (for quick scaffolding)
219
- * Note: This minimal template will NOT pass strict validation by default
220
- * User must fill in the Pre-Clarification Log and Skill Mapping sections
221
- */
222
- export function getMinimalTasksTemplate() {
223
- return `## Pre-Clarification Log
224
-
225
- <!-- Replace with actual Q&A or "Status: COMPLETED - No clarification needed" -->
226
-
227
- Status: COMPLETED - No clarification needed
228
-
229
- Reason: <!-- fill in reason -->
230
-
231
- ## Skill Mapping
232
-
233
- | 实现区域 | 实际功能 | 关联 Skill | 匹配理由 |
234
- |---------|---------|-----------|---------|
235
- | <!-- fill in --> | <!-- fill in --> | <!-- fill in --> | <!-- fill in --> |
236
-
237
- ### Wave 1
238
-
239
- - [ ] 1.1 <!-- Task description --> @skill:none <!-- 纯配置变更 -->
240
-
241
- ### Wave 2
242
-
243
- - [ ] 2.1 <!-- Task description --> @depends:1.1 @skill:none <!-- 无需特定 skill -->
244
-
245
- ## Dependency Analysis
246
-
247
- Status: COMPLETED
248
-
249
- Wave assignment logic:
250
- - Wave 1: No dependencies
251
- - Wave 2: Depends on Wave 1
252
-
253
- ## File Conflict Analysis
254
-
255
- | 文件 | 涉及任务 | 各任务修改区域 | 隔离策略 |
256
- |------|---------|-------------|---------|
257
- | <!-- 相对路径 --> | <!-- T1.x, T2.y --> | <!-- T1.x: 函数名/行范围; T2.y: 函数名/行范围 --> | <!-- parallel / serial --> |
258
- `;
259
- }
260
224
  export default {
261
- getTasksTemplate,
262
- getMinimalTasksTemplate
225
+ getTasksTemplate
263
226
  };
264
227
  //# sourceMappingURL=tasks-template.js.map
@@ -14,14 +14,8 @@ export interface TddTasksTemplateOptions {
14
14
  * Uses valid completion markers to pass strict validation by default
15
15
  */
16
16
  export declare function getTddTasksTemplate(options?: TddTasksTemplateOptions): string;
17
- /**
18
- * Get the minimal TDD tasks.md template (for quick scaffolding)
19
- * Note: User must fill in Pre-Clarification Log and Skill Mapping sections
20
- */
21
- export declare function getMinimalTddTasksTemplate(): string;
22
17
  declare const _default: {
23
18
  getTddTasksTemplate: typeof getTddTasksTemplate;
24
- getMinimalTddTasksTemplate: typeof getMinimalTddTasksTemplate;
25
19
  };
26
20
  export default _default;
27
21
  //# sourceMappingURL=tdd-tasks-template.d.ts.map
@@ -24,61 +24,164 @@ Status: COMPLETED - No clarification needed
24
24
 
25
25
  Reason: TDD workflow requirements are clear - specification first, then failing tests, then implementation.
26
26
 
27
- <!-- If clarification was needed:
27
+ <!-- If clarification was needed, replace above with Q&A record:
28
28
  Question 1: <!-- clarification question -->
29
29
  Answer: <!-- user answer -->
30
+
31
+ Question 2: <!-- clarification question -->
32
+ Answer: <!-- user answer -->
30
33
  -->
31
34
 
32
35
  ## Skill Mapping
33
36
 
34
- <!-- ⚠️ CHECKPOINT [SKILL-TAGGING]: Run \`zhuanspec skills list\` first -->
37
+ <!-- ⚠️ CHECKPOINT [SKILL-TAGGING]: Run \`zhuanspec skills list\` first and record discovered skills -->
35
38
  <!-- Every task MUST have either @skill:real-skill-name or @skill:none -->
39
+ <!-- If @skill:none, MUST provide justification in description -->
40
+ <!-- @skill names MUST match exactly the names returned by \`zhuanspec skills list\` -->
36
41
 
37
42
  | 实现区域 | 实际功能 | 关联 Skill | 匹配理由 |
38
- |---------|---------|-----------|---------|
43
+ |---------|---------|-----------|--------|
39
44
  | 测试层 | 单元测试生成 | generate-${testFramework}-unit-test-skill | TDD Red phase 需要生成测试框架特定测试 |
45
+ | <!-- module/file --> | <!-- actual function --> | <!-- skill name --> | <!-- why it matches --> |
40
46
 
41
47
  <!--
42
- TDD Skill Mapping Guidelines:
43
- - Wave 2 (Red): Unit test generation requires test skill
44
- - Wave 3-4 (Green/Refactor): Implementation may need domain-specific skills
45
- - Wave 5 (Docs): Documentation tasks typically @skill:none
48
+ @skill 标注指南:
49
+ 1. 首先运行 \`zhuanspec skills list --json\` 获取可用 skill 列表
50
+ 2. 基于任务的实际功能内容与 skill description 进行语义匹配
51
+ 3. 匹配原则:
52
+ - 精确匹配:任务功能应与 skill description 明确对应
53
+ - 避免过度匹配:简单的代码修改只需通用编码规范 skill
54
+ - 避免关键词匹配:不要仅因文件名或路径关键词就匹配
55
+
56
+ @depends 标注指南:
57
+ 1. 使用 @depends:taskId 标注依赖,支持多依赖 @depends:taskId1,taskId2
58
+ 2. 无 @depends 的任务默认无依赖,可与其他无依赖任务并行执行
59
+ 3. 不允许循环依赖
60
+ 4. 仅标注直接依赖(如 A→B→C,C 只需标注 @depends:B)
61
+
62
+ @test-case 标注指南(TDD 模式下强烈推荐):
63
+ 1. TDD 模式下每个实现任务(Wave 3-4)应关联对应的测试 case
64
+ 2. 格式:@test-case:TC-001 或 @test-case:TC-001,TC-002(多个用逗号分隔)
65
+ 3. 确保引用的 TC-XXX 在 test-cases.md 中存在
66
+ 4. 任务应覆盖对应测试 case 的所有验收点
67
+
68
+ @ref 标注指南:
69
+ 1. 指向技术方案文档的具体章节(路径为实际定位到的技术方案文件相对路径)
70
+ 2. 格式:@ref:<tech-spec路径>#章节编号-章节名称
71
+ 3. 示例:@ref:techDesign/tech-spec.md#3.1-新建客户接口
72
+ 4. 确保引用的章节在技术方案文档中存在
46
73
  -->
47
74
 
75
+ ## 任务格式说明
76
+
77
+ ⚠️ **所有任务项必须使用 GitHub Flavored Markdown 复选框格式**:
78
+ - 待完成:\`- [ ] N.M 描述\`
79
+ - 已完成:\`- [x] N.M 描述\`
80
+ - **严禁使用** \`#### Task N.M:\` 或 \`#### T1:\` 标题格式
81
+ - **严禁使用** ✅ emoji 标记完成,必须用 \`[x]\`
82
+
83
+ 每个任务按类型使用对应的固定模板,必须填满所有字段:
84
+
85
+ ### 类型 A:新增文件
86
+
87
+ - [ ] N.M [描述] @skill:xxx @ref:xxx
88
+ - **文件**: \`完整相对路径\`(新增)
89
+ - **内容**:
90
+ - 类定义: [类名、继承/实现关系]
91
+ - 依赖注入: [注入的 Bean/Service 列表]
92
+ - 核心方法: [方法签名 → 返回类型](列出全部 public 方法)
93
+ - 关键逻辑: [核心业务流程,如:校验 → 加锁 → 写库 → 同步ES]
94
+ - 字段/配置: [若为 Entity/DTO/配置类,列出全部字段及类型]
95
+ - **验证**: [具体的输入输出断言,含正常和异常场景]
96
+
97
+ 示例:
98
+ - [ ] 3.1 创建 OrderDomainService @skill:java-scf-rpc-usage-skill
99
+ @ref:techDesign/tech-spec.md#3.1-创建订单
100
+ - **文件**: \`order_server/src/main/java/com/zz/order/domain/OrderDomainService.java\`(新增)
101
+ - **内容**:
102
+ - 类定义: \`@Service public class OrderDomainService\`
103
+ - 依赖注入: OrderMapper, InventoryService, RedissonClient
104
+ - 核心方法: createOrder(CreateOrderRequest, Long userId) → Long
105
+ - 关键逻辑: 参数校验 → 库存预扣 → 分布式锁 order:create:{userId} → insert t_order → 发送MQ
106
+ - 异常处理: 库存不足抛 BizException(ErrorCode.STOCK_INSUFFICIENT)
107
+ - **验证**: 库存不足返回 STOCK_INSUFFICIENT;正常创建返回 orderId > 0;并发创建幂等
108
+
109
+ ### 类型 B:修改文件
110
+
111
+ - [ ] N.M [描述] @skill:xxx @ref:xxx
112
+ - **文件**: \`完整相对路径\`(总行数)
113
+ - **修改位置**: L行号范围 \`函数名/类名\` 之后/之内
114
+ - **内容**: [具体改什么:新增代码逻辑/修改现有逻辑/删除代码,描述修改方式]
115
+ - **验证**: [修改后的预期行为,含回归验证]
116
+
117
+ 示例:
118
+ - [ ] 3.2 在 PaymentService 中增加退款超时重试 @skill:none
119
+ @ref:techDesign/tech-spec.md#4.2-退款重试机制
120
+ - **文件**: \`payment_server/src/main/java/com/zz/payment/service/PaymentService.java\`(215行)
121
+ - **修改位置**: L89-102 \`refund()\` 函数内,现有退款调用之后
122
+ - **内容**: 新增重试逻辑 — 退款接口超时时最多重试3次,间隔2s指数退避,3次失败后记录失败日志并发告警MQ
123
+ - **验证**: 超时重试3次后成功;3次均失败触发告警;正常退款不触发重试
124
+
125
+ ## 任务粒度原则
126
+ - 每个任务对应一个类或一个接口方法的实现
127
+ - 单个任务 AI 执行时间不超过 30 分钟
128
+ - 超过则需拆分为多个子任务
129
+ - **禁止模糊描述**:不允许"创建XXX类"不带文件路径、"实现YYY方法"不带方法签名和关键逻辑
130
+
131
+ ## Coverage Checklist
132
+
133
+ <!-- 当存在技术方案(techDesign/tech-spec.md/ 通过--tech-spec创建的提案)时,必须填写此表 -->
134
+ <!-- 列出技术方案中所有维度与任务的映射关系,确保覆盖率 >= 95% -->
135
+
136
+ | 维度 | 技术方案数量 | 提案任务覆盖 | 覆盖率 |
137
+ |------|-------------|-------------|-------|
138
+ | DB 表 | <!-- N张 --> | <!-- T编号范围 --> | <!-- 100% --> |
139
+ | ES 索引 | <!-- N个 --> | <!-- T编号范围 --> | <!-- 100% --> |
140
+ | Entity 类 | <!-- N个 --> | <!-- T编号范围 --> | <!-- 100% --> |
141
+ | Mapper | <!-- N个 --> | <!-- T编号范围 --> | <!-- 100% --> |
142
+ | SCF接口方法 | <!-- N个 --> | <!-- T编号范围 --> | <!-- 100% --> |
143
+ | DTO 类 | <!-- N个 --> | <!-- T编号范围 --> | <!-- 100% --> |
144
+ | 配置项 | <!-- N个 --> | <!-- T编号范围 --> | <!-- 100% --> |
145
+ | 前端组件 | <!-- N个 --> | <!-- T编号范围 --> | <!-- 100% --> |
146
+
48
147
  ### Wave 1
49
148
 
50
149
  <!-- Wave 1: Specification - Define what to build before writing any code -->
150
+ <!-- 此阶段定义功能规格,无代码产出 -->
51
151
 
52
- - [ ] 1.1 Write feature specification @skill:none <!-- justification: spec definition, no code -->
152
+ - [ ] 1.1 <!-- 编写功能规格说明 --> @skill:none <!-- justification: spec definition, no code -->
53
153
 
54
154
  ### Wave 2
55
155
 
56
156
  <!-- Wave 2: Red Phase - Write failing tests that define expected behavior -->
57
- <!-- Tests should fail initially - this proves they test something meaningful -->
157
+ <!-- 先写测试,测试应当初始失败 — 证明测试确实在验证有意义的行为 -->
158
+ <!-- 每个测试任务必须使用类型A/B模板,明确测试文件路径、测试方法签名、断言内容 -->
58
159
 
59
- - [ ] 2.1 Write unit tests for core functionality @depends:1.1 @skill:generate-${testFramework}-unit-test-skill
60
- - [ ] 2.2 Write integration tests @depends:1.1 @skill:none <!-- justification: integration tests, framework-specific -->
160
+ - [ ] 2.1 <!-- 编写核心功能单元测试 --> @depends:1.1 @skill:generate-${testFramework}-unit-test-skill
161
+ - [ ] 2.2 <!-- 编写集成测试 --> @depends:1.1 @skill:none <!-- justification: integration tests -->
61
162
 
62
163
  ### Wave 3
63
164
 
64
165
  <!-- Wave 3: Green Phase - Write minimal code to make tests pass -->
166
+ <!-- 编写最少代码使测试通过,每个任务必须使用类型A(新增)或类型B(修改)模板 -->
65
167
 
66
- - [ ] 3.1 Implement core logic @depends:2.1 @skill:none <!-- fill in actual skill if needed -->
67
- - [ ] 3.2 Implement edge case handling @depends:3.1 @skill:none
168
+ - [ ] 3.1 <!-- 实现核心逻辑 --> @depends:2.1 @skill:none <!-- fill in actual skill if needed -->
169
+ - [ ] 3.2 <!-- 实现边界场景处理 --> @depends:3.1 @skill:none
68
170
 
69
171
  ### Wave 4
70
172
 
71
173
  <!-- Wave 4: Refactor Phase - Clean up code while keeping tests green -->
174
+ <!-- 在保持测试通过的前提下重构,每个任务使用类型B模板标明修改位置 -->
72
175
 
73
- - [ ] 4.1 Refactor for clarity @depends:3.2 @skill:none <!-- justification: code cleanup -->
74
- - [ ] 4.2 Optimize performance @depends:4.1 @skill:none
176
+ - [ ] 4.1 <!-- 重构提升可读性 --> @depends:3.2 @skill:none <!-- justification: code cleanup -->
177
+ - [ ] 4.2 <!-- 性能优化 --> @depends:4.1 @skill:none
75
178
 
76
179
  ### Wave 5
77
180
 
78
181
  <!-- Wave 5: Documentation - Document the implemented feature -->
79
182
 
80
- - [ ] 5.1 Update API documentation @depends:4.2 @skill:none <!-- justification: documentation task -->
81
- - [ ] 5.2 Add usage examples @depends:5.1 @skill:none
183
+ - [ ] 5.1 <!-- 更新 API 文档 --> @depends:4.2 @skill:none <!-- justification: documentation task -->
184
+ - [ ] 5.2 <!-- 补充使用示例 --> @depends:5.1 @skill:none
82
185
 
83
186
  ## Dependency Analysis
84
187
 
@@ -90,11 +193,44 @@ Status: COMPLETED
90
193
 
91
194
  TDD Wave assignment logic:
92
195
  - Wave 1: Specification (no dependencies)
93
- - Wave 2: Tests (depends on spec)
94
- - Wave 3: Implementation (depends on tests)
95
- - Wave 4: Refactor (depends on implementation)
196
+ - Wave 2: Tests (depends on spec) — Red phase
197
+ - Wave 3: Implementation (depends on tests) — Green phase
198
+ - Wave 4: Refactor (depends on implementation) — Refactor phase
96
199
  - Wave 5: Documentation (depends on refactor)
97
200
 
201
+ ## File Conflict Analysis
202
+
203
+ <!-- 当多个任务修改同一文件时,在此声明冲突并指定隔离策略 -->
204
+ <!-- 隔离策略:parallel(不同区域可并行)/ serial(同区域必须串行)-->
205
+ <!-- 此表帮助编排 Agent 做更精确的并行化决策,补充自动检测无法覆盖的"同文件不同区域可并行"场景 -->
206
+ <!-- 无文件冲突时章节可省略,或将表格行填写 N/A -->
207
+
208
+ | 文件 | 涉及任务 | 各任务修改区域 | 隔离策略 |
209
+ |------|---------|-------------|--------|
210
+ | <!-- 相对路径 --> | <!-- T1.x, T2.y --> | <!-- T1.x: 函数名/行范围; T2.y: 函数名/行范围 --> | <!-- parallel / serial --> |
211
+
212
+ ## Test Case Coverage
213
+
214
+ <!-- ⚠️ CHECKPOINT [TEST-CASE-COVERAGE]: TDD 模式下此表为必填项 -->
215
+ <!-- Wave 2 的测试任务必须与 Wave 3-4 的实现任务形成完整映射 -->
216
+ <!-- Use @test-case:TC-XXX to link tasks to test cases -->
217
+ <!-- 表格必须包含四列:Task、测试 Case ID、测试 Case 文件路径、覆盖场景 -->
218
+
219
+ | Task | 测试 Case ID | 测试 Case 文件路径 | 覆盖场景 |
220
+ |------|-------------|-------------------|----------|
221
+ | <!-- T2.1 --> | <!-- TC-001 --> | <!-- BIC 路径层级 --> | <!-- 描述覆盖的场景 --> |
222
+
223
+ <!--
224
+ TDD 测试 case 设计指南:
225
+ 1. Wave 2 每个测试任务至少覆盖一个正向场景和一个异常场景
226
+ 2. Wave 3-4 实现任务应通过 @test-case 反向关联 Wave 2 的测试
227
+ 3. 测试 case ID 格式:TC-XXX(三位数字)
228
+ 4. 测试 case 详情记录在 test-cases.md 文件中
229
+ 5. "测试 Case 文件路径" 列填写 BIC 路径层级格式:
230
+ - 格式:功能模块 > 子模块 > 页面 > 操作 > 结果
231
+ - 示例:退货退款 > 创建售后 > 三选一页面 > 组装机 > 退货退款 > 点击后,显示组装机弹窗
232
+ -->
233
+
98
234
  ## Quality Gates
99
235
 
100
236
  - [ ] Apply 全部任务完成后自动执行一次 \`zhuanspec review <change-id>\`(如失败则手动补执行)
@@ -106,64 +242,14 @@ TDD Wave assignment logic:
106
242
 
107
243
  \`\`\`mermaid
108
244
  flowchart TD
109
- W1[Wave 1: Spec] --> W2[Wave 2: Tests]
110
- W2 --> W3[Wave 3: Impl]
245
+ W1[Wave 1: Spec] --> W2[Wave 2: Red - Tests]
246
+ W2 --> W3[Wave 3: Green - Impl]
111
247
  W3 --> W4[Wave 4: Refactor]
112
248
  W4 --> W5[Wave 5: Docs]
113
249
  \`\`\`
114
250
  `;
115
251
  }
116
- /**
117
- * Get the minimal TDD tasks.md template (for quick scaffolding)
118
- * Note: User must fill in Pre-Clarification Log and Skill Mapping sections
119
- */
120
- export function getMinimalTddTasksTemplate() {
121
- return `## Pre-Clarification Log
122
-
123
- Status: COMPLETED - No clarification needed
124
-
125
- Reason: <!-- fill in reason -->
126
-
127
- ## Skill Mapping
128
-
129
- | 实现区域 | 实际功能 | 关联 Skill | 匹配理由 |
130
- |---------|---------|-----------|---------|
131
- | <!-- fill in --> | <!-- fill in --> | <!-- fill in --> | <!-- fill in --> |
132
-
133
- ### Wave 1
134
-
135
- - [ ] 1.1 Write specification @skill:none
136
-
137
- ### Wave 2
138
-
139
- - [ ] 2.1 Write tests @depends:1.1 @skill:none
140
-
141
- ### Wave 3
142
-
143
- - [ ] 3.1 Implement @depends:2.1 @skill:none
144
-
145
- ### Wave 4
146
-
147
- - [ ] 4.1 Refactor @depends:3.1 @skill:none
148
-
149
- ### Wave 5
150
-
151
- - [ ] 5.1 Document @depends:4.1 @skill:none
152
-
153
- ## Dependency Analysis
154
-
155
- Status: COMPLETED
156
-
157
- Wave assignment: TDD strict order
158
-
159
- ## Quality Gates
160
-
161
- - [ ] Apply 全部任务完成后自动执行一次 \`zhuanspec review <change-id>\`(如失败则手动补执行)
162
- - [ ] 单元测试命令已执行且测试通过(如 \`npm test\` / \`mvn test\`)
163
- `;
164
- }
165
252
  export default {
166
- getTddTasksTemplate,
167
- getMinimalTddTasksTemplate
253
+ getTddTasksTemplate
168
254
  };
169
255
  //# sourceMappingURL=tdd-tasks-template.js.map
@@ -137,19 +137,28 @@ export declare function checkTestCaseCoverage(tasksContent: string, hasTestCase?
137
137
  *
138
138
  * When a tech-spec document exists, validates that the technical spec
139
139
  * adequately covers the proposal's requirements.
140
- * This is a basic framework - full logic will be implemented in Task 7's Skill.
141
140
  *
142
- * Tech spec document lookup order:
143
- * 1. techDesign/tech-spec.md (standard path)
144
- * 2. tech-spec.md in the proposal root directory
145
- * 3. 用户提供本地技术方案路径
141
+ * Tech spec document lookup order (priority):
142
+ * 1. 用户通过 --tech-spec 指定的外部路径 (externalTechSpecPath)
143
+ * 2. techDesign/ 目录下的任意 .md 文件(文件名不限定为 tech-spec.md)
144
+ * 3. 提案根目录下的任意技术方案相关 .md 文件
146
145
  *
147
146
  * Checks:
148
- * - tech-spec.md file exists and is non-empty
149
- * - tech-spec.md contains substantive content (not just placeholder)
147
+ * - tech-spec file exists and is non-empty
148
+ * - tech-spec contains substantive content (not just placeholder)
149
+ * - structural elements (DB tables, APIs, classes, etc.) are covered in proposal files
150
150
  */
151
- export declare function checkTechSpecCoverage(changeDir: string): StrictCheckResult;
151
+ export declare function checkTechSpecCoverage(changeDir: string, externalTechSpecPath?: string): StrictCheckResult;
152
152
  export declare function checkTaskIdFormat(tasksContent: string): StrictCheckResult;
153
+ /**
154
+ * Rule: task-checkbox-format
155
+ *
156
+ * Validates that all tasks under Wave headers use standard GitHub Flavored Markdown
157
+ * checkbox format: `- [ ] N.M description` or `- [x] N.M description`.
158
+ * Rejects legacy formats like `#### Task N.M:` headers or `✅` emoji as completion marker.
159
+ * This ensures automated progress tracking (parseTasks, record-progress, review gate) works correctly.
160
+ */
161
+ export declare function checkTaskCheckboxFormat(tasksContent: string): StrictCheckResult;
153
162
  /**
154
163
  * Main entry: Run all strict validation rules
155
164
  */
@@ -159,6 +168,7 @@ export declare function runStrictValidation(tasksContent: string, parsedTasks: P
159
168
  repoRoot?: string;
160
169
  changeDir?: string;
161
170
  hasTestCase?: boolean;
171
+ techSpecPath?: string;
162
172
  }): Promise<StrictValidationResult>;
163
173
  export {};
164
174
  //# sourceMappingURL=strict-rules.d.ts.map