@xulthekl/team-flow 0.63.0 → 0.65.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 (80) 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/.github/workflows/ci.yml +2 -0
  9. package/CHANGELOG.md +57 -0
  10. package/GEMINI.md +1 -1
  11. package/INSTALL.md +1 -1
  12. package/README.md +1 -1
  13. package/agents/architecture-design.md +1 -1
  14. package/agents/architecture-reviewer.md +2 -2
  15. package/docs/README_en.md +1 -1
  16. package/docs/state-machine.md +4 -1
  17. package/docs/team-flow /344/275/277/347/224/250/350/257/264/346/230/216/357/274/210/347/240/224/345/217/221/345/233/242/351/230/237/347/211/210/357/274/211.md" +2 -2
  18. package/gemini-extension.json +1 -1
  19. package/hooks/session-start +2 -2
  20. package/llms.txt +1 -1
  21. package/package.json +1 -1
  22. package/plugin.json +1 -1
  23. package/scripts/guard/checks/_fs-utils.mjs +18 -0
  24. package/scripts/guard/checks/arch-design-light.mjs +39 -0
  25. package/scripts/guard/checks/arch-gate-exemptions.mjs +5 -3
  26. package/scripts/guard/checks/arch-merged-light.mjs +67 -0
  27. package/scripts/guard/checks/arch-readiness.mjs +1 -1
  28. package/scripts/guard/checks/arch-snapshot-light.mjs +30 -0
  29. package/scripts/guard/checks/arch-snapshot.mjs +5 -3
  30. package/scripts/guard/checks/artifacts-planned.mjs +38 -0
  31. package/scripts/guard/checks/compound-writeback-light.mjs +45 -0
  32. package/scripts/guard/checks/cross-change-consistency-light.mjs +75 -0
  33. package/scripts/guard/checks/direct-short-path.mjs +52 -0
  34. package/scripts/guard/checks/direct-test-result.mjs +30 -0
  35. package/scripts/guard/checks/execution-plan-ready.mjs +7 -1
  36. package/scripts/guard/checks/execution-reviews-passed-light.mjs +28 -0
  37. package/scripts/guard/checks/lightweight-completion-evidence.mjs +27 -0
  38. package/scripts/guard/checks/specs-merged.mjs +25 -1
  39. package/scripts/guard/checks/test-matrix-complete.mjs +27 -1
  40. package/scripts/guard/checks/test-matrix-ready.mjs +28 -1
  41. package/scripts/guard/checks/test-merged-light.mjs +36 -0
  42. package/scripts/guard/guard.mjs +102 -12
  43. package/scripts/infer-workflow.mjs +35 -4
  44. package/scripts/lib/arch-merge.mjs +404 -54
  45. package/scripts/lib/arch-parse.mjs +5 -2
  46. package/scripts/lib/arch-registry.mjs +523 -0
  47. package/scripts/lib/arch-scan-code.mjs +518 -0
  48. package/scripts/lib/cmd-arch.mjs +9 -1
  49. package/scripts/lib/cmd-doctor.mjs +1 -1
  50. package/scripts/lib/cmd-execution.mjs +44 -1
  51. package/scripts/lib/cmd-state.mjs +94 -4
  52. package/scripts/lib/config-loader.mjs +20 -0
  53. package/scripts/lib/execution-plan.mjs +3 -1
  54. package/scripts/lib/state-loader.mjs +43 -0
  55. package/scripts/lib/surface-scan.mjs +156 -0
  56. package/scripts/lib/test-merge.mjs +10 -2
  57. package/scripts/team-flow.mjs +6 -3
  58. package/skills/architecture-design/SKILL.md +29 -11
  59. package/skills/architecture-design/chapters/ch04-entity-to-aggregate.md +18 -7
  60. package/skills/architecture-design/chapters/ch06-integration.md +12 -3
  61. package/skills/architecture-design/glossary.md +5 -1
  62. package/skills/architecture-design/references/adr-templates.md +56 -0
  63. package/skills/architecture-design/references/context-map-8.md +47 -0
  64. package/skills/architecture-design/references/ddd-evented-playbook.md +41 -0
  65. package/skills/architecture-design/references/s3.5-architecture-template.md +36 -4
  66. package/skills/architecture-design/references/s3.5-loading-protocol.md +5 -4
  67. package/skills/architecture-design/references/s3.5-product-architecture.md +6 -6
  68. package/skills/architecture-design/templates/architecture.md +20 -0
  69. package/skills/ce-compound/references/concepts-vocabulary.md +1 -1
  70. package/skills/ce-compound/references/full-mode-workflow.md +2 -2
  71. package/skills/ce-compound/references/lightweight-mode.md +1 -1
  72. package/skills/clean-code/SKILL.md +1 -1
  73. package/skills/jarvis/SKILL.md +2 -0
  74. package/skills/release-archivist/SKILL.md +60 -13
  75. package/skills/release-archivist/references/closing-procedures.md +1 -1
  76. package/skills/session-handoff/SKILL.md +1 -0
  77. package/skills/test-strategy/SKILL.md +1 -1
  78. package/skills/workflow-orchestrator/SKILL.md +2 -2
  79. package/skills/workflow-start/SKILL.md +63 -5
  80. package/skills/workflow-start/references/routing-rules.md +4 -4
@@ -79,9 +79,10 @@ Check for files modified outside scope fence, new dependencies not in design. Un
79
79
  - **Prototype sync**: <synced N pages / N components / design-system updated | no UX delta | conflicts: N>
80
80
  - **Compound promotion**: <promoted N / confirmed N / unchanged N / skipped N | no learnings>
81
81
 
82
- **Verdict**: PASS (all PASS) / CONDITIONAL (WARN only) / FAIL (any FAIL).
82
+ **Verdict**: PASS (all PASS) / CONDITIONAL (WARN only) / **ACCEPTED-RISK** / FAIL (any FAIL).
83
83
  - FAIL → fix issues or route back to build-executor
84
84
  - CONDITIONAL → present WARNs, proceed only with user acceptance
85
+ - **ACCEPTED-RISK(v0.64.0,§3.7)**: 用户**显式**拍板「带风险收尾」——三硬条件:① `tf state set <dir> dp_6_result "accepted-risk: <reason>"` + reason 非空(DP-6 段四值格式;`dp_7` 同记)② **不伪造通过**(验证步骤照跑,失败项原样列进 closing 总结的 Known Risks 段)③ **不自动合并**(merge/发布仍走人工)。**作用域:仅非 guard 维度发现——tests-passing/direct-test-result 等门禁失败不被 accepted-risk 放行**(见 DP-6 段)。拒绝空 Git range / 截断 `HEAD~1` / 失效快照充当验证证据。触发仅限 AskUserQuestion 用户选择,**禁止主代理自判 accepted-risk**
85
86
  - PASS → proceed to final checks
86
87
 
87
88
  ### Step 5b: E2E Verification (conditional, v0.38.0 起由"存在 e2e/ 套件"改为"矩阵含 E2E case"触发)
@@ -129,16 +130,20 @@ Check for files modified outside scope fence, new dependencies not in design. Un
129
130
 
130
131
  ### DP-6 (Verification Outcome)
131
132
  ```bash
132
- tf state set <change-dir> dp_6_result "<pass|conditional|fail>: <summary>"
133
+ tf state set <change-dir> dp_6_result "<pass|conditional|fail|accepted-risk>: <summary/reason>"
133
134
  tf state set <change-dir> dp_6_timestamp $(date -u +%Y-%m-%dT%H:%M:%SZ)
134
135
  ```
135
136
  If FAIL, do NOT proceed to DP-7. Route back or ask about abandonment.
136
137
 
138
+ **ACCEPTED-RISK 作用域(v0.64.0,防死锁)**:`accepted-risk` 仅覆盖**非 guard 维度**的发现(文档缺口、非阻断 WARN、已知展示层风险)。**命中 guard 维度的失败不因此放行**——`tests-passing` / `direct-test-result` 只认 `tf test record` 的结构化 pass 证据,测试失败必须修复或转 `abandoned`,否则 `executing→closing` 转换必被阻断(不存在 accepted-risk 放行通道)。reason 写入 `dp_6_result` 的 summary 段与 closing 总结 Known Risks 段。
139
+
137
140
  **测试门禁凭证(v0.13 §50 修订)**:`dp_6_result` 只是决策点记录,不再是 `tests-passing` 门禁的证据(BUG-A 等价通道仅对存量 change 保留)。非存量 change 的 `executing → closing` 放行凭证是 Step 1 中 `tf test record` 写入的结构化 `test_result`(+ 证据文件)。若 Step 1 尚未执行 `tf test record`,先补跑测试套件并记录,再守 DP-6。
138
141
 
139
142
  ### DP-7 (Archive Confirmation)
140
143
  ```bash
141
144
  tf state set <change-dir> dp_7_result "confirmed: <archive summary>"
145
+ # accepted-risk 收尾时同记(与 DP-6 四值一致,reason 非空):
146
+ # tf state set <change-dir> dp_7_result "accepted-risk: <reason>"
142
147
  tf state set <change-dir> dp_7_timestamp $(date -u +%Y-%m-%dT%H:%M:%SZ)
143
148
  ```
144
149
  Verify DP-0 through DP-6 are recorded before DP-7.
@@ -149,8 +154,11 @@ If implementation diverged from the contract, return to `bridging` before closur
149
154
 
150
155
  ## Post-Verification
151
156
 
152
- ### ⚠ 执行顺序(v0.53.0 §110 B' 时序前移 — MUST)
157
+ ### ⚠ 执行顺序(v0.53.0 §110 B' 时序前移 — MUST;v0.64.0 按 variant 分叉,§3.7 唯一真相源)
158
+
159
+ **先读 `workflow_variant` 再选序列**(读法见 workflow-start SKILL「Front Doors」):
153
160
 
161
+ **legacy / full(默认序列,v0.53.0 原序不动):**
154
162
  ```
155
163
  ① tf arch-merge <change-dir> ← 架构增量回写全局台账
156
164
  ② tf state transition <change-dir> closing
@@ -160,7 +168,26 @@ If implementation diverged from the contract, return to `bridging` before closur
160
168
  ⑥ 设计系统待办检查(v0.54.0) ← 只读检查 + 报告,不执行 iterate
161
169
  ```
162
170
 
163
- (各步详细说明见下方对应节标题的 ①–⑤ 编号。)
171
+ **planned(v0.64.0:回写与审查全前置,transition 是最后一步——closing 段 light 维度在 transition 时一次性校验,④⑤ 后置会死锁,B-13):**
172
+ ```
173
+ ① tf arch-merge <change-dir> --light ← 有架构 surface 才跑;持久源 = 最小 architecture.md(+api/database delta)
174
+ ⚠ 前置 ①-pre 语义段照跑(产 .arch-delta.json)——--light 只是消费方,**不得绕过 delta 校验**(P3 M-5 回指)
175
+ ② tf test-merge <change-dir> --light ← 有测试触碰才跑;changelog 首行写 change:<name> 归因锚
176
+ ③ tf solutions capture <args> --source "change:<name>" ← 必执行(归因 = --source;含「无新增决策」空捕获;禁 compound_skipped 自清)
177
+ ④ final-review.md 复核(≥5 行;**回写之后**核验台账条目 vs diff 抽样,B-01/D5)
178
+ ⑤ tf state transition <change-dir> closing ← planned closing 维度表此刻全部满足
179
+ ⑥ tf prototype-sync <change-dir> ← 有原型才跑(closing 后)
180
+ ⑦ 设计系统待办检查(只读)
181
+ ```
182
+
183
+ **direct(v0.64.0:验证记录即证据,回写全跳过——G4 前提 = 无架构 surface):**
184
+ ```
185
+ ① tf state transition <change-dir> closing ← direct 维度表:direct-short-path 扫描 + tf test record 证据 + test-matrix 轻判据
186
+ ② tf prototype-sync / test-merge / solutions promote 全部跳过(若 direct 触及 design-system 共享层 → 提示补 prototype-sync 或升 planned,B-14)
187
+ ③ G5 同步门禁点(阶段产物同步确认)、Workflow Feedback、Deisolation 等**通用收尾步骤照跑**(仅架构/测试/复利三类回写按 direct 跳过)
188
+ ```
189
+
190
+ (legacy/full 各步详细说明见下方对应节标题的 ①–⑤ 编号;planned/direct 分支以本块为唯一真相源。)
164
191
 
165
192
  > **本块是全流程中该顺序的【唯一真相源】**(v0.53.0 §115.10):②③ 两节及「阶段产物同步门禁点」原先各自复述同一顺序串(本文件内共 4 处),是既有的漂移源——`agents/release-archivist.md` 已明文禁止复述,本文件却复述了 4 次。现各处改为指向本块。
166
193
  >
@@ -168,7 +195,27 @@ If implementation diverged from the contract, return to `bridging` before closur
168
195
 
169
196
  **架构快照门禁(arch-snapshot,v0.36.0 / v0.36.3)**:本轮迭代产品级架构快照 `iterations/vN/architecture.md` 必须已落盘("先快照后回写"强制化)。**FAIL 升级路径**:回 orchestrator 的 ARCH 阶段补快照;存量升级在途 change(快照缺失但 change 有增量产物)→ WARN 兜底放行;`arch_baseline` 缺失 → WARN 不阻断。hotfix/tweak 豁免(不挂该维度)。判定逻辑见插件内 `scripts/guard/checks/arch-gate-exemptions.mjs`(引用,非调用)。
170
197
 
171
- ### ① Architecture Merge (v0.10 §28-§31) — MUST run first
198
+ ### ①-pre · 语义段:产 `architecture/.arch-delta.json`(O8 两段式,P0-B'' · 在 ① 之前执行)
199
+
200
+ 在 `tf arch-merge` **之前**,从本 change 的架构制品语义抽取结构化增量,写入
201
+ `changes/<name>/architecture/.arch-delta.json`(schema:`delta_version: 1` + `change` + `generated_at` +
202
+ `entries[]`,每条 = `kind/op/key/fields`,kind ∈ `aggregate|bounded_context|subdomain|table|endpoint|event|context_map`,
203
+ op ∈ `new|extend|refactor|retire`——权威定义见**工作区设计文档**(非本插件运行时)`docs/plan/ddd-purity-and-arch-merge-design.md` §5.4-4c):
204
+
205
+ - **必填纪律(A8 机械层,两类处置不同——P4 Major 修正)**:`new`/`extend` 必带 `evidence`(指向本 change 制品出处,
206
+ 如 `architecture.md:§3.2`;含引用文件存在性)——**软着陆期 evidence 类缺失/路径不存在 → WARN 且条目照常消费**,
207
+ v0.66.0 起 abort;`retire`/`refactor` 必带 `reason`(`refactor` 另必带 `prev_key`)——**此二者属结构错误,
208
+ 缺失立即 abort(无软着陆豁免,结构坏无法安全消费)**。
209
+ - **物理事实无需穷举**:DDL 新表、api.md 新端点由确定段**机械补种**(漏登记会 WARN 提示);
210
+ 但**语义意图只经本制品**——`retire`/`refactor`/字段富化/事件(`event`,经 `fields.owner_aggregate` 挂宿主)/
211
+ 上下文映射(`context_map`,经 `fields.source_bc` 挂宿主)**漏写不会被补种**。
212
+ - **基线/既有键上写 `new` 会被软着陆降级为 `extend`**(R3-3)——扩展既有聚合直接写 `extend`。
213
+ - **确定段零 LLM**:`tf arch-merge` 读本制品 → schema 校验 → 合并进 `docs/architecture/.registry/registry.json`
214
+ (首次自动 seed 既有基线,红牌 12)→ 从 registry 生成下游产物。`--light` 不得绕过本制品的校验。
215
+ - **缺失 = 软着陆期合法**(arch-merge 自动走 legacy 重算路径并登记 WARN);**新 change SHOULD 产出**,
216
+ v0.66.0 起 MUST(硬切,退出条件见设计方案 §5.4-7)。direct 分支跳过回写,不产 delta。
217
+
218
+ ### ① Architecture Merge (v0.10 §28-§31) — MUST run first(legacy/full 序列;planned 走上方 ⚠ 块 ① `--light`,direct 跳过)
172
219
 
173
220
  Merge change-level architecture artifacts to the global `docs/architecture/` baseline **before** the state transition and before any other post-verification step:
174
221
 
@@ -185,13 +232,13 @@ tf state set <change-dir> arch_merge_skipped true
185
232
  tf state set <change-dir> arch_merge_skip_reason "<理由>"
186
233
  ```
187
234
 
188
- ### ② State Transition
235
+ ### ② State Transition(legacy/full 序列)
189
236
 
190
237
  Run `tf state transition <change-dir> closing`. If delta specs exist, route to `spec-merger`.
191
238
 
192
- **顺序(MUST)**:见 `### ⚠ 执行顺序` 的 ①–⑤(**本步是 ②**,前置 ① 已完成)。不得并行——全局文档不得处于半更新态。
239
+ **顺序(MUST)**:见 `### ⚠ 执行顺序` 的 ①–⑤(**本步是 legacy/full 序的 ②**,前置 ① 已完成;planned 序中 transition 是第 ⑤ 步且前置为回写+审查,direct 序中 transition 是唯一步——三分支各不相同,勿跨分支套用)。不得并行——全局文档不得处于半更新态。
193
240
 
194
- ### ③ Prototype Sync (v0.5)
241
+ ### ③ Prototype Sync (v0.5)(legacy/full 序列;planned 为其 ⑥、direct 见例外)
195
242
 
196
243
  After `arch-merge` (①) completes **and the state transition to `closing` (②) has been run**, run prototype-sync to merge UX deltas back to the global prototype:
197
244
 
@@ -199,15 +246,15 @@ After `arch-merge` (①) completes **and the state transition to `closing` (②)
199
246
  tf prototype-sync <change-dir>
200
247
  ```
201
248
 
202
- **顺序(MUST)**:见 `### ⚠ 执行顺序` 的 ①–⑤(**本步是 ③**,①② 已完成)。同一 change closing 内**顺序执行**,不得并行——`docs/architecture/` / `prototype/` / `docs/test-ledger/` 不得处于半更新态,否则下一个 change 会以半态为基。
249
+ **顺序(MUST)**:见 `### ⚠ 执行顺序` 的 ①–⑤(**本步是 legacy/full 序的 ③**,①② 已完成)。同一 change closing 内**顺序执行**,不得并行——`docs/architecture/` / `prototype/` / `docs/test-ledger/` 不得处于半更新态,否则下一个 change 会以半态为基。
203
250
 
204
251
  If `prototype-sync` reports conflicts, list them in the closing summary and flag for manual resolution. Do not block closing on prototype-sync conflicts (advisory level).
205
252
 
206
253
  **Execution verification(v0.24.0)**:`prototype-sync` 命令执行后,检查其 stdout 输出确认合并完成(输出含 `merged`/`no UX delta`/`conflicts` 之一)。若命令未执行或执行失败,Step 5 Report 的 `Prototype sync` 行必须标注 `SKIPPED` 或 `FAILED`,并在 closing summary 中说明原因。**禁止在 prototype-sync 未执行时将 Prototype sync 行标注为已完成**。
207
254
 
208
- ### ④ Test Merge (v0.12 §43)
255
+ ### ④ Test Merge (v0.12 §43)(legacy/full 序列;planned 走 ⚠ 块 ② `--light` 且在 prototype-sync **之前**,direct 跳过)
209
256
 
210
- After `prototype-sync` completes, run test-merge to write test matrix results back to the global test ledger:
257
+ In the legacy/full sequence, run test-merge after `prototype-sync` completes to write test matrix results back to the global test ledger(位置断言仅限 legacy/full 序——planned 序中 test-merge 是第 ② 步、prototype-sync 是第 ⑥ 步,勿跨分支套用):
211
258
 
212
259
  ```bash
213
260
  tf test-merge <change-dir>
@@ -223,7 +270,7 @@ Skip silently when `test-matrix.md` does not exist (legacy change or test_matrix
223
270
 
224
271
  **Execution verification**: check stdout output for `test-merge complete` confirmation. If the command did not execute or failed, Step 5 Report's `Test Matrix` row (from Step 2b) must note the reason.
225
272
 
226
- ### ⑤ Compound Promotion (v0.5)
273
+ ### ⑤ Compound Promotion (v0.5)(legacy/full 序列;planned 走 ⚠ 块 ③ capture `--source`,direct 跳过)
227
274
 
228
275
  Promote change-level learnings to the global solutions library:
229
276
 
@@ -245,7 +292,7 @@ tf solutions promote <change-dir>
245
292
 
246
293
  ### 阶段产物同步门禁点(v0.37.0 §68.2 G5)
247
294
 
248
- 回写链(顺序见 `### ⚠ 执行顺序` 的 ①–⑤)**全部完成后**,**阻塞确认**(AskUserQuestion)是否同步 change 实施结果(团队协作:落地结果是团队最需要看的内容):
295
+ 回写链(顺序见 `### ⚠ 执行顺序` 的**本分支对应序列**——legacy/full 为 ①–⑤、planned 为 ①–③、direct 无回写)**全部完成后**,**阻塞确认**(AskUserQuestion)是否同步 change 实施结果(团队协作:落地结果是团队最需要看的内容):
249
296
 
250
297
  > **v0.53.0 时序说明**:本门禁点原先表述为"回写链全部完成后、`tf state transition closing` **之前**"——那是旧顺序(转换在最后)。B' 方案已把状态转换前移到 ②,故本门禁点改为以「回写链**全部完成后**」为准,**不再对转换位置附加约束**。二者不冲突:本门禁只关心"实施结果是否同步",与转换先后无关。
251
298
  - **A 提交并推送**:`tf publish --changes <change-dir> --push`
@@ -16,7 +16,7 @@ tf prototype-sync <change-dir>
16
16
  >
17
17
  > ① **门禁只能在转换点校验**:`executing→closing` 现挂 `arch-merged` guard 维度——转换时校验全局 `docs/architecture/ARCHITECTURE.md` 已含本 change 增量(marker 区来源列 `change:<name>` **或** 演进日志锚 `### change:<name>`,双通道)。**未回写则转换被拒**。故 arch-merge 必须先于转换执行。
18
18
  > ② **原顺序下"未回写"在状态机层面不可见**:旧序把 arch-merge 放在转换**之后**,而 `VALID_STATES` 无 `closed`、`closing→closed` 转换不存在 → arch-merge 在状态机上**没有任何锚点**,其成败无门禁考核。这是"架构变更必须合并进台账"这条原则长期停留在**文档承诺**而非**代码强制**的机制原因。
19
- > ③ **与 `arch-snapshot` 不冲突**:两者同挂本转换(`arch-snapshot` 是 v0.36.0 的"先快照后回写"),但**维度之间无数据依赖**——`arch-snapshot` 只读 `docs/architecture/iterations/`,`arch-merge` 全流程不触碰该目录(已逐行核对)。"先快照后回写"仍是语义前提(快照在 ARCH 阶段产出,早于整个 closing)。
19
+ > ③ **与 `arch-snapshot` 不冲突**:两者同挂本转换(`arch-snapshot` 是 v0.36.0 的"先快照后回写"),但**维度之间无数据依赖**——`arch-snapshot` 只读 `docs/architecture/iterations/`,`arch-merge` 自 P0-B'-① 起(ddd-purity v1.5)**只读不写**该目录(seedFromSnapshots 读快照聚合),不构成数据依赖(P4 skill-reviewer 修正:原「全流程不触碰(已逐行核对)」已过期)。"先快照后回写"仍是语义前提(快照在 ARCH 阶段产出,早于整个 closing)。
20
20
  > ④ **逃生通道**:若本 change 确无架构增量可回写,登记 `tf state set <change-dir> arch_merge_skipped true` + `arch_merge_skip_reason "<理由>"`,该维度即豁免。注意:跳过键**只豁免门禁维度**,不改变 `tf arch-merge` 命令自身的退出码——命令的失败按 **owner 归属**判定,非本 change 的解析失配只报 WARN,不会阻断你(v0.53.0 §115.8)。
21
21
 
22
22
  If `prototype-sync` reports conflicts, list them in the closing summary and flag for manual resolution. Do not block closing on prototype-sync conflicts (advisory level).
@@ -67,6 +67,7 @@ argument-hint: "[下一个会话的关注点描述]"
67
67
  4. **用户偏好**:不在文档中的隐性偏好
68
68
  5. **失败尝试**:尝试过但放弃的方案及原因
69
69
  6. **敏感信息**:API Key / Token / 密码 → 替换为 `${PLACEHOLDER}`
70
+ 7. **状态机快照(v0.64.0)**:`state` + `workflow` + **`workflow_variant`**(direct/planned/legacy/null)+ `planned_arch`——恢复会话据此选前门路由(workflow-start Front Doors),缺 variant 会误入 legacy 分支
70
71
 
71
72
  ### Step 3:文档生成
72
73
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: test-strategy
3
- description: 测试设计方法论 skill——design_method 选择、分层策略、对抗验证、复杂度分级。build-executor / contract-builder 通过 skills 字段预加载。
3
+ description: 测试设计方法论 skill——design_method 选择、分层策略、对抗验证、复杂度分级。仅供 build-executor / contract-builder 经 skills 字段预加载,不面向用户直接触发(v0.64.0 §3.8 收紧)。
4
4
  user-invocable: false
5
5
  ---
6
6
 
@@ -93,7 +93,7 @@ prd_draft → user_review → prototype_loop → prd_frozen → completed
93
93
 
94
94
  产品级架构设计:基于迭代版本 vN 产出覆盖所有模块的整体详细架构(预测态快照,P1:只写快照不写全局)。**ARCH 在 S3 之前**——计划(S3)与拆分(S4)是最终任务拆分,必须基于架构定稿(聚合/服务/模块)进行。
95
95
 
96
- **场景判定(入口三态)**:全新项目 → 正向设计(首轮不可跳过);旧项目首轮(`arch_baseline` 缺失)→ 逆向重建 L0 骨架 → 渐进深化;已建档 + 迭代无结构性变更 → 跳过(**skip 必须物化**:写 `docs/architecture/iterations/vN/SKIPPED` 标记 + 理由,判定者=编排器+用户确认)。
96
+ **场景判定(入口三态)**:全新项目 → 正向设计(首轮不可跳过);旧项目首轮(`arch_baseline` 缺失)→ 逆向重建 L0 骨架 → 渐进深化;已建档 + 迭代无结构性变更 → 跳过(**skip 必须物化**:写 `docs/architecture/iterations/vN/SKIPPED.md` 标记 + 理由,判定者=编排器+用户确认)。
97
97
 
98
98
  **执行**:调用 architecture-design skill 的 **product 模式**子代理(8 步设计:限界上下文/聚合注册表/指令事件/状态机/概念 ER/时序),产出 `docs/architecture/iterations/vN/architecture.md`(6 产物,provenance 标注)。
99
99
 
@@ -214,7 +214,7 @@ plan_hash: sha256:<plan.md 内容摘要> # 检测产品层改动后变更层
214
214
  - **后台子代理等待范式(v0.20.0)**:派发后台子代理(prototype-builder / reviewer / architecture-design 等长任务)后**依赖完成通知(`<task-notification>`)再行动**,**禁止反复 `TaskOutput(block=true)` 阻塞轮询**——其对长任务超时返回会倾泻完整子代理 transcript,撑爆主上下文、抵消"只编排"的轻上下文优势。长任务派发后可先处理可并行工作或结束本轮等待通知,**不空转死等**;确需中途观察用 `block=false` 轻量查询(仍返转录,尽量不用)。(设计 §22.2)
215
215
  - **不跳过 PRD 冻结**:PRD 必须经原型循环(或显式跳过)后才能进 ce-plan
216
216
  - **不跳过拆分审计**:change-split-auditor 审计 verdict = PASS 是创建 change 脚手架的前置条件(S4 必选门禁)
217
- - **架构门禁(v0.36.0)**:ARCH 阶段 skip 必须物化(`iterations/vN/SKIPPED` + 理由);arch-readiness(S4 拆分:快照覆盖 change 触及 BC)与 arch-snapshot(change closing)为 guard 门禁,`arch_baseline` 缺失 → WARN 不 FAIL(存量豁免)
217
+ - **架构门禁(v0.36.0)**:ARCH 阶段 skip 必须物化(`iterations/vN/SKIPPED.md` + 理由;存量无扩展名 SKIPPED 门禁亦识别);arch-readiness(S4 拆分:快照覆盖 change 触及 BC)与 arch-snapshot(change closing)为 guard 门禁,`arch_baseline` 缺失 → WARN 不 FAIL(存量豁免)
218
218
  - **路由是建议非决定**:S1 路由判断必须用户确认;重规划必须 DP-R 阻塞确认
219
219
  - **回退必写 replan_log**:active → pending 回退必须记录;受影响制品归档为 .revN,重入不读旧制品
220
220
  - **不阻断流程**:所有复利操作为 advisory 级——INDEX 缺失/读取失败时 CLI 输出一行 WARN 并返回空结果,**不阻断流程**(v0.57.0 前为完全静默)
@@ -7,6 +7,59 @@ description: Primary entry point for the team-flow state-machine workflow. Invok
7
7
 
8
8
  Primary entry point for `team-flow`. Jobs: inspect change context, check for updates, confirm DP-0, determine state, route to correct skill, block invalid transitions.
9
9
 
10
+ ## Front Doors(前门路由,v0.64.0 · spec-superflow 2.0 同步)
11
+
12
+ 进入任何路由前先读 `tf state get <change-dir> workflow_variant`,按分支处理:
13
+
14
+ | `workflow_variant` | 路由 |
15
+ |---|---|
16
+ | `null`(存量 / `tf state init` 新 change / orchestrator S4 创建) | **≡ legacy 分支**:走本文件既有全量流程,行为与 v0.63 一致。有 TTY 且处于 `exploring` → **单次** AskUserQuestion 提示可选前门;无 TTY(headless / e2e Tier2 / jarvis worker)→ **不提示**直接 legacy,绝不挂起(B-11 协议)。 |
17
+ | `direct` | → Direct 路由 |
18
+ | `planned` | → Planned 路由 |
19
+ | `legacy` | 全量冻结流程(本文件既有路由),不可中途转档 |
20
+
21
+ **显式选门落盘**(`--path` 是本 skill 参数,无 `tf workflow` CLI;**新 change 先 `tf state init` 再 set**——BUG-B 要求 state 文件先存在;`base_sha` 仅首建打戳,重复 init 不追加):
22
+
23
+ ```bash
24
+ tf state init <change-dir> # 首建 state 文件 + 打戳 base_sha(扫描基线)
25
+ tf state set <change-dir> workflow quick # direct → quick;planned → full
26
+ tf state set <change-dir> workflow_variant direct # 或 planned
27
+ tf state set <change-dir> planned_arch true # 仅 planned 且用户选轻架构
28
+ ```
29
+
30
+ **优先级铁律:显式 `--path` > 内容启发式 legacy 识别**——显式选门时**不跑** legacy 内容判定(否则 planned「先写 proposal 再 start」第一步就误判 legacy,S-05)。`exploring` 态且未产规划制品时允许**一次**改选前门(首选/纠错);此后只可经 Upgrade 升档,降档禁止。
31
+
32
+ **infer 双通道**:见下方「Mode Detection」节(**唯一落点**,本节不复述——同文件双份规则是漂移源)。
33
+
34
+ **`lightweight` 归属(孤儿值补全)**:`workflow=lightweight` 无独立前门——手动 `tf state set workflow lightweight` + `workflow_variant direct` 使用(quick 的加严变体:closing 追加 `lightweight-completion-evidence`),infer 不产出该值。
35
+
36
+ ### Direct 路由(`workflow=quick`·零文档零契约)
37
+
38
+ 1. 快速 DP-0(一句话确认 scope/AC,仍写 `dp_0_confirmed=true`)
39
+ 2. `tf state init`(若尚未建)→ 上述两条 `tf state set`(先 init 后 set,见落盘块)
40
+ 3. 产出最小 `test-matrix.md`,或显式 `test_matrix_skipped=true`+理由(D4 底线;无契约轻判据)
41
+ 4. 转换 `exploring→approved-for-build→executing`(guard 走 direct 维度表)。**架构 surface(API/DB/聚合)扫描命中 → FAIL** → 走 Upgrade 升 planned,禁止硬闯
42
+ 5. 实施:**主代理当前会话直接写代码**(direct 前门无子代理——Artifact Ownership 的子代理委派要求不适用本分支)
43
+ 6. 验证:跑验证命令 → **`tf test record <dir> --from <输出文件>`(必须 record;guard 只读记录、不现场跑测试,A-19)**
44
+ 7. 转 `closing` → release-archivist **direct 分支**(仅 transition + 验证记录;回写全跳过)
45
+
46
+ ### Planned 路由(`workflow=full`+`variant=planned`·两份文档 + 一次最终审查)
47
+
48
+ 1. 产出 `proposal.md`(≥10 非空行)+ `tasks.md`(≥1 checkbox)——轻路径无 spec-writer 子代理,主代理可直接写。**DP-0 并入本步一次确认**(scope/约束/AC 一次问完,`dp_0_confirmed=true` 照写——与 Direct 快速 DP-0 同型)
49
+ 2. `tf state init`(若尚未建,先 init 后 set)→ `tf state set workflow full` + `workflow_variant planned`(+ `planned_arch true` 如选轻架构)
50
+ 3. **轻架构(`planned_arch=true` 时)**:写 `architecture/light-note.md`(简短说明)+ `architecture/snapshot-light.md`;declined 则显式跳过:`arch_design_light_skipped=true` + `arch_design_light_skip_reason`(两键缺一不可)
51
+ 4. **plan 派生**:`tf execution plan <dir> --derive --confirm --reason "<一句话>"`——tasks.md → 单 wave(serial),写入即同步 `state.execution_mode/execution_plan_hash/execution_plan_revision`;**无需 recommend/receipt/DP-4**(validatePlan 对 planned 豁免)
52
+ 5. D4:最小 `test-matrix.md` 或显式 skip(同 direct)
53
+ 6. 转换 `exploring→approved-for-build→executing`(planned 维度表:无契约、无 DP-3、无 architecture-design 重门)
54
+ 7. 实施:主代理当前会话执行单 wave;完成 → 跑测试 → `tf test record`
55
+ 8. **关门 → dispatch/执行 release-archivist(planned 分支单点执行)**:回写三步(`arch-merge --light` / `test-merge --light` / `tf solutions capture --source "change:<name>"`)→ `final-review.md` 最终审查(**在回写之后核验台账条目 vs diff 抽样**,B-01/D5)→ 转 `closing` → prototype-sync(closing 后,有原型才跑)。**序列只存在于 release-archivist「⚠ 执行顺序」块(唯一真相源,§3.7 B-13),本 skill 不重复执行、不本地复述命令(防双跑)**。
56
+
57
+ ### Upgrade(升档,G5/D9)
58
+
59
+ - 触发:direct 被 `direct-short-path` 判命中架构 surface;或 planned 发现跨模块/高不确定性需重设计。
60
+ - **唯一机械入口**:`tf state upgrade <change-dir> <planned|full>`——校验方向向上 → 原子写 `variant_source=upgrade` + `variant_direction=up` → state 回退 `approved-for-build` → 重算 `artifacts_hash`。**已产代码、`tf test record` 证据、`test_matrix_hash` 全部保留**(B-10 含 hash 重算)。
61
+ - 之后按目标档位补齐缺口(planned:proposal/tasks/derive/回写序列;full:完整仪式)再重新推进。**降档一律禁止**(guard fail-closed:非 exploring 的 variant 变更若 `variant_source≠upgrade` 或方向为降 → 拒绝)。
62
+
10
63
  ## Use This Skill When
11
64
 
12
65
  Only invoke when team-flow context is present: `.team-flow.yaml` exists, artifacts like `proposal.md`/`specs/`/`design.md`/`tasks.md`/`execution-contract.md` are present, or user explicitly invokes team-flow by name. When in doubt, check for `.team-flow.yaml` first.
@@ -70,13 +123,15 @@ Config-aware routing: check `artifacts.order` and `artifacts.skip` from project
70
123
 
71
124
  ## Mode Detection
72
125
 
73
- If workflow is `auto`/`null`/unset: run `tf runtime infer <change-dir>`. Inference: **hotfix** (≤2 tasks, ≤2 files, no schema/API/new modules), **tweak** (≤4 tasks, config/doc only), **full** (anything larger). Persist with `tf state set <dir> workflow <mode>`.
126
+ If workflow is `auto`/`null`/unset: run `tf runtime infer <change-dir>`. 双通道输出(v0.64.0):`mode` ∈ **hotfix**(≤2 tasks/≤2 files) / **tweak**(≤4, config/doc) / **full**(更大;quick/lightweight 仅由显式前门写入)+ `suggested_path` ∈ direct|planned|null(arch/API/DB/聚合信号 → 建议 planned 而非 full,D1)。
127
+
128
+ **持久化改为「建议+询问」(P4 落地)**:有 TTY → 回显 `mode` + `suggested_path` 建议,AskUserQuestion 确认后 `tf state set <dir> workflow <mode>`;无 TTY → 按建议直接落盘并在输出中记 `infer_source=suggested`(B-12,e2e/jarvis 不挂起)。**`suggested_path` 只进前门选择提示,绝不写入 `state.workflow`。**
74
129
 
75
- Validate mode against artifact content. If hotfix/tweak criteria not met → upgrade to `full` and output reason. Don't overwrite explicit mode unless user asks.
130
+ Validate mode against artifact content. If hotfix/tweak criteria not met → upgrade to `full` and output reason. Don't overwrite explicit mode unless user asks. 显式 `--path` 已选前门时跳过本节询问(显式 > 推断)。
76
131
 
77
132
  ## Routing Rules
78
133
 
79
- > **⚠️ 路由优先级(硬规则)**:路由按文档顺序从前到后评估,**第一个匹配的路由必须执行**。关键门控:`arch_design_decision` 为 `null` 时 MUST 路由到 `architecture-design`,即使后续路由(spec-writer / contract-builder / build-executor)的其他条件也满足——架构判定是 exploring→specifying 的硬前置,不可跳过。hotfix/tweak 走快速转换,guard 不挂 `arch-design` 维度(`exploring:bridging`/`exploring:approved-for-build` 为空维度),但 **SOP 层仍须过 architecture-design 判断门,不豁免**(v0.9 §26,见 Fast-Path Routing;hotfix 可能正是架构缺陷导致)——判断结果由 architecture-design 子代理写入 `arch_design_decision`,无"自动写 skipped"行为。
134
+ > **⚠️ 路由优先级(硬规则)**:路由按文档顺序从前到后评估,**第一个匹配的路由必须执行**。**前置例外(v0.64.0 Q3/F-15②)**:`workflow_variant` 为 `direct`/`planned` 时**先走 Front Doors 分支**,结构性不经 `exploring:specifying`,本节 `arch_design_decision` 硬前置与下方「不豁免」规则**不适用**(direct/planned 的架构 surface 由 `direct-short-path` 扫描 + `arch-merged-light` 底线接管);`legacy`/`null`/hotfix/tweak/显式 full 照旧。关键门控:`arch_design_decision` 为 `null` 时 MUST 路由到 `architecture-design`,即使后续路由(spec-writer / contract-builder / build-executor)的其他条件也满足——架构判定是 exploring→specifying 的硬前置,不可跳过。hotfix/tweak 走快速转换,guard 不挂 `arch-design` 维度(`exploring:bridging`/`exploring:approved-for-build` 为空维度),但 **SOP 层仍须过 architecture-design 判断门,不豁免**(v0.9 §26,见 Fast-Path Routing;hotfix 可能正是架构缺陷导致)——判断结果由 architecture-design 子代理写入 `arch_design_decision`,无"自动写 skipped"行为。
80
135
 
81
136
  ### Sub-agent Dispatch Protocol (v0.30.0)
82
137
 
@@ -263,7 +318,8 @@ build-executor 修复 findings 后,workflow-start 必须:
263
318
  - No transition to `abandoned` from `closing` or `abandoned`
264
319
  - No auto-abandon without user confirmation
265
320
  - No merging delta specs from abandoned change
266
- - **No routing to spec-writer without architecture-design gate pass** (v0.9 §26): `arch_design_decision` must be `required` or `skipped` (not `null`). hotfix/tweak 不豁免
321
+ - **No routing to spec-writer without architecture-design gate pass** (v0.9 §26): `arch_design_decision` must be `required` or `skipped` (not `null`). hotfix/tweak 不豁免;**direct/planned 前门结构性不经该门(v0.64.0 Q3)**,架构 surface 由 `direct-short-path` 扫描 + `arch-merged-light` 底线接管
322
+ - **Front-door 主代理直写例外(v0.64.0)**:direct/planned 分支**无子代理**,下条 Artifact Ownership 的「主代理不得直接 Edit/Write」在该两分支不适用(proposal/tasks/light-note/final-review/代码均主代理直写);`legacy`/full/hotfix/tweak 分支该禁令原样生效
267
323
  - **No arch state write without auto-review PASS** (v0.28.1 §36): when `decision: required`, auto-review MUST complete with PASS or PASS_WITH_WARNINGS before writing `arch_design_decision` to yaml. FAIL → loop fix (≤3 rounds) or escalate to human
268
324
  - **No routing past DP-A without user confirmation** (v0.29.0 §37): architecture-design 四步协议完成后,必须经 DP-A 用户确认门(AskUserQuestion)才能路由到 spec-writer。用户选择"需要调整"时,修改必须通过子代理执行,修改后重新 auto-review + 重新 DP-A 确认
269
325
  - **Artifact Ownership — 主代理不得直接修改子代理产物** (v0.29.0 §37): 子代理是其产物的唯一负责人(architecture-design → `architecture/` 目录,spec-writer → `proposal.md`/`specs/`/`design.md`/`tasks.md`,contract-builder → `execution-contract.md`,build-executor → 代码文件)。**tasks.md 的勾选状态属执行期写入区**(v0.49.0 §83.3.4):任务文本归 spec-writer,勾选标记由 build-executor 在 wave 完成时回写(主代理只检查不代写)。**hotfix/tweak 路径的 tasks.md 归属 contract-builder**(v0.22 §85):该路径跳过 spec-writer,若 change 需要任务记录则由 contract-builder 一并产出;默认路径是显式跳过(`tasks_skipped=true` + `tasks_skip_reason`——hotfix 由 contract-builder 写入,tweak 由主代理写入)。主代理(workflow-start)不得通过 Read + Edit/Write 直接修改子代理的产物文件。修改必须通过 `SendMessage` 恢复原子代理(优先)或启动新子代理执行。**v0.39.0 强化**:主代理 MUST NOT 直接 Edit/Write 任何文件 under `changes/<name>/` 或 `.worktrees/`——无论改动量大小,必须通过 SendMessage 委托子代理执行。例外:仅当子代理无法启动且用户明确授权时,主代理可直接修改,但必须在修改后重新触发对应的 review 验证
@@ -276,7 +332,9 @@ workflow-start 负责写入以下字段到 `.team-flow.yaml`:
276
332
 
277
333
  **核心状态字段**:
278
334
  - `state`:当前状态(exploring/specifying/bridging/approved-for-build/executing/debugging/closing/abandoned)
279
- - `workflow`:工作流类型(auto/full/hotfix/tweak)
335
+ - `workflow`:工作流类型(auto/full/hotfix/tweak/**quick/lightweight**,v0.64.0 五值 + auto)
336
+ - `workflow_variant`:前门意图(null/direct/planned/legacy,v0.64.0)——与 `workflow` 是两个维度,禁止混写
337
+ - `planned_arch` / `variant_source` / `variant_direction` / `base_sha` / `model_profile`:v0.64.0 新字段(写入规则见 Front Doors;`workflow_variant` 通用通道仅 exploring 态,升档走 `tf state upgrade`)
280
338
 
281
339
  **决策点字段**(各阶段确认后写入;v0.30.0 修正错位,以各 skill 实际 `tf state set` 为准):
282
340
  - `dp_0_*`:DP-0 用户确认门(workflow-start 本 skill 写入)
@@ -7,7 +7,7 @@ Change is fuzzy, scope unclear, comparing options, no stable change name.
7
7
 
8
8
  ## Route to architecture-design (v0.9 §26, v0.11 §34 审查增强, v0.28.1 §36 主干补强, v0.29.0 §37 DP-A 确认门)
9
9
 
10
- Guard: `arch_design_decision` in `.team-flow.yaml` is `null` → must run before spec-writer.
10
+ Guard: `arch_design_decision` in `.team-flow.yaml` is `null` → must run before spec-writer. **前门例外(v0.64.0)**:`workflow_variant` 为 direct/planned 时结构性不经本门(见 SKILL.md「Front Doors」),本节协议仅适用 legacy/null/hotfix/tweak/full。
11
11
 
12
12
  **架构门禁(v0.36.0 / v0.36.3)**:`exploring→specifying` 还挂 `arch-readiness` 维度(产品级架构快照 `iterations/vN/architecture.md` 存在 或 ARCH skip 物化 或 在途兜底)。**FAIL 升级路径**:回 orchestrator 的 ARCH 阶段补快照(或确认 ARCH skip 物化);`arch_baseline` 缺失(存量项目)→ WARN 不阻断。判定逻辑见 `scripts/guard/checks/arch-gate-exemptions.mjs`。
13
13
 
@@ -99,7 +99,7 @@ tf state set <change-dir> arch_review_rounds "<N>"
99
99
  tf state set <change-dir> arch_review_report "architecture/auto-review.md"
100
100
  ```
101
101
 
102
- **hotfix / tweak 不豁免**:同样过 architecture-design 子代理判断门(hotfix 可能正是架构缺陷导致)。
102
+ **hotfix / tweak 不豁免**:同样过 architecture-design 子代理判断门(hotfix 可能正是架构缺陷导致)。**direct/planned 前门豁免(v0.64.0 Q3)**:结构性不经本门,架构 surface 由 `direct-short-path` 扫描 + `arch-merged-light` 接管。
103
103
 
104
104
  ### Step 4: DP-A 用户确认门 (v0.29.0 §37)
105
105
 
@@ -204,7 +204,7 @@ AskUserQuestion:
204
204
 
205
205
  ## Route to spec-writer (dispatch sub-agent)
206
206
  Guard: `tf runtime guard check <dir> exploring specifying --json` → fail = BLOCK.
207
- **arch_design_decision must not be null** → fail = BLOCK(architecture-design gate not passed,v0.9 §26)。
207
+ **arch_design_decision must not be null** → fail = BLOCK(architecture-design gate not passed,v0.9 §26)。**前门例外(v0.64.0)**:direct/planned 不经本转换(走 `exploring→approved-for-build` 捷径),本 BLOCK 不适用。
208
208
  User knows what they want, artifacts missing/incomplete.
209
209
 
210
210
  ## Route to contract-builder (dispatch sub-agent)
@@ -248,7 +248,7 @@ User explicitly requests, bug-investigator escalates after 3+ failures AND user
248
248
 
249
249
  - **Hotfix**: Route to contract-builder (minimal), skip need-explorer + spec-writer, guard check `exploring bridging --workflow hotfix`, then `bridging -> approved-for-build`, after DP-3 → build-executor, after → release-archivist (lightweight).
250
250
  - **Tweak**: Route to build-executor (direct edit), skip need-explorer + spec-writer + contract-builder, guard check `exploring approved-for-build --workflow tweak`, after → release-archivist (lightweight).
251
- - **architecture-design 不豁免**(v0.9 §26):hotfix / tweak 同样过 architecture-design 子代理判断门(hotfix 可能正是架构缺陷导致)。
251
+ - **architecture-design 不豁免**(v0.9 §26):hotfix / tweak 同样过 architecture-design 子代理判断门(hotfix 可能正是架构缺陷导致)。**direct/planned 前门豁免(v0.64.0)**:见 SKILL.md「Front Doors」,不在本 Fast-Path 序列内。
252
252
 
253
253
  ## Optional Prototype Handoff
254
254