@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.
Files changed (103) hide show
  1. package/bin/zhuanspec-hook.js +3 -0
  2. package/dist/cli/hooks.d.ts +14 -0
  3. package/dist/cli/hooks.js +465 -0
  4. package/dist/cli/index.js +100 -0
  5. package/dist/commands/artifact-workflow.js +15 -34
  6. package/dist/commands/design.d.ts +42 -0
  7. package/dist/commands/design.js +337 -0
  8. package/dist/commands/progress.d.ts +32 -0
  9. package/dist/commands/progress.js +278 -0
  10. package/dist/commands/review.d.ts +32 -0
  11. package/dist/commands/review.js +472 -0
  12. package/dist/commands/validate.d.ts +14 -0
  13. package/dist/commands/validate.js +161 -10
  14. package/dist/core/archive.d.ts +1 -0
  15. package/dist/core/archive.js +45 -3
  16. package/dist/core/completions/command-registry.js +67 -0
  17. package/dist/core/configurators/slash/amazon-q.js +32 -2
  18. package/dist/core/configurators/slash/antigravity.js +8 -2
  19. package/dist/core/configurators/slash/auggie.js +16 -1
  20. package/dist/core/configurators/slash/base.js +1 -1
  21. package/dist/core/configurators/slash/claude.d.ts +4 -0
  22. package/dist/core/configurators/slash/claude.js +56 -1
  23. package/dist/core/configurators/slash/cline.js +8 -2
  24. package/dist/core/configurators/slash/codebuddy.js +22 -1
  25. package/dist/core/configurators/slash/codex.js +21 -0
  26. package/dist/core/configurators/slash/costrict.js +15 -0
  27. package/dist/core/configurators/slash/crush.js +22 -1
  28. package/dist/core/configurators/slash/cursor.js +22 -1
  29. package/dist/core/configurators/slash/factory.js +16 -1
  30. package/dist/core/configurators/slash/gemini.js +8 -2
  31. package/dist/core/configurators/slash/github-copilot.js +19 -1
  32. package/dist/core/configurators/slash/iflow.js +22 -1
  33. package/dist/core/configurators/slash/kilocode.js +4 -1
  34. package/dist/core/configurators/slash/opencode.js +27 -0
  35. package/dist/core/configurators/slash/qoder.d.ts +4 -0
  36. package/dist/core/configurators/slash/qoder.js +59 -1
  37. package/dist/core/configurators/slash/qwen.js +8 -2
  38. package/dist/core/configurators/slash/roocode.js +8 -2
  39. package/dist/core/configurators/slash/windsurf.js +8 -2
  40. package/dist/core/dashboard/metrics.d.ts +33 -0
  41. package/dist/core/dashboard/metrics.js +114 -0
  42. package/dist/core/hooks/collect-knowledge.d.ts +16 -0
  43. package/dist/core/hooks/collect-knowledge.js +203 -0
  44. package/dist/core/hooks/context-load-hook.d.ts +25 -0
  45. package/dist/core/hooks/context-load-hook.js +159 -0
  46. package/dist/core/hooks/deviation-check.d.ts +27 -0
  47. package/dist/core/hooks/deviation-check.js +403 -0
  48. package/dist/core/hooks/deviation-handler.d.ts +43 -0
  49. package/dist/core/hooks/deviation-handler.js +98 -0
  50. package/dist/core/hooks/init.d.ts +14 -0
  51. package/dist/core/hooks/init.js +244 -0
  52. package/dist/core/hooks/notify-milestone.d.ts +14 -0
  53. package/dist/core/hooks/notify-milestone.js +170 -0
  54. package/dist/core/hooks/post-apply.d.ts +29 -0
  55. package/dist/core/hooks/post-apply.js +173 -0
  56. package/dist/core/hooks/post-archive.d.ts +7 -0
  57. package/dist/core/hooks/post-archive.js +208 -0
  58. package/dist/core/hooks/pre-apply.d.ts +34 -0
  59. package/dist/core/hooks/pre-apply.js +139 -0
  60. package/dist/core/hooks/pre-archive.d.ts +7 -0
  61. package/dist/core/hooks/pre-archive.js +50 -0
  62. package/dist/core/hooks/record-progress.d.ts +49 -0
  63. package/dist/core/hooks/record-progress.js +494 -0
  64. package/dist/core/hooks/review-hooks.d.ts +89 -0
  65. package/dist/core/hooks/review-hooks.js +345 -0
  66. package/dist/core/hooks/review-orchestrator.d.ts +40 -0
  67. package/dist/core/hooks/review-orchestrator.js +146 -0
  68. package/dist/core/hooks/summarize.d.ts +15 -0
  69. package/dist/core/hooks/summarize.js +282 -0
  70. package/dist/core/hooks/user-input-hook.d.ts +25 -0
  71. package/dist/core/hooks/user-input-hook.js +179 -0
  72. package/dist/core/init.d.ts +8 -0
  73. package/dist/core/init.js +251 -23
  74. package/dist/core/parsers/requirement-blocks.js +13 -10
  75. package/dist/core/templates/agents-template.d.ts +1 -1
  76. package/dist/core/templates/agents-template.js +510 -243
  77. package/dist/core/templates/index.d.ts +1 -0
  78. package/dist/core/templates/index.js +1 -0
  79. package/dist/core/templates/skill-templates.js +46 -152
  80. package/dist/core/templates/slash-command-templates.d.ts +1 -1
  81. package/dist/core/templates/slash-command-templates.js +352 -20
  82. package/dist/core/templates/tasks-template.d.ts +7 -0
  83. package/dist/core/templates/tasks-template.js +130 -24
  84. package/dist/core/templates/tdd-tasks-template.d.ts +3 -0
  85. package/dist/core/templates/tdd-tasks-template.js +91 -38
  86. package/dist/core/templates/test-cases-template.d.ts +41 -0
  87. package/dist/core/templates/test-cases-template.js +128 -0
  88. package/dist/core/validation/strict-rules.d.ts +44 -5
  89. package/dist/core/validation/strict-rules.js +302 -8
  90. package/dist/core/validation/validator.js +52 -2
  91. package/dist/core/view.d.ts +1 -0
  92. package/dist/core/view.js +60 -2
  93. package/dist/mcp/index.d.ts +28 -0
  94. package/dist/mcp/index.js +31 -0
  95. package/dist/utils/file-system.d.ts +1 -0
  96. package/dist/utils/file-system.js +11 -0
  97. package/dist/utils/item-discovery.js +24 -2
  98. package/dist/utils/phase-utils.d.ts +36 -0
  99. package/dist/utils/phase-utils.js +117 -0
  100. package/package.json +22 -23
  101. package/schemas/spec-driven/schema.yaml +45 -31
  102. package/schemas/spec-driven/templates/spec.md +142 -5
  103. package/schemas/spec-driven/templates/tasks.md +73 -9
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Phase Utilities - Phase state management for ZhuanSpec
3
+ *
4
+ * Provides:
5
+ * - Phase type definition
6
+ * - setPhase: Write phase to progress.json
7
+ * - getPhaseFromProgress: Read phase from progress.json
8
+ * - getCurrentPhase: Comprehensive phase detection
9
+ */
10
+ export type Phase = 'idle' | 'techDesign' | 'propose' | 'apply' | 'review' | 'archive';
11
+ export declare const PHASE_ORDER: Phase[];
12
+ export declare const PHASE_MARKERS: Partial<Record<Phase, string>>;
13
+ /**
14
+ * Set phase in progress.json
15
+ * Creates or updates progress.json with the new phase value
16
+ */
17
+ export declare function setPhase(changeDir: string, phase: Phase): Promise<void>;
18
+ /**
19
+ * Get phase from progress.json
20
+ * Returns null if progress.json doesn't exist or phase field is missing
21
+ */
22
+ export declare function getPhaseFromProgress(changeDir: string): Promise<Phase | null>;
23
+ /**
24
+ * Get current phase using comprehensive detection
25
+ * Priority: progress.json phase > marker files > directory existence
26
+ */
27
+ export declare function getCurrentPhase(changeDir: string): Promise<Phase>;
28
+ /**
29
+ * Check if a directory is a techDesign change (can be reused by proposal)
30
+ */
31
+ export declare function isTechDesignChange(changeDir: string): Promise<boolean>;
32
+ /**
33
+ * Clear techDesign markers when transitioning to propose
34
+ */
35
+ export declare function clearTechDesignMarkers(changeDir: string): Promise<void>;
36
+ //# sourceMappingURL=phase-utils.d.ts.map
@@ -0,0 +1,117 @@
1
+ /**
2
+ * Phase Utilities - Phase state management for ZhuanSpec
3
+ *
4
+ * Provides:
5
+ * - Phase type definition
6
+ * - setPhase: Write phase to progress.json
7
+ * - getPhaseFromProgress: Read phase from progress.json
8
+ * - getCurrentPhase: Comprehensive phase detection
9
+ */
10
+ import path from 'path';
11
+ import { FileSystemUtils } from './file-system.js';
12
+ export const PHASE_ORDER = ['idle', 'techDesign', 'propose', 'apply', 'review', 'archive'];
13
+ export const PHASE_MARKERS = {
14
+ techDesign: '.tech-design',
15
+ apply: '.approved',
16
+ review: 'review-report.md',
17
+ };
18
+ /**
19
+ * Set phase in progress.json
20
+ * Creates or updates progress.json with the new phase value
21
+ */
22
+ export async function setPhase(changeDir, phase) {
23
+ const metricsDir = path.join(changeDir, 'metrics');
24
+ await FileSystemUtils.createDirectory(metricsDir);
25
+ const progressPath = path.join(metricsDir, 'progress.json');
26
+ let progress;
27
+ if (await FileSystemUtils.fileExists(progressPath)) {
28
+ try {
29
+ progress = JSON.parse(await FileSystemUtils.readFile(progressPath));
30
+ }
31
+ catch {
32
+ progress = { phase };
33
+ }
34
+ }
35
+ else {
36
+ progress = { phase };
37
+ }
38
+ progress.phase = phase;
39
+ progress.lastUpdatedAt = new Date().toISOString();
40
+ await FileSystemUtils.writeFile(progressPath, JSON.stringify(progress, null, 2));
41
+ }
42
+ /**
43
+ * Get phase from progress.json
44
+ * Returns null if progress.json doesn't exist or phase field is missing
45
+ */
46
+ export async function getPhaseFromProgress(changeDir) {
47
+ const progressPath = path.join(changeDir, 'metrics', 'progress.json');
48
+ if (!await FileSystemUtils.fileExists(progressPath)) {
49
+ return null;
50
+ }
51
+ try {
52
+ const progress = JSON.parse(await FileSystemUtils.readFile(progressPath));
53
+ const phase = progress.phase;
54
+ // Validate phase value
55
+ if (PHASE_ORDER.includes(phase)) {
56
+ return phase;
57
+ }
58
+ return null;
59
+ }
60
+ catch {
61
+ return null;
62
+ }
63
+ }
64
+ /**
65
+ * Get current phase using comprehensive detection
66
+ * Priority: progress.json phase > marker files > directory existence
67
+ */
68
+ export async function getCurrentPhase(changeDir) {
69
+ // 1. Priority: progress.json phase field
70
+ const progressPhase = await getPhaseFromProgress(changeDir);
71
+ if (progressPhase) {
72
+ return progressPhase;
73
+ }
74
+ // 2. Fallback: marker files
75
+ for (const [phase, marker] of Object.entries(PHASE_MARKERS)) {
76
+ if (marker) {
77
+ const markerPath = path.join(changeDir, marker);
78
+ if (await FileSystemUtils.fileExists(markerPath)) {
79
+ return phase;
80
+ }
81
+ }
82
+ }
83
+ // 3. Fallback: check for proposal.md (propose phase)
84
+ const proposalPath = path.join(changeDir, 'proposal.md');
85
+ if (await FileSystemUtils.fileExists(proposalPath)) {
86
+ return 'propose';
87
+ }
88
+ // 4. Check for design.md without .tech-design (could be techDesign or propose)
89
+ const designPath = path.join(changeDir, 'design.md');
90
+ if (await FileSystemUtils.fileExists(designPath)) {
91
+ // If design.md exists but no proposal.md, likely techDesign
92
+ return 'techDesign';
93
+ }
94
+ // 5. Default: idle (directory exists but no meaningful files)
95
+ return 'idle';
96
+ }
97
+ /**
98
+ * Check if a directory is a techDesign change (can be reused by proposal)
99
+ */
100
+ export async function isTechDesignChange(changeDir) {
101
+ const techDesignMarker = path.join(changeDir, '.tech-design');
102
+ if (await FileSystemUtils.fileExists(techDesignMarker)) {
103
+ return true;
104
+ }
105
+ const phase = await getPhaseFromProgress(changeDir);
106
+ return phase === 'techDesign';
107
+ }
108
+ /**
109
+ * Clear techDesign markers when transitioning to propose
110
+ */
111
+ export async function clearTechDesignMarkers(changeDir) {
112
+ const techDesignMarker = path.join(changeDir, '.tech-design');
113
+ if (await FileSystemUtils.fileExists(techDesignMarker)) {
114
+ await FileSystemUtils.deleteFile(techDesignMarker);
115
+ }
116
+ }
117
+ //# sourceMappingURL=phase-utils.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhuan-ai/zhuanspec",
3
- "version": "2.2.4",
3
+ "version": "2.4.8",
4
4
  "description": "AI-native system for spec-driven development",
5
5
  "keywords": [
6
6
  "zhuanspec",
@@ -27,7 +27,8 @@
27
27
  }
28
28
  },
29
29
  "bin": {
30
- "zhuanspec": "./bin/zhuanspec.js"
30
+ "zhuanspec": "./bin/zhuanspec.js",
31
+ "zhuanspec-hook": "./bin/zhuanspec-hook.js"
31
32
  },
32
33
  "files": [
33
34
  "dist",
@@ -38,26 +39,6 @@
38
39
  "!dist/**/__tests__",
39
40
  "!dist/**/*.map"
40
41
  ],
41
- "scripts": {
42
- "lint": "eslint src/",
43
- "build": "node build.js",
44
- "dev": "tsc --watch",
45
- "dev:cli": "pnpm build && node bin/zhuanspec.js",
46
- "test": "vitest run",
47
- "test:watch": "vitest",
48
- "test:ui": "vitest --ui",
49
- "test:coverage": "vitest --coverage",
50
- "test:postinstall": "node scripts/postinstall.js",
51
- "prepare": "npm run build",
52
- "prepublishOnly": "npm run build",
53
- "postinstall": "node scripts/postinstall.js",
54
- "check:pack-version": "node scripts/pack-version-check.mjs",
55
- "diagnose:cursor": "node scripts/diagnose-cursor-commands.js",
56
- "release": "pnpm run release:ci",
57
- "release:ci": "pnpm run check:pack-version && pnpm exec changeset publish",
58
- "release:local": "pnpm exec changeset version && pnpm run check:pack-version && pnpm exec changeset publish",
59
- "changeset": "changeset"
60
- },
61
42
  "engines": {
62
43
  "node": ">=20.19.0"
63
44
  },
@@ -79,5 +60,23 @@
79
60
  "ora": "^8.2.0",
80
61
  "yaml": "^2.8.2",
81
62
  "zod": "^4.0.17"
63
+ },
64
+ "scripts": {
65
+ "lint": "eslint src/",
66
+ "build": "node build.js",
67
+ "dev": "tsc --watch",
68
+ "dev:cli": "pnpm build && node bin/zhuanspec.js",
69
+ "test": "vitest run",
70
+ "test:watch": "vitest",
71
+ "test:ui": "vitest --ui",
72
+ "test:coverage": "vitest --coverage",
73
+ "test:postinstall": "node scripts/postinstall.js",
74
+ "postinstall": "node scripts/postinstall.js",
75
+ "check:pack-version": "node scripts/pack-version-check.mjs",
76
+ "diagnose:cursor": "node scripts/diagnose-cursor-commands.js",
77
+ "release": "pnpm run release:ci",
78
+ "release:ci": "pnpm run check:pack-version && pnpm exec changeset publish",
79
+ "release:local": "pnpm exec changeset version && pnpm run check:pack-version && pnpm exec changeset publish",
80
+ "changeset": "changeset"
82
81
  }
83
- }
82
+ }
@@ -1,10 +1,35 @@
1
1
  name: spec-driven
2
2
  version: 1
3
- description: 默认 OpenSpec 工作流 - proposal → specs → design → tasks
3
+ description: 默认 zhuanspec 工作流 - techDesign(design) → proposal → specs → tasks
4
4
  artifacts:
5
+ - id: design
6
+ generates: design.md
7
+ description: 包含实现细节的技术设计文档(提案前置)
8
+ template: design.md
9
+ instruction: |
10
+ 创建解释如何实现变更的设计文档。
11
+
12
+ 何时包含 design.md(仅在以下任何情况适用时创建):
13
+ - 横切变更(多个服务/模块)或新的架构模式
14
+ - 新的外部依赖或重要的数据模型更改
15
+ - 安全性、性能或迁移复杂性
16
+ - 在编码之前从技术决策中受益的模糊性
17
+
18
+ 章节:
19
+ - **背景**:背景、当前状态、约束、利益相关者
20
+ - **目标 / 非目标**:此设计实现的内容和明确排除的内容
21
+ - **决策**:关键的技术选择及其理由(为什么选择 X 而不是 Y?)。包括为每个决策考虑的替代方案。
22
+ - **风险 / 权衡**:已知的限制,可能出错的事情。格式:[风险] → 缓解措施
23
+ - **迁移计划**:部署步骤、回滚策略(如果适用)
24
+ - **待解决问题**:待解决的决定或未知数
25
+
26
+ 专注于架构和方法,而不是逐行实现。
27
+ 好的设计文档解释了技术决策背后的"原因"。
28
+ requires: []
29
+
5
30
  - id: proposal
6
31
  generates: proposal.md
7
- description: 概述变更的初始提案文档
32
+ description: 概述变更的初始提案文档(必须引用 design.md)
8
33
  template: proposal.md
9
34
  instruction: |
10
35
  **强制澄清检查点(必须首先执行)**:
@@ -41,6 +66,22 @@ artifacts:
41
66
 
42
67
  只有在所有必要的模糊点都明确后,才能继续创建 proposal.md。
43
68
 
69
+ **自动验证与修复流程**:
70
+ 创建提案后,必须执行自动验证:
71
+ 1. 运行 `zhuanspec validate <id> --strict --auto-fix`
72
+ 2. 如果验证失败,CLI 会自动分析错误并尝试修复(最多 3 次循环)
73
+ 3. 验证通过后,输出提案摘要
74
+ 4. 使用 AskUserQuestion 工具弹出选项式交互确认:
75
+ - 批准,进入实施阶段 → 创建 `.approved` 文件
76
+ - 需要修改提案内容 → 返回修改提案
77
+ - 暂不批准,稍后处理 → 保持提案状态
78
+ - 其他 → 等待用户补充说明
79
+
80
+ **三铁律约束**:
81
+ - **No Spec, No Code**:未批准前禁止任何代码修改
82
+ - **Spec is Truth**:归档时强制校验 Spec-Code 一致性
83
+ - **Reverse Sync**:Apply 阶段偏离时必须先更新提案
84
+
44
85
  创建建立此变更原因的提案文档。
45
86
 
46
87
  章节:
@@ -65,7 +106,8 @@ artifacts:
65
106
  实现细节属于 design.md。
66
107
 
67
108
  这是基础 - 规范、设计和任务都建立在此基础上。
68
- requires: []
109
+ requires:
110
+ - design
69
111
 
70
112
  - id: specs
71
113
  generates: "specs/**/*.md"
@@ -120,34 +162,6 @@ artifacts:
120
162
  requires:
121
163
  - proposal
122
164
 
123
- - id: design
124
- generates: design.md
125
- description: 包含实现细节的技术设计文档
126
- template: design.md
127
- instruction: |
128
- 创建解释如何实现变更的设计文档。
129
-
130
- 何时包含 design.md(仅在以下任何情况适用时创建):
131
- - 横切变更(多个服务/模块)或新的架构模式
132
- - 新的外部依赖或重要的数据模型更改
133
- - 安全性、性能或迁移复杂性
134
- - 在编码之前从技术决策中受益的模糊性
135
-
136
- 章节:
137
- - **背景**:背景、当前状态、约束、利益相关者
138
- - **目标 / 非目标**:此设计实现的内容和明确排除的内容
139
- - **决策**:关键的技术选择及其理由(为什么选择 X 而不是 Y?)。包括为每个决策考虑的替代方案。
140
- - **风险 / 权衡**:已知的限制,可能出错的事情。格式:[风险] → 缓解措施
141
- - **迁移计划**:部署步骤、回滚策略(如果适用)
142
- - **待解决问题**:待解决的决定或未知数
143
-
144
- 专注于架构和方法,而不是逐行实现。
145
- 参考提案了解动机,参考规范了解要求。
146
-
147
- 好的设计文档解释了技术决策背后的"原因"。
148
- requires:
149
- - proposal
150
-
151
165
  - id: tasks
152
166
  generates: tasks.md
153
167
  description: 从规范和设计派生的实施任务
@@ -1,8 +1,145 @@
1
+ ## Impact Assessment
2
+
3
+ ### 影响范围
4
+ - **模块**: <!-- example: order-service -->
5
+ - **数据库**: <!-- example: order_table (add column xxx) -->
6
+ - **API**: <!-- example: /api/v1/orders -->
7
+ - **消息**: <!-- example: OrderCreatedEvent -->
8
+
9
+ ### 风险等级
10
+ - **等级**: <!-- HIGH | MEDIUM | LOW -->
11
+ - **理由**: <!-- why this risk level -->
12
+
13
+ ### Breaking Change
14
+ - **是否破坏性变更**: <!-- 是 | 否 -->
15
+
16
+ ## Estimated Changes
17
+
18
+ ### 文件列表
19
+ | 文件路径 | 变更类型 | 关联要求 | 预估行数 |
20
+ |---------|---------|---------|---------|
21
+ | `<!-- path -->` | <!-- 新增/修改/删除 --> | <!-- Requirement name --> | <!-- estimated lines --> |
22
+
23
+ ### 核心类/方法
24
+ - `<!-- Class.method -->` - <!-- what changes -->
25
+
26
+ ### 测试影响
27
+ - **新增测试类**: <!-- list new test classes needed -->
28
+ - **修改测试类**: <!-- list existing tests to modify -->
29
+
30
+ ## Validation Checklist
31
+
32
+ - [ ] 功能验证清单已覆盖主要场景
33
+ - [ ] 兼容性验证清单已完成
34
+ - [ ] 回归测试清单已完成
35
+ - [ ] 数据迁移方案已设计(如涉及数据库变更)
36
+ - [ ] API 兼容性已评估(如涉及 API 变更)
37
+
1
38
  ## ADDED Requirements
2
39
 
3
- ### 需求:<!-- 要求名称 -->
4
- <!-- 要求文本 -->
40
+ ### Requirement: <!-- Requirement name -->
41
+
42
+ <!-- Requirement text MUST contain SHALL or MUST keyword -->
43
+ <!-- Use SHALL for normative requirements, MUST for mandatory constraints -->
44
+
45
+ **Location**: `<!-- file path, e.g. src/service/order.ts -->`
46
+
47
+ 系统 SHALL <!-- requirement description - what the system must do -->
48
+
49
+ #### Scenario: <!-- Scenario name - describe the success case -->
50
+
51
+ <!-- Scenario format: WHEN condition THEN expected result -->
52
+ <!-- Use WHEN/THEN/AND for consistency across all specs -->
53
+
54
+ **Location**: `<!-- specific method/class, e.g. OrderService.createOrder() -->`
55
+
56
+ - **WHEN** <!-- condition: what triggers this scenario -->
57
+ - **THEN** <!-- expected result: what should happen -->
58
+ - **AND** <!-- optional additional result or constraint -->
59
+
60
+ #### Scenario: <!-- Error/edge case scenario name -->
61
+
62
+ **Location**: `<!-- specific method/class for error handling -->`
63
+
64
+ - **WHEN** <!-- condition including error/edge case -->
65
+ - **THEN** <!-- expected error handling or fallback behavior -->
66
+
67
+ <!--
68
+ Requirements writing guidelines:
69
+
70
+ 1. Use SHALL/MUST keywords:
71
+ - SHALL: normative, standard behavior expectations
72
+ - MUST: mandatory, non-negotiable constraints
73
+
74
+ 2. Each requirement MUST have at least one scenario
75
+ - Success scenario: normal operation path
76
+ - Error scenario: failure handling (optional but recommended)
77
+
78
+ 3. Scenario naming:
79
+ - Use descriptive names that identify the specific test case
80
+ - Examples: "成功导出数据", "无效参数返回错误", "并发请求处理"
81
+
82
+ 4. Scenario format:
83
+ - MUST use exactly 4 hashes (####) for scenario headers
84
+ - Use WHEN/THEN/AND keywords for clarity
85
+ - Each scenario is a potential test case
86
+
87
+ 5. Cross-references:
88
+ - Reference related requirements: "See also: Requirement: 数据验证"
89
+ - Reference related specs: "Spec: user-auth"
90
+ -->
91
+
92
+ <!--
93
+ MODIFIED Requirements template (when changing existing behavior):
94
+
95
+ ## MODIFIED Requirements
96
+
97
+ ### Requirement: <!-- existing requirement name - must match original exactly -->
98
+
99
+ **Location**: `<!-- file path - where the modification happens -->`
100
+
101
+ <!-- Copy original requirement text and modify it -->
102
+ <!-- MUST include full updated content, not just the change -->
103
+
104
+ 系统 SHALL <!-- updated requirement description -->
105
+
106
+ #### Scenario: <!-- existing scenario name or new scenario -->
107
+
108
+ **Location**: `<!-- specific method/class being modified -->`
109
+
110
+ - **WHEN** <!-- updated condition -->
111
+ - **THEN** <!-- updated expected result -->
112
+
113
+ <!--
114
+ Important: For MODIFIED requirements:
115
+ 1. Copy the entire requirement block from zhuanspec/specs/<capability>/spec.md
116
+ 2. Edit it to reflect the new behavior
117
+ 3. Ensure title matches exactly (ignore whitespace)
118
+ 4. Keep all scenarios, even if unchanged
119
+ 5. Partial MODIFIED entries will lose detail on archive
120
+ -->
121
+ -->
122
+
123
+ <!--
124
+ REMOVED Requirements template:
125
+
126
+ ## REMOVED Requirements
127
+
128
+ ### Requirement: <!-- requirement name being removed -->
129
+
130
+ **Location**: `<!-- file path where code was removed -->`
131
+
132
+ **Reason**: <!-- why this requirement is being removed -->
133
+ **Migration**: <!-- how to handle existing usage/code -->
134
+ -->
5
135
 
6
- #### 场景:<!-- 场景名称 -->
7
- - **当** <!-- 条件 -->
8
- - **则** <!-- 预期结果 -->
136
+ <!--
137
+ RENAMED Requirements template (only for name changes):
138
+
139
+ ## RENAMED Requirements
140
+
141
+ - FROM: `### Requirement: OldName`
142
+ - TO: `### Requirement: NewName`
143
+
144
+ <!-- If behavior also changes, use RENAMED (name) + MODIFIED (content) -->
145
+ -->
@@ -1,4 +1,31 @@
1
- ## 1. <!-- 任务组名称 -->
1
+ ## Pre-Clarification Log
2
+
3
+ <!-- ⚠️ CHECKPOINT [PRE-CLARIFICATION]: This section MUST be completed before writing proposal -->
4
+ <!-- Record clarification Q&A or write "Status: COMPLETED - No clarification needed" -->
5
+ <!-- This section MUST NOT be empty, contain only HTML comments, or have TODO/TBD/PENDING markers -->
6
+
7
+ Status: COMPLETED - No clarification needed
8
+
9
+ Reason: All scope, technical choices, priorities, and dependencies are clear from existing specs and project conventions.
10
+
11
+ <!-- If clarification was needed, record Q&A like this:
12
+ Question 1: 数据获取来源?
13
+ Answer: 从 OrderService 获取
14
+
15
+ Question 2: 是否需要分页?
16
+ Answer: 是,每页20条
17
+ -->
18
+
19
+ ## Skill Mapping
20
+
21
+ <!-- ⚠️ CHECKPOINT [SKILL-TAGGING]: Run `zhuanspec skills list` first and record discovered skills -->
22
+ <!-- Every task MUST have either @skill:real-skill-name or @skill:none -->
23
+ <!-- If @skill:none, MUST provide justification -->
24
+ <!-- @skill names MUST match exactly the names returned by `zhuanspec skills list` -->
25
+
26
+ | 实现区域 | 实际功能 | 关联 Skill | 匹配理由 |
27
+ |---------|---------|-----------|---------|
28
+ | <!-- example: DAO层 --> | <!-- example: 数据库表结构 --> | <!-- example: java-db-schema-standards --> | <!-- example: 需要创建新表,符合数据库规范 --> |
2
29
 
3
30
  <!--
4
31
  @skill 标注指南:
@@ -22,16 +49,53 @@
22
49
  - 独立任务:无数据或逻辑依赖的任务不要添加 @depends,以最大化并行度
23
50
 
24
51
  示例:
25
- - [ ] 1.1 新增 AssBusinessDataEnum 枚举值 ASSEMBLY_MACHINE_FLAG @skill:kf-backend-coding-standards
26
- - [ ] 1.2 创建数据库表 ass_order @skill:java-db-schema-standards
52
+ - [ ] 1.1 新增枚举值 @skill:kf-backend-coding-standards
53
+ - [ ] 1.2 创建数据库表 @skill:java-db-schema-standards
27
54
  - [ ] 1.3 编写 DAO 层代码 @skill:java-dao-standards @depends:1.2
28
- - [ ] 1.4 定义 SCF 接口 IAssQueryService @skill:java-scf-rpc-usage-skill @depends:1.3
29
55
  -->
30
56
 
31
- - [ ] 1.1 <!-- 任务描述 --> <!-- @skill:real-skill-name -->
32
- - [ ] 1.2 <!-- 任务描述 --> <!-- @skill:real-skill-name @depends:1.1 -->
57
+ ### Wave 1
58
+
59
+ <!-- Wave 1: Tasks with no dependencies -->
60
+
61
+ - [ ] 1.1 <!-- Task description --> @skill:none <!-- 纯配置变更或手动操作 -->
62
+
63
+ ### Wave 2
64
+
65
+ <!-- Wave 2: Tasks depending on Wave 1 -->
66
+
67
+ - [ ] 2.1 <!-- Task description --> @depends:1.1 @skill:none <!-- 无需特定 skill,通用实现 -->
68
+
69
+ ### Wave 3
70
+
71
+ <!-- Wave 3: Tasks depending on Wave 2 -->
72
+
73
+ - [ ] 3.1 <!-- Task description --> @depends:2.1 @skill:none <!-- 无需特定 skill,通用实现 -->
74
+
75
+ ## Dependency Analysis
76
+
77
+ <!-- ⚠️ CHECKPOINT [TASK-ORDERING]: Status must be COMPLETED after wave analysis -->
78
+ <!-- No task may appear before a task it depends on -->
79
+ <!-- validate --strict will verify task ordering matches computed waves -->
80
+
81
+ Status: COMPLETED
82
+
83
+ Wave assignment logic:
84
+ - Wave 1: No @depends annotations → no dependencies
85
+ - Wave 2: @depends:1.x → depends on Wave 1
86
+ - Wave 3: @depends:2.x → depends on Wave 2
87
+
88
+ ## Quality Gates
89
+
90
+ - [ ] Apply 全部任务完成后自动执行一次 `zhuanspec review <change-id>`(如失败则手动补执行)
91
+
92
+ ## Workflow Diagram
33
93
 
34
- ## 2. <!-- 任务组名称 -->
94
+ <!-- Auto-generated by zhuanspec validate --strict -->
95
+ <!-- DO NOT EDIT - this section will be regenerated on each validation -->
35
96
 
36
- - [ ] 2.1 <!-- 任务描述 -->
37
- - [ ] 2.2 <!-- 任务描述 --> <!-- @depends:1.2,2.1 -->
97
+ ```mermaid
98
+ flowchart TD
99
+ W1[Wave 1] --> W2[Wave 2]
100
+ W2 --> W3[Wave 3]
101
+ ```