teamsmith 0.2.0 → 0.3.1

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 (163) hide show
  1. package/README.md +4 -4
  2. package/package.json +1 -1
  3. package/skills/teamsmith/CHANGELOG.md +69 -0
  4. package/skills/teamsmith/SKILL.md +20 -13
  5. package/skills/teamsmith/extension/team-inbox-watch.ts +5 -3
  6. package/skills/teamsmith/extension/team-notify.ts +37 -6
  7. package/skills/teamsmith/extension/team.ts +438 -0
  8. package/skills/teamsmith/references/config.md +39 -6
  9. package/skills/teamsmith/references/migration.md +197 -47
  10. package/skills/teamsmith/references/protocol.md +201 -30
  11. package/skills/teamsmith/references/troubleshooting.md +130 -10
  12. package/skills/teamsmith/references/workflows.md +36 -2
  13. package/skills/teamsmith/scripts/lib/cmd-agents.sh +318 -23
  14. package/skills/teamsmith/scripts/lib/cmd-bootstrap.sh +2 -2
  15. package/skills/teamsmith/scripts/lib/cmd-config.sh +349 -67
  16. package/skills/teamsmith/scripts/lib/cmd-draft.sh +4 -4
  17. package/skills/teamsmith/scripts/lib/cmd-help.sh +677 -0
  18. package/skills/teamsmith/scripts/lib/cmd-init.sh +157 -5
  19. package/skills/teamsmith/scripts/lib/cmd-interrupt.sh +461 -0
  20. package/skills/teamsmith/scripts/lib/cmd-meeting.sh +2 -25
  21. package/skills/teamsmith/scripts/lib/cmd-project.sh +30 -103
  22. package/skills/teamsmith/scripts/lib/cmd-reap.sh +277 -0
  23. package/skills/teamsmith/scripts/lib/cmd-reply.sh +3 -3
  24. package/skills/teamsmith/scripts/lib/cmd-review.sh +182 -32
  25. package/skills/teamsmith/scripts/lib/cmd-status.sh +234 -21
  26. package/skills/teamsmith/scripts/lib/cmd-update.sh +36 -7
  27. package/skills/teamsmith/scripts/lib/cmd-watch.sh +564 -46
  28. package/skills/teamsmith/scripts/lib/common.sh +1004 -245
  29. package/skills/teamsmith/scripts/lib/gate-lock.sh +582 -0
  30. package/skills/teamsmith/scripts/panel/draft-send.sh +11 -1
  31. package/skills/teamsmith/scripts/panel/panel.js +211 -211
  32. package/skills/teamsmith/scripts/panel/src/App.tsx +58 -21
  33. package/skills/teamsmith/scripts/panel/src/clipboard.ts +12 -5
  34. package/skills/teamsmith/scripts/panel/src/compose.ts +6 -3
  35. package/skills/teamsmith/scripts/panel/src/data.ts +51 -5
  36. package/skills/teamsmith/scripts/panel/src/layout.ts +209 -69
  37. package/skills/teamsmith/scripts/panel/src/main.tsx +37 -8
  38. package/skills/teamsmith/scripts/panel/src/strings/en.ts +39 -29
  39. package/skills/teamsmith/scripts/panel/src/strings/zh.ts +41 -31
  40. package/skills/teamsmith/scripts/panel/src/types.ts +28 -3
  41. package/skills/teamsmith/scripts/replies.mjs +4 -1
  42. package/skills/teamsmith/scripts/shim/killall +10 -0
  43. package/skills/teamsmith/scripts/shim/pgrep +10 -0
  44. package/skills/teamsmith/scripts/shim/pidof +10 -0
  45. package/skills/teamsmith/scripts/shim/pkill +10 -0
  46. package/skills/teamsmith/scripts/shim/signal-gate +108 -31
  47. package/skills/teamsmith/scripts/shim/tmux +18 -0
  48. package/skills/teamsmith/scripts/strings/commands.tsv +86 -0
  49. package/skills/teamsmith/scripts/strings/help.en.tsv +503 -0
  50. package/skills/teamsmith/scripts/strings/help.zh.tsv +489 -0
  51. package/skills/teamsmith/scripts/team +19 -6
  52. package/skills/teamsmith/templates/AGENTS.section.md.tmpl +8 -1
  53. package/skills/teamsmith/templates/config.sh.tmpl +20 -1
  54. package/skills/teamsmith/templates/pm-prompt.md.tmpl +21 -0
  55. package/skills/teamsmith/tests/README.md +31 -0
  56. package/skills/teamsmith/tests/bg-ledger-harness.mjs +464 -40
  57. package/skills/teamsmith/tests/bg-ledger.sh +168 -10
  58. package/skills/teamsmith/tests/checkout-shape-probe.sh +83 -54
  59. package/skills/teamsmith/tests/config-cli.sh +184 -32
  60. package/skills/teamsmith/tests/fixtures/delivery-truth-real/scenario.sh +7 -1
  61. package/skills/teamsmith/tests/fixtures/p287/lint-good.sh.in +3 -0
  62. package/skills/teamsmith/tests/fixtures/p287/lint-hardcoded.sh.in +3 -0
  63. package/skills/teamsmith/tests/fixtures/p287/lint-no-ns.sh.in +3 -0
  64. package/skills/teamsmith/tests/fixtures/p55/flip-p49.sh +18 -6
  65. package/skills/teamsmith/tests/flip-m33.sh +5 -3
  66. package/skills/teamsmith/tests/flip-p158.sh +2 -1
  67. package/skills/teamsmith/tests/flip-p308-skip-not-pass.sh +151 -0
  68. package/skills/teamsmith/tests/flip-p310-lock.sh +210 -0
  69. package/skills/teamsmith/tests/flip-p310-socket.sh +125 -0
  70. package/skills/teamsmith/tests/gate-guard.sh +52 -79
  71. package/skills/teamsmith/tests/help-surface.sh +1664 -0
  72. package/skills/teamsmith/tests/install-shape.sh +359 -22
  73. package/skills/teamsmith/tests/key-replies-pty.sh +9 -10
  74. package/skills/teamsmith/tests/key-replies-ui.sh +2 -8
  75. package/skills/teamsmith/tests/key-replies.sh +281 -28
  76. package/skills/teamsmith/tests/ledger-ban.sh +5 -4
  77. package/skills/teamsmith/tests/ledger-claim.sh +2 -1
  78. package/skills/teamsmith/tests/lib/bounded-spin.sh +90 -0
  79. package/skills/teamsmith/tests/lib/model-policy.sh +4 -0
  80. package/skills/teamsmith/tests/lib/model-routing-flips.py +51 -0
  81. package/skills/teamsmith/tests/lib/pty-wait.sh +21 -111
  82. package/skills/teamsmith/tests/lib/reply-fixture.sh +4 -9
  83. package/skills/teamsmith/tests/lib/section-guard.sh +316 -164
  84. package/skills/teamsmith/tests/lib/tmp-root.sh +139 -27
  85. package/skills/teamsmith/tests/lib/tmux-cap.sh +10 -1
  86. package/skills/teamsmith/tests/lib/tmux-iso.sh +31 -13
  87. package/skills/teamsmith/tests/loop-inventory.tsv +83 -77
  88. package/skills/teamsmith/tests/panel-b2.sh +430 -352
  89. package/skills/teamsmith/tests/panel-b3-stub.sh +112 -4
  90. package/skills/teamsmith/tests/panel-b3.sh +314 -62
  91. package/skills/teamsmith/tests/panel-choices.sh +11 -6
  92. package/skills/teamsmith/tests/panel-cpu.sh +43 -130
  93. package/skills/teamsmith/tests/panel-p21.sh +251 -265
  94. package/skills/teamsmith/tests/panel-snapshots.sh +41 -225
  95. package/skills/teamsmith/tests/panel-strings.mjs +33 -18
  96. package/skills/teamsmith/tests/perf.sh +187 -396
  97. package/skills/teamsmith/tests/routes.sh +440 -117
  98. package/skills/teamsmith/tests/seat-interrupt.sh +1012 -0
  99. package/skills/teamsmith/tests/seat-visibility.sh +675 -0
  100. package/skills/teamsmith/tests/section-guard.sh +13 -102
  101. package/skills/teamsmith/tests/section-needs-audit.sh +24 -7
  102. package/skills/teamsmith/tests/section-paths.tsv +32 -18
  103. package/skills/teamsmith/tests/section-select.sh +371 -19
  104. package/skills/teamsmith/tests/signal-gate.sh +249 -27
  105. package/skills/teamsmith/tests/signal-lint-legacy.txt +4 -1
  106. package/skills/teamsmith/tests/slash-team-e2e.sh +323 -0
  107. package/skills/teamsmith/tests/slash-team.sh +617 -0
  108. package/skills/teamsmith/tests/slice-coverage.sh +206 -0
  109. package/skills/teamsmith/tests/smoke.sh +3595 -788
  110. package/skills/teamsmith/tests/task-model-routing.sh +530 -15
  111. package/skills/teamsmith/tests/team-bg-stop.sh +18 -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/tests/workflow-entry.sh +207 -0
  117. package/skills/teamsmith-init/SKILL.md +12 -12
  118. package/skills/teamsmith-init/references/bootstrap.md +3 -3
  119. package/skills/teamsmith/tests/flip-glue.sh +0 -162
  120. package/skills/teamsmith/tests/flip-m12-26c.sh +0 -129
  121. package/skills/teamsmith/tests/flip-m12.sh +0 -185
  122. package/skills/teamsmith/tests/flip-m16.sh +0 -166
  123. package/skills/teamsmith/tests/flip-m17.sh +0 -204
  124. package/skills/teamsmith/tests/flip-m34.sh +0 -96
  125. package/skills/teamsmith/tests/flip-m37.sh +0 -185
  126. package/skills/teamsmith/tests/flip-m4.3.sh +0 -375
  127. package/skills/teamsmith/tests/flip-m43.sh +0 -128
  128. package/skills/teamsmith/tests/flip-m45.sh +0 -244
  129. package/skills/teamsmith/tests/flip-m46.sh +0 -238
  130. package/skills/teamsmith/tests/flip-m48.sh +0 -304
  131. package/skills/teamsmith/tests/flip-m6.2.sh +0 -205
  132. package/skills/teamsmith/tests/flip-m6.3.sh +0 -283
  133. package/skills/teamsmith/tests/flip-m6.4.sh +0 -267
  134. package/skills/teamsmith/tests/flip-m6.5.sh +0 -113
  135. package/skills/teamsmith/tests/flip-m7.1.sh +0 -135
  136. package/skills/teamsmith/tests/flip-m7.2.sh +0 -321
  137. package/skills/teamsmith/tests/flip-p144.sh +0 -112
  138. package/skills/teamsmith/tests/flip-p156.sh +0 -133
  139. package/skills/teamsmith/tests/flip-p160.sh +0 -182
  140. package/skills/teamsmith/tests/flip-p171.sh +0 -249
  141. package/skills/teamsmith/tests/flip-p18.1.sh +0 -95
  142. package/skills/teamsmith/tests/flip-p20.sh +0 -286
  143. package/skills/teamsmith/tests/flip-p201.sh +0 -249
  144. package/skills/teamsmith/tests/flip-p210.sh +0 -239
  145. package/skills/teamsmith/tests/flip-p211.sh +0 -152
  146. package/skills/teamsmith/tests/flip-p217.sh +0 -288
  147. package/skills/teamsmith/tests/flip-p22.sh +0 -123
  148. package/skills/teamsmith/tests/flip-p23.sh +0 -239
  149. package/skills/teamsmith/tests/flip-p25.sh +0 -165
  150. package/skills/teamsmith/tests/flip-p71.sh +0 -184
  151. package/skills/teamsmith/tests/flip-p72.sh +0 -202
  152. package/skills/teamsmith/tests/load-experiment.sh +0 -290
  153. package/skills/teamsmith/tests/panel-cpu-premise.sh +0 -173
  154. package/skills/teamsmith/tests/panel-flip-m54.sh +0 -207
  155. package/skills/teamsmith/tests/panel-flip-p123.sh +0 -278
  156. package/skills/teamsmith/tests/panel-flip-p125.sh +0 -318
  157. package/skills/teamsmith/tests/panel-flip-p128.sh +0 -259
  158. package/skills/teamsmith/tests/panel-keyprobe-stub.sh +0 -41
  159. package/skills/teamsmith/tests/panel-keyprobe.sh +0 -82
  160. package/skills/teamsmith/tests/panel-knobs.sh +0 -83
  161. package/skills/teamsmith/tests/section-budgets.tsv +0 -154
  162. package/skills/teamsmith/tests/team-bg-flip.sh +0 -239
  163. package/skills/teamsmith/tests/team-inbox-watch-flip.sh +0 -191
@@ -85,7 +85,6 @@ assert_eq() { [ "$2" = "$3" ] && ok "$1" || bad "$1(期望 [$3],实际 [$2]
85
85
  assert_has() { grep -qF -- "$2" "$1" 2>/dev/null && ok "$3" || bad "$3($1 里找不到 [$2])"; }
86
86
  assert_not() { grep -qF -- "$2" "$1" 2>/dev/null && bad "$3(不该出现 [$2])" || ok "$3"; }
87
87
  assert_match() { grep -qE -- "$2" "$1" 2>/dev/null && ok "$3" || bad "$3($1 里没有匹配 [$2])"; }
88
- cond_skip() { printf ' \033[33mSKIP(条件不满足)\033[0m %s\n' "$1${2:+ —— $2}"; }
89
88
 
90
89
  # ---------------------------------------------------------------- P68 数据态等待
91
90
  # fixture-waits-for-landed-reads:控制台自己的状态(首帧标题、工具写的日志、capacity.log 的行数)在断言
@@ -98,21 +97,18 @@ pty_cap() { tmux -L "$sock" capture-pane -p -t "$sess:${b3_cap_pane:-panel}" -S
98
97
  pty_keys() { keys "$@"; }
99
98
  pty_pane_state() { tmux -L "$sock" list-panes -t "$sess:${b3_cap_pane:-panel}" -F '#{pane_dead}:#{pane_dead_status}' 2>/dev/null | head -1; }
100
99
 
101
- # 等控制台自己的标题(`teamsmith pulse`)在稳定帧上。上界 75 轮基础视界(轮询 0.4s + 稳定确认 0.25s;
102
- # 实测每轮 ~0.43s → 约 32s,静态场景不延长)。带宽与推导:安静机上首帧 <1s;旧形状的固定窗口是 5s,
103
- # P52 F2 在负载主机上 6 次红 4 次(首帧落在 5s 之后);确定性的注入(JS runner 晚 8s)实测标题在第
104
- # 43-44 轮(~19s)落地(runner 在路径上付了两次:monitor 的 spawn + activity 读的 monitor.mjs),75 轮
105
- # ≈ 1.7× 实测慢端。rc:0 绿 / 1 红(M59 现场)/ 3 可见 SKIP(场景仍在绘制,机器维度)。
106
- # 夹具旋钮:B3_CONSOLE_ITERS 覆盖上界(只在测带宽时用;默认 75)。
100
+ # 等控制台自己的标题(`teamsmith pulse`)在稳定帧上。视界用 tests/lib/pty-wait.sh 的默认
101
+ # (基础 100 轮 + 仍在绘制时最多 5 倍 ≈ 300s),只防死等;耗尽一律红并报「没等到」(P316:
102
+ # 没有机器前提,没有 SKIP 出口)。耗时只是参考读数。
107
103
  wait_console() { # <outfile> <label>
108
- B3_FRAME_ITERS="${B3_CONSOLE_ITERS:-75}" wait_frame "$1" "$2" 'teamsmith pulse'
104
+ wait_frame "$1" "$2" 'teamsmith pulse'
109
105
  }
110
106
 
111
- # 把 pty-wait 的 rc 翻成夹具的断言:0 → ✓;3 → 可见 SKIP(机器,不算通过也不算失败,D33);其它 → ✗。
107
+ # 把 pty-wait 的 rc 翻成夹具的断言:0 → ✓;其它(含「没等到」)→ ✗。
112
108
  b3_wait_verdict() { # <rc> <ok text> <bad text>
113
109
  case "$1" in
114
110
  0) ok "$2" ;;
115
- 3) cond_skip "$2" "机器读数超前提(等待耗尽但场景仍在绘制,D33 的可见 SKIP)" ;;
111
+ 3) bad "$3" ;; # P316:没有机器前提/ SKIP 出口;耗尽就是「没等到」
116
112
  *) bad "$3" ;;
117
113
  esac
118
114
  }
@@ -120,7 +116,7 @@ b3_wait_verdict() { # <rc> <ok text> <bad text>
120
116
  # 等面板帧满足 needle... 后把捕获写到 <outfile>(needle 以 `!` 开头表示必须缺席)。
121
117
  wait_frame() { # <outfile> <label> <needle...>
122
118
  local _out="$1" _label="$2"; shift 2
123
- local PTY_WAIT_ITERS="${B3_FRAME_ITERS:-30}" PTY_WAIT_PAUSE=0.4 PTY_SETTLE_PAUSE=0.25
119
+ local PTY_WAIT_PAUSE=0.4 PTY_SETTLE_PAUSE=0.25 # 视界用 pty-wait 的默认(只防死等)
124
120
  pty_wait_frame "$_out" "$_label" "$@"
125
121
  }
126
122
 
@@ -145,13 +141,13 @@ wait_cap_not() { # <file name> <needle> <message>
145
141
  # 等一个由工具自己写的文件里出现 <needle>(例如 `pulse up` 的日志点名窗口):20 轮 × 0.5s = 10s。
146
142
  wait_file_has() { # <file> <needle> <label>
147
143
  local file="$1" needle="$2" label="$3" i=1
148
- while [ "$i" -le "${B3_FILE_ITERS:-20}" ]; do
144
+ while [ "$i" -le "${B3_FILE_ITERS:-600}" ]; do
149
145
  grep -qF -- "$needle" "$file" 2>/dev/null && return 0
150
146
  sleep 0.5
151
147
  i=$((i + 1))
152
148
  done
153
149
  printf ' \033[33m·\033[0m 等待超时:%s(%s 轮/%s;%s 里缺 [%s],最后两行:%s)\n' \
154
- "$label" "$((i - 1))" "${B3_FILE_ITERS:-20}" "$file" "$needle" \
150
+ "$label" "$((i - 1))" "${B3_FILE_ITERS:-600}" "$file" "$needle" \
155
151
  "$(tail -2 "$file" 2>/dev/null | tr '\n' ';')" >&2
156
152
  return 1
157
153
  }
@@ -159,7 +155,7 @@ wait_file_has() { # <file> <needle> <label>
159
155
  # 等窗格里的进程参数命中 <needle>(q 收起后窗口里应换成 --headless 巡检循环):30 轮 × 0.5s = 15s。
160
156
  wait_pane_args() { # <pane> <needle> <label>
161
157
  local pane="$1" needle="$2" label="$3" i=1 pid args
162
- while [ "$i" -le "${B3_ARGS_ITERS:-30}" ]; do
158
+ while [ "$i" -le "${B3_ARGS_ITERS:-600}" ]; do
163
159
  pid="$(tmux -L "$sock" list-panes -t "$sess:$pane" -F '#{pane_pid}' 2>/dev/null | head -1)"
164
160
  args="$(ps -o args= -p "${pid:-0}" 2>/dev/null || true)"
165
161
  if [ -n "$args" ] && printf '%s' "$args" | grep -qF -- "$needle"; then return 0; fi
@@ -167,21 +163,21 @@ wait_pane_args() { # <pane> <needle> <label>
167
163
  i=$((i + 1))
168
164
  done
169
165
  printf ' \033[33m·\033[0m 等待超时:%s(%s 轮/%s;窗格进程参数里缺 [%s],最后读到 [%s])\n' \
170
- "$label" "$((i - 1))" "${B3_ARGS_ITERS:-30}" "$needle" "${args:-(无)}" >&2
166
+ "$label" "$((i - 1))" "${B3_ARGS_ITERS:-600}" "$needle" "${args:-(无)}" >&2
171
167
  return 1
172
168
  }
173
169
 
174
170
  # 等 capacity.log 的行数真的长过 <floor>(巡检还在跑的正证据):30 轮 × 0.5s = 15s;成功时打印行数。
175
171
  wait_capacity_growth() { # <file> <floor> <label>
176
172
  local file="$1" floor="$2" label="$3" i=1 c=0
177
- while [ "$i" -le "${B3_CAP_ITERS:-30}" ]; do
173
+ while [ "$i" -le "${B3_CAP_ITERS:-600}" ]; do
178
174
  c="$(grep -c . "$file" 2>/dev/null || echo 0)"
179
175
  if [ "${c:-0}" -gt "$floor" ]; then printf '%s\n' "$c"; return 0; fi
180
176
  sleep 0.5
181
177
  i=$((i + 1))
182
178
  done
183
179
  printf ' \033[33m·\033[0m 等待超时:%s(%s 轮/%s;%s 的行数停在 %s,没长过 %s)\n' \
184
- "$label" "$((i - 1))" "${B3_CAP_ITERS:-30}" "$file" "${c:-?}" "$floor" >&2
180
+ "$label" "$((i - 1))" "${B3_CAP_ITERS:-600}" "$file" "${c:-?}" "$floor" >&2
185
181
  return 1
186
182
  }
187
183
 
@@ -334,6 +330,98 @@ print(",".join(ids))
334
330
  PYL
335
331
  }
336
332
 
333
+ # ---------------------------------------------------------------- 看板页在场(判行为,不判列宽)
334
+ # 120 列的并排档里,空车道按规格折成三列小框(openspec/specs/panel/spec.md「three-column frame」),
335
+ # 框里放不下 `已放弃` 这样的标签,所以「某个车道标签在帧上」不能当「看板页在场」的判据(P125 换形态后
336
+ # 它就恒假,P351 归因)。改判产品自己的两条行为:
337
+ # ① 展开车道的头(`▾ 待办`)只在看板页画 —— 这一帧是不是看板页;
338
+ # ② 目标表按图例顺序给出六条车道 —— 六条车道在不在(车道顺序由规格写死)。
339
+ # 车道清单来自产品自己的 `--snapshot --targets`(点击目标就是「这条车道在这里」的承诺),跑在同一个
340
+ # 夹具状态上,所以它判的是这一版的布局行为,不是某一档的列宽。前提:夹具的看板里至少还有一条展开的
341
+ # 车道(默认就是这样——空车道才折,而 `todo` 有卡片),车道头的字才在帧上。
342
+ board_anchor="▾ 待办"
343
+ board_lane_order="todo,wip,review,done,blocked,dropped"
344
+
345
+ board_lane_list() { # <outfile> → 按图例顺序去重的 lane-fold 车道名
346
+ "$js" "$panel" --snapshot --targets --root "$ROOT" --state-dir "$state" --team-cli "$stub" \
347
+ --lang zh --theme dark --width 120 --height 32 --page 4 >"$1" 2>/dev/null
348
+ python3 - "$1" <<'PYL'
349
+ import json, sys
350
+
351
+ try:
352
+ data = json.load(open(sys.argv[1]))
353
+ except Exception as e: # 读不出的 dump 必须让断言红,不能当成「六条车道都在」
354
+ print(f"<unreadable: {e}>")
355
+ raise SystemExit
356
+ seen = []
357
+ for t in data:
358
+ a = t.get("action") or {}
359
+ if a.get("kind") == "lane-fold" and a.get("lane") not in seen:
360
+ seen.append(a.get("lane"))
361
+ print(",".join(seen))
362
+ PYL
363
+ }
364
+
365
+ board_anchor_hits() { # <capture file> → 帧上展开车道头的处数(读不到按 0,断言随之红)
366
+ local n
367
+ n="$(grep -cF -- "$board_anchor" "$1" 2>/dev/null)"
368
+ printf '%s\n' "${n:-0}"
369
+ }
370
+
371
+ assert_board_page() { # <capture file> <label>
372
+ local lanes hits
373
+ lanes="$(board_lane_list "$tmp/$current/board-lanes.json")"
374
+ hits="$(board_anchor_hits "$1")"
375
+ if [ "$hits" -ge 1 ] && [ "$lanes" = "$board_lane_order" ]; then
376
+ ok "$2(帧上是看板页:车道头 ${hits} 处;六条车道按图例顺序:${lanes})"
377
+ else
378
+ bad "$2(帧上车道头 ${hits} 处、期望 ≥1;车道目标 [${lanes}]、期望 [${board_lane_order}])"
379
+ fi
380
+ }
381
+
382
+ assert_not_board_page() { # <capture file> <label>
383
+ local hits
384
+ hits="$(board_anchor_hits "$1")"
385
+ if [ "$hits" -eq 0 ]; then
386
+ ok "$2(帧上没有看板页的车道头)"
387
+ else
388
+ bad "$2(帧上出现看板页的车道头 ${hits} 处)"
389
+ fi
390
+ }
391
+
392
+ # 6.1 的点击坐标从帧里取:行 = 画着那张卡的那一行,列 = 那张卡的 id 所在的显示列。P125 把未折叠
393
+ # 车道 19→22 列之后,写死的 25 落到卡片内边距那一列,点击就不再落在卡片上;从帧里取坐标的断言判的
394
+ # 是「画出来的这张卡片点得中」,换一版宽度分配也成立。取不到就打印空,由下面的断言红(不回落常数)。
395
+ card_point() { # <capture file> <card id> → "col row"(显示列/行,1-based)
396
+ python3 - "$1" "$2" <<'PYX'
397
+ import re, sys
398
+
399
+ WIDE = [(0x1100,0x115f),(0x2e80,0x303e),(0x3041,0x33ff),(0x3400,0x4dbf),(0x4e00,0x9fff),(0xa000,0xa4cf),(0xac00,0xd7a3),(0xf900,0xfaff),(0xfe10,0xfe19),(0xfe30,0xfe6f),(0xff00,0xff60),(0xffe0,0xffe6)]
400
+
401
+ def cells(text):
402
+ out = []
403
+ for ch in text:
404
+ out.append(ch)
405
+ if any(a <= ord(ch) <= b for a, b in WIDE):
406
+ out.append("")
407
+ return out
408
+
409
+ rows = [re.sub(r"\x1b\[[0-9;]*m", "", l.rstrip("\n")) for l in open(sys.argv[1], encoding="utf-8")]
410
+ needle = sys.argv[2]
411
+ for row, r in enumerate(rows, 1):
412
+ c = cells(r) # 每个显示列一个元素(宽字符的第二列是空串),下标 + 1 就是显示列
413
+ for i in range(len(c) - len(needle) + 1):
414
+ if "".join(c[i:i + len(needle)]) != needle:
415
+ continue
416
+ before = c[i - 1] if i else ""
417
+ after = c[i + len(needle)] if i + len(needle) < len(c) else ""
418
+ if (before and before.isalnum()) or (after and after.isdigit()): # 不是 P140 这类更长的 id
419
+ continue
420
+ print(i + 1, row)
421
+ raise SystemExit
422
+ PYX
423
+ }
424
+
337
425
  # ---------------------------------------------------------------- scenarios
338
426
 
339
427
  scn_pages() {
@@ -357,9 +445,8 @@ scn_pages() {
357
445
  wait_cap_has p3-inbox "收件箱与往来" "捕获里有 [收件箱与往来]"
358
446
  if wait_frame "$tmp/$current/p3-inbox.txt" "消息页计数行(往来,无线程)" '收件箱' '往来' '!线程'; then
359
447
  assert_not "$tmp/$current/p3-inbox.txt" "线程" "捕获里没有 [线程]"
360
- assert_match "$tmp/$current/p3-inbox.txt" '收件箱 [0-9]+ 条 · 往来 [0-9]+ 条' "消息页计数行用「往来」"
361
448
  else
362
- b3_wait_verdict $? "捕获里没有 [线程]" "消息页计数行没有在预算内落定"
449
+ b3_wait_verdict $? "捕获里没有 [线程]" "消息页计数行没等到(超过等待上限)"
363
450
  fi
364
451
  assert_eq "按 3 后 panel-page=3" "$(page_of)" "3"
365
452
  keys m
@@ -385,18 +472,18 @@ scn_settings() {
385
472
  # The selected row is language: Enter switches zh -> en and it applies on the next frame.
386
473
  keys Enter
387
474
  wait_cap_has lang-en.txt "language" "捕获里有 [language]"
388
- wait_file_has "$(conf)" "lang=en" "语言切换写进 panel.conf" || bad "语言偏好没有在预算内落盘"
475
+ wait_file_has "$(conf)" "lang=en" "语言切换写进 panel.conf" || bad "语言偏好没等到落盘(超过等待上限)"
389
476
  assert_has "$(conf)" "lang=en" "切换语言写进 panel.conf"
390
477
  # Down three rows to the mouse preference and toggle it off.
391
478
  keys Down Down Down
392
479
  sleep 0.3
393
480
  keys Enter
394
- wait_file_has "$(conf)" "mouse=0" "鼠标开关写进 panel.conf" || bad "鼠标偏好没有在预算内落盘"
481
+ wait_file_has "$(conf)" "mouse=0" "鼠标开关写进 panel.conf" || bad "鼠标偏好没等到落盘(超过等待上限)"
395
482
  assert_has "$(conf)" "mouse=0" "鼠标开关写进 panel.conf"
396
483
  keys Down
397
484
  sleep 0.2
398
485
  keys Enter
399
- wait_file_has "$(conf)" "density=compact" "密度开关写进 panel.conf" || bad "密度偏好没有在预算内落盘"
486
+ wait_file_has "$(conf)" "density=compact" "密度开关写进 panel.conf" || bad "密度偏好没等到落盘(超过等待上限)"
400
487
  assert_has "$(conf)" "density=compact" "密度开关写进 panel.conf"
401
488
  keys ,
402
489
  wait_cap_not overlay-closed.txt "设置" "捕获里没有 [设置]"
@@ -413,7 +500,7 @@ scn_settings() {
413
500
  local cyc
414
501
  for cyc in 2 3 4 5 1; do
415
502
  keys Enter
416
- wait_file_has "$(conf)" "page=$cyc" "defaultPage 循环到 $cyc" || bad "defaultPage 没有在预算内循环到 $cyc"
503
+ wait_file_has "$(conf)" "page=$cyc" "defaultPage 循环到 $cyc" || bad "defaultPage 没等到(超过等待上限)循环到 $cyc"
417
504
  assert_eq "defaultPage 循环到 $cyc(五页 + 回绕)" "$(sed -n 's/^page=//p' "$(conf)" | tr -d '\n')" "$cyc"
418
505
  done
419
506
  keys Escape
@@ -513,14 +600,14 @@ scn_workdetail() {
513
600
  # 工作页刚把它走到 V14,所以看板页打开的也是 V14 —— 验证的是「返回原页」,不是 id。
514
601
  keys 4; sleep 1
515
602
  wcap board
516
- assert_has "$(wfile board)" "已放弃" "B5 切到看板页"
603
+ assert_board_page "$(wfile board)" "B5 切到看板页"
517
604
  assert_eq "B5 焦点状态两页共用(看板页也在 V14)" "$(focused_id "$(wfile board)")" "V14"
518
605
  keys Enter; sleep 1.4
519
606
  wcap board-detail
520
607
  assert_has "$(wfile board-detail)" "详情 V14" "B5 看板页 enter 打开焦点卡详情"
521
608
  keys Escape; sleep 0.8
522
609
  wcap board-back
523
- assert_has "$(wfile board-back)" "已放弃" "B5 esc 回到看板页"
610
+ assert_board_page "$(wfile board-back)" "B5 esc 回到看板页"
524
611
  assert_eq "B5 看板页返回后 panel-page=4" "$(page_of)" "4"
525
612
  assert_eq "B5 看板页返回后焦点仍是 V14" "$(focused_id "$(wfile board-back)")" "V14"
526
613
 
@@ -550,46 +637,154 @@ PYW
550
637
  bad "B5 第二次点击没有打开详情"
551
638
  fi
552
639
 
553
- # ⑥ 空看板:没有光标、没有行键、没有 focus/open-focused 目标、enter 不开任何东西
640
+ # ⑥ 空看板 + 预览块也清空:没有光标、没有行键、没有 focus/open-focused 目标、enter 不开任何东西
554
641
  python3 - "$tmp/$current/empty.json" <<'PYE'
555
642
  import json, sys
556
643
  json.dump({"rows": [], "counts": {}, "total": 0, "deliveries": []}, open(sys.argv[1], "w"))
557
644
  PYE
558
645
  printf '2\n' > "$(page_file)"
559
- start_panel "B3_STUB_BOARD_FILE='$tmp/$current/empty.json'"
646
+ start_panel "B3_STUB_BOARD_FILE='$tmp/$current/empty.json' B3_STUB_PREVIEWS=empty"
560
647
  keys Down; sleep 0.5
561
648
  keys Enter; sleep 0.8
562
649
  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" \
650
+ assert_eq "B5 空看板 + 空预览块:没有焦点光标" "$(grep -o '›' "$(wfile empty)" | wc -l | tr -d ' ')" "0"
651
+ assert_not "$(wfile empty)" "详情" "B5 空看板 + 空预览块:enter 不开详情"
652
+ assert_eq "B5 空看板 + 空预览块:panel-page 仍是 2" "$(page_of)" "2"
653
+ assert_not "$(wfile empty)" "↑/↓ 行" "B5 空看板 + 空预览块:键位带不发行键"
654
+ B3_STUB_BOARD_FILE="$tmp/$current/empty.json" B3_STUB_PREVIEWS=empty "$js" "$panel" --snapshot --targets --root "$ROOT" --state-dir "$state" \
568
655
  --team-cli "$stub" --lang zh --theme dark --width 120 --height 32 --page 2 >"$tmp/$current/empty-targets.json" 2>/dev/null
569
656
  local kinds
570
657
  kinds="$(kinds_of "$tmp/$current/empty-targets.json")"
571
658
  case ",$kinds," in
572
- *",focus,"*|*",open-focused,"*) bad "B5 空看板的目标表还有 focus/open-focused($kinds)" ;;
573
- *) ok "B5 空看板的目标表没有 focus/open-focused($kinds)" ;;
659
+ *",focus,"*|*",open-focused,"*) bad "B5 空看板 + 空预览块的目标表还有 focus/open-focused($kinds)" ;;
660
+ *) ok "B5 空看板 + 空预览块的目标表没有 focus/open-focused($kinds)" ;;
574
661
  esac
575
662
 
576
- # ⑦ 60x10 降级:没有光标、没有行键、没有死项目标
577
- start_panel
663
+ # ⑥b 空看板 + 预览行(P249):↓ 落在页面行序的第一行(变更块首行),enter 开它的预览,q 原地返回
664
+ start_panel "B3_STUB_BOARD_FILE='$tmp/$current/empty.json'"
665
+ keys Down; sleep 0.6
666
+ wcap empty-preview-focus
667
+ assert_eq "B5 空看板 + 预览行:↓ 后恰好一个光标" "$(grep -o '›' "$(wfile empty-preview-focus)" | wc -l | tr -d ' ')" "1"
668
+ if grep -qE '› +pulse-console' "$(wfile empty-preview-focus)"; then
669
+ ok "B5 空看板 + 预览行:焦点落在变更块第一行(空看板不是丢掉活行的理由)"
670
+ else
671
+ bad "B5 空看板 + 预览行:焦点没有落到变更块第一行"
672
+ fi
673
+ keys Enter; sleep 1.4
674
+ wcap empty-preview-detail
675
+ assert_has "$(wfile empty-preview-detail)" "[proposal]" "B5 空看板 + 预览行:enter 打开变更预览(proposal tab)"
676
+ assert_has "$(wfile empty-preview-detail)" "the proposal body" "B5 空看板 + 预览行:变更预览渲染正文"
677
+ assert_not "$(wfile empty-preview-detail)" "任务看板" "B5 变更预览替换了工作页的块"
678
+ assert_eq "B5 打开预览后仍在第 2 页" "$(page_of)" "2"
679
+ keys q; sleep 0.8
680
+ wcap empty-preview-back
681
+ assert_has "$(wfile empty-preview-back)" "活动变更" "B5 预览 q 回工作页"
682
+ assert_not "$(wfile empty-preview-back)" "详情" "B5 预览 q 关掉了详情"
683
+ assert_eq "B5 预览返回后 panel-page 仍是 2" "$(page_of)" "2"
684
+
685
+ # ⑥c 空看板 + 只有规格块一行(P249 的第三个夹具):↓ 落到 specs 行,enter 开 spec 预览
686
+ start_panel "B3_STUB_BOARD_FILE='$tmp/$current/empty.json' B3_STUB_PREVIEWS=specs-only"
687
+ keys Down; sleep 0.6
688
+ wcap specs-focus
689
+ assert_eq "B5 空看板 + 规格行:↓ 后恰好一个光标" "$(grep -o '›' "$(wfile specs-focus)" | wc -l | tr -d ' ')" "1"
690
+ if grep -qE '› +panel' "$(wfile specs-focus)"; then
691
+ ok "B5 空看板 + 规格行:焦点落在规格块的那一行"
692
+ else
693
+ bad "B5 空看板 + 规格行:焦点没有落到规格块"
694
+ fi
695
+ keys Enter; sleep 1.4
696
+ wcap specs-detail
697
+ assert_has "$(wfile specs-detail)" "[spec]" "B5 规格预览:spec tab 默认打开"
698
+ assert_has "$(wfile specs-detail)" "Requirement: One" "B5 规格预览:渲染 spec 正文"
699
+ assert_eq "B5 规格预览返回后仍在第 2 页" "$(page_of)" "2"
700
+ keys q; sleep 0.8
701
+
702
+ # ⑦ 60x10 降级 + 预览块清空:没有光标、没有行键、没有死项目标(旧断言的新夹具)
703
+ start_panel "B3_STUB_PREVIEWS=empty"
578
704
  tmux -L "$sock" resize-window -t "$sess:panel" -x 60 -y 10 2>/dev/null || true
579
705
  sleep 1.4
580
706
  keys Down; sleep 0.5
581
707
  keys Enter; sleep 0.8
582
708
  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" \
709
+ assert_eq "B5 60x10 降级 + 空预览块:没有焦点光标" "$(grep -o '›' "$(wfile degraded)" | wc -l | tr -d ' ')" "0"
710
+ assert_not "$(wfile degraded)" "详情" "B5 60x10 降级 + 空预览块:enter 不开详情"
711
+ assert_not "$(wfile degraded)" "↑/↓ 行" "B5 60x10 降级 + 空预览块:键位带不发行键"
712
+ B3_STUB_PREVIEWS=empty "$js" "$panel" --snapshot --targets --root "$ROOT" --state-dir "$state" --team-cli "$stub" \
587
713
  --lang zh --theme dark --width 60 --height 10 --page 2 >"$tmp/$current/degraded-targets.json" 2>/dev/null
588
714
  kinds="$(kinds_of "$tmp/$current/degraded-targets.json")"
589
715
  case ",$kinds," in
590
- *",focus,"*|*",open-focused,"*) bad "B5 60x10 降级的目标表还有 focus/open-focused($kinds)" ;;
591
- *) ok "B5 60x10 降级的目标表没有 focus/open-focused($kinds)" ;;
716
+ *",focus,"*|*",open-focused,"*) bad "B5 60x10 降级 + 空预览块的目标表还有 focus/open-focused($kinds)" ;;
717
+ *) ok "B5 60x10 降级 + 空预览块的目标表没有 focus/open-focused($kinds)" ;;
592
718
  esac
719
+
720
+ # ⑦b 60x10 降级 + 预览行:↓ 落到一盏可开的预览行,enter 打开它的预览(不留在板内死路上)
721
+ start_panel
722
+ tmux -L "$sock" resize-window -t "$sess:panel" -x 60 -y 10 2>/dev/null || true
723
+ sleep 1.4
724
+ keys Down; sleep 0.6
725
+ wcap degraded-preview-focus
726
+ assert_eq "B5 60x10 降级 + 预览行:恰好一个光标" "$(grep -o '›' "$(wfile degraded-preview-focus)" | wc -l | tr -d ' ')" "1"
727
+ keys Enter; sleep 1.4
728
+ wcap degraded-preview-detail
729
+ if grep -qE '\[(proposal|spec|D[0-9]+)\]' "$(wfile degraded-preview-detail)"; then
730
+ ok "B5 60x10 降级:enter 打开的是预览(不是板内死项)"
731
+ else
732
+ bad "B5 60x10 降级:enter 没有打开预览"
733
+ fi
734
+ assert_eq "B5 60x10 降级预览返回后仍在第 2 页" "$(page_of)" "2"
735
+ keys q; sleep 0.8
736
+
737
+ # ⑧ 一页一行序(delta 的场景:板 2 行 + 规格 1 行):三↓ 依次落在板首行、板次行、规格块行
738
+ python3 - "$tmp/$current/two.json" <<'PYW2'
739
+ import json, sys
740
+ json.dump({"rows": [
741
+ {"id": "P14", "title": "一", "agent": "dev", "branch": "task/P14", "deps": "-", "state": "wip", "phase": "apply"},
742
+ {"id": "V14", "title": "二", "agent": "verify", "branch": "-", "deps": "P14", "state": "todo", "phase": "verify"},
743
+ ], "counts": {"todo": 1, "wip": 1, "review": 0, "done": 0, "blocked": 0, "dropped": 0}, "total": 2, "deliveries": []}, open(sys.argv[1], "w"))
744
+ PYW2
745
+ start_panel "B3_STUB_BOARD_FILE='$tmp/$current/two.json' B3_STUB_PREVIEWS=specs-only"
746
+ keys Down; sleep 0.5
747
+ wcap walk-1
748
+ assert_eq "B5 一页一行序:第一 ↓ 落在板首行 P14" "$(focused_id "$(wfile walk-1)")" "P14"
749
+ assert_eq "B5 一页一行序:第一步恰好一个光标" "$(grep -o '›' "$(wfile walk-1)" | wc -l | tr -d ' ')" "1"
750
+ keys Down; sleep 0.4
751
+ wcap walk-2
752
+ assert_eq "B5 一页一行序:第二 ↓ 落在板次行 V14" "$(focused_id "$(wfile walk-2)")" "V14"
753
+ assert_eq "B5 一页一行序:第二步恰好一个光标" "$(grep -o '›' "$(wfile walk-2)" | wc -l | tr -d ' ')" "1"
754
+ keys Down; sleep 0.5
755
+ wcap walk-3
756
+ if grep -qE '› +panel' "$(wfile walk-3)"; then
757
+ ok "B5 一页一行序:第三 ↓ 跨块落到规格行"
758
+ else
759
+ bad "B5 一页一行序:第三 ↓ 没有跨到规格行(跨块断掉)"
760
+ fi
761
+ assert_eq "B5 一页一行序:第三步恰好一个光标" "$(grep -o '›' "$(wfile walk-3)" | wc -l | tr -d ' ')" "1"
762
+ keys Enter; sleep 1.2
763
+ wcap walk-open
764
+ assert_has "$(wfile walk-open)" "[spec]" "B5 一页一行序:规格行 enter 开 spec 预览"
765
+ assert_eq "B5 一页一行序:预览仍在第 2 页" "$(page_of)" "2"
766
+ keys q; sleep 0.7
767
+ wcap walk-back
768
+ assert_eq "B5 一页一行序:关闭后焦点仍在同一行" "$(grep -cE '› +panel' "$(wfile walk-back)")" "1"
769
+
770
+ # ⑨ 变更行与决策行各自开自己的 source(delta 的场景):默认夹具里走到 D40,enter 开决策预览
771
+ start_panel
772
+ wfocused=-1
773
+ for wi in $(seq 1 30); do
774
+ if cap | grep -qE '› +D40'; then wfocused=0; break; fi
775
+ keys Down; sleep 0.25
776
+ done
777
+ assert_eq "B5 决策行:↓ 在 30 步内走到决策块第一行 D40" "$wfocused" "0"
778
+ keys Enter; sleep 1.4
779
+ wcap decision-detail
780
+ assert_has "$(wfile decision-detail)" "[D40]" "B5 决策预览:tab 是条目号 D40"
781
+ assert_has "$(wfile decision-detail)" "D40 body" "B5 决策预览:渲染条目正文"
782
+ assert_has "$(wfile decision-detail)" "deeper addendum" "B5 决策预览:同号补记留在正文里"
783
+ assert_eq "B5 决策预览:打开后仍在第 2 页" "$(page_of)" "2"
784
+ keys q; sleep 0.8
785
+ wcap decision-back
786
+ assert_has "$(wfile decision-back)" "最近决策" "B5 决策预览:q 原地回工作页"
787
+ assert_not "$(wfile decision-back)" "详情" "B5 决策预览:q 关掉了详情"
593
788
  }
594
789
 
595
790
  scn_mouse() {
@@ -670,7 +865,6 @@ scn_resize() {
670
865
  tmux -L "$sock" resize-window -t "$sess:panel" -x 99 -y 32 2>/dev/null || true
671
866
  sleep 0.6
672
867
  cap_to narrow
673
- assert_has "$tmp/$current/narrow.txt" "代理" "99 列:单列仍渲染 agent 表"
674
868
  # Reflow to the wide tier: the agent table and the right block share a row.
675
869
  tmux -L "$sock" resize-window -t "$sess:panel" -x 160 -y 32 2>/dev/null || true
676
870
  sleep 1.2
@@ -728,13 +922,13 @@ scn_collapse() {
728
922
  "bash '$skill/scripts/team' pulse up > '$tmp/$current/up.log' 2>&1; sleep 1"
729
923
  # P68:等日志自己点名窗口(原来是 sleep 5 + 单次采样)。
730
924
  wait_file_has "$tmp/$current/up.log" "巡检已在" "pulse up 的日志点名窗口" \
731
- || bad "pulse up 的日志没有在预算内点名窗口"
925
+ || bad "pulse up 的日志没等到点名窗口"
732
926
  assert_has "$tmp/$current/up.log" "巡检已在" "pulse up 起了窗口"
733
927
  # P68:等控制台自己的标题在稳定帧上(原来是 sleep 5 + 单次 capture-pane)。
734
928
  if wait_console "$tmp/$current/console.txt" "pulse 窗口里的控制台首帧"; then
735
929
  assert_has "$tmp/$current/console.txt" "teamsmith pulse" "pulse 窗口里是控制台"
736
930
  else
737
- b3_wait_verdict $? "pulse 窗口里是控制台" "pulse 窗口里没有在预算内出现控制台"
931
+ b3_wait_verdict $? "pulse 窗口里是控制台" "pulse 窗口里没等到(超过等待上限)控制台"
738
932
  fi
739
933
  # 计数放在控制台起来之后:`cmd` 辅助窗口的命令末尾有 `sleep 1`,它自己退掉后剩下的才是后端窗口。
740
934
  local wins_before; wins_before="$(tmux -L "$sock" list-windows -t "$sess" | wc -l | tr -d ' ')"
@@ -765,15 +959,15 @@ scn_collapse() {
765
959
  bash '$skill/scripts/team' pulse up > '$tmp/$current/up2.log' 2>&1"
766
960
  # P68:两份由命令自己写的日志分别等(原来是 sleep 6 + 两次单次采样)。
767
961
  wait_file_has "$tmp/$current/status-headless.log" "无界面 tick" "pulse status 报无界面形态" \
768
- || bad "pulse status 没有在预算内报无界面形态"
962
+ || bad "pulse status 没等到无界面形态"
769
963
  assert_has "$tmp/$current/status-headless.log" "无界面 tick" "pulse status 报无界面形态"
770
964
  wait_file_has "$tmp/$current/up2.log" "恢复成控制台" "pulse up 原地恢复控制台" \
771
- || bad "pulse up 没有在预算内恢复控制台"
965
+ || bad "pulse up 没等到恢复控制台"
772
966
  assert_has "$tmp/$current/up2.log" "恢复成控制台" "pulse up 原地恢复控制台"
773
967
  if wait_console "$tmp/$current/restored.txt" "恢复后的控制台首帧"; then
774
968
  assert_has "$tmp/$current/restored.txt" "teamsmith pulse" "恢复后同一窗口里又是控制台"
775
969
  else
776
- b3_wait_verdict $? "恢复后同一窗口里又是控制台" "恢复后同一窗口里没有在预算内出现控制台"
970
+ b3_wait_verdict $? "恢复后同一窗口里又是控制台" "恢复后同一窗口里没等到(超过等待上限)控制台"
777
971
  fi
778
972
  }
779
973
 
@@ -789,18 +983,18 @@ scn_board() {
789
983
  keys 4
790
984
  sleep 1
791
985
  bcap p4
792
- assert_has "$(bfile p4)" "已放弃" "按 4 切到看板页(六车道在场)"
986
+ assert_board_page "$(bfile p4)" "按 4 切到看板页(六车道在场)"
793
987
  assert_eq "按 4 后 panel-page=4" "$(page_of)" "4"
794
988
  start_panel
795
989
  bcap relaunch
796
- assert_has "$(bfile relaunch)" "已放弃" "重启后仍在看板页(panel-page 记忆)"
990
+ assert_board_page "$(bfile relaunch)" "重启后仍在看板页(panel-page 记忆)"
797
991
  assert_eq "重启后 panel-page 仍是 4" "$(page_of)" "4"
798
992
  # 4.2: an out-of-range file falls back to the default page, never an error.
799
993
  printf '9\n' > "$(page_file)"
800
994
  start_panel
801
995
  bcap oob
802
996
  assert_has "$(bfile oob)" "项目进度" "panel-page=9 时回落到默认页(总览)"
803
- assert_not "$(bfile oob)" "已放弃" "panel-page=9 时没有渲染看板页"
997
+ assert_not_board_page "$(bfile oob)" "panel-page=9 时没有渲染看板页"
804
998
  # 5.3: the focus is keyed by entry id — a reorder keeps it, a removal falls back inside the lane.
805
999
  board_a="$tmp/$current/board-a.json"
806
1000
  board_b="$tmp/$current/board-b.json"
@@ -941,9 +1135,14 @@ PYC
941
1135
 
942
1136
  # 6.1: a click on a card focuses it — in the injected instance's own bytes, the focus cursor has
943
1137
  # to move onto the clicked card (the start of the frame puts it on the first card of `todo`).
1138
+ # P352: 坐标从帧里取(行 = 画着 P14 的那一行,列 = 它的 id 所在的显示列)—— P125 把未折叠车道
1139
+ # 19→22 列之后,写死的 25 落到卡片内边距那一列,点击就不再是「点卡片」。
1140
+ read -r click_col click_row < <(card_point "$(bfile lane-first)" P14)
1141
+ printf ' \033[36m· 夹具\033[0m 6.1 的点击点取自 lane-first 帧:row=%s col=%s(P14 的 id 列)\n' \
1142
+ "${click_row:-(取不到)}" "${click_col:-(取不到)}"
944
1143
  B3_STUB_DONE=20 python3 "$pty_direct" --js "$js" --panel "$panel" --root "$ROOT" --state-dir "$state" \
945
1144
  --team-cli "$stub" --out "$tmp/$current/click-card.bin" --expect-enable yes \
946
- --click-col 25 --click-row 4 --cols 120 --rows 32 >"$tmp/$current/click-card.log" 2>&1
1145
+ --click-col "${click_col:-0}" --click-row "${click_row:-0}" --cols 120 --rows 32 >"$tmp/$current/click-card.log" 2>&1
947
1146
  assert_eq "直驱 pty:卡片点击注入成功(6.1)" "$?" "0"
948
1147
  click_moved="$(python3 - "$tmp/$current/click-card.bin" <<'PYM'
949
1148
  import re, sys
@@ -982,21 +1181,24 @@ scn_detail() {
982
1181
  other_before="$(cd "$ROOT" && find .pi/team/state -type f ! -name draft.md ! -name panel.conf ! -name panel-page | sort | xargs -r md5sum | md5sum)"
983
1182
  start_panel
984
1183
  dcap board
985
- assert_has "$(dfile board)" "已放弃" "夹具:控制台停在看板页(六车道在场)"
1184
+ assert_board_page "$(dfile board)" "夹具:控制台停在看板页(六车道在场)"
986
1185
 
987
1186
  # 9.1 + 9.4: Enter opens the focused card's detail; the first detail frame is timed from the key,
988
1187
  # then the view is waited for (the first frame is the loading state — the block is one child away).
989
- local t0 t1 opened=1 i
1188
+ local t0 t1 opened=1 i last_state=""
990
1189
  t0="$(date +%s.%N)"
991
1190
  keys Enter
992
- for i in $(seq 1 40); do
993
- if { cap || true; } | grep -qF '详情'; then opened=0; break; fi
1191
+ # P316:上限 300s(防死等);耗尽报「没等到详情视图」并带最后一次状态;耗时只作参考打印。
1192
+ for i in $(seq 1 10000); do
1193
+ last_state="$(cap || true)"
1194
+ if printf '%s' "$last_state" | grep -qF '详情'; then opened=0; break; fi
994
1195
  sleep 0.03
995
1196
  done
996
1197
  t1="$(date +%s.%N)"
997
- assert_eq "Enter 后 1.2s 内出现详情视图" "$opened" "0"
998
- printf ' \033[36m·\033[0m 首帧耗时(Enter→详情标题上屏):%ss\n' "$(awk -v a="$t0" -v b="$t1" 'BEGIN { printf "%.3f", b - a }')"
999
- for i in $(seq 1 40); do
1198
+ assert_eq "详情视图出现(上限 300s;没等到时下面打最后状态)" "$opened" "0"
1199
+ [ "$opened" = "0" ] || printf ' \033[33m没等到\033[0m 详情视图:最后一次状态=%s\n' "$(printf '%s' "$last_state" | tail -3 | tr '\n' '|')"
1200
+ printf ' \033[36m· 参考\033[0m 首帧耗时(Enter→详情标题上屏):%ss\n' "$(awk -v a="$t0" -v b="$t1" 'BEGIN { printf "%.3f", b - a }')"
1201
+ for i in $(seq 1 6000); do
1000
1202
  if { cap || true; } | grep -qF '[brief]'; then break; fi
1001
1203
  sleep 0.05
1002
1204
  done
@@ -1005,7 +1207,7 @@ scn_detail() {
1005
1207
  assert_has "$(dfile open)" "[brief]" "第一个文件 tab 默认打开"
1006
1208
  assert_has "$(dfile open)" "fixture brief" "详情视图渲染了 brief 的正文"
1007
1209
  assert_has "$(dfile open)" "verbatim fence body" "围栏代码块正文原样上屏"
1008
- assert_not "$(dfile open)" "已放弃" "详情视图替换了看板块(替换块不留内容)"
1210
+ assert_not_board_page "$(dfile open)" "详情视图替换了看板块(替换块不留内容)"
1009
1211
 
1010
1212
  # 9.2: ←/→ switch files, ↑/↓ scroll the document.
1011
1213
  keys Right
@@ -1027,7 +1229,7 @@ scn_detail() {
1027
1229
  keys q
1028
1230
  sleep 0.8
1029
1231
  dcap back-q
1030
- assert_has "$(dfile back-q)" "已放弃" "q 返回看板页"
1232
+ assert_board_page "$(dfile back-q)" "q 返回看板页"
1031
1233
  assert_not "$(dfile back-q)" "详情 V14" "q 之后详情视图关闭"
1032
1234
  local pane_pid args
1033
1235
  pane_pid="$(tmux -L "$sock" list-panes -t "$sess:panel" -F '#{pane_pid}' | head -1)"
@@ -1042,9 +1244,56 @@ scn_detail() {
1042
1244
  keys Escape
1043
1245
  sleep 0.8
1044
1246
  dcap back-esc
1045
- assert_has "$(dfile back-esc)" "已放弃" "Esc 返回看板页"
1247
+ assert_board_page "$(dfile back-esc)" "Esc 返回看板页"
1046
1248
  assert_not "$(dfile back-esc)" "详情 V14" "Esc 之后详情视图关闭"
1047
1249
 
1250
+ # P249: a preview's artifacts switch with ←/→, ↑/↓ scrolls the document and q returns to the work
1251
+ # page it was opened from — the same view and the same close contract as an entry's detail.
1252
+ printf '2\n' > "$(page_file)"
1253
+ start_panel "B3_STUB_PREVIEW_LONG=40"
1254
+ local wi wfocused=-1
1255
+ for wi in $(seq 1 16); do
1256
+ keys Down; sleep 0.25
1257
+ if cap | grep -qE '› +pulse-console'; then wfocused=0; break; fi
1258
+ done
1259
+ assert_eq "P249 预览:↓ 在 16 步内走到变更块第一行" "$wfocused" "0"
1260
+ keys Enter; sleep 1.4
1261
+ dcap preview-proposal
1262
+ assert_has "$(dfile preview-proposal)" "[proposal]" "P249 预览:变更的第一 tab 是 proposal"
1263
+ assert_has "$(dfile preview-proposal)" "the proposal body" "P249 预览:proposal 正文上屏"
1264
+ assert_eq "P249 预览:打开后仍在第 2 页" "$(page_of)" "2"
1265
+ keys Right; sleep 0.8
1266
+ dcap preview-design
1267
+ assert_has "$(dfile preview-design)" "[design]" "P249 预览:→ 切到 design tab"
1268
+ assert_has "$(dfile preview-design)" "the design body" "P249 预览:design 正文上屏"
1269
+ keys Right; sleep 0.8
1270
+ dcap preview-tasks
1271
+ assert_has "$(dfile preview-tasks)" "[tasks]" "P249 预览:再 → 切到 tasks tab"
1272
+ assert_has "$(dfile preview-tasks)" "the task body" "P249 预览:tasks 正文上屏"
1273
+ keys q; sleep 0.8
1274
+ dcap preview-back
1275
+ assert_has "$(dfile preview-back)" "活动变更" "P249 预览:q 回工作页"
1276
+ assert_not "$(dfile preview-back)" "详情" "P249 预览:q 关掉了详情"
1277
+ # 规格预览:一个 tab,长正文可滚动;Esc 同样原地返回
1278
+ wfocused=-1
1279
+ for wi in $(seq 1 6); do
1280
+ if cap | grep -qE '› +panel'; then wfocused=0; break; fi
1281
+ keys Down; sleep 0.3
1282
+ done
1283
+ assert_eq "P249 预览:关闭后继续走到规格行" "$wfocused" "0"
1284
+ keys Enter; sleep 1.4
1285
+ dcap preview-spec
1286
+ assert_has "$(dfile preview-spec)" "[spec]" "P249 预览:规格一个 tab"
1287
+ assert_has "$(dfile preview-spec)" "spec line 01" "P249 预览:规格正文第一行"
1288
+ for i in 1 2 3 4 5 6 7 8; do keys Down; sleep 0.08; done
1289
+ sleep 0.6
1290
+ dcap preview-spec-scrolled
1291
+ assert_has "$(dfile preview-spec-scrolled)" "spec line 09" "P249 预览:↓×8 滚动规格正文(第 9 行进入视图)"
1292
+ keys Escape; sleep 0.8
1293
+ dcap preview-spec-back
1294
+ assert_has "$(dfile preview-spec-back)" "任务看板" "P249 预览:Esc 回工作页"
1295
+ assert_not "$(dfile preview-spec-back)" "详情" "P249 预览:Esc 关掉了详情"
1296
+
1048
1297
  # 9.3: read-only — only the console's own three state files may differ after the session.
1049
1298
  local docs_after other_after
1050
1299
  docs_after="$(cd "$ROOT" && find docs -type f | sort | xargs -r md5sum | md5sum)"
@@ -1276,6 +1525,9 @@ PYC
1276
1525
 
1277
1526
  # ---------------------------------------------------------------- run
1278
1527
  want=("$@")
1528
+ # P249: `--all` is the explicit whole-suite selector the task's acceptance commands use; with no
1529
+ # argument the behaviour is unchanged (every scenario), and an unknown name stays a no-op.
1530
+ if [ "${want[0]:-}" = "--all" ]; then want=(); fi
1279
1531
  run_scn() {
1280
1532
  local name="$1"
1281
1533
  if [ ${#want[@]} -gt 0 ]; then