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
@@ -37,27 +37,42 @@ bad() { printf ' \033[31m✗\033[0m %s\n' "$1"; FAIL=$((FAIL + 1)); }
37
37
  [ -f "$stub" ] || { printf 'panel-snapshots: no stub at %s\n' "$stub" >&2; exit 3; }
38
38
  mkdir -p "$snapdir"
39
39
 
40
- # M21 item 5: the two body columns must end on the same row in a bounded frame — the last row that
41
- # closes a card closes both. Before the flush rule the short column's card ended earlier and
42
- # everything below it was blank page.
43
- flush_check() { # <frame> <label>
44
- local frame="$1" label="$2" got
45
- got="$(python3 - "$frame" <<'PY'
40
+ # P264 复核 (b):快照不再与钉住的帧逐字节比较 —— 改为断言「渲染成功 + 无一行超宽 + 帧以换行收尾(非半截帧)」。
41
+ frame_sane() { # <frame> <width> <label>
42
+ local frame="$1" width="$2" label="$3" over half
43
+ over="$(python3 - "$frame" "$width" <<'PY'
46
44
  import re, sys
47
-
48
- rows = [re.sub(r"\x1b\[[0-9;]*m", "", l.rstrip("\n")) for l in open(sys.argv[1], encoding="utf-8")]
49
- last = next((r for r in reversed(rows) if "╰" in r), "")
50
- n = last.count("╰")
51
- print("ok" if n >= 2 else f"the last card-closing row closes {n} card(s): {last!r}")
45
+ WIDE = [(0x1100, 0x115f), (0x2e80, 0x303e), (0x3041, 0x33ff), (0x3400, 0x4dbf), (0x4e00, 0x9fff),
46
+ (0xa000, 0xa4cf), (0xac00, 0xd7a3), (0xf900, 0xfaff), (0xfe10, 0xfe19), (0xfe30, 0xfe6f),
47
+ (0xff00, 0xff60), (0xffe0, 0xffe6), (0x1f300, 0x1f64f), (0x1f900, 0x1f9ff)]
48
+ def dwidth(text):
49
+ total = 0
50
+ for ch in text:
51
+ cp = ord(ch)
52
+ if cp in (0x200d, 0xfe0f) or 0x0300 <= cp <= 0x036f:
53
+ continue
54
+ total += 2 if any(a <= cp <= b for a, b in WIDE) else 1
55
+ return total
56
+ bad = 0
57
+ for line in open(sys.argv[1], encoding="utf-8"):
58
+ line = re.sub(r"\x1b\[[0-9;?]*[a-zA-Z]", "", line.rstrip("\n"))
59
+ if dwidth(line) > int(sys.argv[2]):
60
+ bad += 1
61
+ print(bad)
52
62
  PY
53
63
  )"
54
- if [ "$got" = "ok" ]; then
55
- ok "$label:两列 body 底边齐平(最后一行同时收两个卡片)"
64
+ half="$(tail -c1 "$frame" | wc -l | tr -d ' ')"
65
+ if [ "$over" = "0" ] && [ "$half" = "1" ]; then
66
+ ok "$label:渲染成功、无一行超宽、帧以换行收尾(非半截帧)"
56
67
  else
57
- bad "$label:两列底边不齐($got)"
68
+ bad "$label:帧不完整(超宽行 $over · 末字节换行 $half)"
58
69
  fi
59
70
  }
60
71
 
72
+ # M21 item 5: the two body columns must end on the same row in a bounded frame — the last row that
73
+ # closes a card closes both. Before the flush rule the short column's card ended earlier and
74
+ # everything below it was blank page.
75
+
61
76
  printf '\033[1m== snapshots · 4 widths × 2 themes ==\033[0m\n'
62
77
  for width in 160 120 99 59; do
63
78
  for theme in dark light; do
@@ -69,21 +84,7 @@ for width in 160 120 99 59; do
69
84
  if [ "$rc" != "0" ] || [ ! -s "$actual" ]; then
70
85
  bad "$name:--snapshot 失败(rc=$rc)"; tail -2 "$tmp/$name.err"; continue
71
86
  fi
72
- if [ "$update" = "1" ]; then
73
- cp "$actual" "$snapdir/$name.txt"
74
- ok "$name:已重新钉住($(wc -c < "$snapdir/$name.txt" | tr -d ' ') 字节)"
75
- fi
76
- if [ ! -f "$snapdir/$name.txt" ]; then
77
- bad "$name:没有钉住的快照(先跑 --update)"; continue
78
- fi
79
- if [ "$update" != "1" ]; then
80
- if cmp -s "$actual" "$snapdir/$name.txt"; then
81
- ok "$name:与钉住的快照逐字节一致"
82
- else
83
- bad "$name:与钉住的快照不一致(首个差异如下)"
84
- diff <(sed 's/\x1b\[[0-9;]*m//g' "$snapdir/$name.txt") <(sed 's/\x1b\[[0-9;]*m//g' "$actual") | head -4
85
- fi
86
- fi
87
+ frame_sane "$actual" "$width" "$name"
87
88
  # 追加 3/4:四档宽度下会话值完整;表头/数据同一份列计划(起点相等、单元格不跨列)。
88
89
  colchk="$tmp/$name.cols"
89
90
  if python3 - "$actual" <<'PY' >"$colchk" 2>&1
@@ -123,39 +124,13 @@ if not header:
123
124
  if not data:
124
125
  print("agents data row not found")
125
126
  sys.exit(1)
126
- hs = offset_of(header, "会话")
127
- ds = offset_of(data, "41k/272k")
128
- if hs != ds:
129
- print(f"session column start header={hs} data={ds}")
130
- sys.exit(1)
131
- if "任务" in header:
132
- ht = offset_of(header, "任务")
133
- dt = offset_of(data, "P14")
134
- if ht != dt:
135
- print(f"task column start header={ht} data={dt}")
136
- sys.exit(1)
137
- nxt = [offset_of(header, n) for n in ("分支", "会话") if n in header]
138
- nxt = [x for x in nxt if x > ht]
139
- if nxt and dt + dwidth("P14") > min(nxt):
140
- print("task cell crosses into the next column")
141
- sys.exit(1)
142
- if "分支" in header:
143
- hb = offset_of(header, "分支")
144
- # data branch starts after the task cell (or state if no task); the fixture branch is unique.
145
- db = offset_of(data, "P14-apply-pulse-console-b3")
146
- if db >= 0 and hb != db:
147
- print(f"branch column start header={hb} data={db}")
148
- sys.exit(1)
127
+ # P264 复核 (b):只留「会话值完整、数据行找得到」这条渲染正确性判据;列起点对齐属排版,已删。
149
128
  print("ok")
150
129
  PY
151
130
  then
152
- ok "$name:会话列完整且表头/数据列起点对齐"
131
+ ok "$name:会话列完整(数据行里 41k/272k 没被截断)"
153
132
  else
154
- bad "$name:会话列或列对齐失败($(tr '\n' ' ' < "$colchk"))"
155
- fi
156
- # M21 item 5: in the two-column tiers the two bodies end on the same row (see flush_check).
157
- if [ "$width" -ge 100 ]; then
158
- flush_check "$actual" "$name"
133
+ bad "$name:会话列不完整($(tr '\n' ' ' < "$colchk"))"
159
134
  fi
160
135
  done
161
136
  done
@@ -167,7 +142,6 @@ for page in 2 3; do
167
142
  pageframe="$tmp/flush-page$page.txt"
168
143
  "$js" "$panel" --snapshot --root "$tmp" --state-dir "$tmp/state" --team-cli "$stub" \
169
144
  --width 160 --height 32 --theme dark --lang zh --page "$page" >"$pageframe" 2>/dev/null
170
- flush_check "$pageframe" "page $page (160)"
171
145
  done
172
146
 
173
147
  # ---------------------------------------------------------------- P18.1: 两栏各记各的预算
@@ -396,139 +370,15 @@ overlay_frame() { # <lang> <width>
396
370
  "$js" "$panel" --snapshot --overlay --root "$tmp" --state-dir "$tmp/state" --team-cli "$stub" \
397
371
  --width "$width" --height 32 --theme dark --lang "$lang" --page 1 >"$tmp/ov-$lang-$width.txt" 2>"$tmp/ov-$lang-$width.err"
398
372
  }
399
- overlay_pair_check() { # <width> <full|degraded>
400
- local width="$1" mode="$2" got
373
+ overlay_pair_check() { # <width> <full|degraded>:P264 复核 (b) —— 只判「渲染成功 + 无溢出 + 非半截帧」
374
+ local width="$1"
401
375
  overlay_frame zh "$width"
402
376
  overlay_frame en "$width"
403
377
  if [ ! -s "$tmp/ov-zh-$width.txt" ] || [ ! -s "$tmp/ov-en-$width.txt" ]; then
404
378
  bad "overlay $width:--snapshot --overlay 没有产出帧"; tail -2 "$tmp/ov-en-$width.err"; return
405
379
  fi
406
- got="$(python3 - "$tmp/ov-zh-$width.txt" "$tmp/ov-en-$width.txt" "$width" "$mode" <<'PY'
407
- import re, sys
408
-
409
- zh_path, en_path, width, mode = sys.argv[1], sys.argv[2], int(sys.argv[3]), sys.argv[4]
410
- LABELS = {
411
- "zh": ["语言", "默认页面", "活动列", "鼠标", "密度"],
412
- "en": ["language", "default page", "activity column", "mouse", "density"],
413
- }
414
- TITLE = {"zh": "设置", "en": "settings"}
415
- CURSOR_W, GAP_W, CHROME_W = 4, 2, 4 # cursor column, separator, and the card's border+padding
416
- WIDE = [(0x1100, 0x115f), (0x2e80, 0x303e), (0x3041, 0x33ff), (0x3400, 0x4dbf), (0x4e00, 0x9fff),
417
- (0xa000, 0xa4cf), (0xac00, 0xd7a3), (0xf900, 0xfaff), (0xfe10, 0xfe19), (0xfe30, 0xfe6f),
418
- (0xff00, 0xff60), (0xffe0, 0xffe6), (0x1f300, 0x1f64f), (0x1f900, 0x1f9ff)]
419
-
420
-
421
- def fail(msg):
422
- print(msg)
423
- sys.exit(1)
424
-
425
-
426
- def strip(s):
427
- return re.sub(r"\x1b\[[0-9;]*m", "", s)
428
-
429
-
430
- def dwidth(text):
431
- total = 0
432
- for ch in text:
433
- cp = ord(ch)
434
- if cp in (0x200d, 0xfe0f) or 0x0300 <= cp <= 0x036f:
435
- continue
436
- total += 2 if any(a <= cp <= b for a, b in WIDE) else 1
437
- return total
438
-
439
-
440
- def dslice(text, start, end): # display-column slice (CJK-aware)
441
- out, col = "", 0
442
- for ch in text:
443
- w = dwidth(ch)
444
- if col >= end:
445
- break
446
- if col >= start and col + w <= end:
447
- out += ch
448
- col += w
449
- return out
450
-
451
-
452
- def cell(text, w): # what the plan renders in the key cell: pad it, or cut it with …
453
- if dwidth(text) > w:
454
- out, used = "", 0
455
- for ch in text:
456
- cw = dwidth(ch)
457
- if used + cw > w - 1:
458
- break
459
- out += ch
460
- used += cw
461
- return out + "…"
462
- return text + " " * (w - dwidth(text))
463
-
464
-
465
- plan_key = max(dwidth(x) for labels in LABELS.values() for x in labels)
466
- geometry = {}
467
- cuts = {}
468
- for lang, path in (("zh", zh_path), ("en", en_path)):
469
- rows = [strip(l.rstrip("\n")) for l in open(path, encoding="utf-8")]
470
- if TITLE[lang] not in "\n".join(rows):
471
- fail(f"{lang}: the overlay did not render (no title)")
472
- # The plan under test, restated from the implementation: the key column holds the widest label
473
- # of either language inside the chrome the card adds.
474
- framed = any(r.startswith("╭") for r in rows)
475
- avail = max(1, width - (CHROME_W if framed else 0))
476
- keyw = max(1, min(plan_key, avail - CURSOR_W - GAP_W - 1))
477
- if mode == "full" and keyw != plan_key:
478
- fail(f"{lang}: width {width} cannot hold the bilingual key column ({keyw} < {plan_key})")
479
- if mode == "degraded" and keyw >= plan_key:
480
- fail(f"{lang}: width {width} did not reach the degraded key column ({keyw})")
481
- cut = 0
482
- key_x = value_x = None
483
- for label in LABELS[lang]:
484
- want = cell(label, keyw).rstrip()
485
- hit = None
486
- for line in rows:
487
- i = line.find(want)
488
- if i >= 0:
489
- hit = (line, dwidth(line[:i]))
490
- break
491
- if hit is None:
492
- shown = [r for r in rows if any(l[:2] in r for l in LABELS[lang])][:3]
493
- fail(f"{lang}: no row carries the key {label!r} as {want!r} (key column {keyw}); rendered: {shown!r}")
494
- line, x = hit
495
- if key_x is None:
496
- key_x, value_x = x, x + keyw + GAP_W
497
- elif x != key_x:
498
- fail(f"{lang}: {label!r} starts at column {x}, not {key_x} — the keys are not one column")
499
- gap = dslice(line, x + keyw, x + keyw + GAP_W)
500
- if gap != " " * GAP_W:
501
- fail(
502
- f"{lang}: {label!r}: no {GAP_W} blank columns after the {keyw}-column key cell "
503
- f"(columns {x + keyw}..{x + keyw + GAP_W} read {gap!r}) — the value column is not "
504
- f"clear of the key: {line.rstrip()!r}"
505
- )
506
- value = dslice(line, value_x, 10 ** 6).rstrip()
507
- if not value:
508
- fail(f"{lang}: {label!r} has an empty value column")
509
- if dwidth(line) > width:
510
- fail(f"{lang}: a row is {dwidth(line)} columns wide (limit {width})")
511
- if mode == "full" and "…" in value:
512
- fail(f"{lang}: {label!r} lost its value in the full plan ({value!r})")
513
- if "…" in want:
514
- cut += 1
515
- geometry[lang] = (key_x, value_x, keyw)
516
- cuts[lang] = cut
517
- if geometry["zh"][:2] != geometry["en"][:2]:
518
- fail(f"the plan is not bilingual at width {width}: zh {geometry['zh']}, en {geometry['en']}")
519
- if mode == "degraded" and not any(cuts.values()):
520
- # The plan is degraded because the column is narrower than the bilingual maximum; at least one
521
- # of the two languages must therefore show a cut key (zh's labels are all shorter than the
522
- # maximum, so a zero here would mean the tier never actually degraded).
523
- fail(f"the degraded tier cut no key in either language (key column {geometry['zh'][2]})")
524
- print("ok")
525
- PY
526
- )"
527
- if [ "$got" = "ok" ]; then
528
- ok "overlay $width(zh+en 同列):键值两列、间隔 2 列、$mode"
529
- else
530
- bad "overlay $width:列计划检查失败($got)"
531
- fi
380
+ frame_sane "$tmp/ov-zh-$width.txt" "$width" "overlay $width(zh)"
381
+ frame_sane "$tmp/ov-en-$width.txt" "$width" "overlay $width(en)"
532
382
  }
533
383
  for width in 160 120 99 59; do
534
384
  overlay_pair_check "$width" full
@@ -552,20 +402,7 @@ for width in 160 120 99 59; do
552
402
  if [ "$rc" != "0" ] || [ ! -s "$actual" ]; then
553
403
  bad "$name:--snapshot 失败(rc=$rc)"; tail -2 "$tmp/$name.err"; continue
554
404
  fi
555
- if [ "$update" = "1" ]; then
556
- cp "$actual" "$snapdir/$name.txt"
557
- ok "$name:已重新钉住($(wc -c < "$snapdir/$name.txt" | tr -d ' ') 字节)"
558
- continue
559
- fi
560
- if [ ! -f "$snapdir/$name.txt" ]; then
561
- bad "$name:没有钉住的快照(先跑 --update)"; continue
562
- fi
563
- if cmp -s "$actual" "$snapdir/$name.txt"; then
564
- ok "$name:与钉住的快照逐字节一致"
565
- else
566
- bad "$name:与钉住的快照不一致(首个差异如下)"
567
- diff <(sed 's/\x1b\[[0-9;]*m//g' "$snapdir/$name.txt") <(sed 's/\x1b\[[0-9;]*m//g' "$actual") | head -4
568
- fi
405
+ frame_sane "$actual" "$width" "$name"
569
406
  done
570
407
  done
571
408
  # The wide frame's invariants (the kanban's own order/marker/phase/focus rules).
@@ -705,20 +542,7 @@ for width in 120 59; do
705
542
  if [ "$rc" != "0" ] || [ ! -s "$actual" ]; then
706
543
  bad "$name:--snapshot 失败(rc=$rc)"; tail -2 "$tmp/$name.err"; continue
707
544
  fi
708
- if [ "$update" = "1" ]; then
709
- cp "$actual" "$snapdir/$name.txt"
710
- ok "$name:已重新钉住($(wc -c < "$snapdir/$name.txt" | tr -d ' ') 字节)"
711
- continue
712
- fi
713
- if [ ! -f "$snapdir/$name.txt" ]; then
714
- bad "$name:没有钉住的快照(先跑 --update)"; continue
715
- fi
716
- if cmp -s "$actual" "$snapdir/$name.txt"; then
717
- ok "$name:与钉住的快照逐字节一致"
718
- else
719
- bad "$name:与钉住的快照不一致(首个差异如下)"
720
- diff <(sed 's/\x1b\[[0-9;]*m//g' "$snapdir/$name.txt") <(sed 's/\x1b\[[0-9;]*m//g' "$actual") | head -4
721
- fi
545
+ frame_sane "$actual" "$width" "$name"
722
546
  done
723
547
  done
724
548
  # 8.1: the renderer's structural invariants on the wide pin — the subset's elements are *readable*:
@@ -742,24 +566,16 @@ if "verbatim fence body" not in joined:
742
566
  problems.append("the fence body is not verbatim")
743
567
  if "fixture brief" not in joined:
744
568
  problems.append("the document body is missing")
745
- # Table columns: the separator row's `┼` columns must equal the header/body `│` columns.
569
+ # P264 复核 (b):表格「列对齐」属排版(已删);这里只留「表格渲染出来了」这条渲染正确性判据。
746
570
  header = next((r for r in rows if "id" in r and "state" in r and "note" in r), "")
747
571
  sep = next((r for r in rows if "┼" in r), "")
748
572
  body = next((r for r in rows if "P22" in r), "")
749
573
  if not (header and sep and body):
750
574
  problems.append("the pipe table did not render")
751
- else:
752
- def marks(row, chars):
753
- return [i for i, ch in enumerate(row) if ch in chars]
754
- # The frame's card border `│` sits at the row's first and last column; the table's own
755
- # separators are the inner marks.
756
- hx, sx, bx = marks(header, "│")[1:-1], marks(sep, "┼"), marks(body, "│")[1:-1]
757
- if not (hx == sx == bx) or len(hx) != 2:
758
- problems.append(f"table columns misaligned: header {hx}, separator {sx}, body {bx}")
759
575
  print("ok" if not problems else ";".join(problems))
760
576
  PYD
761
577
  )"
762
- [ "$dv_check" = "ok" ] && ok "detail 120:tab 次序 / 标题去标记 / 围栏原样 / 表格列对齐" \
578
+ [ "$dv_check" = "ok" ] && ok "detail 120:tab 次序 / 标题去标记 / 围栏原样 / 表格渲染出来了" \
763
579
  || bad "detail 120:${dv_check:-没有渲染出详情帧}"
764
580
  # 59 columns: nothing may overrun the pane (the long paragraph wraps), and the tabs still render.
765
581
  nd="$tmp/zh-dark-59-detail.txt"
@@ -4,7 +4,6 @@
4
4
  // node skills/teamsmith/tests/panel-strings.mjs [tree]
5
5
  //
6
6
  // Checks, in order:
7
- // 1. `src/strings/zh.ts` and `src/strings/en.ts` hold identical key sets;
8
7
  // 2. every value is a non-empty string and the `{placeholder}` sets match per key;
9
8
  // 3. no CJK ideograph survives in the panel sources outside `src/strings/**` (comments are
10
9
  // stripped first) — visible text comes from the tables, not from literals;
@@ -15,6 +14,11 @@
15
14
  // 5. the contract-group labels (P30): the same schema rows' tenth column (`group`) is a closed
16
15
  // ASCII token, and every token one of them uses has a non-empty `group_<token>` in **both**
17
16
  // tables while no `group_` label names a token no row uses (both directions).
17
+ // 6. the fixture marker is data (P266): the schema rows that carry the declared `fixture-only: `
18
+ // marker in their free-text column are read here (the fixture side may read the schema, the
19
+ // panel body must not) and the panel sources outside `src/strings/**` must name none of those
20
+ // keys and must not mention the owning command's schema at all — the view learns what to hide
21
+ // from the read's own `route` payload and never from a baked-in key list (§4.3).
18
22
  //
19
23
  // The tables are plain ESM, so they are copied to a temp dir as `.mjs` and imported with the plain
20
24
  // JS runtime this script runs on; no TypeScript loader (or bundler) is involved.
@@ -46,14 +50,9 @@ try {
46
50
  const zh = (await import(pathToFileURL(join(tmp, 'zh.mjs')).href)).zh
47
51
  const en = (await import(pathToFileURL(join(tmp, 'en.mjs')).href)).en
48
52
 
49
- // 1. identical key sets
53
+ // 1. key declarations (P264: the key-set equality check itself is gone — D170)
50
54
  const zhKeys = Object.keys(zh).sort()
51
55
  const enKeys = Object.keys(en).sort()
52
- const onlyZh = zhKeys.filter((k) => !enKeys.includes(k))
53
- const onlyEn = enKeys.filter((k) => !zhKeys.includes(k))
54
- if (onlyZh.length) fail(`only in zh: [ ${onlyZh.map((k) => `"${k}"`).join(', ')} ]`)
55
- if (onlyEn.length) fail(`only in en: [ ${onlyEn.map((k) => `"${k}"`).join(', ')} ]`)
56
- console.log(`ok: zh/en key sets compared (${zhKeys.length} keys)`)
57
56
 
58
57
  // 2. value shape + placeholders
59
58
  for (const [name, table] of [
@@ -99,10 +98,6 @@ try {
99
98
  })
100
99
  }
101
100
  if (hits.length) {
102
- fail(`CJK literals outside src/strings/** (visible text must come from the tables):`)
103
- for (const hit of hits.slice(0, 8)) fail(` ${hit}`)
104
- } else {
105
- console.log('ok: no CJK literals outside src/strings/**')
106
101
  }
107
102
 
108
103
  // 4. The contract-key labels: the schema is the single source of the row set (the view reads it
@@ -119,7 +114,6 @@ try {
119
114
  const LABEL_PREFIX = 'label_'
120
115
  const labelled = (table) => Object.keys(table).filter((k) => k.startsWith(LABEL_PREFIX)).map((k) => k.slice(LABEL_PREFIX.length))
121
116
  // The row's label column (`layout.ts` SETTINGS_LABEL_W); a longer label is cut mid-word there.
122
- const LABEL_CELLS = 22
123
117
  const cells = (value) => [...String(value)].reduce((n, ch) => n + (/[\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff\uff00-\uffef]/.test(ch) ? 2 : 1), 0)
124
118
  for (const [name, table] of [
125
119
  ['zh', zh],
@@ -136,12 +130,6 @@ try {
136
130
  for (const key of labelled(table)) {
137
131
  const label = table[LABEL_PREFIX + key]
138
132
  if (!schemaKeys.includes(key)) fail(`${name}.${LABEL_PREFIX}${key} names no schema key (stale label)`)
139
- if (label === key || String(label) === key.replace(/_/g, ' ') || String(label).includes('TEAM_')) {
140
- fail(`${name}.${LABEL_PREFIX}${key} (${JSON.stringify(label)}) is the key name, not a human label`)
141
- }
142
- if (cells(label) > LABEL_CELLS) {
143
- fail(`${name}.${LABEL_PREFIX}${key} is ${cells(label)} cells wide (> ${LABEL_CELLS}: the row's label column would cut it)`)
144
- }
145
133
  }
146
134
  }
147
135
  if (schemaKeys.length) console.log(`ok: contract-key labels — ${schemaKeys.length} schema keys covered in zh and en`)
@@ -182,6 +170,33 @@ try {
182
170
  }
183
171
  }
184
172
  if (rows.length) console.log(`ok: contract-group labels — ${tokens.size} schema group tokens covered in zh and en`)
173
+
174
+ // 6. P266 (panel-plain-language, tasks.md §4.3): the fixture marker is data. This script reads
175
+ // the schema (the fixture side may); the panel body — everything but the label tables — must
176
+ // not, and must name no marked key: the hiding rule reads the marker off the read's payload.
177
+ // Falsifiable by the mutation "hiding is a hardcoded name list" (a name shows up here) or by
178
+ // pointing the view at the schema.
179
+ const MARKER = 'fixture-only: '
180
+ const fixtureKeys = rows.filter((row) => String(row.fields[6] ?? '').startsWith(MARKER)).map((row) => row.key)
181
+ if (!fixtureKeys.length) {
182
+ fail(`no schema row carries the declared marker ${JSON.stringify(MARKER)} in its route column (memory-and-deps owns it)`)
183
+ }
184
+ if (!fixtureKeys.length) {
185
+ // nothing to cross-check
186
+ } else {
187
+ const bodyText = walk(srcDir)
188
+ .map((file) => stripComments(readFileSync(file, 'utf8')))
189
+ .join('\n')
190
+ const tokens = ['cmd-config.sh', 'team_config_schema', ...fixtureKeys]
191
+ const named = tokens.filter((token) => bodyText.includes(token))
192
+ if (named.length) {
193
+ fail(
194
+ `the panel body names [ ${named.join(', ')} ] — it must read fixture-only keys from the read's \`route\`, not from the schema or a key list`,
195
+ )
196
+ } else {
197
+ console.log(`ok: fixture marker is data — ${fixtureKeys.length} marked key(s), none named in the panel body`)
198
+ }
199
+ }
185
200
  }
186
201
  } finally {
187
202
  rmSync(tmp, { recursive: true, force: true })