teamsmith 0.1.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/README.md +13 -7
  2. package/package.json +1 -1
  3. package/skills/teamsmith/CHANGELOG.md +67 -0
  4. package/skills/teamsmith/SKILL.md +26 -8
  5. package/skills/teamsmith/extension/team-notify.ts +37 -6
  6. package/skills/teamsmith/extension/team.ts +438 -0
  7. package/skills/teamsmith/references/agent-adapters.md +7 -7
  8. package/skills/teamsmith/references/config.md +65 -18
  9. package/skills/teamsmith/references/migration.md +220 -34
  10. package/skills/teamsmith/references/protocol.md +250 -25
  11. package/skills/teamsmith/references/troubleshooting.md +124 -7
  12. package/skills/teamsmith/references/workflows.md +66 -20
  13. package/skills/teamsmith/scripts/lib/cmd-agents.sh +525 -90
  14. package/skills/teamsmith/scripts/lib/cmd-bootstrap.sh +71 -10
  15. package/skills/teamsmith/scripts/lib/cmd-config.sh +562 -128
  16. package/skills/teamsmith/scripts/lib/cmd-death.sh +2 -15
  17. package/skills/teamsmith/scripts/lib/cmd-docs.sh +6 -3
  18. package/skills/teamsmith/scripts/lib/cmd-draft.sh +4 -4
  19. package/skills/teamsmith/scripts/lib/cmd-help.sh +677 -0
  20. package/skills/teamsmith/scripts/lib/cmd-init.sh +157 -5
  21. package/skills/teamsmith/scripts/lib/cmd-interrupt.sh +461 -0
  22. package/skills/teamsmith/scripts/lib/cmd-meeting.sh +2 -25
  23. package/skills/teamsmith/scripts/lib/cmd-project.sh +149 -105
  24. package/skills/teamsmith/scripts/lib/cmd-reap.sh +277 -0
  25. package/skills/teamsmith/scripts/lib/cmd-reply.sh +96 -0
  26. package/skills/teamsmith/scripts/lib/cmd-review.sh +188 -40
  27. package/skills/teamsmith/scripts/lib/cmd-status.sh +268 -30
  28. package/skills/teamsmith/scripts/lib/cmd-update.sh +36 -7
  29. package/skills/teamsmith/scripts/lib/cmd-watch.sh +634 -54
  30. package/skills/teamsmith/scripts/lib/common.sh +1560 -109
  31. package/skills/teamsmith/scripts/lib/gate-lock.sh +544 -0
  32. package/skills/teamsmith/scripts/monitor.mjs +34 -3
  33. package/skills/teamsmith/scripts/panel/README.md +22 -11
  34. package/skills/teamsmith/scripts/panel/draft-send.sh +11 -1
  35. package/skills/teamsmith/scripts/panel/panel.js +226 -224
  36. package/skills/teamsmith/scripts/panel/src/App.tsx +478 -184
  37. package/skills/teamsmith/scripts/panel/src/clipboard.ts +11 -5
  38. package/skills/teamsmith/scripts/panel/src/compose.ts +6 -3
  39. package/skills/teamsmith/scripts/panel/src/data.ts +95 -7
  40. package/skills/teamsmith/scripts/panel/src/layout.ts +703 -152
  41. package/skills/teamsmith/scripts/panel/src/main.tsx +129 -19
  42. package/skills/teamsmith/scripts/panel/src/settings.ts +1 -1
  43. package/skills/teamsmith/scripts/panel/src/strings/en.ts +76 -31
  44. package/skills/teamsmith/scripts/panel/src/strings/zh.ts +78 -33
  45. package/skills/teamsmith/scripts/panel/src/types.ts +204 -17
  46. package/skills/teamsmith/scripts/replies.mjs +896 -0
  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 +20 -6
  52. package/skills/teamsmith/templates/AGENTS.section.md.tmpl +23 -3
  53. package/skills/teamsmith/templates/BOARD.md.tmpl +2 -2
  54. package/skills/teamsmith/templates/OWNERSHIP.md.tmpl +7 -3
  55. package/skills/teamsmith/templates/PROTOCOL.md.tmpl +17 -0
  56. package/skills/teamsmith/templates/config.sh.tmpl +29 -5
  57. package/skills/teamsmith/templates/memory-seed.md.tmpl +3 -0
  58. package/skills/teamsmith/templates/pm-prompt.md.tmpl +41 -1
  59. package/skills/teamsmith/templates/report.md.tmpl +12 -0
  60. package/skills/teamsmith/templates/task.md.tmpl +4 -0
  61. package/skills/teamsmith/tests/bg-ledger-harness.mjs +464 -40
  62. package/skills/teamsmith/tests/bg-ledger.sh +168 -10
  63. package/skills/teamsmith/tests/checkout-shape-probe.sh +3 -1
  64. package/skills/teamsmith/tests/config-cli.sh +320 -300
  65. package/skills/teamsmith/tests/death-cause.sh +5 -2
  66. package/skills/teamsmith/tests/fixtures/delivery-truth-real/scenario.sh +7 -1
  67. package/skills/teamsmith/tests/fixtures/p287/lint-good.sh.in +3 -0
  68. package/skills/teamsmith/tests/fixtures/p287/lint-hardcoded.sh.in +3 -0
  69. package/skills/teamsmith/tests/fixtures/p287/lint-no-ns.sh.in +3 -0
  70. package/skills/teamsmith/tests/fixtures/p55/flip-p49.sh +18 -6
  71. package/skills/teamsmith/tests/flip-m33.sh +5 -3
  72. package/skills/teamsmith/tests/flip-m37.sh +4 -1
  73. package/skills/teamsmith/tests/flip-m4.3.sh +4 -1
  74. package/skills/teamsmith/tests/flip-m6.3.sh +4 -1
  75. package/skills/teamsmith/tests/flip-m6.5.sh +4 -1
  76. package/skills/teamsmith/tests/flip-m7.2.sh +4 -1
  77. package/skills/teamsmith/tests/flip-p158.sh +2 -1
  78. package/skills/teamsmith/tests/flip-p210.sh +4 -1
  79. package/skills/teamsmith/tests/flip-p217.sh +4 -1
  80. package/skills/teamsmith/tests/flip-p287-lock.sh +342 -0
  81. package/skills/teamsmith/tests/flip-p287-name.sh +279 -0
  82. package/skills/teamsmith/tests/flip-p304-read-side.sh +98 -0
  83. package/skills/teamsmith/tests/flip-p308-skip-not-pass.sh +151 -0
  84. package/skills/teamsmith/tests/flip-p309-p162-deep.sh +122 -0
  85. package/skills/teamsmith/tests/flip-p310-lock.sh +216 -0
  86. package/skills/teamsmith/tests/flip-p310-socket.sh +125 -0
  87. package/skills/teamsmith/tests/help-surface.sh +1664 -0
  88. package/skills/teamsmith/tests/install-shape.sh +283 -22
  89. package/skills/teamsmith/tests/key-replies-pty.sh +374 -0
  90. package/skills/teamsmith/tests/key-replies-ui.sh +325 -0
  91. package/skills/teamsmith/tests/key-replies.sh +1314 -0
  92. package/skills/teamsmith/tests/ledger-ban.sh +9 -8
  93. package/skills/teamsmith/tests/ledger-claim.sh +248 -0
  94. package/skills/teamsmith/tests/lib/bounded-spin.sh +90 -0
  95. package/skills/teamsmith/tests/lib/model-policy.sh +30 -0
  96. package/skills/teamsmith/tests/lib/model-routing-boundary.sh +420 -0
  97. package/skills/teamsmith/tests/lib/model-routing-expansion.sh +155 -0
  98. package/skills/teamsmith/tests/lib/model-routing-flips.py +187 -0
  99. package/skills/teamsmith/tests/lib/model-routing-roles.sh +250 -0
  100. package/skills/teamsmith/tests/lib/proc-io.sh +103 -0
  101. package/skills/teamsmith/tests/lib/reply-fixture.sh +367 -0
  102. package/skills/teamsmith/tests/lib/section-guard.sh +258 -13
  103. package/skills/teamsmith/tests/lib/tmp-root.sh +139 -27
  104. package/skills/teamsmith/tests/lib/tmux-cap.sh +10 -1
  105. package/skills/teamsmith/tests/lib/tmux-iso.sh +39 -13
  106. package/skills/teamsmith/tests/loop-inventory.tsv +59 -47
  107. package/skills/teamsmith/tests/panel-b2.sh +107 -4
  108. package/skills/teamsmith/tests/panel-b3-stub.sh +139 -4
  109. package/skills/teamsmith/tests/panel-b3.sh +189 -29
  110. package/skills/teamsmith/tests/panel-choices.sh +81 -63
  111. package/skills/teamsmith/tests/panel-cpu.sh +3 -2
  112. package/skills/teamsmith/tests/panel-knobs.sh +7 -1
  113. package/skills/teamsmith/tests/panel-p21.sh +445 -241
  114. package/skills/teamsmith/tests/panel-snapshots.sh +41 -225
  115. package/skills/teamsmith/tests/panel-strings.mjs +33 -18
  116. package/skills/teamsmith/tests/perf.sh +122 -31
  117. package/skills/teamsmith/tests/pm-box-real.sh +1 -1
  118. package/skills/teamsmith/tests/pulse-nudge-key.sh +1 -1
  119. package/skills/teamsmith/tests/routes.sh +364 -109
  120. package/skills/teamsmith/tests/seat-interrupt.sh +1002 -0
  121. package/skills/teamsmith/tests/seat-visibility.sh +675 -0
  122. package/skills/teamsmith/tests/section-budgets.tsv +26 -12
  123. package/skills/teamsmith/tests/section-guard.sh +6 -1
  124. package/skills/teamsmith/tests/section-needs-audit.sh +24 -7
  125. package/skills/teamsmith/tests/section-paths.tsv +42 -26
  126. package/skills/teamsmith/tests/section-select.sh +90 -7
  127. package/skills/teamsmith/tests/slash-team-e2e.sh +323 -0
  128. package/skills/teamsmith/tests/slash-team.sh +617 -0
  129. package/skills/teamsmith/tests/smoke.sh +3762 -628
  130. package/skills/teamsmith/tests/snapshots/zh-dark-120-detail.txt +2 -2
  131. package/skills/teamsmith/tests/snapshots/zh-dark-120-p4.txt +2 -2
  132. package/skills/teamsmith/tests/snapshots/zh-dark-120.txt +9 -9
  133. package/skills/teamsmith/tests/snapshots/zh-dark-160-p4.txt +2 -2
  134. package/skills/teamsmith/tests/snapshots/zh-dark-160.txt +9 -9
  135. package/skills/teamsmith/tests/snapshots/zh-dark-59-detail.txt +1 -1
  136. package/skills/teamsmith/tests/snapshots/zh-dark-59-p4.txt +1 -1
  137. package/skills/teamsmith/tests/snapshots/zh-dark-59.txt +5 -5
  138. package/skills/teamsmith/tests/snapshots/zh-dark-99-p4.txt +2 -2
  139. package/skills/teamsmith/tests/snapshots/zh-dark-99.txt +5 -5
  140. package/skills/teamsmith/tests/snapshots/zh-light-120-detail.txt +2 -2
  141. package/skills/teamsmith/tests/snapshots/zh-light-120-p4.txt +2 -2
  142. package/skills/teamsmith/tests/snapshots/zh-light-120.txt +9 -9
  143. package/skills/teamsmith/tests/snapshots/zh-light-160-p4.txt +2 -2
  144. package/skills/teamsmith/tests/snapshots/zh-light-160.txt +9 -9
  145. package/skills/teamsmith/tests/snapshots/zh-light-59-detail.txt +1 -1
  146. package/skills/teamsmith/tests/snapshots/zh-light-59-p4.txt +1 -1
  147. package/skills/teamsmith/tests/snapshots/zh-light-59.txt +5 -5
  148. package/skills/teamsmith/tests/snapshots/zh-light-99-p4.txt +2 -2
  149. package/skills/teamsmith/tests/snapshots/zh-light-99.txt +5 -5
  150. package/skills/teamsmith/tests/task-header-model.sh +2 -1
  151. package/skills/teamsmith/tests/task-model-routing.sh +1511 -0
  152. package/skills/teamsmith/tests/tmp-hygiene.sh +782 -45
  153. package/skills/teamsmith/tests/tmux-identity-leak.sh +773 -0
  154. package/skills/teamsmith/tests/tmux-lint-legacy.txt +12 -18
  155. package/skills/teamsmith/tests/upgrade-recipe.sh +537 -0
  156. package/skills/teamsmith-init/SKILL.md +43 -43
  157. package/skills/teamsmith-init/references/bootstrap.md +8 -6
  158. package/skills/teamsmith-init/templates/bootstrap-prompt.md.tmpl +9 -5
@@ -14,7 +14,7 @@ each** — the reasoning, owners and gates are in [openspec.md](openspec.md):
14
14
  | # | Phase | Owner | Gate before the next phase |
15
15
  |---|---|---|---|
16
16
  | 1 | `opsx-explore` | an explorer worker (never the eventual implementer) | the PM accepts the approach, records it in `DECISIONS.md`, writes the propose brief |
17
- | 2 | `opsx-propose` | the explorer, same agent (planning only — no code) | the PM's **proposal review is ACCEPTED** in `reviews/<change>-proposal.md`: `openspec validate --all --strict` green + the eight-point checklist |
17
+ | 2 | `opsx-propose` | the explorer, same agent (planning only — no code) | the PM's **proposal review is ACCEPTED** in `reviews/<change>-proposal.md`: `openspec validate --all --strict` green + the ten-point checklist |
18
18
  | 3 | `opsx-apply` | a dev worker | independent verification is dispatched to a different agent |
19
19
  | 4 | `opsx-verify` | an **independent** verify agent | the PM re-runs the gate on the merged tree and sets `done` |
20
20
  | 5 | `opsx-archive` | the PM | the user confirms (the PM may act as the user's proxy only when it says so and records why) |
@@ -34,9 +34,11 @@ verified one by one, archived only after the last one landed.
34
34
  ## A. Assembling a team in a new project
35
35
 
36
36
  New-project setup lives in the **`teamsmith-init`** skill: it carries the ordered question checklist (dependencies,
37
- session/roster/models, gates, VCS mode, install command, the project's ROADMAP/OWNERSHIP/AGENTS.md red lines), the
38
- `team bootstrap` command and the handoff back here. Read `skills/teamsmith-init/SKILL.md` before running anything;
39
- the command's own behaviour is in
37
+ session/roster and the task-category map + independent PM model, gates, VCS mode, install command, the project's
38
+ ROADMAP/OWNERSHIP/AGENTS.md red lines), the `team bootstrap` command (fresh projects must pass
39
+ `--task-models` and `--pm-model`; a legacy config is refused and migrates on the next `team up` (the startup
40
+ transaction) or through the explicit `team config upgrade-models`) and
41
+ the handoff back here. Read `skills/teamsmith-init/SKILL.md` before running anything; the command's own behaviour is in
40
42
  [../../teamsmith-init/references/bootstrap.md](../../teamsmith-init/references/bootstrap.md).
41
43
 
42
44
  ## B. Dispatching the first task
@@ -56,18 +58,22 @@ bash <skill>/scripts/team dispatch dev T1.1 docs/team/tasks/T1.1-*.md
56
58
  bash <skill>/scripts/team dispatch dev T1.1 docs/team/tasks/T1.1-*.md --print # just want to see the prompt
57
59
  ```
58
60
 
59
- Dispatch does this: guards (memory, model concurrency, **session size vs the model window**) → builds the prompt
60
- (scope, red lines, delivery process) → starts an interactive pi in `<session>:dev` (`--session-id <session>-dev`,
61
- `-e` loading the notify extension, `--skill` loading this skill) → **waits for launch proof**: the pane harness
62
- writes a per-attempt nonce right before it execs the agent, and only that proof is reported as success (the line
63
- says the launch was verified). No proof → the window is killed, one retry is made, and the command reports a clear
64
- failure ("the dispatch was sent but the launch could not be confirmed") with what to check. A dispatch never claims
65
- success for a command that never ran.
66
-
67
- Resuming: dispatch the same agent for the same task and the session is reused; `--fresh` starts a new one
68
- (`<session>-<agent>-<timestamp>`; the old history stays in its own file). Use `--fresh` when the task is new and the
69
- session carries a long history from an earlier task, when you switch model family/provider, or when the session is
70
- wedged (the `Context full` / connection-error loop — troubleshooting §4a).
61
+ Dispatch does this: guards (memory, model concurrency, **session size vs the model window**) → resolves the launch
62
+ identity (a **new** task takes the brief's `category:` model from `TEAM_TASK_MODELS`, or `--model` as a one-launch
63
+ override, and gets a fresh SID; a complete same-task recovery keeps the recorded model/SID/category even after the
64
+ category leaves the map) → builds the prompt (scope, red lines, delivery process) → starts an interactive pi in
65
+ `<session>:dev` (`--session-id <session>-dev`, `-e` loading the notify extension, `--skill` loading this skill) →
66
+ **waits for launch proof**: the pane harness writes a per-attempt nonce right before it execs the agent, and only
67
+ that proof is reported as success (the line says the launch was verified). The complete assignment is published
68
+ atomically only after the proof; previews and refusals never write one. No proof → the window is killed, the old
69
+ record stays, and the command reports a clear failure ("the dispatch was sent but the launch could not be
70
+ confirmed") with what to check. A dispatch never claims success for a command that never ran.
71
+
72
+ Resuming: dispatch the same agent for the same task and the recorded session is reused; `--fresh` starts a new one
73
+ (keeping the recorded model/category, only the SID changes) and is required when the model would change (thinking
74
+ suffix included). Use `--fresh` when the task is new and the session carries a long history from an earlier task,
75
+ when you switch model family/provider, or when the session is wedged (the `Context full` / connection-error loop —
76
+ troubleshooting §4a).
71
77
 
72
78
  **One agent, one unfinished task.** Before launching, dispatch also reads what that agent is already carrying: the
73
79
  recorded task (`state/<agent>.env`), its board row and the worktree's checked-out branch. If another task is still
@@ -159,6 +165,12 @@ on Pi (§E2); `team doctor` reports the harness and the plugins this project car
159
165
  `已装插件 packages` — information, never a recommendation); the background-tmux-window fallback plus the four delivery
160
166
  rules are in [references/troubleshooting.md](troubleshooting.md) §17.
161
167
 
168
+ **Read for what each finding changes.** While you read the report and the review record, check that every finding
169
+ states what it changed — the implementation, the next step, the conclusion, or nothing. A caution that names no
170
+ fact, counterexample, reasoning gap or unobserved boundary is a finding to delete, not evidence of thoroughness,
171
+ and a longer or more defensive report is not stronger evidence. This is a reading rule, not a gate: no section
172
+ checks the wording (see [references/protocol.md](protocol.md) §11b).
173
+
162
174
  ### E2. The PM's background gate (the team's own lane, no extra window)
163
175
 
164
176
  On the built-in Pi paths (both the PM and the workers) the session already has two tools for this:
@@ -179,10 +191,17 @@ team_bg_wait review-T1.1
179
191
 
180
192
  The four rules that make it safe (they are the extension's code, not a convention):
181
193
 
182
- 1. **Harvest before the turn ends.** An unharvested job wakes you **once** when it finishes; a harvested job stays
183
- silent (its result came back inline). Several jobs finishing together arrive as **one** message, and never while
184
- you are running tools.
185
- 2. **The ledger is on disk**: every turn end appends
194
+ 1. **End the turn after starting; the completion wake-up is the normal harvest point.** The tool returns at once,
195
+ so the turn is free: end it, and when the job finishes and you are idle you are woken once (several jobs
196
+ finishing together arrive as one message) to run `team_bg_wait <id>`; a harvested job stays silent (its result
197
+ came back inline). In-turn waiting is the bounded exception: use it only when all three hold -- the job is
198
+ expected to finish within the inline-wait budget (about 2 minutes), its result blocks your immediate next step,
199
+ and no other task work can advance meanwhile. A turn that ends with this session's jobs still running is
200
+ **suspended on background jobs** -- a third legal ending beside **delivered** and **hard-blocked**, not a
201
+ delivery and not a blockage, and its last line names every awaited job id.
202
+ 2. **The ledger is on disk**: `team_bg_run` appends `<ISO timestamp> start id=<id> pid=<pid>` before it returns the
203
+ id, and every `team_bg_wait` appends `<ISO timestamp> wait id=<id> outcome=<harvested|running|interrupted>
204
+ waited_s=<s>` (the seconds that call itself waited). Every turn end appends
186
205
  `<ISO timestamp> settled-with-unharvested=<n> jobs=<id>:<running|exit<code>>,…` to
187
206
  `<root>/.pi/team/state/bg.log` — a review or a digest can read “this turn ended with unharvested work”
188
207
  afterwards. Deliveries append `wake count=<n> ids=…`.
@@ -446,3 +465,30 @@ bash <skill>/scripts/team teardown --all # close every window
446
465
  - Archive periodically: finished reports and verification records can move to `docs/team/archive/`; threads stay
447
466
  (append-only).
448
467
  - Worktrees left around eat disk: check with `git worktree list` and clean unused ones with `teardown --purge`.
468
+
469
+ ## K. Reading the help surface
470
+
471
+ The CLI's help is three levels deep, and it never dumps every command at once:
472
+
473
+ ```bash
474
+ bash <skill>/scripts/team # level 0: what teamsmith is, the groups, a beginner set
475
+ bash <skill>/scripts/team help seats # level 1: the commands of one group
476
+ bash <skill>/scripts/team help dispatch # level 2: one command's own page
477
+ bash <skill>/scripts/team dispatch --help # the same page (byte-identical to `help dispatch`)
478
+ ```
479
+
480
+ A command page answers the questions a reader who does not know teamsmith would ask: what it does, when to use it,
481
+ what it reads and writes, which side effects it has, whether it needs `--yes`, and how it can be undone. The pages
482
+ are rendered from one command manifest (`scripts/strings/commands.tsv`) and two parallel prose tables
483
+ (`scripts/strings/help.en.tsv`, `help.zh.tsv`); `tests/help-surface.sh` checks the surface's own promises (menu
484
+ size, coverage, layout, language, the declared effects and their probes) and `tests/routes.sh` probes every printed
485
+ flag against the real parser.
486
+
487
+ Two environment knobs, read from the environment only (the help paths never load the project contract, so they work
488
+ in a directory that is not a project yet):
489
+
490
+ - `TEAM_LANG=en|zh` — the prose language. Unset or empty means English; another value prints one warning and keeps
491
+ English. It selects prose only: command paths, flags and usage lines are byte-identical in both languages, and no
492
+ `--json`/`--print` output changes.
493
+ - `TEAM_HELP_WIDTH=<positive integer>` — the width the surface wraps to, in display cells (a CJK-wide character
494
+ counts two). The default is 100; an invalid value prints one warning and falls back to 100.