@xulthekl/team-flow 0.30.0 → 0.32.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.
Files changed (101) hide show
  1. package/.claude/always/phase-guard.md +1 -1
  2. package/.claude-plugin/marketplace.json +3 -3
  3. package/.claude-plugin/plugin.json +2 -2
  4. package/.codex-plugin/plugin.json +2 -2
  5. package/.cursor-plugin/marketplace.json +2 -2
  6. package/.cursor-plugin/plugin.json +2 -2
  7. package/.github/plugin/marketplace.json +2 -2
  8. package/AGENTS.md +5 -4
  9. package/CHANGELOG.md +85 -0
  10. package/GEMINI.md +1 -1
  11. package/HANDOFF.md +1 -1
  12. package/INSTALL.md +1 -1
  13. package/README.md +3 -3
  14. package/agents/build-executor.md +1 -0
  15. package/agents/contract-builder.md +6 -1
  16. package/docs/README_en.md +1 -1
  17. package/docs/solutions/INDEX.md +2 -0
  18. package/docs/solutions/cross-phase/2026-08-01-no-summary.md +17 -0
  19. package/docs/solutions/cross-phase/2026-08-03-no-summary.md +17 -0
  20. package/gemini-extension.json +2 -2
  21. package/hooks/session-start +2 -2
  22. package/llms.txt +1 -1
  23. package/package.json +6 -2
  24. package/plugin.json +2 -2
  25. package/scripts/guard/checks/test-gate-exemptions.mjs +53 -0
  26. package/scripts/guard/checks/test-matrix-complete.mjs +91 -0
  27. package/scripts/guard/checks/test-matrix-ready.mjs +60 -0
  28. package/scripts/guard/checks/tests-passing.mjs +112 -24
  29. package/scripts/guard/guard.mjs +10 -2
  30. package/scripts/lib/cmd-doctor.mjs +43 -1
  31. package/scripts/lib/cmd-execution.mjs +24 -1
  32. package/scripts/lib/cmd-state.mjs +33 -5
  33. package/scripts/lib/cmd-validate.mjs +42 -0
  34. package/scripts/lib/execution-plan.mjs +23 -0
  35. package/scripts/lib/hash.mjs +11 -0
  36. package/scripts/lib/state-loader.mjs +26 -1
  37. package/scripts/lib/test-matrix-export.mjs +231 -0
  38. package/scripts/lib/test-merge.mjs +540 -0
  39. package/scripts/lib/test-record.mjs +212 -0
  40. package/scripts/team-flow.mjs +9 -0
  41. package/skills/build-executor/implementer-prompt.md +38 -3
  42. package/skills/code-reviewer/SKILL.md +28 -1
  43. package/skills/code-reviewer/code-reviewer-prompt.md +10 -0
  44. package/skills/contract-builder/SKILL.md +75 -0
  45. package/skills/release-archivist/SKILL.md +50 -10
  46. package/skills/session-handoff/SKILL.md +1 -0
  47. package/skills/spec-writer/SKILL.md +3 -1
  48. package/skills/test-strategy/SKILL.md +70 -0
  49. package/skills/test-strategy/references/adversarial-patterns.md +0 -0
  50. package/skills/test-strategy/references/complexity-grading.md +137 -0
  51. package/skills/test-strategy/references/design-methods-detail.md +183 -0
  52. package/skills/workflow-orchestrator/references/s1-path-router.md +4 -0
  53. package/skills/workflow-start/SKILL.md +5 -3
  54. package/skills/workflow-start/references/routing-rules.md +21 -0
  55. package/tests/e2e.test.mjs +0 -266
  56. package/tests/lib/cmd-audit.test.mjs +0 -202
  57. package/tests/lib/cmd-checkpoint.test.mjs +0 -98
  58. package/tests/lib/cmd-config.test.mjs +0 -101
  59. package/tests/lib/cmd-doctor.test.mjs +0 -450
  60. package/tests/lib/cmd-execution.test.mjs +0 -647
  61. package/tests/lib/cmd-handoff.test.mjs +0 -137
  62. package/tests/lib/cmd-inject.test.mjs +0 -218
  63. package/tests/lib/cmd-install-workbuddy.test.mjs +0 -113
  64. package/tests/lib/cmd-install-zcode.test.mjs +0 -42
  65. package/tests/lib/cmd-isolate.test.mjs +0 -68
  66. package/tests/lib/cmd-list.test.mjs +0 -127
  67. package/tests/lib/cmd-runtime.test.mjs +0 -83
  68. package/tests/lib/cmd-state-missing.test.mjs +0 -65
  69. package/tests/lib/cmd-state.test.mjs +0 -365
  70. package/tests/lib/cmd-sync-paths.test.mjs +0 -84
  71. package/tests/lib/cmd-validate-paths.test.mjs +0 -90
  72. package/tests/lib/config-loader.test.mjs +0 -175
  73. package/tests/lib/ensure-branch.test.mjs +0 -110
  74. package/tests/lib/execution-control-plane.test.mjs +0 -168
  75. package/tests/lib/execution-plan.test.mjs +0 -474
  76. package/tests/lib/guard-compound-captured.test.mjs +0 -92
  77. package/tests/lib/guard-specs-merged.test.mjs +0 -110
  78. package/tests/lib/guard-tests-passing.test.mjs +0 -114
  79. package/tests/lib/guard-transitions.test.mjs +0 -262
  80. package/tests/lib/guard.test.mjs +0 -613
  81. package/tests/lib/hash.test.mjs +0 -138
  82. package/tests/lib/infer-workflow.test.mjs +0 -161
  83. package/tests/lib/install-git-hooks.test.mjs +0 -20
  84. package/tests/lib/marketplace-release-docs.test.mjs +0 -31
  85. package/tests/lib/minimality-discipline.test.mjs +0 -37
  86. package/tests/lib/model-profiles-docs.test.mjs +0 -33
  87. package/tests/lib/node20-compatibility.test.mjs +0 -73
  88. package/tests/lib/node20-test-entry.test.mjs +0 -17
  89. package/tests/lib/platform-runtime-distribution.test.mjs +0 -157
  90. package/tests/lib/raw-mode-smoke.test.mjs +0 -42
  91. package/tests/lib/sdd-overlay.test.mjs +0 -118
  92. package/tests/lib/solutions-capture.test.mjs +0 -108
  93. package/tests/lib/solutions-index-gen.test.mjs +0 -147
  94. package/tests/lib/solutions-inject.test.mjs +0 -115
  95. package/tests/lib/solutions-promote.test.mjs +0 -200
  96. package/tests/lib/spec-paths.test.mjs +0 -80
  97. package/tests/lib/state-loader.test.mjs +0 -251
  98. package/tests/lib/token-baseline.test.mjs +0 -72
  99. package/tests/lib/token-rules.test.mjs +0 -94
  100. package/tests/lib/verify-marketplace-release.test.mjs +0 -128
  101. package/tests/tsconfig.json +0 -12
@@ -1,3 +1,3 @@
1
- # team-flow v0.30.0 | 阶段: {{state}} | 工作流: {{workflow}}
1
+ # team-flow v0.32.1 | 阶段: {{state}} | 工作流: {{workflow}}
2
2
  当前阶段允许的操作由 workflow-start 路由规则定义。
3
3
  禁止跨越 DP gate 进入下一阶段。变更范围以 execution-contract.md 的 Intent Lock 为准。
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "team-flow",
3
- "description": "Unified workflow plugin: team-flow + compound-engineering core subset + architecture-design + prototype + workflow-orchestrator + workflow-bootstrap + e2e + session-handoff + workflow-feedback. 23 skills + 15 agents, one install.",
3
+ "description": "Unified workflow plugin: team-flow + compound-engineering core subset + architecture-design + prototype + workflow-orchestrator + workflow-bootstrap + e2e + session-handoff + workflow-feedback. 24 skills + 15 agents, one install.",
4
4
  "owner": {
5
5
  "name": "LT",
6
6
  "url": "https://github.com/LT"
@@ -8,8 +8,8 @@
8
8
  "plugins": [
9
9
  {
10
10
  "name": "team-flow",
11
- "description": "8-state spec workflow + compound global compounding + architecture-design (4A/DDD) + local HTML prototype + product-level orchestration + bootstrap + e2e + session handoff + workflow feedback. 23 skills + 15 agents with embedded TDD, SDD, code review, debugging, delta spec sync, and design-system-driven prototyping.",
12
- "version": "0.30.0",
11
+ "description": "8-state spec workflow + compound global compounding + architecture-design (4A/DDD) + local HTML prototype + product-level orchestration + bootstrap + e2e + session handoff + workflow feedback. 24 skills + 15 agents with embedded TDD, SDD, code review, debugging, delta spec sync, and design-system-driven prototyping.",
12
+ "version": "0.32.1",
13
13
  "source": "./",
14
14
  "author": {
15
15
  "name": "LT",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "team-flow",
3
- "version": "0.30.0",
4
- "description": "Unified workflow plugin: team-flow (spec-driven dev: TDD/SDD/code-review/debugging) + compound-engineering core subset (brainstorm/plan/compound/strategy/ideate/proof, global compounding) + architecture-design (4A+DDD incremental design & global compounding) + prototype (local HTML prototype, zero external deps) + e2e (Playwright E2E, AC-driven) + workflow-orchestrator (product-level workflow orchestration) + workflow-bootstrap (existing project onboarding) + session-handoff (context transfer) + workflow-feedback (issue tracking). 23 skills + 15 agents, one install.",
3
+ "version": "0.32.1",
4
+ "description": "Unified workflow plugin: team-flow (spec-driven dev: TDD/SDD/code-review/debugging) + compound-engineering core subset (brainstorm/plan/compound/strategy/ideate/proof, global compounding) + architecture-design (4A+DDD incremental design & global compounding) + prototype (local HTML prototype, zero external deps) + e2e (Playwright E2E, AC-driven) + workflow-orchestrator (product-level workflow orchestration) + workflow-bootstrap (existing project onboarding) + session-handoff (context transfer) + workflow-feedback (issue tracking). 24 skills + 15 agents, one install.",
5
5
  "source": "./",
6
6
  "author": {
7
7
  "name": "LT",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "team-flow",
3
- "version": "0.30.0",
3
+ "version": "0.32.1",
4
4
  "description": "Spec-first workflow that bridges OpenSpec-style planning and Superpowers-style execution discipline.",
5
5
  "author": {
6
6
  "name": "MageByte",
@@ -26,7 +26,7 @@
26
26
  "interface": {
27
27
  "displayName": "team-flow",
28
28
  "shortDescription": "Spec-first workflow with guarded execution.",
29
- "longDescription": "A self-contained Codex workflow plugin with nine skills for intent exploration, planning artifacts, execution contracts, TDD execution, review gates, systematic debugging, closure, and delta spec sync.",
29
+ "longDescription": "A self-contained Codex workflow plugin with 24 skills for intent exploration, planning artifacts, execution contracts, TDD execution, review gates, systematic debugging, closure, and delta spec sync.",
30
30
  "developerName": "MageByte",
31
31
  "category": "Developer Tools",
32
32
  "composerIcon": "./assets/icon.svg",
@@ -5,13 +5,13 @@
5
5
  },
6
6
  "metadata": {
7
7
  "description": "Unified workflow plugin marketplace for Cursor (team-flow: team-flow + compound + architecture-design + prototype).",
8
- "version": "0.30.0"
8
+ "version": "0.32.1"
9
9
  },
10
10
  "plugins": [
11
11
  {
12
12
  "name": "team-flow",
13
13
  "source": ".",
14
- "description": "Unified workflow plugin: team-flow + compound-engineering core subset + architecture-design + prototype. 17 collaborative skills."
14
+ "description": "Unified workflow plugin: team-flow + compound-engineering core subset + architecture-design + prototype. 24 skills + 15 agents."
15
15
  }
16
16
  ]
17
17
  }
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "team-flow",
3
3
  "displayName": "team-flow",
4
- "description": "Unified workflow plugin: team-flow (spec-driven dev: TDD/SDD/code-review/debugging) + compound-engineering core subset (brainstorm/plan/compound/strategy/ideate/proof, global compounding) + architecture-design (4A+DDD incremental design & global compounding) + prototype (local HTML prototype, zero external deps) + e2e (Playwright E2E, AC-driven) + workflow-orchestrator (product-level workflow orchestration) + workflow-bootstrap (existing project onboarding) + session-handoff (context transfer) + workflow-feedback (issue tracking). 23 skills + 15 agents, one install.",
5
- "version": "0.30.0",
4
+ "description": "Unified workflow plugin: team-flow (spec-driven dev: TDD/SDD/code-review/debugging) + compound-engineering core subset (brainstorm/plan/compound/strategy/ideate/proof, global compounding) + architecture-design (4A+DDD incremental design & global compounding) + prototype (local HTML prototype, zero external deps) + e2e (Playwright E2E, AC-driven) + workflow-orchestrator (product-level workflow orchestration) + workflow-bootstrap (existing project onboarding) + session-handoff (context transfer) + workflow-feedback (issue tracking). 24 skills + 15 agents, one install.",
5
+ "version": "0.32.1",
6
6
  "author": {
7
7
  "name": "LT",
8
8
  "url": "https://github.com/LT"
@@ -6,13 +6,13 @@
6
6
  },
7
7
  "metadata": {
8
8
  "description": "Unified workflow plugins and skills for AI coding agents (team-flow: team-flow + compound + architecture-design + prototype).",
9
- "version": "0.30.0"
9
+ "version": "0.32.1"
10
10
  },
11
11
  "plugins": [
12
12
  {
13
13
  "name": "team-flow",
14
14
  "description": "Unified workflow with planning artifacts, execution contracts, TDD, review gates, systematic debugging, delta spec sync, architecture-design, and local HTML prototyping.",
15
- "version": "0.30.0",
15
+ "version": "0.32.1",
16
16
  "source": ".",
17
17
  "author": {
18
18
  "name": "LT",
package/AGENTS.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # AGENTS.md · team-flow
2
2
 
3
- > team-flow 统一插件 = **team-flow**(spec 驱动开发)+ **compound-engineering 核心子集**(全局复利)+ **architecture-design**(4A+DDD 增量设计)+ **prototype**(本地 HTML 原型)+ **e2e**(AC 驱动 Playwright E2E)+ **workflow-orchestrator**(产品级编排)+ **workflow-bootstrap**(既有项目接入)。一次安装,七套能力协同(23 skills + 15 agents),支持 9 安装面(Claude Code, Cursor, OpenAI Codex CLI/App, GitHub Copilot CLI, Gemini CLI, OpenCode, WorkBuddy, Trae, ima-copilot)。
3
+ > team-flow 统一插件 = **team-flow**(spec 驱动开发)+ **compound-engineering 核心子集**(全局复利)+ **architecture-design**(4A+DDD 增量设计)+ **prototype**(本地 HTML 原型)+ **e2e**(AC 驱动 Playwright E2E)+ **workflow-orchestrator**(产品级编排)+ **workflow-bootstrap**(既有项目接入)。一次安装,七套能力协同(24 skills + 15 agents),支持 9 安装面(Claude Code, Cursor, OpenAI Codex CLI/App, GitHub Copilot CLI, Gemini CLI, OpenCode, WorkBuddy, Trae, ima-copilot)。
4
4
 
5
5
  ## What This Is
6
6
 
@@ -12,7 +12,7 @@
12
12
 
13
13
  ### 身份与依赖关系
14
14
 
15
- - **team-flow**(本插件):Claude Code / Cursor 等宿主的插件实体(`plugin.json` name = `team-flow`),包含 23 个 skills + 15 个 agents + hooks + templates
15
+ - **team-flow**(本插件):Claude Code / Cursor 等宿主的插件实体(`plugin.json` name = `team-flow`),包含 24 个 skills + 15 个 agents + hooks + templates
16
16
  - **@xulthekl/team-flow**(npm 底座包):team-flow 的 CLI 工具层(`package.json` name = `@xulthekl/team-flow`,bin = `tf` / `team-flow`),提供状态机、校验、复利 CLI 等运行时能力
17
17
  - 关系:team-flow 插件 **包含** @xulthekl/team-flow npm 包作为底座(同一仓库、同一版本)。skills 中的 `tf ...` 调用的是已全局安装的 @xulthekl/team-flow CLI,版本由 session-start hook 自动同步
18
18
  - 历史身份(已废弃):`spec-superflow`(npm 包名,0.11.0 后停止发布)/ `ssf`(CLI 前缀)/ `.spec-superflow.yaml`(状态文件)—— 详见设计增强方案 v0.9 §27
@@ -33,7 +33,7 @@ node --test tests/e2e.test.mjs --test-name-pattern="parseDeltaSpec"
33
33
  npm run validate
34
34
  ```
35
35
 
36
- ## 能力概览(九套合一,23 skills)
36
+ ## 能力概览(九套合一,24 skills)
37
37
 
38
38
  ### 1. team-flow(底座,9 skills)
39
39
  spec 驱动开发过程。8 态变更机:`exploring → specifying → bridging → approved-for-build → executing → closing`(另有 `debugging` 侧路径 + `abandoned` 终态)。
@@ -164,7 +164,7 @@ STRATEGY.md CONCEPTS.md 产品策略(BA) / 领域词汇
164
164
  全局作为下一 change / 下一 PRD 版本的 grounding → 闭环
165
165
  ```
166
166
 
167
- ## Skills 索引(23 个)
167
+ ## Skills 索引(24 个)
168
168
 
169
169
  | Skill | 归属 | 用途 |
170
170
  |---|---|---|
@@ -173,6 +173,7 @@ STRATEGY.md CONCEPTS.md 产品策略(BA) / 领域词汇
173
173
  | spec-writer | team-flow | 写 spec |
174
174
  | contract-builder | team-flow | 构建执行契约 |
175
175
  | build-executor | team-flow | TDD 实现 |
176
+ | test-strategy | team-flow | 测试设计方法论(design_method 三级分层 + 对抗验证 + 复杂度分级,v0.12 §41) |
176
177
  | code-reviewer | team-flow | 代码审查 |
177
178
  | spec-merger | team-flow | 合并 delta spec |
178
179
  | release-archivist | team-flow | 发布归档 |
package/CHANGELOG.md CHANGED
@@ -6,6 +6,91 @@ The format loosely follows Keep a Changelog.
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.32.1] - 2026-08-03
10
+
11
+ > 版本号说明:0.32.0 因 `.npmignore` 缺失 `/tests/` 排除项,误将 61.8M e2e 基线归档打入 tarball(72MB),发布后 30 分钟内撤回;npm 版本号一经发布不可复用,故以 **0.32.1** 重发(内容完全一致 + 打包修复)。
12
+
13
+ ### Added(设计增强方案 v0.13 §47-§53 测试门禁硬化——C1-domain-policy 事件修复)
14
+
15
+ #### 豁免键修正(v0.13 §48)
16
+ - **scripts/lib/state-loader.mjs**:BUILTIN_DEFAULTS 新增 `test_matrix_skip_reason` / `test_evidence_path`;`schema_version` 不进 defaults(字段缺失 = 存量信号);writeState 条件序列化 `schema_version`
17
+ - **scripts/lib/cmd-state.mjs**:init 分支仅在 change 创建(状态文件尚不存在)时打戳 `schema_version: 1`(rebuild/set 不追加);SETTABLE_FIELDS 移除 `test_result`、新增 `test_matrix_skip_reason`;`test_result`/`schema_version` 手工 set 被拒并给引导
18
+ - **scripts/guard/checks/test-gate-exemptions.mjs**:新建共享豁免判定模块(legacy/skip 语义唯一真相源,防三个测试门禁漂移)
19
+ - **scripts/guard/checks/test-matrix-complete.mjs**:重写——legacy/skip 双豁免;删除内容型豁免(contract 无 `## Test Matrix` 段即 PASS)与"无 contract → PASS";删除 hash null 短路;skip 必附理由
20
+
21
+ #### 门禁前移(v0.13 §49)
22
+ - **scripts/guard/checks/test-matrix-ready.mjs**:新建入口维度(矩阵存在非空 + contract 声明段 OR 显式 skip 附理由;legacy 豁免)
23
+ - **scripts/guard/guard.mjs**:full `approved-for-build:executing` 新增 `test-matrix-ready`(hotfix/tweak 沿用 §45.3 豁免不挂)
24
+
25
+ #### tests-passing 证据程序化(v0.13 §50,BUG-A 政策修正)
26
+ - **scripts/lib/test-record.mjs**:新建 `tf test record` 命令——maven-surefire(控制台汇总行 + XML 报告目录)/jest(--json)/pytest 解析器 + auto 识别;结构化 `test_result`(recorded-by=tf-test-record)+ 证据落盘 `.superpowers/test-evidence/`;fail 结果 exit 1;无手工自述通道
27
+ - **scripts/guard/checks/tests-passing.mjs**:重写——非存量 change 只认程序化结构化记录 + 证据文件存在性;dp_6_result 去证据化(BUG-A 通道仅存量保留);total=0 空真拒绝;skip 必附理由
28
+ - **scripts/team-flow.mjs**:注册 `test` 命令 + HELP
29
+
30
+ #### review 硬化 + 巡检扩展(v0.13 §51-§52)
31
+ - **scripts/lib/execution-plan.mjs**:validateReviewRange 禁止 base==head(空 diff review 非法,C1 现场 6 个 receipt 全为空 diff);receipt 新增可选 `tests` 统计字段(非负整数校验)
32
+ - **scripts/lib/cmd-execution.mjs**:review 新增 `--tests-total/--tests-passed/--tests-failed`(须同时提供)
33
+ - **scripts/lib/cmd-doctor.mjs**:新增 checkChangeTestGates 巡检(skip_reason 配对 + arch_review_report/test_evidence_path 引用完整性)
34
+ - **scripts/lib/cmd-validate.mjs**:test-matrix 双向互锁(契约段↔矩阵文件,非存量非 skip 时 ERROR)+ hash 漂移警告
35
+
36
+ ### Changed(SOP 硬化批次,v0.13 §52)
37
+ - **agents/contract-builder.md**:skills 补 test-strategy 预加载(修复矩阵生成者的预加载断点)+ test-matrix.md 所有权声明
38
+ - **skills/contract-builder/SKILL.md**:Test Matrix Generation 升 MUST(full workflow)+ skip 必附理由
39
+ - **skills/release-archivist/SKILL.md**:Step 1 零测试条款(0 tests ≠ PASS)+ tf test record 程序化记录;Step 2b 矩阵缺失对非存量 change FAIL(删除静默 SKIP);dp_6 去证据化说明
40
+ - **skills/workflow-start/SKILL.md**:build-executor 返回验证补测试文件检查(SDD/full);contract-builder 路由声明矩阵必产;入口门禁前移引导
41
+ - **skills/workflow-start/references/routing-rules.md**:Route to glaf4-tests 归位(触发主体 = contract-builder;可选的是工具选择,矩阵生成本身强制)
42
+ - **skills/session-handoff/SKILL.md**:Guardrail #6 报告生成纪律(LLM 重构报告必须现场核对,C1 报告 10+ 处失真教训)
43
+
44
+ ### Fixed(P3 审查横展修复)
45
+ - **skills/workflow-start/SKILL.md**:路由优先级块修正 v0.30.0 引入的存量矛盾——删除"hotfix/tweak 架构设计可跳过(自动写 skipped)"例外句(与 Fast-Path 5 处"不豁免"条款及 v0.9 §26 冲突,且无对应代码行为);skill-reviewer F-1
46
+ - **skills/release-archivist/SKILL.md** + **skills/contract-builder/SKILL.md**:Lightweight Closure / Hotfix Mode 补非存量 change tests-passing 门禁指引(skip+reason 或 tf test record),修复轻量收尾必然撞门禁的断点;skill-reviewer W-0
47
+ - **agents/contract-builder.md**:DON'T 列表终态标记条款反向措辞修正;skill-reviewer W-2
48
+ - **计数同步**:12 处 manifest/文档的 skill 计数修正为 24 skills(v0.31.0 新增 test-strategy 时漏更的遗留债);plugin-validator
49
+
50
+ ### Tests
51
+ - tests/lib/schema-version.test.mjs(打戳语义 5 例)、test-record.test.mjs(解析器 9 例 + CLI 6 例)、review-hardening.test.mjs(base==head 拒绝 + 统计字段 4 例)
52
+ - tests/e2e/deterministic/guard-dimensions.test.mjs:test-matrix-complete 重写为 v0.13 六步判定(9 例)+ test-matrix-ready 新 describe(6 例)+ tests-passing 程序化/skip/负向用例
53
+ - tests/lib/cmd-state.test.mjs:test_result/schema_version 拒设用例 + skip_reason 可设用例;tests/lib/guard.test.mjs:closing 前置夹具适配(legacy 夹具直写 yaml 模拟旧 CLI)
54
+ - 全量回归:lib 486/486 + Tier1 e2e 67/67
55
+
56
+ ## [0.31.0] - 2026-08-01
57
+
58
+ ### Added(设计增强方案 v0.12 §40-§46 测试矩阵驱动开发 + 测试复利闭环)
59
+
60
+ #### test-strategy skill(24→25 skills)
61
+ - **skills/test-strategy/**:新建测试设计方法论 skill(≤50 行硬规则),含 3 个 references:design-methods-detail.md(10+1 种 design_method 详细说明)、complexity-grading.md(复杂度分级规则 + 圈复杂度计算)、adversarial-patterns.md(对抗验证三招 + 攻击向量模板)
62
+ - **agents/build-executor.md**:frontmatter `skills` 新增 `test-strategy` 预加载
63
+
64
+ #### test-matrix.md 附属产物
65
+ - **skills/contract-builder/SKILL.md**:新增 Test Matrix Generation 段(12 列格式 + 候选覆盖台账 + 对抗验证段 + GLAF4 Java 路由)
66
+ - **skills/spec-writer/SKILL.md**:新增 Unit/Integration 可选标签(test-matrix 提取 hints)
67
+ - **scripts/lib/hash.mjs**:新增 `computeTestMatrixHash()`(独立于 artifacts_hash,避免自循环)
68
+ - **scripts/lib/state-loader.mjs**:BUILTIN_DEFAULTS 新增 `test_matrix_hash` / `test_matrix_skipped`
69
+ - **scripts/lib/cmd-state.mjs**:SETTABLE_FIELDS 新增 `test_matrix_skipped`;init 计算 test_matrix_hash
70
+
71
+ #### build-executor 按矩阵 TDD
72
+ - **skills/build-executor/implementer-prompt.md**:新增 Test Matrix Protocol 段(TDD/CHARACTERIZATION/REGRESSION 三种 work_mode + 两不原则 + 五步闭环 + 矩阵覆盖率自检)
73
+
74
+ #### code-reviewer Test Matrix Compliance
75
+ - **skills/code-reviewer/SKILL.md**:新增 Step 5b Test Matrix Compliance(case-by-case 验证 + 覆盖率计算 + 候选台账审计 + 金字塔比例检查)
76
+ - **skills/code-reviewer/code-reviewer-prompt.md**:reviewer prompt 新增 Test Matrix Compliance 检查段
77
+
78
+ #### release-archivist Test Matrix Reconciliation
79
+ - **skills/release-archivist/SKILL.md**:新增 Step 2b Test Matrix Reconciliation(条件触发 PASS/FAIL/WARN/SKIP)+ Test Merge 段 + closing 顺序更新为 arch-merge → prototype-sync → test-merge → compound promotion
80
+
81
+ #### guard 维度 test-matrix-complete
82
+ - **scripts/guard/checks/test-matrix-complete.mjs**:新建检查(~55 行),4 条豁免路径(显式 skip / 存量兼容 / 无 contract / hash 一致)
83
+ - **scripts/guard/guard.mjs**:`executing:closing` 新增 `test-matrix-complete`(full 考核 7 维度);hotfix `executing:closing` 新增(6 维度,豁免 test-matrix-complete);tweak 保持 3 维度不变
84
+
85
+ #### 测试复利闭环(test-ledger + test-merge)
86
+ - **scripts/lib/test-merge.mjs**:新建 6 步流程(preCheck → mergeBaselines → resolveDeferred → appendChangelog → rewriteIndex → gitCommit)
87
+ - **scripts/lib/test-matrix-export.mjs**:新建 glaf4 JSON → team-flow Markdown 格式转换(test_kind → test_tier 映射)
88
+ - **scripts/team-flow.mjs**:注册 `test-merge` + `test-matrix-export` 两个新 CLI 命令
89
+
90
+ #### 注入侧
91
+ - **skills/workflow-orchestrator/references/s1-path-router.md**:新增「测试台账注入」段(读取 docs/test-ledger/INDEX.md,注入 partial 模块列表)
92
+ - **skills/workflow-start/references/routing-rules.md**:新增「Route to glaf4-tests」段(GLAF4 Java 项目可选 glaf4-tests design stage)
93
+
9
94
  ## [0.30.0] - 2026-08-01
10
95
 
11
96
  ### Added(设计增强方案 v0.11 §39 workflow 健壮性增强,来源:workflow-feedback 2026-08-01 ×9)
package/GEMINI.md CHANGED
@@ -8,7 +8,7 @@ The workflow is self-contained and does not require OpenSpec or Superpowers at r
8
8
 
9
9
 
10
10
  <!-- team-flow-phase-guard-start -->
11
- # team-flow v0.30.0 | 阶段: {{state}} | 工作流: {{workflow}}
11
+ # team-flow v0.32.1 | 阶段: {{state}} | 工作流: {{workflow}}
12
12
  当前阶段允许的操作由 workflow-start 路由规则定义。
13
13
  禁止跨越 DP gate 进入下一阶段。变更范围以 execution-contract.md 的 Intent Lock 为准。
14
14
  <!-- team-flow-phase-guard-end -->
package/HANDOFF.md CHANGED
@@ -23,7 +23,7 @@
23
23
  | **e2e**(端到端测试) | 整个 skill | 1 |
24
24
  | **session-handoff**(session 交接) | 整个 skill | 1 |
25
25
  | **workflow-feedback**(反馈闭环) | 整个 skill | 1 |
26
- | **合计** | | **23 skills + 15 agents** |
26
+ | **合计** | | **24 skills + 15 agents** |
27
27
 
28
28
  - 零运行时外部依赖(team-flow 底座自包含)。
29
29
  - prototype 额外**零外部依赖、可离线**(自包含 HTML + 页面内 Tweaks 控件,无 CDN)。
package/INSTALL.md CHANGED
@@ -7,7 +7,7 @@
7
7
  - [Fission-AI/OpenSpec](https://github.com/Fission-AI/OpenSpec) — 规划引擎(Schema 验证、Delta Spec、工件解析)
8
8
  - [obra/superpowers](https://github.com/obra/superpowers) — 执行纪律(TDD 铁律、SDD、系统化调试、代码审查)
9
9
 
10
- 当前发布版本:**v0.30.0**。
10
+ 当前发布版本:**v0.32.1**。
11
11
 
12
12
  ---
13
13
 
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # team-flow
2
2
 
3
- > 当前版本:`v0.30.0`
3
+ > 当前版本:`v0.32.1`
4
4
 
5
5
  > 统一插件:**team-flow**(spec 驱动开发)+ **compound-engineering 核心子集**(全局复利)+ **architecture-design**(4A+DDD 增量设计)+ **prototype**(本地 HTML 原型)+ **e2e**(AC 驱动 E2E)+ **workflow-orchestrator**(产品级编排)+ **workflow-bootstrap**(既有项目接入)。一次安装,七套能力协同。
6
6
 
@@ -34,7 +34,7 @@
34
34
  git clone <your-repo> && <cli> plugin install ./team-flow
35
35
  ```
36
36
 
37
- > 不同宿主 CLI 的安装子命令略有差异(如 Claude Code 为 `/plugin add`,Cursor 为 `plugin install`)。以宿主文档为准;本插件提供单一 `plugin.json`,一次安装即加载全部 23 个 skills。
37
+ > 不同宿主 CLI 的安装子命令略有差异(如 Claude Code 为 `/plugin add`,Cursor 为 `plugin install`)。以宿主文档为准;本插件提供单一 `plugin.json`,一次安装即加载全部 24 个 skills。
38
38
 
39
39
  ## 配置(插件层扩展字段)
40
40
 
@@ -70,7 +70,7 @@ specs/<cap>/ 每变更设计/任务/契约 + learnings.md
70
70
  STRATEGY.md CONCEPTS.md 策略 / 领域词汇
71
71
  ```
72
72
 
73
- ## 九套能力(23 skills)
73
+ ## 九套能力(24 skills)
74
74
 
75
75
  - **team-flow**(9):workflow-start / need-explorer / spec-writer / contract-builder / build-executor / code-reviewer / spec-merger / release-archivist / bug-investigator
76
76
  - **compound 核心子集**(6):ce-brainstorm / ce-plan / ce-compound / ce-strategy / ce-ideate / ce-proof
@@ -28,6 +28,7 @@ color: green
28
28
  tools: ["Read", "Bash", "Grep", "Glob", "Write", "Edit"]
29
29
  skills:
30
30
  - build-executor
31
+ - test-strategy
31
32
  ---
32
33
 
33
34
  You are an independent Build Executor. You govern the implementation phase using `execution-contract.md` as the workflow authority, driving disciplined TDD batch execution. You operate in an independent context with Write capability for implementation code and execution receipts.
@@ -28,6 +28,9 @@ color: magenta
28
28
  tools: ["Read", "Bash", "Grep", "Glob", "Write", "Edit"]
29
29
  skills:
30
30
  - contract-builder
31
+ # v0.13 §52 B1:test-matrix.md 由本 agent 生成,需预加载测试设计方法论
32
+ #(design_method 选择/复杂度分级/对抗验证),修复 v0.31.0 的预加载断点。
33
+ - test-strategy
31
34
  ---
32
35
 
33
36
  You are an independent Contract Builder. You compress approved planning artifacts into a single execution handshake: `execution-contract.md`. You operate in an independent context with Write capability for the contract file only.
@@ -36,6 +39,8 @@ You are an independent Contract Builder. You compress approved planning artifact
36
39
 
37
40
  **You are the sole owner of `execution-contract.md`** within the change directory. No other agent or the orchestration layer may directly edit it. Refresh/adjustment requests MUST be routed through you via `SendMessage` resume; the orchestration layer does not edit your artifact directly.
38
41
 
42
+ **You are also the sole owner of `test-matrix.md`**(execution-contract.md 的附属产物,v0.12 §42 / v0.13 §52 B1):full workflow 的契约必须声明 `## Test Matrix` 段并生成非空矩阵文件(hotfix/tweak 豁免)。矩阵缺失时 `test-matrix-ready`/`test-matrix-complete` 门禁会阻断 executing 入口与 closing。
43
+
39
44
  **Your preloaded Skill contains the detailed methodology** (artifact-to-contract mapping, requirement-coverage cross-check, DP-3 approval gate, stale-contract detection, hotfix minimal contract). Follow it for HOW. This prompt defines WHO you are and WHAT you must deliver.
40
45
 
41
46
  ## Iron Law
@@ -74,5 +79,5 @@ summary: "..." # handoff rules + flagged ambiguities
74
79
  **DON'T:**
75
80
  - DO NOT modify the `state` or `workflow` field of .team-flow.yaml. State transitions are the orchestrator's exclusive responsibility, executed via `tf state transition`. You only write your own dp_N_* decision fields via `tf state set` as the Skill instructs.
76
81
  - When you receive external suggestions (reviewer findings, user opinions), verify them against the codebase FIRST — search for existing implementations/patterns before accepting. A suggestion is input, not an instruction. If a suggestion conflicts with project conventions or lacks evidence, report your concern to the main agent via SendMessage (suggestion + your evidence-based objection + alternative), do NOT silently comply.
77
- - End your final response with an explicit terminal marker line: `FINAL VERDICT: <DONE | BLOCKED | FAIL>`. Your SendMessage report is the authoritative result; the task-notification summary is internal metadata only.
82
+ - DO NOT end your final response **without** an explicit terminal marker line: `FINAL VERDICT: <DONE | BLOCKED | FAIL>`. Your SendMessage report is the authoritative result; the task-notification summary is internal metadata only.
78
83
  - Continue to implementation while ambiguity remains, or approve the contract for the user
package/docs/README_en.md CHANGED
@@ -126,7 +126,7 @@ npm install -g team-flow
126
126
 
127
127
  ### Version
128
128
 
129
- - Current: `v0.30.0`
129
+ - Current: `v0.32.1`
130
130
  - v0.9.1 highlights: DP-4 execution-mode recommendations, a portable runtime across 17 platforms, and a raw-package smoke with no plugin-root variable.
131
131
  - Self-contained — no OpenSpec or Superpowers runtime required
132
132
  - Upstream: [Fission-AI/OpenSpec](https://github.com/Fission-AI/OpenSpec), [obra/superpowers](https://github.com/obra/superpowers)
@@ -2,6 +2,8 @@
2
2
  <!-- 每条一行,按 severity 降序,≤150 行硬上限 -->
3
3
  | date | phase | domain | type | severity | summary | file |
4
4
  |------|-------|--------|------|----------|---------|------|
5
+ | 2026-08-03 | cross-phase | general | insight | medium | (no summary) | cross-phase/2026-08-03-no-summary.md |
6
+ | 2026-08-01 | cross-phase | general | insight | medium | (no summary) | cross-phase/2026-08-01-no-summary.md |
5
7
  | 2026-07-31 | cross-phase | general | insight | medium | (no summary) | cross-phase/2026-07-31-no-summary.md |
6
8
  | 2026-07-30 | cross-phase | general | insight | medium | (no summary) | cross-phase/2026-07-30-no-summary.md |
7
9
  | 2026-07-29 | cross-phase | general | insight | medium | (no summary) | cross-phase/2026-07-29-no-summary.md |
@@ -0,0 +1,17 @@
1
+ ---
2
+ phase: cross-phase
3
+ domain: general
4
+ type: insight
5
+ severity: medium
6
+ date: 2026-08-01
7
+ source:
8
+ ---
9
+
10
+ ## 问题描述
11
+ (no summary)
12
+
13
+ ## 根因/模式
14
+ (待补充)
15
+
16
+ ## 预防措施/应用方式
17
+ (待补充)
@@ -0,0 +1,17 @@
1
+ ---
2
+ phase: cross-phase
3
+ domain: general
4
+ type: insight
5
+ severity: medium
6
+ date: 2026-08-03
7
+ source:
8
+ ---
9
+
10
+ ## 问题描述
11
+ (no summary)
12
+
13
+ ## 根因/模式
14
+ (待补充)
15
+
16
+ ## 预防措施/应用方式
17
+ (待补充)
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "team-flow",
3
- "description": "Unified workflow plugin: team-flow (spec-driven dev) + compound-engineering core subset + architecture-design (4A/DDD) + prototype (local HTML). 17 skills, one install.",
4
- "version": "0.30.0",
3
+ "description": "Unified workflow plugin: team-flow (spec-driven dev) + compound-engineering core subset + architecture-design (4A/DDD) + prototype (local HTML). 24 skills, one install.",
4
+ "version": "0.32.1",
5
5
  "contextFileName": "GEMINI.md"
6
6
  }
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env bash
2
- # v0.30.0: auto-sync CLI version with plugin version
2
+ # v0.32.1: auto-sync CLI version with plugin version
3
3
  set -e
4
4
 
5
5
  # ═══════════════════════════════════════════════════════════════
6
6
  # Plugin version (update this when releasing new versions)
7
7
  # ═══════════════════════════════════════════════════════════════
8
- PLUGIN_VERSION="0.29.2"
8
+ PLUGIN_VERSION="0.32.1"
9
9
 
10
10
  # ═══════════════════════════════════════════════════════════════
11
11
  # Step 1: Auto-sync CLI version with plugin version
package/llms.txt CHANGED
@@ -3,7 +3,7 @@
3
3
  ## Overview
4
4
  spec-superflow is a self-contained workflow integration plugin for Claude Code, Cursor, OpenAI Codex CLI/App, GitHub Copilot CLI, Gemini CLI, OpenCode, WorkBuddy, and Trae. It merges spec-driven planning artifacts (proposal, specs, design, tasks) with disciplined execution guardrails (TDD, review gates, controlled handoff) into one unified workflow.
5
5
 
6
- Current version: v0.30.0.
6
+ Current version: v0.32.1.
7
7
 
8
8
  ## Key Documents
9
9
  - README.md: Chinese homepage with full usage guide and FAQ
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xulthekl/team-flow",
3
- "version": "0.30.0",
4
- "description": "Unified plugin (23 skills + 15 agents) integrating team-flow, compound-engineering, architecture-design, prototype, design-system, workflow-orchestrator, workflow-bootstrap, e2e, session-handoff, workflow-feedback for multi-agent coding tools.",
3
+ "version": "0.32.1",
4
+ "description": "Unified plugin (24 skills + 15 agents) integrating team-flow, compound-engineering, architecture-design, prototype, design-system, workflow-orchestrator, workflow-bootstrap, e2e, session-handoff, workflow-feedback for multi-agent coding tools.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "bin": {
@@ -13,6 +13,10 @@
13
13
  "build": "tsc",
14
14
  "test": "node --test tests/e2e.test.mjs tests/lib/*.test.mjs",
15
15
  "test:raw-mode": "node --test tests/lib/raw-mode-smoke.test.mjs",
16
+ "test:e2e": "node --test tests/e2e/deterministic/*.test.mjs",
17
+ "test:e2e:baseline": "node tests/e2e/scripts/make-baseline.mjs",
18
+ "test:e2e:plugin-sync": "node tests/e2e/scripts/plugin-sync.mjs",
19
+ "test:e2e:llm": "TF_E2E_LLM=1 node --test --test-concurrency=1 tests/e2e/workflow/*.test.mjs",
16
20
  "validate": "node scripts/validate-artifacts",
17
21
  "version": "node scripts/team-flow.mjs version $npm_new_version && node scripts/check-version-consistency.mjs && git add -A",
18
22
  "check-versions": "node scripts/check-version-consistency.mjs",
package/plugin.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "team-flow",
3
- "version": "0.30.0",
4
- "description": "Unified workflow plugin: team-flow (spec-driven dev: TDD/SDD/code-review/debugging) + compound-engineering core subset (brainstorm/plan/compound/strategy/ideate/proof, global compounding) + architecture-design (4A+DDD incremental design & global compounding) + prototype (local HTML prototype, zero external deps) + e2e (Playwright E2E, AC-driven) + workflow-orchestrator (product-level workflow orchestration) + workflow-bootstrap (existing project onboarding) + session-handoff (context transfer) + workflow-feedback (issue tracking). 23 skills + 15 agents, one install.",
3
+ "version": "0.32.1",
4
+ "description": "Unified workflow plugin: team-flow (spec-driven dev: TDD/SDD/code-review/debugging) + compound-engineering core subset (brainstorm/plan/compound/strategy/ideate/proof, global compounding) + architecture-design (4A+DDD incremental design & global compounding) + prototype (local HTML prototype, zero external deps) + e2e (Playwright E2E, AC-driven) + workflow-orchestrator (product-level workflow orchestration) + workflow-bootstrap (existing project onboarding) + session-handoff (context transfer) + workflow-feedback (issue tracking). 24 skills + 15 agents, one install.",
5
5
  "author": {
6
6
  "name": "LT"
7
7
  },
@@ -0,0 +1,53 @@
1
+ // scripts/guard/checks/test-gate-exemptions.mjs — shared exemption logic for v0.13 test gates
2
+ //
3
+ // v0.13 §48/§49(设计增强方案 v0.13,C1-domain-policy 事件修复):
4
+ // test-matrix-complete / test-matrix-ready / tests-passing 三个测试门禁共享同一套
5
+ // legacy/skip 豁免语义,抽取到本模块作为唯一真相源,防止三处判定漂移。
6
+ //
7
+ // 豁免键修正背景(RC-1):v0.12 §45.3 的"存量兼容"豁免以 contract 内容为键
8
+ //(无 '## Test Matrix' 段即放行),无法区分"真存量"与"新 change 漏生成矩阵",
9
+ // 导致 v0.31.0 发布当天 C1-domain-policy 零测试通过全部门禁。v0.13 将豁免键改为
10
+ // state 初始化版本标记(schema_version),内容型豁免整体删除。
11
+ import fs from 'node:fs';
12
+ import path from 'node:path';
13
+
14
+ /**
15
+ * v0.13 §48.1:legacy = v0.32.0 之前创建的 change(状态文件无 schema_version 打戳)。
16
+ * 打戳只发生在 `tf state init` 创建 change 时;rebuild/doctor/set 一律不追加,
17
+ * 因此"字段缺失"是可靠的存量信号,不会被新 CLI 重写状态文件而污染。
18
+ */
19
+ export function isLegacyChange(state) {
20
+ return state?.schema_version == null;
21
+ }
22
+
23
+ /** v0.13 §48.2:显式 skip 必须附理由(可审计豁免)。 */
24
+ export function hasExplicitSkip(state) {
25
+ return state?.test_matrix_skipped === 'true'
26
+ && typeof state?.test_matrix_skip_reason === 'string'
27
+ && state.test_matrix_skip_reason.trim().length > 0;
28
+ }
29
+
30
+ /** skip 已置但理由缺失 → 门禁拒绝并引导补理由。 */
31
+ export function skipMissingReason(state) {
32
+ return state?.test_matrix_skipped === 'true' && !hasExplicitSkip(state);
33
+ }
34
+
35
+ export const SKIP_REASON_HINT =
36
+ "test_matrix_skipped=true requires test_matrix_skip_reason — record it: "
37
+ + "tf state set <dir> test_matrix_skip_reason '<why this change needs no test matrix>'";
38
+
39
+ /** contract 是否声明 '## Test Matrix' 段(不存在时 exists=false)。 */
40
+ export function contractDeclaresTestMatrix(changeDir) {
41
+ const contractPath = path.join(changeDir, 'execution-contract.md');
42
+ if (!fs.existsSync(contractPath)) return { exists: false, declares: false };
43
+ const contract = fs.readFileSync(contractPath, 'utf-8');
44
+ return { exists: true, declares: contract.includes('## Test Matrix') };
45
+ }
46
+
47
+ /** test-matrix.md 存在性与非空性。 */
48
+ export function readTestMatrixFile(changeDir) {
49
+ const matrixPath = path.join(changeDir, 'test-matrix.md');
50
+ if (!fs.existsSync(matrixPath)) return { exists: false, empty: true };
51
+ const content = fs.readFileSync(matrixPath, 'utf-8');
52
+ return { exists: true, empty: content.trim().length === 0 };
53
+ }
@@ -0,0 +1,91 @@
1
+ // scripts/guard/checks/test-matrix-complete.mjs — verify test matrix exists and is consistent
2
+ //
3
+ // v0.13 §48 重写(C1-domain-policy 事件修复,RC-1/RC-3):
4
+ // 豁免键由 contract 内容改为 state schema_version;删除 v0.12 的两条结构性豁免:
5
+ // ✗ "contract 无 '## Test Matrix' 段 → PASS"(内容型豁免,新 change 漏生成矩阵同样命中)
6
+ // ✗ "stored hash 为 null 时短路跳过一致性校验"(矩阵生成后未 rebuild 即无保护)
7
+ // 判定顺序见设计增强方案 v0.13 §48.3。
8
+ import { readState } from '../../lib/state-loader.mjs';
9
+ import { computeTestMatrixHash } from '../../lib/hash.mjs';
10
+ import {
11
+ isLegacyChange,
12
+ skipMissingReason,
13
+ SKIP_REASON_HINT,
14
+ contractDeclaresTestMatrix,
15
+ readTestMatrixFile,
16
+ } from './test-gate-exemptions.mjs';
17
+
18
+ /**
19
+ * Returns { pass, failures[], reason? }.
20
+ */
21
+ export function checkTestMatrixComplete(changeDir) {
22
+ const state = readState(changeDir);
23
+
24
+ // Step 1 — legacy:v0.32.0 之前初始化的 change(无 schema_version 打戳)保留旧行为。
25
+ if (isLegacyChange(state)) {
26
+ return { pass: true, failures: [], reason: 'legacy change — initialized before v0.32.0' };
27
+ }
28
+
29
+ // Step 2 — 显式 skip:必须附理由(可审计豁免)。
30
+ if (state.test_matrix_skipped === 'true') {
31
+ if (skipMissingReason(state)) {
32
+ return { pass: false, failures: [SKIP_REASON_HINT] };
33
+ }
34
+ return { pass: true, failures: [], reason: `explicitly skipped: ${state.test_matrix_skip_reason}` };
35
+ }
36
+
37
+ // Step 3 — 非存量 change 的契约必须声明矩阵(v0.13:内容型豁免删除)。
38
+ const contract = contractDeclaresTestMatrix(changeDir);
39
+ if (!contract.exists) {
40
+ return {
41
+ pass: false,
42
+ failures: ['execution-contract.md is missing — a non-legacy change must have a contract declaring ## Test Matrix'],
43
+ };
44
+ }
45
+ if (!contract.declares) {
46
+ return {
47
+ pass: false,
48
+ failures: [
49
+ 'non-legacy contract must declare ## Test Matrix — return to bridging so contract-builder generates test-matrix.md, '
50
+ + 'or explicitly skip (test_matrix_skipped=true + test_matrix_skip_reason)',
51
+ ],
52
+ };
53
+ }
54
+
55
+ // Step 4 — test-matrix.md 存在且非空。
56
+ const matrix = readTestMatrixFile(changeDir);
57
+ if (!matrix.exists) {
58
+ return {
59
+ pass: false,
60
+ failures: ['test-matrix.md is missing — contract declares ## Test Matrix but no matrix file found'],
61
+ };
62
+ }
63
+ if (matrix.empty) {
64
+ return {
65
+ pass: false,
66
+ failures: ['test-matrix.md is empty — must contain at least a Summary section and Cases table'],
67
+ };
68
+ }
69
+
70
+ // Step 5 — hash 必须已记录(v0.13:删除 state.test_matrix_hash && 的空值短路)。
71
+ // 矩阵在 bridging 阶段生成(晚于 state init),contract-builder 生成后必须 tf state rebuild 捕获 hash。
72
+ const computed = computeTestMatrixHash(changeDir);
73
+ if (!state.test_matrix_hash) {
74
+ return {
75
+ pass: false,
76
+ failures: ["test_matrix_hash not recorded — run 'tf state rebuild' after generating test-matrix.md"],
77
+ };
78
+ }
79
+
80
+ // Step 6 — hash 一致性。
81
+ if (state.test_matrix_hash !== computed) {
82
+ return {
83
+ pass: false,
84
+ failures: [
85
+ `test-matrix.md has been modified since last hash — stored: ${state.test_matrix_hash}, current: ${computed}. Run 'tf state rebuild' to update.`,
86
+ ],
87
+ };
88
+ }
89
+
90
+ return { pass: true, failures: [] };
91
+ }