teamsmith 0.2.0 → 0.3.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 (117) hide show
  1. package/README.md +4 -4
  2. package/package.json +1 -1
  3. package/skills/teamsmith/CHANGELOG.md +28 -0
  4. package/skills/teamsmith/SKILL.md +14 -7
  5. package/skills/teamsmith/extension/team-notify.ts +37 -6
  6. package/skills/teamsmith/extension/team.ts +438 -0
  7. package/skills/teamsmith/references/config.md +39 -6
  8. package/skills/teamsmith/references/migration.md +197 -47
  9. package/skills/teamsmith/references/protocol.md +176 -19
  10. package/skills/teamsmith/references/troubleshooting.md +124 -7
  11. package/skills/teamsmith/references/workflows.md +36 -2
  12. package/skills/teamsmith/scripts/lib/cmd-agents.sh +318 -23
  13. package/skills/teamsmith/scripts/lib/cmd-bootstrap.sh +2 -2
  14. package/skills/teamsmith/scripts/lib/cmd-config.sh +349 -67
  15. package/skills/teamsmith/scripts/lib/cmd-draft.sh +4 -4
  16. package/skills/teamsmith/scripts/lib/cmd-help.sh +677 -0
  17. package/skills/teamsmith/scripts/lib/cmd-init.sh +157 -5
  18. package/skills/teamsmith/scripts/lib/cmd-interrupt.sh +461 -0
  19. package/skills/teamsmith/scripts/lib/cmd-meeting.sh +2 -25
  20. package/skills/teamsmith/scripts/lib/cmd-project.sh +30 -103
  21. package/skills/teamsmith/scripts/lib/cmd-reap.sh +277 -0
  22. package/skills/teamsmith/scripts/lib/cmd-reply.sh +3 -3
  23. package/skills/teamsmith/scripts/lib/cmd-review.sh +175 -30
  24. package/skills/teamsmith/scripts/lib/cmd-status.sh +226 -17
  25. package/skills/teamsmith/scripts/lib/cmd-update.sh +36 -7
  26. package/skills/teamsmith/scripts/lib/cmd-watch.sh +564 -46
  27. package/skills/teamsmith/scripts/lib/common.sh +773 -48
  28. package/skills/teamsmith/scripts/lib/gate-lock.sh +544 -0
  29. package/skills/teamsmith/scripts/panel/draft-send.sh +11 -1
  30. package/skills/teamsmith/scripts/panel/panel.js +207 -207
  31. package/skills/teamsmith/scripts/panel/src/App.tsx +58 -21
  32. package/skills/teamsmith/scripts/panel/src/clipboard.ts +11 -5
  33. package/skills/teamsmith/scripts/panel/src/compose.ts +6 -3
  34. package/skills/teamsmith/scripts/panel/src/data.ts +11 -3
  35. package/skills/teamsmith/scripts/panel/src/layout.ts +209 -69
  36. package/skills/teamsmith/scripts/panel/src/main.tsx +33 -8
  37. package/skills/teamsmith/scripts/panel/src/strings/en.ts +39 -29
  38. package/skills/teamsmith/scripts/panel/src/strings/zh.ts +41 -31
  39. package/skills/teamsmith/scripts/panel/src/types.ts +28 -3
  40. package/skills/teamsmith/scripts/replies.mjs +4 -1
  41. package/skills/teamsmith/scripts/shim/tmux +18 -0
  42. package/skills/teamsmith/scripts/strings/commands.tsv +86 -0
  43. package/skills/teamsmith/scripts/strings/help.en.tsv +503 -0
  44. package/skills/teamsmith/scripts/strings/help.zh.tsv +489 -0
  45. package/skills/teamsmith/scripts/team +19 -6
  46. package/skills/teamsmith/templates/AGENTS.section.md.tmpl +8 -1
  47. package/skills/teamsmith/templates/config.sh.tmpl +20 -1
  48. package/skills/teamsmith/templates/pm-prompt.md.tmpl +21 -0
  49. package/skills/teamsmith/tests/bg-ledger-harness.mjs +464 -40
  50. package/skills/teamsmith/tests/bg-ledger.sh +168 -10
  51. package/skills/teamsmith/tests/checkout-shape-probe.sh +3 -1
  52. package/skills/teamsmith/tests/config-cli.sh +160 -14
  53. package/skills/teamsmith/tests/fixtures/delivery-truth-real/scenario.sh +7 -1
  54. package/skills/teamsmith/tests/fixtures/p287/lint-good.sh.in +3 -0
  55. package/skills/teamsmith/tests/fixtures/p287/lint-hardcoded.sh.in +3 -0
  56. package/skills/teamsmith/tests/fixtures/p287/lint-no-ns.sh.in +3 -0
  57. package/skills/teamsmith/tests/fixtures/p55/flip-p49.sh +18 -6
  58. package/skills/teamsmith/tests/flip-m33.sh +5 -3
  59. package/skills/teamsmith/tests/flip-m37.sh +4 -1
  60. package/skills/teamsmith/tests/flip-m4.3.sh +4 -1
  61. package/skills/teamsmith/tests/flip-m6.3.sh +4 -1
  62. package/skills/teamsmith/tests/flip-m6.5.sh +4 -1
  63. package/skills/teamsmith/tests/flip-m7.2.sh +4 -1
  64. package/skills/teamsmith/tests/flip-p158.sh +2 -1
  65. package/skills/teamsmith/tests/flip-p210.sh +4 -1
  66. package/skills/teamsmith/tests/flip-p217.sh +4 -1
  67. package/skills/teamsmith/tests/flip-p287-lock.sh +342 -0
  68. package/skills/teamsmith/tests/flip-p287-name.sh +279 -0
  69. package/skills/teamsmith/tests/flip-p304-read-side.sh +98 -0
  70. package/skills/teamsmith/tests/flip-p308-skip-not-pass.sh +151 -0
  71. package/skills/teamsmith/tests/flip-p309-p162-deep.sh +122 -0
  72. package/skills/teamsmith/tests/flip-p310-lock.sh +216 -0
  73. package/skills/teamsmith/tests/flip-p310-socket.sh +125 -0
  74. package/skills/teamsmith/tests/help-surface.sh +1664 -0
  75. package/skills/teamsmith/tests/install-shape.sh +279 -20
  76. package/skills/teamsmith/tests/key-replies-pty.sh +9 -10
  77. package/skills/teamsmith/tests/key-replies-ui.sh +0 -7
  78. package/skills/teamsmith/tests/key-replies.sh +240 -1
  79. package/skills/teamsmith/tests/ledger-ban.sh +5 -4
  80. package/skills/teamsmith/tests/ledger-claim.sh +2 -1
  81. package/skills/teamsmith/tests/lib/bounded-spin.sh +90 -0
  82. package/skills/teamsmith/tests/lib/model-policy.sh +4 -0
  83. package/skills/teamsmith/tests/lib/model-routing-flips.py +51 -0
  84. package/skills/teamsmith/tests/lib/reply-fixture.sh +4 -9
  85. package/skills/teamsmith/tests/lib/section-guard.sh +258 -13
  86. package/skills/teamsmith/tests/lib/tmp-root.sh +139 -27
  87. package/skills/teamsmith/tests/lib/tmux-cap.sh +10 -1
  88. package/skills/teamsmith/tests/lib/tmux-iso.sh +31 -13
  89. package/skills/teamsmith/tests/loop-inventory.tsv +59 -47
  90. package/skills/teamsmith/tests/panel-b2.sh +106 -3
  91. package/skills/teamsmith/tests/panel-b3-stub.sh +112 -4
  92. package/skills/teamsmith/tests/panel-b3.sh +175 -19
  93. package/skills/teamsmith/tests/panel-choices.sh +11 -6
  94. package/skills/teamsmith/tests/panel-cpu.sh +2 -1
  95. package/skills/teamsmith/tests/panel-knobs.sh +7 -1
  96. package/skills/teamsmith/tests/panel-p21.sh +156 -73
  97. package/skills/teamsmith/tests/panel-snapshots.sh +41 -225
  98. package/skills/teamsmith/tests/panel-strings.mjs +33 -18
  99. package/skills/teamsmith/tests/perf.sh +121 -30
  100. package/skills/teamsmith/tests/routes.sh +327 -93
  101. package/skills/teamsmith/tests/seat-interrupt.sh +1002 -0
  102. package/skills/teamsmith/tests/seat-visibility.sh +675 -0
  103. package/skills/teamsmith/tests/section-budgets.tsv +20 -10
  104. package/skills/teamsmith/tests/section-guard.sh +6 -1
  105. package/skills/teamsmith/tests/section-needs-audit.sh +24 -7
  106. package/skills/teamsmith/tests/section-paths.tsv +19 -13
  107. package/skills/teamsmith/tests/section-select.sh +8 -1
  108. package/skills/teamsmith/tests/slash-team-e2e.sh +323 -0
  109. package/skills/teamsmith/tests/slash-team.sh +617 -0
  110. package/skills/teamsmith/tests/smoke.sh +2972 -440
  111. package/skills/teamsmith/tests/task-model-routing.sh +507 -10
  112. package/skills/teamsmith/tests/tmp-hygiene.sh +782 -45
  113. package/skills/teamsmith/tests/tmux-identity-leak.sh +773 -0
  114. package/skills/teamsmith/tests/tmux-lint-legacy.txt +12 -18
  115. package/skills/teamsmith/tests/upgrade-recipe.sh +537 -0
  116. package/skills/teamsmith-init/SKILL.md +12 -12
  117. package/skills/teamsmith-init/references/bootstrap.md +3 -3
@@ -368,6 +368,24 @@ scenario_keys() {
368
368
  assert_eq "B2 cursor_x=5(托盘+提示+Z)" "$(cursor_x)" "5"
369
369
  assert_eq "B2 没按过 Enter(未提交)" "$(submits)" "0"
370
370
 
371
+ # ①半 ctrl+u(V33 第一轮 OBS-1 的缺测项):清空到行首 → **持久化为空草稿**,重开/重启都不带回。
372
+ # 合同:「a draft the human deleted with the compose line's own keys is not resurrected」。
373
+ keys Escape; sleep 0.4
374
+ printf '' > "$(draft_file)"
375
+ keys m; sleep 0.9
376
+ type_text 'half a thought'; sleep 0.5
377
+ assert_eq "B2 ctrl+u:清空前正文已落盘" "$(draft)" "half a thought"
378
+ keys C-u; sleep 0.8
379
+ assert_eq "B2 ctrl+u:草稿文件 0 字节(清空是持久的)" "$(wc -c < "$(draft_file)" | tr -d ' ')" "0"
380
+ cap_to ctrl-u
381
+ assert_not_has "$tmp/keys/ctrl-u.txt" 'half a thought' "B2 ctrl+u:帧里不再出现被删掉的正文"
382
+ keys Escape; sleep 0.4
383
+ start_panel
384
+ keys m; sleep 0.9
385
+ cap_to ctrl-u-reopen
386
+ assert_not_has "$tmp/keys/ctrl-u-reopen.txt" 'half a thought' "B2 ctrl+u:重开(重启后 m)不带回已删正文"
387
+ assert_eq "B2 ctrl+u:重开后草稿文件仍是 0 字节" "$(wc -c < "$(draft_file)" | tr -d ' ')" "0"
388
+
371
389
  # ② 逻辑行边界:45 字符行 + second,↑ ctrl+a ctrl+k → \nsecond
372
390
  keys Escape; sleep 0.4
373
391
  resize_pane 40 30
@@ -493,7 +511,6 @@ scenario_multiline() {
493
511
  assert_has "$tmp/multiline/after-lf.txt" '> ad' "B3 换行后第一行还在"
494
512
  type_text 'b'; sleep 0.5
495
513
  cap_to two-lines
496
- assert_has "$tmp/multiline/two-lines.txt" ' b' "B3 第二行带续行前缀渲染(同一草稿)"
497
514
  keys Enter; sleep 3
498
515
  assert_eq "B3 Enter 仍提交:恰好一条条目" "$(entries | wc -l | tr -d ' ')" "1"
499
516
  assert_eq "B3 条目保住两行" "$(payload_of "$(entries | head -1)")" $'ad\nb'
@@ -1147,12 +1164,97 @@ scenario_readonly() {
1147
1164
  assert_eq "3.2 文档/收件箱零改动" "$(printf '%s\n' "$after" | grep -c '^docs/team')" "$(printf '%s\n' "$before" | grep -c '^docs/team')"
1148
1165
  }
1149
1166
 
1167
+ # ---------------------------------------------------------------- 2.7 the draft settle (P249)
1168
+ scenario_settle() {
1169
+ section "2.7 · 草稿结算:成功一起清空、error 原地保留、写盘失败不假装清掉"
1170
+ server_up settle
1171
+ local before after
1172
+
1173
+ # ① delivered:输入行与 state/draft.md 一起清空;重启后 m 打开空草稿(无幽灵草稿)
1174
+ start_pm '' ''
1175
+ start_panel
1176
+ keys m; sleep 0.6
1177
+ type_text 'half a thought'; sleep 0.4
1178
+ assert_eq "2.7 delivered 发送前:文件里有原文" "$(draft)" "half a thought"
1179
+ keys Enter; sleep 3
1180
+ cap_to delivered
1181
+ assert_has "$tmp/settle/delivered.txt" 'delivered' "2.7 delivered 回执"
1182
+ assert_eq "2.7 delivered:state/draft.md 0 字节" "$(wc -c < "$(draft_file)" | tr -d ' ')" "0"
1183
+ start_panel
1184
+ keys m; sleep 0.6
1185
+ cap_to delivered-reopen
1186
+ assert_not_has "$tmp/settle/delivered-reopen.txt" 'half a thought' "2.7 delivered:重启后 m 不带回已发正文"
1187
+
1188
+ # ② queued(PM 框忙):一样一起清空,PM 的草稿逐字节不变
1189
+ tmux -L "$sock" kill-window -t "$sess:pm" 2>/dev/null || true
1190
+ start_pm '半句草稿 half a sentence' ''
1191
+ start_panel
1192
+ keys m; sleep 0.6
1193
+ type_text 'queued thought'; sleep 0.4
1194
+ before="$(pm_cap)"
1195
+ keys Enter; sleep 3
1196
+ cap_to queued
1197
+ assert_has "$tmp/settle/queued.txt" 'queued' "2.7 queued 回执"
1198
+ assert_eq "2.7 queued:state/draft.md 0 字节" "$(wc -c < "$(draft_file)" | tr -d ' ')" "0"
1199
+ after="$(pm_cap)"
1200
+ assert_eq "2.7 queued:PM 的草稿逐字节不变" "$before" "$after"
1201
+
1202
+ # ③ held(unconfirmed,静态页脚):清空(裁定 D2:结算不是丢失,durable 副本在 outbox/held/)
1203
+ tmux -L "$sock" kill-window -t "$sess:pm" 2>/dev/null || true
1204
+ rm -rf "$ROOT/.pi/team/state/outbox"
1205
+ start_pm '' 'FAKE_TUI_EAT_ENTER=1 FAKE_TUI_STATIC_FOOTER=1'
1206
+ start_panel
1207
+ keys m; sleep 0.6
1208
+ type_text 'held candidate'; sleep 0.4
1209
+ keys Enter; sleep 9
1210
+ cap_to held
1211
+ assert_has "$tmp/settle/held.txt" 'held' "2.7 held 回执"
1212
+ assert_eq "2.7 held:state/draft.md 0 字节(清空是结算)" "$(wc -c < "$(draft_file)" | tr -d ' ')" "0"
1213
+ assert_has "$ROOT/.pi/team/state/outbox/HOLDING.log" 'reason=unconfirmed' "2.7 held:副本在 held/ 且记下原因"
1214
+
1215
+ # ④ error(没有投递目标):文字保留在输入行与文件里,下一次 Enter 从原文重试(compose 不关)
1216
+ tmux -L "$sock" kill-window -t "$sess:pm" 2>/dev/null || true
1217
+ start_panel
1218
+ keys m; sleep 0.6
1219
+ type_text 'kept words'; sleep 0.4
1220
+ keys Enter; sleep 3
1221
+ cap_to error
1222
+ assert_has "$tmp/settle/error.txt" '未确认' "2.7 error 回执(投递未确认)"
1223
+ assert_has "$tmp/settle/error.txt" 'kept words' "2.7 error:输入行仍留着原文"
1224
+ assert_eq "2.7 error:state/draft.md 保留原文" "$(draft)" "kept words"
1225
+ keys Enter; sleep 3
1226
+ cap_to error-retry
1227
+ assert_has "$tmp/settle/error-retry.txt" 'kept words' "2.7 error:下一次 Enter 从保留的原文重试"
1228
+
1229
+ # ⑤ 写盘失败(settle 已成立但清空写不进去):不假装清掉——文字与文件都还在、回执点名文件
1230
+ # (先把 ④ 留在闸里的草稿拿掉,让这一段从干净的一页开始)
1231
+ tmux -L "$sock" kill-window -t "$sess:pm" 2>/dev/null || true
1232
+ rm -f "$(draft_file)"
1233
+ start_pm '' ''
1234
+ start_panel
1235
+ keys m; sleep 0.6
1236
+ type_text 'ghost candidate'; sleep 0.4
1237
+ chmod 444 "$(draft_file)"
1238
+ keys Enter; sleep 3
1239
+ cap_to readonly
1240
+ assert_has "$tmp/settle/readonly.txt" 'draft.md' "2.7 写盘失败:回执点名 state/draft.md"
1241
+ assert_has "$tmp/settle/readonly.txt" 'ghost candidate' "2.7 写盘失败:输入行仍留着原文(不假装清掉)"
1242
+ assert_eq "2.7 写盘失败:文件仍是原文(内存=磁盘)" "$(draft)" "ghost candidate"
1243
+ chmod 644 "$(draft_file)"
1244
+ keys Enter; sleep 3
1245
+ cap_to readonly-retry
1246
+ assert_eq "2.7 清空失败后恢复可写重试:文件清空" "$(wc -c < "$(draft_file)" | tr -d ' ')" "0"
1247
+ assert_not_has "$tmp/settle/readonly-retry.txt" 'ghost candidate' "2.7 重试成功后输入行也空了"
1248
+ }
1249
+
1150
1250
  # ---------------------------------------------------------------- runner
1151
1251
  if [ "${BASH_SOURCE[0]}" != "$0" ]; then
1152
1252
  return 0 2>/dev/null || exit 0
1153
1253
  fi
1154
- ALL="cursor keys multiline clipboard cjk draft editor receipt pause paste actions readonly"
1254
+ ALL="cursor keys multiline clipboard cjk draft editor receipt settle pause paste actions readonly"
1155
1255
  selected="${*:-$ALL}"
1256
+ # P249: `--all` is the explicit whole-suite selector the task's acceptance commands use.
1257
+ [ "$selected" = "--all" ] && selected="$ALL"
1156
1258
  mkdir -p "$tmp"
1157
1259
  rc=0
1158
1260
  for name in $selected; do
@@ -1166,11 +1268,12 @@ for name in $selected; do
1166
1268
  draft) scenario_draft ;;
1167
1269
  editor) scenario_editor ;;
1168
1270
  receipt) scenario_receipt ;;
1271
+ settle) scenario_settle ;;
1169
1272
  pause) scenario_pause ;;
1170
1273
  paste) scenario_paste ;;
1171
1274
  actions) scenario_actions ;;
1172
1275
  readonly) scenario_readonly ;;
1173
- *) printf 'panel-b2: unknown scenario %s(known: %s)\n' "$name" "$ALL" >&2; rs=3 ;;
1276
+ *) printf 'panel-b2: unknown scenario %s(known: %s)\n' "$name" "$ALL" >&2; rc=3 ;;
1174
1277
  esac || rc=$?
1175
1278
  done
1176
1279
 
@@ -17,10 +17,12 @@ block=""
17
17
  prev=""
18
18
  detail_id=""
19
19
  detail_file=""
20
+ detail_source=""
20
21
  for a in "$@"; do
21
22
  [ "$prev" = "--block" ] && block="$a"
22
23
  [ "$prev" = "--id" ] && detail_id="$a"
23
24
  [ "$prev" = "--file" ] && detail_file="$a"
25
+ [ "$prev" = "--source" ] && detail_source="$a"
24
26
  prev="$a"
25
27
  done
26
28
 
@@ -81,6 +83,11 @@ recent_json() { # B3_STUB_RECENT lines, deterministic timestamps; unset = the or
81
83
  }
82
84
 
83
85
  board_json() {
86
+ # B3_STUB_BOARD_EMPTY=1: no rows, so the work page's preview blocks are the only possible rows.
87
+ if [ "${B3_STUB_BOARD_EMPTY:-0}" = "1" ]; then
88
+ printf '%s\n' '{"rows": [], "counts": {"todo": 0, "wip": 0, "review": 0, "done": 0, "blocked": 0, "dropped": 0}, "total": 0, "deliveries": []}'
89
+ return 0
90
+ fi
84
91
  # B3_STUB_BOARD_FILE=<path>: serve that file verbatim — the board-page fixtures rewrite it between
85
92
  # refreshes to prove the focus survives a reorder and falls back when the entry leaves the board.
86
93
  if [ -n "${B3_STUB_BOARD_FILE:-}" ] && [ -r "${B3_STUB_BOARD_FILE}" ]; then
@@ -126,7 +133,102 @@ JSON
126
133
  printf '],\n "counts": {"todo": 1, "wip": 1, "review": 0, "done": %s, "blocked": 1, "dropped": 1},\n "total": %s,\n "deliveries": [\n {"id": "P14", "agent": "dev", "at": "2026-09-16T09:30:00Z"}\n ]}\n' "$n" "$((n + 4))"
127
134
  }
128
135
 
129
- changes_json() { cat <<'JSON'
136
+ # P249: the preview sources' stand-in (`--source spec|change|decision`). One fixed capability
137
+ # `demo`, one fixed change `demo` (its three artifacts) and one fixed decision `D7`; any other id
138
+ # answers the real reader's empty file list + reason, and `--file` must be one of the discovered
139
+ # paths (anything else exits non-zero). `B3_STUB_PREVIEWS=empty` empties the three preview blocks
140
+ # themselves, for the work page's no-dead-item fixture.
141
+ preview_json() { # <source> <id> [file]
142
+ local source="$1" id="$2" want="${3:-}"
143
+ local file="" text="" files="" reason=""
144
+ case "$source" in
145
+ spec)
146
+ if [ "$id" = "demo" ] || [ "$id" = "panel" ]; then
147
+ file="openspec/specs/$id/spec.md"
148
+ files="$(printf '[{"tab": "spec", "name": "spec.md", "path": "openspec/specs/%s/spec.md", "size": 64, "truncated": false}]' "$id")"
149
+ if [ "${B3_STUB_PREVIEW_LONG:-0}" -gt 0 ] 2>/dev/null; then
150
+ local i
151
+ text="# $id spec
152
+
153
+ ### Requirement: One
154
+
155
+ body"
156
+ for ((i = 1; i <= B3_STUB_PREVIEW_LONG; i++)); do printf -v line 'spec line %02d with a few words to read' "$i"; text="$text
157
+ $line"; done
158
+ else
159
+ text="# $id spec
160
+
161
+ ### Requirement: One
162
+
163
+ body"
164
+ fi
165
+ else
166
+ reason="openspec/specs/$id/spec.md 不存在"
167
+ fi
168
+ ;;
169
+ change)
170
+ if [ "$id" = "demo" ] || [ "$id" = "pulse-console" ]; then
171
+ files="$(printf '[{"tab": "proposal", "name": "proposal.md", "path": "openspec/changes/%s/proposal.md", "size": 30, "truncated": false}, {"tab": "design", "name": "design.md", "path": "openspec/changes/%s/design.md", "size": 30, "truncated": false}, {"tab": "tasks", "name": "tasks.md", "path": "openspec/changes/%s/tasks.md", "size": 30, "truncated": false}]' "$id" "$id" "$id")"
172
+ case "$want" in
173
+ ''|"openspec/changes/$id/proposal.md") file="openspec/changes/$id/proposal.md"; text="# $id proposal
174
+
175
+ the proposal body" ;;
176
+ "openspec/changes/$id/design.md") file="$want"; text="# $id design
177
+
178
+ the design body" ;;
179
+ "openspec/changes/$id/tasks.md") file="$want"; text="# $id tasks
180
+
181
+ - [ ] 1.1 the task body" ;;
182
+ *) printf 'panel-b3-stub: --file not in the discovered set: %s\n' "$want" >&2; return 1 ;;
183
+ esac
184
+ else
185
+ reason="openspec/changes/$id/ 下没有 proposal/design/tasks"
186
+ fi
187
+ ;;
188
+ decision)
189
+ case "$id" in
190
+ D40|D39|D38)
191
+ file="docs/team/DECISIONS.md"
192
+ files="$(printf '[{"tab": "%s", "name": "DECISIONS.md", "path": "docs/team/DECISIONS.md", "size": 40, "truncated": false}]' "$id")"
193
+ text="## $id · fixture decision
194
+
195
+ $id body
196
+
197
+ ### $id 补记
198
+
199
+ deeper addendum"
200
+ ;;
201
+ *) reason="DECISIONS.md 里没有 $id" ;;
202
+ esac
203
+ ;;
204
+ *)
205
+ printf 'panel-b3-stub: unknown --source %s\n' "$source" >&2
206
+ return 2
207
+ ;;
208
+ esac
209
+ # The single-file sources serve exactly their discovered path.
210
+ case "$source" in
211
+ spec|decision)
212
+ if [ -n "$want" ] && [ "$want" != "$file" ]; then
213
+ printf 'panel-b3-stub: --file not in the discovered set: %s\n' "$want" >&2
214
+ return 1
215
+ fi
216
+ ;;
217
+ esac
218
+ if [ -z "$file" ]; then
219
+ printf '{"id": %s, "count": 0, "file": "", "text": "", "truncated": false, "files": [], "reason": %s}\n' \
220
+ "$(json_str "$id")" "$(json_str "$reason")"
221
+ return 0
222
+ fi
223
+ printf '{"id": %s, "count": 1, "file": %s, "text": %s, "truncated": false, "files": %s}\n' \
224
+ "$(json_str "$id")" "$(json_str "$file")" "$(json_str_ml "$text")" "$files"
225
+ }
226
+
227
+ changes_json() {
228
+ case "${B3_STUB_PREVIEWS:-}" in
229
+ empty|specs-only) printf '%s\n' '{"available": true, "source": "dir", "count": 0, "changes": []}'; return 0 ;;
230
+ esac
231
+ cat <<'JSON'
130
232
  {"available": true, "source": "openspec", "count": 2, "changes": [
131
233
  {"id": "pulse-console", "done": 8, "total": 28, "age": "44m ago", "phase": "apply"},
132
234
  {"id": "rename-watchdog", "done": 12, "total": 12, "age": "2d ago", "phase": "verify"}
@@ -134,7 +236,9 @@ changes_json() { cat <<'JSON'
134
236
  JSON
135
237
  }
136
238
 
137
- specs_json() { cat <<'JSON'
239
+ specs_json() {
240
+ if [ "${B3_STUB_PREVIEWS:-}" = "empty" ]; then printf '%s\n' '{"available": true, "count": 0, "requirements": 0, "specs": []}'; return 0; fi
241
+ cat <<'JSON'
138
242
  {"available": true, "count": 12, "requirements": 45, "specs": [
139
243
  {"name": "panel", "requirements": 12},
140
244
  {"name": "watchdog", "requirements": 10},
@@ -144,7 +248,11 @@ specs_json() { cat <<'JSON'
144
248
  JSON
145
249
  }
146
250
 
147
- decisions_json() { cat <<'JSON'
251
+ decisions_json() {
252
+ case "${B3_STUB_PREVIEWS:-}" in
253
+ empty|specs-only) printf '%s\n' '{"count": 0, "recent": []}'; return 0 ;;
254
+ esac
255
+ cat <<'JSON'
148
256
  {"count": 40, "recent": ["D40 · 2026-09-16 · 决定 — 控制台分三批", "D39 · 2026-09-16 · 决定 — i18n 进 B3", "D38 · 2026-09-15 · 决定 — q 收起不清巡检"]}
149
257
  JSON
150
258
  }
@@ -290,7 +398,7 @@ case "$block" in
290
398
  outbox_list) outbox_list_json ;;
291
399
  inbox) inbox_json ;;
292
400
  patrol) patrol_json ;;
293
- detail) detail_json "$detail_id" "$detail_file" ;;
401
+ detail) if [ -n "$detail_source" ]; then preview_json "$detail_source" "$detail_id" "$detail_file"; else detail_json "$detail_id" "$detail_file"; fi ;;
294
402
  # pulse-key-replies:三个回复块也是固定数据(默认「显式空」,B3_STUB_REPLY=1 → 一条 1 号回复,
295
403
  # =corrupt → 最新槽位不可用),这样第 5 页与总览的摘要行在快照里逐字节可复现。
296
404
  reply_summary) reply_summary_json ;;
@@ -357,7 +357,6 @@ scn_pages() {
357
357
  wait_cap_has p3-inbox "收件箱与往来" "捕获里有 [收件箱与往来]"
358
358
  if wait_frame "$tmp/$current/p3-inbox.txt" "消息页计数行(往来,无线程)" '收件箱' '往来' '!线程'; then
359
359
  assert_not "$tmp/$current/p3-inbox.txt" "线程" "捕获里没有 [线程]"
360
- assert_match "$tmp/$current/p3-inbox.txt" '收件箱 [0-9]+ 条 · 往来 [0-9]+ 条' "消息页计数行用「往来」"
361
360
  else
362
361
  b3_wait_verdict $? "捕获里没有 [线程]" "消息页计数行没有在预算内落定"
363
362
  fi
@@ -550,46 +549,154 @@ PYW
550
549
  bad "B5 第二次点击没有打开详情"
551
550
  fi
552
551
 
553
- # ⑥ 空看板:没有光标、没有行键、没有 focus/open-focused 目标、enter 不开任何东西
552
+ # ⑥ 空看板 + 预览块也清空:没有光标、没有行键、没有 focus/open-focused 目标、enter 不开任何东西
554
553
  python3 - "$tmp/$current/empty.json" <<'PYE'
555
554
  import json, sys
556
555
  json.dump({"rows": [], "counts": {}, "total": 0, "deliveries": []}, open(sys.argv[1], "w"))
557
556
  PYE
558
557
  printf '2\n' > "$(page_file)"
559
- start_panel "B3_STUB_BOARD_FILE='$tmp/$current/empty.json'"
558
+ start_panel "B3_STUB_BOARD_FILE='$tmp/$current/empty.json' B3_STUB_PREVIEWS=empty"
560
559
  keys Down; sleep 0.5
561
560
  keys Enter; sleep 0.8
562
561
  wcap empty
563
- assert_eq "B5 空看板:没有焦点光标" "$(grep -o '›' "$(wfile empty)" | wc -l | tr -d ' ')" "0"
564
- assert_not "$(wfile empty)" "详情" "B5 空看板:enter 不开详情"
565
- assert_eq "B5 空看板:panel-page 仍是 2" "$(page_of)" "2"
566
- assert_has "$(wfile empty)" "看板为空" "B5 空看板:块显示空态而不是一行空行"
567
- B3_STUB_BOARD_FILE="$tmp/$current/empty.json" "$js" "$panel" --snapshot --targets --root "$ROOT" --state-dir "$state" \
562
+ assert_eq "B5 空看板 + 空预览块:没有焦点光标" "$(grep -o '›' "$(wfile empty)" | wc -l | tr -d ' ')" "0"
563
+ assert_not "$(wfile empty)" "详情" "B5 空看板 + 空预览块:enter 不开详情"
564
+ assert_eq "B5 空看板 + 空预览块:panel-page 仍是 2" "$(page_of)" "2"
565
+ assert_not "$(wfile empty)" "↑/↓ 行" "B5 空看板 + 空预览块:键位带不发行键"
566
+ B3_STUB_BOARD_FILE="$tmp/$current/empty.json" B3_STUB_PREVIEWS=empty "$js" "$panel" --snapshot --targets --root "$ROOT" --state-dir "$state" \
568
567
  --team-cli "$stub" --lang zh --theme dark --width 120 --height 32 --page 2 >"$tmp/$current/empty-targets.json" 2>/dev/null
569
568
  local kinds
570
569
  kinds="$(kinds_of "$tmp/$current/empty-targets.json")"
571
570
  case ",$kinds," in
572
- *",focus,"*|*",open-focused,"*) bad "B5 空看板的目标表还有 focus/open-focused($kinds)" ;;
573
- *) ok "B5 空看板的目标表没有 focus/open-focused($kinds)" ;;
571
+ *",focus,"*|*",open-focused,"*) bad "B5 空看板 + 空预览块的目标表还有 focus/open-focused($kinds)" ;;
572
+ *) ok "B5 空看板 + 空预览块的目标表没有 focus/open-focused($kinds)" ;;
574
573
  esac
575
574
 
576
- # ⑦ 60x10 降级:没有光标、没有行键、没有死项目标
577
- start_panel
575
+ # ⑥b 空看板 + 预览行(P249):↓ 落在页面行序的第一行(变更块首行),enter 开它的预览,q 原地返回
576
+ start_panel "B3_STUB_BOARD_FILE='$tmp/$current/empty.json'"
577
+ keys Down; sleep 0.6
578
+ wcap empty-preview-focus
579
+ assert_eq "B5 空看板 + 预览行:↓ 后恰好一个光标" "$(grep -o '›' "$(wfile empty-preview-focus)" | wc -l | tr -d ' ')" "1"
580
+ if grep -qE '› +pulse-console' "$(wfile empty-preview-focus)"; then
581
+ ok "B5 空看板 + 预览行:焦点落在变更块第一行(空看板不是丢掉活行的理由)"
582
+ else
583
+ bad "B5 空看板 + 预览行:焦点没有落到变更块第一行"
584
+ fi
585
+ keys Enter; sleep 1.4
586
+ wcap empty-preview-detail
587
+ assert_has "$(wfile empty-preview-detail)" "[proposal]" "B5 空看板 + 预览行:enter 打开变更预览(proposal tab)"
588
+ assert_has "$(wfile empty-preview-detail)" "the proposal body" "B5 空看板 + 预览行:变更预览渲染正文"
589
+ assert_not "$(wfile empty-preview-detail)" "任务看板" "B5 变更预览替换了工作页的块"
590
+ assert_eq "B5 打开预览后仍在第 2 页" "$(page_of)" "2"
591
+ keys q; sleep 0.8
592
+ wcap empty-preview-back
593
+ assert_has "$(wfile empty-preview-back)" "活动变更" "B5 预览 q 回工作页"
594
+ assert_not "$(wfile empty-preview-back)" "详情" "B5 预览 q 关掉了详情"
595
+ assert_eq "B5 预览返回后 panel-page 仍是 2" "$(page_of)" "2"
596
+
597
+ # ⑥c 空看板 + 只有规格块一行(P249 的第三个夹具):↓ 落到 specs 行,enter 开 spec 预览
598
+ start_panel "B3_STUB_BOARD_FILE='$tmp/$current/empty.json' B3_STUB_PREVIEWS=specs-only"
599
+ keys Down; sleep 0.6
600
+ wcap specs-focus
601
+ assert_eq "B5 空看板 + 规格行:↓ 后恰好一个光标" "$(grep -o '›' "$(wfile specs-focus)" | wc -l | tr -d ' ')" "1"
602
+ if grep -qE '› +panel' "$(wfile specs-focus)"; then
603
+ ok "B5 空看板 + 规格行:焦点落在规格块的那一行"
604
+ else
605
+ bad "B5 空看板 + 规格行:焦点没有落到规格块"
606
+ fi
607
+ keys Enter; sleep 1.4
608
+ wcap specs-detail
609
+ assert_has "$(wfile specs-detail)" "[spec]" "B5 规格预览:spec tab 默认打开"
610
+ assert_has "$(wfile specs-detail)" "Requirement: One" "B5 规格预览:渲染 spec 正文"
611
+ assert_eq "B5 规格预览返回后仍在第 2 页" "$(page_of)" "2"
612
+ keys q; sleep 0.8
613
+
614
+ # ⑦ 60x10 降级 + 预览块清空:没有光标、没有行键、没有死项目标(旧断言的新夹具)
615
+ start_panel "B3_STUB_PREVIEWS=empty"
578
616
  tmux -L "$sock" resize-window -t "$sess:panel" -x 60 -y 10 2>/dev/null || true
579
617
  sleep 1.4
580
618
  keys Down; sleep 0.5
581
619
  keys Enter; sleep 0.8
582
620
  wcap degraded
583
- assert_eq "B5 60x10 降级:没有焦点光标" "$(grep -o '›' "$(wfile degraded)" | wc -l | tr -d ' ')" "0"
584
- assert_not "$(wfile degraded)" "详情" "B5 60x10 降级:enter 不开详情"
585
- assert_not "$(wfile degraded)" "↑/↓ 行" "B5 60x10 降级:键位带不发行键"
586
- "$js" "$panel" --snapshot --targets --root "$ROOT" --state-dir "$state" --team-cli "$stub" \
621
+ assert_eq "B5 60x10 降级 + 空预览块:没有焦点光标" "$(grep -o '›' "$(wfile degraded)" | wc -l | tr -d ' ')" "0"
622
+ assert_not "$(wfile degraded)" "详情" "B5 60x10 降级 + 空预览块:enter 不开详情"
623
+ assert_not "$(wfile degraded)" "↑/↓ 行" "B5 60x10 降级 + 空预览块:键位带不发行键"
624
+ B3_STUB_PREVIEWS=empty "$js" "$panel" --snapshot --targets --root "$ROOT" --state-dir "$state" --team-cli "$stub" \
587
625
  --lang zh --theme dark --width 60 --height 10 --page 2 >"$tmp/$current/degraded-targets.json" 2>/dev/null
588
626
  kinds="$(kinds_of "$tmp/$current/degraded-targets.json")"
589
627
  case ",$kinds," in
590
- *",focus,"*|*",open-focused,"*) bad "B5 60x10 降级的目标表还有 focus/open-focused($kinds)" ;;
591
- *) ok "B5 60x10 降级的目标表没有 focus/open-focused($kinds)" ;;
628
+ *",focus,"*|*",open-focused,"*) bad "B5 60x10 降级 + 空预览块的目标表还有 focus/open-focused($kinds)" ;;
629
+ *) ok "B5 60x10 降级 + 空预览块的目标表没有 focus/open-focused($kinds)" ;;
592
630
  esac
631
+
632
+ # ⑦b 60x10 降级 + 预览行:↓ 落到一盏可开的预览行,enter 打开它的预览(不留在板内死路上)
633
+ start_panel
634
+ tmux -L "$sock" resize-window -t "$sess:panel" -x 60 -y 10 2>/dev/null || true
635
+ sleep 1.4
636
+ keys Down; sleep 0.6
637
+ wcap degraded-preview-focus
638
+ assert_eq "B5 60x10 降级 + 预览行:恰好一个光标" "$(grep -o '›' "$(wfile degraded-preview-focus)" | wc -l | tr -d ' ')" "1"
639
+ keys Enter; sleep 1.4
640
+ wcap degraded-preview-detail
641
+ if grep -qE '\[(proposal|spec|D[0-9]+)\]' "$(wfile degraded-preview-detail)"; then
642
+ ok "B5 60x10 降级:enter 打开的是预览(不是板内死项)"
643
+ else
644
+ bad "B5 60x10 降级:enter 没有打开预览"
645
+ fi
646
+ assert_eq "B5 60x10 降级预览返回后仍在第 2 页" "$(page_of)" "2"
647
+ keys q; sleep 0.8
648
+
649
+ # ⑧ 一页一行序(delta 的场景:板 2 行 + 规格 1 行):三↓ 依次落在板首行、板次行、规格块行
650
+ python3 - "$tmp/$current/two.json" <<'PYW2'
651
+ import json, sys
652
+ json.dump({"rows": [
653
+ {"id": "P14", "title": "一", "agent": "dev", "branch": "task/P14", "deps": "-", "state": "wip", "phase": "apply"},
654
+ {"id": "V14", "title": "二", "agent": "verify", "branch": "-", "deps": "P14", "state": "todo", "phase": "verify"},
655
+ ], "counts": {"todo": 1, "wip": 1, "review": 0, "done": 0, "blocked": 0, "dropped": 0}, "total": 2, "deliveries": []}, open(sys.argv[1], "w"))
656
+ PYW2
657
+ start_panel "B3_STUB_BOARD_FILE='$tmp/$current/two.json' B3_STUB_PREVIEWS=specs-only"
658
+ keys Down; sleep 0.5
659
+ wcap walk-1
660
+ assert_eq "B5 一页一行序:第一 ↓ 落在板首行 P14" "$(focused_id "$(wfile walk-1)")" "P14"
661
+ assert_eq "B5 一页一行序:第一步恰好一个光标" "$(grep -o '›' "$(wfile walk-1)" | wc -l | tr -d ' ')" "1"
662
+ keys Down; sleep 0.4
663
+ wcap walk-2
664
+ assert_eq "B5 一页一行序:第二 ↓ 落在板次行 V14" "$(focused_id "$(wfile walk-2)")" "V14"
665
+ assert_eq "B5 一页一行序:第二步恰好一个光标" "$(grep -o '›' "$(wfile walk-2)" | wc -l | tr -d ' ')" "1"
666
+ keys Down; sleep 0.5
667
+ wcap walk-3
668
+ if grep -qE '› +panel' "$(wfile walk-3)"; then
669
+ ok "B5 一页一行序:第三 ↓ 跨块落到规格行"
670
+ else
671
+ bad "B5 一页一行序:第三 ↓ 没有跨到规格行(跨块断掉)"
672
+ fi
673
+ assert_eq "B5 一页一行序:第三步恰好一个光标" "$(grep -o '›' "$(wfile walk-3)" | wc -l | tr -d ' ')" "1"
674
+ keys Enter; sleep 1.2
675
+ wcap walk-open
676
+ assert_has "$(wfile walk-open)" "[spec]" "B5 一页一行序:规格行 enter 开 spec 预览"
677
+ assert_eq "B5 一页一行序:预览仍在第 2 页" "$(page_of)" "2"
678
+ keys q; sleep 0.7
679
+ wcap walk-back
680
+ assert_eq "B5 一页一行序:关闭后焦点仍在同一行" "$(grep -cE '› +panel' "$(wfile walk-back)")" "1"
681
+
682
+ # ⑨ 变更行与决策行各自开自己的 source(delta 的场景):默认夹具里走到 D40,enter 开决策预览
683
+ start_panel
684
+ wfocused=-1
685
+ for wi in $(seq 1 30); do
686
+ if cap | grep -qE '› +D40'; then wfocused=0; break; fi
687
+ keys Down; sleep 0.25
688
+ done
689
+ assert_eq "B5 决策行:↓ 在 30 步内走到决策块第一行 D40" "$wfocused" "0"
690
+ keys Enter; sleep 1.4
691
+ wcap decision-detail
692
+ assert_has "$(wfile decision-detail)" "[D40]" "B5 决策预览:tab 是条目号 D40"
693
+ assert_has "$(wfile decision-detail)" "D40 body" "B5 决策预览:渲染条目正文"
694
+ assert_has "$(wfile decision-detail)" "deeper addendum" "B5 决策预览:同号补记留在正文里"
695
+ assert_eq "B5 决策预览:打开后仍在第 2 页" "$(page_of)" "2"
696
+ keys q; sleep 0.8
697
+ wcap decision-back
698
+ assert_has "$(wfile decision-back)" "最近决策" "B5 决策预览:q 原地回工作页"
699
+ assert_not "$(wfile decision-back)" "详情" "B5 决策预览:q 关掉了详情"
593
700
  }
594
701
 
595
702
  scn_mouse() {
@@ -670,7 +777,6 @@ scn_resize() {
670
777
  tmux -L "$sock" resize-window -t "$sess:panel" -x 99 -y 32 2>/dev/null || true
671
778
  sleep 0.6
672
779
  cap_to narrow
673
- assert_has "$tmp/$current/narrow.txt" "代理" "99 列:单列仍渲染 agent 表"
674
780
  # Reflow to the wide tier: the agent table and the right block share a row.
675
781
  tmux -L "$sock" resize-window -t "$sess:panel" -x 160 -y 32 2>/dev/null || true
676
782
  sleep 1.2
@@ -1045,6 +1151,53 @@ scn_detail() {
1045
1151
  assert_has "$(dfile back-esc)" "已放弃" "Esc 返回看板页"
1046
1152
  assert_not "$(dfile back-esc)" "详情 V14" "Esc 之后详情视图关闭"
1047
1153
 
1154
+ # P249: a preview's artifacts switch with ←/→, ↑/↓ scrolls the document and q returns to the work
1155
+ # page it was opened from — the same view and the same close contract as an entry's detail.
1156
+ printf '2\n' > "$(page_file)"
1157
+ start_panel "B3_STUB_PREVIEW_LONG=40"
1158
+ local wi wfocused=-1
1159
+ for wi in $(seq 1 16); do
1160
+ keys Down; sleep 0.25
1161
+ if cap | grep -qE '› +pulse-console'; then wfocused=0; break; fi
1162
+ done
1163
+ assert_eq "P249 预览:↓ 在 16 步内走到变更块第一行" "$wfocused" "0"
1164
+ keys Enter; sleep 1.4
1165
+ dcap preview-proposal
1166
+ assert_has "$(dfile preview-proposal)" "[proposal]" "P249 预览:变更的第一 tab 是 proposal"
1167
+ assert_has "$(dfile preview-proposal)" "the proposal body" "P249 预览:proposal 正文上屏"
1168
+ assert_eq "P249 预览:打开后仍在第 2 页" "$(page_of)" "2"
1169
+ keys Right; sleep 0.8
1170
+ dcap preview-design
1171
+ assert_has "$(dfile preview-design)" "[design]" "P249 预览:→ 切到 design tab"
1172
+ assert_has "$(dfile preview-design)" "the design body" "P249 预览:design 正文上屏"
1173
+ keys Right; sleep 0.8
1174
+ dcap preview-tasks
1175
+ assert_has "$(dfile preview-tasks)" "[tasks]" "P249 预览:再 → 切到 tasks tab"
1176
+ assert_has "$(dfile preview-tasks)" "the task body" "P249 预览:tasks 正文上屏"
1177
+ keys q; sleep 0.8
1178
+ dcap preview-back
1179
+ assert_has "$(dfile preview-back)" "活动变更" "P249 预览:q 回工作页"
1180
+ assert_not "$(dfile preview-back)" "详情" "P249 预览:q 关掉了详情"
1181
+ # 规格预览:一个 tab,长正文可滚动;Esc 同样原地返回
1182
+ wfocused=-1
1183
+ for wi in $(seq 1 6); do
1184
+ if cap | grep -qE '› +panel'; then wfocused=0; break; fi
1185
+ keys Down; sleep 0.3
1186
+ done
1187
+ assert_eq "P249 预览:关闭后继续走到规格行" "$wfocused" "0"
1188
+ keys Enter; sleep 1.4
1189
+ dcap preview-spec
1190
+ assert_has "$(dfile preview-spec)" "[spec]" "P249 预览:规格一个 tab"
1191
+ assert_has "$(dfile preview-spec)" "spec line 01" "P249 预览:规格正文第一行"
1192
+ for i in 1 2 3 4 5 6 7 8; do keys Down; sleep 0.08; done
1193
+ sleep 0.6
1194
+ dcap preview-spec-scrolled
1195
+ assert_has "$(dfile preview-spec-scrolled)" "spec line 09" "P249 预览:↓×8 滚动规格正文(第 9 行进入视图)"
1196
+ keys Escape; sleep 0.8
1197
+ dcap preview-spec-back
1198
+ assert_has "$(dfile preview-spec-back)" "任务看板" "P249 预览:Esc 回工作页"
1199
+ assert_not "$(dfile preview-spec-back)" "详情" "P249 预览:Esc 关掉了详情"
1200
+
1048
1201
  # 9.3: read-only — only the console's own three state files may differ after the session.
1049
1202
  local docs_after other_after
1050
1203
  docs_after="$(cd "$ROOT" && find docs -type f | sort | xargs -r md5sum | md5sum)"
@@ -1276,6 +1429,9 @@ PYC
1276
1429
 
1277
1430
  # ---------------------------------------------------------------- run
1278
1431
  want=("$@")
1432
+ # P249: `--all` is the explicit whole-suite selector the task's acceptance commands use; with no
1433
+ # argument the behaviour is unchanged (every scenario), and an unknown name stays a no-op.
1434
+ if [ "${want[0]:-}" = "--all" ]; then want=(); fi
1279
1435
  run_scn() {
1280
1436
  local name="$1"
1281
1437
  if [ ${#want[@]} -gt 0 ]; then
@@ -509,11 +509,13 @@ fi
509
509
 
510
510
  # ---------------------------------------------------------------- flip-drop-pm(F-A)
511
511
  if want flip-drop-pm; then
512
- section "flip F-A · 从 known 里去掉独立 PM 模型 → known 断言必须红且点名 pm;恢复 → 绿"
512
+ section "flip F-A · 从 known 里去掉独立 PM 模型 → known 断言必须红且点名独立 PM;恢复 → 绿"
513
513
  ft="$tmp/flip-drop-pm"
514
514
  mkdir -p "$ft/skills/teamsmith"
515
515
  cp -a "$skill/scripts" "$ft/skills/teamsmith/scripts"
516
- cp -a "$skill/templates" "$skill/references" "$ft/skills/teamsmith/"
516
+ # P315:`team init` 现在要装 `/team` 扩展(源 = <skill>/extension/team.ts),夹具的拷贝集合要跟上;
517
+ # 少拷一层时 `new_proj` 里的 init 直接退出、走查拿不到结论,红侧就是假红。
518
+ cp -a "$skill/templates" "$skill/references" "$skill/extension" "$ft/skills/teamsmith/"
517
519
  python3 - "$ft/skills/teamsmith/scripts/lib/cmd-config.sh" <<'PYPATCH'
518
520
  import sys
519
521
  p = sys.argv[1]
@@ -535,10 +537,12 @@ PYPATCH
535
537
  rc_red=$?
536
538
  TEAM_CHOICES_TREE="$tree" bash "$here/panel-choices.sh" known > "$tmp/flip-drop-pm-green.log" 2>&1
537
539
  rc_green=$?
538
- if [ "$rc_red" -ne 0 ] && grep -a '✗' "$tmp/flip-drop-pm-red.log" | grep -qi 'pm'; then
539
- ok "F-A:去掉 PM 的 known 解析后断言红且点名 pm(rc=$rc_red)"
540
+ # P315:匹配口径收窄到正文里的「独立 PM」——原来是 `grep -qi 'pm'`,而红日志里的临时路径就叫
541
+ # `teamsmith-panel-choice-pm_skills-…`,于是 `team init` 在夹具里当场失败也能把这条判成 ok(假绿)。
542
+ if [ "$rc_red" -ne 0 ] && grep -a '✗' "$tmp/flip-drop-pm-red.log" | grep -qF '独立 PM'; then
543
+ ok "F-A:去掉 PM 的 known 解析后断言红且点名独立 PM(rc=$rc_red)"
540
544
  else
541
- bad "F-A:去掉 PM 的 known 解析后断言没红/没点名 pm(rc=$rc_red)"
545
+ bad "F-A:去掉 PM 的 known 解析后断言没红/没点名独立 PM(rc=$rc_red)"
542
546
  fi
543
547
  [ "$rc_green" -eq 0 ] && ok "F-A:恢复真树后 known 断言绿" || bad "F-A:真树也红了(rc=$rc_green)"
544
548
  printf ' --- 红侧尾部 ---\n'
@@ -551,7 +555,8 @@ if want flip-suggest; then
551
555
  ft="$tmp/flip-suggest"
552
556
  mkdir -p "$ft/skills/teamsmith"
553
557
  cp -a "$skill/scripts" "$ft/skills/teamsmith/scripts"
554
- cp -a "$skill/templates" "$skill/references" "$ft/skills/teamsmith/"
558
+ # P315:与 F-A 同理 —— `team init` 要 extension/team.ts 才能装完,少拷一层就是夹具坏掉(走查 rc=3)。
559
+ cp -a "$skill/templates" "$skill/references" "$skill/extension" "$ft/skills/teamsmith/"
555
560
  flip_cfg="$ft/skills/teamsmith/scripts/lib/cmd-config.sh"
556
561
  cp -a "$cmd_config" "$flip_cfg"
557
562
  python3 - "$flip_cfg" <<'PY'
@@ -158,7 +158,8 @@ printf '== measured project root: %s (neutral fixture project — not the caller
158
158
  printf '== console bundle under test: %s (tree under test %s) ==\n' "$panel" "$tree"
159
159
 
160
160
  hz="$(getconf CLK_TCK 2>/dev/null || echo 100)"
161
- time_out="$(mktemp "${TMPDIR:-/tmp}/p12cpu.XXXXXX")"
161
+ team_tmp_root_prepare >/dev/null 2>&1 || true
162
+ time_out="$(mktemp "$(team_tmp_root)/teamsmith-p12cpu.$(tmp_root_ns).XXXXXX")"
162
163
  # TEAM_PANEL_CPU_PAGE=<1|2|3|4> parks the measured console on that page (the board page's kanban is
163
164
  # the heaviest layout, so the red line is checked there too — P18/B2 item 6.4).
164
165
  page_flag=""
@@ -18,6 +18,11 @@ set -uo pipefail
18
18
  here="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
19
19
  tree="${TEAM_PANEL_CPU_TREE:-$(cd -P "$here/../../.." && pwd)}"
20
20
  cpu="$here/panel-cpu.sh"
21
+
22
+ # P287:临时根名字里的项目命名空间(ns)的唯一实现在 scripts/lib/common.sh。
23
+ if ! declare -F team_project_ns >/dev/null 2>&1; then
24
+ [ -f "$here/../scripts/lib/common.sh" ] && . "$here/../scripts/lib/common.sh"
25
+ fi
21
26
  PASS=0; FAIL=0
22
27
  ok() { printf ' \033[32m✓\033[0m %s\n' "$1"; PASS=$((PASS + 1)); }
23
28
  bad() { printf ' \033[31m✗\033[0m %s\n' "$1"; FAIL=$((FAIL + 1)); }
@@ -31,7 +36,8 @@ real_load="$(cut -d' ' -f1 /proc/loadavg 2>/dev/null || printf '?')"
31
36
  real_cores="$(nproc 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null || printf 0)"
32
37
  case "$real_cores" in ''|*[!0-9]*) real_cores=0 ;; esac
33
38
 
34
- out="$(mktemp "${TMPDIR:-/tmp}/panel-knobs.XXXXXX")"
39
+ team_tmp_root_prepare >/dev/null 2>&1 || true
40
+ out="$(mktemp "$(team_tmp_root)/teamsmith-panel-knobs.$(team_project_ns 2>/dev/null || printf 'nosig-00000000').XXXXXX")"
35
41
  trap 'rm -f "$out"' EXIT
36
42
  # 夹具开关**显式清掉**(继承来的 TEAM_SMOKE_FIXTURE=1 会让注入被采信,那样这条检查就假绿);
37
43
  # 三个旋钮全部注入,正是 d-realpath 的形状。