@xulthekl/team-flow 0.36.4 → 0.38.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 (50) 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 +1 -1
  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 +1 -0
  9. package/CHANGELOG.md +37 -0
  10. package/GEMINI.md +1 -1
  11. package/INSTALL.md +1 -1
  12. package/README.md +1 -1
  13. package/agents/architecture-reviewer.md +16 -6
  14. package/agents/change-split-auditor.md +11 -6
  15. package/agents/code-reviewer.md +7 -6
  16. package/agents/cross-change-consistency-checker.md +11 -6
  17. package/agents/prd-completeness-reviewer.md +11 -6
  18. package/agents/prototype-reviewer.md +11 -6
  19. package/docs/README_en.md +1 -1
  20. package/docs/solutions/INDEX.md +1 -0
  21. package/docs/solutions/cross-phase/2026-08-06-no-summary.md +17 -0
  22. package/gemini-extension.json +1 -1
  23. package/hooks/session-start +2 -2
  24. package/llms.txt +1 -1
  25. package/package.json +1 -1
  26. package/plugin.json +1 -1
  27. package/scripts/lib/cmd-prototype.mjs +227 -0
  28. package/scripts/lib/cmd-publish.mjs +254 -0
  29. package/scripts/lib/prototype-sync.mjs +41 -2
  30. package/scripts/lib/test-matrix-export.mjs +5 -0
  31. package/scripts/lib/test-merge.mjs +130 -93
  32. package/scripts/team-flow.mjs +8 -0
  33. package/skills/architecture-design/references/s3.5-product-architecture.md +9 -0
  34. package/skills/build-executor/SKILL.md +7 -0
  35. package/skills/build-executor/implementer-prompt.md +3 -1
  36. package/skills/ce-brainstorm/references/prototype-loop.md +2 -2
  37. package/skills/code-reviewer/SKILL.md +4 -3
  38. package/skills/code-reviewer/code-reviewer-prompt.md +2 -2
  39. package/skills/contract-builder/SKILL.md +19 -4
  40. package/skills/e2e/SKILL.md +2 -0
  41. package/skills/prototype/SKILL.md +4 -3
  42. package/skills/prototype/references/orchestration-flow.md +2 -2
  43. package/skills/release-archivist/SKILL.md +25 -6
  44. package/skills/spec-writer/SKILL.md +12 -8
  45. package/skills/test-strategy/SKILL.md +2 -1
  46. package/skills/test-strategy/references/design-methods-detail.md +1 -0
  47. package/skills/test-strategy/references/test-quality-rules.md +1 -0
  48. package/skills/workflow-orchestrator/references/s2-prd-prototype-loop.md +11 -2
  49. package/skills/workflow-orchestrator/references/s4-split-validate.md +9 -0
  50. package/skills/workflow-start/SKILL.md +10 -1
@@ -46,9 +46,11 @@ Compare contract batches against actual diff. Every SHALL/MUST must have impleme
46
46
 
47
47
  If `test-matrix.md` exists:
48
48
  1. **Statistics**: total cases / implemented / passed
49
- 2. **Candidate Coverage Ledger audit**: any `decision=deferred` without reasonable reason?
50
- 3. **Complexity tier check**: cases per module meet minimum (trivial≥3 / medium≥5 / complex≥7)?
51
- 4. **Verdict**:
49
+ 2. **E2E 层豁免(v0.38.0)**:`test_tier=e2e` case coverage 分母豁免,单列统计 `e2e cases: implemented N/M(经 Step 5b 验证)`——E2E 证据由 Step 5b 对账,不参与本步骤 100%/90% 判定
50
+ 3. **Candidate Coverage Ledger audit**: any `decision=deferred` without reasonable reason?
51
+ 4. **Complexity tier check**: cases per module meet minimum (trivial≥3 / medium≥5 / complex≥7)?(E2E case 不参与模块用例数下限判定)
52
+ 5. **分母为 0 兜底(v0.38.0)**:纯 e2e change(无 unit/integration case,分母为 0)时,本步骤以 Step 5b E2E 验证结果为准,不判 FAIL(E2E 不替代低层级测试,但边界场景不卡死)
53
+ 6. **Verdict**:
52
54
  - Matrix coverage = 100% AND all cases pass → **PASS**
53
55
  - Matrix coverage ≥ 90% with reasonable deferred items → **CONDITIONAL (WARN)**
54
56
  - Matrix coverage < 90% OR unexplained gaps → **FAIL**
@@ -82,12 +84,20 @@ Check for files modified outside scope fence, new dependencies not in design. Un
82
84
  - CONDITIONAL → present WARNs, proceed only with user acceptance
83
85
  - PASS → proceed to final checks
84
86
 
85
- ### Step 5b: E2E Verification (optional, v0.4)
86
- If an `e2e/` suite exists for the change, fold its report into verification (see design spec ch.16):
87
+ ### Step 5b: E2E Verification (conditional, v0.38.0 起由"存在 e2e/ 套件"改为"矩阵含 E2E case"触发)
88
+
89
+ 检测 `test-matrix.md` 是否含 `test_tier=e2e` 的 case:
90
+ 1. **无 E2E case** → 跳过(本步骤不执行)
91
+ 2. **有 E2E case 且已有 e2e 报告**(`docs/statistics/YYYY-MM-DD-e2e-report.md` 存在)→ 折进验证(见下)
92
+ 3. **有 E2E case 且无 e2e 报告** → **AskUserQuestion 阻塞确认**:"test-matrix 含 {N} 个 E2E case,是否执行 E2E 测试?"
93
+ - **是** → 引导执行 `/e2e`(e2e skill:AC 提取 → Playwright 脚本 → 执行 → 报告 `docs/statistics/YYYY-MM-DD-e2e-report.md`),报告产生后回填本步骤验证
94
+ - **否** → 记录 E2E skip + 理由(如环境不具备/本期不做),报告行 `| E2E | SKIP | [reason] |`(不 FAIL)
95
+
96
+ 有 E2E 报告时的验证逻辑(4 级判定与门禁内联于此;design spec ch.16 仅概述):
87
97
  - Read `docs/statistics/YYYY-MM-DD-e2e-report.md`: AC coverage / four-dimension coverage (EX/ST/BND) / type distribution / uncovered list / failure root-cause (test issue vs implementation issue).
88
98
  - **4-level artifact verification** (L1 existence / L2 substance / L3 wiring / L4 dataflow → VERIFIED/HOLLOW/ORPHANED/STUB/MISSING): compare `architecture-design` outputs (API/DB design docs) against actual code; STUB/MISSING = BLOCKER, HOLLOW/ORPHANED = WARNING.
89
99
  - **Graded gate**: prototype-phase AC≥80% (HP required, EX/ST/BND non-blocking if absent); integration-phase AC≥95% / EX≥80% / ST≥90% / BND≥75% (AC/EX = BLOCKER, ST/BND = WARNING).
90
- - Add a report row: `| E2E | PASS/FAIL/WARN | [coverage summary] |`.
100
+ - Add a report row: `| E2E | PASS/FAIL/WARN/SKIP | [coverage summary or skip reason] |`.
91
101
  - Note: `ce-proof` is the Proof markdown editor — unrelated to verification; do NOT route E2E there.
92
102
 
93
103
  ## Final Checks
@@ -203,6 +213,15 @@ tf solutions capture \
203
213
 
204
214
  This check is advisory — skip silently if no learnable moments are detected.
205
215
 
216
+ ### 阶段产物同步门禁点(v0.37.0 §68.2 G5)
217
+
218
+ 回写链(arch-merge → prototype-sync → test-merge → compound promotion)全部完成后、`tf state transition closing` 之前,**阻塞确认**(AskUserQuestion)是否同步 change 实施结果(团队协作:落地结果是团队最需要看的内容):
219
+ - **A 提交并推送**:`tf publish --changes <change-dir> --push`
220
+ - **B 仅提交不推送**:`tf publish --changes <change-dir>`(arch-merge/test-merge 已自动 commit,此步补 push)
221
+ - **C 暂不同步**:继续 closing,后续可补
222
+
223
+ 同步对象:实施代码 `changes/<change-dir>/` + arch-merge 回写(docs/architecture/)+ test-ledger(docs/test-ledger/)。**原型独立仓库场景**:若本 change 有 UX 增量回写原型,push 对应 `prd-vN` 分支(`tf prototype branch <prd-vN>` 确认/创建 worktree)。
224
+
206
225
  ### Worktree Deisolation (v0.35.0) — advisory
207
226
 
208
227
  After compound promotion, check if worktree isolation exists for this change:
@@ -11,15 +11,19 @@ Create or refine planning artifacts when the change has moved beyond exploration
11
11
 
12
12
  Read `.team-flow.yaml` (especially `dp_0_decisions`, `dp_0_confirmed`) and any existing planning artifacts. If `dp_0_confirmed` is not `true`, stop and route back to `workflow-start` for DP-0.
13
13
 
14
- ### Global Prototype Reading (v0.5)
14
+ ### Global Prototype Reading (v0.5, v0.37.0 版本化)
15
15
 
16
- Before generating artifacts, check if a global prototype exists:
17
- 1. Read `prototype/flow.md` if it exists this defines page navigation and user flows
18
- 2. List `prototype/pages/` directory these are the UI contract pages
19
- 3. Read `prototype/design-system.md` if it exists — component and token definitions
20
- 4. Store as UI contract context for design.md and tasks.md generation
16
+ Before generating artifacts, **resolve the PRD version and locate the prototype worktree**:
17
+ 1. **版本推导(v0.37.0 §68.5)**:读 `change-brief.md` `upstream_plan_ref: prd/vN/plan.md`(无 brief 时从 change 目录名 `v{N}-` 前缀推导)→ PRD 版本 vN
18
+ 2. **原型定位**:原型为独立仓库(有远程),版本 worktree = `<workspace>/.worktrees/prd-vN/prototype/`(该 worktree 不存在时回退 `<workspace>/prototype/` 并提示"原型应位于版本 worktree,`tf prototype branch <prd-vN>` 创建")
19
+ 3. Read `prototype/flow.md` if it exists — this defines page navigation and user flows
20
+ 4. List `prototype/pages/` directory these are the UI contract pages
21
+ 5. Read `prototype/design-system.md` if it exists — component and token definitions
22
+ 6. Store as UI contract context for design.md and tasks.md generation
21
23
 
22
- If `prototype/` does not exist or is empty, skip silently — not all projects have prototypes.
24
+ If no prototype exists or it is empty, skip silently — not all projects have prototypes.
25
+
26
+ **制品引用约定(v0.37.0 §68.5)**:design.md / tasks.md 中引用原型保留 `prototype/<rel>` 相对写法(可读性),但 `## UI Contract` / `**Prototype:**` 段必须**声明本 change 所属 PRD 版本 vN + 原型 worktree 路径**——实施阶段(build-executor)据此定位同一份原型,避免指向主干旧版本或空目录。
23
27
 
24
28
  ### Solutions Index (v0.5)
25
29
 
@@ -88,7 +92,7 @@ Every requirement must be testable. Use SHALL or MUST. Every requirement must ha
88
92
 
89
93
  Optional structured AC tags under a Scenario are supported for E2E extraction (v0.4, design spec ch.16): `##### Exception:` (→ EX AC, ×2), `##### State:` (→ ST AC, ×2), `##### Boundary:` (→ BND AC, ×1). These are **OPTIONAL** — omitting them does NOT fail validation. The `e2e` skill applies dimension-conditional gating (absent dimension = N/A, not 0%) plus keyword fallback (error/invalid/fail/边界), so no spec is forced to add tags.
90
94
 
91
- Optional test-dimension tags under a Scenario are supported for test-matrix extraction (v0.12 §44.1): `##### Unit:` (→ unit test hints: equivalence classes, boundary values), `##### Integration:` (→ integration test hints: cross-module, transaction boundaries). These are **OPTIONAL** — omitting them does NOT fail validation. The `contract-builder` extracts matrix skeletons from these tags when present, but does not require them.
95
+ Optional test-dimension tags under a Scenario are supported for test-matrix extraction (v0.12 §44.1): `##### Unit:` (→ unit test hints: equivalence classes, boundary values), `##### Integration:` (→ integration test hints: cross-module, transaction boundaries), `##### E2E:` (→ e2e test hints: UI interaction / cross-layer flows; v0.38.0, test_tier=e2e). These are **OPTIONAL** — omitting them does NOT fail validation. The `contract-builder` extracts matrix skeletons from these tags when present, but does not require them.
92
96
 
93
97
  ### design.md
94
98
  Must have: Context (current state, constraints, stakeholders), Goals, Decisions (Choice + Rationale + Alternatives considered), Risks And Trade-Offs.
@@ -42,7 +42,8 @@ user-invocable: false
42
42
 
43
43
  - unit(test_tier=unit):70-80% 的 case
44
44
  - integration(test_tier=integration):≤30% 的 case
45
- - e2e:由 e2e skill 独立覆盖,不计入本矩阵
45
+ - e2e(test_tier=e2e,v0.38.0):含 **UI 交互/跨层链路**的 AC(如上下分栏联动、导出端到端、权限 403 端到端)必须显式评估 E2E 必要性——**纳入 E2E case 或记录排除理由**(不静默跳过)。E2E case 沿用标准 12 列格式,`test_tier=e2e`、case_id `{Module}-e2e-{scene}-{NNN}`(3 连字符 + 数字结尾,满足复利台账计数)、mock 列填 `-`。
46
+ - **金字塔分母 = unit + integration**(e2e 不计入金字塔配比,避免稀释 unit 占比判定)。
46
47
 
47
48
  ## 4. 对抗验证三招(矩阵生成后必检)
48
49
 
@@ -179,5 +179,6 @@ CANCELLED ←──────────────┘ (仅 PAID 前可取
179
179
  | service_social, repository_h2 | integration |
180
180
  | rabbitmq_social, redis_social | integration |
181
181
  | external_api_stub, test_infrastructure | integration |
182
+ | playwright_prototype, playwright_integration(v0.38.0) | e2e |
182
183
 
183
184
  **用途**:test_tier 用于统计和 CI 分级;test_kind 用于路由到正确的编写模板。
@@ -226,6 +226,7 @@ class UserServiceCreateUserTest { ... }
226
226
 
227
227
  **检查**:
228
228
  - case 声明的 `test_tier` 与实际测试文件不符(如 unit case 写到了集成测试文件)
229
+ - `test_tier=e2e` 的 case 合法落点是 `e2e/` 目录(Playwright spec,v0.38.0)——落在普通单元/集成测试文件里算 mismatch
229
230
 
230
231
  ### 12. evidence-not-in-method
231
232
 
@@ -82,6 +82,15 @@ PRD草稿生成后:
82
82
 
83
83
  设置 `frozen_downstream`(见 state-model.md「双层冻结」)。冻结后,**迭代内变更不升版**,在 vN 内修订 + 记录决策/变更履历。
84
84
 
85
+ ### 4.5 阶段产物同步门禁点(v0.37.0 §68.2 G1)
86
+
87
+ S2 冻结后,**阻塞确认**(AskUserQuestion)是否同步阶段产物(团队协作:PRD+原型是需求讨论基线):
88
+ - **A 提交并推送**:`tf publish --prd --push`;原型为独立仓库时先 `tf prototype branch <prd-vN>` 确认/创建版本 worktree(迭代完成 push `prd-vN` 分支供团队查看者 `tf prototype branch <prd-vN>` 一键拉取)
89
+ - **B 仅提交不推送**:`tf publish --prd`
90
+ - **C 暂不同步**:继续 S3,后续可补
91
+
92
+ 同步对象:`prd/vN/` + 原型(push `prd-vN` 分支)+ `.team-flow/`(orchestrator.yaml / registry.yaml)。
93
+
85
94
  ### 5. 复利捕获
86
95
 
87
96
  检测可复利时刻(需求矛盾、原型返工、自动评审发现不一致并修正等)。每次自动评审发现不一致并修正后触发:
@@ -97,8 +106,8 @@ tf solutions capture --phase prd --domain <domain> --type pitfall --severity <se
97
106
 
98
107
  ## 原型自动评审(§17.10)
99
108
 
100
- **实现形式**:独立 `prototype-reviewer` agent(只读审查员,对齐 code-reviewer 模式)。
101
- - tools: Read, Bash, Grep, Glob(**无 Write**,报告写在 final response,编排层落盘)
109
+ **实现形式**:独立 `prototype-reviewer` agent(对齐 code-reviewer 模式)。
110
+ - tools: Read, Bash, Grep, Glob, Write(直接写审查报告文件)
102
111
  - 独立上下文运行,未参与 PRD/原型产出(规避锚定效应)
103
112
  - 两阶段检查:Pre-check(Bash 结构化预检,D1/D4 机械化)+ Deep-check(LLM 六维度语义对比,D2/D3/D5/D6 标注为「建议级,误报可被人工推翻」)
104
113
 
@@ -137,6 +137,15 @@ Change C1 已就绪,运行 /workflow-start 进入变更级流程。
137
137
  执行顺序建议:C1 → (C2 ∥ C3) → C4(C2/C3 可并行)
138
138
  ```
139
139
 
140
+ ### 5.5 阶段产物同步门禁点(v0.37.0 §68.2 G3)
141
+
142
+ S4 分发完成(orchestrator 结束)后,**阻塞确认**(AskUserQuestion)是否同步阶段产物(团队协作:成员领取任务的前提):
143
+ - **A 提交并推送**:`tf publish --changes --push`
144
+ - **B 仅提交不推送**:`tf publish --changes`
145
+ - **C 暂不同步**:结束编排,后续可补
146
+
147
+ 同步对象:`changes/*/`(脚手架 + change-brief.md)+ `.team-flow/`(change_dag / orchestrator.yaml)= 任务分发(成员领取)。
148
+
140
149
  ## 完成条件
141
150
 
142
151
  - change-split-auditor 审计 verdict = PASS(必选门禁已通过,含 v0.9 D5 拆分维度合规)
@@ -78,7 +78,7 @@ Guard: `arch_design_decision` in `.team-flow.yaml` is `null` → must run before
78
78
  > **⛔ 串行约束(v0.30.0)**:四步严格串行。**修复子代理(architecture-design)完成前 MUST NOT dispatch 审查子代理(architecture-reviewer)**——并行会使审查跑在修复之前、误报"全部未修复"FAIL(来源:workflow-feedback 2026-08-01)。并行白名单:仅多个独立 change 的工作可并行;修复→审查、设计→审查必须串行。
79
79
 
80
80
  1. **Dispatch**: `architecture-design` as sub-agent(**输入含 `docs/architecture/iterations/<vN>/architecture.md` 产品级架构快照**,v0.36.0——变更级只引用产品级聚合注册表,不重定义)→ returns `decision` + `reason` + `artifacts`。**⛔ 记录子代理 ID**(后续循环修正和 DP-A 调整必须通过此 ID 恢复,禁止启动新子代理)
81
- 2. **Auto-review** (decision=required 时触发): 校验产物文件存在且非空 → dispatch `architecture-reviewer` sub-agent(**记录子代理 ID**)→ FAIL 则通过 **SendMessage 恢复原 architecture-design 子代理**修正(≤3 轮 + 收敛检测,不收敛转人工)→ 报告落盘 `changes/<name>/architecture/auto-review.md`
81
+ 2. **Auto-review** (decision=required 时触发): 校验产物文件存在且非空 → dispatch `architecture-reviewer` sub-agent(**记录子代理 ID**,agent 会直接写审查报告到 `changes/<name>/architecture/auto-review.md`)→ FAIL 则通过 **SendMessage 恢复原 architecture-design 子代理**修正(≤3 轮 + 收敛检测,不收敛转人工)
82
82
  3. **Reasonableness check + state write**: PASS/PASS_WITH_WARNINGS → write `arch_design_decision` + `arch_review_*` to yaml; skipped + brief 含架构关键词 → BLOCK; required + artifacts 缺失 → BLOCK; required + auto-review FAIL → BLOCK
83
83
  4. **DP-A 用户确认门(v0.29.0 §37)**: 输出架构决策摘要 → AskUserQuestion 确认 → 需要调整时**必须通过 SendMessage 恢复原子代理**修改(禁止主代理直接修改,禁止启动新子代理)→ 修改后 SendMessage 恢复原 reviewer 重新 auto-review → 回到本步骤重新确认。含项目规范变更提示(advisory)。详见 `references/routing-rules.md`「Step 4: DP-A」
84
84
 
@@ -93,6 +93,15 @@ Guard: `... check <dir> specifying bridging --json` → fail = BLOCK. Artifacts
93
93
  ### Route to build-executor (dispatch sub-agent)
94
94
  Contract exists and approved, contract matches artifacts. Include `DP-4: 执行模式选择`: propose waves, run `tf execution recommend <change-dir> [--wave ...]`, show the user every available mode plus evidence and the recommendation, then obtain a clear selection. The command saves a current receipt; before the first implementation edit, `build-executor` must run `tf execution plan <change-dir> --mode <selected> --confirm ...` (and `--acknowledge-recommendation` when the selected mode differs from the recommendation) using matching artifacts, contract, and waves, then `tf execution show <change-dir> --json`; report the saved revision, selected mode, recommendation alignment, ordered waves, and actual concurrent-dispatch capability. A revision must repeat recommend and confirmation. Do not transition to `executing` until `show` reports `current: true`; then run `... check <dir> approved-for-build executing --json` → fail = BLOCK. **v0.13 §49 门禁前移**:该 guard 含 `test-matrix-ready` 维度——full 模式非存量 change 必须"带着矩阵开工"(矩阵存在非空 OR 显式 skip 附理由);FAIL 时回 bridging 让 contract-builder 补矩阵,或按指引显式 skip,禁止绕过。
95
95
 
96
+ ### 阶段产物同步门禁点(v0.37.0 §68.2 G4)
97
+
98
+ 契约批准(DP-3)后、进入实施(DP-4)前,**阻塞确认**(AskUserQuestion)是否同步 change 规划制品(团队协作:契约是实施授权):
99
+ - **A 提交并推送**:`tf publish --changes <change-dir> --push`
100
+ - **B 仅提交不推送**:`tf publish --changes <change-dir>`
101
+ - **C 暂不同步**:直接进入实施,后续可补
102
+
103
+ 同步对象:change 规划制品 4+1(proposal / specs / design / tasks / execution-contract)+ `architecture/`。
104
+
96
105
  ### Route to bug-investigator
97
106
  Execution hit blockage: test failure, unexpected behavior, build error, task cannot proceed. After debugging, route back to build-executor.
98
107