rvlib-shipkit 2.31.0 → 2.33.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 (408) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/package.json +1 -1
  3. package/src/advisors/acts.ts +16 -15
  4. package/src/advisors/advice.ts +56 -102
  5. package/src/advisors/advisor-view.ts +122 -76
  6. package/src/advisors/app-graph.ts +1 -1
  7. package/src/advisors/app.ts +3 -11
  8. package/src/advisors/cf-api.ts +1 -1
  9. package/src/advisors/dir-bucket.ts +4 -3
  10. package/src/advisors/edge/api.ts +20 -221
  11. package/src/advisors/edge/bucket.ts +2 -2
  12. package/src/advisors/edge/handler.ts +13 -155
  13. package/src/advisors/edge/here.ts +5 -5
  14. package/src/advisors/edge/pages.ts +12 -9
  15. package/src/advisors/edge/shell.ts +6 -5
  16. package/src/advisors/edge/sign-in.ts +101 -36
  17. package/src/advisors/edge/status.ts +19 -6
  18. package/src/advisors/edge/types.ts +36 -60
  19. package/src/advisors/expose.ts +29 -29
  20. package/src/advisors/here.ts +12 -12
  21. package/src/advisors/invite-send.ts +79 -35
  22. package/src/advisors/invite.ts +31 -8
  23. package/src/advisors/job.ts +24 -16
  24. package/src/advisors/login.ts +40 -15
  25. package/src/advisors/owner-store.ts +46 -22
  26. package/src/advisors/photos.ts +3 -3
  27. package/src/advisors/project.ts +27 -25
  28. package/src/advisors/reach.ts +89 -0
  29. package/src/advisors/rights.ts +1 -1
  30. package/src/advisors/routes.ts +55 -74
  31. package/src/advisors/scan.ts +0 -4
  32. package/src/advisors/setup-run.ts +14 -14
  33. package/src/advisors/share-trace.ts +3 -3
  34. package/src/advisors/{door-probe.ts → sign-in-probe.ts} +7 -6
  35. package/src/advisors/speaks.ts +29 -0
  36. package/src/advisors/sync.ts +97 -183
  37. package/src/advisors/tunnel.ts +6 -5
  38. package/src/advisors/users-listen.ts +92 -0
  39. package/src/advisors/users-router.ts +261 -87
  40. package/src/advisors/users-store.ts +81 -0
  41. package/src/agent-time/blocked-scan.ts +181 -0
  42. package/src/agent-time/registry.ts +12 -5
  43. package/src/agent-time/store.ts +9 -109
  44. package/src/asks/ask-bar-fold.ts +2 -1
  45. package/src/asks/ask-close.ts +2 -1
  46. package/src/asks/ask-doc.ts +2 -1
  47. package/src/asks/ask-migrate.ts +3 -2
  48. package/src/asks/ask-steps-fold.ts +2 -1
  49. package/src/asks/ask-store.ts +4 -3
  50. package/src/check.ts +3 -43
  51. package/src/checks/SK001-package-json-shape.check.ts +4 -55
  52. package/src/checks/SK004-gitignore-policy.check.ts +24 -69
  53. package/src/checks/SK013-one-way-in-policy.check.ts +3 -7
  54. package/src/checks/SK017-vscode-hub-task.check.ts +4 -4
  55. package/src/checks/SK019-tests-run-in-units.check.ts +3 -14
  56. package/src/checks/SK020-self-spawning-check.check.ts +5 -7
  57. package/src/checks/SK035-public-clean.check.ts +1 -1
  58. package/src/checks/SK039-vscode-watch-generated.check.ts +1 -1
  59. package/src/checks/SK042-post-kinds.check.ts +5 -14
  60. package/src/checks/SK054-agent-allow-list.check.ts +5 -74
  61. package/src/checks/SK055-retired-config-keys.check.ts +45 -0
  62. package/src/cli/cmd_Advisors.ts +11 -45
  63. package/src/cli/cmd_Asks.ts +3 -10
  64. package/src/cli/cmd_Backup.ts +25 -127
  65. package/src/cli/cmd_BackupTargets.ts +1 -1
  66. package/src/cli/cmd_Capacity.ts +6 -2
  67. package/src/cli/cmd_Checks.ts +0 -14
  68. package/src/cli/cmd_Ci.ts +2 -1
  69. package/src/cli/cmd_Db.ts +3 -82
  70. package/src/cli/cmd_Home.ts +4 -32
  71. package/src/cli/cmd_Hq.ts +0 -17
  72. package/src/cli/cmd_Releases.ts +57 -4
  73. package/src/cli/cmd_Review.ts +333 -354
  74. package/src/cli/cmd_Shot.ts +26 -4
  75. package/src/cli/cmd_SocialDrafts.ts +6 -13
  76. package/src/cli/cmd_ThreadSyncNeeds.ts +6 -2
  77. package/src/cli/cmd_Time.ts +1 -1
  78. package/src/cli/cmd_Trailer.ts +1 -1
  79. package/src/cli/inbox-hook-run.ts +5 -23
  80. package/src/cli/registry-heads.ts +5 -55
  81. package/src/cli/registry.ts +1 -5
  82. package/src/cli/review-here.ts +1 -1
  83. package/src/cli.ts +15 -4
  84. package/src/collections/collection-types.ts +1 -1
  85. package/src/collections/review.ts +5 -4
  86. package/src/core/admission.ts +268 -0
  87. package/src/core/agent-allow-policy.ts +32 -2
  88. package/src/core/agent-env.ts +8 -0
  89. package/src/core/allow-rows.ts +74 -0
  90. package/src/core/check-file-names.ts +19 -106
  91. package/src/core/code-lines.ts +36 -21
  92. package/src/core/footprint.ts +17 -13
  93. package/src/core/identities-root.ts +1 -4
  94. package/src/core/layout.ts +1 -2
  95. package/src/core/machine-db.ts +33 -208
  96. package/src/core/machine-layout.ts +14 -127
  97. package/src/core/machine-read.ts +5 -2
  98. package/src/core/mask-source.ts +60 -0
  99. package/src/core/memory-watch.ts +17 -14
  100. package/src/core/motherhome.ts +8 -35
  101. package/src/core/one-way-in-policy.ts +0 -3
  102. package/src/core/peer-sk.ts +8 -0
  103. package/src/core/repo-walk.ts +0 -9
  104. package/src/core/retention.ts +1 -9
  105. package/src/core/retired-checks.ts +2 -0
  106. package/src/core/tmux-policy.ts +1 -1
  107. package/src/core/tree-watch.ts +2 -2
  108. package/src/core/when.ts +7 -45
  109. package/src/gate/admit-heavy.ts +150 -0
  110. package/src/gate/check-runner.ts +6 -0
  111. package/src/gate/discover-checks.ts +42 -32
  112. package/src/gate/gate-checks.ts +21 -131
  113. package/src/gate/head-gate.ts +1 -1
  114. package/src/gate/job-run.ts +2 -1
  115. package/src/gate/pre-commit-discovery.ts +22 -28
  116. package/src/gate/run-check.ts +3 -4
  117. package/src/gate/run-ci.ts +4 -0
  118. package/src/gate/run-fix.ts +5 -17
  119. package/src/gate/run-fixers.ts +6 -42
  120. package/src/home/app-sign.ts +2 -2
  121. package/src/home/backup-status.ts +52 -92
  122. package/src/home/backup-verdict.ts +2 -2
  123. package/src/home/daemon-jobs.ts +51 -95
  124. package/src/home/database-words.ts +1 -2
  125. package/src/home/databases.ts +9 -25
  126. package/src/home/home-launchd.ts +0 -6
  127. package/src/home/home-paths.ts +8 -4
  128. package/src/home/home-routes.ts +3 -10
  129. package/src/home/home-state.ts +2 -14
  130. package/src/home/inbox-shape.ts +14 -15
  131. package/src/home/inbox.ts +1 -1
  132. package/src/home/machine-repair.ts +102 -103
  133. package/src/home/resume.ts +1 -15
  134. package/src/home/run-daemon.ts +7 -12
  135. package/src/home/space-page.ts +3 -2
  136. package/src/home/supervise.ts +3 -7
  137. package/src/hooks/commit-msg-run.ts +61 -0
  138. package/src/hooks/commit-run.ts +16 -166
  139. package/src/hooks/gate-outcome.ts +108 -0
  140. package/src/hooks/git-hook.ts +9 -9
  141. package/src/hooks/hook-config.ts +8 -8
  142. package/src/hooks/leak-guard.ts +1 -1
  143. package/src/hooks/pre-commit-checks.ts +1 -1
  144. package/src/hooks/run-hooks.ts +2 -6
  145. package/src/hooks/shared-file.ts +3 -2
  146. package/src/hq/daemon-db.ts +8 -8
  147. package/src/hq/door.ts +3 -16
  148. package/src/hq/hq-db.ts +4 -3
  149. package/src/hq/hq-local.ts +1 -2
  150. package/src/hq/hq-store.ts +0 -15
  151. package/src/hq/item-direct.ts +8 -10
  152. package/src/hq/item-fill.ts +37 -0
  153. package/src/hq/kinds/item-gone.ts +7 -10
  154. package/src/hq/kinds/item-msg.ts +12 -18
  155. package/src/hq/kinds/item.ts +13 -19
  156. package/src/hq/kinds/report.ts +3 -4
  157. package/src/hq/owner-switch.ts +3 -3
  158. package/src/hq/report.ts +5 -9
  159. package/src/hq/switch.ts +2 -11
  160. package/src/hq/thread-sync.ts +5 -17
  161. package/src/hq/{shapes-words.ts → threads-words.ts} +2 -12
  162. package/src/http/owner-word.ts +1 -1
  163. package/src/identities/machine.ts +16 -0
  164. package/src/init-repo.ts +0 -1
  165. package/src/ledger/check-stats.ts +6 -5
  166. package/src/ledger/db.ts +2 -4
  167. package/src/ledger/record-kept.ts +117 -48
  168. package/src/ledger/run-log.ts +21 -2
  169. package/src/ledger/slow-tests.ts +96 -0
  170. package/src/ledger/store.ts +3 -86
  171. package/src/ledger/suite-log.ts +8 -2
  172. package/src/media-store/backup/facts.ts +3 -37
  173. package/src/media-store/backup/keys.ts +1 -8
  174. package/src/media-store/backup/manifest.ts +6 -67
  175. package/src/media-store/backup/restore.ts +4 -13
  176. package/src/media-store/backup/retention.ts +13 -1
  177. package/src/media-store/backup/run.ts +6 -267
  178. package/src/media-store/backup/snapshot.ts +2 -38
  179. package/src/media-store/backup/sources.ts +3 -113
  180. package/src/media-store/backup/target-send.ts +5 -29
  181. package/src/media-store/db.ts +8 -7
  182. package/src/media-store/forget-one.ts +1 -1
  183. package/src/media-store/forget.ts +1 -80
  184. package/src/orchestrator/guards.ts +0 -1
  185. package/src/orchestrator/presence.ts +2 -2
  186. package/src/orchestrator/routes.ts +1 -1
  187. package/src/orchestrator/started.ts +0 -9
  188. package/src/orchestrator/talk-key.ts +3 -4
  189. package/src/orchestrator/unheard.ts +1 -1
  190. package/src/plan/planner.ts +3 -2
  191. package/src/recordings/edit.ts +3 -3
  192. package/src/recordings/marks-draw.ts +17 -6
  193. package/src/recordings/marks.ts +120 -9
  194. package/src/reflections/reflections-queue.ts +3 -10
  195. package/src/release/notes.ts +1 -1
  196. package/src/release/public-clean.ts +66 -6
  197. package/src/release/run-bump.ts +11 -0
  198. package/src/release/run-release.ts +4 -0
  199. package/src/releases/from-thread.ts +3 -3
  200. package/src/releases/model.ts +186 -36
  201. package/src/releases/store.ts +13 -3
  202. package/src/releases/validate.ts +83 -0
  203. package/src/repo-config.ts +36 -64
  204. package/src/review/answer-kinds.ts +63 -4
  205. package/src/review/blocked-guard.ts +11 -0
  206. package/src/review/blocked-object.ts +298 -0
  207. package/src/review/cells.ts +144 -230
  208. package/src/review/close.ts +39 -1
  209. package/src/review/doc-save.ts +3 -2
  210. package/src/review/draft-item.ts +1 -1
  211. package/src/review/events.ts +3 -7
  212. package/src/review/expect.ts +23 -39
  213. package/src/review/format.ts +79 -46
  214. package/src/review/glyphs.ts +1 -0
  215. package/src/review/hand-over.ts +3 -3
  216. package/src/review/heard.ts +1 -1
  217. package/src/review/holds-sync.ts +2 -1
  218. package/src/review/inbox-hook.ts +2 -2
  219. package/src/review/inbox-read.ts +39 -33
  220. package/src/review/instruction-guards.ts +12 -0
  221. package/src/review/instructions.ts +0 -1
  222. package/src/review/item-db.ts +13 -43
  223. package/src/review/item-hq.ts +2 -2
  224. package/src/review/item-rows.ts +3 -14
  225. package/src/review/kind-catalog.ts +3 -1
  226. package/src/review/kinds.ts +18 -8
  227. package/src/review/live-view.ts +3 -0
  228. package/src/review/media-kind.ts +1 -1
  229. package/src/review/mentions.ts +1 -2
  230. package/src/review/model.ts +158 -114
  231. package/src/review/move.ts +149 -0
  232. package/src/review/need-threads.ts +3 -2
  233. package/src/review/object-card.ts +11 -0
  234. package/src/review/object-read.ts +6 -1
  235. package/src/review/one-block.ts +1 -1
  236. package/src/review/owner-read.ts +1 -1
  237. package/src/review/phone-push.ts +10 -9
  238. package/src/review/previews.ts +32 -4
  239. package/src/review/push.ts +2 -2
  240. package/src/review/recap.ts +129 -0
  241. package/src/review/referring.ts +6 -3
  242. package/src/review/reflection-object.ts +4 -3
  243. package/src/review/routes.ts +51 -47
  244. package/src/review/secret-route.ts +3 -2
  245. package/src/review/settle.ts +0 -6
  246. package/src/review/snooze.ts +5 -3
  247. package/src/review/speaker.ts +68 -0
  248. package/src/review/start-title.ts +19 -0
  249. package/src/review/store-parties.ts +28 -0
  250. package/src/review/store.ts +94 -59
  251. package/src/review/{wakes.ts → thread-events.ts} +92 -7
  252. package/src/review/thread-md.ts +35 -14
  253. package/src/review/thread-state.ts +804 -0
  254. package/src/review/threads.ts +29 -347
  255. package/src/review/traces.ts +104 -7
  256. package/src/review/trailer-item.ts +1 -1
  257. package/src/review/unit.ts +7 -9
  258. package/src/review/verdict-items.ts +12 -10
  259. package/src/review/view-layout.ts +25 -1
  260. package/src/review/watch-feed.ts +1 -2
  261. package/src/review/working-guards.ts +2 -3
  262. package/src/rules/untrack-generated.ts +1 -15
  263. package/src/secrets/copy.ts +4 -4
  264. package/src/secrets/lapse.ts +2 -1
  265. package/src/serve/hub-app/advisor-app.tsx +4 -4
  266. package/src/serve/hub-app/advisor-face.tsx +9 -3
  267. package/src/serve/hub-app/advisor-host.ts +27 -27
  268. package/src/serve/hub-app/advisors-model.ts +17 -8
  269. package/src/serve/hub-app/advisors-rights.tsx +1 -1
  270. package/src/serve/hub-app/advisors-st.ts +15 -14
  271. package/src/serve/hub-app/advisors-view.tsx +13 -11
  272. package/src/serve/hub-app/app-bridge.ts +23 -3
  273. package/src/serve/hub-app/asks-page.tsx +1 -1
  274. package/src/serve/hub-app/auto-text.tsx +71 -16
  275. package/src/serve/hub-app/check-view.tsx +0 -8
  276. package/src/serve/hub-app/controls.css +14 -3
  277. package/src/serve/hub-app/database-view.tsx +1 -2
  278. package/src/serve/hub-app/dock-st.ts +1 -1
  279. package/src/serve/hub-app/git-view.tsx +3 -1
  280. package/src/serve/hub-app/hub.css +12 -5
  281. package/src/serve/hub-app/icons.tsx +1 -1
  282. package/src/serve/hub-app/inbox-view.tsx +1 -2
  283. package/src/serve/hub-app/live-sources.ts +2 -2
  284. package/src/serve/hub-app/main-panel.tsx +2 -1
  285. package/src/serve/hub-app/panel-repo.ts +0 -9
  286. package/src/serve/hub-app/pic.tsx +29 -12
  287. package/src/serve/hub-app/polled.ts +16 -2
  288. package/src/serve/hub-app/recordings-st.ts +23 -2
  289. package/src/serve/hub-app/recordings-view.tsx +68 -10
  290. package/src/serve/hub-app/ref-pill.ts +1 -1
  291. package/src/serve/hub-app/repo-st.ts +1 -2
  292. package/src/serve/hub-app/review/advisor-add.tsx +1 -1
  293. package/src/serve/hub-app/review/advisor-invite.tsx +1 -1
  294. package/src/serve/hub-app/review/draft-body.tsx +2 -2
  295. package/src/serve/hub-app/review/heard-line.tsx +1 -1
  296. package/src/serve/hub-app/review/instructions-view.tsx +1 -8
  297. package/src/serve/hub-app/review/kind-states.tsx +14 -9
  298. package/src/serve/hub-app/review/kit.tsx +4 -11
  299. package/src/serve/hub-app/review/lane-bar.tsx +3 -3
  300. package/src/serve/hub-app/review/lightbox.tsx +15 -11
  301. package/src/serve/hub-app/review/line-window.ts +4 -1
  302. package/src/serve/hub-app/review/live-bar-st.ts +2 -2
  303. package/src/serve/hub-app/review/live-view.tsx +57 -1
  304. package/src/serve/hub-app/review/object-panel.tsx +20 -8
  305. package/src/serve/hub-app/review/question-views.tsx +191 -53
  306. package/src/serve/hub-app/review/recap-bar.tsx +40 -0
  307. package/src/serve/hub-app/review/request-cell.tsx +48 -0
  308. package/src/serve/hub-app/review/review-cells.tsx +154 -96
  309. package/src/serve/hub-app/review/review-host.ts +8 -4
  310. package/src/serve/hub-app/review/review-kit.ts +17 -11
  311. package/src/serve/hub-app/review/review-list.tsx +30 -35
  312. package/src/serve/hub-app/review/review-st.ts +32 -42
  313. package/src/serve/hub-app/review/review-thread.tsx +139 -85
  314. package/src/serve/hub-app/review/review-views.tsx +127 -68
  315. package/src/serve/hub-app/review/share-lines.tsx +4 -4
  316. package/src/serve/hub-app/review/start-st.ts +2 -5
  317. package/src/serve/hub-app/review/superseded-runs.ts +4 -3
  318. package/src/serve/hub-app/review/thread-close.tsx +10 -7
  319. package/src/serve/hub-app/review/thread-st.ts +381 -202
  320. package/src/serve/hub-app/review/tone-bar.tsx +129 -0
  321. package/src/serve/hub-app/review/tones.ts +53 -0
  322. package/src/serve/hub-app/review/trailer-body.tsx +2 -2
  323. package/src/serve/hub-app/review/trailer-st.ts +3 -2
  324. package/src/serve/hub-app/review/trailer-voices-st.ts +3 -2
  325. package/src/serve/hub-app/review.css +189 -106
  326. package/src/serve/hub-app/search-view.tsx +1 -1
  327. package/src/serve/hub-app/social/social-model.ts +0 -4
  328. package/src/serve/hub-app/source-acts.ts +2 -1
  329. package/src/serve/hub-app/stores/stores-page.tsx +2 -2
  330. package/src/serve/hub-app/terminal-sources.tsx +2 -1
  331. package/src/serve/hub-app/thread-row.tsx +3 -4
  332. package/src/serve/hub-app/tree-build.ts +0 -4
  333. package/src/serve/hub-app/urls-view.tsx +2 -1
  334. package/src/serve/hub-app/view-layout.css +13 -3
  335. package/src/serve/hub-app/wikis-view.tsx +5 -2
  336. package/src/serve/hub-runtime.ts +7 -37
  337. package/src/serve/project-gutter-route.ts +6 -2
  338. package/src/serve/read-thread.ts +20 -2
  339. package/src/serve/read-worker.ts +9 -1
  340. package/src/serve/record-pages.ts +46 -0
  341. package/src/serve/serve-hub.ts +2 -2
  342. package/src/serve/terminal-host.ts +1 -1
  343. package/src/serve/terminal-route.ts +1 -3
  344. package/src/serve/tracked-watch.ts +1 -3
  345. package/src/setup-house.ts +2 -2
  346. package/src/shipkit-files.ts +1 -1
  347. package/src/shipkit.ts +1 -6
  348. package/src/shot/client.ts +2 -1
  349. package/src/shot/film-box.ts +0 -20
  350. package/src/shot/on-place.ts +141 -0
  351. package/src/social/drafts.ts +1 -1
  352. package/src/social/kinds.ts +6 -29
  353. package/src/social/load.ts +2 -2
  354. package/src/social/post-object.ts +3 -2
  355. package/src/social/release-stage.ts +1 -1
  356. package/src/social/stage.ts +2 -2
  357. package/src/stores/model.ts +4 -0
  358. package/src/stores/routes.ts +11 -3
  359. package/src/suite/judge-suites.ts +58 -0
  360. package/src/suite/red-alone.ts +54 -18
  361. package/src/suite/runner-shapes.ts +2 -2
  362. package/src/suite/suite-cli.ts +67 -14
  363. package/src/suite/test-units.ts +2 -1
  364. package/src/urls/fill.ts +1 -1
  365. package/src/urls/places.ts +1 -2
  366. package/src/vault/vault-config.ts +2 -2
  367. package/src/vault/vault-init.ts +1 -5
  368. package/src/wiki/graph-page.ts +14 -2
  369. package/src/advisors/copy-truth.ts +0 -49
  370. package/src/advisors/door-child.ts +0 -112
  371. package/src/advisors/door-serve.ts +0 -52
  372. package/src/advisors/door.ts +0 -118
  373. package/src/checks/SK016-legacy-check-shapes.check.ts +0 -189
  374. package/src/checks/SK029-explicit-check-files.check.ts +0 -112
  375. package/src/checks/SK048-one-local-file.check.ts +0 -36
  376. package/src/core/config-rewrite.ts +0 -111
  377. package/src/core/daemon-port.ts +0 -10
  378. package/src/core/legacy-shapes.ts +0 -263
  379. package/src/core/migrate-layout.ts +0 -638
  380. package/src/core/port-check-cli.ts +0 -52
  381. package/src/core/port-check-file.ts +0 -295
  382. package/src/core/port-check-files.ts +0 -31
  383. package/src/gate/discover-legacy-checks.ts +0 -26
  384. package/src/home/home-move.ts +0 -527
  385. package/src/home/machine-fold.ts +0 -810
  386. package/src/hq/item-shapes.ts +0 -54
  387. package/src/hq/kinds/items-read.ts +0 -4
  388. package/src/media-store/backup/daemon.ts +0 -220
  389. package/src/media-store/backup/kept.ts +0 -241
  390. package/src/media-store/backup/prune.ts +0 -359
  391. package/src/media-store/backup/secret.ts +0 -88
  392. package/src/media-store/backup/ssh-space.ts +0 -202
  393. package/src/media-store/backup/watch.ts +0 -117
  394. package/src/review/band.ts +0 -182
  395. package/src/review/folders.ts +0 -216
  396. package/src/review/hook-ask.ts +0 -58
  397. package/src/review/role.ts +0 -48
  398. package/src/review/thread-fold.ts +0 -64
  399. package/src/review/wait.ts +0 -91
  400. package/src/rules/rule.ts +0 -43
  401. package/src/serve/hook-thread.ts +0 -37
  402. package/src/serve/hook-work.ts +0 -92
  403. package/src/serve/hook-worker.ts +0 -57
  404. package/src/serve/hub-app/review/dock.tsx +0 -147
  405. package/src/serve/hub-app/review/faces.tsx +0 -18
  406. package/src/serve/hub-app/review/item-verdict.tsx +0 -112
  407. package/src/serve/hub-app/review/review-board.tsx +0 -48
  408. /package/src/{scaffold → core}/jsonc-spans.ts +0 -0
@@ -1,5 +1,5 @@
1
- // sk thread: an agent shows the owner something as a version in its thread and reads his answer; a dispatcher routes
2
- // what he, a player or a rule raised, a worker claims and closes it (review/store.ts, wiki tools/shipkit/threads.md).
1
+ // sk thread: an agent shows the owner something as a version in its thread and reads his answer; what he, a player or
2
+ // a rule raised, a worker claims and closes (review/store.ts, wiki tools/shipkit/threads.md).
3
3
  // Every module loads inside execute: the cli registers this file on every `sk` call
4
4
  import { Command, Option } from './clip.ts'
5
5
  import type { AnswerKind } from '../review/model.ts'
@@ -17,9 +17,7 @@ async function run(context: Ctx, body: (h: Here) => Promise<number> | number, o:
17
17
  const out = (l: string): void => void context.stdout.write(`${l}\n`)
18
18
  const err = (l: string): void => void context.stderr.write(`${l}\n`)
19
19
  try {
20
- // the older name still works: it says the new one where a person reads it, never in a hook's or a script's output
21
20
  const argv = process.argv.slice(2)
22
- if (argv[0] === 'review' && !argv.includes('--hook') && !argv.includes('--json')) err(`sk review is now sk thread: sk thread ${argv.slice(1).map((a) => (/^[\w./=,@:+#-]+$/.test(a) ? a : JSON.stringify(a))).join(' ')}`)
23
21
  const root = await reviewRoot(process.cwd())
24
22
  if (root == null) throw new Error(noRepo(process.cwd()))
25
23
  // a repo where an agent writes in a thread needs a next session that hears it; the gate's repair wires the hook
@@ -41,7 +39,7 @@ async function run(context: Ctx, body: (h: Here) => Promise<number> | number, o:
41
39
  const isHelp = (a: string): boolean => a === '--help' || a === '-h'
42
40
 
43
41
  /** the verbs that write an agent's act in a thread */
44
- const WRITING_VERBS = new Set(['post', 'add', 'add-view', 'ask', 'propose', 'reply', 'update', 'take', 'assign', 'working', 'fixed', 'done', 'attach', 'ready'])
42
+ const WRITING_VERBS = new Set(['post', 'add-view', 'ask', 'propose', 'reply', 'update', 'take', 'assign', 'working', 'fixed', 'done', 'attach', 'ready'])
45
43
 
46
44
  /** the agent that acts (review/parties.ts laneOfCaller); `need` refuses an unnamed one */
47
45
  function actor(as: string | undefined, need: boolean, verb: string): string {
@@ -55,6 +53,18 @@ function actor(as: string | undefined, need: boolean, verb: string): string {
55
53
  /** an item id, a player report's ref (`live#3`), or an address (`trailer:comfy-ts/main`, the newest version of the
56
54
  * thread that owns it, or the one above it) to its item id */
57
55
  async function idOf(dir: string, ref: string, one?: { verb: string; objects?: boolean }): Promise<string> {
56
+ try {
57
+ return await idHere(dir, ref, one)
58
+ } catch (e) {
59
+ // a thread moved to another repo: its old address and ids say where it is now, never « no thread »
60
+ const { movedLine, movedOf } = await import('../review/move.ts')
61
+ const m = movedOf(dir, ref)
62
+ if (m !== null) throw new Error(movedLine(ref, m))
63
+ throw e
64
+ }
65
+ }
66
+
67
+ async function idHere(dir: string, ref: string, one?: { verb: string; objects?: boolean }): Promise<string> {
58
68
  const { itemOfRef, readAll, specOf } = await import('../review/store.ts')
59
69
  const { addressOrThrow, ID_RE } = await import('../review/model.ts')
60
70
  const { THREAD_ID_RE, threadIdOf, threadOfAddress, threadsOf, threadsOfId } = await import('../review/threads.ts')
@@ -138,7 +148,8 @@ async function replyTarget(h: Here, ref: string, id: string): Promise<string> {
138
148
  const { ID_RE } = await import('../review/model.ts')
139
149
  if (ID_RE.test(ref) || !ref.includes(':') || /^\w+#\d+$/.test(ref)) return id
140
150
  const { readAll } = await import('../review/store.ts')
141
- const { replyTargetOf, threadOfItem, threadsOf } = await import('../review/threads.ts')
151
+ const { threadOfItem, threadsOf } = await import('../review/threads.ts')
152
+ const { replyTargetOf } = await import('../review/thread-state.ts')
142
153
  const t = threadOfItem(id, threadsOf(readAll(h.dir).items, h.say.spec))
143
154
  return t ? replyTargetOf(t) : id
144
155
  }
@@ -206,6 +217,36 @@ const MEDIA_FILE = /\.(png|jpe?g|webp|gif|mp4|webm|mov|wav|mp3|flac|ogg|opus|m4a
206
217
 
207
218
  /** one `--option` of a question: words, a media file, `<label>=<file>` or `<label>=<before>,<after>` (a gallery tile's
208
219
  * form); the part after the last `=` is media only when each of its files is one */
220
+ /** the rows of `sk thread ask --row`, read in the order typed: each --row opens a thing, the --option and --pick after
221
+ * it are that row's. `args`: the words after `ask` */
222
+ export function askRowsOf(args: readonly string[]): { label: string; options: string[]; pick?: number }[] {
223
+ const rows: { label: string; options: string[]; pick?: number }[] = []
224
+ for (let i = 0; i < args.length; i++) {
225
+ const a = args[i]!
226
+ const eq = /^(--row|--option|--pick)=(.*)$/s.exec(a)
227
+ const flag = eq?.[1] ?? a
228
+ if (flag !== '--row' && flag !== '--option' && flag !== '--pick') continue
229
+ const value = eq !== null ? eq[2]! : args[++i]
230
+ if (value === undefined) throw new Error(`${flag}: a value after it`)
231
+ if (flag === '--row') {
232
+ if (value.trim() === '') throw new Error('--row: the thing this row picks for, in words')
233
+ rows.push({ label: value.trim(), options: [] })
234
+ continue
235
+ }
236
+ const row = rows.at(-1)
237
+ if (row === undefined) throw new Error(`${flag} before the first --row: with --row, each row's --option and --pick follow it`)
238
+ if (flag === '--option') row.options.push(value)
239
+ else {
240
+ if (row.pick !== undefined) throw new Error(`--row ${row.label}: one --pick a row`)
241
+ const n = Number(value)
242
+ if (!(Number.isInteger(n) && n >= 1)) throw new Error(`--pick ${value}: an option's number from 1`)
243
+ row.pick = n - 1
244
+ }
245
+ }
246
+ for (const r of rows) if (r.options.length < 2) throw new Error(`--row ${r.label}: two --option or more after it`)
247
+ return rows
248
+ }
249
+
209
250
  export function askOption(a: string): { label: string; files?: string[] } {
210
251
  const eq = a.lastIndexOf('=')
211
252
  const tail = eq >= 0 ? a.slice(eq + 1).split(',').map((f) => f.trim()) : [a.trim()]
@@ -354,8 +395,6 @@ const ADD_FLAGS = `flags:
354
395
  --live [<label>] <url> a running page framed in the thread (repeat it), its shot taken now: what an advisor sees, and what shows while it loads or when it stops answering; a loopback, tailnet or https url; a page of the hub itself: its shot and a link, never a frame
355
396
  --label "<label>" the first view's label
356
397
  --view "<label>" <a.png> [<b.png>] another view of the same subject (repeat it); --note "<text>" right after it: a line on that view
357
- --choice the older form of a question: posts sk thread ask with each --view an option, and prints that form
358
- --pick <n> with --choice: the option you suggest, by its number from 1 (a letter or a label works too); the « my pick » pill
359
398
  --gallery "<label>" <a.png> … a grid he rates tile by tile (stars, OK, fix or no, a word), alone or beside other views; a tile is "[<row>/]<label>=[<before>,]<after>": a redraw carries its before, a row holds one asset's variants
360
399
  --trailer <cut.trailer> a trailer cut, played in the thread by the trailer entry's player, never a compiled clip; his notes land on its shots
361
400
  --version v<n> with --trailer: a kept version of that cut, else the cut's own render
@@ -367,7 +406,7 @@ const ADD_FLAGS = `flags:
367
406
  --commit <sha> the commit it shows
368
407
  --lane <id> the lane that made it; else SK_AGENT
369
408
  --wip "<what is still wrong>" a version sent in work: « in progress », no verdict asked; each step after: sk thread update <id> <broken|better|fixed> "<line>" <file>
370
- --on <address> the version's own address (page:review/lightbox, trailer:<name>/<cut>): it goes into the thread that owns it, one thread per address; a trailer or a draft names its own
409
+ --on <address> the version's own address (page:threads/lightbox, trailer:<name>/<cut>): it goes into the thread that owns it, one thread per address; a trailer or a draft names its own
371
410
  --about <address> another object it is about, a link that finds it (repeat it); never its thread
372
411
  --answers <id | live#3> the item it answers (a note he raised, a player's report), one thread (repeat it)
373
412
  --keeps "<what stays>" on a new version of an approved look: what of it stays
@@ -399,7 +438,7 @@ export async function trailerOfFlags(o: Record<string, string>, others: boolean)
399
438
  return null
400
439
  }
401
440
  const clash = ['image', 'video', 'audio', 'after', 'live'].filter((k) => o[k] !== undefined)
402
- if (clash.length > 0 || others) throw new Error(`--trailer: the version plays the cut; no ${clash.length > 0 ? clash.map((k) => `--${k}`).join(', ') : '--view, --gallery, --choice or --wip'} beside it`)
441
+ if (clash.length > 0 || others) throw new Error(`--trailer: the version plays the cut; no ${clash.length > 0 ? clash.map((k) => `--${k}`).join(', ') : '--view, --gallery or --wip'} beside it`)
403
442
  const { mkdtempSync, rmSync } = await import('node:fs')
404
443
  const { tmpdir } = await import('node:os')
405
444
  const { join } = await import('node:path')
@@ -423,18 +462,18 @@ export async function trailerOfFlags(o: Record<string, string>, others: boolean)
423
462
  export async function draftOfFlags(o: Record<string, string>, others: boolean, cwd: string = process.cwd()): Promise<import('../review/model.ts').ItemDraft | null> {
424
463
  if (o.draft === undefined) return null
425
464
  const clash = ['image', 'video', 'audio', 'before', 'after', 'label', 'live', 'trailer'].filter((k) => o[k] !== undefined)
426
- if (clash.length > 0 || others) throw new Error(`--draft: the version shows the draft itself; no ${clash.length > 0 ? clash.map((k) => `--${k}`).join(', ') : '--view, --gallery or --choice'} beside it`)
465
+ if (clash.length > 0 || others) throw new Error(`--draft: the version shows the draft itself; no ${clash.length > 0 ? clash.map((k) => `--${k}`).join(', ') : '--view or --gallery'} beside it`)
427
466
  const [{ findRepoRoot }, { openDesk }, { draftItemOf }] = await Promise.all([import('../ts/config.ts'), import('../social/open.ts'), import('../review/draft-item.ts')])
428
467
  return draftItemOf((await openDesk(findRepoRoot(cwd))).desk, o.draft, cwd).item
429
468
  }
430
469
 
431
470
  /** --md <file | -> or --html <file | ->: the version's subject is that document, its text read now (`-` stdin); null
432
471
  * without either. Words, numbers and tables go this way, never as a picture of text */
433
- export async function docOfFlags(o: Record<string, string>, beside: { trailer: unknown; draft: unknown; states: unknown; choice: boolean; wip: boolean }, stdin: () => Promise<string> = () => new Response(Bun.stdin.stream()).text()): Promise<import('../review/model.ts').ItemDoc | null> {
472
+ export async function docOfFlags(o: Record<string, string>, beside: { trailer: unknown; draft: unknown; states: unknown; wip: boolean }, stdin: () => Promise<string> = () => new Response(Bun.stdin.stream()).text()): Promise<import('../review/model.ts').ItemDoc | null> {
434
473
  if (o.md !== undefined && o.html !== undefined) throw new Error('--md and --html: one document a version; markdown first, --html when markdown is not enough')
435
474
  const kind = o.md !== undefined ? 'md' : o.html !== undefined ? 'html' : null
436
475
  if (kind === null) return null
437
- const other = beside.trailer ? '--trailer' : beside.draft ? '--draft' : beside.states ? "an object's --before and --after states" : beside.choice ? '--choice' : beside.wip ? '--wip --live' : null
476
+ const other = beside.trailer ? '--trailer' : beside.draft ? '--draft' : beside.states ? "an object's --before and --after states" : beside.wip ? '--wip --live' : null
438
477
  if (other !== null) throw new Error(`--${kind}: a document is the version's subject, never with ${other}`)
439
478
  const path = o[kind]!
440
479
  const ext = kind === 'md' ? /\.(md|markdown|txt)$/i : /\.html?$/i
@@ -455,20 +494,19 @@ export async function docOfFlags(o: Record<string, string>, beside: { trailer: u
455
494
  }
456
495
 
457
496
  export class ReviewAddCommand extends Command {
458
- static override paths = [['thread', 'post'], ['review', 'add']]
497
+ static override paths = [['thread', 'post']]
459
498
  static essential = {}
460
499
  /** the flags its proxy reads, as its help lists them: what a doc may name (RV019) */
461
500
  static proxyFlags = [...new Set(ADD_FLAGS.match(/--[a-z][a-z0-9-]*/g) ?? [])]
462
501
  static override usage = Command.Usage({
463
502
  category: 'Review',
464
503
  description: "a version in the thread of its subject, by its address; it starts the thread; no media: words",
465
- details: `${DETAILS}\n\nsk thread post [<address> | <id>] <flags>. The address is the version's own (screen:<screen>, asset:<asset>, page:<page>, a kind of the repo's unit); --trailer and --draft name theirs, so it may be left out. An id names its thread. With no media, --title and --what are words: they start the thread, or are a reply in it. sk thread add is its older name.\n\n${ADD_FLAGS}`,
504
+ details: `${DETAILS}\n\nsk thread post [<address> | <id>] <flags>. The address is the version's own (screen:<screen>, asset:<asset>, page:<page>, a kind of the repo's unit); --trailer and --draft name theirs, so it may be left out. An id names its thread. With no media, --title and --what are words: they start the thread, or are a reply in it.\n\n${ADD_FLAGS}`,
466
505
  examples: [
467
506
  ['one image', 'sk thread post screen:menu --title "the new menu" --what "the menu, bigger" --image shots/menu.png'],
468
507
  ['a report with a table: markdown, never a picture of text', 'sk thread post page:hub/speed --title "the hub, before and after" --what "every click under 50 ms" --md report.md'],
469
508
  ['a before and after', 'sk thread post asset:lamps --title "lamps lit" --what "..." --before a.png --after b.png'],
470
509
  ['the next version: the same address, the tool links it, the thread keeps its name', 'sk thread post asset:lamps --title "lamps lit, warmer" --what "..." --image c.png'],
471
- ['a pick among three voices, yours on the second', 'sk thread post asset:narrator --choice --pick 2 --title "the narrator" --what "..." --view "voice 0" a.flac --note "low, breathy" --view "voice 1" b.flac --view "voice 2" c.flac'],
472
510
  ['a 360° panorama he looks around in', 'sk thread post screen:hall --title "the hall in 360" --what "..." --pano hall-360.png'],
473
511
  ['a Gaussian splat he orbits, its poster shot now', 'sk thread post asset:hall --title "the hall as a splat" --what "..." --splat hall.ply'],
474
512
  ['icons he rates one by one', 'sk thread post asset:buff-icons --title "buff icons" --what "..." --gallery "icons" vitality=a.png haste=b.png greed=c.png'],
@@ -486,7 +524,6 @@ export class ReviewAddCommand extends Command {
486
524
  }
487
525
  return run(this.context, async (h) => {
488
526
  const { addItem, postUpdate, agentName } = await import('../review/store.ts')
489
- if (this.path[1] === 'add') h.err('sk thread add is now sk thread post [<address>]: the same flags')
490
527
  // `--wip "<what is still wrong>"`: a version sent in work, its first update still broken; a bare --wip goes with --live
491
528
  const w = this.args.indexOf('--wip')
492
529
  const wipLine = w >= 0 && this.args[w + 1] !== undefined && !this.args[w + 1]!.startsWith('--') ? this.args[w + 1] : undefined
@@ -497,7 +534,7 @@ export class ReviewAddCommand extends Command {
497
534
  const kindName = rest[rest.indexOf('--subject') + 1]
498
535
  const kind = rest.includes('--subject') && kindName ? h.unit?.kinds?.[kindName] : undefined
499
536
  const own = [...Object.keys(kind?.flags ?? {}), ...Object.keys(h.unit?.flags ?? {})]
500
- const f = flagsOf(rest, ['title', 'what', 'post', 'changelog', 'rating', 'video', 'audio', 'pano', 'splat', 'mesh', 'before', 'after', 'label', 'topic', 'subject', 'commit', 'lane', 'supersedes', 'keeps', 'why', 'live', 'trailer', 'version', 'shots', 'pick', 'draft', 'on', 'md', 'html'], ['image', 'answers', 'about', ...own], ['new', 'wip', 'choice', 'keep', 'verdict', 'rename'])
537
+ const f = flagsOf(rest, ['title', 'what', 'post', 'changelog', 'rating', 'video', 'audio', 'pano', 'splat', 'mesh', 'before', 'after', 'label', 'topic', 'subject', 'commit', 'lane', 'supersedes', 'keeps', 'why', 'live', 'trailer', 'version', 'shots', 'draft', 'on', 'md', 'html'], ['image', 'answers', 'about', ...own], ['new', 'wip', 'keep', 'verdict', 'rename'])
501
538
  const o = f.one
502
539
  // --what is one or two short lines: a wall goes as a document, --md, and needs no escape
503
540
  const wall = o.what !== undefined ? (await import('../review/reply-guards.ts')).wallInWords(o.what, '--what', f.positionals[0] ?? '<address>', false) : null
@@ -505,12 +542,10 @@ export class ReviewAddCommand extends Command {
505
542
  // --image repeats only as the stills of a kind's page, one a view (<view>=<a.png>)
506
543
  const images = f.many.image ?? []
507
544
  if (images.length === 1) o.image = images[0]!
508
- if (images.length > 1 && f.on.has('choice')) throw new Error('--choice: one --image, the first option; the others are --view')
509
545
  // the first word names the thread: an address (the version's own), or an id (its thread)
510
546
  const { addressOrThrow, canonicalAddress, ID_RE } = await import('../review/model.ts')
511
547
  const first = f.positionals[0]
512
- // post names its thread first; add's lone word is a title, unless it reads as an address
513
- const named = first !== undefined && (ID_RE.test(first) || canonicalAddress(first) !== null || (this.path[1] === 'post' && !MEDIA_FILE.test(first)))
548
+ const named = first !== undefined && (ID_RE.test(first) || canonicalAddress(first) !== null || !MEDIA_FILE.test(first))
514
549
  const target = named ? f.positionals.shift() : undefined
515
550
  if (target !== undefined && ID_RE.test(target)) {
516
551
  const { readAll } = await import('../review/store.ts')
@@ -534,19 +569,17 @@ export class ReviewAddCommand extends Command {
534
569
  const [lone, ...more] = f.positionals
535
570
  if (lone !== undefined && more.length === 0 && o.title === undefined && !MEDIA_FILE.test(lone)) o.title = lone
536
571
  else if (lone !== undefined) throw new Error(`unexpected ${f.positionals.map(quoted).join(' ')}: the title is --title "<title>", the subject --image <a.png> (sk thread post --help)`)
537
- if (f.on.has('choice') && f.on.has('verdict')) throw new Error("--choice --verdict: a choice is a question, its pick is the owner's answer; post it without --verdict")
538
- if (lives.length > 0 && (f.on.has('choice') || o.trailer !== undefined || o.draft !== undefined || o.live !== undefined))
539
- throw new Error(`--live <url>: a view of a running page; never with ${f.on.has('choice') ? '--choice (ask, then post)' : o.trailer !== undefined ? '--trailer' : o.draft !== undefined ? '--draft' : '--wip --live <name>'}`)
540
- if (f.on.has('choice')) return choiceAsQuestion(h, o, views, f.many)
572
+ if (lives.length > 0 && (o.trailer !== undefined || o.draft !== undefined || o.live !== undefined))
573
+ throw new Error(`--live <url>: a view of a running page; never with ${o.trailer !== undefined ? '--trailer' : o.draft !== undefined ? '--draft' : '--wip --live <name>'}`)
541
574
  const states = await statesOfFlags(h, o, views.length > 0)
542
575
  if (images.length > 1 && !states) throw new Error('--image: one picture a version; it repeats as <view>=<a.png> only beside --after on a kind whose page draws views')
543
576
  // a version a kind's page draws shows its stills: the picture given wins over a shot of the page
544
577
  const still = states ? await stillOfFlags(h, o, states, images) : null
545
- const trailer = await trailerOfFlags(o, views.length > 0 || f.on.has('wip') || f.on.has('choice'))
578
+ const trailer = await trailerOfFlags(o, views.length > 0 || f.on.has('wip'))
546
579
  // a draft's own address with no media draws the draft itself, as --draft does: never a version of words
547
580
  const ownDraft = o.on !== undefined ? /^draft:([^/]+)$/.exec(o.on) : null
548
581
  if (ownDraft && o.draft === undefined && views.length === 0 && [o.image, o.video, o.audio, o.pano, o.before, o.after, o.live, o.trailer].every((v) => v === undefined)) o.draft = ownDraft[1]!
549
- const draft = await draftOfFlags(o, views.length > 0 || f.on.has('choice'))
582
+ const draft = await draftOfFlags(o, views.length > 0)
550
583
  const repoFlags = Object.fromEntries(own.flatMap((k) => (f.many[k] ? [[k, f.many[k]]] : [])))
551
584
  const parsed = kind?.parse ? kind.parse(Object.fromEntries(Object.keys(kind.flags ?? {}).map((k) => [k, f.many[k] ?? []]))) : null
552
585
  if (wipLine !== undefined && o.live !== undefined) throw new Error('--wip "<line>" sends a version in work; --wip --live <name> a draft on a live shot: one of the two')
@@ -588,7 +621,7 @@ export class ReviewAddCommand extends Command {
588
621
  if (problems.length > 0) throw new Error(`--changelog: the repo's guard refuses it: ${problems.join('; ')}`)
589
622
  }
590
623
  const topic = o.topic ?? parsed?.topic
591
- const doc = await docOfFlags(o, { trailer, draft, states, choice: f.on.has('choice'), wip: o.live !== undefined })
624
+ const doc = await docOfFlags(o, { trailer, draft, states, wip: o.live !== undefined })
592
625
  let input: import('../review/store.ts').AddInput = {
593
626
  title: o.title ?? '',
594
627
  what: o.what ?? '',
@@ -618,10 +651,8 @@ export class ReviewAddCommand extends Command {
618
651
  ...(o.on ? { on: o.on } : {}),
619
652
  ...((f.many.about ?? []).length > 0 ? { about: f.many.about } : {}),
620
653
  ...(f.on.has('new') ? { fresh: true } : {}),
621
- ...(f.on.has('choice') ? { choice: true } : {}),
622
654
  ...(f.on.has('keep') ? { keep: true } : {}),
623
655
  ...(f.on.has('rename') ? { rename: true as const } : {}),
624
- ...(o.pick !== undefined ? { agentPick: o.pick } : {}),
625
656
  ...(o.live !== undefined ? { image: wipViews[0]?.image ?? '', views: wipViews.slice(1), wip: { live: o.live } } : { views }),
626
657
  }
627
658
  const media = [o.image, o.video, o.audio, o.pano, o.splat, o.mesh, o.before, o.after, o.live, o.trailer, o.draft].some((v) => v !== undefined) || views.length > 0 || lives.length > 0 || states !== null || doc !== null
@@ -692,7 +723,6 @@ export class ReviewAddCommand extends Command {
692
723
  }
693
724
  if (item.draft) h.out(`draft version: ${item.draft.slug}, ${item.draft.posts.length} place${item.draft.posts.length > 1 ? 's' : ''}: ${item.draft.posts.map((p) => p.name).join(', ')}`)
694
725
  if (item.origin.by === 'agent' && !item.origin.lane) h.err(`posted ${item.id} with no lane: on the next post pass --lane <id> (or SK_AGENT), so the hub colours it; never post this one again`)
695
- if (item.choice && item.agentPick === undefined) h.err(`a choice with no pick of yours: every question carries one, sk thread pick ${item.id} <view> (or --pick on post)`)
696
726
  const { unheardLine } = await import('../review/model.ts')
697
727
  const { liveWatchers } = await import('../review/watchers.ts')
698
728
  const unheard = unheardLine(item, liveWatchers(h.dir))
@@ -803,35 +833,11 @@ async function keepStill(h: Here, item: import('../review/model.ts').Item, still
803
833
  }
804
834
  }
805
835
 
806
- /** `post --choice`, the older form of a question with media options: each view an option (its note after its label),
807
- * the title and what its words, posted as the question into the address's thread; it prints the `ask` form */
808
- async function choiceAsQuestion(h: Here, o: Record<string, string>, views: readonly ViewInput[], many: Record<string, string[]>): Promise<number> {
809
- const versionOnly = ['changelog', 'rating', 'post', 'keeps', 'supersedes', 'trailer', 'draft', 'live', 'why'].filter((k) => o[k] !== undefined)
810
- if (many.answers?.length) versionOnly.push('answers')
811
- if (versionOnly.length > 0) throw new Error(`--choice is a question now, and a question takes no ${versionOnly.map((k) => `--${k}`).join(', ')}: ask, then post the version once he picked`)
812
- if (views.some((v) => v.gallery)) throw new Error('--choice: a gallery is no option; a set he rates one by one stays a gallery version, a row per asset')
813
- if (o.on === undefined) throw new Error(NO_ADDRESS)
814
- const first = o.image ?? o.video ?? o.audio
815
- const all: ViewInput[] = [...(first !== undefined ? [{ label: o.label ?? 'option 1', image: first }] : o.before !== undefined && o.after !== undefined ? [{ label: o.label ?? 'option 1', before: o.before, after: o.after }] : []), ...views]
816
- const options = all.map((v) => ({ label: v.note?.trim() ? `${v.label}: ${v.note.trim()}` : v.label, files: v.before !== undefined && v.after !== undefined ? [v.before, v.after] : [v.image ?? v.video ?? v.audio ?? ''] }))
817
- const { viewIndexOf } = await import('../review/model.ts')
818
- const pick = o.pick === undefined ? undefined : /^\d+$/.test(o.pick) ? Number(o.pick) - 1 : viewIndexOf(all, o.pick)
819
- const text = [o.title, o.what].filter((x) => x?.trim()).join('\n') || 'which one ?'
820
- const form = `sk thread ask ${o.on} ${quoted(text.split('\n')[0]!)} ${options.map((x) => `--option ${quoted(`${x.label}=${x.files.join(',')}`)}`).join(' ')}${pick !== undefined ? ` --pick ${pick + 1}` : ''}`
821
- h.err(`post --choice is now a question: ${form}`)
822
- if (pick === undefined) h.err('no --pick: the house rule wants your pick on every question')
823
- const { postAsk } = await import('../review/store.ts')
824
- const as = o.lane
825
- const id = await idOrOpen(h, o.on, o.title ?? text, as)
826
- const m = await postAsk(h.dir, id, { who: actor(as, false, 'ask'), text, options, ...(pick !== undefined ? { pick } : {}) })
827
- h.out(`${id} asked: ${m.ask?.options.map((x, i) => `${i + 1} ${x}${m.ask?.pick === i ? ' (your pick)' : ''}`).join(' · ')}`)
828
- return 0
829
- }
830
-
831
836
  async function saidIntoThread(h: Here, item: import('../review/model.ts').Item, typed: boolean): Promise<void> {
832
837
  const { readAll } = await import('../review/store.ts')
833
838
  const { ownAddressOf, verdictOf } = await import('../review/model.ts')
834
- const { openNotesOf, threadOfItem, threadsOf } = await import('../review/threads.ts')
839
+ const { threadOfItem, threadsOf } = await import('../review/threads.ts')
840
+ const { openNotesOf } = await import('../review/thread-state.ts')
835
841
  const items = readAll(h.dir).items
836
842
  const t = threadOfItem(item.id, threadsOf(items, h.say.spec))
837
843
  const own = ownAddressOf(item, h.say.spec)
@@ -894,19 +900,20 @@ async function wordsIn(dir: string, id: string, who: string, text: string, verdi
894
900
  return appendMessage(dir, id, { who, text: t.text, asksVerdict: true }, image !== undefined ? { image } : {})
895
901
  }
896
902
 
897
- /** what an agent asked in the thread of item `id` that still waits on the owner after its reply `mine`: the owner's words
898
- * answer a question, a change or words asking the owner's verdict by themselves (model.ts wordsAnswerOf), so each line
899
- * left is one his click answers or its agent takes back; never left open under a reply that says nothing more is needed */
903
+ /** what an agent asked in the thread of item `id` that still waits on the owner after its reply `mine`: a plain reply of his
904
+ * answers nothing, so each line left is one his control answers or its agent takes back; never left open under a reply
905
+ * that says nothing more is needed */
900
906
  async function stillOpenLines(dir: string, id: string, mine: string): Promise<string[]> {
901
907
  const { readAll } = await import('../review/store.ts')
902
- const { openAsksOf, openItemVerdictsOf, threadOfItem, threadsOf } = await import('../review/threads.ts')
908
+ const { threadOfItem, threadsOf } = await import('../review/threads.ts')
909
+ const { openAsksOf, openItemVerdictsOf } = await import('../review/thread-state.ts')
903
910
  const t = threadOfItem(id, threadsOf(readAll(dir).items))
904
911
  if (t === null) return []
905
912
  const open = [...openAsksOf(t), ...openItemVerdictsOf(t)].filter((m) => m.id !== mine)
906
913
  if (open.length === 0) return []
907
914
  const one = (s: string): string => (s.length > 70 ? `${s.slice(0, 69)}…` : s)
908
915
  return [
909
- ` ${open.length} still wait${open.length > 1 ? '' : 's'} on him in this thread: his click answers ${open.length > 1 ? 'each' : 'it'}; when it asks nothing more, sk thread withdraw <id> --why "<why>" takes it back`,
916
+ ` ${open.length} still wait${open.length > 1 ? '' : 's'} on the owner in this thread: the owner's click answers ${open.length > 1 ? 'each' : 'it'}; when the owner's plain words settled it, sk thread withdraw <id> --chat "<the owner's words>"; when it asks nothing more, sk thread withdraw <id> --why "<why>"`,
910
917
  ...open.map((m) => ` ${m.id} « ${one((m.propose ? `a change of ${m.propose.on}` : (m.text ?? '')).replace(/\s+/g, ' ').trim())} »`),
911
918
  ]
912
919
  }
@@ -915,7 +922,7 @@ async function stillOpenLines(dir: string, id: string, mine: string): Promise<st
915
922
  const VERDICT_FLAG = "it waits for the owner's verdict (approve, fix, reject on it in the hub, « judge » in the inbox): a thing made that the owner approves before it ships or lands; a choice of what to do is a question, a visible change a version, never on a progress line"
916
923
 
917
924
  export class ReviewAddViewCommand extends Command {
918
- static override paths = [['review', 'add-view']]
925
+ static override paths = [['thread', 'add-view']]
919
926
  static essential = {}
920
927
  /** the flags its proxy reads, as its usage lists them: what a doc may name (RV019) */
921
928
  static proxyFlags = [...new Set(ADD_VIEW_USAGE.match(/--[a-z][a-z0-9-]*/g) ?? [])]
@@ -961,7 +968,7 @@ export class ReviewAddViewCommand extends Command {
961
968
  }
962
969
 
963
970
  export class ReviewLsCommand extends Command {
964
- static override paths = [['review'], ['review', 'ls']]
971
+ static override paths = [['thread'], ['thread', 'ls']]
965
972
  static override usage = Command.Usage({
966
973
  category: 'Review',
967
974
  description: "the active threads: status, thread id, title, address; `sk thread <verb>` runs a unit's verb",
@@ -983,7 +990,7 @@ export class ReviewLsCommand extends Command {
983
990
  const v = verbs[verb]
984
991
  if (!v) {
985
992
  const { typoOf } = await import('./family-help.ts')
986
- const own = this.cli.definitions().map((d) => d.path.split(' ')).filter((w) => w[1] === 'review' && w.length === 3).map((w) => w[2]!)
993
+ const own = this.cli.definitions().map((d) => d.path.split(' ')).filter((w) => w[1] === 'thread' && w.length === 3).map((w) => w[2]!)
987
994
  const close = typoOf(verb, [...own, ...Object.keys(verbs)], 2)
988
995
  throw new Error(`no verb « ${verb} »: ${close.length > 0 ? `did you mean ${close.map((c) => `sk thread ${c}`).join(', ')} ? ` : ''}sk thread --help lists sk's own; the repo's unit declares ${Object.keys(verbs).join(', ') || 'none'}`)
989
996
  }
@@ -1000,16 +1007,21 @@ export class ReviewLsCommand extends Command {
1000
1007
  this.context,
1001
1008
  async (h) => {
1002
1009
  const { readAll } = await import('../review/store.ts')
1003
- const { isActive, orderedThreads, statusOf } = await import('../review/threads.ts')
1010
+ const { orderedThreads, threadState } = await import('../review/thread-state.ts')
1004
1011
  const all = readAll(h.dir)
1005
1012
  for (const b of all.broken) h.err(`review: FAIL ${b.id}: ${b.error}`)
1006
- const threads = orderedThreads(all.items).filter((t) => every || isActive(t))
1013
+ const now = new Date()
1014
+ const threads = orderedThreads(all.items)
1015
+ .map((t) => ({ t, s: threadState(t, now) }))
1016
+ .filter((x) => every || x.s.active)
1007
1017
  if (threads.length === 0) h.out(every ? 'review: the store is empty' : 'review: nothing active (--all shows every thread)')
1008
1018
  const { ownAddressesOf, threadIdOf, threadTitle } = await import('../review/threads.ts')
1009
1019
  // the thread's own id, never an item's: the items' ids are `sk thread show <thread>`'s
1010
- for (const t of threads) {
1020
+ // whose move first (his with what he does, the agents', aside, done), then the head's status
1021
+ for (const { t, s } of threads) {
1011
1022
  const at = ownAddressesOf(t)[0]
1012
- h.out(`${statusOf(t.head, all.items).padEnd(17)} ${threadIdOf(t)} ${threadTitle(t)}${t.versions.length > 1 ? ` (v${t.versions.length})` : ''}${at ? ` ${at}` : ''}`)
1023
+ const move = s.turn === 'yours' || s.turn === 'aside' ? `${s.turn} ${s.wait}` : s.turn
1024
+ h.out(`${move.padEnd(13)} ${s.status.padEnd(17)} ${threadIdOf(t)} ${threadTitle(t)}${t.versions.length > 1 ? ` (v${t.versions.length})` : ''}${at ? ` ${at}` : ''}`)
1013
1025
  }
1014
1026
  return all.broken.length > 0 ? 1 : 0
1015
1027
  },
@@ -1019,7 +1031,7 @@ export class ReviewLsCommand extends Command {
1019
1031
  }
1020
1032
 
1021
1033
  export class ReviewShowCommand extends Command {
1022
- static override paths = [['review', 'show']]
1034
+ static override paths = [['thread', 'show']]
1023
1035
  static essential = { args: '<address | id>' }
1024
1036
  static override usage = Command.Usage({
1025
1037
  category: 'Review',
@@ -1030,6 +1042,7 @@ export class ReviewShowCommand extends Command {
1030
1042
  id = Option.String({ name: 'address | id' })
1031
1043
  paste = Option.Boolean('--paste', false, { description: 'the block another agent session acts on: title, repo, this command, the links' })
1032
1044
  md = Option.Boolean('--md', false, { description: 'the whole thread as markdown: its facts, then every item and message oldest first, each object whole, a superseded one in one line' })
1045
+ all = Option.Boolean('--all', false, { description: 'every message, past a recap he accepted too: a thread with one reads from it, what still waits or is owed before it kept' })
1033
1046
 
1034
1047
  async execute(): Promise<number> {
1035
1048
  return run(this.context, async (h) => {
@@ -1044,7 +1057,7 @@ export class ReviewShowCommand extends Command {
1044
1057
  const { dirname } = await import('node:path')
1045
1058
  const { pasteHosts, threadUrl } = await import('../review/paste.ts')
1046
1059
  const { pasteBlock, STATUS_LABEL } = await import('../review/model.ts')
1047
- const { statusOf } = await import('../review/threads.ts')
1060
+ const { statusOf } = await import('../review/thread-state.ts')
1048
1061
  const w = await pasteHosts(dirname(dirname(h.dir)))
1049
1062
  h.out(pasteBlock(x.item, STATUS_LABEL[statusOf(x, all.items)], { root: w.root, open: threadUrl(w.open, x.item.id), phone: w.phone ? threadUrl(w.phone, x.item.id) : null }))
1050
1063
  return 0
@@ -1064,15 +1077,21 @@ export class ReviewShowCommand extends Command {
1064
1077
  if (t === null) throw new Error(`${this.id} reads in no thread`)
1065
1078
  const { threadMarkdown } = await import('../review/thread-md.ts')
1066
1079
  const { withThreadLook } = await import('../review/refs.ts')
1067
- h.out(withThreadLook(h.say.look, () => threadMarkdown(t, mediaDir(h.dir), h.say.spec, shared.map((e) => ({ at: e.at, md: `- ${shareLine(e)}` })))).replace(/\n$/, ''))
1080
+ const md = withThreadLook(h.say.look, () => threadMarkdown(t, mediaDir(h.dir), h.say.spec, shared.map((e) => ({ at: e.at, md: `- ${shareLine(e)}` })), { all: this.all })).replace(/\n$/, '')
1081
+ h.out(md)
1068
1082
  const named = sharesNamed(dirname(dirname(h.dir)), texts, true)
1069
1083
  if (named !== null) h.out(`\n${named}`)
1084
+ // a long read: the agent may offer him a recap, never write one unasked (review/recap.ts)
1085
+ const { offerLine, offersRecap } = await import('../review/recap.ts')
1086
+ const { threadState } = await import('../review/thread-state.ts')
1087
+ const bytes = Buffer.byteLength(md)
1088
+ if (!this.all && offersRecap(bytes, threadState(t).recap)) h.err(`review: ${offerLine(bytes, address ?? x.item.id)}`)
1070
1089
  return 0
1071
1090
  }
1072
1091
  // the paths it prints are on the disk: a message's image or file the purge let go comes back first
1073
1092
  const { ensureLocal } = await import('../review/media-read.ts')
1074
1093
  await Promise.all((t ? membersOf(t) : [x]).flatMap((y) => y.thread.flatMap((m) => [...(m.image ? [m.image] : []), ...(m.files ?? []).map((g) => g.file)].map((n) => ensureLocal(h.dir, y.item.id, `thread/${n}`).catch((e: Error) => h.err(`review: WARN thread/${n}: ${e.message}`))))))
1075
- h.out(t && (t.head.item.id === x.item.id || t.answers.length > 0) ? threadDetail(t, mediaDir(h.dir), true, h.say) : detail(x, mediaDir(h.dir), true, false, h.say))
1094
+ h.out(t && (t.head.item.id === x.item.id || t.answers.length > 0) ? threadDetail(t, mediaDir(h.dir), true, { ...h.say, all: this.all }) : detail(x, mediaDir(h.dir), true, false, h.say))
1076
1095
  if (shared.length > 0) h.out([' shared with people outside (the advisors):', ...shared.map((e) => ` ${shareLine(e)}`)].join('\n'))
1077
1096
  const named = sharesNamed(dirname(dirname(h.dir)), texts)
1078
1097
  if (named !== null) h.out(named)
@@ -1092,7 +1111,7 @@ async function sessionOf(mine: boolean, session: string | undefined): Promise<st
1092
1111
  }
1093
1112
 
1094
1113
  export class ReviewInboxCommand extends Command {
1095
- static override paths = [['review', 'inbox']]
1114
+ static override paths = [['thread', 'inbox']]
1096
1115
  static essential = {}
1097
1116
  static override usage = Command.Usage({
1098
1117
  category: 'Review',
@@ -1117,7 +1136,8 @@ export class ReviewInboxCommand extends Command {
1117
1136
  // as a hook: the same run as the hook's own boot (cli.ts)
1118
1137
  if (input != null) return (await import('./inbox-hook-run.ts')).inboxHook(h, input)
1119
1138
  const { selectInbox, selectedText } = await import('../review/inbox-read.ts')
1120
- const { followedIds, hears, listenersOf, sinceHeLeft, threadByItem, threadsOf } = await import('../review/threads.ts')
1139
+ const { followedIds, hears, listenersOf, threadByItem, threadsOf } = await import('../review/threads.ts')
1140
+ const { sinceHeLeft } = await import('../review/thread-state.ts')
1121
1141
  const { untakenLine } = await import('../review/format.ts')
1122
1142
  const { liveWatchers } = await import('../review/watchers.ts')
1123
1143
  await pull(h)
@@ -1137,13 +1157,15 @@ export class ReviewInboxCommand extends Command {
1137
1157
  const mine = { ...here, say: { ...here.say, to: (x: import('../review/model.ts').ReviewItem, m: import('../review/model.ts').Message) => wordReaches({ session, lane }, x, m, named, parties) } }
1138
1158
  const sel = selectInbox(mine, (x, byItem) => hears({ session, lane }, x, byItem, parties), { all: this.all, subject: this.subject })
1139
1159
  if (sel.threads.length === 0 && sel.news.length === 0) h.out('review: no unseen feedback or reply')
1140
- for (const g of sel.threads) h.out(`${selectedText(mine, g)}\n`)
1141
- const { ownAddressOf, verdictOf } = await import('../review/model.ts')
1160
+ const { oncePerBurst } = await import('../review/speaker.ts')
1161
+ const noted = oncePerBurst()
1162
+ for (const g of sel.threads) h.out(noted(`${selectedText(mine, g)}\n`))
1163
+ const { STATUS_LABEL, TONE_ASKS, verdictOf } = await import('../review/model.ts')
1164
+ // each tone says what it owes (model.ts TONE_ASKS), then the way out of any of them
1142
1165
  const owedLine = (t: (typeof sel.owed)[number]): string => {
1143
1166
  const x = t.head
1144
- const fix = verdictOf(x)?.status === 'approved-with-fix'
1145
- const close = fix ? `sk thread fixed ${x.item.id} "<what changed>"` : `its next version, sk thread post ${ownAddressOf(x.item, h.say.spec) ?? x.item.id} …`
1146
- return ` ${x.item.id} ${fix ? 'ok with a fix' : 'rejected'} "${x.item.title}": ${close}, or sk thread wontfix ${x.item.id} --note "<why>"`
1167
+ const v = verdictOf(x)?.status ?? 'rework'
1168
+ return ` ${x.item.id} ${STATUS_LABEL[v]} "${x.item.title}": ${TONE_ASKS[v].replace('<id>', x.item.id)}; or sk thread wontfix ${x.item.id} --note "<why>"`
1147
1169
  }
1148
1170
  if (sel.owed.length > 0) h.out(`owed, read and not done:\n${sel.owed.map(owedLine).join('\n')}\n`)
1149
1171
  // the threads this process's session or lane holds whose move is the agents' (review/inbox-read.ts heldOwedLines)
@@ -1159,7 +1181,7 @@ export class ReviewInboxCommand extends Command {
1159
1181
  const byItem = threadByItem(threadsOf(here.items, h.say.spec))
1160
1182
  const followed = followedIds(here.items)
1161
1183
  const untaken = here.items.flatMap((x) => {
1162
- const why = untakenOf(x, followed.has(x.item.id), listenersOf(watchers, x, byItem).length > 0, new Date(), h.say.spec.dispatcher)
1184
+ const why = untakenOf(x, followed.has(x.item.id), listenersOf(watchers, x, byItem).length > 0, new Date())
1163
1185
  return why === null ? [] : [untakenLine(x, why, null)]
1164
1186
  })
1165
1187
  if (untaken.length > 0) h.out(`not taken:\n${untaken.join('\n')}\n`)
@@ -1191,25 +1213,17 @@ async function seenRefused(dir: string, id: string, as: string | undefined): Pro
1191
1213
  return { refused: seenRefusal(x, t, me, parties), ...(only !== undefined ? { only } : {}) }
1192
1214
  }
1193
1215
 
1194
- /** the line the owner reads at the bottom of the thread of item `id` now, in its dock (review/expect.ts expectOf, the
1195
- * hub's own): an agent's words never contradict it */
1216
+ /** what is expected of the owner on the thread of item `id` now (review/expect.ts expectOf, the band the hub's lists
1217
+ * read too): an agent's words never contradict it */
1196
1218
  async function headLine(dir: string, id: string): Promise<string | null> {
1197
1219
  const { readAll } = await import('../review/store.ts')
1198
1220
  const { threadOfItem, threadsOf } = await import('../review/threads.ts')
1199
- const { threadView, waitsOnOwner } = await import('../review/cells.ts')
1200
- const { expectOf, waitLinesOf } = await import('../review/expect.ts')
1201
- const { validatedOf } = await import('../review/band.ts')
1202
- const items = readAll(dir).items
1203
- const threads = threadsOf(items)
1204
- const t = threadOfItem(id, threads)
1221
+ const { expectOf } = await import('../review/expect.ts')
1222
+ const { threadState } = await import('../review/thread-state.ts')
1223
+ const t = threadOfItem(id, threadsOf(readAll(dir).items))
1205
1224
  if (t === null) return null
1206
- const v = threadView(t, items, threads, t.head.item.id)
1207
- const head = v.cells.find((c) => c.id === v.head && c.kind === 'version')
1208
- const version = v.waits && v.state.state !== 'closed' && head?.kind === 'version' ? { id: head.id, n: head.n } : null
1209
- const waiting = waitLinesOf(v.cells.filter(waitsOnOwner), version, v.ask ? { state: v.ask.state, title: v.ask.title, head: v.head } : undefined)
1210
1225
  const { parties } = await callerParties(dir, t, undefined)
1211
- const e = expectOf({ ...v, waiting, ...(v.aside ? { aside: v.aside } : {}), validated: validatedOf({ turn: v.turn, status: v.status, ...(v.ask ? { ask: v.ask.state } : {}) }) }, parties)
1212
- return `the owner reads at the bottom of the thread: « ${e.words} »: your words never say otherwise`
1226
+ return `expected of the owner now: « ${expectOf(threadState(t), parties).words} »: your words never say otherwise`
1213
1227
  }
1214
1228
 
1215
1229
  /** the caller and the parties its thread's holder names */
@@ -1267,7 +1281,7 @@ export async function mayHoldItem(dir: string, id: string, as?: string): Promise
1267
1281
  }
1268
1282
 
1269
1283
  export class ReviewSeenCommand extends Command {
1270
- static override paths = [['review', 'seen']]
1284
+ static override paths = [['thread', 'seen']]
1271
1285
  static essential = { args: '<address | ids>' }
1272
1286
  static override usage = Command.Usage({ category: 'Review', description: 'mark his new words read as you read them: by id, or a whole thread by its address', details: DETAILS })
1273
1287
  ids = Option.Rest({ required: 1, name: 'address | id' })
@@ -1392,6 +1406,127 @@ export class ThreadTagCommand extends Command {
1392
1406
  }
1393
1407
  }
1394
1408
 
1409
+ export class ThreadRenameCommand extends Command {
1410
+ static override paths = [['thread', 'rename']]
1411
+ static essential = { args: '<address | id> "<title>"' }
1412
+ static override usage = Command.Usage({
1413
+ category: 'Review',
1414
+ description: 'rename a thread on purpose, when asked in it too: a trace line says who renamed it from what to what',
1415
+ details: `${DETAILS}\n\nA thread's name is its first title (the opening words, else its first version's) until a rename on purpose: this verb, a version posted with --rename, or the owner's double click on the title at the thread's head. Never a second thread for the same conversation. The thread shows « <who> renamed the thread: « old » → « new » ». An ask's thread is named by its instructions (sk ask edit).`,
1416
+ examples: [['asked « rename the thread to something meaningful »', 'SK_AGENT=L4 sk thread rename talk:20261128-a-new-thread-233927 "Avoirs normalisés : le plan"']],
1417
+ })
1418
+ ref = Option.String({ name: 'address | id' })
1419
+ title = Option.String({ name: 'title' })
1420
+ as = Option.String('--as', { description: 'who renames it (else SK_AGENT)' })
1421
+
1422
+ async execute(): Promise<number> {
1423
+ return run(this.context, async (h) => {
1424
+ const { renameThread } = await import('../review/close.ts')
1425
+ const id = await idOf(h.dir, this.ref)
1426
+ const r = renameThread(h.dir, id, callerLane(this.as) ?? 'agent', this.title)
1427
+ h.out(r.from === r.to ? `${this.ref}: named « ${r.to} » already, nothing to rename` : `${this.ref}: renamed « ${r.from} » → « ${r.to} »`)
1428
+ return 0
1429
+ })
1430
+ }
1431
+ }
1432
+
1433
+ export class ThreadSuggestMoveCommand extends Command {
1434
+ static override paths = [['thread', 'suggest-move']]
1435
+ static essential = { args: '<address | id> <repo> "<why>"' }
1436
+ static override usage = Command.Usage({
1437
+ category: 'Review',
1438
+ description: 'a thread raised in the wrong project: ask the owner to move it, his one click moves it whole',
1439
+ details: `${DETAILS}\n\nPosts one question in the thread, « This is about <repo>: move it there? », its options « move to <repo> » (your pick) and « keep it here ». His click on « move to <repo> » moves the thread whole into that repo's threads: every item, message, answer and file, ids and times kept, a trace line on both sides, its old address and ids pointing to the new place. Its holder lets go there, and that repo's default session hears it. A thread whose subject is another house repo's: this is the answer from here; a reply or a reflection never replaces it. Only he moves a thread. An ask's or a blocked command's thread stays in its repo. The same question typed with sk thread ask and those two options acts the same.`,
1440
+ examples: [['his note about the toolkit, raised in a game repo', `SK_AGENT=L4 sk thread suggest-move talk:20261129-traces-should-be-dimmed toolkit "the hub's code lives in the toolkit repo"`]],
1441
+ })
1442
+ ref = Option.String({ name: 'address | id' })
1443
+ repo = Option.String({ name: 'repo' })
1444
+ why = Option.String({ name: 'why', required: false })
1445
+ as = Option.String('--as', { description: 'who asks (else SK_AGENT)' })
1446
+
1447
+ async execute(): Promise<number> {
1448
+ return run(this.context, async (h) => {
1449
+ const { houseRootOf, suggestMoveQuestion } = await import('../review/move.ts')
1450
+ const { postAsk } = await import('../review/store.ts')
1451
+ const { rootOfStore } = await import('../review/close.ts')
1452
+ const { repoNameOf } = await import('../agent-time/registry.ts')
1453
+ const root = rootOfStore(h.dir)
1454
+ if (this.repo === repoNameOf(root)) throw new Error(`the thread is in ${this.repo} already`)
1455
+ if (houseRootOf(root, this.repo) === null) throw new Error(`${this.repo}: no house repo of that name (sk global-context lists them)`)
1456
+ const id = await idOf(h.dir, this.ref)
1457
+ const on = (await import('../review/store.ts')).readItem(h.dir, id)?.item.on ?? ''
1458
+ if (/^(ask|blocked):/.test(on)) throw new Error(`${on}: an ask's or a blocked command's thread stays in the repo whose record it is, so it never moves`)
1459
+ const m = await postAsk(h.dir, id, { who: actor(this.as, false, 'ask'), ...suggestMoveQuestion(this.repo, this.why ?? '') })
1460
+ h.out(`${id} asked: « move to ${this.repo} » (your pick) · « keep it here »; his click on the first moves the thread (${m.id})`)
1461
+ return 0
1462
+ })
1463
+ }
1464
+ }
1465
+
1466
+ export class ThreadCloseCommand extends Command {
1467
+ static override paths = [['thread', 'close']]
1468
+ static essential = { args: '<address | id> "<why, one line>"' }
1469
+ static override usage = Command.Usage({
1470
+ category: 'Review',
1471
+ description: 'close a conversation you finished, nothing in it left to judge; « reopen » in the hub undoes it',
1472
+ details: `${DETAILS}\n\nWords saying a thread is done leave it in the owner's turn: this closes it. Its status becomes done (« closed · done » at its head, « reopen » beside it), each version of words that waited on a verdict reads « no verdict needed: closed by <who> », and the thread shows « <who> closed the thread: <why> ». Refused, each named with its id, while something in it waits on the owner: a question, a change, words asking a verdict, a version with media to judge (a picture, a clip, a sound), an object that holds it open on the owner (a branch to merge); and on an ask's thread (sk asks done).`,
1473
+ examples: [['the work asked is live, nothing waits on the owner', 'SK_AGENT=L4 sk thread close talk:20261128-point-complet "everything this point asked is live"']],
1474
+ })
1475
+ ref = Option.String({ name: 'address | id' })
1476
+ why = Option.String({ name: 'why' })
1477
+ as = Option.String('--as', { description: 'who closes it (else SK_AGENT)' })
1478
+
1479
+ async execute(): Promise<number> {
1480
+ return run(this.context, async (h) => {
1481
+ const { agentClose } = await import('../review/close.ts')
1482
+ const id = await idOf(h.dir, this.ref)
1483
+ const r = agentClose(h.dir, id, callerLane(this.as) ?? 'agent', this.why)
1484
+ h.out(`${this.ref}: closed as done${r.versions.length > 0 ? `, ${r.versions.length} older version${r.versions.length > 1 ? 's' : ''} need no verdict` : ''}; his « reopen » brings it back`)
1485
+ return 0
1486
+ })
1487
+ }
1488
+ }
1489
+
1490
+ export class ThreadRecapCommand extends Command {
1491
+ static override paths = [['thread', 'recap']]
1492
+ static essential = { args: '<address | id> --body <file | -> | --offer' }
1493
+ static override usage = Command.Usage({
1494
+ category: 'Review',
1495
+ description: 'a recap of a long thread he asked for, which he judges; accepted, every reader starts at it',
1496
+ details: `${DETAILS}\n\nThe recap's markdown holds four sections in this order, each one at least a line: ## Decided (what was settled, the owner's words quoted where they set a rule), ## Live now (what stands now), ## Open (each line « - <who>: <what> », who owes it: owner or a lane; or « - none »), ## Links (each line names the id of a version or a message of this thread in backticks; or « - none »). The verb refuses a body missing a section, an open line that names nobody, a link to no id of the thread. It asks the owner's verdict like a version (ok, ok with a fix, rework…); a recap still waiting on that verdict is superseded by the new one. Once the owner accepts it (ok, or ok with a fix), sk thread show (and --md), the inbox and its hook read from it on; what still waits on the owner or is owed before it stays listed; --all on show reads every message. Nothing is deleted. Write one only when the owner asks (« recap » in the hub, or a yes to --offer); --offer asks in one click, once, for a thread whose show --md passes about 15 KB, and a « not now » stands. Page: wiki tools/shipkit/threads.md, A recap`,
1497
+ examples: [
1498
+ ['the recap the owner asked for', 'SK_AGENT=L4 sk thread recap talk:20261129-romcom-words --body recap.md'],
1499
+ ['offer one on a long thread', 'sk thread recap talk:20261129-romcom-words --offer'],
1500
+ ],
1501
+ })
1502
+ ref = Option.String({ name: 'address | id' })
1503
+ body = Option.String('--body', { description: 'the recap as markdown: a file, or - for stdin' })
1504
+ offer = Option.Boolean('--offer', false, { description: 'ask the owner « recap this thread? » in one click, your pick yes; never a recap the owner did not ask for' })
1505
+ as = Option.String('--as', { description: 'who writes it (else SK_AGENT)' })
1506
+
1507
+ async execute(): Promise<number> {
1508
+ return run(this.context, async (h) => {
1509
+ if (this.offer === (this.body !== undefined)) throw new Error('one of --body <file | -> (the recap the owner asked for) or --offer (ask the owner first)')
1510
+ const { agentName, postAsk, postRecap } = await import('../review/store.ts')
1511
+ const id = await idOf(h.dir, this.ref)
1512
+ const who = callerLane(this.as) ?? agentName()
1513
+ if (this.offer) {
1514
+ const { RECAP_OFFER_WORDS } = await import('../review/recap.ts')
1515
+ const q = await postAsk(h.dir, id, { who, text: RECAP_OFFER_WORDS, options: ['yes, recap it', 'not now'], pick: 0 })
1516
+ h.out(`${this.ref}: ${q.id} asks the owner for a recap; the owner's yes is the request: then sk thread recap ${this.ref} --body <file>`)
1517
+ return 0
1518
+ }
1519
+ const { readFileSync } = await import('node:fs')
1520
+ const text = this.body === '-' ? await new Response(Bun.stdin.stream()).text() : readFileSync(this.body!, 'utf8')
1521
+ const m = postRecap(h.dir, id, { who, text })
1522
+ h.out(`${this.ref}: the recap ${m.id} waits on the owner's verdict${m.replaces ? `, superseding ${m.replaces}` : ''}; accepted, every reader starts at it`)
1523
+ const said = await headLine(h.dir, id)
1524
+ if (said !== null) h.out(said)
1525
+ return 0
1526
+ })
1527
+ }
1528
+ }
1529
+
1395
1530
  export class ThreadTakeCommand extends Command {
1396
1531
  static override paths = [['thread', 'take']]
1397
1532
  static essential = { args: '<address | id>' }
@@ -1472,7 +1607,7 @@ export class ThreadAssignCommand extends Command {
1472
1607
  }
1473
1608
 
1474
1609
  export class ReviewReplyCommand extends Command {
1475
- static override paths = [['review', 'reply']]
1610
+ static override paths = [['thread', 'reply']]
1476
1611
  static essential = { args: '<address | id> <text>' }
1477
1612
  static override usage = Command.Usage({ category: 'Review', description: "your message in a thread: what you changed, the answer to his question", details: `${DETAILS}\n\nBy address, the words answer his newest open note in the thread (the one sk thread fixed closes), else its newest version; by id, that item.` })
1478
1613
  id = Option.String({ name: 'address | id' })
@@ -1517,7 +1652,7 @@ export class ReviewReplyCommand extends Command {
1517
1652
  }
1518
1653
 
1519
1654
  export class ReviewUpdateCommand extends Command {
1520
- static override paths = [['review', 'update']]
1655
+ static override paths = [['thread', 'update']]
1521
1656
  static essential = { args: '<address | id> [state] <text>' }
1522
1657
  static override usage = Command.Usage({
1523
1658
  category: 'Review',
@@ -1570,11 +1705,9 @@ export class ReviewUpdateCommand extends Command {
1570
1705
  // an update goes where he reads: the thread's newest version
1571
1706
  const id = threadOfId(asked, threadsOf(readAll(h.dir).items))?.head.item.id ?? asked
1572
1707
  const r = await postUpdate(h.dir, id, { who: callerLane(this.as) ?? agentName(), state: this.state, text: this.text, files: this.files, ...(this.keep ? { keep: true } : {}) })
1573
- const { viewNo, stateOf } = await import('../review/model.ts')
1574
- const { readItem } = await import('../review/store.ts')
1575
- const x = readItem(h.dir, id)
1576
- const now = x && stateOf(x, false).state === 'asks' ? "waits for the owner's verdict" : x && stateOf(x, false).state === 'draft' ? 'in progress, no verdict asked' : 'in work'
1577
- h.out(`${id}: ${r.tag}${r.view !== null ? `, view ${viewNo(r.view)}` : ''}${id !== asked ? ` (on the newest version, ${asked} is older)` : ''}; the version ${now}`)
1708
+ const { viewNo } = await import('../review/model.ts')
1709
+ // where the thread stands is the head line's to say, from its state
1710
+ h.out(`${id}: ${r.tag}${r.view !== null ? `, view ${viewNo(r.view)}` : ''}${id !== asked ? ` (on the newest version, ${asked} is older)` : ''}`)
1578
1711
  const said = await headLine(h.dir, id)
1579
1712
  if (said !== null) h.out(said)
1580
1713
  if (r.view !== null) for (const line of await (await import('../review/previews.ts')).playCopies(h.dir, r.item, r.view)) h.err(line)
@@ -1588,11 +1721,11 @@ export class ReviewUpdateCommand extends Command {
1588
1721
  }
1589
1722
 
1590
1723
  export class ReviewWithdrawCommand extends Command {
1591
- static override paths = [['review', 'withdraw']]
1724
+ static override paths = [['thread', 'withdraw']]
1592
1725
  static override usage = Command.Usage({
1593
1726
  category: 'Review',
1594
1727
  description: 'take back what an agent posted, with the reason: a version by its id, or one message by its id',
1595
- details: `${DETAILS}\n\nA version (or any other item of a thread) withdrawn asks nothing more: its open questions, changes and words asking the owner's verdict wait on nobody with it. A message id (sk thread show prints them) takes back that one question, change or words alone, a reply posted by mistake included. A thread (its address, or its own id t-…) is refused with the ids of its items: name the one you mean. What the owner wrote or raised is never withdrawn by an agent. --chat "<the owner's words>": the owner answered it in chat, outside the thread; the words are the reason, quoted, so it never stays open in the hub. The owner's words in the thread itself need nothing: they answer what an agent asked before them on that item (a question, a change, words asking the owner's verdict) by themselves, « answered in words ».`,
1728
+ details: `${DETAILS}\n\nA version (or any other item of a thread) withdrawn asks nothing more: its open questions, changes and words asking the owner's verdict wait on nobody with it. A message id (sk thread show prints them) takes back that one question, change or words alone, a reply posted by mistake included. A thread (its address, or its own id t-…) is refused with the ids of its items: name the one you mean. What the owner wrote or raised is never withdrawn by an agent. --chat "<the owner's words>": the owner's words settled it outside its own control, in chat or in a plain reply of the thread; the words are the reason, quoted, so it never stays open in the hub. A plain reply of the owner's never answers a question, a change or words asking the owner's verdict by itself: the agent that acts on the owner's words closes what they settled with --chat.`,
1596
1729
  examples: [
1597
1730
  ['a version taken back', 'sk thread withdraw 20261120-101500-the-logo --why "a newer one follows"'],
1598
1731
  ['he answered the question in chat', 'sk thread withdraw 20261120-223154-747-agent-vg49 --chat "B only, keep both kill matrices"'],
@@ -1600,7 +1733,7 @@ export class ReviewWithdrawCommand extends Command {
1600
1733
  })
1601
1734
  ids = Option.Rest({ required: 1 })
1602
1735
  why = Option.String('--why,--note', { required: false, description: 'why it goes (--note says the same, as on fixed, wontfix, blocked and drop)' })
1603
- chat = Option.String('--chat', { required: false, description: 'the owner answered it in chat: the words become the reason, quoted' })
1736
+ chat = Option.String('--chat', { required: false, description: 'the owner settled it in his own words, in chat or in a plain reply of the thread: the words become the reason, quoted' })
1604
1737
 
1605
1738
  async execute(): Promise<number> {
1606
1739
  return run(this.context, async (h) => {
@@ -1627,7 +1760,7 @@ export class ReviewWithdrawCommand extends Command {
1627
1760
  }
1628
1761
 
1629
1762
  export class ReviewReopenCommand extends Command {
1630
- static override paths = [['review', 'reopen']]
1763
+ static override paths = [['thread', 'reopen']]
1631
1764
  static override usage = Command.Usage({ category: 'Review', description: 'an answered version waits for his answer again; the old verdict stays in the thread', details: DETAILS })
1632
1765
  ids = Option.Rest({ required: 1 })
1633
1766
 
@@ -1648,48 +1781,23 @@ export class ReviewReopenCommand extends Command {
1648
1781
  }
1649
1782
  }
1650
1783
 
1651
- export class ReviewPickCommand extends Command {
1652
- static override paths = [['review', 'pick']]
1653
- /** for an older choice version: a question's pick is fixed when it is asked */
1654
- static older = true
1655
- static override usage = Command.Usage({
1656
- category: 'Review',
1657
- description: "the option you suggest on a choice he has not answered: the hub's « my pick » pill on it",
1658
- details: `${DETAILS}\n\nsk thread pick <id> <view>: the view by its letter (B) or its label; one pick a version, a new one replaces it; for an older choice version (a question's pick is fixed at ask).`,
1659
- examples: [['suggest the second option', 'sk thread pick <id> B'], ['by its label', 'sk thread pick <id> "Zen Garden"']],
1660
- })
1661
- id = Option.String({ required: true })
1662
- view = Option.String({ required: true })
1663
-
1664
- async execute(): Promise<number> {
1665
- return run(this.context, async (h) => {
1666
- const { setAgentPick } = await import('../review/store.ts')
1667
- const { viewNo, viewName } = await import('../review/model.ts')
1668
- const id = await idOf(h.dir, this.id)
1669
- const item = setAgentPick(h.dir, id, this.view)
1670
- const n = item.agentPick ?? 0
1671
- h.out(`${id}: my pick ${viewNo(n)} "${viewName(item.views[n], n)}"`)
1672
- return 0
1673
- })
1674
- }
1675
- }
1784
+ type VerbOp = 'wontfix' | 'claim' | 'release' | 'done' | 'ask'
1676
1785
 
1677
- type ActOp = 'fixed' | 'wontfix' | 'claim' | 'release' | 'blocked' | 'done' | 'dispatch' | 'ask' | 'drop' | 'reassign'
1678
-
1679
- /** one state change: by a worker on its claim, or by the dispatcher on what it routes; the item, then the new state */
1680
- function actCommand(op: ActOp, description: string, o: { note?: 'required' | 'optional'; text?: string; topic?: 'required' | 'optional'; named: boolean; examples: [string, string][] }) {
1786
+ /** a question, or one state change by a worker on its claim; the item, then the new state */
1787
+ function actCommand(op: VerbOp, description: string, o: { note?: 'required' | 'optional'; text?: string; named: boolean; examples: [string, string][] }) {
1681
1788
  return class extends Command {
1682
- static override paths = [['review', op]]
1789
+ static override paths = [['thread', op]]
1683
1790
  static essential = op === 'ask' ? { args: '<address | id> "<question>" --option … --pick <n>' } : undefined
1684
1791
  static gloss = op === 'done' ? 'the old name of fixed' : undefined
1685
1792
  static older = op === 'done' ? true : undefined
1686
1793
  static override usage = Command.Usage({ category: 'Review', description, details: `${DETAILS}\n\nTakes an item id or a player report's ref (live#3). ${o.named ? 'Who acts: --as <name>, else SK_AGENT.' : 'Who acts: --as, else SK_AGENT, else agent.'}`, examples: o.examples })
1687
1794
  id = Option.String({ name: 'address | id' })
1688
- words = o.text !== undefined || o.topic !== undefined ? Option.String({ required: false, name: o.text ?? 'topic' }) : undefined
1795
+ words = o.text !== undefined ? Option.String({ required: false, name: o.text }) : undefined
1689
1796
  note = o.note === 'required' ? Option.String('--note', { required: true, description: 'what was done, why not, or what is needed' }) : Option.String('--note', { description: 'what was done, or the reason' })
1690
1797
  commit = Option.String('--commit', { description: 'the commit that holds the fix' })
1691
1798
  as = Option.String('--as', { description: 'who acts (else SK_AGENT)' })
1692
- options = op === 'ask' ? Option.Array('--option', { description: 'a question he answers in one click: each option (two or more), words, a file (a picture, a clip, a sound: its name the label), "<label>=<file>" or "<label>=<before>,<after>"; any agent asks this way, the dispatcher asks without' }) : undefined
1799
+ rows = op === 'ask' ? Option.Array('--row', { description: 'one pick per thing in one question: each --row "<thing>" opens a row, the --option and --pick after it are its own; he clicks one option a row (eight words, each with its shape candidates: one question, eight rows)' }) : undefined
1800
+ options = op === 'ask' ? Option.Array('--option', { description: 'a question he answers in one click: each option (two or more), words, a file (a picture, a clip, a sound: its name the label), "<label>=<file>" or "<label>=<before>,<after>"' }) : undefined
1693
1801
  pick = op === 'ask' ? Option.String('--pick', { description: 'with --option: the option you pick, by its number from 1 (the house rule: a pick on every question)' }) : undefined
1694
1802
  checklist = op === 'ask' ? Option.Array('--checklist', { description: 'a checklist he ticks, line by line, over days: each line a step, words on one line (markdown: bold, a link, code)' }) : undefined
1695
1803
  confirm = op === 'ask' ? Option.Boolean('--confirm', false, { description: 'one step he does in the real world: he answers « done »' }) : undefined
@@ -1746,7 +1854,7 @@ function actCommand(op: ActOp, description: string, o: { note?: 'required' | 'op
1746
1854
  h.out(` set aside until ${until.toLocaleString()}: out of his turn until then`)
1747
1855
  }
1748
1856
 
1749
- /** the answer kind the flags name, null for none (a choice through --option, or the dispatcher's question) */
1857
+ /** the answer kind the flags name, null for none (a choice through --option or --row) */
1750
1858
  kindFlags(): { kind: AnswerKind; label: string } | null {
1751
1859
  const named = [
1752
1860
  ...((this.checklist?.length ?? 0) > 0 ? [{ kind: 'checklist' as const, label: '--checklist' }] : []),
@@ -1770,6 +1878,10 @@ function actCommand(op: ActOp, description: string, o: { note?: 'required' | 'op
1770
1878
  const { postAsk } = await import('../review/store.ts')
1771
1879
  const { askStateText } = await import('../review/answer-kinds.ts')
1772
1880
  if (!this.words?.trim()) throw new Error(`ask <address | id> "<what you ask>" ${k.label}`)
1881
+ if (k.kind === 'text') {
1882
+ const letters = (await import('../review/instruction-guards.ts')).lettersAsText(this.words)
1883
+ if (letters !== null) h.err(`« ${letters} »: a typed answer stands in for picks; one question with a row per thing shows each option with its picture, one click a row: --row "<thing>" --option "<label>=<file>" … --pick <n> (wiki tools/shipkit/threads-essentials.md, Which object for which need)`)
1884
+ }
1773
1885
  if (k.kind === 'secret') {
1774
1886
  const joined = (await import('../review/instruction-guards.ts')).joinedSecretAsk(this.words)
1775
1887
  if (joined !== null) throw new Error(`« ${joined} » asks him for two values as one: one field a value, so ask twice, a --secret each with its own name (wiki tools/shipkit/threads-instructions.md, A field inside a step)`)
@@ -1787,6 +1899,32 @@ function actCommand(op: ActOp, description: string, o: { note?: 'required' | 'op
1787
1899
  if (k.kind === 'secret') h.out(` his answer reads « stored as ${m.ask?.secret?.name} »; then: sk secret get ${m.ask?.secret?.name}`)
1788
1900
  return 0
1789
1901
  }
1902
+ if (op === 'ask' && (this.rows?.length ?? 0) > 0) {
1903
+ const { postAsk } = await import('../review/store.ts')
1904
+ if (!this.words?.trim()) throw new Error('ask <address | id> "<question>" --row "<thing>" --option "<a>" --option "<b>" --pick <n> --row …')
1905
+ // the rows are read in the order typed, as propose reads its fields (process.argv after `ask`)
1906
+ const raw = process.argv.slice(2)
1907
+ const from = raw.indexOf('ask')
1908
+ if (from < 0) throw new Error('--row: the rows are read in the order typed, from the command line')
1909
+ const rows = askRowsOf(raw.slice(from + 1))
1910
+ if (rows.length !== this.rows!.length) throw new Error(`--row: ${this.rows!.length} rows typed, ${rows.length} read`)
1911
+ const at = await this.target(h, { kind: 'choice' })
1912
+ const { id, replaces } = at
1913
+ const unpicked = rows.filter((r) => r.pick === undefined).map((r) => r.label)
1914
+ if (unpicked.length > 0) h.err(`no --pick on ${unpicked.join(', ')}: the house rule wants your pick on every row`)
1915
+ const group = crypto.randomUUID().slice(0, 12)
1916
+ const who = actor(this.as, false, op)
1917
+ const posted = []
1918
+ for (const [i, r] of rows.entries()) {
1919
+ const m = await postAsk(h.dir, id, { who, text: this.words, options: r.options.map(askOption), ...(r.pick !== undefined ? { pick: r.pick } : {}), row: { group, i, n: rows.length, label: r.label }, ...(i === 0 && replaces ? { replaces } : {}) })
1920
+ posted.push(m)
1921
+ }
1922
+ h.out(`${id} asked ${rows.length} rows, one pick each:`)
1923
+ for (const m of posted) h.out(` ${m.ask!.row!.label}: ${m.ask!.options.map((o, i) => `${i + 1} ${o}${m.ask?.views?.[i] != null ? ' [media]' : ''}${m.ask?.pick === i ? ' (your pick)' : ''}`).join(' · ')}`)
1924
+ await this.withdrawOlder(h, at, posted[0]!.id)
1925
+ await this.later(h, id)
1926
+ return 0
1927
+ }
1790
1928
  if (op === 'ask' && this.options !== undefined) {
1791
1929
  const { postAsk } = await import('../review/store.ts')
1792
1930
  if (!this.words?.trim()) throw new Error('ask <address | id> "<question>" --option "<a>" --option "<b>" --pick <n>')
@@ -1794,17 +1932,18 @@ function actCommand(op: ActOp, description: string, o: { note?: 'required' | 'op
1794
1932
  const { id, replaces } = at
1795
1933
  const pick = this.pick === undefined ? undefined : Number(this.pick) - 1
1796
1934
  if (pick === undefined) h.err('no --pick: the house rule wants your pick on every question')
1797
- const m = await postAsk(h.dir, id, { who: actor(this.as, false, op), text: this.words, options: this.options.map(askOption), ...(pick !== undefined ? { pick } : {}), ...(replaces ? { replaces } : {}) })
1935
+ const move = (await import('../review/move.ts')).moveOfOptions(this.options)
1936
+ const m = await postAsk(h.dir, id, { who: actor(this.as, false, op), text: this.words, options: this.options.map(askOption), ...(pick !== undefined ? { pick } : {}), ...(replaces ? { replaces } : {}), ...(move !== null ? { move } : {}) })
1798
1937
  h.out(`${id} asked: ${m.ask?.options.map((o, i) => `${i + 1} ${o}${m.ask?.views?.[i] != null ? ' [media]' : ''}${m.ask?.pick === i ? ' (your pick)' : ''}`).join(' · ')}`)
1799
1938
  await this.withdrawOlder(h, at, m.id)
1800
1939
  await this.later(h, id)
1801
1940
  return 0
1802
1941
  }
1942
+ if (op === 'ask') throw new Error('ask <address | id> "<question>" with its answer kind: --option "<a>" --option "<b>" --pick <n>, --row, --checklist, --confirm, --text, --url or --secret <name>')
1803
1943
  const { stateOf } = await import('../review/model.ts')
1804
1944
  const { detail } = await import('../review/format.ts')
1805
- if (this.words !== undefined && o.text === undefined && o.topic === undefined) throw new Error(`unexpected ${this.words}`)
1945
+ if (this.words !== undefined && o.text === undefined) throw new Error(`unexpected ${this.words}`)
1806
1946
  if (o.text && !this.words?.trim()) throw new Error(`${op} <id> "<${o.text}>"`)
1807
- if (o.topic === 'required' && !this.words) throw new Error(`${op} <id> <topic> (sk thread topics)`)
1808
1947
  const id = await idOf(h.dir, this.id)
1809
1948
  const who = actor(this.as, o.named, op)
1810
1949
  if (op === 'wontfix') {
@@ -1835,13 +1974,11 @@ function actCommand(op: ActOp, description: string, o: { note?: 'required' | 'op
1835
1974
  if (st?.state === 'asks' || st?.state === 'draft')
1836
1975
  throw new Error(`${id}: done closes a version the owner answered « fix »; this one ${st.state === 'asks' ? "waits on the owner's verdict" : 'is in progress'}: sk thread withdraw ${id} --why "<why>" takes it back`)
1837
1976
  }
1838
- const holds = op === 'done' || op === 'wontfix' || op === 'release' || op === 'blocked' || op === 'fixed' ? await callerHolds(h.dir, id, this.as) : false
1977
+ const holds = op === 'done' || op === 'wontfix' || op === 'release' ? await callerHolds(h.dir, id, this.as) : false
1839
1978
  act(h.dir, id, op, who, {
1840
1979
  holds,
1841
1980
  ...(this.note ? { note: this.note } : {}),
1842
- ...(op === 'ask' && this.words ? { text: this.words } : {}),
1843
1981
  ...(op === 'done' && this.words ? { note: this.words } : {}),
1844
- ...(o.topic && this.words ? { topic: this.words } : {}),
1845
1982
  ...(this.commit ? { commit: this.commit } : {}),
1846
1983
  })
1847
1984
  const x = readItem(h.dir, id)
@@ -1857,12 +1994,11 @@ function actCommand(op: ActOp, description: string, o: { note?: 'required' | 'op
1857
1994
  export const ReviewWontfixCommand = actCommand('wontfix', 'close an item he raised as not done, with the reason', { note: 'required', named: false, examples: [['not done', 'sk thread wontfix <id> --note "the room is gone"']] })
1858
1995
  export const ReviewClaimCommand = actCommand('claim', 'take an item to work on it: the hub shows the thread in work by your lane', { named: true, examples: [['take it', 'sk thread claim <id> --as L12']] })
1859
1996
  export const ReviewReleaseCommand = actCommand('release', 'give back an item you claimed', { note: 'optional', named: true, examples: [['give it back', 'sk thread release <id> --as L12']] })
1860
- export const ReviewBlockedCommand = actCommand('blocked', 'an item you claimed goes back to the owner with what is needed', { note: 'required', named: true, examples: [['his decision is needed', 'sk thread blocked <id> --note "which of the two layouts?" --as L12']] })
1861
1997
  export const ReviewDoneCommand = actCommand('done', 'the older name of sk thread fixed on a version he answered « ok with a fix »', { text: 'what changed', named: false, examples: [['the fix made', 'sk thread fixed <id> "the sign moved one tile up"']] })
1862
1998
 
1863
- /** `fixed <address | id> ["<what was done>"]`: the one way to say it is fixed (review/threads.ts fixedPlan) */
1999
+ /** `fixed <address | id> ["<what was done>"]`: the one way to say it is fixed (review/thread-state.ts fixedPlan) */
1864
2000
  export class ReviewFixedCommand extends Command {
1865
- static override paths = [['review', 'fixed']]
2001
+ static override paths = [['thread', 'fixed']]
1866
2002
  static essential = { args: '<address | id> [what was done]' }
1867
2003
  static override usage = Command.Usage({
1868
2004
  category: 'Review',
@@ -1883,7 +2019,8 @@ export class ReviewFixedCommand extends Command {
1883
2019
  return run(this.context, async (h) => {
1884
2020
  const { act, postUpdate, readAll } = await import('../review/store.ts')
1885
2021
  const { stateOf } = await import('../review/model.ts')
1886
- const { fixedPlan, threadOfItem, threadsOf } = await import('../review/threads.ts')
2022
+ const { threadOfItem, threadsOf } = await import('../review/threads.ts')
2023
+ const { fixedPlan } = await import('../review/thread-state.ts')
1887
2024
  const id = await idOf(h.dir, this.id)
1888
2025
  const items = readAll(h.dir).items
1889
2026
  const x = items.find((y) => y.item.id === id)
@@ -1900,46 +2037,31 @@ export class ReviewFixedCommand extends Command {
1900
2037
  h.out(`${plan.id}: ${r.tag}; ${isOpening(r.item) ? 'its work is done, nothing waits on the owner' : "the owner's verdict is asked again"}`)
1901
2038
  return 0
1902
2039
  }
2040
+ const { openAsksOf, openItemVerdictsOf } = await import('../review/thread-state.ts')
2041
+ const asked = (u: typeof t): (typeof x.thread)[number][] => [...openAsksOf(u), ...openItemVerdictsOf(u)]
2042
+ const before = asked(t)
1903
2043
  const holds = await callerHolds(h.dir, plan.id, this.as)
1904
2044
  act(h.dir, plan.id, plan.op, who, { ...(said ? { note: said } : {}), ...(this.commit ? { commit: this.commit } : {}), holds })
1905
- const after = readAll(h.dir).items.find((y) => y.item.id === plan.id)
2045
+ const now = readAll(h.dir).items
2046
+ const after = now.find((y) => y.item.id === plan.id)
1906
2047
  const st = after ? stateOf(after, false) : null
1907
2048
  h.out(`${plan.id} ${plan.op === 'done' ? 'closed, « ok with a fix » done' : 'fixed'}: ${st ? `${st.state}${st.why ? ` (${st.why})` : ''}` : 'gone'}`)
2049
+ // a close moots what was asked before it (review/thread-state.ts mootAt): never in silence
2050
+ const still = new Set(asked(threadOfItem(id, threadsOf(now, h.say.spec)) ?? t).map((m) => m.id))
2051
+ const moot = before.filter((m) => !still.has(m.id))
2052
+ if (moot.length > 0) {
2053
+ const one = (s: string): string => (s.length > 70 ? `${s.slice(0, 69)}…` : s)
2054
+ h.out(` the close moots ${moot.length} asked of him, closed not answered; if he still owes one, ask it again (sk thread ask):`)
2055
+ for (const m of moot) h.out(` ${m.id} « ${one((m.propose ? `a change of ${m.propose.on}` : (m.text ?? '')).replace(/\s+/g, ' ').trim())} »`)
2056
+ }
1908
2057
  return 0
1909
2058
  })
1910
2059
  }
1911
2060
  }
1912
- export const ReviewDispatchCommand = actCommand('dispatch', 'the dispatcher sends a raised item to a topic', { note: 'optional', topic: 'required', named: true, examples: [['to a topic', 'sk thread dispatch <id> lieux --as dispatcher']] })
1913
- export const ReviewAskCommand = actCommand('ask', 'a question he answers in one click, with your pick; it starts the thread when none owns the address', { text: 'question', named: true, examples: [['one click, your pick on the second', 'sk thread ask messages:tui/u1 "which hook line ?" --option "Run any workflow" --option "Your workflow, one command" --pick 2'], ["the dispatcher's question on a raised item (no --option)", 'sk thread ask <id> "which tower?" --as dispatcher']] })
1914
- export const ReviewDropCommand = actCommand('drop', 'the dispatcher closes a raised item with the reason (a duplicate, already fixed)', { note: 'required', named: true, examples: [['a duplicate', 'sk thread drop <id> --note "same as <other id>" --as dispatcher']] })
1915
- export const ReviewReassignCommand = actCommand('reassign', 'the dispatcher takes a claim back, or sends the item to another topic', { note: 'optional', topic: 'optional', named: true, examples: [['a stale claim', 'sk thread reassign <id> --as dispatcher']] })
1916
-
1917
- export class ReviewDispatcherCommand extends Command {
1918
- static override paths = [['review', 'dispatcher']]
1919
- static override usage = Command.Usage({
1920
- category: 'Review',
1921
- description: 'take the dispatcher role: one session at a time routes what is raised',
1922
- details: `${DETAILS}\n\nRefused while another holder acted in the last 30 minutes, unless --take. Only in a repo whose review unit declares a dispatcher.`,
1923
- examples: [['take the role', 'sk thread dispatcher --as dispatcher']],
1924
- })
1925
- as = Option.String('--as', { description: 'who takes it (else SK_AGENT)' })
1926
- take = Option.Boolean('--take', false, { description: 'take it from an active holder' })
1927
-
1928
- async execute(): Promise<number> {
1929
- return run(this.context, async (h) => {
1930
- if (!h.say.spec.dispatcher) throw new Error('this repo routes nothing: its review unit declares no dispatcher (dispatcher: true)')
1931
- const { takeRole } = await import('../review/role.ts')
1932
- const name = actor(this.as, true, 'dispatcher')
1933
- const r = takeRole(h.dir, name, this.take)
1934
- if (!r.ok) throw new Error(r.why)
1935
- h.out(`${name} holds the dispatcher role${r.was && r.was.name !== name ? ` (taken from ${r.was.name})` : ''}`)
1936
- return 0
1937
- })
1938
- }
1939
- }
2061
+ export const ReviewAskCommand = actCommand('ask', 'a question he answers in one click, with your pick; it starts the thread when none owns the address', { text: 'question', named: true, examples: [['one click, your pick on the second', 'sk thread ask messages:tui/u1 "which hook line ?" --option "Run any workflow" --option "Your workflow, one command" --pick 2'], ['one pick per thing, a row each, your pick on each row', 'sk thread ask screen:frames/sort "which shape for each word ?" --row "Arrivée" --option "A=arrivee-a.png" --option "B=arrivee-b.png" --pick 1 --row "Adieu" --option "A=adieu-a.png" --option "B=adieu-b.png" --pick 2']] })
1940
2062
 
1941
2063
  export class ReviewNextCommand extends Command {
1942
- static override paths = [['review', 'next']]
2064
+ static override paths = [['thread', 'next']]
1943
2065
  static override usage = Command.Usage({
1944
2066
  category: 'Review',
1945
2067
  description: 'claim the oldest open item of a topic, or raised to a lane, and show it with the pages to read first',
@@ -1973,7 +2095,7 @@ export class ReviewNextCommand extends Command {
1973
2095
  }
1974
2096
 
1975
2097
  export class ReviewTopicsCommand extends Command {
1976
- static override paths = [['review', 'topics']]
2098
+ static override paths = [['thread', 'topics']]
1977
2099
  static override usage = Command.Usage({ category: 'Review', description: 'the topics a raised item is routed to, and the pages a worker reads first', details: DETAILS })
1978
2100
 
1979
2101
  async execute(): Promise<number> {
@@ -1987,10 +2109,10 @@ export class ReviewTopicsCommand extends Command {
1987
2109
  }
1988
2110
 
1989
2111
  export class ReviewBoardCommand extends Command {
1990
- static override paths = [['review', 'board']]
2112
+ static override paths = [['thread', 'board']]
1991
2113
  static override usage = Command.Usage({
1992
2114
  category: 'Review',
1993
- description: 'every open raised item by state, topic and worker, stale claims marked; who is the dispatcher',
2115
+ description: 'every open raised item by state, topic and worker, stale claims marked',
1994
2116
  details: DETAILS,
1995
2117
  examples: [['what is open', 'sk thread board'], ['one topic, closed ones too', 'sk thread board --topic lieux --all']],
1996
2118
  })
@@ -2000,17 +2122,12 @@ export class ReviewBoardCommand extends Command {
2000
2122
  async execute(): Promise<number> {
2001
2123
  return run(this.context, async (h) => {
2002
2124
  const { readAll } = await import('../review/store.ts')
2003
- const { roleOf } = await import('../review/role.ts')
2004
2125
  const { isMarkItem, isStale, stateOf } = await import('../review/model.ts')
2005
2126
  const { followedIds } = await import('../review/threads.ts')
2006
2127
  if (this.topic && Object.keys(h.say.spec.topics).length > 0 && !h.say.spec.topics[this.topic]) throw new Error(`--topic: one of ${Object.keys(h.say.spec.topics).join(', ')}`)
2007
2128
  await pull(h)
2008
2129
  const all = readAll(h.dir)
2009
2130
  for (const b of all.broken) h.err(`review: FAIL ${b.id}: ${b.error}`)
2010
- if (h.say.spec.dispatcher) {
2011
- const role = roleOf(h.dir)
2012
- h.out(role ? `dispatcher: ${role.name} (since ${role.since.slice(0, 16)})` : 'dispatcher: nobody (sk thread dispatcher --as <name>)')
2013
- }
2014
2131
  const now = new Date()
2015
2132
  const followed = followedIds(all.items)
2016
2133
  const rows = all.items
@@ -2030,7 +2147,7 @@ export class ReviewBoardCommand extends Command {
2030
2147
  }
2031
2148
 
2032
2149
  export class ReviewReadyCommand extends Command {
2033
- static override paths = [['review', 'ready']]
2150
+ static override paths = [['thread', 'ready']]
2034
2151
  static override usage = Command.Usage({ category: 'Review', description: 'a draft version becomes one he answers: its last frame, or the image given, stays', details: DETAILS })
2035
2152
  id = Option.String()
2036
2153
  image = Option.String('--image', { description: 'the image that stays' })
@@ -2049,7 +2166,7 @@ export class ReviewReadyCommand extends Command {
2049
2166
  }
2050
2167
 
2051
2168
  export class ReviewDeleteCommand extends Command {
2052
- static override paths = [['review', 'delete']]
2169
+ static override paths = [['thread', 'delete']]
2053
2170
  static override usage = Command.Usage({
2054
2171
  category: 'Review',
2055
2172
  description: "a player's test report removed at its source and here, or an item the owner raised removed here",
@@ -2081,7 +2198,7 @@ export class ReviewDeleteCommand extends Command {
2081
2198
  }
2082
2199
 
2083
2200
  export class ReviewMarksCommand extends Command {
2084
- static override paths = [['review', 'marks']]
2201
+ static override paths = [['thread', 'marks']]
2085
2202
  static override usage = Command.Usage({
2086
2203
  category: 'Review',
2087
2204
  description: "the owner's marks kept in the store: per subject its latest stars, mark and note",
@@ -2114,7 +2231,7 @@ export class ReviewMarksCommand extends Command {
2114
2231
  }
2115
2232
 
2116
2233
  export class ReviewAnimCommand extends Command {
2117
- static override paths = [['review', 'anim']]
2234
+ static override paths = [['thread', 'anim']]
2118
2235
  static override usage = Command.Usage({
2119
2236
  category: 'Review',
2120
2237
  description: "a version's before and after as a looping animation to send: a cut, a fade or a wipe, mp4 or gif",
@@ -2159,7 +2276,7 @@ export class ReviewAnimCommand extends Command {
2159
2276
  }
2160
2277
 
2161
2278
  export class ReviewStageCommand extends Command {
2162
- static override paths = [['review', 'stage']]
2279
+ static override paths = [['thread', 'stage']]
2163
2280
  static override usage = Command.Usage({
2164
2281
  category: 'Review',
2165
2282
  description: "one media of a version staged as a post: a draft group of the repo's social store, never posted",
@@ -2232,7 +2349,7 @@ export class ReviewStageCommand extends Command {
2232
2349
  }
2233
2350
 
2234
2351
  export class ReviewAutoCommand extends Command {
2235
- static override paths = [['review', 'auto']]
2352
+ static override paths = [['thread', 'auto']]
2236
2353
  static override usage = Command.Usage({
2237
2354
  category: 'Review',
2238
2355
  description: "the repo's auto rules: period, last run and answer, last item, next run; `auto run <id>` runs one",
@@ -2283,7 +2400,7 @@ export class ReviewAutoCommand extends Command {
2283
2400
  }
2284
2401
 
2285
2402
  export class ReviewWatchCommand extends Command {
2286
- static override paths = [['review', 'watch']]
2403
+ static override paths = [['thread', 'watch']]
2287
2404
  static essential = {}
2288
2405
  static override usage = Command.Usage({
2289
2406
  category: 'Review',
@@ -2480,7 +2597,7 @@ async function hearStore(h: Here, f: { session: string | null; lane: string | nu
2480
2597
  setInterval(() => void known().catch(() => {}), 30_000)
2481
2598
  const shown = new Set<string>(once?.printed ?? [])
2482
2599
  if (once !== null) onceSaves.push(() => once.save(shown))
2483
- // a store refused for a while (a fold or a way back of the daemon file walks): one line, and the next poll
2600
+ // a store refused for a while (a repair of the daemon file): one line, and the next poll
2484
2601
  // reads again; never a watch that dies and hears nothing more
2485
2602
  let refused: string | null = null
2486
2603
  const safely = (fn: () => void): void => {
@@ -2495,8 +2612,11 @@ async function hearStore(h: Here, f: { session: string | null; lane: string | nu
2495
2612
  }
2496
2613
  }
2497
2614
  const tick = (): void => safely(read)
2615
+ const { oncePerBurst } = await import('../review/speaker.ts')
2498
2616
  const read = (): void => {
2499
2617
  const all = readAll(h.dir)
2618
+ // one read is one burst: an advisor's note once in it (review/speaker.ts)
2619
+ const noted = oncePerBurst()
2500
2620
  // the model moved under this watch: it runs again, and its broken lines are the old model's
2501
2621
  if (all.broken.length > 0 && modelWatch.readFailed()) return
2502
2622
  byItem = threadByItem(threadsOf(all.items, h.say.spec))
@@ -2520,7 +2640,7 @@ async function hearStore(h: Here, f: { session: string | null; lane: string | nu
2520
2640
  const code = t && h.say.code ? ` #${h.say.code(t)}` : ''
2521
2641
  for (const l of fresh) {
2522
2642
  shown.add(l.key)
2523
- say(code === '' || !l.text.startsWith(`${x.item.id} `) ? l.text : `${x.item.id}${code}${l.text.slice(x.item.id.length)}`)
2643
+ say(noted(code === '' || !l.text.startsWith(`${x.item.id} `) ? l.text : `${x.item.id}${code}${l.text.slice(x.item.id.length)}`))
2524
2644
  }
2525
2645
  // a session's watch, his message on its ended lane's thread: the way back to that lane
2526
2646
  const r = fresh.length > 0 && lane === null && t && parties ? resumeOf(h, t, parties) : null
@@ -2542,7 +2662,7 @@ async function hearStore(h: Here, f: { session: string | null; lane: string | nu
2542
2662
  for (const l of shareOf({ items: all.items, spec: h.say.spec, parties: placed, watchers: others, media: mediaDir(h.dir), since: r.holder.since, me: { session, repo } })) {
2543
2663
  if (shown.has(l.key)) continue
2544
2664
  shown.add(l.key)
2545
- say(shareText(l))
2665
+ say(noted(shareText(l)))
2546
2666
  }
2547
2667
  }
2548
2668
  }
@@ -2558,7 +2678,7 @@ async function hearStore(h: Here, f: { session: string | null; lane: string | nu
2558
2678
  const watchers = liveWatchers(h.dir)
2559
2679
  for (const x of all.items) {
2560
2680
  if (lane !== null && laneOf(x) !== lane) continue
2561
- const why = untakenOf(x, followed.has(x.item.id), listenersOf(watchers, x, byItem).length > 0, now, h.say.spec.dispatcher)
2681
+ const why = untakenOf(x, followed.has(x.item.id), listenersOf(watchers, x, byItem).length > 0, now)
2562
2682
  if (why === null) continue
2563
2683
  const round = Math.floor((now.getTime() - Date.parse(x.thread.at(-1)?.at ?? x.item.created)) / UNTAKEN_AGAIN_MS)
2564
2684
  const key = `untaken ${x.item.id} ${why} ${round}`
@@ -2637,98 +2757,6 @@ async function watchFeed(say: (l: string) => void): Promise<import('../review/wa
2637
2757
  return (feedHeld = new WatchFeed(daemonUrl(), { say }))
2638
2758
  }
2639
2759
 
2640
- /** the review folders of this machine's house, its archived repos and their worktrees included */
2641
- async function houseStores(): Promise<string[]> {
2642
- const { findRepoRoot } = await import('../ts/config.ts')
2643
- const { houseRepos } = await import('../house/project-gutter.ts')
2644
- const { homedir } = await import('node:os')
2645
- const { storeDir } = await import('../review/store.ts')
2646
- const house = houseRepos(findRepoRoot(process.cwd()), homedir())
2647
- if (house.index == null) throw new Error(`${process.cwd()} is in no house repo: run it from the house checkout, whose repos it reads`)
2648
- const { existsSync } = await import('node:fs')
2649
- const repos = [...house.repos, ...house.archived].map((r) => r.path)
2650
- // a lane's worktree holds the items it sent there: they join their repo's rows
2651
- const trees = repos.flatMap((r) => {
2652
- return realGit.runSync(r, ['worktree', 'list', '--porcelain']).out.split('\n').flatMap((l) => (l.startsWith('worktree ') && l.slice(9) !== r ? [l.slice(9)] : []))
2653
- })
2654
- return [...repos, ...trees.filter((t) => existsSync(storeDir(t)))].map((r) => storeDir(r))
2655
- }
2656
-
2657
- export class ReviewImportCommand extends Command {
2658
- static override paths = [['review', 'import']]
2659
- static override usage = Command.Usage({
2660
- category: 'Review',
2661
- description: "threads kept as folders into the daemon's database: an older shipkit's store, or an export",
2662
- details: `${DETAILS}\n\nEvery thread is rows of the daemon's database. A shipkit older than the rows kept a repo's threads as folders in \`.shipkit/review/<id>/\` (\`item.json\`, \`thread/<message>.json\`, the media beside them, \`.gone/\` the items set aside), and sk thread export writes the same layout. A look by default: what it would write. \`--go\` writes every head the rows lack or hold older and every message they lack (by id and rev), links each media file into the spool, then proves each one it read is in the rows. A head the rows hold later stays, named; a folder that does not read stays as it is, named, and the exit is 1. The folders are read, never written nor removed, so a second run writes nothing. \`--from <folder>\` reads an export instead of the repo's own folder; \`--all\` reads every house repo of this machine and their worktrees. Page: wiki tools/shipkit/threads-store.md, Folders`,
2663
- examples: [['what it would import here', 'sk thread import'], ["this repo's old threads into the rows", 'sk thread import --go'], ['every house repo', 'sk thread import --all --go'], ['an export', 'sk thread import --from /tmp/threads --go']],
2664
- })
2665
- go = Option.Boolean('--go', false, { description: 'write it; without it, a look' })
2666
- all = Option.Boolean('--all', false, { description: 'every house repo of this machine, not only this repo' })
2667
- from = Option.String('--from', { description: "a folder sk thread export wrote, instead of the repo's own" })
2668
-
2669
- async execute(): Promise<number> {
2670
- return run(this.context, async (h) => {
2671
- if (this.all && this.from != null) throw new Error('--all or --from, not both')
2672
- const { resolve } = await import('node:path')
2673
- const { importFolders, importLines, notInRows } = await import('../review/folders.ts')
2674
- const stores = this.all ? await houseStores() : [h.dir]
2675
- const dry = !this.go
2676
- const from = this.from == null ? {} : { from: resolve(this.from) }
2677
- const passes = stores.map((d) => importFolders(d, { dry, ...from }))
2678
- for (const l of importLines(passes, dry)) h.out(l)
2679
- if (dry) {
2680
- h.out('a look: nothing written. sk thread import --go writes it')
2681
- return 0
2682
- }
2683
- const left = passes.flatMap((p) => notInRows(p).map((l) => `${p.dir}: ${l}`))
2684
- if (left.length > 0) {
2685
- h.err(`FAIL: review import: ${left.length} items or messages it read are not in the rows: run it again`)
2686
- for (const l of left.slice(0, 20)) h.err(` ${l}`)
2687
- return 1
2688
- }
2689
- const broken = passes.reduce((n, p) => n + p.broken.length, 0)
2690
- h.out(`ok: ${passes.reduce((n, p) => n + p.items, 0)} threads read, each one in the rows of the daemon's database; the folders stay as they are`)
2691
- return broken > 0 ? 1 : 0
2692
- })
2693
- }
2694
- }
2695
-
2696
- export class ReviewExportCommand extends Command {
2697
- static override paths = [['review', 'export']]
2698
- static override usage = Command.Usage({
2699
- category: 'Review',
2700
- description: 'threads of this repo written as folders, one an item, into a folder of yours',
2701
- details: `${DETAILS}\n\nEvery thread is rows of the daemon's database; export writes each one as a folder a person reads (\`<to>/<id>/item.json\`, \`thread/<message>.json\`, and each media file this machine still holds; a file the disk let go is named, its key in the head's media). sk thread import --from <to> reads it back. Nothing in the rows changes.`,
2702
- examples: [['one item', 'sk thread export 20261118-210000-the-gate --to /tmp/threads'], ['every item of the repo', 'sk thread export --all --to /tmp/threads']],
2703
- })
2704
- all = Option.Boolean('--all', false, { description: 'every item of the repo' })
2705
- to = Option.String('--to', { required: true, description: 'the folder the items are written into' })
2706
- ids = Option.Rest()
2707
-
2708
- async execute(): Promise<number> {
2709
- return run(this.context, async (h) => {
2710
- const { resolve } = await import('node:path')
2711
- const { realpathSync } = await import('node:fs')
2712
- if (this.all === this.ids.length > 0) throw new Error('give item ids or --all')
2713
- const to = resolve(this.to)
2714
- const real = (p: string): string => {
2715
- try {
2716
- return realpathSync(p)
2717
- } catch {
2718
- return resolve(p)
2719
- }
2720
- }
2721
- if (real(to) === real(h.dir)) throw new Error(`--to ${this.to}: the store's own folder, which sk thread import reads as an older shipkit's store`)
2722
- const ids = this.all ? undefined : await Promise.all(this.ids.map((r) => idOf(h.dir, r)))
2723
- const r = (await import('../review/folders.ts')).exportFolders(h.dir, to, ids)
2724
- h.out(`review: ${r.items} items written into ${to} (${r.heads} heads, ${r.msgs} messages, ${r.media?.copied ?? 0} media files)`)
2725
- for (const k of r.kept) h.out(` kept: ${k}`)
2726
- if (r.media && r.media.missing.length > 0) h.out(` ${r.media.missing.length} media files this machine no longer holds (the Space has them by their key in the head): ${r.media.missing.slice(0, 5).join(', ')}`)
2727
- return 0
2728
- })
2729
- }
2730
- }
2731
-
2732
2760
  /** what `propose` was typed with: its positionals, the thread it goes in, who acts, and its fields in the order typed:
2733
2761
  * `--field <key>` opens a field, the value flags after it are that field's; with no `--field`, one field */
2734
2762
  export function proposeArgs(args: readonly string[], read: (file: string) => string): { positionals: string[]; into?: string; as?: string; replaces?: string; fields: import('../review/store.ts').ProposeInput[] } {
@@ -2876,56 +2904,17 @@ export class ThreadAttachCommand extends Command {
2876
2904
  }
2877
2905
  }
2878
2906
 
2879
- export class ReviewMigrateCommand extends Command {
2880
- static override paths = [
2881
- ['thread', 'migrate'],
2882
- ['review', 'migrate'],
2883
- ]
2884
- static override usage = Command.Usage({
2885
- category: 'Review',
2886
- description: "fold the threads that own one address into one; dry run, --go after a backup",
2887
- details: `${DETAILS}\n\nA look unless --go: per store, the links it would write (address, version, the version it supersedes) and the threads before and after. --go writes each link through the head's one rewrite path, and nothing else: no backup run holds a head (the hq does, with its copies). Only a missing link is written: a second run finds nothing. His notes read in their thread already: none is written. Each changed head goes to the hq like any changed head. Page: wiki tools/shipkit/threads-store.md, The one thread guard`,
2888
- examples: [['what it would fold here', 'sk thread migrate'], ['every house store', 'sk thread migrate --all'], ['fold them', 'sk thread migrate --all --go']],
2889
- })
2890
- go = Option.Boolean('--go', false, { description: 'write the links, after a backup' })
2891
- all = Option.Boolean('--all', false, { description: 'every house store of this machine, not only this repo' })
2907
+ /** `review …`, the retired name of `thread`: one refusal that names the new line, never the verb run */
2908
+ export class ReviewRetiredCommand extends Command {
2909
+ static override paths = [['review']]
2910
+ static override usage = undefined
2911
+ words = Option.Proxy()
2892
2912
 
2893
2913
  async execute(): Promise<number> {
2894
- return run(this.context, async (h) => {
2895
- const { dirname } = await import('node:path')
2896
- const { openReview } = await import('../review/project.ts')
2897
- const { foldStore } = await import('../review/thread-fold.ts')
2898
- const { repoIdOf } = await import('../review/item-db.ts')
2899
- const dirs = this.all ? await houseStores() : [h.dir]
2900
- const seen = new Set<string>()
2901
- const stores = dirs.filter((d) => {
2902
- const key = repoIdOf(d)
2903
- if (seen.has(key)) return false
2904
- seen.add(key)
2905
- return true
2906
- })
2907
- const plans = []
2908
- for (const d of stores) {
2909
- await openReview(dirname(dirname(d)))
2910
- plans.push({ d, ...foldStore(d, { go: false }) })
2911
- }
2912
- const todo = plans.filter((p) => p.links.length > 0)
2913
- for (const p of plans) h.out(`${p.d}: ${p.links.length} links, ${p.before} threads to ${p.after}`)
2914
- for (const p of todo) for (const l of p.links) h.out(` ${l.address}: ${l.id} supersedes ${l.supersedes}`)
2915
- if (todo.length === 0) {
2916
- h.out('ok: every address is one thread, nothing to fold')
2917
- return 0
2918
- }
2919
- if (!this.go) {
2920
- h.out(`a look: nothing written. ${this.all ? 'sk thread migrate --all --go' : 'sk thread migrate --go'} folds`)
2921
- return 0
2922
- }
2923
- for (const p of todo) {
2924
- const r = foldStore(p.d, { go: true })
2925
- h.out(`${p.d}: ${r.links.length} links written, ${r.before} threads to ${r.after}`)
2926
- }
2927
- return 0
2928
- })
2914
+ const line = this.words.map((a) => (/^[\w./=,@:+#-]+$/.test(a) ? a : JSON.stringify(a))).join(' ')
2915
+ // sk-disable-next-line SK050 -- the refusal names the retired command
2916
+ this.context.stderr.write(`FAIL: sk review is now sk thread: sk thread ${line}`.trimEnd() + '\n')
2917
+ return 1
2929
2918
  }
2930
2919
  }
2931
2920
 
@@ -2940,18 +2929,12 @@ export const REVIEW_COMMANDS = [
2940
2929
  ReviewUpdateCommand,
2941
2930
  ReviewWithdrawCommand,
2942
2931
  ReviewReopenCommand,
2943
- ReviewPickCommand,
2944
2932
  ReviewFixedCommand,
2945
2933
  ReviewWontfixCommand,
2946
2934
  ReviewClaimCommand,
2947
2935
  ReviewReleaseCommand,
2948
- ReviewBlockedCommand,
2949
2936
  ReviewDoneCommand,
2950
- ReviewDispatcherCommand,
2951
- ReviewDispatchCommand,
2952
2937
  ReviewAskCommand,
2953
- ReviewDropCommand,
2954
- ReviewReassignCommand,
2955
2938
  ReviewNextCommand,
2956
2939
  ReviewTopicsCommand,
2957
2940
  ReviewBoardCommand,
@@ -2962,19 +2945,15 @@ export const REVIEW_COMMANDS = [
2962
2945
  ReviewStageCommand,
2963
2946
  ReviewAutoCommand,
2964
2947
  ReviewWatchCommand,
2965
- ReviewImportCommand,
2966
- ReviewExportCommand,
2967
- ReviewMigrateCommand,
2968
2948
  ThreadProposeCommand,
2969
2949
  ThreadAttachCommand,
2970
2950
  ThreadTakeCommand,
2951
+ ThreadRenameCommand,
2952
+ ThreadSuggestMoveCommand,
2953
+ ThreadCloseCommand,
2954
+ ThreadRecapCommand,
2971
2955
  ThreadTagCommand,
2972
2956
  ThreadAssignCommand,
2973
2957
  ThreadWorkingCommand,
2958
+ ReviewRetiredCommand,
2974
2959
  ]
2975
-
2976
- // every verb is `sk thread <verb>`, and `sk review <verb>` its older name (run() says the new form on stderr)
2977
- for (const C of REVIEW_COMMANDS) {
2978
- const paths = (C.paths ?? []).flatMap((p) => (p[0] === 'review' ? [['thread', ...p.slice(1)], p] : [p]))
2979
- C.paths = paths.filter((p, i) => paths.findIndex((q) => q.join(' ') === p.join(' ')) === i)
2980
- }