teamsmith 0.1.2 → 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.
- package/README.md +13 -7
- package/package.json +1 -1
- package/skills/teamsmith/CHANGELOG.md +67 -0
- package/skills/teamsmith/SKILL.md +26 -8
- package/skills/teamsmith/extension/team-notify.ts +37 -6
- package/skills/teamsmith/extension/team.ts +438 -0
- package/skills/teamsmith/references/agent-adapters.md +7 -7
- package/skills/teamsmith/references/config.md +65 -18
- package/skills/teamsmith/references/migration.md +220 -34
- package/skills/teamsmith/references/protocol.md +250 -25
- package/skills/teamsmith/references/troubleshooting.md +124 -7
- package/skills/teamsmith/references/workflows.md +66 -20
- package/skills/teamsmith/scripts/lib/cmd-agents.sh +525 -90
- package/skills/teamsmith/scripts/lib/cmd-bootstrap.sh +71 -10
- package/skills/teamsmith/scripts/lib/cmd-config.sh +562 -128
- package/skills/teamsmith/scripts/lib/cmd-death.sh +2 -15
- package/skills/teamsmith/scripts/lib/cmd-docs.sh +6 -3
- package/skills/teamsmith/scripts/lib/cmd-draft.sh +4 -4
- package/skills/teamsmith/scripts/lib/cmd-help.sh +677 -0
- package/skills/teamsmith/scripts/lib/cmd-init.sh +157 -5
- package/skills/teamsmith/scripts/lib/cmd-interrupt.sh +461 -0
- package/skills/teamsmith/scripts/lib/cmd-meeting.sh +2 -25
- package/skills/teamsmith/scripts/lib/cmd-project.sh +149 -105
- package/skills/teamsmith/scripts/lib/cmd-reap.sh +277 -0
- package/skills/teamsmith/scripts/lib/cmd-reply.sh +96 -0
- package/skills/teamsmith/scripts/lib/cmd-review.sh +188 -40
- package/skills/teamsmith/scripts/lib/cmd-status.sh +268 -30
- package/skills/teamsmith/scripts/lib/cmd-update.sh +36 -7
- package/skills/teamsmith/scripts/lib/cmd-watch.sh +634 -54
- package/skills/teamsmith/scripts/lib/common.sh +1560 -109
- package/skills/teamsmith/scripts/lib/gate-lock.sh +544 -0
- package/skills/teamsmith/scripts/monitor.mjs +34 -3
- package/skills/teamsmith/scripts/panel/README.md +22 -11
- package/skills/teamsmith/scripts/panel/draft-send.sh +11 -1
- package/skills/teamsmith/scripts/panel/panel.js +226 -224
- package/skills/teamsmith/scripts/panel/src/App.tsx +478 -184
- package/skills/teamsmith/scripts/panel/src/clipboard.ts +11 -5
- package/skills/teamsmith/scripts/panel/src/compose.ts +6 -3
- package/skills/teamsmith/scripts/panel/src/data.ts +95 -7
- package/skills/teamsmith/scripts/panel/src/layout.ts +703 -152
- package/skills/teamsmith/scripts/panel/src/main.tsx +129 -19
- package/skills/teamsmith/scripts/panel/src/settings.ts +1 -1
- package/skills/teamsmith/scripts/panel/src/strings/en.ts +76 -31
- package/skills/teamsmith/scripts/panel/src/strings/zh.ts +78 -33
- package/skills/teamsmith/scripts/panel/src/types.ts +204 -17
- package/skills/teamsmith/scripts/replies.mjs +896 -0
- package/skills/teamsmith/scripts/shim/tmux +18 -0
- package/skills/teamsmith/scripts/strings/commands.tsv +86 -0
- package/skills/teamsmith/scripts/strings/help.en.tsv +503 -0
- package/skills/teamsmith/scripts/strings/help.zh.tsv +489 -0
- package/skills/teamsmith/scripts/team +20 -6
- package/skills/teamsmith/templates/AGENTS.section.md.tmpl +23 -3
- package/skills/teamsmith/templates/BOARD.md.tmpl +2 -2
- package/skills/teamsmith/templates/OWNERSHIP.md.tmpl +7 -3
- package/skills/teamsmith/templates/PROTOCOL.md.tmpl +17 -0
- package/skills/teamsmith/templates/config.sh.tmpl +29 -5
- package/skills/teamsmith/templates/memory-seed.md.tmpl +3 -0
- package/skills/teamsmith/templates/pm-prompt.md.tmpl +41 -1
- package/skills/teamsmith/templates/report.md.tmpl +12 -0
- package/skills/teamsmith/templates/task.md.tmpl +4 -0
- package/skills/teamsmith/tests/bg-ledger-harness.mjs +464 -40
- package/skills/teamsmith/tests/bg-ledger.sh +168 -10
- package/skills/teamsmith/tests/checkout-shape-probe.sh +3 -1
- package/skills/teamsmith/tests/config-cli.sh +320 -300
- package/skills/teamsmith/tests/death-cause.sh +5 -2
- package/skills/teamsmith/tests/fixtures/delivery-truth-real/scenario.sh +7 -1
- package/skills/teamsmith/tests/fixtures/p287/lint-good.sh.in +3 -0
- package/skills/teamsmith/tests/fixtures/p287/lint-hardcoded.sh.in +3 -0
- package/skills/teamsmith/tests/fixtures/p287/lint-no-ns.sh.in +3 -0
- package/skills/teamsmith/tests/fixtures/p55/flip-p49.sh +18 -6
- package/skills/teamsmith/tests/flip-m33.sh +5 -3
- package/skills/teamsmith/tests/flip-m37.sh +4 -1
- package/skills/teamsmith/tests/flip-m4.3.sh +4 -1
- package/skills/teamsmith/tests/flip-m6.3.sh +4 -1
- package/skills/teamsmith/tests/flip-m6.5.sh +4 -1
- package/skills/teamsmith/tests/flip-m7.2.sh +4 -1
- package/skills/teamsmith/tests/flip-p158.sh +2 -1
- package/skills/teamsmith/tests/flip-p210.sh +4 -1
- package/skills/teamsmith/tests/flip-p217.sh +4 -1
- package/skills/teamsmith/tests/flip-p287-lock.sh +342 -0
- package/skills/teamsmith/tests/flip-p287-name.sh +279 -0
- package/skills/teamsmith/tests/flip-p304-read-side.sh +98 -0
- package/skills/teamsmith/tests/flip-p308-skip-not-pass.sh +151 -0
- package/skills/teamsmith/tests/flip-p309-p162-deep.sh +122 -0
- package/skills/teamsmith/tests/flip-p310-lock.sh +216 -0
- package/skills/teamsmith/tests/flip-p310-socket.sh +125 -0
- package/skills/teamsmith/tests/help-surface.sh +1664 -0
- package/skills/teamsmith/tests/install-shape.sh +283 -22
- package/skills/teamsmith/tests/key-replies-pty.sh +374 -0
- package/skills/teamsmith/tests/key-replies-ui.sh +325 -0
- package/skills/teamsmith/tests/key-replies.sh +1314 -0
- package/skills/teamsmith/tests/ledger-ban.sh +9 -8
- package/skills/teamsmith/tests/ledger-claim.sh +248 -0
- package/skills/teamsmith/tests/lib/bounded-spin.sh +90 -0
- package/skills/teamsmith/tests/lib/model-policy.sh +30 -0
- package/skills/teamsmith/tests/lib/model-routing-boundary.sh +420 -0
- package/skills/teamsmith/tests/lib/model-routing-expansion.sh +155 -0
- package/skills/teamsmith/tests/lib/model-routing-flips.py +187 -0
- package/skills/teamsmith/tests/lib/model-routing-roles.sh +250 -0
- package/skills/teamsmith/tests/lib/proc-io.sh +103 -0
- package/skills/teamsmith/tests/lib/reply-fixture.sh +367 -0
- package/skills/teamsmith/tests/lib/section-guard.sh +258 -13
- package/skills/teamsmith/tests/lib/tmp-root.sh +139 -27
- package/skills/teamsmith/tests/lib/tmux-cap.sh +10 -1
- package/skills/teamsmith/tests/lib/tmux-iso.sh +39 -13
- package/skills/teamsmith/tests/loop-inventory.tsv +59 -47
- package/skills/teamsmith/tests/panel-b2.sh +107 -4
- package/skills/teamsmith/tests/panel-b3-stub.sh +139 -4
- package/skills/teamsmith/tests/panel-b3.sh +189 -29
- package/skills/teamsmith/tests/panel-choices.sh +81 -63
- package/skills/teamsmith/tests/panel-cpu.sh +3 -2
- package/skills/teamsmith/tests/panel-knobs.sh +7 -1
- package/skills/teamsmith/tests/panel-p21.sh +445 -241
- package/skills/teamsmith/tests/panel-snapshots.sh +41 -225
- package/skills/teamsmith/tests/panel-strings.mjs +33 -18
- package/skills/teamsmith/tests/perf.sh +122 -31
- package/skills/teamsmith/tests/pm-box-real.sh +1 -1
- package/skills/teamsmith/tests/pulse-nudge-key.sh +1 -1
- package/skills/teamsmith/tests/routes.sh +364 -109
- package/skills/teamsmith/tests/seat-interrupt.sh +1002 -0
- package/skills/teamsmith/tests/seat-visibility.sh +675 -0
- package/skills/teamsmith/tests/section-budgets.tsv +26 -12
- package/skills/teamsmith/tests/section-guard.sh +6 -1
- package/skills/teamsmith/tests/section-needs-audit.sh +24 -7
- package/skills/teamsmith/tests/section-paths.tsv +42 -26
- package/skills/teamsmith/tests/section-select.sh +90 -7
- package/skills/teamsmith/tests/slash-team-e2e.sh +323 -0
- package/skills/teamsmith/tests/slash-team.sh +617 -0
- package/skills/teamsmith/tests/smoke.sh +3762 -628
- package/skills/teamsmith/tests/snapshots/zh-dark-120-detail.txt +2 -2
- package/skills/teamsmith/tests/snapshots/zh-dark-120-p4.txt +2 -2
- package/skills/teamsmith/tests/snapshots/zh-dark-120.txt +9 -9
- package/skills/teamsmith/tests/snapshots/zh-dark-160-p4.txt +2 -2
- package/skills/teamsmith/tests/snapshots/zh-dark-160.txt +9 -9
- package/skills/teamsmith/tests/snapshots/zh-dark-59-detail.txt +1 -1
- package/skills/teamsmith/tests/snapshots/zh-dark-59-p4.txt +1 -1
- package/skills/teamsmith/tests/snapshots/zh-dark-59.txt +5 -5
- package/skills/teamsmith/tests/snapshots/zh-dark-99-p4.txt +2 -2
- package/skills/teamsmith/tests/snapshots/zh-dark-99.txt +5 -5
- package/skills/teamsmith/tests/snapshots/zh-light-120-detail.txt +2 -2
- package/skills/teamsmith/tests/snapshots/zh-light-120-p4.txt +2 -2
- package/skills/teamsmith/tests/snapshots/zh-light-120.txt +9 -9
- package/skills/teamsmith/tests/snapshots/zh-light-160-p4.txt +2 -2
- package/skills/teamsmith/tests/snapshots/zh-light-160.txt +9 -9
- package/skills/teamsmith/tests/snapshots/zh-light-59-detail.txt +1 -1
- package/skills/teamsmith/tests/snapshots/zh-light-59-p4.txt +1 -1
- package/skills/teamsmith/tests/snapshots/zh-light-59.txt +5 -5
- package/skills/teamsmith/tests/snapshots/zh-light-99-p4.txt +2 -2
- package/skills/teamsmith/tests/snapshots/zh-light-99.txt +5 -5
- package/skills/teamsmith/tests/task-header-model.sh +2 -1
- package/skills/teamsmith/tests/task-model-routing.sh +1511 -0
- package/skills/teamsmith/tests/tmp-hygiene.sh +782 -45
- package/skills/teamsmith/tests/tmux-identity-leak.sh +773 -0
- package/skills/teamsmith/tests/tmux-lint-legacy.txt +12 -18
- package/skills/teamsmith/tests/upgrade-recipe.sh +537 -0
- package/skills/teamsmith-init/SKILL.md +43 -43
- package/skills/teamsmith-init/references/bootstrap.md +8 -6
- package/skills/teamsmith-init/templates/bootstrap-prompt.md.tmpl +9 -5
|
@@ -116,7 +116,7 @@ server_up() { # <name> → fresh project + private tmux session
|
|
|
116
116
|
tmux -L "$sock" kill-server 2>/dev/null || true
|
|
117
117
|
rm -f "${TMUX_TMPDIR:-/tmp}/tmux-$(id -u)/$sock" 2>/dev/null || true
|
|
118
118
|
( cd "$ROOT" && bash "$skill/scripts/team" init --session "$sess" --agents "dev verify" --vcs local \
|
|
119
|
-
--gates "true" --docs docs/team ) >"$tmp/$1/init.log" 2>&1 \
|
|
119
|
+
--gates "true" --docs docs/team --task-models 'routine=deepseek/deepseek-flash analysis=xai/grok-4.6 verify=kimi-coding/k3-256k' --pm-model 'deepseek/deepseek-flash' ) >"$tmp/$1/init.log" 2>&1 \
|
|
120
120
|
|| { printf 'panel-b2: team init failed\n' >&2; tail -3 "$tmp/$1/init.log" >&2; exit 3; }
|
|
121
121
|
mkdir -p "$ROOT/.pi/team/state" "$ROOT/docs/team"
|
|
122
122
|
# The private server: the panes inherit its environment, and its `TMUX` routes every `team`
|
|
@@ -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;
|
|
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
|
-
|
|
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() {
|
|
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() {
|
|
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
|
}
|
|
@@ -240,6 +348,28 @@ closed" ;;
|
|
|
240
348
|
"$(json_str "$id")" "$(json_str "$file")" "$(json_str_ml "$text")" "$files"
|
|
241
349
|
}
|
|
242
350
|
|
|
351
|
+
# pulse-key-replies 的固定回复块(stub 面;见上面的三条 case)。
|
|
352
|
+
reply_entry_json() {
|
|
353
|
+
printf '{"no": 1, "available": true, "title": "固定关键回复", "from": "dev2", "at": "2026-09-16T09:59:00Z", "bytes": 24, "sha256": "%s"}' "$(printf 'a%.0s' {1..64})"
|
|
354
|
+
}
|
|
355
|
+
reply_summary_json() {
|
|
356
|
+
case "${B3_STUB_REPLY:-empty}" in
|
|
357
|
+
empty) printf '%s\n' '{"available": true, "state": "empty", "total_slots": 0, "warnings": []}' ;;
|
|
358
|
+
corrupt) printf '%s\n' '{"available": true, "state": "unavailable", "total_slots": 1, "warnings": [], "reason": "checksum mismatch"}' ;;
|
|
359
|
+
*) printf '{"available": true, "state": "ok", "total_slots": 1, "warnings": [], "entry": %s}\n' "$(reply_entry_json)" ;;
|
|
360
|
+
esac
|
|
361
|
+
}
|
|
362
|
+
reply_list_json() {
|
|
363
|
+
case "${B3_STUB_REPLY:-empty}" in
|
|
364
|
+
empty) printf '%s\n' '{"available": true, "state": "empty", "total_slots": 0, "entries": [], "next_before": null, "warnings": []}' ;;
|
|
365
|
+
corrupt) printf '%s\n' '{"available": true, "state": "ok", "total_slots": 1, "entries": [{"no": 1, "available": false, "reason": "checksum mismatch"}], "next_before": null, "warnings": []}' ;;
|
|
366
|
+
*) printf '{"available": true, "state": "ok", "total_slots": 1, "entries": [%s], "next_before": null, "warnings": []}\n' "$(reply_entry_json)" ;;
|
|
367
|
+
esac
|
|
368
|
+
}
|
|
369
|
+
reply_body_json() {
|
|
370
|
+
printf '%s\n' '{"no": 1, "available": true, "title": "固定关键回复", "from": "dev2", "at": "2026-09-16T09:59:00Z", "bytes": 24, "sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "text_kind": "safe-display", "display_text": "固定回复正文\n第二行\n"}'
|
|
371
|
+
}
|
|
372
|
+
|
|
243
373
|
case "$block" in
|
|
244
374
|
frame)
|
|
245
375
|
printf '%s\n' '{"project": "fixture", "timestamp": "2026-09-16T10:00:00Z", "interval": 900, "standby": {"on": false, "reason": ""}, "activity_source": ""}'
|
|
@@ -268,7 +398,12 @@ case "$block" in
|
|
|
268
398
|
outbox_list) outbox_list_json ;;
|
|
269
399
|
inbox) inbox_json ;;
|
|
270
400
|
patrol) patrol_json ;;
|
|
271
|
-
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 ;;
|
|
402
|
+
# pulse-key-replies:三个回复块也是固定数据(默认「显式空」,B3_STUB_REPLY=1 → 一条 1 号回复,
|
|
403
|
+
# =corrupt → 最新槽位不可用),这样第 5 页与总览的摘要行在快照里逐字节可复现。
|
|
404
|
+
reply_summary) reply_summary_json ;;
|
|
405
|
+
reply_list) reply_list_json ;;
|
|
406
|
+
reply_body) reply_body_json ;;
|
|
272
407
|
health)
|
|
273
408
|
printf '%s\n' '{"version": "1.38.0", "doc_version": "1.38.0", "doctor": "ok", "gates": "—"}'
|
|
274
409
|
;;
|