@zhuan-ai/zhuanspec 2.0.0 → 2.1.1
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 +60 -37
- 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 +1 -1
- package/schemas/spec-driven/schema.yaml +13 -13
- package/schemas/spec-driven/templates/design.md +6 -6
- package/schemas/spec-driven/templates/proposal.md +7 -7
- package/schemas/spec-driven/templates/spec.md +4 -4
- package/schemas/tdd/schema.yaml +107 -107
- package/schemas/tdd/templates/implementation.md +5 -5
- package/schemas/tdd/templates/spec.md +6 -6
- package/schemas/tdd/templates/test.md +7 -7
|
@@ -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
|
+
⚠️ **检查点 [强制澄清]**:
|
|
48
|
+
必须在 tasks.md 中记录澄清结果,添加 "## 澄清日志" 章节:
|
|
49
|
+
- 如果进行了提问:记录每个问题及用户的回答
|
|
50
|
+
- 如果无需澄清:写明"状态:已完成 - 无需澄清"并简要说明理由
|
|
51
|
+
- 此章节不能为空或仅包含 HTML 注释
|
|
52
|
+
- 未完成此检查点前禁止继续编写提案
|
|
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\` 并在分享提案之前解决所有问题。
|
|
@@ -400,14 +408,14 @@ zhuanspec/
|
|
|
400
408
|
\`\`\`markdown
|
|
401
409
|
# Change: [变更的简要描述]
|
|
402
410
|
|
|
403
|
-
##
|
|
411
|
+
## 变更原因
|
|
404
412
|
[关于问题/机会的 1-2 句话]
|
|
405
413
|
|
|
406
|
-
##
|
|
414
|
+
## 变更内容
|
|
407
415
|
- [变更的要点列表]
|
|
408
416
|
- [用 **BREAKING** 标记破坏性更改]
|
|
409
417
|
|
|
410
|
-
##
|
|
418
|
+
## 影响范围
|
|
411
419
|
- Affected specs: [列出功能]
|
|
412
420
|
- Affected code: [关键文件/系统]
|
|
413
421
|
\`\`\`
|
|
@@ -415,19 +423,19 @@ zhuanspec/
|
|
|
415
423
|
3. **创建规范增量:** \`specs/[capability]/spec.md\`
|
|
416
424
|
\`\`\`markdown
|
|
417
425
|
## ADDED Requirements
|
|
418
|
-
###
|
|
426
|
+
### 需求:New Feature
|
|
419
427
|
The system SHALL provide...
|
|
420
428
|
|
|
421
|
-
####
|
|
422
|
-
-
|
|
423
|
-
-
|
|
429
|
+
#### 场景:Success case
|
|
430
|
+
- **当** user performs action
|
|
431
|
+
- **则** expected result
|
|
424
432
|
|
|
425
433
|
## MODIFIED Requirements
|
|
426
|
-
###
|
|
434
|
+
### 需求:Existing Feature
|
|
427
435
|
[完整的修改后要求]
|
|
428
436
|
|
|
429
437
|
## REMOVED Requirements
|
|
430
|
-
###
|
|
438
|
+
### 需求:Old Feature
|
|
431
439
|
**Reason**: [移除原因]
|
|
432
440
|
**Migration**: [如何处理]
|
|
433
441
|
\`\`\`
|
|
@@ -438,11 +446,11 @@ The system SHALL provide...
|
|
|
438
446
|
先运行 \`zhuanspec skills list --json\` 发现当前环境中可用的 skill 及其 description,然后基于语义匹配在任务中标注真实 skill 名称:
|
|
439
447
|
|
|
440
448
|
\`\`\`markdown
|
|
441
|
-
## 1.
|
|
442
|
-
- [ ] 1.1
|
|
443
|
-
- [ ] 1.2
|
|
444
|
-
- [ ] 1.3
|
|
445
|
-
- [ ] 1.4
|
|
449
|
+
## 1. 实现
|
|
450
|
+
- [ ] 1.1 创建数据库表结构 @skill:java-db-schema-standards
|
|
451
|
+
- [ ] 1.2 实现 RPC 接口 @skill:java-scf-rpc-usage-skill
|
|
452
|
+
- [ ] 1.3 添加前端组件 @skill:kf-fe-frontend-dev
|
|
453
|
+
- [ ] 1.4 编写测试 @skill:generate-mockito-unit-test-skill
|
|
446
454
|
\`\`\`
|
|
447
455
|
> **@skill 标签**:创建 tasks.md 前,运行 \`zhuanspec skills list --json\` 发现可用 skill 及其 description。基于 skill description 进行语义匹配:
|
|
448
456
|
> - 仔细阅读每个 skill 的 description,理解其具体功能和适用场景
|
|
@@ -452,6 +460,21 @@ The system SHALL provide...
|
|
|
452
460
|
> - 使用真实 skill 名称标注,支持多个 skill(\`@skill:name1,name2\`)
|
|
453
461
|
> - Apply 阶段 AI 根据标签直接调用对应 skill。无可用 skill 时可省略。
|
|
454
462
|
|
|
463
|
+
⚠️ **检查点 [Skill 标注]**:
|
|
464
|
+
1. 必须先运行 \`zhuanspec skills list\` 并在 Skill 映射表中记录发现的 skill
|
|
465
|
+
2. 每个任务必须标注 @skill:真实skill名称 或 @skill:none
|
|
466
|
+
3. 如果使用 @skill:none,必须提供理由(例如:"纯配置变更,无需 skill")
|
|
467
|
+
4. @skill 名称必须与 \`zhuanspec skills list\` 返回的名称完全一致 —— 禁止虚构 skill 名称
|
|
468
|
+
5. tasks.md 中的 Skill 映射表不能为空
|
|
469
|
+
6. validate --strict 会验证所有 @skill 名称是否存在于已知 skill 列表中
|
|
470
|
+
|
|
471
|
+
⚠️ **检查点 [任务排序]**:
|
|
472
|
+
1. tasks.md 中的任务必须按波次组织(### 波次 1, ### 波次 2 等)
|
|
473
|
+
2. 波次分配必须根据 @depends 依赖关系计算(波次 1 = 无依赖,波次 N = 依赖波次 N-1)
|
|
474
|
+
3. 任务不能出现在其依赖的任务之前
|
|
475
|
+
4. 必须在文件末尾添加 "## 依赖分析" 章节并标明"状态:已完成"
|
|
476
|
+
5. validate --strict 会验证任务排序是否与计算的波次匹配
|
|
477
|
+
|
|
455
478
|
5. **在需要时创建 design.md:**
|
|
456
479
|
如果以下任何情况适用,则创建 \`design.md\`;否则省略:
|
|
457
480
|
- 横切变更(多个服务/模块)或新的架构模式
|
|
@@ -461,24 +484,24 @@ The system SHALL provide...
|
|
|
461
484
|
|
|
462
485
|
最小 \`design.md\` 骨架:
|
|
463
486
|
\`\`\`markdown
|
|
464
|
-
##
|
|
487
|
+
## 背景
|
|
465
488
|
[背景、约束、利益相关者]
|
|
466
489
|
|
|
467
|
-
##
|
|
490
|
+
## 目标 / 非目标
|
|
468
491
|
- Goals: [...]
|
|
469
492
|
- Non-Goals: [...]
|
|
470
493
|
|
|
471
|
-
##
|
|
494
|
+
## 决策
|
|
472
495
|
- Decision: [内容和原因]
|
|
473
496
|
- Alternatives considered: [选项 + 理由]
|
|
474
497
|
|
|
475
|
-
##
|
|
498
|
+
## 风险 / 权衡
|
|
476
499
|
- [风险] → 缓解措施
|
|
477
500
|
|
|
478
|
-
##
|
|
501
|
+
## 迁移计划
|
|
479
502
|
[步骤、回滚]
|
|
480
503
|
|
|
481
|
-
##
|
|
504
|
+
## 待解决问题
|
|
482
505
|
- [...]
|
|
483
506
|
\`\`\`
|
|
484
507
|
|
|
@@ -488,16 +511,16 @@ The system SHALL provide...
|
|
|
488
511
|
|
|
489
512
|
**正确**(使用 #### 标题):
|
|
490
513
|
\`\`\`markdown
|
|
491
|
-
####
|
|
492
|
-
-
|
|
493
|
-
-
|
|
514
|
+
#### 场景:用户登录成功
|
|
515
|
+
- **当** 提供了有效凭据
|
|
516
|
+
- **则** 返回 JWT token
|
|
494
517
|
\`\`\`
|
|
495
518
|
|
|
496
519
|
**错误**(不要使用项目符号或粗体):
|
|
497
520
|
\`\`\`markdown
|
|
498
|
-
-
|
|
499
|
-
|
|
500
|
-
###
|
|
521
|
+
- **场景:用户登录** ❌
|
|
522
|
+
**场景**:用户登录 ❌
|
|
523
|
+
### 场景:用户登录 ❌
|
|
501
524
|
\`\`\`
|
|
502
525
|
|
|
503
526
|
每个要求必须至少有一个场景。
|
|
@@ -530,8 +553,8 @@ The system SHALL provide...
|
|
|
530
553
|
RENAMED 示例:
|
|
531
554
|
\`\`\`markdown
|
|
532
555
|
## RENAMED Requirements
|
|
533
|
-
- FROM: \`###
|
|
534
|
-
- TO: \`###
|
|
556
|
+
- FROM: \`### 需求:Login\`
|
|
557
|
+
- TO: \`### 需求:User Authentication\`
|
|
535
558
|
\`\`\`
|
|
536
559
|
|
|
537
560
|
## 故障排除
|
|
@@ -576,25 +599,25 @@ zhuanspec list
|
|
|
576
599
|
# 2) 选择变更 ID 并搭建
|
|
577
600
|
CHANGE=add-two-factor-auth
|
|
578
601
|
mkdir -p zhuanspec/changes/\$CHANGE/{specs/auth}
|
|
579
|
-
printf "##
|
|
580
|
-
printf "## 1.
|
|
602
|
+
printf "## 变更原因\\n...\\n\\n## 变更内容\\n- ...\\n\\n## 影响范围\\n- ...\\n" > zhuanspec/changes/\\$CHANGE/proposal.md
|
|
603
|
+
printf "## 1. 实现\n- [ ] 1.1 ...\n" > zhuanspec/changes/\$CHANGE/tasks.md
|
|
581
604
|
|
|
582
605
|
# 3) 添加增量(示例)
|
|
583
606
|
cat > zhuanspec/changes/\$CHANGE/specs/auth/spec.md << 'EOF'
|
|
584
607
|
## ADDED Requirements
|
|
585
|
-
###
|
|
608
|
+
### 需求:双因素认证
|
|
586
609
|
用户 MUST 在登录时提供第二个认证因素。
|
|
587
610
|
|
|
588
|
-
####
|
|
589
|
-
-
|
|
590
|
-
-
|
|
611
|
+
#### 场景:需要 OTP
|
|
612
|
+
- **当** 提供了有效凭据
|
|
613
|
+
- **则** 需要 OTP 挑战
|
|
591
614
|
EOF
|
|
592
615
|
|
|
593
616
|
# 4) 验证
|
|
594
617
|
zhuanspec validate \$CHANGE --strict
|
|
595
618
|
\`\`\`
|
|
596
619
|
|
|
597
|
-
##
|
|
620
|
+
## 多功能示例
|
|
598
621
|
|
|
599
622
|
\`\`\`
|
|
600
623
|
zhuanspec/changes/add-2fa-notify/
|
|
@@ -610,14 +633,14 @@ zhuanspec/changes/add-2fa-notify/
|
|
|
610
633
|
auth/spec.md
|
|
611
634
|
\`\`\`markdown
|
|
612
635
|
## ADDED Requirements
|
|
613
|
-
###
|
|
636
|
+
### 需求:双因素认证
|
|
614
637
|
...
|
|
615
638
|
\`\`\`
|
|
616
639
|
|
|
617
640
|
notifications/spec.md
|
|
618
641
|
\`\`\`markdown
|
|
619
642
|
## ADDED Requirements
|
|
620
|
-
###
|
|
643
|
+
### 需求:OTP 邮件通知
|
|
621
644
|
...
|
|
622
645
|
\`\`\`
|
|
623
646
|
|
|
@@ -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
|