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
@@ -6,7 +6,7 @@
6
6
  # TEAM_INSTALL_KEEP=1 bash ... # keep the fixture directory
7
7
  # TEAM_INSTALL_TREE=<tree> bash ... # run against another checkout (the flip section builds scratch trees)
8
8
  #
9
- # Sections: surfaces install conflict shell pack doctor flip
9
+ # Sections: surfaces install conflict shell pack doctor extension flip
10
10
  # Exit: 0 every selected section green, 1 at least one assertion failed, 3 setup failure.
11
11
  #
12
12
  # Nothing here touches the caller's project: every fixture is a fresh git repo under $TMPDIR, the caller's
@@ -62,7 +62,7 @@ assert_link_to() { [ -L "$1" ] && [ "$(readlink -f "$1" 2>/dev/null)" = "$2" ] &
62
62
  || bad "$3($1 → $(readlink -f "$1" 2>/dev/null || echo '不是软链'),期望 $2)"; }
63
63
 
64
64
  SECTIONS=("$@")
65
- [ "${#SECTIONS[@]}" -gt 0 ] || SECTIONS=(surfaces install conflict shell pack doctor flip)
65
+ [ "${#SECTIONS[@]}" -gt 0 ] || SECTIONS=(surfaces install conflict shell pack doctor extension flip)
66
66
  want() { local s; for s in "${SECTIONS[@]}"; do [ "$s" = "$1" ] && return 0; done; return 1; }
67
67
 
68
68
  # ---------------------------------------------------------------- helpers
@@ -280,24 +280,124 @@ chk_bootstrap_installs() { # <tree> <已初始化但删掉 .pi/skills 的仓库>
280
280
  if [ "$(readlink -f "$p/.pi/skills/teamsmith")" != "$t/skills/teamsmith" ]; then printf '软链目标不对\n'; return 1; fi
281
281
  h2="$(file_hash "$p/.pi/team/config.sh")"
282
282
  if [ "$h1" != "$h2" ]; then printf 'config.sh 被改了\n'; return 1; fi
283
- if ! printf '%s\n' "$out" | grep -qF -- 'pi --approve'; then
284
- printf 'bootstrap 升级路径没打信任提示行\n'; return 1
283
+ if ! chk_trust_hint "$out" >/dev/null; then
284
+ printf 'bootstrap 升级路径的信任提示行不达标:[%s]\n' "$(printf '%s\n' "$out" | grep -F -- 'pi --approve' | head -1)"
285
+ return 1
285
286
  fi
286
- printf '已存在配置也装了 skill,config.sh 未动,信任提示行也在\n'
287
+ printf '已存在配置也装了 skill,config.sh 未动,信任提示行也在(同一行契约)\n'
287
288
  return 0
288
289
  }
289
290
 
290
- # P59:安装步的信任提示行 —— 同一行必须点名触发资源(.pi/skills/)与三条出路
291
- # (pi --approve / /trust / team init --no-skills),而且只能出现一次。
291
+ # ---------------------------------------------------------------- P270 · `/team` 扩展安装面(同一张冲突表,单文件形状)
292
+ chk_ext_installed_link() { # <tree> <repo>:装成指向运行树的软链
293
+ local t="$1" p="$2"
294
+ local dest="$p/.pi/extensions/team.ts"
295
+ [ -L "$dest" ] || { printf '没有把 /team 扩展装成软链(%s)\n' "$dest"; return 1; }
296
+ [ "$(readlink -f "$dest")" = "$t/skills/teamsmith/extension/team.ts" ] \
297
+ || { printf '软链目标不对:%s\n' "$(readlink -f "$dest")"; return 1; }
298
+ printf '扩展软链指向运行树\n'
299
+ return 0
300
+ }
301
+ chk_ext_unmarked_survives() { # <tree> <repo(.pi/extensions/team.ts 是不带标记的普通文件)>
302
+ local t="$1" p="$2"
303
+ local dest="$p/.pi/extensions/team.ts" before after out rc
304
+ before="$(file_hash "$dest")"
305
+ out="$(init_proj "$t" "$p")"; rc=$?
306
+ [ "$rc" -ne 0 ] || { printf '未标记的扩展文件居然 rc=0\n'; return 1; }
307
+ case "$out" in *红线*|*不认识的条目*) ;; *) printf '没说明红线:[%s]\n' "$(printf '%s' "$out" | tail -2 | tr '\n' ' ')"; return 1 ;; esac
308
+ after="$(file_hash "$dest")"
309
+ [ "$before" = "$after" ] || { printf '拒绝时把字节改了\n'; return 1; }
310
+ out="$(init_proj "$t" "$p" --force)"; rc=$?
311
+ [ "$rc" -ne 0 ] || { printf '--force 下未标记的扩展文件居然 rc=0\n'; return 1; }
312
+ after="$(file_hash "$dest")"
313
+ [ "$before" = "$after" ] || { printf '--force 把未标记的扩展文件动了\n'; return 1; }
314
+ printf '拒绝且连 --force 都不删(rc=%s)\n' "$rc"
315
+ return 0
316
+ }
317
+ chk_ext_marked_copy_force() { # <tree> <repo(扩展是带标记、改坏了一行的副本)>
318
+ local t="$1" p="$2"
319
+ local dest="$p/.pi/extensions/team.ts" before out rc
320
+ before="$(file_hash "$dest")"
321
+ out="$(init_proj "$t" "$p")"; rc=$?
322
+ [ "$rc" -ne 0 ] || { printf '带标记的漂移副本居然 rc=0\n'; return 1; }
323
+ [ "$(file_hash "$dest")" = "$before" ] || { printf '拒绝时把漂移副本改了\n'; return 1; }
324
+ init_proj "$t" "$p" --force >/dev/null 2>&1; rc=$?
325
+ [ "$rc" -eq 0 ] || { printf '--force 退出 %s\n' "$rc"; return 1; }
326
+ cmp -s "$t/skills/teamsmith/extension/team.ts" "$dest" || { printf '--force 后字节与源不同\n'; return 1; }
327
+ printf '带标记的漂移副本:默认拒绝、--force 换成源\n'
328
+ return 0
329
+ }
330
+ chk_ext_foreign_link_force() { # <tree> <repo(扩展软链指向 $tmp/foreign-ext.ts)>
331
+ local t="$1" p="$2"
332
+ local dest="$p/.pi/extensions/team.ts" out rc
333
+ out="$(init_proj "$t" "$p")"; rc=$?
334
+ [ "$rc" -ne 0 ] || { printf '别源软链居然 rc=0\n'; return 1; }
335
+ [ "$(readlink "$dest")" = "$tmp/foreign-ext.ts" ] || { printf '拒绝时被重指了\n'; return 1; }
336
+ init_proj "$t" "$p" --force >/dev/null 2>&1; rc=$?
337
+ [ "$rc" -eq 0 ] || { printf '--force 退出 %s\n' "$rc"; return 1; }
338
+ [ "$(readlink -f "$dest")" = "$t/skills/teamsmith/extension/team.ts" ] || { printf '--force 没重指到运行树\n'; return 1; }
339
+ printf '别源软链:默认拒绝、--force 重指\n'
340
+ return 0
341
+ }
342
+ chk_bootstrap_installs_ext() { # <tree> <已初始化但删掉 .pi/extensions 的仓库>
343
+ local t="$1" p="$2" h1 h2 out rc dest
344
+ dest="$p/.pi/extensions/team.ts"
345
+ h1="$(file_hash "$p/.pi/team/config.sh")"
346
+ out="$(run_tree "$t" "$p" bootstrap --no-pulse --agents dev)"; rc=$?
347
+ [ "$rc" -eq 0 ] || { printf 'bootstrap rc=%s:[%s]\n' "$rc" "$(printf '%s' "$out" | tail -2 | tr '\n' ' ')"; return 1; }
348
+ [ -L "$dest" ] || { printf 'bootstrap 没装回扩展\n'; return 1; }
349
+ [ "$(readlink -f "$dest")" = "$t/skills/teamsmith/extension/team.ts" ] || { printf '软链目标不对\n'; return 1; }
350
+ h2="$(file_hash "$p/.pi/team/config.sh")"
351
+ [ "$h1" = "$h2" ] || { printf 'config.sh 被改了\n'; return 1; }
352
+ printf '已存在配置也装了扩展,config.sh 未动\n'
353
+ return 0
354
+ }
355
+ ext_doctor_row() { # <captured 输出> → `/team 扩展安装` 行(没有则空)
356
+ printf '%s\n' "$1" | grep -F '/team 扩展安装' | head -1
357
+ }
358
+ chk_ext_doctor_missing() { # <tree> <repo(扩展被删掉)>
359
+ local out rc row
360
+ out="$(run_doctor "$1" "$2")"; rc=$?
361
+ [ "$rc" -eq 0 ] || { printf 'doctor 因 install 行以外的东西非 0(rc=%s)\n' "$rc"; return 1; }
362
+ row="$(ext_doctor_row "$out")"
363
+ case "$row" in *'!'*'.pi/extensions/team.ts'*'team init'*) ;; *) printf '缺失行的形状不对:[%s]\n' "$row"; return 1 ;; esac
364
+ case "$row" in *'--force'*) printf '缺失不该给 --force:[%s]\n' "$row"; return 1 ;; esac
365
+ printf '缺失:warn 点名路径与修法 team init\n'
366
+ return 0
367
+ }
368
+ chk_ext_doctor_drift() { # <tree> <repo(扩展副本改坏一行)>
369
+ local out rc row
370
+ out="$(run_doctor "$1" "$2")"; rc=$?
371
+ [ "$rc" -eq 0 ] || { printf 'doctor 因 install 行以外的东西非 0(rc=%s)\n' "$rc"; return 1; }
372
+ row="$(ext_doctor_row "$out")"
373
+ case "$row" in *'!'*'.pi/extensions/team.ts'*'team init --force'*) ;; *) printf '漂移行的形状不对:[%s]\n' "$row"; return 1 ;; esac
374
+ printf '漂移:warn 点名路径与修法 team init --force\n'
375
+ return 0
376
+ }
377
+ chk_ext_no_install_silent() { # <tree> <没有项目本地安装的仓库>
378
+ local out rc
379
+ out="$(run_doctor "$1" "$2")"; rc=$?
380
+ [ "$rc" -eq 0 ] || { printf 'doctor 因 install 行以外的东西非 0(rc=%s)\n' "$rc"; return 1; }
381
+ if printf '%s\n' "$out" | grep -qF '/team 扩展安装'; then printf '没有项目本地安装却刷了 /team 行\n'; return 1; fi
382
+ printf '没有项目本地安装:一行都不打\n'
383
+ return 0
384
+ }
385
+
386
+ # P59 + P299:安装步的信任提示行 —— 同一行必须点名**两处**触发资源(.pi/skills/ 与 .pi/extensions/)
387
+ # 与三条出路(pi --approve / /trust / team init --no-skills),而且只能出现一次。
292
388
  chk_trust_hint() { # <init 捕获输出>
293
- local line n
389
+ local line n t miss=""
294
390
  line="$(printf '%s\n' "$1" | grep -F -- 'pi --approve' | head -1)"
295
391
  if [ -z "$line" ]; then
296
- printf '输出里没有信任提示行(要一行点名 .pi/skills/ + pi --approve + /trust + team init --no-skills)\n'
392
+ printf '输出里没有信任提示行(要一行点名 .pi/skills/ + .pi/extensions/ + pi --approve + /trust + team init --no-skills)\n'
297
393
  return 1
298
394
  fi
299
- case "$line" in *'.pi/skills/'*'pi --approve'*'/trust'*'team init --no-skills'*) ;; *)
300
- printf '提示行缺要点:[%s]\n' "$line"; return 1 ;; esac
395
+ for t in '.pi/skills/' '.pi/extensions/' 'pi --approve' '/trust' 'team init --no-skills'; do
396
+ case "$line" in *"$t"*) ;; *) miss="$miss [$t]" ;; esac
397
+ done
398
+ if [ -n "$miss" ]; then
399
+ printf '提示行缺要点:%s —— 行原文:[%s]\n' "$miss" "$line"; return 1
400
+ fi
301
401
  n="$(printf '%s' "$1" | grep -cF -- 'pi --approve' || true)"
302
402
  if [ "$n" != "1" ]; then printf '提示行不是恰好一行(%s 行)\n' "$n"; return 1; fi
303
403
  printf '信任提示行打了一次:[%s]\n' "$(printf '%s' "$line" | LC_ALL=C sed 's/^[[:space:]]*//' | cut -c1-56)"
@@ -318,6 +418,20 @@ chk_no_skills_silent() { # <tree> <repo>:--no-skills 下不许出现这一行
318
418
  return 0
319
419
  }
320
420
 
421
+ # P299(init-skill 场景 3 的红侧面):两处 init 文档必须**同页**点名「触发资源 + 三条答案」——
422
+ # 判据用稳定 token(不是整句),删掉任一个 token 必红。五个 token = 两处触发资源 + 三条出路。
423
+ chk_init_docs_fact() { # <tree>
424
+ local d t miss=""
425
+ for d in skills/teamsmith-init/SKILL.md skills/teamsmith-init/references/bootstrap.md; do
426
+ for t in '.pi/skills/' '.pi/extensions/' 'pi --approve' '/trust' 'team init --no-skills'; do
427
+ grep -qF -- "$t" "$1/$d" || miss="$miss $d[$t]"
428
+ done
429
+ done
430
+ if [ -n "$miss" ]; then printf 'init 文档没同页点名触发资源/答案:%s\n' "$miss"; return 1; fi
431
+ printf '两处 init 文档都同页点名 .pi/skills/ + .pi/extensions/ + pi --approve + /trust + team init --no-skills\n'
432
+ return 0
433
+ }
434
+
321
435
  chk_pack_manifest() { # <tree>:声明面 —— 恰好一个 bin 键,files 带着 bin/
322
436
  python3 - "$1/package.json" <<'PYMANI'
323
437
  import json, sys
@@ -370,7 +484,77 @@ chk_prefix_install() { # <tree>:npm 私有 prefix 安装后与 bash 入口一
370
484
  if ! diff <("$prefix/bin/team" help 2>&1) <(bash "$t/skills/teamsmith/scripts/team" help 2>&1) >/dev/null; then
371
485
  printf 'prefix 的 help 与 bash 入口不一致\n'; return 1
372
486
  fi
373
- printf '私有 prefix 安装后 version/help 与 bash 入口一致(%s/bin/team)\n' "$prefix"
487
+ # P321:安装物还得带上信号闸门的四个入口。npm 的 tarball **不携带 120000 软链** —— 0.3.0 的包里
488
+ # pkill/killall/pgrep/pidof 四个名字全部缺失,装完全部落到 /usr/bin(docs/team/reviews/release-0.3.0.md)。
489
+ # 判据不看名字在不在:在**安装物**的 gated PATH 里用同名 argv 记录桩验拒绝/放行(不发任何信号)。
490
+ chk_prefix_signal_entries "$prefix" || return 1
491
+ printf '私有 prefix 安装后 version/help 与 bash 入口一致,四个信号入口在且判定生效(%s/bin/team)\n' "$prefix"
492
+ return 0
493
+ }
494
+
495
+ chk_prefix_signal_entries() { # <prefix>:安装物的 pkill/killall/pgrep/pidof 在、解析到安装目录、判定生效
496
+ local prefix="$1" shim backends stub wlog log t form out rc line fargs missing=""
497
+ shim="$prefix/lib/node_modules/teamsmith/skills/teamsmith/scripts/shim"
498
+ backends="$tmp/prefix-signal-backends"; rm -rf "$backends"; mkdir -p "$backends"
499
+ stub="$backends/.witness"
500
+ cat > "$stub" <<'WITNESS'
501
+ #!/usr/bin/env bash
502
+ printf 'WITNESS tool=%s argc=%s argv=%s\n' "$(basename "$0")" "$#" "$*" >> "${WITNESS_LOG:?}"
503
+ [ -n "${WITNESS_OUT:-}" ] && printf '%s\n' "$WITNESS_OUT"
504
+ [ -n "${WITNESS_ERR:-}" ] && printf '%s\n' "$WITNESS_ERR" >&2
505
+ exit "${WITNESS_EXIT:-0}"
506
+ WITNESS
507
+ chmod +x "$stub"
508
+ for t in pkill killall pgrep pidof; do ln -sf .witness "$backends/$t"; done
509
+ for t in pkill killall pgrep pidof; do
510
+ [ -f "$shim/$t" ] && [ -x "$shim/$t" ] || missing="${missing:+$missing }$t"
511
+ done
512
+ if [ -n "$missing" ]; then
513
+ printf '安装包没有携带信号闸门入口(npm 丢 120000 软链的历史形状):%s\n' "$missing"; return 1
514
+ fi
515
+ for t in pkill killall pgrep pidof; do
516
+ line="$(PATH="$shim:$backends:/usr/bin:/bin" command -v "$t" 2>/dev/null)"
517
+ if [ "$line" != "$shim/$t" ]; then
518
+ printf 'gated PATH 里 %s 解析到 [%s],不是安装包的入口\n' "$t" "$line"; return 1
519
+ fi
520
+ done
521
+ log="$tmp/prefix-signal-calls.log"; rm -f "$log" "$log.forensics"
522
+ wlog="$tmp/prefix-signal-witness.log"; rm -f "$wlog"
523
+ # 拒绝:exit 64、stdout 留空、同名后端一次也没被执行
524
+ for form in "pkill -f marker" "killall sleep" "pgrep -f marker" "pgrep sleep" "pidof sleep"; do
525
+ read -r -a fargs <<< "$form"
526
+ out="$(env -u TEAM_SIGNAL_REAL PATH="$shim:$backends:/usr/bin:/bin" TEAM_SIGNAL_CALLS_LOG="$log" \
527
+ WITNESS_LOG="$wlog" "$shim/${fargs[0]}" "${fargs[@]:1}" 2>/dev/null)"; rc=$?
528
+ if [ "$rc" != "64" ] || [ -n "$out" ]; then
529
+ printf '安装包入口 [%s] 应拒绝(64 + 空 stdout),实际 rc=%s stdout=[%s]\n' "$form" "$rc" "$out"; return 1
530
+ fi
531
+ unset fargs
532
+ done
533
+ if [ -s "$wlog" ]; then
534
+ printf '拒绝路径执行了同名后端:%s\n' "$(head -2 "$wlog" | tr '\n' ' ')"; return 1
535
+ fi
536
+ # 放行:--help 与显式 -P 的原样 argv / stdout / stderr / 非零状态都来自同名后端
537
+ out="$(env -u TEAM_SIGNAL_REAL PATH="$shim:$backends:/usr/bin:/bin" TEAM_SIGNAL_CALLS_LOG="$log" \
538
+ WITNESS_LOG="$wlog" WITNESS_EXIT=3 WITNESS_OUT=sel-out WITNESS_ERR=sel-err \
539
+ "$shim/pgrep" --help 2>"$tmp/prefix-signal.err")"; rc=$?
540
+ if [ "$rc" != "3" ] || [ "$out" != "sel-out" ] || [ "$(cat "$tmp/prefix-signal.err")" != "sel-err" ]; then
541
+ printf 'pgrep --help 没有原样透传:rc=%s stdout=[%s] stderr=[%s]\n' "$rc" "$out" "$(cat "$tmp/prefix-signal.err")"
542
+ return 1
543
+ fi
544
+ grep -qF 'WITNESS tool=pgrep argc=1 argv=--help' "$wlog" \
545
+ || { printf 'pgrep --help 的 argv 没落到同名后端:[%s]\n' "$(cat "$wlog")"; return 1; }
546
+ out="$(env -u TEAM_SIGNAL_REAL PATH="$shim:$backends:/usr/bin:/bin" TEAM_SIGNAL_CALLS_LOG="$log" \
547
+ WITNESS_LOG="$wlog" WITNESS_EXIT=0 WITNESS_OUT=42 \
548
+ "$shim/pgrep" -P 12 2>/dev/null)"; rc=$?
549
+ if [ "$rc" != "0" ] || [ "$out" != "42" ]; then
550
+ printf 'pgrep -P 12 没有原样透传:rc=%s stdout=[%s]\n' "$rc" "$out"; return 1
551
+ fi
552
+ grep -qF 'WITNESS tool=pgrep argc=2 argv=-P 12' "$wlog" \
553
+ || { printf 'pgrep -P 12 的 argv 没落到 pgrep 后端:[%s]\n' "$(cat "$wlog")"; return 1; }
554
+ grep -qF 'act=pass · tool=pgrep' "$log" \
555
+ || { printf '安装包入口的日志没有 act=pass · tool=pgrep:[%s]\n' "$(cat "$log")"; return 1; }
556
+ grep -qF 'act=refused · tool=pidof' "$log" \
557
+ || { printf '安装包入口的拒绝日志没有 tool=pidof:[%s]\n' "$(cat "$log")"; return 1; }
374
558
  return 0
375
559
  }
376
560
 
@@ -416,17 +600,19 @@ if want surfaces; then
416
600
  bad "init SKILL 行序不对:npm=[$n_npm] init=[$n_init] bootstrap=[$n_boot]"
417
601
  fi
418
602
  grep -qF '.pi/skills/' "$init_skill" && ok "init SKILL 点名项目目标 .pi/skills/" || bad "init SKILL 没点名 .pi/skills/"
603
+ # P299:两处 init 文档都要同页带「触发资源 + 三条答案」的稳定 token(红侧在 flip ⑨)
604
+ check_holds "P299 两处 init 文档同页点名触发资源与答案" chk_init_docs_fact "$tree"
419
605
  grep -qF 'pi install' "$init_skill" && grep -qF 'install.sh' "$init_skill" \
420
606
  && ok "init SKILL 同时保留两条替代路线(pi install / install.sh)" \
421
607
  || bad "init SKILL 少了替代路线"
422
- help_out="$(bash "$team_cli" help 2>&1)"
423
- help_init="$(printf '%s\n' "$help_out" | grep -A2 '^ init ')"
424
- case "$help_init" in *'.pi/skills'*'--copy'*'--no-skills'*)
425
- ok "team help 的 init 行点名 .pi/skills / --copy / --no-skills" ;;
426
- *) bad "team help 的 init 行没说全($(printf '%s' "$help_init" | tr '\n' ' '))" ;;
608
+ # P260 起帮助面分三级:init / bootstrap 的用法行与说明在各自的命令页上(读整页,不再截三行窗口)
609
+ help_out="$(bash "$team_cli" help init 2>&1)"
610
+ case "$help_out" in *'.pi/skills'*'--copy'*'--no-skills'*)
611
+ ok "team help init 页点名 .pi/skills / --copy / --no-skills" ;;
612
+ *) bad "team help init 页没说全($(printf '%s' "$help_out" | tr '\n' ' ' | cut -c1-200))" ;;
427
613
  esac
428
- printf '%s\n' "$help_out" | grep -A2 '^ bootstrap ' | grep -qF '.pi/skills' \
429
- && ok "team help 的 bootstrap 行点名装 skill 一步" || bad "team help 的 bootstrap 行没点名装 skill"
614
+ printf '%s\n' "$(bash "$team_cli" help bootstrap 2>&1)" | grep -qF '.pi/skills' \
615
+ && ok "team help bootstrap 页点名装 skill 一步" || bad "team help bootstrap 页没点名装 skill"
430
616
  grep -F '| Init / self-check |' "$daily_skill" | grep -qF '.pi/skills/' \
431
617
  && ok "日常 skill 的命令表 init 行点名项目 skill 安装" || bad "日常 skill 的命令表 init 行没点名安装"
432
618
  n_r_npm="$(grep -nF 'npm install -g teamsmith' "$tree/README.md" | head -1 | cut -d: -f1)"
@@ -476,7 +662,9 @@ if want install; then
476
662
  case "$out" in *'--no-skills'*) ok "--no-skills 明说跳过了这一步" ;; *) bad "--no-skills 没有说明" ;; esac
477
663
  check_holds "P59 --no-skills 不打信任提示行" chk_no_skills_silent "$tree" "$p"
478
664
  assert_not_file "$p/.pi/skills" "--no-skills 没建 .pi/skills/"
665
+ assert_not_file "$p/.pi/extensions" "--no-skills 也没建 .pi/extensions/"
479
666
  assert_eq ".gitignore 没被塞进 .pi/skills/" "$(grep -cxF '.pi/skills/' "$p/.gitignore" || true)" "0"
667
+ assert_eq ".gitignore 没被塞进 .pi/extensions/" "$(grep -cxF '.pi/extensions/' "$p/.gitignore" || true)" "0"
480
668
 
481
669
  # ③ --copy:真目录、字节相等、不带 node_modules/.git
482
670
  p="$tmp/p-copy"; git_new "$p"; assert_isolated "$tree" "$p"
@@ -498,6 +686,7 @@ if want install; then
498
686
  assert_eq "worktree 里 init 退出码 0" "$rc" "0"
499
687
  assert_link_to "$p/.pi/skills/teamsmith" "$tree/skills/teamsmith" "安装落在主工作树的 .pi/skills/"
500
688
  assert_not_file "$p/.worktrees/wt/.pi/skills" "worktree 侧没有安装条目"
689
+ assert_not_file "$p/.worktrees/wt/.pi/extensions" "worktree 侧也没有 /team 扩展(席位不需要斜杠命令)"
501
690
 
502
691
  # ⑤ bootstrap 升级路径(配置已存在、.pi/skills 缺席)
503
692
  p="$tmp/p-boot"; git_new "$p"; assert_isolated "$tree" "$p"
@@ -511,6 +700,7 @@ if want install; then
511
700
  out="$(run_tree "$tree" "$p" bootstrap --no-pulse --print)"; rc=$?
512
701
  assert_eq "bootstrap --print 退出码 0" "$rc" "0"
513
702
  case "$out" in *'.pi/skills/'*) ok "--print 的计划点名装 skill 一步" ;; *) bad "--print 没点名装 skill 一步" ;; esac
703
+ case "$out" in *'.pi/extensions/'*) ok "--print 的计划同时点名 /team 扩展一步" ;; *) bad "--print 没点名 /team 扩展一步" ;; esac
514
704
  assert_not_file "$p/.pi/skills" "--print 没写 .pi/skills/"
515
705
  assert_not_file "$p/.pi/team/config.sh" "--print 没写配置"
516
706
  assert_eq "--print 没动仓库(.git 指纹不变)" "$(files_hash "$p/.git")" "$before"
@@ -574,7 +764,7 @@ if want pack; then
574
764
  else
575
765
  check_holds "声明面:一个 bin 键(team → bin/team.mjs)+ files 带 bin/" chk_pack_manifest "$tree"
576
766
  check_holds "打包清单:bin/team.mjs + 两个 SKILL.md + install.sh,不含账本" chk_pack_walk "$tree"
577
- check_holds "私有 prefix 安装:version/help 与 bash 入口一致" chk_prefix_install "$tree"
767
+ check_holds "私有 prefix 安装:version/help 与四个信号入口都来自安装物" chk_prefix_install "$tree"
578
768
  fi
579
769
  fi
580
770
 
@@ -610,6 +800,80 @@ if want doctor; then
610
800
  assert_eq "别源软链:warn 不改退出码(doctor 0)" "$DOC_RC" "0"
611
801
  init_proj "$tree" "$p" --force >/dev/null 2>&1
612
802
  assert_link_to "$p/.pi/skills/teamsmith" "$tree/skills/teamsmith" "别源软链:--force 修复到运行树"
803
+ # ⑤ P270:扩展 link → pass 行点名路径与源;不 warn
804
+ p="$tmp/d-ext-link"; git_new "$p"; init_proj "$tree" "$p" >/dev/null 2>&1
805
+ doctor_capture "$tree" "$p"; row="$(ext_doctor_row "$DOC_OUT")"
806
+ case "$row" in *'✓'*"$p/.pi/extensions/team.ts"*"$tree/skills/teamsmith/extension/team.ts"*)
807
+ ok "/team 扩展 link:pass 行点名入口与源" ;; *) bad "/team 扩展 link:行不对($row)" ;; esac
808
+ case "$row" in *'!'*) bad "/team 扩展 link:居然 warn" ;; *) ok "/team 扩展 link:不 warn" ;; esac
809
+ assert_eq "/team 扩展 link:doctor 退出 0" "$DOC_RC" "0"
810
+ # ⑥ 扩展缺失 → warn 点名路径与修法 team init;修复后回到 pass
811
+ p="$tmp/d-ext-missing"; git_new "$p"; init_proj "$tree" "$p" >/dev/null 2>&1; rm -f "$p/.pi/extensions/team.ts"
812
+ check_holds "扩展缺失:warn 点名路径与修法 team init" chk_ext_doctor_missing "$tree" "$p"
813
+ init_proj "$tree" "$p" >/dev/null 2>&1
814
+ doctor_capture "$tree" "$p"; row="$(ext_doctor_row "$DOC_OUT")"
815
+ case "$row" in *'✓'*) ok "扩展缺失修复:team init 后回到 pass" ;; *) bad "扩展缺失修复后行不对($row)" ;; esac
816
+ # ⑦ 副本漂移 → warn 点名路径与修法 team init --force;--force 之后回到 pass
817
+ p="$tmp/d-ext-drift"; git_new "$p"; init_proj "$tree" "$p" --copy >/dev/null 2>&1
818
+ printf '\n// drift\n' >> "$p/.pi/extensions/team.ts"
819
+ check_holds "扩展漂移:warn 点名路径与修法 team init --force" chk_ext_doctor_drift "$tree" "$p"
820
+ init_proj "$tree" "$p" --force >/dev/null 2>&1
821
+ doctor_capture "$tree" "$p"; row="$(ext_doctor_row "$DOC_OUT")"
822
+ case "$row" in *'✓'*"$tree/skills/teamsmith/extension/team.ts"*) ok "扩展漂移修复:--force 后回到 pass" ;; *) bad "扩展漂移修复后行不对($row)" ;; esac
823
+ # ⑧ 没有项目本地安装 → 一行都不打
824
+ p="$tmp/d-ext-absent"; git_new "$p"; init_proj "$tree" "$p" --no-skills >/dev/null 2>&1
825
+ check_holds "没有项目本地安装:/team 行一行都不打" chk_ext_no_install_silent "$tree" "$p"
826
+ fi
827
+
828
+ # ---------------------------------------------------------------- extension · P270
829
+ if want extension; then
830
+ section "extension · /team 扩展安装面(link/copy/冲突表/--no-skills/bootstrap)"
831
+ # ① 默认 link:逐条一行 + .gitignore + 目标指向运行树
832
+ p="$tmp/x-link"; git_new "$p"; assert_isolated "$tree" "$p"
833
+ out="$(init_proj "$tree" "$p")"; rc=$?
834
+ assert_eq "init 退出码 0" "$rc" "0"
835
+ case "$out" in *"link $p/.pi/extensions/team.ts → $tree/skills/teamsmith/extension/team.ts"*)
836
+ ok "输出逐条一行:扩展 link 行(含目标与源)" ;;
837
+ *) bad "扩展 link 行形状不对:$(printf '%s' "$out" | grep extensions | tr '\n' ' ')" ;; esac
838
+ check_holds "扩展装成指向运行树的软链" chk_ext_installed_link "$tree" "$p"
839
+ assert_eq ".gitignore 有 .pi/extensions/ 且只一条" "$(grep -cxF '.pi/extensions/' "$p/.gitignore" || true)" "1"
840
+ # ② 幂等:第二次 init 报 skip;--copy 对着已有软链也 skip,目标不变
841
+ x1="$(readlink -f "$p/.pi/extensions/team.ts")"
842
+ out2="$(init_proj "$tree" "$p")"; rc2=$?
843
+ assert_eq "第二次 init 退出码 0" "$rc2" "0"
844
+ case "$out2" in *"skip $p/.pi/extensions/team.ts("*) ok "第二次 init 报扩展 skip" ;; *) bad "第二次 init 没有扩展 skip 行" ;; esac
845
+ assert_eq "第二次 init 后扩展目标不变" "$(readlink -f "$p/.pi/extensions/team.ts")" "$x1"
846
+ out3="$(init_proj "$tree" "$p" --copy)"; rc3=$?
847
+ assert_eq "--copy 对着已有扩展软链退出 0(skip,不覆盖)" "$rc3" "0"
848
+ assert_eq "--copy 后仍是同一软链目标" "$(readlink -f "$p/.pi/extensions/team.ts")" "$x1"
849
+ # ③ --copy:真文件、字节相等
850
+ p="$tmp/x-copy"; git_new "$p"; init_proj "$tree" "$p" --copy >/dev/null 2>&1
851
+ [ -f "$p/.pi/extensions/team.ts" ] && [ ! -L "$p/.pi/extensions/team.ts" ] \
852
+ && ok "--copy 装的是真文件(不是软链)" || bad "--copy 装的扩展不是文件"
853
+ assert_eq "--copy 的扩展与源逐字节相等" \
854
+ "$(cmp -s "$tree/skills/teamsmith/extension/team.ts" "$p/.pi/extensions/team.ts" && echo same || echo differ)" "same"
855
+ # ④ --no-skills:两个目录都不建
856
+ p="$tmp/x-noskills"; git_new "$p"; init_proj "$tree" "$p" --no-skills >/dev/null 2>&1
857
+ assert_not_file "$p/.pi/skills" "--no-skills 没建 .pi/skills/"
858
+ assert_not_file "$p/.pi/extensions" "--no-skills 也没建 .pi/extensions/"
859
+ assert_eq ".gitignore 没被塞进 .pi/extensions/" "$(grep -cxF '.pi/extensions/' "$p/.gitignore" || true)" "0"
860
+ # ⑤ 冲突表:不带标记的普通文件 —— 拒绝且连 --force 都不删(红线)
861
+ p="$tmp/x-unmarked"; git_new "$p"; init_proj "$tree" "$p" --no-skills >/dev/null 2>&1
862
+ mkdir -p "$p/.pi/extensions"; printf 'not the extension\n' > "$p/.pi/extensions/team.ts"
863
+ check_holds "未标记的普通文件:拒绝且连 --force 都不删" chk_ext_unmarked_survives "$tree" "$p"
864
+ # ⑥ 带标记的漂移副本:默认拒绝、--force 换源
865
+ p="$tmp/x-marked"; git_new "$p"; init_proj "$tree" "$p" --copy >/dev/null 2>&1
866
+ printf '\n// drift\n' >> "$p/.pi/extensions/team.ts"
867
+ check_holds "带标记的漂移副本:默认拒绝、--force 换源" chk_ext_marked_copy_force "$tree" "$p"
868
+ # ⑦ 别源软链:默认拒绝、--force 重指
869
+ p="$tmp/x-foreign"; git_new "$p"; init_proj "$tree" "$p" --no-skills >/dev/null 2>&1
870
+ mkdir -p "$p/.pi/extensions"
871
+ printf '// teamsmith /team extension\n' > "$tmp/foreign-ext.ts"
872
+ ln -s "$tmp/foreign-ext.ts" "$p/.pi/extensions/team.ts"
873
+ check_holds "别源软链:默认拒绝、--force 重指" chk_ext_foreign_link_force "$tree" "$p"
874
+ # ⑧ bootstrap 升级路径(配置已存在、扩展缺席)
875
+ p="$tmp/x-boot"; git_new "$p"; init_proj "$tree" "$p" >/dev/null 2>&1; rm -rf "$p/.pi/extensions"
876
+ check_holds "bootstrap 对已存在的项目装回扩展" chk_bootstrap_installs_ext "$tree" "$p"
613
877
  fi
614
878
 
615
879
  # ---------------------------------------------------------------- flip
@@ -689,6 +953,14 @@ PYPACKF
689
953
  ft="$tmp/f-pack2"; scratch_tree "$ft"; rm -f "$ft/bin/team.mjs"
690
954
  check_holds "⑤b 对照:真实树打包清单齐全" chk_pack_walk "$tree"
691
955
  check_breaks "⑤b 翻转:bin 目标文件不在(package 不完整)" chk_pack_walk "$ft"
956
+ # ⑥ P321:把四个信号入口改回 0.3.0 的软链形状 —— npm 的 tarball 丢掉它们,安装判据必须红
957
+ ft="$tmp/f-pack-symlink"; scratch_tree "$ft"
958
+ for _fs in pkill killall pgrep pidof; do
959
+ rm -f "$ft/skills/teamsmith/scripts/shim/$_fs"
960
+ ln -s signal-gate "$ft/skills/teamsmith/scripts/shim/$_fs"
961
+ done
962
+ check_holds "⑥ 对照:真实树的私有 prefix 安装带四个可执行信号入口" chk_prefix_install "$tree"
963
+ check_breaks "⑥ 翻转:入口退回 0.3.0 的软链形状(npm 的 tarball 不携带软链)" chk_prefix_install "$ft"
692
964
  fi
693
965
  # ⑦ P59:安装步的信任提示行 —— 去掉它 → 判据红;让它在 --no-skills 下出现 → 判据红
694
966
  ft="$tmp/f-trustline"; scratch_tree "$ft"
@@ -711,16 +983,81 @@ PYTRUST
711
983
  import sys
712
984
  p = sys.argv[1]
713
985
  s = open(p, encoding='utf-8').read()
714
- old = " printf ' skip %s(--no-skills:只做配置/文档,没装项目本地 skill)\\n' \"$target\"\n return 0"
986
+ old = " printf ' skip %s 与 %s(--no-skills:只做配置/文档,没装项目本地 skill/扩展)\\n' \\\n \"$target\" \"$(team_project_extension_target)\"\n return 0"
715
987
  if old not in s:
716
988
  print("没找到 --no-skills 分支"); sys.exit(1)
717
- new = old.replace(' return 0', ' team_dim " 提示:.pi/skills/ pi --approve /trust team init --no-skills"\n return 0')
989
+ new = old.replace(' return 0', ' team_dim " 提示:.pi/skills/ 与 .pi/extensions/ pi --approve /trust team init --no-skills"\n return 0')
718
990
  open(p, "w", encoding="utf-8").write(s.replace(old, new, 1))
719
991
  PYTRUST2
720
992
  pg2="$tmp/f-trust-noskills-green"; git_new "$pg2"
721
993
  pf2="$tmp/f-trust-noskills-red"; git_new "$pf2"
722
994
  check_holds "⑦b 对照:真实树 --no-skills 安静" chk_no_skills_silent "$tree" "$pg2"
723
995
  check_breaks "⑦b 翻转:提示行也打进 --no-skills 分支" chk_no_skills_silent "$ft2" "$pf2"
996
+ # ⑦c P299:只删输出行里的 `.pi/extensions/`(其余原样)→ 判据必须红并点名那一行
997
+ ft="$tmp/f-trust-extline"; scratch_tree "$ft"
998
+ python3 - "$ft/skills/teamsmith/scripts/lib/cmd-init.sh" <<'PYTRUSTEXT'
999
+ import sys
1000
+ p = sys.argv[1]
1001
+ s = open(p, encoding='utf-8').read()
1002
+ old = ' team_dim " 提示:.pi/skills/ 与 .pi/extensions/'
1003
+ new = ' team_dim " 提示:.pi/skills/ 与 '
1004
+ if old not in s:
1005
+ print("没找到信任提示行"); sys.exit(1)
1006
+ open(p, "w", encoding="utf-8").write(s.replace(old, new, 1))
1007
+ PYTRUSTEXT
1008
+ pg3="$tmp/f-trust-extline-green"; git_new "$pg3"
1009
+ pf3="$tmp/f-trust-extline-red"; git_new "$pf3"
1010
+ check_holds "⑦c 对照:真实树信任行点名两处资源" chk_trust_hint_case "$tree" "$pg3"
1011
+ check_breaks "⑦c 翻转:信任行删掉 .pi/extensions/" chk_trust_hint_case "$ft" "$pf3"
1012
+ # ⑨ P299:两处 init 文档的稳定 token(场景 3 的红侧:删掉 token → 同一判据红)
1013
+ ft="$tmp/f-docs-skill"; scratch_tree "$ft"
1014
+ python3 - "$ft/skills/teamsmith-init/SKILL.md" <<'PYDOCSKILL'
1015
+ import sys
1016
+ p = sys.argv[1]
1017
+ s = open(p, encoding='utf-8').read()
1018
+ if '.pi/extensions/' not in s:
1019
+ print("SKILL.md 里找不到 .pi/extensions/"); sys.exit(1)
1020
+ open(p, "w", encoding="utf-8").write(s.replace('.pi/extensions/', '', 1))
1021
+ PYDOCSKILL
1022
+ check_holds "⑨a 对照:两处 init 文档的 token 都在" chk_init_docs_fact "$tree"
1023
+ check_breaks "⑨a 翻转:SKILL.md 删掉 .pi/extensions/ token" chk_init_docs_fact "$ft"
1024
+ ft2="$tmp/f-docs-boot"; scratch_tree "$ft2"
1025
+ python3 - "$ft2/skills/teamsmith-init/references/bootstrap.md" <<'PYDOCBOOT'
1026
+ import sys
1027
+ p = sys.argv[1]
1028
+ s = open(p, encoding='utf-8').read()
1029
+ if '/trust' not in s:
1030
+ print("bootstrap.md 里找不到 /trust"); sys.exit(1)
1031
+ open(p, "w", encoding="utf-8").write(s.replace('/trust', '', 1))
1032
+ PYDOCBOOT
1033
+ check_breaks "⑨b 翻转:bootstrap.md 删掉 /trust token" chk_init_docs_fact "$ft2"
1034
+ # ⑧ P270:扩展红线(不带标记的普通文件连 --force 都不删)与 /team 的 doctor 行
1035
+ ft="$tmp/f-ext-refuse"; scratch_tree "$ft"
1036
+ python3 - "$ft/skills/teamsmith/scripts/lib/cmd-init.sh" <<'PYEXT'
1037
+ import sys
1038
+ p = sys.argv[1]
1039
+ s = open(p, encoding='utf-8').read()
1040
+ old = ('team_extension_install_refuse_unknown() { # <dest>:普通文件/目录但没有源的标记行 —— 红线:--force 也不删\n'
1041
+ ' local dest="$1"\n')
1042
+ new = ('team_extension_install_refuse_unknown() { # <dest>:普通文件/目录但没有源的标记行 —— 红线:--force 也不删\n'
1043
+ ' local dest="$1"\n rm -f "$dest"\n')
1044
+ if old not in s:
1045
+ print("没找到扩展红线函数"); sys.exit(1)
1046
+ open(p, "w", encoding="utf-8").write(s.replace(old, new, 1))
1047
+ PYEXT
1048
+ pg="$tmp/f-ext-refuse-green"; git_new "$pg"; init_proj "$tree" "$pg" --no-skills >/dev/null 2>&1
1049
+ mkdir -p "$pg/.pi/extensions"; printf 'not the extension\n' > "$pg/.pi/extensions/team.ts"
1050
+ pf="$tmp/f-ext-refuse-red"; git_new "$pf"; init_proj "$ft" "$pf" --no-skills >/dev/null 2>&1
1051
+ mkdir -p "$pf/.pi/extensions"; printf 'not the extension\n' > "$pf/.pi/extensions/team.ts"
1052
+ check_holds "⑧a 对照:真实树拒绝未标记的扩展文件" chk_ext_unmarked_survives "$tree" "$pg"
1053
+ check_breaks "⑧a 翻转:红线函数改成 rm -f(未标记的文件被删)" chk_ext_unmarked_survives "$ft" "$pf"
1054
+ ft="$tmp/f-ext-doctor"; scratch_tree "$ft"
1055
+ printf '\n# FLIP:把 /team 扩展的 doctor 行静默掉\nteam_project_extension_install_row() { return 0; }\n' \
1056
+ >> "$ft/skills/teamsmith/scripts/lib/cmd-init.sh"
1057
+ pg="$tmp/f-ext-doctor-green"; git_new "$pg"; init_proj "$tree" "$pg" >/dev/null 2>&1; rm -f "$pg/.pi/extensions/team.ts"
1058
+ pf="$tmp/f-ext-doctor-red"; git_new "$pf"; init_proj "$ft" "$pf" >/dev/null 2>&1; rm -f "$pf/.pi/extensions/team.ts"
1059
+ check_holds "⑧b 对照:真实树报扩展缺失" chk_ext_doctor_missing "$tree" "$pg"
1060
+ check_breaks "⑧b 翻转:/team 的 doctor 行被静默" chk_ext_doctor_missing "$ft" "$pf"
724
1061
  # ⑥ 真实树没被夹具动过:git status 指纹前后一致
725
1062
  porcelain_after="$(cd "$tree" && git status --porcelain | sha256sum)"
726
1063
  assert_eq "⑥ 夹具没碰真实树(git status 指纹不变)" "$porcelain_after" "$porcelain_before"
@@ -61,7 +61,8 @@ kr_group_pages() {
61
61
  fixture_up pages "dev2|完整结论与取舍|$b1" "verify|第二份回复|$b2"
62
62
  start_panel || { bad "pages:面板起不来"; return 1; }
63
63
  keys "5"; sleep 0.6
64
- want_frame list5 "pages:第 5 页列表帧(编号/标题/自称发布者)" "#2 第二份回复" "#1 完整结论与取舍" "关键回复"
64
+ want_frame list5 "pages:第 5 页列表帧(编号/标题/发布者标签)" "#2 第二份回复" "#1 完整结论与取舍" "关键回复"
65
+ assert_has "$tmp/$current/list5.txt" "「这条回复是写给谁的?」" "pages:第 5 页说明行带着判据的自测题(删整行或只删自测题都会红)"
65
66
  assert_has "$tmp/$current/list5.txt" "个编号槽位" "pages:列表带编号槽位计数"
66
67
  assert_has "$tmp/$current/list5.txt" "更早" "pages:Older 控件可见"
67
68
  ev_save "$tmp/$current/list5.txt" "pty-pages-list5.txt"
@@ -112,15 +113,14 @@ PYT
112
113
  case "$kinds" in *page*) ok "overview:总览带页面目标(含第 5 页)" ;; *) bad "overview:总览没有页面目标(kinds=$kinds)" ;; esac
113
114
  "${clean_env[@]}" node "$panel" --root "$ROOT" --team-cli "$team_cli" --snapshot --page 1 \
114
115
  --width 120 --height 28 --lang zh 2>/dev/null | sed -e 's/\x1b\[[0-9;]*m//g' >"$tmp/ov-snap.txt"
115
- assert_has "$tmp/ov-snap.txt" "最新关键回复" "overview:总览摘要行带标题标签"
116
116
  assert_has "$tmp/ov-snap.txt" "#1 总览入口标题" "overview:总览摘要行显示最新编号与标题"
117
- assert_has "$tmp/ov-snap.txt" "dev2" "overview:总览摘要行显示自称发布者"
117
+ assert_has "$tmp/ov-snap.txt" "dev2" "overview:总览摘要行显示发布者标签"
118
118
  start_panel || { bad "overview:面板起不来"; return 1; }
119
119
  want_frame ov_pane "overview:面板总览上的摘要行" "#1 总览入口标题" "最新关键回复"
120
120
  keys "5"; sleep 0.6
121
121
  want_frame ov_page5 "overview:按 5 到第 5 页最新列表" "#1 总览入口标题" "个编号槽位"
122
122
  keys Enter; sleep 0.6
123
- want_frame ov_body "overview:列表上 Enter 用同一正文视窗打开" "总览入口回复" "只读 · 发布者自称,未经核验"
123
+ want_frame ov_body "overview:列表上 Enter 用同一正文视窗打开" "总览入口回复" "只读 · 按发布的原文显示"
124
124
  ev_save "$tmp/$current/ov_pane.txt" "pty-overview-summary.txt"
125
125
  }
126
126
 
@@ -145,7 +145,7 @@ kr_group_list() {
145
145
  sleep 0.4
146
146
  want_frame focus_last "list:连续 ↓ 把焦点移到最旧的 #1(末端夹住,光标在 #1 行)" "› #1 第 1 号"
147
147
  keys Enter; sleep 0.8
148
- want_frame first_body "list:打开最旧的 #1,全文可读" "#1 关键回复" "批量回复正文" "只读 · 发布者自称"
148
+ want_frame first_body "list:打开最旧的 #1,全文可读" "#1 关键回复" "批量回复正文" "只读 · 按发布的原文显示"
149
149
  keys "q"; sleep 0.6
150
150
  want_frame back_ctx "list:q 返回列表且仍是同一页与同一焦点" "› #1 第 1 号"
151
151
  keys Right; sleep 1.2
@@ -163,7 +163,7 @@ kr_group_body() {
163
163
  fixture_up body "dev2|长正文|$long"
164
164
  start_panel || { bad "body:面板起不来"; return 1; }
165
165
  keys "5"; sleep 0.6; keys Enter; sleep 0.8
166
- want_frame top "body:视窗打开在文首" "长正文" "自称来自 dev2"
166
+ want_frame top "body:视窗打开在文首" "长正文" "来自 dev2"
167
167
  assert_not "$tmp/$current/top.txt" "END-MARKER-P234" "body:打开时不在结尾(长文不是一次铺满)"
168
168
  keys End; sleep 0.6
169
169
  want_frame end "body:End 到结尾,END-MARKER 可见" "END-MARKER-P234"
@@ -217,7 +217,7 @@ kr_group_mouse() {
217
217
  --hint "#38 鼠标 38 号" --out "$tmp/m-open.bin" >"$tmp/m-open.log" 2>&1
218
218
  rc=$?
219
219
  if [ "$rc" = "0" ]; then ok "mouse:第二点注入成功"; else bad "mouse:第二点注入失败(rc=$rc)"; fi
220
- want_frame m_open "mouse:再点同一行打开该号正文(第二次点击才是打开)" "鼠标夹具正文" "只读 · 发布者自称" "#38 关键回复"
220
+ want_frame m_open "mouse:再点同一行打开该号正文(第二次点击才是打开)" "鼠标夹具正文" "只读 · 按发布的原文显示" "#38 关键回复"
221
221
  # Back 芯片:单击返回
222
222
  python3 "$SELF_DIR/panel-b3-pty-tmux-mouse.py" --sock "$sock" --session "$sess" --pane "$sess:panel" \
223
223
  --hint "返回" --out "$tmp/m-back.bin" >"$tmp/m-back.log" 2>&1
@@ -281,8 +281,7 @@ kr_group_language() {
281
281
  printf 'lang=en\n' >"$state/panel.conf"
282
282
  start_panel || { bad "language:面板起不来"; return 1; }
283
283
  keys "5"; sleep 0.6
284
- want_frame en "language:en 表下第 5 页标签与路由完整" "key replies" "Older" "Older"
285
- assert_has "$tmp/$current/en.txt" "numbered slots" "language:en 表下槽位计数文案"
284
+ want_frame en "language:en 表下第 5 页标签与路由完整(含说明行的自测题)" "key replies" "Older" "Older" '"who is this reply written for?"'
286
285
  printf 'lang=zh\n' >"$state/panel.conf"
287
286
  start_panel || bad "language:重启失败"
288
287
  keys "5"; sleep 0.6
@@ -312,7 +311,7 @@ kr_group_async() {
312
311
  # ③ 打开正文 → 一个带编号的 body 调用
313
312
  reset_argv
314
313
  keys Enter; sleep 1.2
315
- want_frame body "async:正文视窗渲染" "只读 · 发布者自称"
314
+ want_frame body "async:正文视窗渲染" "只读 · 按发布的原文显示"
316
315
  assert_match "$(kr_argv)" 'reply_body.*--no [0-9]+' "async:body 调用带要读的编号"
317
316
  # ④ 返回 → 不再请求 body;离开第 5 页 → list/body 都不再请求
318
317
  reset_argv
@@ -57,7 +57,6 @@ kr_group_blocks() {
57
57
  kr_panel_snapshot 1 --width 120 --height 28 --lang zh >"$tmp/bl-ov.txt"
58
58
  assert_eq "blocks:--page 1 快照里 list 调用为 0" "$(block_calls reply_list)" "0"
59
59
  assert_eq "blocks:--page 1 快照里 body 调用为 0" "$(block_calls reply_body)" "0"
60
- assert_has "$tmp/bl-ov.txt" "最新关键回复" "blocks:总览摘要行渲染(默认语言)"
61
60
  # ② 第 5 页:list 恰好一次且带 newest 形态;body 仍为 0
62
61
  reset_argv
63
62
  kr_panel_snapshot 5 --width 120 --height 28 --lang zh >"$tmp/bl-list.txt"
@@ -81,7 +80,8 @@ kr_group_blocks() {
81
80
  t0="$(date +%s)"
82
81
  kr_panel_snapshot 5 --width 120 --height 28 --lang zh >"$tmp/bl-slow.txt"
83
82
  t1="$(date +%s)"
84
- if [ $((t1 - t0)) -le 20 ]; then ok "blocks:慢 list 在超时界内返回($((t1 - t0))s ≤ 20s)"; else bad "blocks:慢 list 拖过了超时界($((t1 - t0))s)"; fi
83
+ # P316:不判耗时;超时杀块的行为由下一行「慢 list 只降级本块」守。
84
+ printf ' \033[2m· 参考 blocks:慢 list 快照用时 %ss(不判快慢)\033[0m\n' "$((t1 - t0))"
85
85
  assert_has "$tmp/bl-slow.txt" "更早" "blocks:慢 list 只降级本块(页面的导航/其它内容仍在)"
86
86
  kr_shim_set_slow -
87
87
  # ⑥ 输出泛滥:块 stdout 超过上限 → 该块判失败而不是把巨量内容塞进帧
@@ -94,7 +94,6 @@ FLOOD
94
94
  "${clean_env[@]}" node "$panel" --root "$ROOT" \
95
95
  --team-cli "$tmp/$current/bin/flood-team" --snapshot --page 1 --width 120 --height 24 --lang zh \
96
96
  | sed -e 's/\x1b\[[0-9;]*m//g' >"$tmp/bl-flood.txt" 2>/dev/null
97
- assert_has "$tmp/bl-flood.txt" "最新关键回复" "blocks:泛滥源只让摘要行降级,帧仍然渲染"
98
97
  ev_save "$tmp/bl-flood.txt" "ui-blocks-flood.txt"
99
98
  }
100
99
 
@@ -182,10 +181,8 @@ PYW
182
181
  # 状态:summary 行 / 空 store / 坏 store / cursor 续页 / 长文视窗
183
182
  kr_panel_snapshot 1 --width 160 --height 30 --lang zh >"$tmp/snap-summary.txt"
184
183
  assert_has "$tmp/snap-summary.txt" "#60 槽位 58" "snapshots:总览摘要显示最新编号与标题"
185
- assert_has "$tmp/snap-summary.txt" "最新关键回复" "snapshots:总览摘要标题标签"
186
184
  kr_panel_snapshot 5 --reply-before 10 --width 120 --height 24 --lang zh >"$tmp/snap-cont.txt"
187
185
  assert_has "$tmp/snap-cont.txt" "#1 " "snapshots:更旧页 cursor 到达 #1"
188
- assert_has "$tmp/snap-cont.txt" "个编号槽位" "snapshots:更旧页仍带槽位计数"
189
186
  kr_panel_snapshot 5 --reply-no 2 --width 120 --height 24 --lang zh >"$tmp/snap-view.txt"
190
187
  assert_has "$tmp/snap-view.txt" "长文快照" "snapshots:长文视窗渲染标题"
191
188
  local KR="$state/key-replies" size
@@ -195,9 +192,6 @@ PYW
195
192
  assert_has "$tmp/snap-corrupt.txt" "不可用" "snapshots:坏槽位在快照里是不可用行"
196
193
  mv "$KR" "$tmp/store-parked"
197
194
  kr_panel_snapshot 5 --width 99 --height 20 --lang zh >"$tmp/snap-empty.txt"
198
- assert_has "$tmp/snap-empty.txt" "(还没有关键回复)" "snapshots:空 store 是显式空状态"
199
- assert_has "$tmp/snap-empty.txt" "关键回复" "snapshots:空 store 时页面身份仍在"
200
- assert_not "$tmp/snap-empty.txt" "个编号槽位" "snapshots:空 store 不伪装成有槽位"
201
195
  mv "$tmp/store-parked" "$KR"
202
196
  # 半截帧守卫:一次性写出器(`--snapshot`/`--print`/`--json`)走的是同步 raw fd 写,
203
197
  # fd 1 是管道时可能只写进去一部分——每个快照都必须是完整 UTF-8 且以换行结尾。