@xulthekl/team-flow 0.30.0 → 0.31.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.
Files changed (40) hide show
  1. package/.claude/always/phase-guard.md +1 -1
  2. package/.claude-plugin/marketplace.json +1 -1
  3. package/.claude-plugin/plugin.json +2 -2
  4. package/.codex-plugin/plugin.json +1 -1
  5. package/.cursor-plugin/marketplace.json +1 -1
  6. package/.cursor-plugin/plugin.json +1 -1
  7. package/.github/plugin/marketplace.json +2 -2
  8. package/AGENTS.md +2 -1
  9. package/CHANGELOG.md +38 -0
  10. package/GEMINI.md +1 -1
  11. package/INSTALL.md +1 -1
  12. package/README.md +2 -2
  13. package/agents/build-executor.md +1 -0
  14. package/docs/README_en.md +1 -1
  15. package/gemini-extension.json +1 -1
  16. package/hooks/session-start +2 -2
  17. package/llms.txt +1 -1
  18. package/package.json +1 -1
  19. package/plugin.json +2 -2
  20. package/scripts/guard/checks/test-matrix-complete.mjs +67 -0
  21. package/scripts/guard/guard.mjs +5 -1
  22. package/scripts/lib/cmd-state.mjs +9 -4
  23. package/scripts/lib/hash.mjs +11 -0
  24. package/scripts/lib/state-loader.mjs +12 -1
  25. package/scripts/lib/test-matrix-export.mjs +231 -0
  26. package/scripts/lib/test-merge.mjs +540 -0
  27. package/scripts/team-flow.mjs +6 -0
  28. package/skills/build-executor/implementer-prompt.md +38 -3
  29. package/skills/code-reviewer/SKILL.md +28 -1
  30. package/skills/code-reviewer/code-reviewer-prompt.md +10 -0
  31. package/skills/contract-builder/SKILL.md +76 -0
  32. package/skills/release-archivist/SKILL.md +35 -2
  33. package/skills/spec-writer/SKILL.md +3 -1
  34. package/skills/test-strategy/SKILL.md +70 -0
  35. package/skills/test-strategy/references/adversarial-patterns.md +0 -0
  36. package/skills/test-strategy/references/complexity-grading.md +137 -0
  37. package/skills/test-strategy/references/design-methods-detail.md +183 -0
  38. package/skills/workflow-orchestrator/references/s1-path-router.md +4 -0
  39. package/skills/workflow-start/references/routing-rules.md +17 -0
  40. package/tests/lib/cmd-install-workbuddy.test.mjs +1 -1
@@ -1,3 +1,3 @@
1
- # team-flow v0.30.0 | 阶段: {{state}} | 工作流: {{workflow}}
1
+ # team-flow v0.31.0 | 阶段: {{state}} | 工作流: {{workflow}}
2
2
  当前阶段允许的操作由 workflow-start 路由规则定义。
3
3
  禁止跨越 DP gate 进入下一阶段。变更范围以 execution-contract.md 的 Intent Lock 为准。
@@ -9,7 +9,7 @@
9
9
  {
10
10
  "name": "team-flow",
11
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",
12
+ "version": "0.31.0",
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.31.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
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.31.0",
4
4
  "description": "Spec-first workflow that bridges OpenSpec-style planning and Superpowers-style execution discipline.",
5
5
  "author": {
6
6
  "name": "MageByte",
@@ -5,7 +5,7 @@
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.31.0"
9
9
  },
10
10
  "plugins": [
11
11
  {
@@ -2,7 +2,7 @@
2
2
  "name": "team-flow",
3
3
  "displayName": "team-flow",
4
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",
5
+ "version": "0.31.0",
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.31.0"
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.31.0",
16
16
  "source": ".",
17
17
  "author": {
18
18
  "name": "LT",
package/AGENTS.md CHANGED
@@ -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,44 @@ The format loosely follows Keep a Changelog.
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.31.0] - 2026-08-01
10
+
11
+ ### Added(设计增强方案 v0.12 §40-§46 测试矩阵驱动开发 + 测试复利闭环)
12
+
13
+ #### test-strategy skill(24→25 skills)
14
+ - **skills/test-strategy/**:新建测试设计方法论 skill(≤50 行硬规则),含 3 个 references:design-methods-detail.md(10+1 种 design_method 详细说明)、complexity-grading.md(复杂度分级规则 + 圈复杂度计算)、adversarial-patterns.md(对抗验证三招 + 攻击向量模板)
15
+ - **agents/build-executor.md**:frontmatter `skills` 新增 `test-strategy` 预加载
16
+
17
+ #### test-matrix.md 附属产物
18
+ - **skills/contract-builder/SKILL.md**:新增 Test Matrix Generation 段(12 列格式 + 候选覆盖台账 + 对抗验证段 + GLAF4 Java 路由)
19
+ - **skills/spec-writer/SKILL.md**:新增 Unit/Integration 可选标签(test-matrix 提取 hints)
20
+ - **scripts/lib/hash.mjs**:新增 `computeTestMatrixHash()`(独立于 artifacts_hash,避免自循环)
21
+ - **scripts/lib/state-loader.mjs**:BUILTIN_DEFAULTS 新增 `test_matrix_hash` / `test_matrix_skipped`
22
+ - **scripts/lib/cmd-state.mjs**:SETTABLE_FIELDS 新增 `test_matrix_skipped`;init 计算 test_matrix_hash
23
+
24
+ #### build-executor 按矩阵 TDD
25
+ - **skills/build-executor/implementer-prompt.md**:新增 Test Matrix Protocol 段(TDD/CHARACTERIZATION/REGRESSION 三种 work_mode + 两不原则 + 五步闭环 + 矩阵覆盖率自检)
26
+
27
+ #### code-reviewer Test Matrix Compliance
28
+ - **skills/code-reviewer/SKILL.md**:新增 Step 5b Test Matrix Compliance(case-by-case 验证 + 覆盖率计算 + 候选台账审计 + 金字塔比例检查)
29
+ - **skills/code-reviewer/code-reviewer-prompt.md**:reviewer prompt 新增 Test Matrix Compliance 检查段
30
+
31
+ #### release-archivist Test Matrix Reconciliation
32
+ - **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
33
+
34
+ #### guard 维度 test-matrix-complete
35
+ - **scripts/guard/checks/test-matrix-complete.mjs**:新建检查(~55 行),4 条豁免路径(显式 skip / 存量兼容 / 无 contract / hash 一致)
36
+ - **scripts/guard/guard.mjs**:`executing:closing` 新增 `test-matrix-complete`(full 考核 7 维度);hotfix `executing:closing` 新增(6 维度,豁免 test-matrix-complete);tweak 保持 3 维度不变
37
+
38
+ #### 测试复利闭环(test-ledger + test-merge)
39
+ - **scripts/lib/test-merge.mjs**:新建 6 步流程(preCheck → mergeBaselines → resolveDeferred → appendChangelog → rewriteIndex → gitCommit)
40
+ - **scripts/lib/test-matrix-export.mjs**:新建 glaf4 JSON → team-flow Markdown 格式转换(test_kind → test_tier 映射)
41
+ - **scripts/team-flow.mjs**:注册 `test-merge` + `test-matrix-export` 两个新 CLI 命令
42
+
43
+ #### 注入侧
44
+ - **skills/workflow-orchestrator/references/s1-path-router.md**:新增「测试台账注入」段(读取 docs/test-ledger/INDEX.md,注入 partial 模块列表)
45
+ - **skills/workflow-start/references/routing-rules.md**:新增「Route to glaf4-tests」段(GLAF4 Java 项目可选 glaf4-tests design stage)
46
+
9
47
  ## [0.30.0] - 2026-08-01
10
48
 
11
49
  ### 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.31.0 | 阶段: {{state}} | 工作流: {{workflow}}
12
12
  当前阶段允许的操作由 workflow-start 路由规则定义。
13
13
  禁止跨越 DP gate 进入下一阶段。变更范围以 execution-contract.md 的 Intent Lock 为准。
14
14
  <!-- team-flow-phase-guard-end -->
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.31.0**。
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.31.0`
4
4
 
5
5
  > 统一插件:**team-flow**(spec 驱动开发)+ **compound-engineering 核心子集**(全局复利)+ **architecture-design**(4A+DDD 增量设计)+ **prototype**(本地 HTML 原型)+ **e2e**(AC 驱动 E2E)+ **workflow-orchestrator**(产品级编排)+ **workflow-bootstrap**(既有项目接入)。一次安装,七套能力协同。
6
6
 
@@ -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.
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.31.0`
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)
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "team-flow",
3
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",
4
+ "version": "0.31.0",
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.31.0: 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.31.0"
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.31.0.
7
7
 
8
8
  ## Key Documents
9
9
  - README.md: Chinese homepage with full usage guide and FAQ
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xulthekl/team-flow",
3
- "version": "0.30.0",
3
+ "version": "0.31.0",
4
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.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
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.31.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
5
  "author": {
6
6
  "name": "LT"
7
7
  },
@@ -0,0 +1,67 @@
1
+ // scripts/guard/checks/test-matrix-complete.mjs — verify test matrix exists and is consistent
2
+ import fs from 'node:fs';
3
+ import path from 'node:path';
4
+ import { readState } from '../../lib/state-loader.mjs';
5
+ import { computeTestMatrixHash } from '../../lib/hash.mjs';
6
+
7
+ /**
8
+ * Check that test-matrix.md exists and its hash is consistent with state.
9
+ *
10
+ * Exemption paths (v0.12 §45.3):
11
+ * 1. Legacy: execution-contract.md has no "## Test Matrix" section → PASS
12
+ * 2. Explicit skip: test_matrix_skipped === 'true' → PASS
13
+ * 3. test-matrix.md exists and hash matches → PASS
14
+ * 4. test-matrix.md missing or hash mismatch → FAIL
15
+ *
16
+ * Returns { pass, failures[], reason? }.
17
+ */
18
+ export function checkTestMatrixComplete(changeDir) {
19
+ const state = readState(changeDir);
20
+
21
+ // Exemption 1: explicit skip
22
+ if (state.test_matrix_skipped === 'true') {
23
+ return { pass: true, failures: [], reason: 'explicitly skipped via test_matrix_skipped' };
24
+ }
25
+
26
+ // Exemption 2: legacy contract without Test Matrix section
27
+ const contractPath = path.join(changeDir, 'execution-contract.md');
28
+ if (fs.existsSync(contractPath)) {
29
+ const contract = fs.readFileSync(contractPath, 'utf-8');
30
+ if (!contract.includes('## Test Matrix')) {
31
+ return { pass: true, failures: [], reason: 'legacy contract — no test matrix section' };
32
+ }
33
+ } else {
34
+ // No contract at all — nothing to check
35
+ return { pass: true, failures: [], reason: 'no execution contract — skipping test matrix check' };
36
+ }
37
+
38
+ // Check test-matrix.md exists and is non-empty
39
+ const matrixPath = path.join(changeDir, 'test-matrix.md');
40
+ if (!fs.existsSync(matrixPath)) {
41
+ return {
42
+ pass: false,
43
+ failures: ['test-matrix.md is missing — contract declares ## Test Matrix but no matrix file found'],
44
+ };
45
+ }
46
+
47
+ const content = fs.readFileSync(matrixPath, 'utf-8');
48
+ if (content.trim().length === 0) {
49
+ return {
50
+ pass: false,
51
+ failures: ['test-matrix.md is empty — must contain at least a Summary section and Cases table'],
52
+ };
53
+ }
54
+
55
+ // Hash consistency check
56
+ const computed = computeTestMatrixHash(changeDir);
57
+ if (state.test_matrix_hash && state.test_matrix_hash !== computed) {
58
+ return {
59
+ pass: false,
60
+ failures: [
61
+ `test-matrix.md has been modified since last hash — stored: ${state.test_matrix_hash}, current: ${computed}. Run 'tf state rebuild' to update.`,
62
+ ],
63
+ };
64
+ }
65
+
66
+ return { pass: true, failures: [] };
67
+ }
@@ -14,6 +14,7 @@ import { checkDp3Approved } from './checks/dp3-approved.mjs';
14
14
  import { checkExecutionPlanReady } from './checks/execution-plan-ready.mjs';
15
15
  import { checkExecutionReviewsPassed } from './checks/execution-reviews-passed.mjs';
16
16
  import { checkCompoundCaptured } from './checks/compound-captured.mjs';
17
+ import { checkTestMatrixComplete } from './checks/test-matrix-complete.mjs';
17
18
 
18
19
  // Transition matrix: <from>:<to> → required check dimensions
19
20
  const TRANSITION_CHECKS = {
@@ -22,7 +23,7 @@ const TRANSITION_CHECKS = {
22
23
  'specifying:bridging': ['artifacts-exist', 'schema-valid'],
23
24
  'bridging:approved-for-build': ['artifacts-exist', 'schema-valid', 'contract-fresh', 'dp-gate-passed'],
24
25
  'approved-for-build:executing': ['artifacts-exist', 'contract-fresh', 'dp-gate-passed', 'execution-plan-ready'],
25
- 'executing:closing': ['tasks-complete', 'tests-passing', 'specs-merged', 'execution-plan-ready', 'execution-reviews-passed', 'compound-captured'],
26
+ 'executing:closing': ['tasks-complete', 'tests-passing', 'specs-merged', 'execution-plan-ready', 'execution-reviews-passed', 'compound-captured', 'test-matrix-complete'],
26
27
 
27
28
  // Debugging side-path
28
29
  'executing:debugging': [],
@@ -55,6 +56,8 @@ const WORKFLOW_TRANSITION_CHECKS = {
55
56
  'exploring:bridging': [],
56
57
  'bridging:approved-for-build': ['contract-current', 'dp3-approved'],
57
58
  'approved-for-build:executing': ['contract-current', 'dp3-approved', 'execution-plan-ready'],
59
+ // hotfix exemption: no test-matrix-complete (v0.12 §45.3)
60
+ 'executing:closing': ['tasks-complete', 'tests-passing', 'specs-merged', 'execution-plan-ready', 'execution-reviews-passed', 'compound-captured'],
58
61
  },
59
62
  tweak: {
60
63
  'exploring:approved-for-build': [],
@@ -167,6 +170,7 @@ async function main() {
167
170
  'execution-reviews-passed': (dir) => checkExecutionReviewsPassed(dir),
168
171
  'arch-design': (dir) => checkArchDesign(dir),
169
172
  'compound-captured': (dir) => checkCompoundCaptured(dir),
173
+ 'test-matrix-complete': (dir) => checkTestMatrixComplete(dir),
170
174
  };
171
175
 
172
176
  const checks = [];
@@ -7,7 +7,7 @@ import { fileURLToPath } from 'node:url';
7
7
  // VALID_STATES 统一从 state-loader.mjs 引入(状态机合法值唯一真相源),不再本地硬编码。
8
8
  // 来源:workflow-feedback 2026-08-01,#100005。
9
9
  import { readState, writeState, updateField, rebuildState, VALID_STATES } from './state-loader.mjs';
10
- import { computeArtifactsHash, computeContractHash } from './hash.mjs';
10
+ import { computeArtifactsHash, computeContractHash, computeTestMatrixHash } from './hash.mjs';
11
11
 
12
12
  const __dirname = dirname(fileURLToPath(import.meta.url));
13
13
 
@@ -29,6 +29,8 @@ const SETTABLE_FIELDS = [
29
29
  'dp_a_result', 'dp_a_timestamp', 'dp_a_adjustments',
30
30
  // Compound engineering capture gate (v0.24.0 复利贯穿强制化)
31
31
  'compound_skipped',
32
+ // Test matrix gate (v0.12 §45.4)
33
+ 'test_matrix_skipped',
32
34
  ];
33
35
 
34
36
  export async function run(args) {
@@ -84,15 +86,18 @@ export async function run(args) {
84
86
  }
85
87
  const hash = computeArtifactsHash(changeDir);
86
88
  const ch = computeContractHash(changeDir);
89
+ const tmh = computeTestMatrixHash(changeDir);
87
90
  const state = readState(changeDir);
88
91
  state.artifacts_hash = hash;
89
92
  state.contract_hash = ch;
93
+ // v0.12 §42.5: test_matrix_hash is independent from artifacts_hash
94
+ state.test_matrix_hash = tmh;
90
95
  state.last_transition = new Date().toISOString();
91
96
  writeState(changeDir, state);
92
97
  if (values.json) {
93
- console.log(JSON.stringify({ ok: true, artifacts_hash: hash, contract_hash: ch }));
98
+ console.log(JSON.stringify({ ok: true, artifacts_hash: hash, contract_hash: ch, test_matrix_hash: tmh }));
94
99
  } else {
95
- console.log(`State initialized. artifacts_hash: ${hash}`);
100
+ console.log(`State initialized. artifacts_hash: ${hash}` + (tmh ? `, test_matrix_hash: ${tmh}` : ''));
96
101
  }
97
102
  break;
98
103
  }
@@ -209,7 +214,7 @@ export async function run(args) {
209
214
  break;
210
215
  }
211
216
  case 'rebuild': {
212
- const state = rebuildState(changeDir, { computeArtifactsHash, computeContractHash });
217
+ const state = rebuildState(changeDir, { computeArtifactsHash, computeContractHash, computeTestMatrixHash });
213
218
  if (values.json) {
214
219
  console.log(JSON.stringify({ ok: true, state: state.state }));
215
220
  } else {
@@ -67,6 +67,17 @@ export function computeContractHash(changeDir) {
67
67
  return `sha256:${hash.digest('hex')}`;
68
68
  }
69
69
 
70
+ // Compute SHA256 hash of test-matrix.md alone (v0.12 §42.5).
71
+ // Independent from artifacts_hash to avoid self-circulation:
72
+ // modify matrix → contract stale → rollback bridging → regenerate matrix.
73
+ export function computeTestMatrixHash(changeDir) {
74
+ const matrix = path.join(changeDir, 'test-matrix.md');
75
+ if (!fs.existsSync(matrix)) return null;
76
+ const hash = crypto.createHash('sha256');
77
+ hash.update(fs.readFileSync(matrix, 'utf-8'));
78
+ return `sha256:${hash.digest('hex')}`;
79
+ }
80
+
70
81
  // Fast staleness check: compare stored artifacts_hash against current.
71
82
  export function isContractFresh(changeDir, stateLoader) {
72
83
  const stateFile = path.join(changeDir, '.team-flow.yaml');
@@ -61,6 +61,9 @@ const BUILTIN_DEFAULTS = {
61
61
  dp_a_adjustments: null,
62
62
  // Compound engineering capture gate (v0.24.0 复利贯穿强制化)
63
63
  compound_skipped: null,
64
+ // Test matrix gate (v0.12 §42.5 + §45.4)
65
+ test_matrix_hash: null,
66
+ test_matrix_skipped: null,
64
67
  };
65
68
 
66
69
  /**
@@ -162,6 +165,10 @@ export function writeState(changeDir, state) {
162
165
  lines.push('');
163
166
  lines.push('# === Compound engineering capture gate (v0.24.0) ===');
164
167
  lines.push(`compound_skipped: ${state.compound_skipped ?? 'null'}`);
168
+ lines.push('');
169
+ lines.push('# === Test matrix gate (v0.12 §42.5) ===');
170
+ lines.push(`test_matrix_hash: ${state.test_matrix_hash ?? 'null'}`);
171
+ lines.push(`test_matrix_skipped: ${state.test_matrix_skipped ?? 'null'}`);
165
172
 
166
173
  fs.writeFileSync(filePath, lines.join('\n') + '\n', 'utf-8');
167
174
  }
@@ -179,10 +186,14 @@ export function updateField(changeDir, field, value) {
179
186
  * Rebuild state file from artifacts — recomputes hashes.
180
187
  * Requires hash functions to be passed in (avoids circular dependency).
181
188
  */
182
- export function rebuildState(changeDir, { computeArtifactsHash, computeContractHash }) {
189
+ export function rebuildState(changeDir, { computeArtifactsHash, computeContractHash, computeTestMatrixHash }) {
183
190
  const state = readState(changeDir);
184
191
  state.artifacts_hash = computeArtifactsHash(changeDir);
185
192
  state.contract_hash = computeContractHash(changeDir);
193
+ // v0.12 §42.5: test_matrix_hash is independent from artifacts_hash
194
+ if (computeTestMatrixHash) {
195
+ state.test_matrix_hash = computeTestMatrixHash(changeDir);
196
+ }
186
197
  writeState(changeDir, state);
187
198
  return state;
188
199
  }