@zhuan-ai/zhuanspec 2.2.4 → 2.4.8
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/zhuanspec-hook.js +3 -0
- package/dist/cli/hooks.d.ts +14 -0
- package/dist/cli/hooks.js +465 -0
- package/dist/cli/index.js +100 -0
- package/dist/commands/artifact-workflow.js +15 -34
- package/dist/commands/design.d.ts +42 -0
- package/dist/commands/design.js +337 -0
- package/dist/commands/progress.d.ts +32 -0
- package/dist/commands/progress.js +278 -0
- package/dist/commands/review.d.ts +32 -0
- package/dist/commands/review.js +472 -0
- package/dist/commands/validate.d.ts +14 -0
- package/dist/commands/validate.js +161 -10
- package/dist/core/archive.d.ts +1 -0
- package/dist/core/archive.js +45 -3
- package/dist/core/completions/command-registry.js +67 -0
- package/dist/core/configurators/slash/amazon-q.js +32 -2
- package/dist/core/configurators/slash/antigravity.js +8 -2
- package/dist/core/configurators/slash/auggie.js +16 -1
- package/dist/core/configurators/slash/base.js +1 -1
- package/dist/core/configurators/slash/claude.d.ts +4 -0
- package/dist/core/configurators/slash/claude.js +56 -1
- package/dist/core/configurators/slash/cline.js +8 -2
- package/dist/core/configurators/slash/codebuddy.js +22 -1
- package/dist/core/configurators/slash/codex.js +21 -0
- package/dist/core/configurators/slash/costrict.js +15 -0
- package/dist/core/configurators/slash/crush.js +22 -1
- package/dist/core/configurators/slash/cursor.js +22 -1
- package/dist/core/configurators/slash/factory.js +16 -1
- package/dist/core/configurators/slash/gemini.js +8 -2
- package/dist/core/configurators/slash/github-copilot.js +19 -1
- package/dist/core/configurators/slash/iflow.js +22 -1
- package/dist/core/configurators/slash/kilocode.js +4 -1
- package/dist/core/configurators/slash/opencode.js +27 -0
- package/dist/core/configurators/slash/qoder.d.ts +4 -0
- package/dist/core/configurators/slash/qoder.js +59 -1
- package/dist/core/configurators/slash/qwen.js +8 -2
- package/dist/core/configurators/slash/roocode.js +8 -2
- package/dist/core/configurators/slash/windsurf.js +8 -2
- package/dist/core/dashboard/metrics.d.ts +33 -0
- package/dist/core/dashboard/metrics.js +114 -0
- package/dist/core/hooks/collect-knowledge.d.ts +16 -0
- package/dist/core/hooks/collect-knowledge.js +203 -0
- package/dist/core/hooks/context-load-hook.d.ts +25 -0
- package/dist/core/hooks/context-load-hook.js +159 -0
- package/dist/core/hooks/deviation-check.d.ts +27 -0
- package/dist/core/hooks/deviation-check.js +403 -0
- package/dist/core/hooks/deviation-handler.d.ts +43 -0
- package/dist/core/hooks/deviation-handler.js +98 -0
- package/dist/core/hooks/init.d.ts +14 -0
- package/dist/core/hooks/init.js +244 -0
- package/dist/core/hooks/notify-milestone.d.ts +14 -0
- package/dist/core/hooks/notify-milestone.js +170 -0
- package/dist/core/hooks/post-apply.d.ts +29 -0
- package/dist/core/hooks/post-apply.js +173 -0
- package/dist/core/hooks/post-archive.d.ts +7 -0
- package/dist/core/hooks/post-archive.js +208 -0
- package/dist/core/hooks/pre-apply.d.ts +34 -0
- package/dist/core/hooks/pre-apply.js +139 -0
- package/dist/core/hooks/pre-archive.d.ts +7 -0
- package/dist/core/hooks/pre-archive.js +50 -0
- package/dist/core/hooks/record-progress.d.ts +49 -0
- package/dist/core/hooks/record-progress.js +494 -0
- package/dist/core/hooks/review-hooks.d.ts +89 -0
- package/dist/core/hooks/review-hooks.js +345 -0
- package/dist/core/hooks/review-orchestrator.d.ts +40 -0
- package/dist/core/hooks/review-orchestrator.js +146 -0
- package/dist/core/hooks/summarize.d.ts +15 -0
- package/dist/core/hooks/summarize.js +282 -0
- package/dist/core/hooks/user-input-hook.d.ts +25 -0
- package/dist/core/hooks/user-input-hook.js +179 -0
- package/dist/core/init.d.ts +8 -0
- package/dist/core/init.js +251 -23
- package/dist/core/parsers/requirement-blocks.js +13 -10
- package/dist/core/templates/agents-template.d.ts +1 -1
- package/dist/core/templates/agents-template.js +510 -243
- package/dist/core/templates/index.d.ts +1 -0
- package/dist/core/templates/index.js +1 -0
- package/dist/core/templates/skill-templates.js +46 -152
- package/dist/core/templates/slash-command-templates.d.ts +1 -1
- package/dist/core/templates/slash-command-templates.js +352 -20
- package/dist/core/templates/tasks-template.d.ts +7 -0
- package/dist/core/templates/tasks-template.js +130 -24
- package/dist/core/templates/tdd-tasks-template.d.ts +3 -0
- package/dist/core/templates/tdd-tasks-template.js +91 -38
- package/dist/core/templates/test-cases-template.d.ts +41 -0
- package/dist/core/templates/test-cases-template.js +128 -0
- package/dist/core/validation/strict-rules.d.ts +44 -5
- package/dist/core/validation/strict-rules.js +302 -8
- package/dist/core/validation/validator.js +52 -2
- package/dist/core/view.d.ts +1 -0
- package/dist/core/view.js +60 -2
- package/dist/mcp/index.d.ts +28 -0
- package/dist/mcp/index.js +31 -0
- package/dist/utils/file-system.d.ts +1 -0
- package/dist/utils/file-system.js +11 -0
- package/dist/utils/item-discovery.js +24 -2
- package/dist/utils/phase-utils.d.ts +36 -0
- package/dist/utils/phase-utils.js +117 -0
- package/package.json +22 -23
- package/schemas/spec-driven/schema.yaml +45 -31
- package/schemas/spec-driven/templates/spec.md +142 -5
- package/schemas/spec-driven/templates/tasks.md +73 -9
|
@@ -2,9 +2,14 @@
|
|
|
2
2
|
* Tasks Template
|
|
3
3
|
*
|
|
4
4
|
* Template for generating tasks.md with required checkpoint sections.
|
|
5
|
+
* This template MUST conform to strict validation rules in strict-rules.ts:
|
|
6
|
+
* - pre-clarification-completed: Must have valid Pre-Clarification Log section
|
|
7
|
+
* - skill-tags-valid: Must have Skill Mapping table and @skill tags
|
|
8
|
+
* - task-ordering-by-wave: Must have Wave headers in correct order
|
|
5
9
|
*/
|
|
6
10
|
/**
|
|
7
11
|
* Get the tasks.md template structure with required checkpoint sections
|
|
12
|
+
* Template uses valid completion markers to pass strict validation by default
|
|
8
13
|
*/
|
|
9
14
|
export function getTasksTemplate(options) {
|
|
10
15
|
const changeId = options?.changeId || '[change-id]';
|
|
@@ -12,64 +17,165 @@ export function getTasksTemplate(options) {
|
|
|
12
17
|
|
|
13
18
|
## Pre-Clarification Log
|
|
14
19
|
|
|
15
|
-
<!--
|
|
16
|
-
<!--
|
|
20
|
+
<!-- ⚠️ CHECKPOINT [PRE-CLARIFICATION]: This section MUST be completed before writing proposal -->
|
|
21
|
+
<!-- Record clarification Q&A or write "Status: COMPLETED - No clarification needed" -->
|
|
22
|
+
<!-- This section MUST NOT be empty, contain only HTML comments, or have TODO/TBD/PENDING markers -->
|
|
17
23
|
|
|
18
|
-
Status:
|
|
24
|
+
Status: COMPLETED - No clarification needed
|
|
19
25
|
|
|
20
|
-
|
|
26
|
+
Reason: All scope, technical choices, priorities, and dependencies are clear from existing specs and project conventions.
|
|
27
|
+
|
|
28
|
+
<!-- If clarification was needed, replace above with Q&A record:
|
|
29
|
+
Question 1: <!-- clarification question -->
|
|
30
|
+
Answer: <!-- user answer -->
|
|
21
31
|
|
|
22
|
-
|
|
23
|
-
|
|
32
|
+
Question 2: <!-- clarification question -->
|
|
33
|
+
Answer: <!-- user answer -->
|
|
34
|
+
-->
|
|
35
|
+
|
|
36
|
+
## Skill Mapping
|
|
24
37
|
|
|
25
|
-
<!--
|
|
38
|
+
<!-- ⚠️ CHECKPOINT [SKILL-TAGGING]: Run \`zhuanspec skills list\` first and record discovered skills -->
|
|
26
39
|
<!-- Every task MUST have either @skill:real-skill-name or @skill:none -->
|
|
40
|
+
<!-- If @skill:none, MUST provide justification in description -->
|
|
41
|
+
<!-- @skill names MUST match exactly the names returned by \`zhuanspec skills list\` -->
|
|
42
|
+
|
|
43
|
+
| 实现区域 | 实际功能 | 关联 Skill | 匹配理由 |
|
|
44
|
+
|---------|---------|-----------|---------|
|
|
45
|
+
| <!-- module/file --> | <!-- actual function --> | <!-- skill name --> | <!-- why it matches --> |
|
|
46
|
+
|
|
47
|
+
<!--
|
|
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)
|
|
27
61
|
|
|
28
|
-
|
|
62
|
+
@test-case 标注指南(可选):
|
|
63
|
+
1. 仅当提供测试 case 时添加此标注
|
|
64
|
+
2. 格式:@test-case:TC-001 或 @test-case:TC-001,TC-002(多个用逗号分隔)
|
|
65
|
+
3. 确保引用的 TC-XXX 在 test-cases.md 中存在
|
|
66
|
+
4. 任务应覆盖对应测试 case 的所有验收点
|
|
67
|
+
-->
|
|
29
68
|
|
|
30
|
-
### Wave 1
|
|
69
|
+
### Wave 1
|
|
31
70
|
|
|
32
|
-
<!-- Tasks
|
|
33
|
-
<!-- Wave assignment computed from @depends relationships -->
|
|
71
|
+
<!-- Wave 1: Tasks with no dependencies -->
|
|
34
72
|
|
|
35
|
-
- [ ] 1.1
|
|
73
|
+
- [ ] 1.1 <!-- Task description --> @skill:none <!-- 纯配置变更或手动操作 -->
|
|
36
74
|
|
|
37
|
-
### Wave 2
|
|
75
|
+
### Wave 2
|
|
38
76
|
|
|
39
|
-
<!-- Tasks
|
|
77
|
+
<!-- Wave 2: Tasks depending on Wave 1 -->
|
|
40
78
|
|
|
41
|
-
- [ ] 2.1
|
|
79
|
+
- [ ] 2.1 <!-- Task description --> @depends:1.1 @skill:none <!-- 无需特定 skill -->
|
|
80
|
+
|
|
81
|
+
### Wave 3
|
|
82
|
+
|
|
83
|
+
<!-- Wave 3: Tasks depending on Wave 2 -->
|
|
84
|
+
|
|
85
|
+
- [ ] 3.1 <!-- Task description --> @depends:2.1 @skill:none <!-- 无需特定 skill -->
|
|
42
86
|
|
|
43
87
|
## Dependency Analysis
|
|
44
88
|
|
|
45
|
-
<!--
|
|
89
|
+
<!-- ⚠️ CHECKPOINT [TASK-ORDERING]: Status must be COMPLETED after wave analysis -->
|
|
46
90
|
<!-- No task may appear before a task it depends on -->
|
|
91
|
+
<!-- validate --strict will verify task ordering matches computed waves -->
|
|
92
|
+
|
|
93
|
+
Status: COMPLETED
|
|
94
|
+
|
|
95
|
+
Wave assignment logic:
|
|
96
|
+
- Wave 1: No @depends annotations → no dependencies
|
|
97
|
+
- Wave 2: @depends:1.x → depends on Wave 1
|
|
98
|
+
- Wave 3: @depends:2.x → depends on Wave 2
|
|
99
|
+
|
|
100
|
+
## Test Case Coverage
|
|
47
101
|
|
|
48
|
-
|
|
102
|
+
<!-- ⚠️ CHECKPOINT [TEST-CASE-COVERAGE]: Each task should reference related test cases (recommended) -->
|
|
103
|
+
<!-- Use @test-case:TC-XXX to link tasks to test cases -->
|
|
104
|
+
<!-- 表格必须包含四列:Task、测试 Case ID、测试 Case 文件路径、覆盖场景 -->
|
|
105
|
+
|
|
106
|
+
| Task | 测试 Case ID | 测试 Case 文件路径 | 覆盖场景 |
|
|
107
|
+
|------|-------------|-------------------|----------|
|
|
108
|
+
| <!-- T1 --> | <!-- TC-001 --> | <!-- BIC 路径层级,如:退货退款 > 创建售后 > 三选一页面 > 组装机弹窗 --> | <!-- 描述覆盖的场景 --> |
|
|
109
|
+
|
|
110
|
+
<!--
|
|
111
|
+
测试 case 设计指南:
|
|
112
|
+
1. 为每个 Requirement 设计至少一个正向场景测试 case
|
|
113
|
+
2. 为关键业务逻辑设计异常场景测试 case
|
|
114
|
+
3. 测试 case 应与 Requirement 的 Scenario 对应
|
|
115
|
+
4. 测试 case ID 格式:TC-XXX(三位数字)
|
|
116
|
+
5. 测试 case 详情记录在 test-cases.md 文件中
|
|
117
|
+
6. "测试 Case 文件路径" 列填写 BIC 路径层级格式:
|
|
118
|
+
- 格式:功能模块 > 子模块 > 页面 > 操作 > 结果
|
|
119
|
+
- 示例:退货退款 > 创建售后 > 三选一页面 > 组装机 > 退货退款 > 点击后,显示组装机弹窗
|
|
120
|
+
-->
|
|
121
|
+
|
|
122
|
+
## Quality Gates
|
|
123
|
+
|
|
124
|
+
- [ ] Apply 全部任务完成后自动执行一次 \`zhuanspec review <change-id>\`(如失败则手动补执行)
|
|
125
|
+
- [ ] **测试 case 已设计并覆盖所有关键场景**
|
|
126
|
+
|
|
127
|
+
## Workflow Diagram
|
|
128
|
+
|
|
129
|
+
<!-- Auto-generated by zhuanspec validate --strict -->
|
|
130
|
+
<!-- DO NOT EDIT - this section will be regenerated on each validation -->
|
|
131
|
+
|
|
132
|
+
\`\`\`mermaid
|
|
133
|
+
flowchart TD
|
|
134
|
+
W1[Wave 1] --> W2[Wave 2]
|
|
135
|
+
W2 --> W3[Wave 3]
|
|
136
|
+
\`\`\`
|
|
49
137
|
`;
|
|
50
138
|
}
|
|
51
139
|
/**
|
|
52
140
|
* Get the minimal tasks.md template (for quick scaffolding)
|
|
141
|
+
* Note: This minimal template will NOT pass strict validation by default
|
|
142
|
+
* User must fill in the Pre-Clarification Log and Skill Mapping sections
|
|
53
143
|
*/
|
|
54
144
|
export function getMinimalTasksTemplate() {
|
|
55
145
|
return `## Pre-Clarification Log
|
|
56
146
|
|
|
57
|
-
Status:
|
|
147
|
+
<!-- Replace with actual Q&A or "Status: COMPLETED - No clarification needed" -->
|
|
148
|
+
|
|
149
|
+
Status: COMPLETED - No clarification needed
|
|
150
|
+
|
|
151
|
+
Reason: <!-- fill in reason -->
|
|
58
152
|
|
|
59
153
|
## Skill Mapping
|
|
60
154
|
|
|
61
|
-
|
|
|
62
|
-
|
|
155
|
+
| 实现区域 | 实际功能 | 关联 Skill | 匹配理由 |
|
|
156
|
+
|---------|---------|-----------|---------|
|
|
157
|
+
| <!-- fill in --> | <!-- fill in --> | <!-- fill in --> | <!-- fill in --> |
|
|
158
|
+
|
|
159
|
+
### Wave 1
|
|
63
160
|
|
|
64
|
-
|
|
161
|
+
- [ ] 1.1 <!-- Task description --> @skill:none <!-- 纯配置变更 -->
|
|
65
162
|
|
|
66
|
-
### Wave
|
|
163
|
+
### Wave 2
|
|
67
164
|
|
|
68
|
-
- [ ]
|
|
165
|
+
- [ ] 2.1 <!-- Task description --> @depends:1.1 @skill:none <!-- 无需特定 skill -->
|
|
69
166
|
|
|
70
167
|
## Dependency Analysis
|
|
71
168
|
|
|
72
|
-
Status:
|
|
169
|
+
Status: COMPLETED
|
|
170
|
+
|
|
171
|
+
Wave assignment logic:
|
|
172
|
+
- Wave 1: No dependencies
|
|
173
|
+
- Wave 2: Depends on Wave 1
|
|
174
|
+
|
|
175
|
+
## Quality Gates
|
|
176
|
+
|
|
177
|
+
- [ ] Apply 全部任务完成后自动执行一次 \`zhuanspec review <change-id>\`(如失败则手动补执行)
|
|
178
|
+
- [ ] 单元测试命令已执行且测试通过(如 \`npm test\` / \`mvn test\`)
|
|
73
179
|
`;
|
|
74
180
|
}
|
|
75
181
|
export default {
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Template for generating tasks.md in TDD workflow with required checkpoint sections.
|
|
5
5
|
* This follows the TDD schema: spec → tests → implementation → docs
|
|
6
|
+
* Template MUST conform to strict validation rules in strict-rules.ts
|
|
6
7
|
*/
|
|
7
8
|
export interface TddTasksTemplateOptions {
|
|
8
9
|
changeId: string;
|
|
@@ -10,10 +11,12 @@ export interface TddTasksTemplateOptions {
|
|
|
10
11
|
}
|
|
11
12
|
/**
|
|
12
13
|
* Get the TDD tasks.md template structure with required checkpoint sections
|
|
14
|
+
* Uses valid completion markers to pass strict validation by default
|
|
13
15
|
*/
|
|
14
16
|
export declare function getTddTasksTemplate(options?: TddTasksTemplateOptions): string;
|
|
15
17
|
/**
|
|
16
18
|
* Get the minimal TDD tasks.md template (for quick scaffolding)
|
|
19
|
+
* Note: User must fill in Pre-Clarification Log and Skill Mapping sections
|
|
17
20
|
*/
|
|
18
21
|
export declare function getMinimalTddTasksTemplate(): string;
|
|
19
22
|
declare const _default: {
|
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Template for generating tasks.md in TDD workflow with required checkpoint sections.
|
|
5
5
|
* This follows the TDD schema: spec → tests → implementation → docs
|
|
6
|
+
* Template MUST conform to strict validation rules in strict-rules.ts
|
|
6
7
|
*/
|
|
7
8
|
/**
|
|
8
9
|
* Get the TDD tasks.md template structure with required checkpoint sections
|
|
10
|
+
* Uses valid completion markers to pass strict validation by default
|
|
9
11
|
*/
|
|
10
12
|
export function getTddTasksTemplate(options) {
|
|
11
13
|
const changeId = options?.changeId || '[change-id]';
|
|
@@ -14,99 +16,150 @@ export function getTddTasksTemplate(options) {
|
|
|
14
16
|
|
|
15
17
|
## Pre-Clarification Log
|
|
16
18
|
|
|
17
|
-
<!--
|
|
18
|
-
<!--
|
|
19
|
+
<!-- ⚠️ CHECKPOINT [PRE-CLARIFICATION]: This section MUST be completed before writing proposal -->
|
|
20
|
+
<!-- Record clarification Q&A or write "Status: COMPLETED - No clarification needed" -->
|
|
21
|
+
<!-- This section MUST NOT be empty, contain only HTML comments, or have TODO/TBD/PENDING markers -->
|
|
19
22
|
|
|
20
|
-
Status:
|
|
23
|
+
Status: COMPLETED - No clarification needed
|
|
21
24
|
|
|
22
|
-
|
|
25
|
+
Reason: TDD workflow requirements are clear - specification first, then failing tests, then implementation.
|
|
26
|
+
|
|
27
|
+
<!-- If clarification was needed:
|
|
28
|
+
Question 1: <!-- clarification question -->
|
|
29
|
+
Answer: <!-- user answer -->
|
|
30
|
+
-->
|
|
23
31
|
|
|
24
|
-
|
|
25
|
-
|---|---|---|
|
|
32
|
+
## Skill Mapping
|
|
26
33
|
|
|
27
|
-
<!--
|
|
34
|
+
<!-- ⚠️ CHECKPOINT [SKILL-TAGGING]: Run \`zhuanspec skills list\` first -->
|
|
28
35
|
<!-- Every task MUST have either @skill:real-skill-name or @skill:none -->
|
|
29
36
|
|
|
30
|
-
|
|
37
|
+
| 实现区域 | 实际功能 | 关联 Skill | 匹配理由 |
|
|
38
|
+
|---------|---------|-----------|---------|
|
|
39
|
+
| 测试层 | 单元测试生成 | generate-${testFramework}-unit-test-skill | TDD Red phase 需要生成测试框架特定测试 |
|
|
40
|
+
|
|
41
|
+
<!--
|
|
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
|
|
46
|
+
-->
|
|
31
47
|
|
|
32
|
-
### Wave 1
|
|
48
|
+
### Wave 1
|
|
33
49
|
|
|
34
|
-
<!-- Define what to build before writing any code -->
|
|
50
|
+
<!-- Wave 1: Specification - Define what to build before writing any code -->
|
|
35
51
|
|
|
36
|
-
- [ ] 1.1 Write feature specification @skill:none <!-- spec definition -->
|
|
52
|
+
- [ ] 1.1 Write feature specification @skill:none <!-- justification: spec definition, no code -->
|
|
37
53
|
|
|
38
|
-
### Wave 2
|
|
54
|
+
### Wave 2
|
|
39
55
|
|
|
40
|
-
<!--
|
|
56
|
+
<!-- Wave 2: Red Phase - Write failing tests that define expected behavior -->
|
|
41
57
|
<!-- Tests should fail initially - this proves they test something meaningful -->
|
|
42
58
|
|
|
43
59
|
- [ ] 2.1 Write unit tests for core functionality @depends:1.1 @skill:generate-${testFramework}-unit-test-skill
|
|
44
|
-
- [ ] 2.2 Write integration tests @depends:1.1 @skill:none
|
|
60
|
+
- [ ] 2.2 Write integration tests @depends:1.1 @skill:none <!-- justification: integration tests, framework-specific -->
|
|
45
61
|
|
|
46
|
-
### Wave 3
|
|
62
|
+
### Wave 3
|
|
47
63
|
|
|
48
|
-
<!--
|
|
64
|
+
<!-- Wave 3: Green Phase - Write minimal code to make tests pass -->
|
|
49
65
|
|
|
50
|
-
- [ ] 3.1 Implement core logic @depends:2.1 @skill:none
|
|
66
|
+
- [ ] 3.1 Implement core logic @depends:2.1 @skill:none <!-- fill in actual skill if needed -->
|
|
51
67
|
- [ ] 3.2 Implement edge case handling @depends:3.1 @skill:none
|
|
52
68
|
|
|
53
|
-
### Wave 4
|
|
69
|
+
### Wave 4
|
|
54
70
|
|
|
55
|
-
<!--
|
|
71
|
+
<!-- Wave 4: Refactor Phase - Clean up code while keeping tests green -->
|
|
56
72
|
|
|
57
|
-
- [ ] 4.1 Refactor for clarity @depends:3.2 @skill:none
|
|
73
|
+
- [ ] 4.1 Refactor for clarity @depends:3.2 @skill:none <!-- justification: code cleanup -->
|
|
58
74
|
- [ ] 4.2 Optimize performance @depends:4.1 @skill:none
|
|
59
75
|
|
|
60
|
-
### Wave 5
|
|
76
|
+
### Wave 5
|
|
61
77
|
|
|
62
|
-
<!-- Document the implemented feature -->
|
|
78
|
+
<!-- Wave 5: Documentation - Document the implemented feature -->
|
|
63
79
|
|
|
64
|
-
- [ ] 5.1 Update API documentation @depends:4.2 @skill:none
|
|
80
|
+
- [ ] 5.1 Update API documentation @depends:4.2 @skill:none <!-- justification: documentation task -->
|
|
65
81
|
- [ ] 5.2 Add usage examples @depends:5.1 @skill:none
|
|
66
82
|
|
|
67
83
|
## Dependency Analysis
|
|
68
84
|
|
|
69
|
-
<!--
|
|
85
|
+
<!-- ⚠️ CHECKPOINT [TASK-ORDERING]: Status must be COMPLETED after wave analysis -->
|
|
70
86
|
<!-- TDD waves follow strict order: spec → tests → impl → refactor → docs -->
|
|
71
87
|
<!-- No task may appear before a task it depends on -->
|
|
72
88
|
|
|
73
|
-
Status:
|
|
89
|
+
Status: COMPLETED
|
|
90
|
+
|
|
91
|
+
TDD Wave assignment logic:
|
|
92
|
+
- 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)
|
|
96
|
+
- Wave 5: Documentation (depends on refactor)
|
|
97
|
+
|
|
98
|
+
## Quality Gates
|
|
99
|
+
|
|
100
|
+
- [ ] Apply 全部任务完成后自动执行一次 \`zhuanspec review <change-id>\`(如失败则手动补执行)
|
|
101
|
+
|
|
102
|
+
## Workflow Diagram
|
|
103
|
+
|
|
104
|
+
<!-- Auto-generated by zhuanspec validate --strict -->
|
|
105
|
+
<!-- DO NOT EDIT - this section will be regenerated -->
|
|
106
|
+
|
|
107
|
+
\`\`\`mermaid
|
|
108
|
+
flowchart TD
|
|
109
|
+
W1[Wave 1: Spec] --> W2[Wave 2: Tests]
|
|
110
|
+
W2 --> W3[Wave 3: Impl]
|
|
111
|
+
W3 --> W4[Wave 4: Refactor]
|
|
112
|
+
W4 --> W5[Wave 5: Docs]
|
|
113
|
+
\`\`\`
|
|
74
114
|
`;
|
|
75
115
|
}
|
|
76
116
|
/**
|
|
77
117
|
* Get the minimal TDD tasks.md template (for quick scaffolding)
|
|
118
|
+
* Note: User must fill in Pre-Clarification Log and Skill Mapping sections
|
|
78
119
|
*/
|
|
79
120
|
export function getMinimalTddTasksTemplate() {
|
|
80
121
|
return `## Pre-Clarification Log
|
|
81
122
|
|
|
82
|
-
Status:
|
|
123
|
+
Status: COMPLETED - No clarification needed
|
|
124
|
+
|
|
125
|
+
Reason: <!-- fill in reason -->
|
|
83
126
|
|
|
84
127
|
## Skill Mapping
|
|
85
128
|
|
|
86
|
-
|
|
|
87
|
-
|
|
129
|
+
| 实现区域 | 实际功能 | 关联 Skill | 匹配理由 |
|
|
130
|
+
|---------|---------|-----------|---------|
|
|
131
|
+
| <!-- fill in --> | <!-- fill in --> | <!-- fill in --> | <!-- fill in --> |
|
|
132
|
+
|
|
133
|
+
### Wave 1
|
|
88
134
|
|
|
89
|
-
|
|
135
|
+
- [ ] 1.1 Write specification @skill:none
|
|
90
136
|
|
|
91
|
-
### Wave
|
|
137
|
+
### Wave 2
|
|
92
138
|
|
|
93
|
-
- [ ]
|
|
139
|
+
- [ ] 2.1 Write tests @depends:1.1 @skill:none
|
|
94
140
|
|
|
95
|
-
### Wave
|
|
141
|
+
### Wave 3
|
|
96
142
|
|
|
97
|
-
- [ ]
|
|
143
|
+
- [ ] 3.1 Implement @depends:2.1 @skill:none
|
|
98
144
|
|
|
99
|
-
### Wave
|
|
145
|
+
### Wave 4
|
|
100
146
|
|
|
101
|
-
- [ ]
|
|
147
|
+
- [ ] 4.1 Refactor @depends:3.1 @skill:none
|
|
102
148
|
|
|
103
|
-
### Wave
|
|
149
|
+
### Wave 5
|
|
104
150
|
|
|
105
|
-
- [ ]
|
|
151
|
+
- [ ] 5.1 Document @depends:4.1 @skill:none
|
|
106
152
|
|
|
107
153
|
## Dependency Analysis
|
|
108
154
|
|
|
109
|
-
Status:
|
|
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\`)
|
|
110
163
|
`;
|
|
111
164
|
}
|
|
112
165
|
export default {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test Cases Template
|
|
3
|
+
*
|
|
4
|
+
* Template for generating test-cases.md when test cases are provided.
|
|
5
|
+
* This template is optional and only created when:
|
|
6
|
+
* - User selects "有测试 case" in Phase 0 (Test Case Decision)
|
|
7
|
+
* - Test case details are fetched via taskId/bicId or manually entered
|
|
8
|
+
*/
|
|
9
|
+
export interface TestCasesTemplateOptions {
|
|
10
|
+
changeId: string;
|
|
11
|
+
source?: 'taskId' | 'bicId' | 'manual';
|
|
12
|
+
sourceId?: string;
|
|
13
|
+
testCaseCount?: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Get the test-cases.md template structure
|
|
17
|
+
*/
|
|
18
|
+
export declare function getTestCasesTemplate(options?: TestCasesTemplateOptions): string;
|
|
19
|
+
/**
|
|
20
|
+
* Get a minimal test-cases.md template for manual entry
|
|
21
|
+
*/
|
|
22
|
+
export declare function getMinimalTestCasesTemplate(): string;
|
|
23
|
+
/**
|
|
24
|
+
* Format fetched test cases into test-cases.md content
|
|
25
|
+
* This function can be used to convert raw test case data from MCP tools
|
|
26
|
+
*/
|
|
27
|
+
export declare function formatFetchedTestCases(changeId: string, source: string, sourceId: string, testCases: Array<{
|
|
28
|
+
id: string;
|
|
29
|
+
title: string;
|
|
30
|
+
preconditions?: string[];
|
|
31
|
+
steps?: string[];
|
|
32
|
+
expectedResult?: string;
|
|
33
|
+
checkpoints?: string[];
|
|
34
|
+
}>): string;
|
|
35
|
+
declare const _default: {
|
|
36
|
+
getTestCasesTemplate: typeof getTestCasesTemplate;
|
|
37
|
+
getMinimalTestCasesTemplate: typeof getMinimalTestCasesTemplate;
|
|
38
|
+
formatFetchedTestCases: typeof formatFetchedTestCases;
|
|
39
|
+
};
|
|
40
|
+
export default _default;
|
|
41
|
+
//# sourceMappingURL=test-cases-template.d.ts.map
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test Cases Template
|
|
3
|
+
*
|
|
4
|
+
* Template for generating test-cases.md when test cases are provided.
|
|
5
|
+
* This template is optional and only created when:
|
|
6
|
+
* - User selects "有测试 case" in Phase 0 (Test Case Decision)
|
|
7
|
+
* - Test case details are fetched via taskId/bicId or manually entered
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Get the test-cases.md template structure
|
|
11
|
+
*/
|
|
12
|
+
export function getTestCasesTemplate(options) {
|
|
13
|
+
const changeId = options?.changeId || '[change-id]';
|
|
14
|
+
const source = options?.source || 'manual';
|
|
15
|
+
const sourceId = options?.sourceId || '[source-id]';
|
|
16
|
+
const count = options?.testCaseCount || 2;
|
|
17
|
+
return `# 测试 Cases: ${changeId}
|
|
18
|
+
|
|
19
|
+
**来源**: ${source === 'taskId' ? `taskId=${sourceId}` : source === 'bicId' ? `bicId=${sourceId}` : '手动录入'}
|
|
20
|
+
**获取时间**: [YYYY-MM-DD]
|
|
21
|
+
**总数**: ${count} 个测试 case
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## TC-001: [测试 case 标题]
|
|
26
|
+
|
|
27
|
+
**前置条件**:
|
|
28
|
+
- [前置条件1]
|
|
29
|
+
- [前置条件2]
|
|
30
|
+
|
|
31
|
+
**测试步骤**:
|
|
32
|
+
1. 步骤1
|
|
33
|
+
2. 步骤2
|
|
34
|
+
3. 步骤3
|
|
35
|
+
|
|
36
|
+
**预期结果**:
|
|
37
|
+
- [预期结果描述]
|
|
38
|
+
|
|
39
|
+
**验收点**:
|
|
40
|
+
- ✅ 验收点1: [具体描述]
|
|
41
|
+
- ✅ 验收点2: [具体描述]
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## TC-002: [测试 case 标题]
|
|
46
|
+
|
|
47
|
+
**前置条件**:
|
|
48
|
+
- [前置条件1]
|
|
49
|
+
|
|
50
|
+
**测试步骤**:
|
|
51
|
+
1. 步骤1
|
|
52
|
+
2. 步骤2
|
|
53
|
+
|
|
54
|
+
**预期结果**:
|
|
55
|
+
- [预期结果描述]
|
|
56
|
+
|
|
57
|
+
**验收点**:
|
|
58
|
+
- ✅ 验收点1: [具体描述]
|
|
59
|
+
- ✅ 验收点2: [具体描述]
|
|
60
|
+
`;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Get a minimal test-cases.md template for manual entry
|
|
64
|
+
*/
|
|
65
|
+
export function getMinimalTestCasesTemplate() {
|
|
66
|
+
return `# 测试 Cases: [change-id]
|
|
67
|
+
|
|
68
|
+
**来源**: 手动录入
|
|
69
|
+
**获取时间**: [YYYY-MM-DD]
|
|
70
|
+
**总数**: N 个测试 case
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## TC-001: [测试 case 标题]
|
|
75
|
+
|
|
76
|
+
**前置条件**:
|
|
77
|
+
- [前置条件]
|
|
78
|
+
|
|
79
|
+
**测试步骤**:
|
|
80
|
+
1. [步骤]
|
|
81
|
+
|
|
82
|
+
**预期结果**:
|
|
83
|
+
- [预期结果]
|
|
84
|
+
|
|
85
|
+
**验收点**:
|
|
86
|
+
- ✅ 验收点: [描述]
|
|
87
|
+
`;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Format fetched test cases into test-cases.md content
|
|
91
|
+
* This function can be used to convert raw test case data from MCP tools
|
|
92
|
+
*/
|
|
93
|
+
export function formatFetchedTestCases(changeId, source, sourceId, testCases) {
|
|
94
|
+
const header = `# 测试 Cases: ${changeId}
|
|
95
|
+
|
|
96
|
+
**来源**: ${source}=${sourceId}
|
|
97
|
+
**获取时间**: ${new Date().toISOString().split('T')[0]}
|
|
98
|
+
**总数**: ${testCases.length} 个测试 case
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
`;
|
|
102
|
+
const testCaseBlocks = testCases.map(tc => {
|
|
103
|
+
const preconditionList = tc.preconditions?.map(p => `- ${p}`).join('\n') || '- [待补充前置条件]';
|
|
104
|
+
const stepsList = tc.steps?.map((s, i) => `${i + 1}. ${s}`).join('\n') || '1. [待补充测试步骤]';
|
|
105
|
+
const checkpointsList = tc.checkpoints?.map(c => `- ✅ ${c}`).join('\n') || '- ✅ [待补充验收点]';
|
|
106
|
+
return `## ${tc.id}: ${tc.title}
|
|
107
|
+
|
|
108
|
+
**前置条件**:
|
|
109
|
+
${preconditionList}
|
|
110
|
+
|
|
111
|
+
**测试步骤**:
|
|
112
|
+
${stepsList}
|
|
113
|
+
|
|
114
|
+
**预期结果**:
|
|
115
|
+
- ${tc.expectedResult || '[待补充预期结果]'}
|
|
116
|
+
|
|
117
|
+
**验收点**:
|
|
118
|
+
${checkpointsList}
|
|
119
|
+
`;
|
|
120
|
+
}).join('\n---\n');
|
|
121
|
+
return header + testCaseBlocks;
|
|
122
|
+
}
|
|
123
|
+
export default {
|
|
124
|
+
getTestCasesTemplate,
|
|
125
|
+
getMinimalTestCasesTemplate,
|
|
126
|
+
formatFetchedTestCases
|
|
127
|
+
};
|
|
128
|
+
//# sourceMappingURL=test-cases-template.js.map
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Strict Validation Rules
|
|
3
3
|
*
|
|
4
|
-
* Implementation of
|
|
5
|
-
* 1. pre-clarification-completed: Check Pre-Clarification Log section
|
|
6
|
-
* 2. skill-tags-valid: Validate @skill tags against known skills
|
|
7
|
-
* 3. task-ordering-by-wave: Verify task ordering follows wave structure
|
|
4
|
+
* Implementation of strict validation rules for `zhuanspec validate --strict`.
|
|
8
5
|
*/
|
|
9
6
|
import type { ParsedTask } from '../task-graph/types.js';
|
|
10
7
|
export interface StrictCheckResult {
|
|
@@ -64,8 +61,50 @@ export declare function checkTaskOrderingByWave(tasksContent: string, parsedTask
|
|
|
64
61
|
* - Each scheduling_summary entry correctly describes subagent count and execution mode
|
|
65
62
|
*/
|
|
66
63
|
export declare function checkSubagentDirectives(parsedTasks: ParsedTask[]): StrictCheckResult;
|
|
64
|
+
/**
|
|
65
|
+
* Rule 5: review-gate-defined
|
|
66
|
+
*
|
|
67
|
+
* Tasks must explicitly mention zhuanspec review gate.
|
|
68
|
+
*/
|
|
69
|
+
export declare function checkReviewGateDefined(tasksContent: string): StrictCheckResult;
|
|
70
|
+
/**
|
|
71
|
+
* Rule 7: proposal-format-valid
|
|
72
|
+
*
|
|
73
|
+
* Validates that proposal.md contains required sections:
|
|
74
|
+
* - Why/变更原因
|
|
75
|
+
* - What Changes/变更内容
|
|
76
|
+
* - Impact/影响范围
|
|
77
|
+
*/
|
|
78
|
+
export declare function checkProposalFormatValid(proposalContent: string): StrictCheckResult;
|
|
79
|
+
/**
|
|
80
|
+
* Detect current workflow phase based on progress.json.
|
|
81
|
+
*
|
|
82
|
+
* Phase detection logic:
|
|
83
|
+
* 1. If progress.json doesn't exist -> Propose phase
|
|
84
|
+
* 2. If progress.json exists with phase field -> use that phase
|
|
85
|
+
* 3. If progress.json exists without phase field -> Apply phase (default)
|
|
86
|
+
*/
|
|
87
|
+
export declare function detectPhase(changeDir: string): 'propose' | 'apply' | 'review';
|
|
88
|
+
/**
|
|
89
|
+
* Rule: test-case-coverage
|
|
90
|
+
* Validates that tasks.md has test case coverage section.
|
|
91
|
+
* Behavior differs based on hasTestCase mode:
|
|
92
|
+
* - hasTestCase=true (TDD or user provided cases): REQUIRED, blocking if missing
|
|
93
|
+
* - hasTestCase=false (normal spec-driven): SKIPPED, warning only
|
|
94
|
+
*
|
|
95
|
+
* Table format validation (when hasTestCase=true):
|
|
96
|
+
* - Must have four columns: Task, 测试 Case ID, 测试 Case 文件路径, 覆盖场景
|
|
97
|
+
* - Column headers must match expected format
|
|
98
|
+
*/
|
|
99
|
+
export declare function checkTestCaseCoverage(tasksContent: string, hasTestCase?: boolean): StrictCheckResult;
|
|
67
100
|
/**
|
|
68
101
|
* Main entry: Run all strict validation rules
|
|
69
102
|
*/
|
|
70
|
-
export declare function runStrictValidation(tasksContent: string, parsedTasks: ParsedTask[], knownSkillNames: string[]
|
|
103
|
+
export declare function runStrictValidation(tasksContent: string, parsedTasks: ParsedTask[], knownSkillNames: string[], options?: {
|
|
104
|
+
proposalContent?: string;
|
|
105
|
+
specsDir?: string;
|
|
106
|
+
repoRoot?: string;
|
|
107
|
+
changeDir?: string;
|
|
108
|
+
hasTestCase?: boolean;
|
|
109
|
+
}): Promise<StrictValidationResult>;
|
|
71
110
|
//# sourceMappingURL=strict-rules.d.ts.map
|