@xulthekl/team-flow 0.52.0 → 0.53.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 (39) 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 +3 -3
  9. package/CHANGELOG.md +69 -0
  10. package/GEMINI.md +1 -1
  11. package/HANDOFF.md +11 -0
  12. package/INSTALL.md +1 -1
  13. package/README.md +2 -2
  14. package/agents/release-archivist.md +4 -4
  15. package/docs/README_en.md +1 -1
  16. package/docs/usage-guide.md +4 -1
  17. package/gemini-extension.json +1 -1
  18. package/hooks/session-start +2 -2
  19. package/llms.txt +1 -1
  20. package/package.json +1 -1
  21. package/plugin.json +1 -1
  22. package/scripts/guard/checks/arch-merged.mjs +101 -0
  23. package/scripts/guard/checks/arch-snapshot.mjs +16 -3
  24. package/scripts/guard/guard.mjs +9 -1
  25. package/scripts/lib/arch-merge.mjs +407 -47
  26. package/scripts/lib/arch-parse.mjs +304 -26
  27. package/scripts/lib/cmd-arch.mjs +29 -1
  28. package/scripts/lib/cmd-publish.mjs +53 -6
  29. package/scripts/lib/cmd-state.mjs +2 -0
  30. package/scripts/lib/prototype-sync.mjs +2 -1
  31. package/scripts/lib/state-loader.mjs +10 -0
  32. package/scripts/lib/test-merge.mjs +1 -1
  33. package/scripts/team-flow.mjs +14 -1
  34. package/skills/architecture-design/templates/api.md +10 -4
  35. package/skills/prototype/SKILL.md +2 -2
  36. package/skills/release-archivist/SKILL.md +46 -36
  37. package/skills/release-archivist/references/closing-procedures.md +14 -4
  38. package/skills/workflow-bootstrap/SKILL.md +27 -18
  39. package/skills/workflow-orchestrator/references/state-model.md +3 -0
@@ -91,7 +91,7 @@ prototype/
91
91
 
92
92
  ## prototype-sync(change 完成回写,release-archivist 自动触发,v0.24.0 升级)
93
93
 
94
- > **触发机制(v0.24.0)**:prototype-sync 由 `release-archivist` closing 流程**自动触发**(`arch-merge → prototype-sync → compound promotion` 顺序执行),不再是手动 SOP。release-archivist Step 5 Report 中 `Prototype sync` 行是必填维度,未执行时 closing 报告不完整。
94
+ > **触发机制(v0.24.0;v0.53.0 补入状态转换位次)**:prototype-sync 由 `release-archivist` closing 流程**自动触发**(`arch-merge → state transition closing → prototype-sync → compound promotion` 顺序执行),不再是手动 SOP。release-archivist Step 5 Report 中 `Prototype sync` 行是必填维度,未执行时 closing 报告不完整。
95
95
  >
96
96
  > **独立调用**:仍可独立调用(如 change 中途需要预同步),但标准路径是 closing 自动触发。
97
97
 
@@ -99,7 +99,7 @@ prototype/
99
99
  2. **派 `prototype-builder`(修正/演进模式)**把增量合并进全局 `prototype/`(pages/components/assets/flow.md)——主代理不直接写原型 HTML。
100
100
  3. 若涉及设计系统迭代,调用 `/team-flow:design-system`(iterate 模式)合并进 `.team-flow/design-system/` 并记变更履历。
101
101
  4. 人工确认增量无误。
102
- 5. **顺序提交**:`arch-merge` → `prototype-sync`(同一 change closing 内)。
102
+ 5. **顺序提交**:`arch-merge` → `state transition closing` → `prototype-sync`(同一 change closing 内)。**状态转换必须在 arch-merge 之后、prototype-sync 之前**(v0.53.0 §110 B' 时序前移:`executing→closing` 挂 `arch-merged` 门禁,未回写则转换被拒)。
103
103
 
104
104
  ## 脚手架
105
105
  新建项目:`cp -r references/prototype-scaffold/ <project>/prototype/`,再按 `.team-flow/design-system/` 的设计系统填 token(缺设计系统先用 `/team-flow:design-system` 创建)。
@@ -118,7 +118,7 @@ Check for files modified outside scope fence, new dependencies not in design. Un
118
118
 
119
119
  ## Final Checks
120
120
 
121
- **⛔ 状态字段禁写(v0.30.0 + v0.13 §50)**:仅写本 skill 的 `dp_6_*`/`dp_7_*` 决策字段;测试证据经 `tf test record` 程序化写入(不再手工 set `test_result`);**MUST NOT** 修改 `.team-flow.yaml` 的 `state`/`workflow` 核心字段——closing 转换由主代理经 `tf state transition` 执行(来源:workflow-feedback 2026-08-01)。
121
+ **⛔ 状态字段禁写(v0.30.0 + v0.13 §50;v0.53.0 增补跳过键)**:仅写本 skill 的 `dp_6_*`/`dp_7_*` 决策字段 + `arch_merge_skipped`/`arch_merge_skip_reason` 跳过键(后者见 `### ① Architecture Merge` 的 no-op 登记指引);测试证据经 `tf test record` 程序化写入(不再手工 set `test_result`);**MUST NOT** 修改 `.team-flow.yaml` 的 `state`/`workflow` 核心字段——closing 转换由主代理经 `tf state transition` 执行(来源:workflow-feedback 2026-08-01)。
122
122
 
123
123
  - Tests passing? (cite command and output)
124
124
  - All batches complete? (cite batch status)
@@ -149,13 +149,27 @@ If implementation diverged from the contract, return to `bridging` before closur
149
149
 
150
150
  ## Post-Verification
151
151
 
152
- Run `tf state transition <change-dir> closing`. If delta specs exist, route to `spec-merger`.
152
+ ### 执行顺序(v0.53.0 §110 B' 时序前移 MUST)
153
+
154
+ ```
155
+ ① tf arch-merge <change-dir> ← 架构增量回写全局台账
156
+ ② tf state transition <change-dir> closing
157
+ ③ tf prototype-sync <change-dir>
158
+ ④ tf test-merge <change-dir>
159
+ ⑤ tf solutions promote(compound promotion)
160
+ ```
161
+
162
+ (各步详细说明见下方对应节标题的 ①–⑤ 编号。)
163
+
164
+ > **本块是全流程中该顺序的【唯一真相源】**(v0.53.0 §115.10):②③ 两节及「阶段产物同步门禁点」原先各自复述同一顺序串(本文件内共 4 处),是既有的漂移源——`agents/release-archivist.md` 已明文禁止复述,本文件却复述了 4 次。现各处改为指向本块。
165
+ >
166
+ > **为何 ① 必须在 ② 之前**(v0.53.0 变更,务必遵守):`executing→closing` 现挂 **`arch-merged` 门禁维度**——转换时校验全局台账已含本 change 增量。**未回写则转换被拒**。完整论证(含与 `arch-snapshot` 的无数据依赖关系)见 `references/closing-procedures.md`。
153
167
 
154
- **架构快照门禁(arch-snapshot,v0.36.0 / v0.36.3)**:`executing→closing` `arch-snapshot` 维度——本轮迭代产品级架构快照 `iterations/vN/architecture.md` 必须已落盘("先快照后回写"强制化)。**FAIL 升级路径**:回 orchestrator 的 ARCH 阶段补快照;存量升级在途 change(快照缺失但 change 有增量产物)→ WARN 兜底放行;`arch_baseline` 缺失 → WARN 不阻断。hotfix/tweak 豁免(不挂该维度)。判定逻辑见 `scripts/guard/checks/arch-gate-exemptions.mjs`。
168
+ **架构快照门禁(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`。
155
169
 
156
- ### Architecture Merge (v0.10 §28-§31) — MUST run first
170
+ ### Architecture Merge (v0.10 §28-§31) — MUST run first
157
171
 
158
- Merge change-level architecture artifacts to the global `docs/architecture/` baseline **before** any other post-verification step:
172
+ Merge change-level architecture artifacts to the global `docs/architecture/` baseline **before** the state transition and before any other post-verification step:
159
173
 
160
174
  ```bash
161
175
  tf arch-merge <change-dir>
@@ -163,23 +177,34 @@ tf arch-merge <change-dir>
163
177
 
164
178
  This merges `architecture/{architecture,database,api}.md` and `architecture/sql/` into the global architecture docs. Skip silently when `architecture/` does not exist (architecture-design was `skipped`) — 前置判据见 `## Lightweight Closure > 回写链前置判据`(v0.22 §87:先判断再决定是否执行命令)。
165
179
 
166
- **Execution order (mandatory, v0.12 §43.4)**: `arch-merge` `prototype-sync` `test-merge` `compound promotion`. Do not parallelise global docs must not be in a half-updated state.
180
+ **命令输出即是证据**:`arch-merge` 现在会汇总 `[WARN]` / `[FAIL]` 并可能以非零退出码结束。**有 `[FAIL]` 行时必须先解决再转换**(典型:`端点章节表有 N 行候选但 0 条提取——api.md 表格形态失配`)。若命令确为 no-op(无架构增量可回写),用显式跳过键登记:
181
+
182
+ ```bash
183
+ tf state set <change-dir> arch_merge_skipped true
184
+ tf state set <change-dir> arch_merge_skip_reason "<理由>"
185
+ ```
186
+
187
+ ### ② State Transition
188
+
189
+ Run `tf state transition <change-dir> closing`. If delta specs exist, route to `spec-merger`.
190
+
191
+ **顺序(MUST)**:见 `### ⚠ 执行顺序` 的 ①–⑤(**本步是 ②**,前置 ① 已完成)。不得并行——全局文档不得处于半更新态。
167
192
 
168
- ### Prototype Sync (v0.5)
193
+ ### Prototype Sync (v0.5)
169
194
 
170
- After `arch-merge` completes, run prototype-sync to merge UX deltas back to the global prototype:
195
+ 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:
171
196
 
172
197
  ```bash
173
198
  tf prototype-sync <change-dir>
174
199
  ```
175
200
 
176
- **Write-back order (mandatory, v0.12 §43.4)**: `arch-merge` `prototype-sync` → `test-merge` → `compound promotion` must be executed **sequentially** within the same change closing. Do not run them in parallel — the global `docs/architecture/`, `prototype/`, and `docs/test-ledger/` must not be in a half-updated state when the next change grounds on them.
201
+ **顺序(MUST)**:见 `### 执行顺序` ①–⑤(**本步是 ③**,①② 已完成)。同一 change closing 内**顺序执行**,不得并行——`docs/architecture/` / `prototype/` / `docs/test-ledger/` 不得处于半更新态,否则下一个 change 会以半态为基。
177
202
 
178
203
  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).
179
204
 
180
205
  **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 行标注为已完成**。
181
206
 
182
- ### Test Merge (v0.12 §43)
207
+ ### Test Merge (v0.12 §43)
183
208
 
184
209
  After `prototype-sync` completes, run test-merge to write test matrix results back to the global test ledger:
185
210
 
@@ -197,42 +222,25 @@ Skip silently when `test-matrix.md` does not exist (legacy change or test_matrix
197
222
 
198
223
  **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.
199
224
 
200
- ### Compound Promotion (v0.5)
225
+ ### Compound Promotion (v0.5)
201
226
 
202
- During closing, promote change-level learnings to the global solutions library:
227
+ Promote change-level learnings to the global solutions library:
203
228
 
204
229
  ```bash
205
230
  tf solutions promote <change-dir>
206
231
  ```
207
232
 
208
- This checks the change's `learnings.md` (change root; v0.49.0 §83.3.5 path unification) for entries meeting promotion criteria:
209
- - severity ≥ medium AND type = pitfall/pattern → promote to global `docs/solutions/`
210
- - domain+type matches existing global entry → mark as "confirmed pattern", upgrade severity (low → medium → high → critical)
211
-
212
- Valid `severity` values: `critical` | `high` | `medium` | `low` (ordered; lowercase, case-sensitive; v0.23 §91 — the order is defined once in `scripts/lib/severity.mjs`).
213
-
214
- Report promotion results in the closing summary. Promotion is advisory — failures do not block closing.
215
-
216
- ### Compound Capture Check (v0.5;v0.49.0 §83.3.5 明确写入方)
217
-
218
- Before finalizing the closing, check if this change produced any learnable moments:
233
+ 读取 change 根目录的 `learnings.md`(v0.49.0 §83.3.5 路径统一)——`severity medium` `type = pitfall|pattern` 者晋升全局 `docs/solutions/`;命中既有条目则标记 confirmed pattern 并升级 severity。severity 序 `critical > high > medium > low` 定义在 `scripts/lib/severity.mjs`(v0.23 §91,单一来源)。
219
234
 
220
- - Did the change trigger any mandatory rewind (re-specify, re-bridge)?
221
- - Did bug-investigator find a recurring issue (same root cause as a prior change)?
222
- - Did scope expand beyond the original proposal?
223
- - Did execution-contract drift from proposal?
235
+ **Compound Capture Check(v0.5)**:closing 前自检本 change 是否产生了可沉淀的经验(强制回退 / 复发根因 / 范围外扩 / 契约漂移);有则写入 change 根的 `learnings.md`,每条 `## <title>` 带 frontmatter(`phase`/`domain`/`type`/`severity`/`date`)。该文件正是 `compound-captured` guard 检查、`tf solutions promote` 读取的对象。
224
236
 
225
- If any of the above occurred, **write them to the change's `learnings.md` (change root)** — one `## <title>` entry per learning, each carrying a frontmatter block (`phase` / `domain` / `type` / `severity` / `date`). Format reference: `tf runtime asset read templates/learnings.md`. This is the file the `compound-captured` guard checks and `tf solutions promote` reads; entries without frontmatter are skipped by promote (reason listed in its output).
226
-
227
- `tf solutions capture` writes to global `docs/solutions/` — it does **not** create `learnings.md`. Use it only for product-level learnings that belong directly in the global library.
228
-
229
- This check is advisory — skip silently if no learnable moments are detected.
230
-
231
- > 详细收尾流程(Prototype Sync / Compound Promotion / Compound Capture / Worktree Deisolation / Code Landing)见 `references/closing-procedures.md`。
237
+ > **本节的展开版(条目质量要求、`tf solutions capture` `learnings.md` 的分工、Prototype Sync / Worktree Deisolation / Code Landing 全流程)见 `references/closing-procedures.md`**——该处为超集,本节不再重复(v0.53.0 §115.10:同名节曾两处各自维护,属根因 的同一类漂移)。
232
238
 
233
239
  ### 阶段产物同步门禁点(v0.37.0 §68.2 G5)
234
240
 
235
- 回写链(arch-merge prototype-sync test-merge → compound promotion)全部完成后、`tf state transition closing` 之前,**阻塞确认**(AskUserQuestion)是否同步 change 实施结果(团队协作:落地结果是团队最需要看的内容):
241
+ 回写链(顺序见 `### 执行顺序` ①–⑤)**全部完成后**,**阻塞确认**(AskUserQuestion)是否同步 change 实施结果(团队协作:落地结果是团队最需要看的内容):
242
+
243
+ > **v0.53.0 时序说明**:本门禁点原先表述为"回写链全部完成后、`tf state transition closing` **之前**"——那是旧顺序(转换在最后)。B' 方案已把状态转换前移到 ②,故本门禁点改为以「回写链**全部完成后**」为准,**不再对转换位置附加约束**。二者不冲突:本门禁只关心"实施结果是否同步",与转换先后无关。
236
244
  - **A 提交并推送**:`tf publish --changes <change-dir> --push`
237
245
  - **B 仅提交不推送**:`tf publish --changes <change-dir>`(arch-merge/test-merge 已自动 commit,此步补 push)
238
246
  - **C 暂不同步**:继续 closing,后续可补
@@ -268,7 +276,9 @@ This check is advisory — skip if the user declines. If the user reports issues
268
276
 
269
277
  Verify files exist and are non-empty, run `node --check` on code files, skip 5-step verification. Still record DP-6 and DP-7.
270
278
 
271
- **回写链前置判据(v0.22 §87)**:先按下表判断适用性,**不适用则不执行命令**(v0.22 实测:逐项跑完才知道不适用,占 release-archivist 80% 耗时)。本表 4 行判据**仅在 Lightweight Closure 适用**;其中 arch-merge 与 test-merge 两行的 "Skip silently" 见 `### Architecture Merge`(:164 正文句)与 `### Test Merge`(:196 正文句)。
279
+ **回写链前置判据(v0.22 §87)**:先按下表判断适用性,**不适用则不执行命令**(v0.22 实测:逐项跑完才知道不适用,占 release-archivist 80% 耗时)。本表 4 行判据**仅在 Lightweight Closure 适用**;其中 arch-merge 与 test-merge 两行的 "Skip silently" 见 `### Architecture Merge` `### Test Merge` 两节各自的正文句。
280
+
281
+ > **v0.53.0 修正**:此处原用行号引用(`(:164 正文句)`/`(:196 正文句)`),本次改动插入段落使其失效。**行号引用在密集改动期必然漂移,已改为按标题引用**——同轮 `docs/architecture-api-db-design-enhancement-v0.25.md` 亦把 45 处行号引用全量改为符号引用。
272
282
 
273
283
  | 回写项 | 前置判据 | 不满足时登记 |
274
284
  |---|---|---|
@@ -4,13 +4,20 @@
4
4
 
5
5
  ## Prototype Sync (v0.5)
6
6
 
7
- After `arch-merge` completes, run prototype-sync to merge UX deltas back to the global prototype:
7
+ After `arch-merge` completes **and the state transition to `closing` has been performed**, run prototype-sync to merge UX deltas back to the global prototype:
8
8
 
9
9
  ```bash
10
10
  tf prototype-sync <change-dir>
11
11
  ```
12
12
 
13
- **Write-back order (mandatory)**: `arch-merge` → `prototype-sync` → `compound promotion` must be executed **sequentially** within the same change closing. Do not run them in parallel — the global `docs/architecture/` and `prototype/` must not be in a half-updated state when the next change grounds on them.
13
+ **Write-back order (mandatory;v0.53.0 增补状态转换位次)**: `arch-merge` → `state transition closing` → `prototype-sync` → `test-merge` → `compound promotion` must be executed **sequentially** within the same change closing. Do not run them in parallel — the global `docs/architecture/` and `prototype/` must not be in a half-updated state when the next change grounds on them.
14
+
15
+ > **为何状态转换插在 arch-merge 之后**(v0.53.0 §110 B' 时序前移,完整论证)
16
+ >
17
+ > ① **门禁只能在转换点校验**:`executing→closing` 现挂 `arch-merged` guard 维度——转换时校验全局 `docs/architecture/ARCHITECTURE.md` 已含本 change 增量(marker 区来源列 `change:<name>` **或** 演进日志锚 `### change:<name>`,双通道)。**未回写则转换被拒**。故 arch-merge 必须先于转换执行。
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)。
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)。
14
21
 
15
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).
16
23
 
@@ -62,11 +69,14 @@ tf state set <change-dir> dp_6_timestamp $(date -u +%Y-%m-%dT%H:%M:%SZ)
62
69
 
63
70
  If FAIL, do NOT proceed to DP-7. Route back or ask about abandonment.
64
71
 
65
- After PASS, also record the verification gate:
72
+ After PASS, also record the verification gate **程序化写入**(v0.53.0 修正:本处原写 `tf state set <change-dir> test_result pass`,与同轮修正的 `SKILL.md`「不再手工 set `test_result`」及 CLI 实测互相矛盾——CLI 直接拒绝:`⛔ 'test_result' 不再支持手工 set(v0.13 §50)`):
73
+
66
74
  ```bash
67
- tf state set <change-dir> test_result pass
75
+ tf test record <change-dir> --from <runner-output-file>
68
76
  ```
69
77
 
78
+ (`test_result` 已移出 `SETTABLE_FIELDS`,`tests-passing` 门禁只认 `tf test record` 写入的程序化证据。DP-6 段此前的 `dp_6_result` 只是决策点记录,**不是**放行凭证。)
79
+
70
80
  ## DP-7 (Archive Confirmation)
71
81
 
72
82
  ```bash
@@ -107,38 +107,47 @@ Do NOT invoke for:
107
107
  **B2 成果物导入(v0.23.0 新增,v0.24.0 模板初始化补强)**:
108
108
 
109
109
  ```
110
- Step 0: 目录+模板初始化(v0.24.0 新增)
111
- ├── mkdir -p docs/architecture/
112
- ├── 从 ${CLAUDE_PLUGIN_ROOT}/skills/architecture-design/templates/ 复制模板:
113
- │ architecture.md → docs/architecture/ARCHITECTURE.md
114
- │ database.md → docs/architecture/DATABASE.md
115
- │ physical-model.md → docs/architecture/PHYSICAL-MODEL.md
116
- │ api.md → docs/architecture/API-INDEX.md
117
- │ index.md → docs/architecture/INDEX.md
110
+ Step 0: 全局台账脚手架(v0.24.0 新增;v0.53.0 修正)
111
+ ├── bash: tf arch scaffold --project-root <根>
112
+ │ 复用 arch-merge 的生成器产出**目标格式**的空基线(同源,构造上消除格式漂移)
118
113
  └── 已存在的文件不覆盖(只补缺失)
119
114
 
115
+ ⛔ **禁止从 skills/architecture-design/templates/ 复制模板**(v0.53.0 §102 R1 废止):
116
+ 原做法把 **change 级模板** 复制成 **全局台账制品**(`api.md → API-INDEX.md` 等 5 处),
117
+ 而 arch-merge 把这 5 个路径定义为 `generated, do not edit` 的生成式产物——两类写入方
118
+ 语义互斥且互不知情。实测后果:DATABASE / PHYSICAL-MODEL / INDEX 因无条件重建被覆盖,
119
+ 而 `ARCHITECTURE.md` / `API-INDEX.md` **永久卡在模板态**;其中 `API-INDEX.md` 模板自带
120
+ 的 4 条 `/api/xxx` 占位行使扫描非空,**连"空结果拒绝覆盖"保护都不触发**,
121
+ `updateIndex` 还把这 4 行统计成 `端点数量: 4` 写进 INDEX.md。
122
+ 详见 team-flow-workspace/docs/architecture-api-db-design-enhancement-v0.25.md §101.3 / §102.2
123
+
124
+ ⛔ **B2 不得直接写生成式制品**(v0.53.0 §115.6 横展):`PHYSICAL-MODEL.md` / `DATABASE.md` /
125
+ `API-INDEX.md` / `INDEX.md` 四个由 arch-merge **无条件重建**——bootstrap 手写的内容在
126
+ 该 change 首次 arch-merge 时即被整体覆盖(无 DDL 时 PHYSICAL-MODEL 会被改写为"暂无物理模型",
127
+ **用户提供的知识丢失**)。As-Is 叙述的唯一载体是 `docs/architecture/baseline.md`。
128
+
120
129
  Step 1: 询问用户是否有既有成果物
121
130
  ├── 有 SQL DDL 脚本 → 导入到 docs/architecture/schema-baseline.sql
122
- ├── 有物理模型文档 转换为 docs/architecture/PHYSICAL-MODEL.md(对齐标准格式)
123
- ├── API 文档/Swagger 导出 提取端点生成 docs/architecture/API-INDEX.md
131
+ │ (PHYSICAL-MODEL.md / DATABASE.md arch-merge 从该文件生成,B2 不直接写)
132
+ ├── 有物理模型文档内容并入 docs/architecture/baseline.md(B2 的 As-Is 叙述载体)
133
+ ├── 有 API 文档/Swagger 导出 → 端点清单写入 baseline.md §5(全局 API 表面基线)
124
134
  └── 无既有成果物 → Step 2 兜底
125
135
 
126
136
  Step 2: 确定性提取(兜底)
127
137
  ├── recon-probe.sh DDL 提取能力(v0.24.0 已实现:SQL 文件 / Java Entity / 占位)
128
138
  │ bash ${CLAUDE_PLUGIN_ROOT}/skills/workflow-bootstrap/scripts/recon-probe.sh --root <根> --ddl-out docs/architecture/schema-baseline.sql
129
- ├── schema-baseline.sql 反向生成 PHYSICAL-MODEL.md
130
- └── 扫描 Controller/Router 生成 API-INDEX.md
139
+ ├── 扫描 Controller/Router → 端点清单并入 baseline.md §5
140
+ └── (PHYSICAL-MODEL / DATABASE / API-INDEX / INDEX 由 `tf arch-merge` 维护,bootstrap 不产出)
131
141
 
132
142
  优先级原则:用户既有成果物 > 确定性提取 > LLM 推断
133
143
  ```
134
144
 
135
145
  产出:
136
- - `docs/architecture/ARCHITECTURE.md` — 分层、模块边界、技术选型(瘦锚点格式)
137
- - `docs/architecture/DATABASE.md` — 数据模型(如适用)
138
- - `docs/architecture/PHYSICAL-MODEL.md` — 物理模型(v0.23.0 新增)
139
- - `docs/architecture/schema-baseline.sql` — DDL 基线脚本(v0.23.0 新增)
140
- - `docs/architecture/API-INDEX.md` — API 端点索引(v0.23.0 新增)
141
- - `docs/architecture/INDEX.md` — 架构文档索引(v0.23.0 新增)
146
+ - `docs/architecture/baseline.md` — **As-Is 架构基线(B2 的主要产物)**:分层、模块边界、技术选型、既有 API 清单
147
+ - `docs/architecture/ARCHITECTURE.md` — 骨架由 `tf arch scaffold` 建;**As-Is 叙述写在 marker 区之外**,
148
+ `<!-- arch:current-state:begin/end -->` 之间由 arch-merge 独占维护(v0.53.0 §115.6 澄清)
149
+ - `docs/architecture/schema-baseline.sql` — DDL 基线脚本(B2 导入;后续由 arch-merge 幂等追加)
150
+ - `docs/architecture/{PHYSICAL-MODEL,DATABASE,API-INDEX,INDEX}.md` — **生成式,由 arch-merge 维护,B2 不写**
142
151
  - `docs/architecture/<bc>/` — 每个有界上下文的目录(如能识别)
143
152
 
144
153
  **轻量 vs 完整**:
@@ -113,6 +113,9 @@ phases:
113
113
  | 产品级评审门 | ARCH→S3(2026-08-19:ARCH 上移 S3 前,原 ARCH→S4) | architecture-reviewer product 视角 PASS | skip 时仍要物化标记 |
114
114
  | arch-readiness | exploring:specifying(guard 存在性)+ S4 拆分(LLM 覆盖校验) | iterations/vN/ 快照覆盖 change 触及的 BC | arch_baseline 缺失 → WARN 不 FAIL |
115
115
  | arch-snapshot | executing→closing | 本轮快照已落盘 | 在途 change legacy 豁免 |
116
+ | arch-merged | executing→closing(v0.53.0 新增) | 本 change 架构增量已回写全局 `docs/architecture/ARCHITECTURE.md`(marker 区来源列 `change:<name>` **或** 演进日志锚 `### change:<name>`,任一命中即 PASS) | `arch_design_decision` 缺失/skipped 豁免;`arch_baseline` 缺失 legacy 豁免;`arch_merge_skipped` 显式跳过键 |
117
+
118
+ > **arch-merged 的时序前提(v0.53.0 §110 B')**:arch-merge 需在该转换**之前**执行,否则转换被拒。详细顺序见 `team-flow/skills/release-archivist/SKILL.md` 的 `## Post-Verification`。
116
119
 
117
120
  ## arch_baseline 豁免键(v0.35.0 新增)
118
121