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,19 +1,16 @@
1
- // `*.check.ts` discovery — THE way anything gets into a gate. Drop a file
2
- // anywhere in the repo, default-export `check({...})`, and every surface sees
3
- // it with no config edit. The toolkit's own built-ins are the same files
4
- // under `src/checks/`, walked by this same code, so a built-in and a repo
5
- // check differ by `from` and by nothing else.
1
+ // check discovery, THE way anything gets into a gate. Drop a `<name>.check.shipkit.ts` unit file anywhere in the
2
+ // repo, default-export `check({...})`, and every surface sees it with no config edit. The toolkit's own built-ins
3
+ // are `*.check.ts` files under its `src/checks/`, walked by this same code, so a built-in and a repo check differ by
4
+ // `from` and by nothing else.
6
5
  //
7
6
  // Discovery IMPORTS each check file. That is what buys the shape a function
8
7
  // body, a fixer and a typed declaration instead of four regexes, and it is why
9
8
  // a check file keeps its metadata imports at the top level and its BODY's
10
- // imports inside `run` or behind `import.meta.main`. The budget is 300ms for a
11
- // real repo, pinned by tests/check-shape.test.ts.
9
+ // imports inside `run`. The budget is 300ms for a real repo, pinned by
10
+ // tests/check-shape.test.ts.
12
11
  //
13
- // The suffix is shared with the legacy check SCRIPT (named `export const`
14
- // declarations, a body that runs on import), read through 0.40 by
15
- // core/discover-legacy-checks.ts. A script must never be imported, so the two
16
- // are told apart by reading the source first (`isLegacyCheckSource`).
12
+ // A repo `*.check.ts` is the retired shape (a check script, or a check file under the old suffix): never imported,
13
+ // it stands as one red row that names the unit file to write instead.
17
14
  //
18
15
  // Skipped dirs: node_modules, dist, tmp, references (templates for other
19
16
  // repos), every dot-dir, and the repo's vendored dirs (core/vendored.ts).
@@ -22,12 +19,10 @@ import { readFileSync, realpathSync } from 'fs'
22
19
  import { basename, relative } from 'path'
23
20
  import { check, type CheckDef, type CheckFrom } from '../check.ts'
24
21
 
25
- import { CHECK_SUFFIX as SUFFIX, fallbackNames, isLegacyCheckSource, UNIT_SUFFIX, unitBase } from '../core/check-file-names.ts'
22
+ import { CHECK_SUFFIX as SUFFIX, CHECK_UNIT_SUFFIX, UNIT_SUFFIX, unitBase } from '../core/check-file-names.ts'
26
23
  import { unitKind } from '../shipkit-files.ts'
27
24
  import { importFresh, prunedDirs, repoUnitFiles, walk, walkKept } from '../core/repo-walk.ts'
28
25
 
29
- export { fallbackNames, isLegacyCheckSource } from '../core/check-file-names.ts'
30
-
31
26
  import { BUILTIN_CHECK_DIR, builtinsOf } from './builtin-checks-dir.ts'
32
27
  export { BUILTIN_CHECK_DIR, builtinsOf } from './builtin-checks-dir.ts'
33
28
 
@@ -56,12 +51,6 @@ export type DiscoveredCheck = {
56
51
  from: CheckFrom
57
52
  }
58
53
 
59
- /** the same question about a file on disk. An unreadable file is a check
60
- * file, so the import names what is wrong with it */
61
- export function isLegacyCheckFile(path: string): boolean {
62
- try { return isLegacyCheckSource(readFileSync(path, 'utf8')) } catch { return false }
63
- }
64
-
65
54
  /** every built-in id, from the file names alone. Sync and import free, so
66
55
  * `defineRepo` can read the namespace at config load. Read once per
67
56
  * process: the toolkit's own files cannot appear mid run, and `defineRepo`
@@ -109,7 +98,24 @@ function unloadable(path: string, message: string): CheckDef {
109
98
  cache: { by: 'never', why: 'the file does not load' },
110
99
  fix: 'none',
111
100
  applies: 'always',
112
- run: (c) => c.fail(`${basename(path)} does not load: ${message.replace(`${path}: `, '')}`, `fix the declaration in ${basename(path)} by the reason above; a retired check file shape: shipkit check --fix SK029 ports it with the values it ran on`),
101
+ run: (c) => c.fail(`${basename(path)} does not load: ${message.replace(`${path}: `, '')}`, `fix the declaration in ${basename(path)} by the reason above (tools/shipkit/writing-a-check.md)`),
102
+ }
103
+ }
104
+
105
+ /** the unit file a repo `*.check.ts` becomes */
106
+ export const unitFileOf = (rel: string): string => `${rel.slice(0, -SUFFIX.length)}${CHECK_UNIT_SUFFIX}`
107
+
108
+ /** the stand in for a repo `*.check.ts`, the retired shape: never imported (a check script runs its body on import),
109
+ * it fails in every gate with the file to write instead, so an old repo breaks loud and never loses a check unseen */
110
+ function retiredFile(rel: string): CheckDef {
111
+ return {
112
+ description: 'no repo check file keeps the retired `*.check.ts` shape',
113
+ blocking: true,
114
+ runs: { onPreCommit: false, onCi: true, onFull: true, onRelease: true, onHealth: true, onSave: false, onClock: false },
115
+ cache: { by: 'never', why: 'the file is never imported' },
116
+ fix: 'none',
117
+ applies: 'always',
118
+ run: (c) => c.fail(`${rel} is a retired check file shape, so it never runs`, `rename it ${unitFileOf(rel)}, one \`export default check({...})\` whose body is \`run: (c) => …\` (tools/shipkit/writing-a-check.md)`),
113
119
  }
114
120
  }
115
121
 
@@ -152,17 +158,18 @@ export type DiscoverOpts = {
152
158
  imported?: (path: string, ms: number, def: CheckDef | null, loaded: boolean) => void
153
159
  /** the toolkit's checks dir, a parameter for tests only */
154
160
  builtinDir?: string
155
- /** the repo's own check and unit files, when the caller already walked the tree (the commit hook's table) */
156
- repoFiles?: { checks: string[]; units: string[] }
161
+ /** the repo's own unit files, when the caller already walked the tree (the commit hook's table). The retired
162
+ * `*.check.ts` files are then not looked for: their rows run nothing at commit */
163
+ units?: string[]
157
164
  }
158
165
 
159
166
  export async function discoverChecks(root: string, o: DiscoverOpts = {}): Promise<DiscoveredCheck[]> {
160
167
  const builtinDir = builtinsOf(root, o.builtinDir ?? BUILTIN_CHECK_DIR)
161
168
  const builtins: string[] = []
162
169
  walk(builtinDir, builtins)
163
- const found: string[] = o.repoFiles?.checks.slice() ?? []
164
- if (o.repoFiles == null) walkKept(root, found, SUFFIX, undefined, prunedDirs(root))
165
- const units = o.repoFiles?.units.slice().sort() ?? repoUnitFiles(root)
170
+ const found: string[] = []
171
+ if (o.units == null) walkKept(root, found, SUFFIX, undefined, prunedDirs(root))
172
+ const units = o.units?.slice().sort() ?? repoUnitFiles(root)
166
173
  // the repo that HOSTS the toolkit walks over `src/checks/` too, and a file
167
174
  // discovered twice is a duplicate id rather than a second check. Real paths,
168
175
  // because a consumer reaches the same files through a linked node_modules
@@ -171,16 +178,19 @@ export async function discoverChecks(root: string, o: DiscoverOpts = {}): Promis
171
178
  // its own source, never an install of it
172
179
  const inRoot = relative(real(root), real(builtinDir))
173
180
  const hostsToolkit = !inRoot.startsWith('..') && !inRoot.split(/[\\/]/).includes('node_modules')
174
- const all = found.filter((f) => !shipped.has(real(f))).sort()
181
+ const retired = found.filter((f) => !shipped.has(real(f))).sort()
175
182
  builtins.sort()
176
- const names = fallbackNames(root, all)
177
- // a legacy script is left to its own reader, and never imported here
178
- const own = all.filter((f) => o.skip?.(f) === true || !isLegacyCheckFile(f))
179
183
  const base = (f: string): string => basename(f).slice(0, -SUFFIX.length)
180
184
 
181
185
  const out: DiscoveredCheck[] = []
182
186
  const ids = new Set<string>()
183
- for (const f of [...builtins, ...own, ...units]) {
187
+ for (const f of retired) {
188
+ const rel = relative(root, f).replace(/\\/g, '/')
189
+ ids.add(rel)
190
+ const def = retiredFile(rel)
191
+ out.push({ def, path: f, rel, id: rel, title: rel, description: def.description, owner: rel, from: 'repo' })
192
+ }
193
+ for (const f of [...builtins, ...units]) {
184
194
  const isBuiltin = builtins.includes(f)
185
195
  if (o.skip?.(f) === true) continue
186
196
  let def: CheckDef | null
@@ -200,7 +210,7 @@ export async function discoverChecks(root: string, o: DiscoverOpts = {}): Promis
200
210
  const rel = isBuiltin ? null : relative(root, f).replace(/\\/g, '/')
201
211
  const fallback = isBuiltin
202
212
  ? (BUILTIN_ID_RE.exec(base(f))?.[1] ?? base(f))
203
- : f.endsWith(UNIT_SUFFIX) ? unitBase(f) : names.get(f)!
213
+ : unitBase(f)
204
214
  let id = def.id ?? fallback
205
215
  if (isBuiltin) {
206
216
  const refused = loadError != null ? null
@@ -5,10 +5,8 @@
5
5
  // disagree about what exists, which is the whole reason this file is the only
6
6
  // place that enumerates.
7
7
  //
8
- // What feeds it: the floor slots derived from package.json scripts, the
9
- // repo's own `tasks: []`, every discovered `*.check.ts`, and the two legacy
10
- // forms still read behind the compatibility fence (`rules: []` and a legacy
11
- // check script, a `*.check.ts` with no check object). The declaration always lives WITH the check, never in a table
8
+ // What feeds it: the floor slots derived from package.json scripts and every
9
+ // discovered check file. The declaration always lives WITH the check, never in a table
12
10
  // over here: a table beside the registry is a second source of truth that
13
11
  // drifts the first time somebody adds one.
14
12
  import { existsSync, realpathSync } from 'fs'
@@ -19,9 +17,6 @@ import { auditedExtras, ignoredFor, readAuditReport } from '../core/audit-report
19
17
  import { listRepoFiles, resolveFloor, slotDescription, type FloorResolution } from '../core/floor.ts'
20
18
  import { treeRev } from '../core/tree-rev.ts'
21
19
  import { yieldLoop } from '../core/loop-watch.ts'
22
- import { discoverLegacyChecks } from './discover-legacy-checks.ts'
23
- import { checkFileRunBy } from '../core/legacy-shapes.ts'
24
- import { ruleCacheExtra } from '../rules/rule.ts'
25
20
  import { discoverChecks } from './discover-checks.ts'
26
21
  import { checkCacheExtra, describeFirst, type TaskDef, type CheckFrom, type CheckEnv, type CheckDef } from '../check.ts'
27
22
  import { CHECK_TIMEOUT_MS, type RunnableCheck, type CheckBody } from './check-runner.ts'
@@ -93,12 +88,11 @@ export function envTier(): TestTier {
93
88
  * question about the world (core/check-runner.ts owns the other default) */
94
89
  export const BUILD_TIMEOUT_MS = 600_000
95
90
 
96
- /** the floor plus the repo's own `tasks: []`, with the slots nothing could
97
- * fill and the ones a config turned off. The gate prints those, and the TUI
98
- * draws its rows from them before anything has run. */
91
+ /** the floor's build steps, with the slots nothing could fill and the ones a
92
+ * config turned off. The gate prints those, and the TUI draws its rows from
93
+ * them before anything has run. */
99
94
  export async function allTasks(c: RepoConfig, root: string): Promise<FloorResolution> {
100
- const floor = resolveFloor(c, root)
101
- return { ...floor, tasks: [...floor.tasks, ...(c.tasks ?? [])] }
95
+ return resolveFloor(c, root)
102
96
  }
103
97
 
104
98
  /** one gate check with everything a reader asks about it, not only what the
@@ -111,7 +105,7 @@ export type CheckRow = {
111
105
  /** the check's one line description (the shape: check.ts
112
106
  * descriptionProblem). Every row carries one: a check file declares it,
113
107
  * and a row with no file to say it in (a floor slot, a unit test check,
114
- * a task, the legacy forms) gets it from what generated the row. */
108
+ * a commit gate) gets it from what generated the row. */
115
109
  description: string
116
110
  /** does `shipkit ci` run it? false = PROACTIVE: `shipkit check` reports it,
117
111
  * the gate never does, and it may sit red for months without anything
@@ -120,12 +114,10 @@ export type CheckRow = {
120
114
  /** a BUILD STEP: the gate runs it, the health pass does not. `shipkit ci`
121
115
  * asks "is my change good" and builds, `shipkit check` asks "is this
122
116
  * repo healthy" and reports, and a repo's test suite has no business in
123
- * the second question. DERIVED true for a floor slot and a `tasks: []`
124
- * entry, which have no file to say it in, and DECLARED by a `*.check.ts`
125
- * that is one (check.ts `build`). */
117
+ * the second question. DERIVED true for a floor slot, which has no file
118
+ * to say it in, and DECLARED by a check file that is one (check.ts `build`). */
126
119
  build: boolean
127
- /** can a failure stop you? null = the check never said AND the repo set no
128
- * `checkDefaults.blocking`, which the runner treats as fatal. */
120
+ /** can a failure stop you? null = the check never said, which the runner treats as fatal. */
129
121
  blocking: boolean | null
130
122
  /** where the answer is owned: a wiki page, a file, a command. Null when
131
123
  * the check names none. */
@@ -157,7 +149,7 @@ export type CheckRow = {
157
149
  /** whose check it is: `shipkit` = it ships with the toolkit (a built-in
158
150
  * SK check, the contracts pass, a floor slot nothing in the repo filled),
159
151
  * `repo` = this repo declared it (a package.json script behind a floor
160
- * slot, a task, a rule, a check file, a check file). */
152
+ * slot, a check file). */
161
153
  from: CheckFrom
162
154
  /** a COMMIT GATE: the git hook that runs it (hooks/hook-gates.ts). The
163
155
  * runner never does, so every runner context reads false */
@@ -177,9 +169,7 @@ export type ComposeOpts = {
177
169
  tier?: TestTier
178
170
  }
179
171
 
180
- /** a legacy `TaskDef` as the runner takes it. The config key still reads
181
- * through the compatibility window, so the shape survives one release longer
182
- * than the word for it. */
172
+ /** a floor slot's `TaskDef` as the runner takes it */
183
173
  function taskBody(t: TaskDef): CheckBody {
184
174
  return {
185
175
  ...(t.cmd == null ? {} : { cmd: t.cmd }),
@@ -228,7 +218,7 @@ function rootTestKey(root: string, c: RepoConfig, floor: FloorResolution): { inp
228
218
  return { inputs: subs.length === 0 ? t.inputs : inputsOutsideUnits(t.inputs, subs.map((u) => u.rel), files), code: own }
229
219
  }
230
220
 
231
- /** a task's own description, else its command exiting 0 */
221
+ /** a floor slot's own description, else its command exiting 0 */
232
222
  const taskDescription = (t: TaskDef): string =>
233
223
  describeFirst(t.description, t.cmd == null ? null : `\`${t.cmd.join(' ')}\` exits 0`, `the ${t.id} task ${t.cmd == null ? 'passes' : 'exits 0'}`)
234
224
 
@@ -236,8 +226,7 @@ const taskDescription = (t: TaskDef): string =>
236
226
  * about once a day and never in step with its siblings */
237
227
  const DAILY: [string, string] = ['20h', '28h']
238
228
 
239
- /** the runs of a row with no file to declare them in (a floor slot, a config
240
- * task, a legacy rule or script), written out in full with the reason. It
229
+ /** the runs of a row with no file to declare them in (a floor slot), written out in full with the reason. It
241
230
  * keeps what the planner and the gate did with such a row before the
242
231
  * declaration was explicit: a ttl is the cadence ('once' for a forever
243
232
  * fact), a save moves a keyed row or a fact, a gate build step nothing keys
@@ -269,7 +258,7 @@ function declOfCache(cache: CacheDecl, env: CheckEnv): { inputs?: string[]; opti
269
258
  }
270
259
  }
271
260
 
272
- /** a legacy row's cache, as one cell */
261
+ /** a floor slot's cache, as one cell */
273
262
  const legacyCacheText = (d: { inputs?: string[]; ttl?: string; never?: string }): string =>
274
263
  d.inputs != null ? filesText(d.inputs) : d.ttl != null && d.ttl !== '' ? (d.ttl === FOREVER ? 'fact' : `ttl ${d.ttl}`) : d.never != null ? `never: ${d.never}` : 'never: nothing declared'
275
264
 
@@ -301,7 +290,7 @@ export async function composeChecks(root: string, c: RepoConfig, o: ComposeOpts
301
290
  const fromOf = new Map(checks.map((u) => [u.id, u.from]))
302
291
  // a floor slot the REPO filled (its package.json script, its config
303
292
  // override) is the repo's; one shipkit filled with its own module or the
304
- // repo's tsc is the toolkit's. A task the config declares is the repo's.
293
+ // repo's tsc is the toolkit's
305
294
  const taskFrom = (id: string): CheckFrom => {
306
295
  const discovered = fromOf.get(id)
307
296
  if (discovered != null) return discovered
@@ -309,20 +298,7 @@ export async function composeChecks(root: string, c: RepoConfig, o: ComposeOpts
309
298
  if (src == null) return 'repo'
310
299
  return src === 'package.json script' || src === 'repo.config override' || src === 'unit' ? 'repo' : 'shipkit'
311
300
  }
312
- // LEGACY: a task that runs a check file under the check's own name was
313
- // that file run twice, once per engine, when tasks and checks had a
314
- // namespace each. One namespace makes the pair one check: the check row
315
- // runs, carrying what the task added (core/legacy-shapes.ts rewrites the
316
- // pair the same way on disk)
317
- const legacy = discoverLegacyChecks(root)
318
- const foldedInto = new Map<string, TaskDef>()
319
- for (const t of c.tasks ?? []) {
320
- const d = legacy.find((x) => x.name === t.id)
321
- if (d == null || t.logic != null) continue
322
- const r = checkFileRunBy(t, root)
323
- if (r != null && r.rest.length === 0 && r.rel === relative(root, d.path).replace(/\\/g, '/')) foldedInto.set(t.id, t)
324
- }
325
- // BUILD STEPS: the floor, then the repo's own `tasks: []`. The whole run
301
+ // BUILD STEPS: the floor. The whole run
326
302
  // carries the tier flag rather than one task id: a repo names its suites
327
303
  // what it likes, and a gate that guesses which one is the tests will miss
328
304
  // one.
@@ -340,20 +316,18 @@ export async function composeChecks(root: string, c: RepoConfig, o: ComposeOpts
340
316
  const onDisk = (p: string): boolean => existsSync(join(root, isNamesInput(p) ? p.slice(0, -3) : p))
341
317
  const audit = readAuditReport(root)
342
318
  const extrasOf = (id: string): string[] => [...new Set([...ignoredFor(c.ignoredInputs, id), ...auditedExtras(audit, id)])].filter(onDisk).sort()
343
- for (const raw of [...floor.tasks, ...(c.tasks ?? []).filter((t) => foldedInto.get(t.id) !== t)]) {
319
+ for (const raw of floor.tasks) {
344
320
  const added = { ...(full ? { [FULL_TESTS_ENV]: '1' } : {}), ...liveEnv() }
345
321
  const t: TaskDef = Object.keys(added).length > 0 ? { ...raw, env: { ...raw.env, ...added } } : raw
346
- const own = t.id === 'test' && floor.tasks.includes(raw) ? rootTest : null
322
+ const own = t.id === 'test' ? rootTest : null
347
323
  const declared = own?.inputs ?? t.inputs
348
324
  // the declared extras join a declared list too: a list names what the
349
325
  // task reads in the tree, and the audit found these outside it
350
326
  const extras = extrasOf(t.id)
351
327
  const inputs = declared == null && t.ttl == null && t.never == null && t.cmd != null ? ['.', ...extras] : declared == null ? declared : [...declared, ...extras]
352
- const slot = floor.tasks.includes(raw)
353
- const kind = slot ? 'a floor slot' : 'a repo.config.ts task'
354
328
  // a foreign repo's suites are the team's: the daemon starts none on a save unless `onSave` names it
355
- const noSave = foreign && slot && c.onSave?.[t.id] == null ? "foreign: the team's suite, onSave names one to run" : undefined
356
- const runs = withRepoOff(derivedRuns({ gate: t.optIn !== true, build: true, inputs, ttl: t.ttl, kind, repair: false, ...(noSave == null ? {} : { noSave }) }), repoOff(c, t.id))
329
+ const noSave = foreign && c.onSave?.[t.id] == null ? "foreign: the team's suite, onSave names one to run" : undefined
330
+ const runs = withRepoOff(derivedRuns({ gate: t.optIn !== true, build: true, inputs, ttl: t.ttl, kind: 'a floor slot', repair: false, ...(noSave == null ? {} : { noSave }) }), repoOff(c, t.id))
357
331
  const row: CheckRow = {
358
332
  decl: {
359
333
  id: t.id,
@@ -481,90 +455,6 @@ export async function composeChecks(root: string, c: RepoConfig, o: ComposeOpts
481
455
  }
482
456
  out.push({ row, runnable: runnableOf(row, body, { fix: u.def.repair, pointer: u.def.cmd?.join(' ') ?? null }) })
483
457
  }
484
- // LEGACY: `rules: []`, read as a check whose body is its lint. Dies with
485
- // that config key once `shipkit fleet` shows no repo below 0.40.
486
- for (const r of c.rules ?? []) {
487
- const runs = withRepoOff(derivedRuns({ gate: true, build: false, inputs: r.inputs, ttl: r.ttl, kind: 'a legacy repo.config.ts rule', repair: r.fix != null }), repoOff(c, r.id))
488
- const row: CheckRow = {
489
- decl: {
490
- id: r.id,
491
- inputs: r.inputs,
492
- code: r.code,
493
- ttl: r.ttl,
494
- never: r.never,
495
- extra: ruleCacheExtra(r, env),
496
- },
497
- title: r.title,
498
- description: describeFirst(r.title, `rule ${r.id} holds`),
499
- gate: runs.off == null && runs.onCi,
500
- build: false,
501
- blocking: r.blocking,
502
- owner: r.owner,
503
- group: null,
504
- timeoutMs: null,
505
- budgetMs: budgetOf(r.id, undefined, { build: false, cmd: false, world: r.ttl != null || r.never != null }, c.budgets),
506
- optIn: false,
507
- fixable: r.fix != null,
508
- runs,
509
- cache: legacyCacheText(r),
510
- when: whenSummary(runs, repoOff(c, r.id), false),
511
- deps: null,
512
- from: 'repo',
513
- }
514
- out.push({ row, runnable: runnableOf(row, { run: (ctx) => r.lint(ctx, { root: ctx.root, config: ctx.config }) }, { fix: r.fix }) })
515
- }
516
- // LEGACY: a check script with no check object, read as a `cmd` check
517
- // running itself. The reader is a source scanner rather than an import,
518
- // which is why it cannot carry a fixer or a typed declaration
519
- // (core/discover-legacy-checks.ts).
520
- for (const found of legacy) {
521
- const rel = relative(root, found.path).replace(/\\/g, '/')
522
- const task = foldedInto.get(found.name)
523
- // a task that is not optIn put an off gate file in the gate, and the
524
- // file's own cache declaration wins over the task's
525
- const d = task == null ? found : { ...found, gate: found.gate || task.optIn !== true }
526
- const cached = d.inputs != null || d.ttl != null || d.never != null
527
- const li = { inputs: d.inputs ?? (cached ? undefined : task?.inputs), ttl: d.ttl ?? (cached ? undefined : task?.ttl), never: d.never ?? (cached ? undefined : task?.never) }
528
- const runs = withRepoOff(derivedRuns({ gate: d.gate, build: false, inputs: li.inputs, ttl: li.ttl, kind: 'a legacy check script', repair: false }), repoOff(c, d.name))
529
- const row: CheckRow = {
530
- decl: {
531
- id: d.name,
532
- inputs: li.inputs,
533
- ttl: li.ttl,
534
- never: li.never,
535
- code: [rel],
536
- argv: ['bun', rel],
537
- // no `extra`, so WHERE it runs stays out of a legacy check's
538
- // key, deliberately: the field is read by a source scanner
539
- // that cannot carry a `cacheKey` either, and adding the
540
- // rotation now would bust every field repo's TTL cache once
541
- // for a file form that is refused after 0.40 anyway
542
- },
543
- title: d.name,
544
- description: describeFirst(`\`bun ${rel}\` exits 0`, `${d.name} exits 0`),
545
- gate: runs.off == null && runs.onCi,
546
- build: false,
547
- // the file wins, then the repo default, then nothing: an
548
- // unclassified check is an error, never a guess
549
- blocking: d.blocking ?? c.checkDefaults?.blocking ?? null,
550
- owner: rel,
551
- group: task?.group ?? null,
552
- timeoutMs: task?.timeoutMs ?? null,
553
- budgetMs: budgetOf(d.name, undefined, { build: false, cmd: true, world: d.ttl != null || d.never != null }, c.budgets),
554
- optIn: false,
555
- // the reader is a source scanner, so it cannot carry a function
556
- fixable: false,
557
- runs,
558
- cache: legacyCacheText(li),
559
- when: whenSummary(runs, repoOff(c, d.name), false),
560
- deps: task?.deps ?? null,
561
- from: 'repo',
562
- }
563
- // the pointer names the file the way a reader types it, never the
564
- // absolute path discovery happened to hand the spawner
565
- const body: CheckBody = { cmd: ['bun', d.path], ...(task?.env == null ? {} : { env: task.env }), ...(task?.cwd == null ? {} : { cwd: resolve(root, task.cwd) }) }
566
- out.push({ row, runnable: runnableOf(row, body, { pointer: `bun ${rel}` }) })
567
- }
568
458
  // THE COMMIT GATES: the git hooks run them (hooks/run-hooks.ts), never the
569
459
  // runner, so a row here only makes them enumerable and `off` able to name
570
460
  // them. They run in no runner context, and a run by name says where they run
@@ -28,7 +28,7 @@ import { OWN_LIB } from '../core/last-good.ts'
28
28
  import type { CiOpts } from './run-ci.ts'
29
29
 
30
30
  /** the options a working gate passes on to the gate of HEAD: what selects and shows checks, never what repairs */
31
- export type HeadGateOpts = Pick<CiOpts, 'bail' | 'json' | 'skipGroups' | 'withIds' | 'onlyIds' | 'fresh' | 'tests' | 'verbose'> & { print: (l: string) => void }
31
+ export type HeadGateOpts = Pick<CiOpts, 'admit' | 'bail' | 'json' | 'skipGroups' | 'withIds' | 'onlyIds' | 'fresh' | 'tests' | 'verbose'> & { print: (l: string) => void }
32
32
 
33
33
  /** the toolkit that runs the checks: its cli, and where it comes from in words */
34
34
  export type Kit = { cli: string; from: string }
@@ -17,7 +17,8 @@ export async function runJob(root: string, id: string, kind: JobKind, job: JobOp
17
17
  const onCheck = (e: CheckEvent): void => appendJobCheck(root, id, e)
18
18
  if (kind === 'ci') {
19
19
  const { runCi } = await import('./run-ci.ts')
20
- return await runCi(root, { ...job.opts, print, onCheck })
20
+ // a detached gate someone asked for waits on a full machine like a foreground one; the plan's own never does
21
+ return await runCi(root, { ...job.opts, ...(job.turn === true ? {} : { admit: true }), print, onCheck })
21
22
  }
22
23
  const { runCheck } = await import('./run-check.ts')
23
24
  return await runCheck(root, { ...job.opts, print, onCheck })
@@ -5,7 +5,7 @@
5
5
  //
6
6
  // A table beside the per worktree git dir remembers, per file, whether it
7
7
  // declares `onPreCommit`, keyed on the file's mtime and size, and the last
8
- // walk: the repo's check and unit files, and the mtime of every dir it read. A
8
+ // walk: the repo's unit files, and the mtime of every dir it read. A
9
9
  // dir's mtime moves when an entry is added, removed or renamed in it, so while
10
10
  // none moved the list is the same. When every dir and every file still matches
11
11
  // and none runs at commit, the hook answers from the table with stats alone,
@@ -30,11 +30,11 @@ import type { DiscoveredCheck } from './discover-checks.ts'
30
30
  /** a repo check file whose import takes longer than this, warm, is named */
31
31
  export const SLOW_IMPORT_MS = 30
32
32
 
33
- const TABLE_VERSION = 2
33
+ const TABLE_VERSION = 3
34
34
 
35
35
  type Row = { stamp: string; preCommit: boolean }
36
- /** the repo's own check and unit files at the last walk, and each dir it read with its mtime then */
37
- type Walk = { dirs: [string, number][]; checks: string[]; units: string[] }
36
+ /** the repo's own unit files at the last walk, and each dir it read with its mtime then */
37
+ type Walk = { dirs: [string, number][]; units: string[] }
38
38
  type Table = { v: number; files: Record<string, Row>; walk?: Walk }
39
39
 
40
40
  export const declarationsTable = (root: string): string | null => {
@@ -110,7 +110,7 @@ const mtimeOf = (d: string): number => {
110
110
  async function freshWalk(root: string, w: Walk): Promise<{ walk: Walk; moved: boolean }> {
111
111
  const known = new Set(w.dirs.map(([d]) => d))
112
112
  const dirs: [string, number][] = []
113
- const files = new Set([...w.checks, ...w.units])
113
+ const files = new Set(w.units)
114
114
  const found: string[] = []
115
115
  let moved = false
116
116
  let prune: ReadonlySet<string> | null = null
@@ -129,18 +129,17 @@ async function freshWalk(root: string, w: Walk): Promise<{ walk: Walk; moved: bo
129
129
  for (const e of entries) {
130
130
  const sub = join(d, e.name)
131
131
  if (!e.isDirectory()) {
132
- if (e.name.endsWith(CHECK_SUFFIX) || e.name.endsWith(UNIT_SUFFIX)) files.add(sub)
132
+ if (e.name.endsWith(UNIT_SUFFIX)) files.add(sub)
133
133
  continue
134
134
  }
135
135
  if (known.has(sub) || SKIPPED_DIRS.has(e.name) || e.name.startsWith('.')) continue
136
136
  const { prunedDirs, walk } = await import('../core/repo-walk.ts')
137
137
  prune ??= prunedDirs(root)
138
- if (!prune.has(sub)) walk(sub, found, '.ts', undefined, prune, dirs)
138
+ if (!prune.has(sub)) walk(sub, found, UNIT_SUFFIX, undefined, prune, dirs)
139
139
  }
140
140
  }
141
- for (const f of found) if (f.endsWith(CHECK_SUFFIX) || f.endsWith(UNIT_SUFFIX)) files.add(f)
142
- const all = [...files].sort()
143
- return { walk: { dirs, checks: all.filter((f) => f.endsWith(CHECK_SUFFIX)), units: all.filter((f) => f.endsWith(UNIT_SUFFIX)) }, moved }
141
+ for (const f of found) files.add(f)
142
+ return { walk: { dirs, units: [...files].sort() }, moved }
144
143
  }
145
144
 
146
145
  /** the table written whole through a rename, so a reader never sees half of it; a table that cannot be written costs
@@ -167,15 +166,18 @@ function answerOf(table: Table, files: readonly string[], stamp: (f: string) =>
167
166
  }
168
167
 
169
168
  /** the files that run at commit, from the table and stats alone: null when only discovery can say (no walk yet, a
170
- * file no row knows, a file whose stamp moved). A walk whose dirs moved is brought up to date and kept */
171
- export async function preCommitFromTable(root: string): Promise<string[] | null> {
169
+ * file no row knows, a file whose stamp moved). A walk whose dirs moved is brought up to date and kept. `staged`: the
170
+ * paths the commit stages; the dirs of the walk (hundreds of stats) are read only when one of them is a unit file,
171
+ * since a new unit file enters the gate with the commit that stages it. A known unit file is still stamped, and one
172
+ * gone answers null */
173
+ export async function preCommitFromTable(root: string, staged?: readonly string[]): Promise<string[] | null> {
172
174
  const path = declarationsTable(root)
173
175
  const table = readTable(path)
174
176
  if (path == null || table.walk == null) return null
175
177
  const builtins = builtinFiles(builtinsOf(root, BUILTIN_CHECK_DIR))
176
178
  if (builtins == null) return null
177
- const { walk, moved } = await freshWalk(root, table.walk)
178
- const run = answerOf(table, [...builtins, ...walk.checks, ...walk.units], stampOf)
179
+ const { walk, moved } = staged != null && !staged.some((p) => p.endsWith(UNIT_SUFFIX)) ? { walk: table.walk, moved: false } : await freshWalk(root, table.walk)
180
+ const run = answerOf(table, [...builtins, ...walk.units], stampOf)
179
181
  if (run != null && moved) writeTable(path, { ...table, walk })
180
182
  return run
181
183
  }
@@ -205,9 +207,8 @@ export async function discoverPreCommit(root: string): Promise<PreCommitDiscover
205
207
  let skipped = 0
206
208
  let imported = 0
207
209
  const slow: { path: string; ms: number }[] = []
208
- const { BUILTIN_CHECK_DIR: builtinDir, discoverChecks, isLegacyCheckFile } = await import('./discover-checks.ts')
209
- // the tree is walked whole once, then kept up to date by the dirs that moved: one walk for both suffixes, every
210
- // dir timed
210
+ const { BUILTIN_CHECK_DIR: builtinDir, discoverChecks } = await import('./discover-checks.ts')
211
+ // the tree is walked whole once, then kept up to date by the dirs that moved, every dir timed
211
212
  let walk: Walk | null = null
212
213
  if (table.walk != null && path != null) {
213
214
  const fresh = await freshWalk(root, table.walk)
@@ -221,8 +222,8 @@ export async function discoverPreCommit(root: string): Promise<PreCommitDiscover
221
222
  const { prunedDirs, walk: walkTree } = await import('../core/repo-walk.ts')
222
223
  const found: string[] = []
223
224
  const dirs: [string, number][] = []
224
- walkTree(root, found, '.ts', undefined, prunedDirs(root), dirs)
225
- walk = { dirs, checks: found.filter((f) => f.endsWith(CHECK_SUFFIX)).sort(), units: found.filter((f) => f.endsWith(UNIT_SUFFIX)).sort() }
225
+ walkTree(root, found, UNIT_SUFFIX, undefined, prunedDirs(root), dirs)
226
+ walk = { dirs, units: found.sort() }
226
227
  table.walk = walk
227
228
  changed = true
228
229
  }
@@ -230,7 +231,7 @@ export async function discoverPreCommit(root: string): Promise<PreCommitDiscover
230
231
  const shared = readShared(sharedPath)
231
232
  let sharedChanged = false
232
233
  const checks = await discoverChecks(root, {
233
- ...(walk == null ? {} : { repoFiles: { checks: walk.checks, units: walk.units } }),
234
+ ...(walk == null ? {} : { units: walk.units }),
234
235
  skip: (f) => {
235
236
  const row = table.files[f]
236
237
  const s = stamp(f)
@@ -277,13 +278,6 @@ export async function discoverPreCommit(root: string): Promise<PreCommitDiscover
277
278
  for (const k of keys.slice(0, Math.max(0, keys.length - SHARED_MAX))) delete shared.rows[k]
278
279
  writeTable(sharedPath, shared)
279
280
  }
280
- // a legacy script is never imported, so its row comes from its source: it runs nothing at commit
281
- for (const f of walk?.checks ?? []) {
282
- const s = stamp(f)
283
- if (s == null || table.files[f]?.stamp === s || !isLegacyCheckFile(f)) continue
284
- table.files[f] = { stamp: s, preCommit: false }
285
- changed = true
286
- }
287
281
  let written = !changed
288
282
  if (changed && path != null) {
289
283
  // a row whose file is gone is dropped, so the table never outgrows the repo
@@ -291,6 +285,6 @@ export async function discoverPreCommit(root: string): Promise<PreCommitDiscover
291
285
  written = writeTable(path, table)
292
286
  }
293
287
  const builtins = builtinFiles(builtinsOf(root, BUILTIN_CHECK_DIR))
294
- const settled = path != null && written && walk != null && builtins != null && answerOf(table, [...builtins, ...walk.checks, ...walk.units], stamp) != null
288
+ const settled = path != null && written && walk != null && builtins != null && answerOf(table, [...builtins, ...walk.units], stamp) != null
295
289
  return { checks, slow, imported, skipped, settled }
296
290
  }
@@ -29,6 +29,8 @@ import { CI_LOG_DIR } from '../core/layout.ts'
29
29
  export type { CheckEvent } from './check-runner.ts'
30
30
 
31
31
  export type CheckOpts = {
32
+ /** waits once, before the first heavy check that misses the cache (check-runner.ts) */
33
+ beforeHeavy?: (id: string) => Promise<void>
32
34
  json?: boolean
33
35
  fresh?: boolean
34
36
  /** report-only for self-maintaining rules (SK005 never touches package.json) */
@@ -199,16 +201,13 @@ export async function runCheckPass(root: string, o: CheckOpts = {}): Promise<Che
199
201
  childEnv: { [SHARE_ENV]: sharePath, ...(o.fresh === true ? { SHIPKIT_FRESH: '1' } : {}) },
200
202
  bail: o.bail,
201
203
  color: o.color,
204
+ ...(o.beforeHeavy != null ? { beforeHeavy: o.beforeHeavy } : {}),
202
205
  print: sink,
203
206
  detail: o.detail,
204
207
  onCheck: (e) => { collected.push(...e.lines); o.onCheck?.(e) },
205
208
  })
206
209
  const lines: Line[] = []
207
210
  const say = (l: Line, to: (line: string) => void = print): void => { lines.push(l); to(formatLine(l, false)) }
208
- // a declaration in a shape the check file replaced is reported by check
209
- // SK016, which also carries the fixer that rewrites it: one owner, one
210
- // line, one command, rather than a warning per surface.
211
- //
212
211
  // checks this run did not ask about: named here rather than printed one
213
212
  // line each, because twenty four `skip:` lines is the wall of text the
214
213
  // page just replaced
@@ -23,6 +23,9 @@ import { gateBinary } from '../ledger/toolchain-identity.ts'
23
23
  import type { CheckResult } from './check-runner.ts'
24
24
 
25
25
  export type CiOpts = {
26
+ /** a gate someone asked for (sk ci, --head): it waits on a full machine before its first heavy check that misses
27
+ * the cache (gate/admit-heavy.ts). Unset for a release and the plan's own gates, which never wait */
28
+ admit?: boolean
26
29
  bail?: boolean
27
30
  json?: boolean
28
31
  skipGroups?: string[]
@@ -223,6 +226,7 @@ export async function runCi(root: string, o: CiOpts = {}): Promise<number> {
223
226
  fresh: o.fresh,
224
227
  color: o.color,
225
228
  tier,
229
+ ...(o.admit === true ? { beforeHeavy: async (id: string) => (await import('./admit-heavy.ts')).admitCheck(id, o.print ?? ((l) => console.log(l))) } : {}),
226
230
  }
227
231
  try {
228
232
  ledger = Ledger.open(root, composed.map((g) => g.row.decl), {
@@ -59,23 +59,11 @@ export async function runFix(root: string, o: FixOpts = {}): Promise<number> {
59
59
  // what each row resolved to: its declared `fix` and whether it is off
60
60
  const inventory = await gateInventory(root, config)
61
61
  const resolved = new Map(inventory.map((r) => [r.decl.id, r.runs]))
62
- // a rule the repo still registers fixes exactly like a check file, one
63
- // code path, with the fix word its derived row carries
64
- const all: Target[] = [
65
- ...(await discoverChecks(root)).map((u): Target => ({
66
- id: u.id, title: u.title, owner: u.owner, run: u.def.run, fix: u.def.repair, when: resolved.get(u.id)?.fix ?? u.def.fix, off: resolved.get(u.id)?.off ?? null,
67
- // a built-in repair writes through `c` (tests/repair-doors.test.ts holds them to it); a repo's own file is read
68
- ...(u.rel == null ? {} : { unguarded: () => { const r = rawAccessInClosure(root, u.path, { skip: LIB_ROOT }); return r == null ? null : rawAccessLine(r) } }),
69
- })),
70
- ...(config.rules ?? []).map((r): Target => {
71
- const runs = resolved.get(r.id)
72
- return {
73
- id: r.id, title: r.title, owner: r.owner, when: runs?.fix ?? 'none', off: runs?.off ?? null, unguarded: () => 'a rules: [] repair gets the bare root, never `c`',
74
- run: (c) => r.lint(c, { root: c.root, config: c.config }),
75
- fix: r.fix == null ? undefined : (c) => r.fix!({ root: c.root, config: c.config }),
76
- }
77
- }),
78
- ]
62
+ const all: Target[] = (await discoverChecks(root)).map((u): Target => ({
63
+ id: u.id, title: u.title, owner: u.owner, run: u.def.run, fix: u.def.repair, when: resolved.get(u.id)?.fix ?? u.def.fix, off: resolved.get(u.id)?.off ?? null,
64
+ // a built-in repair writes through `c` (tests/repair-doors.test.ts holds them to it); a repo's own file is read
65
+ ...(u.rel == null ? {} : { unguarded: () => { const r = rawAccessInClosure(root, u.path, { skip: LIB_ROOT }); return r == null ? null : rawAccessLine(r) } }),
66
+ }))
79
67
 
80
68
  // no ids: the repairs declared for the gate. A manual one runs by name
81
69
  let targets = all.filter((r) => r.fix != null && r.when === 'ci')