@zhuan-ai/zhuanspec 2.0.0 → 2.1.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/README.zh.md +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/commands/artifact-workflow.js +22 -2
- package/dist/commands/validate.d.ts +5 -0
- package/dist/commands/validate.js +65 -3
- package/dist/core/skill-discovery.d.ts +2 -2
- package/dist/core/skill-discovery.js +16 -3
- package/dist/core/task-graph/index.d.ts +2 -0
- package/dist/core/task-graph/index.js +2 -0
- package/dist/core/task-graph/mermaid-renderer.d.ts +22 -0
- package/dist/core/task-graph/mermaid-renderer.js +128 -0
- package/dist/core/templates/agents-template.d.ts +1 -1
- package/dist/core/templates/agents-template.js +23 -0
- package/dist/core/templates/skill-templates.js +42 -0
- package/dist/core/templates/slash-command-templates.js +25 -2
- package/dist/core/templates/tasks-template.d.ts +23 -0
- package/dist/core/templates/tasks-template.js +79 -0
- package/dist/core/templates/tdd-tasks-template.d.ts +24 -0
- package/dist/core/templates/tdd-tasks-template.js +116 -0
- package/dist/core/validation/strict-rules.d.ts +60 -0
- package/dist/core/validation/strict-rules.js +287 -0
- package/dist/core/validation/types.d.ts +10 -0
- package/dist/core/validation/validator.d.ts +5 -0
- package/dist/core/validation/validator.js +103 -1
- package/package.json +22 -20
|
@@ -43,6 +43,14 @@ export const agentsTemplate = `# ZhuanSpec 使用说明
|
|
|
43
43
|
**工作流**
|
|
44
44
|
0. 审查 \`zhuanspec/project.md\`、\`zhuanspec list\` 和 \`zhuanspec list --specs\` 以了解当前上下文。
|
|
45
45
|
1. **强制澄清检查(必须首先执行)**:分析用户请求,识别所有不确定或模糊的方面(范围、技术选择、实现细节、数据获取来源、服务分层、依赖关系、优先级、验收标准等......)。如果发现任何模糊之处,必须停止并使用**选项式交互**(如 \`AskQuestion\` 工具)提问,获得明确答复后才能继续。严禁在不确定的情况下自行推测或创建提案,严禁要求用户手动输入大段文字。
|
|
46
|
+
|
|
47
|
+
⚠️ **CHECKPOINT [PRE-CLARIFICATION]**:
|
|
48
|
+
You MUST record the pre-clarification result in tasks.md under "## Pre-Clarification Log":
|
|
49
|
+
- If questions were asked: Record each question and the user's answer
|
|
50
|
+
- If no clarification needed: Write "Status: COMPLETED - No clarification needed" with brief justification
|
|
51
|
+
- This section MUST NOT be empty or contain only HTML comments
|
|
52
|
+
- NEVER proceed to proposal writing without completing this checkpoint
|
|
53
|
+
|
|
46
54
|
2. 选择一个唯一的动词开头的 \`change-id\`,并在 \`zhuanspec/changes/<id>/\` 下搭建 \`proposal.md\`、\`tasks.md\`、可选的 \`design.md\` 和规范增量。
|
|
47
55
|
3. 使用 \`## ADDED|MODIFIED|REMOVED Requirements\` 起草规范增量,每个要求至少包含一个 \`#### Scenario:\`。
|
|
48
56
|
4. 运行 \`zhuanspec validate <id> --strict\` 并在分享提案之前解决所有问题。
|
|
@@ -452,6 +460,21 @@ The system SHALL provide...
|
|
|
452
460
|
> - 使用真实 skill 名称标注,支持多个 skill(\`@skill:name1,name2\`)
|
|
453
461
|
> - Apply 阶段 AI 根据标签直接调用对应 skill。无可用 skill 时可省略。
|
|
454
462
|
|
|
463
|
+
⚠️ **CHECKPOINT [SKILL-TAGGING]**:
|
|
464
|
+
1. You MUST run \`zhuanspec skills list\` first and record discovered skills in the Skill Mapping table
|
|
465
|
+
2. Every task MUST have either @skill:real-skill-name or @skill:none
|
|
466
|
+
3. If @skill:none, you MUST provide a justification (e.g., "pure config change, no skill applies")
|
|
467
|
+
4. @skill names MUST match exactly the names returned by \`zhuanspec skills list\` — do NOT invent skill names
|
|
468
|
+
5. The Skill Mapping table in tasks.md MUST NOT be empty
|
|
469
|
+
6. validate --strict will verify all @skill names exist in the known skill list
|
|
470
|
+
|
|
471
|
+
⚠️ **CHECKPOINT [TASK-ORDERING]**:
|
|
472
|
+
1. Tasks in tasks.md MUST be organized under Wave headers (### Wave 1, ### Wave 2, etc.)
|
|
473
|
+
2. Wave assignment must be computed from @depends relationships (Wave 1 = no deps, Wave N = depends on Wave N-1)
|
|
474
|
+
3. No task may appear before a task it depends on
|
|
475
|
+
4. You MUST add a "## Dependency Analysis" section at the end with "Status: COMPLETED"
|
|
476
|
+
5. validate --strict will verify task ordering matches computed waves
|
|
477
|
+
|
|
455
478
|
5. **在需要时创建 design.md:**
|
|
456
479
|
如果以下任何情况适用,则创建 \`design.md\`;否则省略:
|
|
457
480
|
- 横切变更(多个服务/模块)或新的架构模式
|
|
@@ -738,6 +738,13 @@ export function getProposeChangeSkillTemplate() {
|
|
|
738
738
|
|
|
739
739
|
d. 只有所有模糊点都明确后,才继续后续步骤。
|
|
740
740
|
|
|
741
|
+
⚠️ **CHECKPOINT [PRE-CLARIFICATION]**:
|
|
742
|
+
You MUST record the pre-clarification result in tasks.md under "## Pre-Clarification Log":
|
|
743
|
+
- If questions were asked: Record each question and the user's answer
|
|
744
|
+
- If no clarification needed: Write "Status: COMPLETED - No clarification needed" with brief justification
|
|
745
|
+
- This section MUST NOT be empty or contain only HTML comments
|
|
746
|
+
- NEVER proceed to proposal writing without completing this checkpoint
|
|
747
|
+
|
|
741
748
|
2. **Derive change name**
|
|
742
749
|
|
|
743
750
|
From the user's description, derive a kebab-case name (e.g., "add user authentication" → \`add-user-auth\`).
|
|
@@ -762,6 +769,14 @@ export function getProposeChangeSkillTemplate() {
|
|
|
762
769
|
- Read any completed dependency files for context
|
|
763
770
|
- **For proposal artifact**: When filling Skill Mapping section, analyze each skill's description and match based on actual functionality (not just module names). Simple changes like enum modifications should map to general coding standards, not architecture-level skills.
|
|
764
771
|
- **For tasks artifact only**: Before creating tasks.md, run \`zhuanspec skills list --json\` to discover available skills with their descriptions. For each task, read skill descriptions carefully and annotate with \`@skill:<real-skill-name>\` tags only when there's a clear semantic match between the task's functionality and the skill's purpose. Supports multiple: \`@skill:name1,name2\`.
|
|
772
|
+
|
|
773
|
+
⚠️ **CHECKPOINT [SKILL-TAGGING]**:
|
|
774
|
+
1. You MUST run \`zhuanspec skills list\` first and record discovered skills in the Skill Mapping table
|
|
775
|
+
2. Every task MUST have either @skill:real-skill-name or @skill:none
|
|
776
|
+
3. If @skill:none, you MUST provide a justification (e.g., "pure config change, no skill applies")
|
|
777
|
+
4. @skill names MUST match exactly the names returned by \`zhuanspec skills list\` — do NOT invent skill names
|
|
778
|
+
5. The Skill Mapping table in tasks.md MUST NOT be empty
|
|
779
|
+
6. validate --strict will verify all @skill names exist in the known skill list
|
|
765
780
|
- Create the artifact following the schema's instruction
|
|
766
781
|
- Show brief progress: "✓ Created <artifact-id>"
|
|
767
782
|
|
|
@@ -771,6 +786,13 @@ export function getProposeChangeSkillTemplate() {
|
|
|
771
786
|
- **design.md**: Only if needed (cross-cutting changes, new dependencies, security/performance)
|
|
772
787
|
- **tasks.md**: Break into small, verifiable tasks with checkboxes. Annotate with @skill tags based on semantic matching of skill descriptions to task functionality.
|
|
773
788
|
|
|
789
|
+
⚠️ **CHECKPOINT [TASK-ORDERING]**:
|
|
790
|
+
1. Tasks in tasks.md MUST be organized under Wave headers (### Wave 1, ### Wave 2, etc.)
|
|
791
|
+
2. Wave assignment must be computed from @depends relationships (Wave 1 = no deps, Wave N = depends on Wave N-1)
|
|
792
|
+
3. No task may appear before a task it depends on
|
|
793
|
+
4. You MUST add a "## Dependency Analysis" section at the end with "Status: COMPLETED"
|
|
794
|
+
5. validate --strict will verify task ordering matches computed waves
|
|
795
|
+
|
|
774
796
|
5. **Validate the change**
|
|
775
797
|
\`\`\`bash
|
|
776
798
|
zhuanspec validate <name> --strict
|
|
@@ -1019,6 +1041,13 @@ export function getOpsxProposeCommandTemplate() {
|
|
|
1019
1041
|
- If any unclear aspects found, use **AskUserQuestion tool** with preset options to clarify
|
|
1020
1042
|
- Do NOT proceed until all ambiguities are resolved
|
|
1021
1043
|
|
|
1044
|
+
⚠️ **CHECKPOINT [PRE-CLARIFICATION]**:
|
|
1045
|
+
You MUST record the pre-clarification result in tasks.md under "## Pre-Clarification Log":
|
|
1046
|
+
- If questions were asked: Record each question and the user's answer
|
|
1047
|
+
- If no clarification needed: Write "Status: COMPLETED - No clarification needed" with brief justification
|
|
1048
|
+
- This section MUST NOT be empty or contain only HTML comments
|
|
1049
|
+
- NEVER proceed to proposal writing without completing this checkpoint
|
|
1050
|
+
|
|
1022
1051
|
2. **Derive change name** from input (kebab-case, verb-first, unique)
|
|
1023
1052
|
|
|
1024
1053
|
3. **Create change**: \`zhuanspec new change "<name>"\`
|
|
@@ -1028,6 +1057,19 @@ export function getOpsxProposeCommandTemplate() {
|
|
|
1028
1057
|
- Read dependencies, create artifact, show progress
|
|
1029
1058
|
- Artifacts: proposal.md → specs/ → design.md (if needed) → tasks.md
|
|
1030
1059
|
|
|
1060
|
+
⚠️ **CHECKPOINT [SKILL-TAGGING]**:
|
|
1061
|
+
1. You MUST run \`zhuanspec skills list\` first and record discovered skills in the Skill Mapping table
|
|
1062
|
+
2. Every task MUST have either @skill:real-skill-name or @skill:none
|
|
1063
|
+
3. If @skill:none, you MUST provide a justification (e.g., "pure config change, no skill applies")
|
|
1064
|
+
4. @skill names MUST match exactly the names returned by \`zhuanspec skills list\` — do NOT invent skill names
|
|
1065
|
+
5. The Skill Mapping table in tasks.md MUST NOT be empty
|
|
1066
|
+
|
|
1067
|
+
⚠️ **CHECKPOINT [TASK-ORDERING]**:
|
|
1068
|
+
1. Tasks in tasks.md MUST be organized under Wave headers (### Wave 1, ### Wave 2, etc.)
|
|
1069
|
+
2. Wave assignment must be computed from @depends relationships (Wave 1 = no deps, Wave N = depends on Wave N-1)
|
|
1070
|
+
3. No task may appear before a task it depends on
|
|
1071
|
+
4. You MUST add a "## Dependency Analysis" section at the end with "Status: COMPLETED"
|
|
1072
|
+
|
|
1031
1073
|
5. **Validate**: \`zhuanspec validate <name> --strict\`
|
|
1032
1074
|
|
|
1033
1075
|
6. **Present** the complete proposal for review
|
|
@@ -21,13 +21,20 @@ const proposalSteps = `**步骤**
|
|
|
21
21
|
* 其他不明确?(其他不明确的情况)
|
|
22
22
|
- 如果发现任何模糊之处,必须停止并使用**选项式交互**提问:
|
|
23
23
|
* 使用编辑器的结构化问答工具(如 \`AskQuestion\`),将每个问题转化为带 2-5 个预设选项的选择题
|
|
24
|
-
*
|
|
24
|
+
* 每个问题末尾包含“其他”选项作为兖底
|
|
25
25
|
* 尽量将多个问题合并到一次交互中一次性展示
|
|
26
26
|
* 必须等待用户选择答案,不能继续
|
|
27
27
|
* **严禁**要求用户手动输入大段文字来回答
|
|
28
|
-
-
|
|
28
|
+
- 如果用户选择“其他”,再针对该问题追问(仍优先使用选项式)
|
|
29
29
|
- **严禁**在不确定的情况下自行推测、假设或创建提案文件
|
|
30
30
|
- 只有在所有模糊点都明确后,才能继续后续步骤
|
|
31
|
+
|
|
32
|
+
⚠️ **CHECKPOINT [PRE-CLARIFICATION]**:
|
|
33
|
+
You MUST record the pre-clarification result in tasks.md under "## Pre-Clarification Log":
|
|
34
|
+
- If questions were asked: Record each question and the user's answer
|
|
35
|
+
- If no clarification needed: Write "Status: COMPLETED - No clarification needed" with brief justification
|
|
36
|
+
- This section MUST NOT be empty or contain only HTML comments
|
|
37
|
+
- NEVER proceed to proposal writing without completing this checkpoint
|
|
31
38
|
2. 选择一个唯一的动词开头的 \`change-id\`,并在 \`zhuanspec/changes/<id>/\` 下搭建 \`proposal.md\`、\`tasks.md\` 和 \`design.md\`(需要时)。
|
|
32
39
|
3. 将变更映射为具体的功能或要求,将多范围的工作分解为具有明确关系和顺序的不同规范增量。
|
|
33
40
|
4. 当解决方案跨越多个系统、引入新模式或在提交规范之前需要权衡讨论时,在 \`design.md\` 中捕获架构推理。
|
|
@@ -43,6 +50,22 @@ const proposalSteps = `**步骤**
|
|
|
43
50
|
- 将 \`tasks.md\` 起草为有序的小型、可验证工作项列表
|
|
44
51
|
- 使用 \`@skill:<real-skill-name>\` 标注与 skill 匹配的任务(支持多个:\`@skill:name1,name2\`)
|
|
45
52
|
- 仅当 skill 明确匹配任务时才标注,没有匹配的 skill 可省略标签
|
|
53
|
+
|
|
54
|
+
⚠️ **CHECKPOINT [SKILL-TAGGING]**:
|
|
55
|
+
1. You MUST run \`zhuanspec skills list\` first and record discovered skills in the Skill Mapping table
|
|
56
|
+
2. Every task MUST have either @skill:real-skill-name or @skill:none
|
|
57
|
+
3. If @skill:none, you MUST provide a justification (e.g., "pure config change, no skill applies")
|
|
58
|
+
4. @skill names MUST match exactly the names returned by \`zhuanspec skills list\` — do NOT invent skill names
|
|
59
|
+
5. The Skill Mapping table in tasks.md MUST NOT be empty
|
|
60
|
+
6. validate --strict will verify all @skill names exist in the known skill list
|
|
61
|
+
|
|
62
|
+
⚠️ **CHECKPOINT [TASK-ORDERING]**:
|
|
63
|
+
1. Tasks in tasks.md MUST be organized under Wave headers (### Wave 1, ### Wave 2, etc.)
|
|
64
|
+
2. Wave assignment must be computed from @depends relationships (Wave 1 = no deps, Wave N = depends on Wave N-1)
|
|
65
|
+
3. No task may appear before a task it depends on
|
|
66
|
+
4. You MUST add a "## Dependency Analysis" section at the end with "Status: COMPLETED"
|
|
67
|
+
5. validate --strict will verify task ordering matches computed waves
|
|
68
|
+
|
|
46
69
|
7. 使用 \`zhuanspec validate <id> --strict\` 进行验证,并在分享提案之前解决所有问题。`;
|
|
47
70
|
const proposalReferences = `**参考**
|
|
48
71
|
- 当验证失败时,使用 \`zhuanspec show <id> --json --deltas-only\` 或 \`zhuanspec show <spec> --type spec\` 检查详细信息。
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tasks Template
|
|
3
|
+
*
|
|
4
|
+
* Template for generating tasks.md with required checkpoint sections.
|
|
5
|
+
*/
|
|
6
|
+
export interface TasksTemplateOptions {
|
|
7
|
+
changeId: string;
|
|
8
|
+
capabilities?: string[];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Get the tasks.md template structure with required checkpoint sections
|
|
12
|
+
*/
|
|
13
|
+
export declare function getTasksTemplate(options?: TasksTemplateOptions): string;
|
|
14
|
+
/**
|
|
15
|
+
* Get the minimal tasks.md template (for quick scaffolding)
|
|
16
|
+
*/
|
|
17
|
+
export declare function getMinimalTasksTemplate(): string;
|
|
18
|
+
declare const _default: {
|
|
19
|
+
getTasksTemplate: typeof getTasksTemplate;
|
|
20
|
+
getMinimalTasksTemplate: typeof getMinimalTasksTemplate;
|
|
21
|
+
};
|
|
22
|
+
export default _default;
|
|
23
|
+
//# sourceMappingURL=tasks-template.d.ts.map
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tasks Template
|
|
3
|
+
*
|
|
4
|
+
* Template for generating tasks.md with required checkpoint sections.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Get the tasks.md template structure with required checkpoint sections
|
|
8
|
+
*/
|
|
9
|
+
export function getTasksTemplate(options) {
|
|
10
|
+
const changeId = options?.changeId || '[change-id]';
|
|
11
|
+
return `# Tasks: ${changeId}
|
|
12
|
+
|
|
13
|
+
## Pre-Clarification Log
|
|
14
|
+
|
|
15
|
+
<!-- REQUIRED: Record clarification Q&A or write "Status: COMPLETED - No clarification needed" -->
|
|
16
|
+
<!-- This section MUST NOT be empty or contain only HTML comments -->
|
|
17
|
+
|
|
18
|
+
Status: PENDING
|
|
19
|
+
|
|
20
|
+
## Skill Mapping
|
|
21
|
+
|
|
22
|
+
| Skill Name | Actual Function | Match Reason |
|
|
23
|
+
|---|---|---|
|
|
24
|
+
|
|
25
|
+
<!-- REQUIRED: Run \`zhuanspec skills list\` and record skill matching decisions -->
|
|
26
|
+
<!-- Every task MUST have either @skill:real-skill-name or @skill:none -->
|
|
27
|
+
|
|
28
|
+
## Task List
|
|
29
|
+
|
|
30
|
+
### Wave 1 (No Dependencies)
|
|
31
|
+
|
|
32
|
+
<!-- Tasks organized by execution wave -->
|
|
33
|
+
<!-- Wave assignment computed from @depends relationships -->
|
|
34
|
+
|
|
35
|
+
- [ ] 1.1 [Task description] @skill:none <!-- justification: pure config change -->
|
|
36
|
+
|
|
37
|
+
### Wave 2 (Depends on Wave 1)
|
|
38
|
+
|
|
39
|
+
<!-- Tasks that depend on Wave 1 completion -->
|
|
40
|
+
|
|
41
|
+
- [ ] 2.1 [Task description] @depends:1.1 @skill:none
|
|
42
|
+
|
|
43
|
+
## Dependency Analysis
|
|
44
|
+
|
|
45
|
+
<!-- REQUIRED: Status must be COMPLETED after wave analysis -->
|
|
46
|
+
<!-- No task may appear before a task it depends on -->
|
|
47
|
+
|
|
48
|
+
Status: PENDING
|
|
49
|
+
`;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Get the minimal tasks.md template (for quick scaffolding)
|
|
53
|
+
*/
|
|
54
|
+
export function getMinimalTasksTemplate() {
|
|
55
|
+
return `## Pre-Clarification Log
|
|
56
|
+
|
|
57
|
+
Status: PENDING
|
|
58
|
+
|
|
59
|
+
## Skill Mapping
|
|
60
|
+
|
|
61
|
+
| Skill Name | Actual Function | Match Reason |
|
|
62
|
+
|---|---|---|
|
|
63
|
+
|
|
64
|
+
## Task List
|
|
65
|
+
|
|
66
|
+
### Wave 1 (No Dependencies)
|
|
67
|
+
|
|
68
|
+
- [ ] 1.1 [Task description] @skill:none
|
|
69
|
+
|
|
70
|
+
## Dependency Analysis
|
|
71
|
+
|
|
72
|
+
Status: PENDING
|
|
73
|
+
`;
|
|
74
|
+
}
|
|
75
|
+
export default {
|
|
76
|
+
getTasksTemplate,
|
|
77
|
+
getMinimalTasksTemplate
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=tasks-template.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TDD Tasks Template
|
|
3
|
+
*
|
|
4
|
+
* Template for generating tasks.md in TDD workflow with required checkpoint sections.
|
|
5
|
+
* This follows the TDD schema: spec → tests → implementation → docs
|
|
6
|
+
*/
|
|
7
|
+
export interface TddTasksTemplateOptions {
|
|
8
|
+
changeId: string;
|
|
9
|
+
testFramework?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Get the TDD tasks.md template structure with required checkpoint sections
|
|
13
|
+
*/
|
|
14
|
+
export declare function getTddTasksTemplate(options?: TddTasksTemplateOptions): string;
|
|
15
|
+
/**
|
|
16
|
+
* Get the minimal TDD tasks.md template (for quick scaffolding)
|
|
17
|
+
*/
|
|
18
|
+
export declare function getMinimalTddTasksTemplate(): string;
|
|
19
|
+
declare const _default: {
|
|
20
|
+
getTddTasksTemplate: typeof getTddTasksTemplate;
|
|
21
|
+
getMinimalTddTasksTemplate: typeof getMinimalTddTasksTemplate;
|
|
22
|
+
};
|
|
23
|
+
export default _default;
|
|
24
|
+
//# sourceMappingURL=tdd-tasks-template.d.ts.map
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TDD Tasks Template
|
|
3
|
+
*
|
|
4
|
+
* Template for generating tasks.md in TDD workflow with required checkpoint sections.
|
|
5
|
+
* This follows the TDD schema: spec → tests → implementation → docs
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Get the TDD tasks.md template structure with required checkpoint sections
|
|
9
|
+
*/
|
|
10
|
+
export function getTddTasksTemplate(options) {
|
|
11
|
+
const changeId = options?.changeId || '[change-id]';
|
|
12
|
+
const testFramework = options?.testFramework || 'jest';
|
|
13
|
+
return `# TDD Tasks: ${changeId}
|
|
14
|
+
|
|
15
|
+
## Pre-Clarification Log
|
|
16
|
+
|
|
17
|
+
<!-- REQUIRED: Record clarification Q&A or write "Status: COMPLETED - No clarification needed" -->
|
|
18
|
+
<!-- This section MUST NOT be empty or contain only HTML comments -->
|
|
19
|
+
|
|
20
|
+
Status: PENDING
|
|
21
|
+
|
|
22
|
+
## Skill Mapping
|
|
23
|
+
|
|
24
|
+
| Skill Name | Actual Function | Match Reason |
|
|
25
|
+
|---|---|---|
|
|
26
|
+
|
|
27
|
+
<!-- REQUIRED: Run \`zhuanspec skills list\` and record skill matching decisions -->
|
|
28
|
+
<!-- Every task MUST have either @skill:real-skill-name or @skill:none -->
|
|
29
|
+
|
|
30
|
+
## Task List
|
|
31
|
+
|
|
32
|
+
### Wave 1: Specification (No Dependencies)
|
|
33
|
+
|
|
34
|
+
<!-- Define what to build before writing any code -->
|
|
35
|
+
|
|
36
|
+
- [ ] 1.1 Write feature specification @skill:none <!-- spec definition -->
|
|
37
|
+
|
|
38
|
+
### Wave 2: Red Phase - Write Failing Tests
|
|
39
|
+
|
|
40
|
+
<!-- TDD Red: Write tests that define expected behavior -->
|
|
41
|
+
<!-- Tests should fail initially - this proves they test something meaningful -->
|
|
42
|
+
|
|
43
|
+
- [ ] 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
|
|
45
|
+
|
|
46
|
+
### Wave 3: Green Phase - Implementation
|
|
47
|
+
|
|
48
|
+
<!-- TDD Green: Write minimal code to make tests pass -->
|
|
49
|
+
|
|
50
|
+
- [ ] 3.1 Implement core logic @depends:2.1 @skill:none
|
|
51
|
+
- [ ] 3.2 Implement edge case handling @depends:3.1 @skill:none
|
|
52
|
+
|
|
53
|
+
### Wave 4: Refactor Phase
|
|
54
|
+
|
|
55
|
+
<!-- TDD Refactor: Clean up code while keeping tests green -->
|
|
56
|
+
|
|
57
|
+
- [ ] 4.1 Refactor for clarity @depends:3.2 @skill:none
|
|
58
|
+
- [ ] 4.2 Optimize performance @depends:4.1 @skill:none
|
|
59
|
+
|
|
60
|
+
### Wave 5: Documentation
|
|
61
|
+
|
|
62
|
+
<!-- Document the implemented feature -->
|
|
63
|
+
|
|
64
|
+
- [ ] 5.1 Update API documentation @depends:4.2 @skill:none
|
|
65
|
+
- [ ] 5.2 Add usage examples @depends:5.1 @skill:none
|
|
66
|
+
|
|
67
|
+
## Dependency Analysis
|
|
68
|
+
|
|
69
|
+
<!-- REQUIRED: Status must be COMPLETED after wave analysis -->
|
|
70
|
+
<!-- TDD waves follow strict order: spec → tests → impl → refactor → docs -->
|
|
71
|
+
<!-- No task may appear before a task it depends on -->
|
|
72
|
+
|
|
73
|
+
Status: PENDING
|
|
74
|
+
`;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Get the minimal TDD tasks.md template (for quick scaffolding)
|
|
78
|
+
*/
|
|
79
|
+
export function getMinimalTddTasksTemplate() {
|
|
80
|
+
return `## Pre-Clarification Log
|
|
81
|
+
|
|
82
|
+
Status: PENDING
|
|
83
|
+
|
|
84
|
+
## Skill Mapping
|
|
85
|
+
|
|
86
|
+
| Skill Name | Actual Function | Match Reason |
|
|
87
|
+
|---|---|---|
|
|
88
|
+
|
|
89
|
+
## Task List
|
|
90
|
+
|
|
91
|
+
### Wave 1: Specification
|
|
92
|
+
|
|
93
|
+
- [ ] 1.1 Write feature specification @skill:none
|
|
94
|
+
|
|
95
|
+
### Wave 2: Red Phase - Tests
|
|
96
|
+
|
|
97
|
+
- [ ] 2.1 Write failing tests @depends:1.1 @skill:none
|
|
98
|
+
|
|
99
|
+
### Wave 3: Green Phase - Implementation
|
|
100
|
+
|
|
101
|
+
- [ ] 3.1 Implement to pass tests @depends:2.1 @skill:none
|
|
102
|
+
|
|
103
|
+
### Wave 4: Documentation
|
|
104
|
+
|
|
105
|
+
- [ ] 4.1 Document the feature @depends:3.1 @skill:none
|
|
106
|
+
|
|
107
|
+
## Dependency Analysis
|
|
108
|
+
|
|
109
|
+
Status: PENDING
|
|
110
|
+
`;
|
|
111
|
+
}
|
|
112
|
+
export default {
|
|
113
|
+
getTddTasksTemplate,
|
|
114
|
+
getMinimalTddTasksTemplate
|
|
115
|
+
};
|
|
116
|
+
//# sourceMappingURL=tdd-tasks-template.js.map
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strict Validation Rules
|
|
3
|
+
*
|
|
4
|
+
* Implementation of three strict validation rules for `zhuanspec validate --strict`:
|
|
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
|
|
8
|
+
*/
|
|
9
|
+
import type { ParsedTask } from '../task-graph/types.js';
|
|
10
|
+
export interface StrictCheckResult {
|
|
11
|
+
ruleId: string;
|
|
12
|
+
ruleName: string;
|
|
13
|
+
passed: boolean;
|
|
14
|
+
errors: string[];
|
|
15
|
+
warnings: string[];
|
|
16
|
+
}
|
|
17
|
+
export interface StrictValidationResult {
|
|
18
|
+
checks: StrictCheckResult[];
|
|
19
|
+
allPassed: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Rule 1: pre-clarification-completed
|
|
23
|
+
*
|
|
24
|
+
* Checks that tasks.md has a valid "## Pre-Clarification Log" section.
|
|
25
|
+
* Valid content includes:
|
|
26
|
+
* - Actual Q&A record text
|
|
27
|
+
* - "No clarification needed"
|
|
28
|
+
* - "Status: COMPLETED"
|
|
29
|
+
* Invalid:
|
|
30
|
+
* - Section missing
|
|
31
|
+
* - Section empty (whitespace only)
|
|
32
|
+
* - Only HTML comments
|
|
33
|
+
* - Contains "TODO", "TBD", "PENDING", "?" unresolved markers
|
|
34
|
+
*/
|
|
35
|
+
export declare function checkPreClarification(tasksContent: string): StrictCheckResult;
|
|
36
|
+
/**
|
|
37
|
+
* Rule 2: skill-tags-valid
|
|
38
|
+
*
|
|
39
|
+
* Validates:
|
|
40
|
+
* a. Skill Mapping table exists with at least one data row
|
|
41
|
+
* b. Each task has @skill:xxx tag or @skill:none
|
|
42
|
+
* c. @skill:none tasks should have a reason in description
|
|
43
|
+
* d. All @skill:xxx names must exist in knownSkillNames
|
|
44
|
+
* e. Comma-separated multi-skills are validated individually
|
|
45
|
+
*/
|
|
46
|
+
export declare function checkSkillTagsValid(tasksContent: string, parsedTasks: ParsedTask[], knownSkillNames: string[]): StrictCheckResult;
|
|
47
|
+
/**
|
|
48
|
+
* Rule 3: task-ordering-by-wave
|
|
49
|
+
*
|
|
50
|
+
* Validates:
|
|
51
|
+
* - Tasks are ordered by wave (wave 1 tasks before wave 2, etc.)
|
|
52
|
+
* - Wave headers "### Wave N" match actual computed wave numbers
|
|
53
|
+
* - Tasks.md must have Wave headers
|
|
54
|
+
*/
|
|
55
|
+
export declare function checkTaskOrderingByWave(tasksContent: string, parsedTasks: ParsedTask[]): StrictCheckResult;
|
|
56
|
+
/**
|
|
57
|
+
* Main entry: Run all strict validation rules
|
|
58
|
+
*/
|
|
59
|
+
export declare function runStrictValidation(tasksContent: string, parsedTasks: ParsedTask[], knownSkillNames: string[]): Promise<StrictValidationResult>;
|
|
60
|
+
//# sourceMappingURL=strict-rules.d.ts.map
|