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
@@ -16,6 +16,7 @@
16
16
  # workflow 指引:fixture Agent 在五种结果后仍发同一正文、回执 body-free、账本不变(4.1)
17
17
  # flip 坏源码→红→还原→绿:九条具名 guard 的独立 scratch 源码 + 哈希(2.4)
18
18
  # skip-path 缺观测器(/proc/<pid>/io)时可见跳过并点名,而不是判红(V27 M3)
19
+ # guide 指引面:PM 提示词/协议/命令表三处纪律在场 + 示例命令对拍真解析器 + 四变异红侧(change: pm-reply-discipline · P267)
19
20
  #
20
21
  # 隔离(M7.2 的纪律):夹具只在临时根里的私有仓库跑真 CLI;进入任何写盘命令前先断言
21
22
  # `team paths` 的 main_root 等于夹具仓库(不是真实仓库);跑完断言真实仓库的 docs/team/inbox
@@ -44,7 +45,7 @@ while [ $# -gt 0 ]; do
44
45
  *) printf 'key-replies.sh:未知参数 %s(-h 看用法)\n' "$1" >&2; exit 2 ;;
45
46
  esac
46
47
  done
47
- KR_ALL_GROUPS=(input paths original concurrency receipts interrupt paging bounded readonly workflow flip skip-path)
48
+ KR_ALL_GROUPS=(input paths original concurrency receipts interrupt paging bounded readonly workflow flip skip-path guide)
48
49
  if [ "$ALL" = "1" ] && [ "${#KR_GROUPS[@]}" -gt 0 ]; then
49
50
  printf 'key-replies.sh:--all 与 --select 不同用\n' >&2; exit 2
50
51
  fi
@@ -1046,6 +1047,244 @@ kr_group_skip_path() {
1046
1047
  kr_ev_save "$out" "skip-path-bounded-flip.txt"
1047
1048
  }
1048
1049
 
1050
+ # ---------------------------------------------------------------- 组:guide(change: pm-reply-discipline · P267;判据面 P301)
1051
+ # 纪律要随工具走:三处指令面(注入的 PM 提示词 / 协议的 §4b / SKILL 命令表)各自带着同一套**语义锚点**
1052
+ # (大小写不敏感;断言的是「义务在场」,不是逐字措辞),并且各自带着同一条**判据** `written for the user`
1053
+ # ——写给用户的回复(回答/汇报/结论/裁定/请示/交付摘要)必须发布,写给巡检/席位/别的项目 PM 的与工具回执不算。
1054
+ # 模板里印出来的示例命令必须被**真解析器**接受
1055
+ # ——「印出来就能用」是承诺兑现;控制臂(同一 argv 追加未知旗标)必须被拒,否则这个探针是空对空。
1056
+ # 五个 $TMP 变异副本必须红并点名被改的面(①②③⑤ 还要点名缺失的判据 token),重新从真树复制后绿。
1057
+ # 真树与真项目在这一组里只读。
1058
+ guide_spec() { # <面名> → 分号分隔的锚点;`row:` 前缀 = 必须落在 SKILL 的 `| Key replies |` 行内
1059
+ case "$1" in
1060
+ "prompt template") printf '%s' 'conclusion;milestone;ruling;ask the user;--stdin;team reply post;written for the user' ;;
1061
+ "protocol reference") printf '%s' 'conclusion;milestone;ruling;ask the user;--stdin;team reply post;No tool can verify;written for the user' ;;
1062
+ "command table") printf '%s' 'milestone;ruling;ask the user;row:conclusion;row:say;row:notify;row:--stdin;row:team reply post;row:written for the user' ;;
1063
+ esac
1064
+ }
1065
+
1066
+ guide_surface_path() { # <面名> → 该面的真实路径
1067
+ case "$1" in
1068
+ "prompt template") printf '%s\n' "$SKILL_DIR/templates/pm-prompt.md.tmpl" ;;
1069
+ "protocol reference") printf '%s\n' "$SKILL_DIR/references/protocol.md" ;;
1070
+ "command table") printf '%s\n' "$SKILL_DIR/SKILL.md" ;;
1071
+ esac
1072
+ }
1073
+
1074
+ guide_check_surface() { # <面名> <文件>:绿=0;红=1 并点名面 + 缺的锚点(真树与变异副本共用)
1075
+ local name="$1" f="$2" specs row="" miss="" a want
1076
+ local -a arr
1077
+ if [ ! -f "$f" ]; then
1078
+ bad "guide-surfaces:$name 文件缺失($f)—— 这个面不再承载「关键结论先发布」"
1079
+ return 1
1080
+ fi
1081
+ specs="$(guide_spec "$name")"
1082
+ case "$specs" in *row:*) row="$(grep -m1 '^| Key replies |' "$f" 2>/dev/null)" ;; esac
1083
+ IFS=';' read -r -a arr <<<"$specs"
1084
+ for a in "${arr[@]}"; do
1085
+ case "$a" in
1086
+ row:*)
1087
+ want="${a#row:}"
1088
+ if [ -z "$row" ] || ! printf '%s' "$row" | grep -qiF -- "$want"; then
1089
+ miss="$miss [$want](Key replies 行内)"
1090
+ fi ;;
1091
+ *)
1092
+ grep -qiF -- "$a" "$f" || miss="$miss [$a]" ;;
1093
+ esac
1094
+ done
1095
+ if [ -z "$miss" ]; then
1096
+ ok "guide-surfaces:$name 带着全部语义锚点(${specs//;/、},大小写不敏感)"
1097
+ else
1098
+ bad "guide-surfaces:$name 丢了纪律判据:$miss —— 这里判的是这个面缺了什么,不是要求某个措辞;这个面不再承载「关键结论先发布」"
1099
+ return 1
1100
+ fi
1101
+ }
1102
+
1103
+ guide_example_cmd() { # <模板> → 唯一示例命令(去反引号);次数≠1/形状不全 → rc1 + stderr 说明
1104
+ local tmpl="$1" n cmd
1105
+ n="$(grep -c -- 'team reply post' "$tmpl" 2>/dev/null || true)"
1106
+ if [ "${n:-0}" != "1" ]; then
1107
+ printf '模板里 team reply post 出现 %s 次(示例命令必须是唯一一行)' "${n:-0}" >&2
1108
+ return 1
1109
+ fi
1110
+ cmd="$(grep -o 'team reply post[^`]*' "$tmpl" 2>/dev/null | head -1 | sed 's/[[:space:]]*$//')"
1111
+ if ! printf '%s' "$cmd" | grep -q -- '--stdin'; then
1112
+ printf '示例命令里没有 --stdin(取到 [%s])' "$cmd" >&2
1113
+ return 1
1114
+ fi
1115
+ case "$cmd" in
1116
+ *'< '*) ;;
1117
+ *) printf '示例命令没有用 < <file> 把正文从文件重定向进来(取到 [%s])' "$cmd" >&2; return 1 ;;
1118
+ esac
1119
+ printf '%s\n' "$cmd"
1120
+ }
1121
+
1122
+ guide_run_example() { # <夹具项目> <旗标文本(印刷原样,去掉重定向)> <正文文件> —— 行首 team 解析为真 CLI
1123
+ local p="$1" flags="$2" f="$3"
1124
+ ( cd "$p" && env "${KR_CLEAN[@]:1}" bash -c 'eval "bash \"$1\" --root \"$2\" $3 < \"$4\""' _ "$KR_TEAM" "$p" "$flags" "$f" )
1125
+ }
1126
+
1127
+ guide_check_example() { # <模板> <夹具项目>:绿=0;红=1(文案里点名 example command)
1128
+ local tmpl="$1" p="$2" cmd rest flags body out rc2 rc before after after2 red=0
1129
+ cmd="$(guide_example_cmd "$tmpl" 2>"$TMP/guide-example.err")"
1130
+ if [ -z "$cmd" ]; then
1131
+ bad "guide-example:example command 在 $tmpl 里取不到可执行的样例($(head -c 160 "$TMP/guide-example.err" 2>/dev/null))"
1132
+ return 1
1133
+ fi
1134
+ rest="${cmd#team }"; flags="${rest%% < *}" # 在重定向前的 ` < ` 处截断(题目的 `<short title>` 里没有这个分隔)
1135
+ if [ "$flags" = "$rest" ] || ! printf '%s' "$flags" | grep -q -- '--stdin'; then
1136
+ bad "guide-example:example command 的旗标部分取不到(取到 [$(printf '%s' "$flags" | head -c 120)])"
1137
+ return 1
1138
+ fi
1139
+ flags="${flags%"${flags##*[![:space:]]}"}" # 去掉换行/尾随空格,保留印刷原样的词序列
1140
+ body="$TMP/guide-example-body.txt"
1141
+ printf '引导面探针正文:完整的一份答复(不是摘要)。\n' >"$body"
1142
+ before="$(kr_cli "$p" reply list --json 2>/dev/null | jget /dev/stdin 'd["total_slots"]')"
1143
+ out="$(guide_run_example "$p" "$flags" "$body" 2>&1)"; rc=$?
1144
+ after="$(kr_cli "$p" reply list --json 2>/dev/null | jget /dev/stdin 'd["total_slots"]')"
1145
+ if [ "$rc" = "0" ]; then
1146
+ ok "guide-example:示例命令被真解析器接受(rc=0,$cmd)"
1147
+ else
1148
+ bad "guide-example:example command 被真解析器拒绝(rc=$rc,输出 [$(printf '%s' "$out" | head -c 160)])"; red=1
1149
+ fi
1150
+ if jok "$out" 'd["outcome"]=="saved"'; then
1151
+ ok "guide-example:示例命令的回执 outcome=saved(no=$(jget "$out" 'd.get("no")'))"
1152
+ else
1153
+ bad "guide-example:example command 的回执不是 saved(rc=$rc,输出 [$(printf '%s' "$out" | head -c 160)])"; red=1
1154
+ fi
1155
+ if [ "${after:-x}" = "$(( ${before:-0} + 1 ))" ]; then
1156
+ ok "guide-example:示例命令真的发布了一条(槽位 ${before:-?} → ${after:-?})"
1157
+ else
1158
+ bad "guide-example:example command 发布后槽位不是 +1(${before:-?} → ${after:-?})"; red=1
1159
+ fi
1160
+ out="$(guide_run_example "$p" "$flags --frobnicate-probe" "$body" 2>&1)"; rc2=$?
1161
+ after2="$(kr_cli "$p" reply list --json 2>/dev/null | jget /dev/stdin 'd["total_slots"]')"
1162
+ if [ "$rc2" = "2" ]; then
1163
+ ok "guide-example:控制臂(同一 argv + 未知旗标)被真解析器拒绝(rc=2)"
1164
+ else
1165
+ bad "guide-example:example command 的控制臂没有拒绝未知旗标(rc=$rc2)—— 探针可能把旗标吞掉了"; red=1
1166
+ fi
1167
+ if printf '%s' "$out" | grep -qF -- '未知参数'; then
1168
+ ok "guide-example:控制臂诊断点名「未知参数」"
1169
+ else
1170
+ bad "guide-example:example command 的控制臂诊断没有点名「未知参数」([$(printf '%s' "$out" | head -c 160)])"; red=1
1171
+ fi
1172
+ if [ "${after2:-x}" = "${after:-y}" ]; then
1173
+ ok "guide-example:控制臂没有新槽位(拒绝发生在发布之前,槽位仍 ${after2:-?})"
1174
+ else
1175
+ bad "guide-example:example command 的控制臂留下了新槽位(${after:-?} → ${after2:-?})"; red=1
1176
+ fi
1177
+ return "$red"
1178
+ }
1179
+
1180
+ kr_group_guide() {
1181
+ section "guide · 三处表面的纪律 + 按读者判据 + 示例命令对拍 + 五变异(change: pm-reply-discipline · P267 / P301)"
1182
+ local TMPL PROTO SKILLMD pex mut MUTD out rc
1183
+ TMPL="$(guide_surface_path "prompt template")"
1184
+ PROTO="$(guide_surface_path "protocol reference")"
1185
+ SKILLMD="$(guide_surface_path "command table")"
1186
+
1187
+ # ---- guide-surfaces:真树的三处表面各自带着自己的锚点(缺哪个点名哪个面)
1188
+ guide_check_surface "prompt template" "$TMPL"
1189
+ guide_check_surface "protocol reference" "$PROTO"
1190
+ guide_check_surface "command table" "$SKILLMD"
1191
+
1192
+ # ---- guide-example:印出来的示例命令必须被真解析器接受(真 CLI、私有夹具、重定向指向夹具正文)
1193
+ pex="$(kr_new_proj "guide-example")"
1194
+ guide_check_example "$TMPL" "$pex"
1195
+
1196
+ # ---- guide-flip:四个 $TMP 变异副本,每次必须红并点名被改的面;还原(重新从真树复制)后绿
1197
+ MUTD="$TMP/guide-mut"; rm -rf "$MUTD"; mkdir -p "$MUTD"
1198
+
1199
+ guide_flip_red() { # <标签> <期望点名的面> <rc> <断言文本>
1200
+ local label="$1" expect="$2" rc="$3" text="$4" first
1201
+ if [ -n "$KR_EV" ]; then
1202
+ printf '%s\n' "$text" >"$TMP/guide-flip.out"
1203
+ kr_ev_save "$TMP/guide-flip.out" "guide-flip-$(printf '%s' "$expect" | tr ' ' '-')-red.txt"
1204
+ fi
1205
+ if [ "$rc" != "0" ] && printf '%s' "$text" | grep -q '✗' && printf '%s' "$text" | grep -qF -- "$expect"; then
1206
+ first="$(printf '%s' "$text" | grep -m1 '✗' | sed 's/^[[:space:]]*//; s/ —— .*$//')"
1207
+ ok "guide-flip/$label:变异 → 红并点名 [$expect](${first:0:200})"
1208
+ else
1209
+ bad "guide-flip/$label:变异后没有红/没有点名 [$expect](rc=$rc,输出 [$(printf '%s' "$text" | tr '\n' '|' | cut -c1-220)])"
1210
+ fi
1211
+ }
1212
+
1213
+ guide_flip_names_criterion() { # <标签> <断言文本>:红文案里必须出现被摘掉的那条判据(缺了什么,不是措辞要求)
1214
+ local label="$1" text="$2"
1215
+ if printf '%s' "$text" | grep -qF -- '[written for the user]'; then
1216
+ ok "guide-flip/$label:红文案点名缺失的判据 [written for the user]"
1217
+ else
1218
+ bad "guide-flip/$label:红文案没有点名缺失的判据 [written for the user]([$(printf '%s' "$text" | tr '\n' '|' | cut -c1-220)])"
1219
+ fi
1220
+ }
1221
+
1222
+ guide_flip_ev() { # <名字> <断言文本(还原后的绿)>:TEAM_REPLY_EVIDENCE 时留证
1223
+ [ -n "$KR_EV" ] || return 0
1224
+ printf '%s\n' "$2" >"$TMP/guide-flip.out"
1225
+ kr_ev_save "$TMP/guide-flip.out" "$1"
1226
+ }
1227
+
1228
+ # ① 模板:删掉持有 `Key conclusions` 锚点的整段 → 红并点名 prompt template
1229
+ mut="$MUTD/pm-prompt.md.tmpl"; cp -f "$TMPL" "$mut"
1230
+ awk 'BEGIN{RS="";ORS="\n\n"} !index($0,"Key conclusions") {print}' "$mut" >"$mut.tmp" && mv "$mut.tmp" "$mut"
1231
+ if grep -qF -- 'Key conclusions' "$mut"; then bad "guide-flip/①:变异没应用上(Key conclusions 段还在)"; fi
1232
+ out="$(guide_check_surface "prompt template" "$mut" 2>&1)"; rc=$?
1233
+ guide_flip_red "①" "prompt template" "$rc" "$out"
1234
+ guide_flip_names_criterion "①" "$out"
1235
+ cp -f "$TMPL" "$mut"
1236
+ out="$(guide_check_surface "prompt template" "$mut" 2>&1)"; rc=$?
1237
+ if [ "$rc" = "0" ]; then ok "guide-flip/①:还原(重新从真树复制)后绿"; else bad "guide-flip/①:还原后仍红([$(printf '%s' "$out" | tr '\n' '|' | cut -c1-200)])"; fi
1238
+ guide_flip_ev "guide-flip-1-restore-green.txt" "$out"
1239
+
1240
+ # ② 协议:删掉 §4b 的常设义务段 → 红并点名 protocol reference
1241
+ mut="$MUTD/protocol.md"; cp -f "$PROTO" "$mut"
1242
+ awk 'BEGIN{RS="";ORS="\n\n"} !index($0,"standing duty of the PM") {print}' "$mut" >"$mut.tmp" && mv "$mut.tmp" "$mut"
1243
+ if grep -qF -- 'standing duty of the PM' "$mut"; then bad "guide-flip/②:变异没应用上(常设义务段还在)"; fi
1244
+ out="$(guide_check_surface "protocol reference" "$mut" 2>&1)"; rc=$?
1245
+ guide_flip_red "②" "protocol reference" "$rc" "$out"
1246
+ guide_flip_names_criterion "②" "$out"
1247
+ cp -f "$PROTO" "$mut"
1248
+ out="$(guide_check_surface "protocol reference" "$mut" 2>&1)"; rc=$?
1249
+ if [ "$rc" = "0" ]; then ok "guide-flip/②:还原(重新从真树复制)后绿"; else bad "guide-flip/②:还原后仍红([$(printf '%s' "$out" | tr '\n' '|' | cut -c1-200)])"; fi
1250
+ guide_flip_ev "guide-flip-2-restore-green.txt" "$out"
1251
+
1252
+ # ③ SKILL:把 `| Key replies |` 行换成不含锚点的行 → 红并点名 command table
1253
+ mut="$MUTD/SKILL.md"; cp -f "$SKILLMD" "$mut"
1254
+ awk 'index($0, "| Key replies |") == 1 && !done { print "| Key replies | See `references/protocol.md` §4b. |"; done=1; next } { print }' "$mut" >"$mut.tmp" && mv "$mut.tmp" "$mut"
1255
+ if grep -qF -- 'The outlet for key conclusions' "$mut"; then bad "guide-flip/③:变异没应用上(旧行还在)"; fi
1256
+ out="$(guide_check_surface "command table" "$mut" 2>&1)"; rc=$?
1257
+ guide_flip_red "③" "command table" "$rc" "$out"
1258
+ guide_flip_names_criterion "③" "$out"
1259
+ cp -f "$SKILLMD" "$mut"
1260
+ out="$(guide_check_surface "command table" "$mut" 2>&1)"; rc=$?
1261
+ if [ "$rc" = "0" ]; then ok "guide-flip/③:还原(重新从真树复制)后绿"; else bad "guide-flip/③:还原后仍红([$(printf '%s' "$out" | tr '\n' '|' | cut -c1-200)])"; fi
1262
+ guide_flip_ev "guide-flip-3-restore-green.txt" "$out"
1263
+
1264
+ # ④ 模板:示例行的 `--stdin` 改成 `--stdinX` → 真解析器拒绝 → 红并点名 example command
1265
+ mut="$MUTD/pm-prompt.md.tmpl"; cp -f "$TMPL" "$mut"
1266
+ perl -pi -e 's/--stdin\b/--stdinX/ if /team reply post/' "$mut"
1267
+ if ! grep -qF -- '--stdinX' "$mut"; then bad "guide-flip/④:变异没应用上(示例行没有 --stdinX)"; fi
1268
+ out="$(guide_check_example "$mut" "$pex" 2>&1)"; rc=$?
1269
+ guide_flip_red "④" "example command" "$rc" "$out"
1270
+ cp -f "$TMPL" "$mut"
1271
+ out="$(guide_check_example "$mut" "$pex" 2>&1)"; rc=$?
1272
+ if [ "$rc" = "0" ]; then ok "guide-flip/④:还原(重新从真树复制)后绿"; else bad "guide-flip/④:还原后仍红([$(printf '%s' "$out" | tr '\n' '|' | cut -c1-200)])"; fi
1273
+ guide_flip_ev "guide-flip-4-restore-green.txt" "$out"
1274
+
1275
+ # ⑤ 模板:只把判据 token 换成另一种说法(句子仍通顺)→ 红并点名 prompt template 与缺失的判据
1276
+ mut="$MUTD/pm-prompt.md.tmpl"; cp -f "$TMPL" "$mut"
1277
+ perl -pi -e 's/written for the user/written for a person/g' "$mut"
1278
+ if grep -qiF -- 'written for the user' "$mut"; then bad "guide-flip/⑤:变异没应用上(判据 token 还在)"; fi
1279
+ out="$(guide_check_surface "prompt template" "$mut" 2>&1)"; rc=$?
1280
+ guide_flip_red "⑤" "prompt template" "$rc" "$out"
1281
+ guide_flip_names_criterion "⑤" "$out"
1282
+ cp -f "$TMPL" "$mut"
1283
+ out="$(guide_check_surface "prompt template" "$mut" 2>&1)"; rc=$?
1284
+ if [ "$rc" = "0" ]; then ok "guide-flip/⑤:还原(重新从真树复制)后绿"; else bad "guide-flip/⑤:还原后仍红([$(printf '%s' "$out" | tr '\n' '|' | cut -c1-200)])"; fi
1285
+ guide_flip_ev "guide-flip-5-restore-green.txt" "$out"
1286
+ }
1287
+
1049
1288
  # ---------------------------------------------------------------- 驱动
1050
1289
  if [ -n "$KR_EV" ]; then mkdir -p "$KR_EV" 2>/dev/null || true; kr_ev_note "run start $(date -u +%Y-%m-%dT%H:%M:%SZ)"; fi
1051
1290
  if ! kr_io_supported; then
@@ -40,6 +40,7 @@ set -uo pipefail
40
40
 
41
41
  BAN_SELF="${BASH_SOURCE[0]}"
42
42
  BAN_DIR="$(cd -P "$(dirname "$BAN_SELF")" && pwd)"
43
+ BAN_SKILL_DIR="$(cd -P "$BAN_DIR/.." && pwd)" # skill 根(影子副本要指回真库,见 tmp-root.sh 的 TEAM_TMP_SKILL_DIR)
43
44
  BAN_REPO_ROOT="$(cd -P "$BAN_DIR/../../.." && pwd)" # tests/ → teamsmith/ → skills/ → 仓库根
44
45
  BAN_DOCS_REL="docs/team"
45
46
  BAN_NAMES_REL=".pi/team/forbidden-names.txt"
@@ -328,7 +329,7 @@ ban_run() { # <root> <published|all> <名单源文件|-> <用户名|->
328
329
 
329
330
  # ── 自检:五形状 + 不误伤 + 混合/超量/截断 + 可证伪(含遮蔽影子)──────────────────────────
330
331
  ban_selftest() {
331
- local base="${TMPDIR:-/tmp}/teamsmith-ledger-ban-selftest.$$"
332
+ local base="$(team_tmp_root)/.teamsmith-ledger-ban-selftest.$$"
332
333
  local okn=0 badn=0 case_rc=0 out="" rc=0
333
334
  rm -rf "$base"
334
335
  mkdir -p "$base" || { ban_note "自检:建不出 $base"; return 1; }
@@ -425,7 +426,7 @@ EOF
425
426
  awk -v pat="$ban_ct" '{ if (index($0, pat) > 0) print ": # 影子:永远不记命中"; else print }' \
426
427
  "$sh/ledger-ban.sh" >"$sh/ledger-ban.new" && mv "$sh/ledger-ban.new" "$sh/ledger-ban.sh"
427
428
  if [ "$(grep -cF "$ban_ct" "$sh/ledger-ban.sh")" = "0" ]; then
428
- out="$(LEDGER_BAN_SHADOW_CHILD=1 bash "$sh/ledger-ban.sh" --self-test 2>&1)"; rc=$?
429
+ out="$(LEDGER_BAN_SHADOW_CHILD=1 TEAM_TMP_SKILL_DIR="$BAN_SKILL_DIR" bash "$sh/ledger-ban.sh" --self-test 2>&1)"; rc=$?
429
430
  if [ "$rc" = "1" ] && ban_case_has "✗ ①" && ban_case_has "✗ ②"; then
430
431
  ban_case_ok "④" "影子:把扫描改成永远通过 → ①②红(自检有牙)"
431
432
  else
@@ -556,7 +557,7 @@ EOF
556
557
  awk -v pat="$ban_mk" '{ if (index($0, pat) > 0) sub(/i <= n_spans/, "i <= 0"); print }' \
557
558
  "$sh2/ledger-ban.sh" >"$sh2/ledger-ban.new" && mv "$sh2/ledger-ban.new" "$sh2/ledger-ban.sh"
558
559
  if [ "$(grep -cF "$ban_mk" "$sh2/ledger-ban.sh")" = "0" ]; then
559
- out="$(LEDGER_BAN_SHADOW_CHILD=1 bash "$sh2/ledger-ban.sh" --self-test 2>&1)"; rc=$?
560
+ out="$(LEDGER_BAN_SHADOW_CHILD=1 TEAM_TMP_SKILL_DIR="$BAN_SKILL_DIR" bash "$sh2/ledger-ban.sh" --self-test 2>&1)"; rc=$?
560
561
  if [ "$rc" = "1" ] && ban_case_has "✗ ⑦" && ban_case_has "✗ ⑧"; then
561
562
  ban_case_ok "④b" "影子(遮蔽关掉):⑦⑧ 的「输出无原文」断言红(断言有牙)"
562
563
  else
@@ -607,6 +608,6 @@ fi
607
608
  if [ "$BAN_SCOPE" = "published" ] && [ ! -e "$BAN_ROOT/$BAN_DOCS_REL" ]; then
608
609
  ban_note "注意:$BAN_DOCS_REL 不存在(产品面检出?)—— 没有账本文本可扫"
609
610
  fi
610
- BAN_TMP="$(tmp_root_create ledger-ban)" || ban_die "建不出临时根(TMPDIR=${TMPDIR:-/tmp})"
611
+ BAN_TMP="$(tmp_root_create ledger-ban)" || ban_die "建不出临时根(TMPDIR=$(team_tmp_root))"
611
612
  ban_run "$BAN_ROOT" "$BAN_SCOPE" "$BAN_NAMES" "$BAN_USER"
612
613
  exit $?
@@ -229,7 +229,8 @@ if [ "$(grep -cF -- "$OLD_PAT" "$OLDFACE/ledger-ban.sh")" = "1" ]; then
229
229
  awk -v pat="$OLD_PAT" -v rep="$OLD_NEW" '{ i = index($0, pat); if (i > 0) $0 = substr($0, 1, i - 1) rep substr($0, i + length(pat)); print }' \
230
230
  "$OLDFACE/ledger-ban.sh" >"$OLDFACE/new" && mv "$OLDFACE/new" "$OLDFACE/ledger-ban.sh"
231
231
  if [ "$(grep -cF -- "$OLD_NEW" "$OLDFACE/ledger-ban.sh")" = "1" ]; then
232
- OUT="$(bash "$OLDFACE/ledger-ban.sh" --all --root "$FACE" --names-file "$FACE/.pi/team/forbidden-names.txt" 2>&1)"; RC=$?
232
+ # 旧面副本只拷了 ledger-ban.sh + lib/tmp-root.sh → 指回真库(P309:解析器不在,创建者会具名失败)
233
+ OUT="$(TEAM_TMP_SKILL_DIR="$SKILL_DIR" bash "$OLDFACE/ledger-ban.sh" --all --root "$FACE" --names-file "$FACE/.pi/team/forbidden-names.txt" 2>&1)"; RC=$?
233
234
  if [ "$RC" = "0" ] && printf '%s\n' "$OUT" | grep -qF 'hits=0' \
234
235
  && ! printf '%s\n' "$OUT" | grep -qF 'planted.tsv'; then
235
236
  case_ok "⑥ 假绿对照:账本面退回「只扫 *.md」→ 同一棵树、同一个植入 hits=0(假绿就是这么来的)"
@@ -0,0 +1,90 @@
1
+ #!/usr/bin/env bash
2
+ # bounded-spin.sh — 夹具的后台「看门 / 轮询」进程的**唯一实现**(infra · 实现:P313)
3
+ #
4
+ # 现场(2026-10-18,PM 实测):`/tmp` 显示 100% 满(64 M),`du` 只算出 9 G,`df` 说用了 15 G ——
5
+ # 差额是「**已删除但仍被持有**」的文件:78 个同一形状的进程合计持有 **11.98 GB**,运行 2 天以上:
6
+ #
7
+ # bash -c 'log="$1"; trap "" TERM; while :; do date +%s >> "$log"; sleep 0.2; done' _ <log>
8
+ #
9
+ # 它们的父进程(一次被打断的夹具运行)早已不在、写入的目标(夹具的临时根)早已被删,而循环
10
+ # **忽略 TERM**、**从不检查父进程**、**没有上限** → 任何一次被打断的夹具运行都会永久泄漏一个。
11
+ #
12
+ # 契约(三条,缺一条就是缺陷):
13
+ # ① 响应 TERM:`trap` 记录收到 TERM 然后**退出**;绝不 `trap "" TERM`
14
+ # (只有「忽略 TERM」本身是被测对象时才用 BOUNDED_SPIN_IGNORE_TERM=1,并写清理由);
15
+ # ② 每轮检查父进程:`while kill -0 "$parent"`,父没了就自己退(被打断的运行不留孤儿);
16
+ # ③ 硬上限:最大运行秒数 + 最大写入字节,到点退出并留**一行**说明(到点不是静默消失);
17
+ # 另外:写目标已经不在了(夹具的临时根被清理)也立即退出 ——「往已删除的文件里继续写」
18
+ # 正是上一次泄漏的形状(df 与 du 的差额就是这么来的)。
19
+ #
20
+ # 用法(夹具里):
21
+ # . "$SELF_DIR/lib/bounded-spin.sh"
22
+ # bounded_spin <interval_s> <cap_s> <cap_bytes|-> <log|-> [<parent_pid>] &
23
+ # log = `-` → 只自旋、不写日志(此时 cap_bytes 用 `-`)
24
+ # 父 pid 默认 `$PPID`;**经子 shell / setsid / tmux 间接拉起时**要显式给一个活到最后的
25
+ # supervisor pid(否则父一退它就跟着退,那就成了它自己的缺陷)。
26
+ # BOUNDED_SPIN_TERM="<snippet>" TERM 到达时先跑这段(记录证据),然后退出
27
+ # BOUNDED_SPIN_IGNORE_TERM=1 故意忽略 TERM(只给「忽略 TERM 的被测对象」,仍受 ②③ 约束)
28
+ #
29
+ # 退出行(写进日志尾部 + stderr 各一行):
30
+ # bounded-spin:退出(<原因>)· pid=<pid> · 父=<pid> · 轮=<n> · 用时=<s>s · 已写=<bytes>B
31
+
32
+ BS_LIB=1
33
+
34
+ # 父进程还活着吗?僵尸按「不在」算(它已经不在运行,只是还没被回收)。
35
+ # 没有 /proc 的平台退回 kill -0(拿不到僵尸判定,但边界仍在)。
36
+ _bs_parent_alive() { # <pid>
37
+ local pid="${1:-}" st
38
+ case "$pid" in ''|0|*[!0-9]*) return 1 ;; esac
39
+ if [ ! -d /proc/1 ]; then kill -0 "$pid" 2>/dev/null; return; fi
40
+ [ -r "/proc/$pid/stat" ] || return 1
41
+ st="$(awk '{ sub(/^.*\) /, ""); print $1 }' "/proc/$pid/stat" 2>/dev/null || true)"
42
+ [ "$st" = "Z" ] && return 1
43
+ return 0
44
+ }
45
+
46
+ # 收口:留一行说明再退。局部变量(parent / rounds / t0 / bytes / log)由 bounded_spin 定义,
47
+ # bash 的动态作用域让这里读得到 —— 改这个函数前先确认那几个变量名没被换掉。
48
+ _bs_exit() { # <原因>
49
+ local reason="$1" msg
50
+ msg="$(printf 'bounded-spin:退出(%s)· pid=%s · 父=%s · 轮=%s · 用时=%ss · 已写=%sB' \
51
+ "$reason" "$$" "${parent:-?}" "${rounds:-0}" "$(( SECONDS - ${t0:-$SECONDS} ))" "${bytes:-0}")"
52
+ if [ "${log:--}" != "-" ] && [ -n "${log:-}" ] && [ -e "$log" ]; then
53
+ printf '%s\n' "$msg" >> "$log" 2>/dev/null || true
54
+ fi
55
+ printf '%s\n' "$msg" >&2
56
+ exit 0
57
+ }
58
+
59
+ _bs_on_term() { # TERM = 收工:先跑调用方要的证据片段,再退出(绝不忽略)
60
+ eval "${BOUNDED_SPIN_TERM:-:}" >/dev/null 2>&1 || true
61
+ _bs_exit "收到 TERM"
62
+ }
63
+
64
+ bounded_spin() { # <interval_s> <cap_s> <cap_bytes|-> <log|-> [<parent_pid>]
65
+ local iv="${1:-0.2}" cap_s="${2:-1800}" cap_b="${3:--}" log="${4:--}" parent="${5:-$PPID}"
66
+ local t0="$SECONDS" rounds=0 bytes=0 line
67
+ case "$cap_s" in ''|*[!0-9]*) printf 'bounded-spin:cap_s 必须是正整数(收到 [%s])\n' "$cap_s" >&2; return 2 ;; esac
68
+ [ "$cap_s" -gt 0 ] || { printf 'bounded-spin:cap_s 必须是正整数(收到 [%s])\n' "$cap_s" >&2; return 2; }
69
+ if [ "${BOUNDED_SPIN_IGNORE_TERM:-0}" = "1" ]; then
70
+ trap '' TERM # 只有「忽略 TERM」本身是被测对象时才允许(调用方必须写清理由)
71
+ else
72
+ trap '_bs_on_term' TERM
73
+ fi
74
+ trap '_bs_exit "收到 INT"' INT
75
+ while _bs_parent_alive "$parent"; do
76
+ if [ "$(( SECONDS - t0 ))" -ge "$cap_s" ]; then _bs_exit "到点(最大运行 ${cap_s}s)"; fi
77
+ rounds=$((rounds + 1))
78
+ if [ "$log" != "-" ]; then
79
+ [ -e "$log" ] || _bs_exit "写目标已不在(${log})"
80
+ line="$(date +%s)"
81
+ if [ "$cap_b" != "-" ] && [ "$(( bytes + ${#line} + 1 ))" -gt "$cap_b" ]; then
82
+ _bs_exit "到点(最大写入 ${cap_b}B)"
83
+ fi
84
+ printf '%s\n' "$line" >> "$log" 2>/dev/null || _bs_exit "写不进去(${log})"
85
+ bytes=$(( bytes + ${#line} + 1 ))
86
+ fi
87
+ sleep "$iv"
88
+ done
89
+ _bs_exit "父进程 ${parent} 已不在"
90
+ }
@@ -17,6 +17,10 @@ for k,v in values.items(): s=s.replace('{{'+k+'}}',v)
17
17
  # P235: the template carries empty model-policy keys; the fixture fills both.
18
18
  s=re.sub(r'^TEAM_TASK_MODELS=.*$', 'TEAM_TASK_MODELS="routine=deepseek/deepseek-flash analysis=xai/grok-4.6 verify=kimi-coding/k3-256k"', s, flags=re.M)
19
19
  s=re.sub(r'^TEAM_PM_MODEL=.*$', 'TEAM_PM_MODEL="deepseek/deepseek-flash"', s, flags=re.M)
20
+ # P261: the template's shape number is a render placeholder too; the fixture declares the shape it builds
21
+ # (same style as the two model keys above), otherwise the literal '{{CONFIG_VERSION}}' would read as a
22
+ # non-integer shape marker and the startup transaction would refuse the fixture.
23
+ s=re.sub(r'^TEAM_CONFIG_VERSION=.*$', 'TEAM_CONFIG_VERSION="2"', s, flags=re.M)
20
24
  pathlib.Path(out).write_text(s)
21
25
  PY
22
26
  }
@@ -131,6 +131,57 @@ elif name == 'monitor-record-drift':
131
131
  replace(root / 'skills/teamsmith/scripts/monitor.mjs',
132
132
  ' team_assignment_parse "$2" "$data" || exit 1',
133
133
  ' data="$(printf "%s" "$data" | sed "s/malformed nonce/fixture-nonce/")" # P228_FLIP_monitor-record-drift\n team_assignment_parse "$2" "$data" || exit 1')
134
+ elif name == 'migration-row-removed':
135
+ # P261 red side: the derivation table loses its only migration row -> the legacy project must be refused
136
+ # (missing-migration-row named), not silently passed through with the old keys.
137
+ replace(lib / 'cmd-config.sh', 'm1|1|2|0.2.0', '# P228_FLIP_migration-row-removed')
138
+ elif name == 'no-backup':
139
+ # P261 red side: write no timestamped backup but still report one.
140
+ replace(lib / 'cmd-config.sh',
141
+ 'cp -p "$path" "$dir/$name" || return 1',
142
+ ': # P228_FLIP_no-backup')
143
+ elif name == 'no-shape-number':
144
+ # P261 red side: init/bootstrap stop writing the configuration shape number.
145
+ replace(root / 'skills/teamsmith/scripts/lib/cmd-project.sh',
146
+ ' "CONFIG_VERSION=$TEAM_CONFIG_SHAPE_CURRENT" > "$cfg"; then',
147
+ ' > "$cfg"; then # P228_FLIP_no-shape-number')
148
+ elif name == 'missing-record-refused':
149
+ # P261 red side: restore the old single refusal for "no metadata at all".
150
+ replace(lib / 'common.sh',
151
+ ' if [ ! -f "$TEAM_STATE_DIR/pm-launch.env" ]; then\n TEAM_PM_IDENTITY_REGISTER=1',
152
+ ' if [ ! -f "$TEAM_STATE_DIR/pm-launch.env" ]; then\n team_err "PM launch identity missing"; return 1 # P228_FLIP_missing-record-refused\n TEAM_PM_IDENTITY_REGISTER=1')
153
+ elif name == 'adopt-ignores-yes':
154
+ # P261 red side: --adopt-pm-identity writes a differing record without the explicit --yes.
155
+ replace(lib / 'common.sh',
156
+ """ if [ "$yes" != "1" ]; then
157
+ team_err "--adopt-pm-identity 需要 --yes:这是把现在的解析声明成这次续跑的身份"
158
+ team_dim " 记录 model=$TEAM_PM_SELECTED_MODEL(suffix 显式)/现在 model=$want_model;记录 resume_key=$TEAM_PM_RECORDED_RESUME_KEY/现在 resume_key=$want_resume" >&2
159
+ team_dim " 要新开一场对话而不是认领:$TEAM_CLI up --fresh-pm" >&2
160
+ return 1
161
+ fi""",
162
+ ' : # P228_FLIP_adopt-ignores-yes')
163
+ elif name == 'legacy-route-placeholder':
164
+ # P261 返修(V35 F2/O1)红侧:拒绝建议退回占位符(不读项目自己的配置也不走推导表)
165
+ # → init / bootstrap / config 写路径的「推导命令逐字节」与粘贴现场必红。
166
+ function(lib / 'common.sh', 'team_legacy_model_route_lines',
167
+ " local cfg=\"${1:-${TEAM_CONFIG:-}}\"\n"
168
+ " team_dim \" 路线 ① 手工事务(先预览):$TEAM_CLI config upgrade-models --task-models '<category=provider/model …>' --pm-model '<provider/model>' --dry-run\"\n"
169
+ " team_dim \" 路线 ② 启动事务(机械形状由它迁移):$TEAM_CLI up(--print 只预告,--no-migrate 只报告)\"")
170
+ elif name == 'updatecheck-equal-prints':
171
+ # P261 red side: an equal published version is reported as newer.
172
+ replace(lib / 'cmd-watch.sh',
173
+ ' [ "$b" -gt "$a" ] && return 0',
174
+ ' [ "$b" -ge "$a" ] && return 0 # P228_FLIP_updatecheck-equal-prints')
175
+ elif name == 'updatecheck-ignores-off':
176
+ # P261 red side: TEAM_UPDATE_CHECK=0 no longer suppresses the lookup.
177
+ replace(lib / 'cmd-watch.sh',
178
+ ' [ "${TEAM_UPDATE_CHECK:-1}" = "0" ] && return 0',
179
+ ': # P228_FLIP_updatecheck-ignores-off')
180
+ elif name == 'updatecheck-print-writes-cache':
181
+ # P261 red side: the preview performs the lookup and writes the cache.
182
+ replace(lib / 'cmd-watch.sh',
183
+ " printf '(本可检查 npm 上的新版本:--print 下不联网、不写缓存)\\n'\n return 0\n fi",
184
+ " team_update_check_notice # P228_FLIP_updatecheck-print-writes-cache\n printf '(本可检查 npm 上的新版本:--print 下不联网、不写缓存)\\n'\n return 0\n fi")
134
185
  else:
135
186
  raise SystemExit('unknown mutation: ' + name)
136
187
  print(json.dumps(dict(mutation=name, changes=changes), ensure_ascii=False))
@@ -193,14 +193,14 @@ kr_group_pane() {
193
193
 
194
194
  # ① 第 5 页:列表帧(两行 + 页签身份)
195
195
  keys "5"; sleep 0.6
196
- want_frame list5 "pane:第 5 页列表帧(编号 + 标题 + 自称发布者)" "#3 长正文" "#2 第二份回复" "#1 完整结论与取舍" "关键回复"
196
+ want_frame list5 "pane:第 5 页列表帧(编号 + 标题 + 发布者标签)" "#3 长正文" "#2 第二份回复" "#1 完整结论与取舍" "关键回复"
197
197
  assert_has "$tmp/$current/list5.txt" "关键回复" "pane:页签显示第 5 页身份"
198
198
  assert_has "$tmp/$current/list5.txt" "个编号槽位" "pane:列表带编号槽位计数(不冒充可读回复数)"
199
199
  ev_save "$tmp/$current/list5.txt" "pane-list5.txt"
200
200
  # ② Enter 打开焦点(最新号)→ 正文视窗;End 滚到最后一行,END-MARKER 可达
201
201
  keys Enter; sleep 0.6
202
- want_frame viewer "pane:Enter 打开焦点号的完整正文" "长正文" "自称来自 dev2"
203
- assert_has "$tmp/$current/viewer.txt" "只读 · 发布者自称,未经核验" "pane:正文视窗写明自称且只读"
202
+ want_frame viewer "pane:Enter 打开焦点号的完整正文" "长正文" "来自 dev2"
203
+ assert_has "$tmp/$current/viewer.txt" "只读 · 按发布的原文显示" "pane:正文视窗只读且按发布的原文显示(没有限定词)"
204
204
  assert_not "$tmp/$current/viewer.txt" "END-MARKER-P234" "pane:视窗打开时停在文首(长文没有被一次性铺满)"
205
205
  keys End; sleep 0.6
206
206
  want_frame viewer_end "pane:End 滚到长正文结尾,END-MARKER 可达" "END-MARKER-P234"
@@ -255,7 +255,7 @@ kr_group_demand() {
255
255
  # ③ 打开某号:多一个 reply_body --no <no>
256
256
  reset_argv
257
257
  keys Down; sleep 0.3; keys Enter; sleep 1.5
258
- want_frame body "demand:打开某号后正文视窗渲染" "只读 · 发布者自称"
258
+ want_frame body "demand:打开某号后正文视窗渲染" "只读 · 按发布的原文显示"
259
259
  assert_eq "demand:打开正文时没有 list 的新调用" "$(block_calls reply_list)" "0"
260
260
  if [ "$(block_calls reply_body)" -ge 1 ]; then ok "demand:打开正文后 body 被调度($(block_calls reply_body) 次)"; else bad "demand:打开正文后没有 body 调用"; fi
261
261
  assert_match "$(kr_argv)" 'reply_body.*--no [0-9]+' "demand:body 调用带上了要读的编号(argv 可查)"
@@ -346,7 +346,6 @@ PYW
346
346
  bad "snapshot:${w}×${t}×${l} 宽度检查器本身失败(rc=$over_rc,$over)"
347
347
  elif [ -z "$over" ]; then ok "snapshot:${w}×${t}×${l} 没有行超过 ${w} 列(显示宽度)"
348
348
  else bad "snapshot:${w}×${t}×${l} 有行超宽($over)"; fi
349
- if [ "$l" = "zh" ]; then assert_match "$f" '更早' "snapshot:${w}×${t}×${l} Older 可达"; else assert_match "$f" 'Older' "snapshot:${w}×${t}×${l} Older 可达"; fi
350
349
  # 页签身份:59 列用短标签,但活动页标签仍在
351
350
  if [ "$l" = "zh" ]; then assert_has "$f" "关键回复" "snapshot:${w}×${t}×${l} 活动页身份可见"; else assert_has "$f" "key replies" "snapshot:${w}×${t}×${l} 活动页身份可见"; fi
352
351
  done
@@ -357,15 +356,11 @@ PYW
357
356
  # 空 store / 坏 store / 长文视窗 三态
358
357
  "${clean_env[@]}" node "$panel" --root "$ROOT" --team-cli "$team_cli" --snapshot --page 5 --reply-before 10 --width 120 --height 24 --lang zh 2>/dev/null | sed -e 's/\x1b\[[0-9;]*m//g' >"$tmp/snap-cont.txt"
359
358
  assert_has "$tmp/snap-cont.txt" "#1 " "snapshot:第二页 cursor 渲染出 #1(更旧页真的可达)"
360
- assert_has "$tmp/snap-cont.txt" "个编号槽位" "snapshot:更旧页仍带编号槽位计数"
361
359
  ev_save "$tmp/snap-cont.txt" "snapshot-continuation.txt"
362
360
  "${clean_env[@]}" node "$panel" --root "$ROOT" --team-cli "$team_cli" --snapshot --page 5 --reply-no 2 --width 120 --height 24 --lang zh 2>/dev/null | sed -e 's/\x1b\[[0-9;]*m//g' >"$tmp/snap-view.txt"
363
361
  assert_has "$tmp/snap-view.txt" "长文快照" "snapshot:长文视窗渲染标题"
364
362
  mv "$state/key-replies" "$tmp/store-parked"
365
363
  "${clean_env[@]}" node "$panel" --root "$ROOT" --team-cli "$team_cli" --snapshot --page 5 --width 99 --height 20 --lang zh 2>/dev/null | sed -e 's/\x1b\[[0-9;]*m//g' >"$tmp/snap-empty.txt"
366
- assert_has "$tmp/snap-empty.txt" "(还没有关键回复)" "snapshot:空 store 是显式空状态"
367
- assert_has "$tmp/snap-empty.txt" "关键回复" "snapshot:空 store 时页面身份仍在"
368
- assert_not "$tmp/snap-empty.txt" "个编号槽位" "snapshot:空 store 不伪装成有槽位"
369
364
  ev_save "$tmp/snap-empty.txt" "snapshot-empty.txt"
370
365
  mv "$tmp/store-parked" "$state/key-replies"
371
366
  }