teamsmith 0.0.0-stage → 0.1.2

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 (245) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +158 -2
  3. package/bin/team.mjs +59 -0
  4. package/install.sh +94 -0
  5. package/package.json +37 -4
  6. package/skills/teamsmith/CHANGELOG.md +763 -0
  7. package/skills/teamsmith/SKILL.md +312 -0
  8. package/skills/teamsmith/extension/team-bg.ts +435 -0
  9. package/skills/teamsmith/extension/team-inbox-watch.ts +1412 -0
  10. package/skills/teamsmith/extension/team-notify.ts +663 -0
  11. package/skills/teamsmith/references/agent-adapters.md +643 -0
  12. package/skills/teamsmith/references/config.md +477 -0
  13. package/skills/teamsmith/references/meeting.md +124 -0
  14. package/skills/teamsmith/references/memory.md +133 -0
  15. package/skills/teamsmith/references/migration.md +227 -0
  16. package/skills/teamsmith/references/openspec.md +222 -0
  17. package/skills/teamsmith/references/philosophy.md +95 -0
  18. package/skills/teamsmith/references/protocol.md +712 -0
  19. package/skills/teamsmith/references/troubleshooting.md +1384 -0
  20. package/skills/teamsmith/references/workflows.md +448 -0
  21. package/skills/teamsmith/scripts/lib/cmd-agents.sh +1709 -0
  22. package/skills/teamsmith/scripts/lib/cmd-bg.sh +284 -0
  23. package/skills/teamsmith/scripts/lib/cmd-bootstrap.sh +311 -0
  24. package/skills/teamsmith/scripts/lib/cmd-config.sh +1156 -0
  25. package/skills/teamsmith/scripts/lib/cmd-death.sh +562 -0
  26. package/skills/teamsmith/scripts/lib/cmd-docs.sh +149 -0
  27. package/skills/teamsmith/scripts/lib/cmd-draft.sh +124 -0
  28. package/skills/teamsmith/scripts/lib/cmd-init.sh +212 -0
  29. package/skills/teamsmith/scripts/lib/cmd-meeting.sh +904 -0
  30. package/skills/teamsmith/scripts/lib/cmd-outbox.sh +196 -0
  31. package/skills/teamsmith/scripts/lib/cmd-project.sh +642 -0
  32. package/skills/teamsmith/scripts/lib/cmd-review.sh +1393 -0
  33. package/skills/teamsmith/scripts/lib/cmd-status.sh +1399 -0
  34. package/skills/teamsmith/scripts/lib/cmd-update.sh +191 -0
  35. package/skills/teamsmith/scripts/lib/cmd-watch.sh +1681 -0
  36. package/skills/teamsmith/scripts/lib/common.sh +4964 -0
  37. package/skills/teamsmith/scripts/lib/draft-entry.sh +51 -0
  38. package/skills/teamsmith/scripts/lib/outbox.sh +2042 -0
  39. package/skills/teamsmith/scripts/lib/tmux-argv.sh +165 -0
  40. package/skills/teamsmith/scripts/monitor.mjs +616 -0
  41. package/skills/teamsmith/scripts/panel/README.md +192 -0
  42. package/skills/teamsmith/scripts/panel/build.sh +47 -0
  43. package/skills/teamsmith/scripts/panel/bun.lock +109 -0
  44. package/skills/teamsmith/scripts/panel/draft-send.sh +68 -0
  45. package/skills/teamsmith/scripts/panel/package.json +24 -0
  46. package/skills/teamsmith/scripts/panel/panel.js +388 -0
  47. package/skills/teamsmith/scripts/panel/src/App.tsx +2150 -0
  48. package/skills/teamsmith/scripts/panel/src/clipboard.ts +154 -0
  49. package/skills/teamsmith/scripts/panel/src/compose.ts +691 -0
  50. package/skills/teamsmith/scripts/panel/src/data.ts +555 -0
  51. package/skills/teamsmith/scripts/panel/src/format.ts +50 -0
  52. package/skills/teamsmith/scripts/panel/src/layout.ts +2562 -0
  53. package/skills/teamsmith/scripts/panel/src/main.tsx +894 -0
  54. package/skills/teamsmith/scripts/panel/src/markdown.ts +340 -0
  55. package/skills/teamsmith/scripts/panel/src/sanitize.ts +42 -0
  56. package/skills/teamsmith/scripts/panel/src/settings.ts +154 -0
  57. package/skills/teamsmith/scripts/panel/src/strings/en.ts +416 -0
  58. package/skills/teamsmith/scripts/panel/src/strings/index.ts +65 -0
  59. package/skills/teamsmith/scripts/panel/src/strings/types.ts +9 -0
  60. package/skills/teamsmith/scripts/panel/src/strings/zh.ts +414 -0
  61. package/skills/teamsmith/scripts/panel/src/theme.ts +116 -0
  62. package/skills/teamsmith/scripts/panel/src/types.ts +652 -0
  63. package/skills/teamsmith/scripts/panel/src/width.ts +105 -0
  64. package/skills/teamsmith/scripts/panel/tsconfig.json +16 -0
  65. package/skills/teamsmith/scripts/shim/signal-gate +156 -0
  66. package/skills/teamsmith/scripts/shim/tmux +403 -0
  67. package/skills/teamsmith/scripts/team +143 -0
  68. package/skills/teamsmith/templates/AGENTS.section.md.tmpl +147 -0
  69. package/skills/teamsmith/templates/BOARD.md.tmpl +18 -0
  70. package/skills/teamsmith/templates/DECISIONS.md.tmpl +22 -0
  71. package/skills/teamsmith/templates/OWNERSHIP.md.tmpl +25 -0
  72. package/skills/teamsmith/templates/PROTOCOL.md.tmpl +84 -0
  73. package/skills/teamsmith/templates/ROADMAP.md.tmpl +29 -0
  74. package/skills/teamsmith/templates/config.sh.tmpl +106 -0
  75. package/skills/teamsmith/templates/memory-seed.md.tmpl +46 -0
  76. package/skills/teamsmith/templates/pm-prompt.md.tmpl +110 -0
  77. package/skills/teamsmith/templates/report.md.tmpl +36 -0
  78. package/skills/teamsmith/templates/task.md.tmpl +65 -0
  79. package/skills/teamsmith/templates/threads-README.md +17 -0
  80. package/skills/teamsmith/tests/bg-ledger-harness.mjs +682 -0
  81. package/skills/teamsmith/tests/bg-ledger.sh +307 -0
  82. package/skills/teamsmith/tests/checkout-shape-probe.sh +800 -0
  83. package/skills/teamsmith/tests/config-cli.sh +1562 -0
  84. package/skills/teamsmith/tests/container-tmux.sh +493 -0
  85. package/skills/teamsmith/tests/coverage-inventory.sh +173 -0
  86. package/skills/teamsmith/tests/death-cause.sh +564 -0
  87. package/skills/teamsmith/tests/delivery-truth.sh +1231 -0
  88. package/skills/teamsmith/tests/fake-tui.py +450 -0
  89. package/skills/teamsmith/tests/fixtures/delivery-truth-real/README.md +60 -0
  90. package/skills/teamsmith/tests/fixtures/delivery-truth-real/judge-second.py +139 -0
  91. package/skills/teamsmith/tests/fixtures/delivery-truth-real/mock-server.py +29 -0
  92. package/skills/teamsmith/tests/fixtures/delivery-truth-real/observe.ts +20 -0
  93. package/skills/teamsmith/tests/fixtures/delivery-truth-real/run-case.sh +79 -0
  94. package/skills/teamsmith/tests/fixtures/delivery-truth-real/scenario.sh +175 -0
  95. package/skills/teamsmith/tests/fixtures/p55/flip-p49.sh +229 -0
  96. package/skills/teamsmith/tests/fixtures/p71-incident/README.md +22 -0
  97. package/skills/teamsmith/tests/fixtures/p71-incident/dev2.seen +8 -0
  98. package/skills/teamsmith/tests/fixtures/p71-incident/dev2.wake +9 -0
  99. package/skills/teamsmith/tests/fixtures/p71-incident/pm-nudges.wake +3 -0
  100. package/skills/teamsmith/tests/fixtures/signal-lint-cases.txt +40 -0
  101. package/skills/teamsmith/tests/flip-glue.sh +162 -0
  102. package/skills/teamsmith/tests/flip-m12-26c.sh +129 -0
  103. package/skills/teamsmith/tests/flip-m12.sh +185 -0
  104. package/skills/teamsmith/tests/flip-m16.sh +166 -0
  105. package/skills/teamsmith/tests/flip-m17.sh +204 -0
  106. package/skills/teamsmith/tests/flip-m33.sh +284 -0
  107. package/skills/teamsmith/tests/flip-m34.sh +96 -0
  108. package/skills/teamsmith/tests/flip-m37.sh +185 -0
  109. package/skills/teamsmith/tests/flip-m4.3.sh +375 -0
  110. package/skills/teamsmith/tests/flip-m43.sh +128 -0
  111. package/skills/teamsmith/tests/flip-m44.sh +262 -0
  112. package/skills/teamsmith/tests/flip-m45.sh +244 -0
  113. package/skills/teamsmith/tests/flip-m46.sh +238 -0
  114. package/skills/teamsmith/tests/flip-m48.sh +304 -0
  115. package/skills/teamsmith/tests/flip-m6.2.sh +205 -0
  116. package/skills/teamsmith/tests/flip-m6.3.sh +283 -0
  117. package/skills/teamsmith/tests/flip-m6.4.sh +267 -0
  118. package/skills/teamsmith/tests/flip-m6.5.sh +113 -0
  119. package/skills/teamsmith/tests/flip-m7.1.sh +135 -0
  120. package/skills/teamsmith/tests/flip-m7.2.sh +321 -0
  121. package/skills/teamsmith/tests/flip-p144.sh +112 -0
  122. package/skills/teamsmith/tests/flip-p156.sh +133 -0
  123. package/skills/teamsmith/tests/flip-p158.sh +301 -0
  124. package/skills/teamsmith/tests/flip-p160.sh +182 -0
  125. package/skills/teamsmith/tests/flip-p171.sh +249 -0
  126. package/skills/teamsmith/tests/flip-p18.1.sh +95 -0
  127. package/skills/teamsmith/tests/flip-p20.sh +286 -0
  128. package/skills/teamsmith/tests/flip-p201.sh +249 -0
  129. package/skills/teamsmith/tests/flip-p210.sh +239 -0
  130. package/skills/teamsmith/tests/flip-p211.sh +152 -0
  131. package/skills/teamsmith/tests/flip-p217.sh +288 -0
  132. package/skills/teamsmith/tests/flip-p22.sh +123 -0
  133. package/skills/teamsmith/tests/flip-p23.sh +239 -0
  134. package/skills/teamsmith/tests/flip-p25.sh +165 -0
  135. package/skills/teamsmith/tests/flip-p71.sh +184 -0
  136. package/skills/teamsmith/tests/flip-p72.sh +202 -0
  137. package/skills/teamsmith/tests/frames/README.md +176 -0
  138. package/skills/teamsmith/tests/frames/p78-conversation-rule-below-box.txt +6 -0
  139. package/skills/teamsmith/tests/frames/p78-cursor-mid-draft.txt +6 -0
  140. package/skills/teamsmith/tests/frames/p78-draft-rule-below-cursor-line.txt +6 -0
  141. package/skills/teamsmith/tests/frames/p78-draft-rule-below-cursor.txt +6 -0
  142. package/skills/teamsmith/tests/frames/p78-draft-rule-blank-region.txt +6 -0
  143. package/skills/teamsmith/tests/frames/p78-draft-rule-only.txt +5 -0
  144. package/skills/teamsmith/tests/frames/p78-spinner-row-below-cursor.txt +6 -0
  145. package/skills/teamsmith/tests/frames/p78-wider-rule-below-cursor.txt +6 -0
  146. package/skills/teamsmith/tests/frames/p86-f1-mixed-width-disjoint-box.txt +8 -0
  147. package/skills/teamsmith/tests/frames/p86-f1-narrower-width-disjoint-box.txt +8 -0
  148. package/skills/teamsmith/tests/frames/p86-f1-spinner-top-disjoint-box.txt +8 -0
  149. package/skills/teamsmith/tests/frames/pi-0.85.1-update-banner.txt +30 -0
  150. package/skills/teamsmith/tests/frames/pi-0.87.0-draft-half-sentence.txt +30 -0
  151. package/skills/teamsmith/tests/frames/pi-0.87.0-empty-box.txt +30 -0
  152. package/skills/teamsmith/tests/frames/pi-0.87.0-one-line-draft.txt +30 -0
  153. package/skills/teamsmith/tests/frames/pi-0.87.0-project-trust-prompt.txt +30 -0
  154. package/skills/teamsmith/tests/frames/pi-0.99.2-empty-editor.txt +32 -0
  155. package/skills/teamsmith/tests/frames/pi-0.99.2-human-draft.txt +32 -0
  156. package/skills/teamsmith/tests/frames/pi-1.0.0-git-error-in-box.txt +32 -0
  157. package/skills/teamsmith/tests/gate-guard.sh +112 -0
  158. package/skills/teamsmith/tests/guard-matrix.sh +233 -0
  159. package/skills/teamsmith/tests/install-shape.sh +731 -0
  160. package/skills/teamsmith/tests/ledger-ban.sh +612 -0
  161. package/skills/teamsmith/tests/lib/box-judge.sh +68 -0
  162. package/skills/teamsmith/tests/lib/checkout-shape.sh +129 -0
  163. package/skills/teamsmith/tests/lib/loop-scan.awk +114 -0
  164. package/skills/teamsmith/tests/lib/pty-wait.sh +676 -0
  165. package/skills/teamsmith/tests/lib/section-guard.sh +855 -0
  166. package/skills/teamsmith/tests/lib/shell-lex.pl +261 -0
  167. package/skills/teamsmith/tests/lib/tmp-root.sh +528 -0
  168. package/skills/teamsmith/tests/lib/tmux-cap.sh +35 -0
  169. package/skills/teamsmith/tests/lib/tmux-iso-call-probe.sh +81 -0
  170. package/skills/teamsmith/tests/lib/tmux-iso-probe.sh +46 -0
  171. package/skills/teamsmith/tests/lib/tmux-iso.sh +381 -0
  172. package/skills/teamsmith/tests/load-experiment.sh +290 -0
  173. package/skills/teamsmith/tests/loop-inventory.tsv +84 -0
  174. package/skills/teamsmith/tests/panel-b2-slow-stub.sh +19 -0
  175. package/skills/teamsmith/tests/panel-b2.sh +1183 -0
  176. package/skills/teamsmith/tests/panel-b3-pty-mouse.py +240 -0
  177. package/skills/teamsmith/tests/panel-b3-pty-tmux-mouse.py +138 -0
  178. package/skills/teamsmith/tests/panel-b3-stub.sh +279 -0
  179. package/skills/teamsmith/tests/panel-b3.sh +1301 -0
  180. package/skills/teamsmith/tests/panel-choices.sh +572 -0
  181. package/skills/teamsmith/tests/panel-clipboard-model.ts +187 -0
  182. package/skills/teamsmith/tests/panel-compose-model.ts +290 -0
  183. package/skills/teamsmith/tests/panel-contrast.mjs +81 -0
  184. package/skills/teamsmith/tests/panel-cpu-premise.sh +173 -0
  185. package/skills/teamsmith/tests/panel-cpu.sh +391 -0
  186. package/skills/teamsmith/tests/panel-flip-m54.sh +207 -0
  187. package/skills/teamsmith/tests/panel-flip-p123.sh +278 -0
  188. package/skills/teamsmith/tests/panel-flip-p125.sh +318 -0
  189. package/skills/teamsmith/tests/panel-flip-p128.sh +259 -0
  190. package/skills/teamsmith/tests/panel-keyprobe-pty.py +99 -0
  191. package/skills/teamsmith/tests/panel-keyprobe-stub.sh +41 -0
  192. package/skills/teamsmith/tests/panel-keyprobe.sh +82 -0
  193. package/skills/teamsmith/tests/panel-keyprobe.tsx +116 -0
  194. package/skills/teamsmith/tests/panel-knobs.sh +83 -0
  195. package/skills/teamsmith/tests/panel-p21.sh +2181 -0
  196. package/skills/teamsmith/tests/panel-snapshots.sh +802 -0
  197. package/skills/teamsmith/tests/panel-strings.mjs +195 -0
  198. package/skills/teamsmith/tests/perf.sh +740 -0
  199. package/skills/teamsmith/tests/pm-box-real.sh +350 -0
  200. package/skills/teamsmith/tests/pulse-nudge-key.sh +563 -0
  201. package/skills/teamsmith/tests/routes.sh +1652 -0
  202. package/skills/teamsmith/tests/section-budgets.tsv +150 -0
  203. package/skills/teamsmith/tests/section-guard.sh +231 -0
  204. package/skills/teamsmith/tests/section-needs-audit.sh +94 -0
  205. package/skills/teamsmith/tests/section-paths.tsv +142 -0
  206. package/skills/teamsmith/tests/section-select.sh +655 -0
  207. package/skills/teamsmith/tests/signal-gate.sh +366 -0
  208. package/skills/teamsmith/tests/signal-lint-legacy.txt +14 -0
  209. package/skills/teamsmith/tests/signal-lint.pl +416 -0
  210. package/skills/teamsmith/tests/skill-load.mjs +65 -0
  211. package/skills/teamsmith/tests/smoke.sh +19711 -0
  212. package/skills/teamsmith/tests/snapshots/zh-dark-120-detail.txt +32 -0
  213. package/skills/teamsmith/tests/snapshots/zh-dark-120-p4.txt +32 -0
  214. package/skills/teamsmith/tests/snapshots/zh-dark-120.txt +32 -0
  215. package/skills/teamsmith/tests/snapshots/zh-dark-160-p4.txt +32 -0
  216. package/skills/teamsmith/tests/snapshots/zh-dark-160.txt +32 -0
  217. package/skills/teamsmith/tests/snapshots/zh-dark-59-detail.txt +32 -0
  218. package/skills/teamsmith/tests/snapshots/zh-dark-59-p4.txt +32 -0
  219. package/skills/teamsmith/tests/snapshots/zh-dark-59.txt +32 -0
  220. package/skills/teamsmith/tests/snapshots/zh-dark-99-p4.txt +32 -0
  221. package/skills/teamsmith/tests/snapshots/zh-dark-99.txt +32 -0
  222. package/skills/teamsmith/tests/snapshots/zh-light-120-detail.txt +32 -0
  223. package/skills/teamsmith/tests/snapshots/zh-light-120-p4.txt +32 -0
  224. package/skills/teamsmith/tests/snapshots/zh-light-120.txt +32 -0
  225. package/skills/teamsmith/tests/snapshots/zh-light-160-p4.txt +32 -0
  226. package/skills/teamsmith/tests/snapshots/zh-light-160.txt +32 -0
  227. package/skills/teamsmith/tests/snapshots/zh-light-59-detail.txt +32 -0
  228. package/skills/teamsmith/tests/snapshots/zh-light-59-p4.txt +32 -0
  229. package/skills/teamsmith/tests/snapshots/zh-light-59.txt +32 -0
  230. package/skills/teamsmith/tests/snapshots/zh-light-99-p4.txt +32 -0
  231. package/skills/teamsmith/tests/snapshots/zh-light-99.txt +32 -0
  232. package/skills/teamsmith/tests/spec-ledger-refs.tsv +78 -0
  233. package/skills/teamsmith/tests/spec-refs.sh +826 -0
  234. package/skills/teamsmith/tests/task-header-model.sh +267 -0
  235. package/skills/teamsmith/tests/team-bg-flip.sh +239 -0
  236. package/skills/teamsmith/tests/team-bg-harness.mjs +392 -0
  237. package/skills/teamsmith/tests/team-bg-stop.sh +434 -0
  238. package/skills/teamsmith/tests/team-inbox-watch-flip.sh +191 -0
  239. package/skills/teamsmith/tests/team-inbox-watch-harness.mjs +1559 -0
  240. package/skills/teamsmith/tests/tmp-hygiene.sh +1190 -0
  241. package/skills/teamsmith/tests/tmux-lint-legacy.txt +31 -0
  242. package/skills/teamsmith/tests/tmux-lint.pl +604 -0
  243. package/skills/teamsmith-init/SKILL.md +100 -0
  244. package/skills/teamsmith-init/references/bootstrap.md +74 -0
  245. package/skills/teamsmith-init/templates/bootstrap-prompt.md.tmpl +46 -0
@@ -0,0 +1,195 @@
1
+ #!/usr/bin/env node
2
+ // String-table gate for the pulse console (pulse-console B3, tasks.md 6.1).
3
+ //
4
+ // node skills/teamsmith/tests/panel-strings.mjs [tree]
5
+ //
6
+ // Checks, in order:
7
+ // 1. `src/strings/zh.ts` and `src/strings/en.ts` hold identical key sets;
8
+ // 2. every value is a non-empty string and the `{placeholder}` sets match per key;
9
+ // 3. no CJK ideograph survives in the panel sources outside `src/strings/**` (comments are
10
+ // stripped first) — visible text comes from the tables, not from literals;
11
+ // 4. the contract-key labels (M49): every key of the owning command's schema
12
+ // (`skills/teamsmith/scripts/lib/cmd-config.sh`) has a non-empty `label_<KEY>` in **both**
13
+ // tables, no label names a key the schema does not carry (no stale half), the label is not
14
+ // the key spelled differently, and it fits the row's label column.
15
+ // 5. the contract-group labels (P30): the same schema rows' tenth column (`group`) is a closed
16
+ // ASCII token, and every token one of them uses has a non-empty `group_<token>` in **both**
17
+ // tables while no `group_` label names a token no row uses (both directions).
18
+ //
19
+ // The tables are plain ESM, so they are copied to a temp dir as `.mjs` and imported with the plain
20
+ // JS runtime this script runs on; no TypeScript loader (or bundler) is involved.
21
+ //
22
+ // Exit: 0 all three checks pass, 1 at least one failed (the message names the key/file).
23
+
24
+ import { copyFileSync, existsSync, mkdtempSync, readFileSync, readdirSync, rmSync, statSync } from 'node:fs'
25
+ import { tmpdir } from 'node:os'
26
+ import { dirname, join, relative } from 'node:path'
27
+ import { pathToFileURL } from 'node:url'
28
+
29
+ const tree = process.argv[2] || process.cwd()
30
+ const srcDir = join(tree, 'skills/teamsmith/scripts/panel/src')
31
+ const stringsDir = join(srcDir, 'strings')
32
+
33
+ const failures = []
34
+ const fail = (message) => failures.push(message)
35
+ const placeholders = (value) => {
36
+ const set = new Set()
37
+ for (const m of String(value).matchAll(/\{(\w+)\}/g)) set.add(m[1])
38
+ return [...set].sort()
39
+ }
40
+
41
+ const tmp = mkdtempSync(join(tmpdir(), 'panel-strings-'))
42
+ try {
43
+ for (const file of ['zh.ts', 'en.ts']) {
44
+ copyFileSync(join(stringsDir, file), join(tmp, file.replace(/\.ts$/, '.mjs')))
45
+ }
46
+ const zh = (await import(pathToFileURL(join(tmp, 'zh.mjs')).href)).zh
47
+ const en = (await import(pathToFileURL(join(tmp, 'en.mjs')).href)).en
48
+
49
+ // 1. identical key sets
50
+ const zhKeys = Object.keys(zh).sort()
51
+ 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
+
58
+ // 2. value shape + placeholders
59
+ for (const [name, table] of [
60
+ ['zh', zh],
61
+ ['en', en],
62
+ ]) {
63
+ for (const key of Object.keys(table)) {
64
+ const value = table[key]
65
+ if (typeof value !== 'string' || value.length === 0) fail(`${name}.${key} is not a non-empty string`)
66
+ }
67
+ }
68
+ for (const key of zhKeys.filter((k) => enKeys.includes(k))) {
69
+ const a = placeholders(zh[key])
70
+ const b = placeholders(en[key])
71
+ if (a.join(',') !== b.join(',')) fail(`${key}: placeholder mismatch zh={${a.join(',')}} en={${b.join(',')}}`)
72
+ }
73
+ console.log('ok: values are non-empty strings with matching placeholders')
74
+
75
+ // 3. no CJK outside the tables (comments stripped: the sources document in prose)
76
+ const CJK = /[\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff]/
77
+ const stripComments = (text) =>
78
+ text
79
+ .replace(/\/\*[\s\S]*?\*\//g, '')
80
+ .split('\n')
81
+ .map((line) => line.replace(/\/\/.*$/, ''))
82
+ .join('\n')
83
+ const walk = (dir) => {
84
+ const out = []
85
+ for (const entry of readdirSync(dir)) {
86
+ const full = join(dir, entry)
87
+ if (statSync(full).isDirectory()) {
88
+ if (full === stringsDir) continue
89
+ out.push(...walk(full))
90
+ } else if (/\.(ts|tsx|js|jsx)$/.test(entry)) out.push(full)
91
+ }
92
+ return out
93
+ }
94
+ const hits = []
95
+ for (const file of walk(srcDir)) {
96
+ const lines = stripComments(readFileSync(file, 'utf8')).split('\n')
97
+ lines.forEach((line, i) => {
98
+ if (CJK.test(line)) hits.push(`${relative(tree, file)}:${i + 1}: ${line.trim()}`)
99
+ })
100
+ }
101
+ 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
+ }
107
+
108
+ // 4. The contract-key labels: the schema is the single source of the row set (the view reads it
109
+ // at render time), the labels are the row's human identity — so the two must line up exactly,
110
+ // in both directions. The assertion is falsifiable by deleting one label (a missing key) or by
111
+ // leaving one behind after the schema drops a key (a stale label).
112
+ const schemaFile = join(tree, 'skills/teamsmith/scripts/lib/cmd-config.sh')
113
+ if (!existsSync(schemaFile)) {
114
+ console.log(`skip: ${relative(tree, schemaFile)} is not in this tree (schema-label check not run)`)
115
+ } else {
116
+ const schemaBody = /^team_config_schema\(\)\s*\{[\s\S]*?\nEOF\n/m.exec(readFileSync(schemaFile, 'utf8'))
117
+ const schemaKeys = schemaBody ? [...schemaBody[0].matchAll(/^(TEAM_[A-Z0-9_]+)\|/gm)].map((m) => m[1]) : []
118
+ if (!schemaKeys.length) fail(`${relative(tree, schemaFile)}: no schema key parsed from team_config_schema()`)
119
+ const LABEL_PREFIX = 'label_'
120
+ const labelled = (table) => Object.keys(table).filter((k) => k.startsWith(LABEL_PREFIX)).map((k) => k.slice(LABEL_PREFIX.length))
121
+ // The row's label column (`layout.ts` SETTINGS_LABEL_W); a longer label is cut mid-word there.
122
+ const LABEL_CELLS = 22
123
+ const cells = (value) => [...String(value)].reduce((n, ch) => n + (/[\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff\uff00-\uffef]/.test(ch) ? 2 : 1), 0)
124
+ for (const [name, table] of [
125
+ ['zh', zh],
126
+ ['en', en],
127
+ ]) {
128
+ const have = new Set(labelled(table))
129
+ const missing = schemaKeys.filter((k) => !have.has(k))
130
+ if (missing.length) fail(`${name}: no label for schema key(s) [ ${missing.join(', ')} ]`)
131
+ }
132
+ for (const [name, table] of [
133
+ ['zh', zh],
134
+ ['en', en],
135
+ ]) {
136
+ for (const key of labelled(table)) {
137
+ const label = table[LABEL_PREFIX + key]
138
+ 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
+ }
146
+ }
147
+ if (schemaKeys.length) console.log(`ok: contract-key labels — ${schemaKeys.length} schema keys covered in zh and en`)
148
+
149
+ // P30/D2: the functional-group bijection. The schema row's tenth column is the only place a
150
+ // group token is declared; the visible heading is `group_<token>` in the tables. Both
151
+ // directions are failures: a row token with no label (the tables lag the schema) and a label
152
+ // no row uses (a stale group). The token's shape is asserted here too, so a malformed tenth
153
+ // field is red in the fast gate as well as in config-cli.sh's groups walk.
154
+ const GROUP_PREFIX = 'group_'
155
+ const GROUP_SHAPE = /^[a-z][a-z0-9-]*$/
156
+ const rows = [...(schemaBody ? schemaBody[0].matchAll(/^(TEAM_[A-Z0-9_]+)\|(.+)$/gm) : [])].map((m) => ({
157
+ key: m[1],
158
+ // Everything after the key: class|kind|spec|form|default|danger|route|suggest|group — the
159
+ // tenth column is this array's ninth element (index 8).
160
+ fields: m[2].split('|'),
161
+ }))
162
+ const tokens = new Set()
163
+ for (const row of rows) {
164
+ const token = String(row.fields[8] ?? '')
165
+ if (!token) {
166
+ fail(`${row.key}: schema row declares no group (its tenth field is missing) — the tables' group labels cannot line up`)
167
+ continue
168
+ }
169
+ if (!GROUP_SHAPE.test(token)) fail(`${row.key}: group token ${JSON.stringify(token)} does not match ^[a-z][a-z0-9-]*$`)
170
+ tokens.add(token)
171
+ }
172
+ for (const [name, table] of [
173
+ ['zh', zh],
174
+ ['en', en],
175
+ ]) {
176
+ for (const token of [...tokens].sort()) {
177
+ const value = table[GROUP_PREFIX + token]
178
+ if (typeof value !== 'string' || value.length === 0) fail(`${name}: no ${GROUP_PREFIX}${token} label for the group the schema rows carry`)
179
+ }
180
+ for (const key of Object.keys(table).filter((k) => k.startsWith(GROUP_PREFIX))) {
181
+ if (!tokens.has(key.slice(GROUP_PREFIX.length))) fail(`${name}.${key} names no group any schema row uses (stale label)`)
182
+ }
183
+ }
184
+ if (rows.length) console.log(`ok: contract-group labels — ${tokens.size} schema group tokens covered in zh and en`)
185
+ }
186
+ } finally {
187
+ rmSync(tmp, { recursive: true, force: true })
188
+ }
189
+
190
+ if (failures.length) {
191
+ console.error('✗ panel-strings failed:')
192
+ for (const message of failures) console.error(` ${message}`)
193
+ process.exit(1)
194
+ }
195
+ console.log('panel-strings: ok')