rvlib-shipkit 2.25.0 → 2.27.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 (456) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/package.json +2 -2
  3. package/src/agent-time/diet.ts +77 -0
  4. package/src/agent-time/family.ts +72 -0
  5. package/src/agent-time/hooks.ts +331 -0
  6. package/src/agent-time/limits.ts +44 -0
  7. package/src/agent-time/live.ts +1 -3
  8. package/src/agent-time/mask.ts +96 -18
  9. package/src/agent-time/refused.ts +45 -0
  10. package/src/agent-time/render.ts +130 -17
  11. package/src/agent-time/report-cache.ts +57 -0
  12. package/src/agent-time/report.ts +349 -23
  13. package/src/agent-time/shape.ts +50 -3
  14. package/src/agent-time/store.ts +370 -95
  15. package/src/agent-time/timeline.ts +140 -21
  16. package/src/agent-time/turns.ts +18 -8
  17. package/src/annex/offload.ts +17 -6
  18. package/src/annex/tidy.ts +70 -10
  19. package/src/asks/ask-after.ts +40 -0
  20. package/src/asks/asks-queue.ts +205 -47
  21. package/src/assets/kit-config.ts +7 -3
  22. package/src/assets/kits/identity-kit.ts +289 -10
  23. package/src/check.ts +3 -1
  24. package/src/checks/SK004-gitignore-policy.check.ts +12 -5
  25. package/src/checks/SK013-one-way-in-policy.check.ts +8 -3
  26. package/src/checks/SK026-asks-autoclose.check.ts +5 -5
  27. package/src/checks/SK028-readme.check.ts +7 -66
  28. package/src/checks/SK030-cache-audit.check.ts +6 -1
  29. package/src/checks/SK031-trace-audit.check.ts +2 -0
  30. package/src/checks/SK033-global-contribution.check.ts +3 -1
  31. package/src/checks/SK035-public-clean.check.ts +2 -2
  32. package/src/checks/SK043-scratch-on-the-mac.check.ts +59 -4
  33. package/src/checks/SK045-slow-hooks.check.ts +47 -0
  34. package/src/checks/SK046-hook-records.check.ts +76 -0
  35. package/src/checks/SK047-login-in-description.check.ts +36 -0
  36. package/src/checks/SK048-one-local-file.check.ts +36 -0
  37. package/src/cli/cmd_Asks.ts +71 -5
  38. package/src/cli/cmd_Backup.ts +5 -3
  39. package/src/cli/cmd_Capacity.ts +2 -2
  40. package/src/cli/cmd_CrossRepoActivity.ts +5 -4
  41. package/src/cli/cmd_Db.ts +253 -0
  42. package/src/cli/cmd_History.ts +212 -0
  43. package/src/cli/cmd_Home.ts +31 -3
  44. package/src/cli/cmd_Hq.ts +516 -0
  45. package/src/cli/cmd_Machines.ts +36 -0
  46. package/src/cli/cmd_Media.ts +38 -6
  47. package/src/cli/cmd_Mv.ts +1 -1
  48. package/src/cli/cmd_Reflect.ts +23 -2
  49. package/src/cli/cmd_Releases.ts +30 -0
  50. package/src/cli/cmd_Review.ts +569 -118
  51. package/src/cli/cmd_Secret.ts +62 -12
  52. package/src/cli/cmd_Social.ts +83 -1
  53. package/src/cli/cmd_Space.ts +324 -0
  54. package/src/cli/cmd_Time.ts +82 -5
  55. package/src/cli/cmd_Tmp.ts +28 -4
  56. package/src/cli/cmd_Trailer.ts +14 -10
  57. package/src/cli/cmd_Urls.ts +56 -0
  58. package/src/cli/cmd_Vault.ts +583 -0
  59. package/src/cli/family-help.ts +4 -2
  60. package/src/cli/family-pages.ts +1 -1
  61. package/src/cli/registry.ts +26 -4
  62. package/src/collections/actions.ts +63 -13
  63. package/src/collections/collection-types.ts +23 -1
  64. package/src/collections/providers.ts +117 -23
  65. package/src/collections/review.ts +4 -4
  66. package/src/commands/runner.ts +5 -1
  67. package/src/contracts/contract-manifests.ts +6 -5
  68. package/src/contracts/contract-types.ts +6 -4
  69. package/src/contracts/contracts-engine.ts +11 -0
  70. package/src/contracts/manifests/chrome-web-store.contract.ts +31 -0
  71. package/src/core/budget.ts +12 -17
  72. package/src/core/capacity.ts +27 -18
  73. package/src/core/check-runner.ts +7 -4
  74. package/src/core/history-files.ts +9 -5
  75. package/src/core/layout.ts +3 -0
  76. package/src/core/machine-busy.ts +127 -0
  77. package/src/core/machine-commit.ts +6 -1
  78. package/src/core/machine-db.ts +368 -20
  79. package/src/core/machine-layout.ts +137 -0
  80. package/src/core/machine-read.ts +81 -0
  81. package/src/core/migrate-layout.ts +1 -1
  82. package/src/core/one-way-in-policy.ts +64 -7
  83. package/src/core/polling-policy.ts +27 -0
  84. package/src/core/retention.ts +16 -2
  85. package/src/core/scope.ts +107 -14
  86. package/src/core/signal-name.ts +6 -0
  87. package/src/core/slots.ts +5 -4
  88. package/src/core/trace-audit.ts +6 -1
  89. package/src/core/transient.ts +6 -0
  90. package/src/drill/clean.ts +25 -1
  91. package/src/drill/run.ts +2 -2
  92. package/src/drill/seal.ts +27 -4
  93. package/src/home/activity-shape.ts +2 -0
  94. package/src/home/activity.ts +66 -3
  95. package/src/home/app-sign.ts +15 -4
  96. package/src/home/daemon-jobs.ts +149 -7
  97. package/src/home/database-projects.ts +111 -0
  98. package/src/home/database-words.ts +203 -0
  99. package/src/home/databases.ts +460 -0
  100. package/src/home/global-units.ts +6 -0
  101. package/src/home/gui-app/ShipkitGui.swift +122 -1
  102. package/src/home/gui-app.ts +6 -3
  103. package/src/home/home-move.ts +514 -0
  104. package/src/home/home-paths.ts +12 -3
  105. package/src/home/home-routes.ts +68 -0
  106. package/src/home/inbox-shape.ts +24 -14
  107. package/src/home/machine-fold.ts +820 -0
  108. package/src/home/machine-host.ts +20 -5
  109. package/src/home/machine-repair.ts +503 -0
  110. package/src/home/machine-stores.ts +66 -15
  111. package/src/home/machine-temp.ts +547 -86
  112. package/src/home/resume.ts +79 -0
  113. package/src/home/run-daemon.ts +25 -4
  114. package/src/home/run-pm.ts +18 -5
  115. package/src/home/serve-daemon.ts +18 -3
  116. package/src/home/serve-web.ts +175 -7
  117. package/src/home/space-job.ts +115 -0
  118. package/src/home/space-page.ts +257 -0
  119. package/src/home/space-route.ts +167 -0
  120. package/src/home/space-words.ts +103 -0
  121. package/src/home/time-page-shape.ts +202 -0
  122. package/src/home/time-page.ts +64 -0
  123. package/src/home/vault-page.ts +482 -0
  124. package/src/home/vault-words.ts +132 -0
  125. package/src/hooks/leak-guard.ts +40 -13
  126. package/src/hooks/one-way-in-guard.ts +17 -4
  127. package/src/hq/cards.ts +581 -0
  128. package/src/hq/door-route.ts +43 -0
  129. package/src/hq/door.ts +163 -0
  130. package/src/hq/files-send.ts +348 -0
  131. package/src/hq/forgotten-log.ts +35 -0
  132. package/src/hq/history-check.ts +255 -0
  133. package/src/hq/history-place.ts +146 -0
  134. package/src/hq/history-send.ts +487 -0
  135. package/src/hq/hq-db.ts +99 -0
  136. package/src/hq/hq-local.ts +469 -0
  137. package/src/hq/hq-routes.ts +196 -0
  138. package/src/hq/hq-store.ts +599 -0
  139. package/src/hq/kinds/ask.ts +147 -0
  140. package/src/hq/kinds/card-gone.ts +83 -0
  141. package/src/hq/kinds/card-msg.ts +66 -0
  142. package/src/hq/kinds/card.ts +99 -0
  143. package/src/hq/kinds/index.ts +21 -0
  144. package/src/hq/kinds/kind.ts +126 -0
  145. package/src/hq/kinds/media.ts +125 -0
  146. package/src/hq/kinds/prompt.ts +219 -0
  147. package/src/hq/kinds/reflection.ts +128 -0
  148. package/src/hq/kinds/report.ts +55 -0
  149. package/src/hq/kinds/time-day.ts +236 -0
  150. package/src/hq/ledger.ts +473 -0
  151. package/src/hq/machine-key.ts +44 -0
  152. package/src/hq/machine-notes.ts +131 -0
  153. package/src/hq/outbox.ts +372 -0
  154. package/src/hq/replica.ts +168 -0
  155. package/src/hq/repo-id.ts +4 -0
  156. package/src/hq/report-facts.ts +117 -0
  157. package/src/hq/report.ts +274 -0
  158. package/src/hq/switch.ts +151 -0
  159. package/src/hq/vault-grant.ts +92 -0
  160. package/src/identities/identities.ts +15 -3
  161. package/src/identities/steps.ts +31 -0
  162. package/src/ledger/db.ts +73 -26
  163. package/src/ledger/gate-checks.ts +29 -4
  164. package/src/ledger/git-key.ts +3 -3
  165. package/src/ledger/git-scan.ts +49 -7
  166. package/src/ledger/run-log.ts +11 -3
  167. package/src/ledger/store.ts +26 -4
  168. package/src/media-store/backup/daemon.ts +36 -17
  169. package/src/media-store/backup/kept.ts +241 -0
  170. package/src/media-store/backup/restore.ts +14 -4
  171. package/src/media-store/backup/run.ts +11 -11
  172. package/src/media-store/backup/secret.ts +6 -4
  173. package/src/media-store/backup/snapshot.ts +4 -2
  174. package/src/media-store/backup/sources.ts +68 -20
  175. package/src/media-store/copy/config.ts +77 -0
  176. package/src/media-store/copy/copy.ts +194 -0
  177. package/src/media-store/copy/lifecycle.ts +43 -0
  178. package/src/media-store/copy/night.ts +90 -0
  179. package/src/media-store/copy/proof.ts +151 -0
  180. package/src/media-store/copy/snapshot.ts +152 -0
  181. package/src/media-store/copy/store.ts +62 -0
  182. package/src/media-store/copy/stream.ts +176 -0
  183. package/src/media-store/daemon.ts +66 -16
  184. package/src/media-store/db.ts +22 -11
  185. package/src/media-store/forget.ts +23 -3
  186. package/src/media-store/hand.ts +4 -3
  187. package/src/media-store/hq-find.ts +75 -0
  188. package/src/media-store/hq-send.ts +277 -0
  189. package/src/media-store/kind.ts +2 -0
  190. package/src/media-store/purge.ts +18 -15
  191. package/src/media-store/put.ts +24 -8
  192. package/src/media-store/remote.ts +16 -7
  193. package/src/media-store/space-listing.ts +240 -0
  194. package/src/media-store/space.ts +40 -21
  195. package/src/media-store/sync.ts +5 -5
  196. package/src/media-store/tidy.ts +98 -0
  197. package/src/media-store/upload.ts +3 -3
  198. package/src/media-store/webp.ts +66 -0
  199. package/src/messages/model.ts +16 -7
  200. package/src/messages/routes.ts +14 -4
  201. package/src/messages/score.ts +2 -2
  202. package/src/messages/suggest.ts +96 -0
  203. package/src/pages/frame-client.ts +10 -0
  204. package/src/plan/planner.ts +28 -17
  205. package/src/recordings/media-kind.ts +1 -0
  206. package/src/recordings/model.ts +1 -1
  207. package/src/recordings/recorder-app/Capture.swift +9 -7
  208. package/src/reflect/hq-corpus.ts +56 -0
  209. package/src/reflect/prompt-corpus.ts +3 -1
  210. package/src/reflect/transcript.ts +146 -36
  211. package/src/release/machine-words.ts +67 -0
  212. package/src/release/public-clean.ts +8 -3
  213. package/src/releases/from-card.ts +1 -1
  214. package/src/releases/model.ts +18 -0
  215. package/src/releases/routes.ts +10 -5
  216. package/src/releases/store.ts +23 -2
  217. package/src/repo-config.ts +42 -2
  218. package/src/review/anim.ts +2 -2
  219. package/src/review/auto.ts +2 -2
  220. package/src/review/card-db.ts +244 -0
  221. package/src/review/card-rows.ts +266 -0
  222. package/src/review/cells.ts +76 -5
  223. package/src/review/draft-card.ts +41 -0
  224. package/src/review/draft-model.ts +78 -0
  225. package/src/review/format.ts +29 -10
  226. package/src/review/gone.ts +98 -0
  227. package/src/review/inbox-hook.ts +35 -0
  228. package/src/review/marks.ts +1 -1
  229. package/src/review/media-kind.ts +7 -5
  230. package/src/review/media-read.ts +9 -7
  231. package/src/review/media.ts +32 -5
  232. package/src/review/model.ts +214 -45
  233. package/src/review/move.ts +491 -0
  234. package/src/review/notes.ts +12 -20
  235. package/src/review/previews.ts +15 -19
  236. package/src/review/project.ts +1 -1
  237. package/src/review/rev.ts +8 -0
  238. package/src/review/role.ts +1 -1
  239. package/src/review/routes.ts +64 -13
  240. package/src/review/stage-card.ts +8 -4
  241. package/src/review/stage-routes.ts +1 -1
  242. package/src/review/store.ts +529 -83
  243. package/src/review/thread-fold.ts +51 -0
  244. package/src/review/threads.ts +147 -9
  245. package/src/review/trailer-auto-mock.ts +63 -0
  246. package/src/review/trailer-card.ts +4 -4
  247. package/src/review/trailer-desk.ts +41 -7
  248. package/src/review/trailer-media.ts +1 -0
  249. package/src/review/trailer-model.ts +8 -0
  250. package/src/review/trailer-notes.ts +1 -1
  251. package/src/review/trailer-routes.ts +9 -1
  252. package/src/review/unit.ts +6 -6
  253. package/src/review/watchers.ts +1 -1
  254. package/src/rules/untrack-generated.ts +92 -8
  255. package/src/secrets/held.ts +16 -0
  256. package/src/secrets/keychain.ts +113 -0
  257. package/src/secrets/list.ts +16 -6
  258. package/src/secrets/manager.ts +24 -10
  259. package/src/secrets/read.ts +257 -0
  260. package/src/secrets/who-reads.ts +49 -0
  261. package/src/serve/door-forward.ts +268 -0
  262. package/src/serve/door-names.ts +47 -0
  263. package/src/serve/embed.ts +1 -1
  264. package/src/serve/hub-app/activity-view.tsx +56 -32
  265. package/src/serve/hub-app/activity.css +7 -1
  266. package/src/serve/hub-app/asks-page.tsx +48 -0
  267. package/src/serve/hub-app/asks-st.ts +25 -0
  268. package/src/serve/hub-app/clock-svc.ts +1 -2
  269. package/src/serve/hub-app/col-card.tsx +64 -13
  270. package/src/serve/hub-app/col-list-page.tsx +122 -0
  271. package/src/serve/hub-app/col-list-st.ts +103 -0
  272. package/src/serve/hub-app/col-tables-view.tsx +10 -41
  273. package/src/serve/hub-app/col-tables.ts +76 -8
  274. package/src/serve/hub-app/cols-svc.ts +70 -16
  275. package/src/serve/hub-app/database-st.ts +260 -0
  276. package/src/serve/hub-app/database-view.tsx +289 -0
  277. package/src/serve/hub-app/database.css +32 -0
  278. package/src/serve/hub-app/entry-bar.css +14 -0
  279. package/src/serve/hub-app/entry-bar.tsx +33 -0
  280. package/src/serve/hub-app/entry-pick.ts +31 -0
  281. package/src/serve/hub-app/floating.tsx +1 -0
  282. package/src/serve/hub-app/hash-route.ts +11 -1
  283. package/src/serve/hub-app/header-bar.tsx +14 -18
  284. package/src/serve/hub-app/home-st.ts +89 -9
  285. package/src/serve/hub-app/home-strip.css +5 -19
  286. package/src/serve/hub-app/home-strip.tsx +58 -92
  287. package/src/serve/hub-app/home.html +7 -0
  288. package/src/serve/hub-app/hub-app.tsx +31 -142
  289. package/src/serve/hub-app/hub-types.ts +3 -1
  290. package/src/serve/hub-app/hub.css +109 -23
  291. package/src/serve/hub-app/icons.tsx +18 -1
  292. package/src/serve/hub-app/identities-st.ts +56 -6
  293. package/src/serve/hub-app/identities-view.tsx +100 -58
  294. package/src/serve/hub-app/identities.css +17 -15
  295. package/src/serve/hub-app/identity-address.ts +5 -0
  296. package/src/serve/hub-app/inbox-st.ts +41 -24
  297. package/src/serve/hub-app/inbox-view.tsx +37 -41
  298. package/src/serve/hub-app/inbox.css +2 -5
  299. package/src/serve/hub-app/index.html +7 -0
  300. package/src/serve/hub-app/kept-cols.tsx +7 -0
  301. package/src/serve/hub-app/keys.ts +28 -15
  302. package/src/serve/hub-app/later.tsx +26 -0
  303. package/src/serve/hub-app/list-filter.tsx +14 -0
  304. package/src/serve/hub-app/list-walk.ts +72 -3
  305. package/src/serve/hub-app/machines-st.ts +251 -0
  306. package/src/serve/hub-app/machines-view.tsx +224 -0
  307. package/src/serve/hub-app/machines.css +76 -0
  308. package/src/serve/hub-app/md-copy.tsx +79 -0
  309. package/src/serve/hub-app/media-view.tsx +2 -0
  310. package/src/serve/hub-app/messages/messages-page.tsx +79 -7
  311. package/src/serve/hub-app/messages/messages-st.ts +99 -3
  312. package/src/serve/hub-app/messages.css +14 -0
  313. package/src/serve/hub-app/page-keys.ts +175 -0
  314. package/src/serve/hub-app/pages-frames.tsx +11 -3
  315. package/src/serve/hub-app/palette-st.ts +58 -11
  316. package/src/serve/hub-app/palette-view.tsx +3 -1
  317. package/src/serve/hub-app/project-list.css +54 -8
  318. package/src/serve/hub-app/project-list.tsx +128 -59
  319. package/src/serve/hub-app/projects-svc.ts +78 -7
  320. package/src/serve/hub-app/reader-chips.tsx +13 -0
  321. package/src/serve/hub-app/readme-view.tsx +2 -3
  322. package/src/serve/hub-app/readme.css +27 -5
  323. package/src/serve/hub-app/reflections-page.tsx +42 -0
  324. package/src/serve/hub-app/reflections-st.ts +17 -0
  325. package/src/serve/hub-app/releases/releases-page.tsx +25 -2
  326. package/src/serve/hub-app/releases/releases-st.ts +1 -1
  327. package/src/serve/hub-app/repo-sections.ts +9 -5
  328. package/src/serve/hub-app/repo-st.ts +35 -8
  329. package/src/serve/hub-app/review/draft-card.tsx +163 -0
  330. package/src/serve/hub-app/review/kit.tsx +50 -7
  331. package/src/serve/hub-app/review/note-place.ts +1 -1
  332. package/src/serve/hub-app/review/review-board.tsx +2 -2
  333. package/src/serve/hub-app/review/review-cells.tsx +145 -65
  334. package/src/serve/hub-app/review/review-kit.ts +27 -1
  335. package/src/serve/hub-app/review/review-list.tsx +68 -30
  336. package/src/serve/hub-app/review/review-page.tsx +7 -8
  337. package/src/serve/hub-app/review/review-st.ts +111 -24
  338. package/src/serve/hub-app/review/review-thread.tsx +49 -19
  339. package/src/serve/hub-app/review/review-views.tsx +475 -144
  340. package/src/serve/hub-app/review/thread-control-st.ts +115 -0
  341. package/src/serve/hub-app/review/thread-control.tsx +74 -0
  342. package/src/serve/hub-app/review/thread-st.ts +73 -26
  343. package/src/serve/hub-app/review/trailer-card.tsx +1 -1
  344. package/src/serve/hub-app/review/trailer-page.tsx +37 -16
  345. package/src/serve/hub-app/review/trailer-st.ts +41 -7
  346. package/src/serve/hub-app/review.css +267 -61
  347. package/src/serve/hub-app/side-lists.ts +72 -0
  348. package/src/serve/hub-app/sidebar.tsx +6 -3
  349. package/src/serve/hub-app/site/site-part.tsx +2 -8
  350. package/src/serve/hub-app/site/site-st.ts +4 -4
  351. package/src/serve/hub-app/social/comms-page.tsx +20 -5
  352. package/src/serve/hub-app/social/kit.tsx +30 -4
  353. package/src/serve/hub-app/social/post-card.tsx +139 -49
  354. package/src/serve/hub-app/social/serial-writes.ts +13 -0
  355. package/src/serve/hub-app/social/social-model.ts +11 -0
  356. package/src/serve/hub-app/social/social-page.tsx +94 -35
  357. package/src/serve/hub-app/social/social-st.ts +120 -36
  358. package/src/serve/hub-app/social/stage-popup.tsx +1 -1
  359. package/src/serve/hub-app/social/stage-st.ts +1 -1
  360. package/src/serve/hub-app/social/step-layout.ts +1 -1
  361. package/src/serve/hub-app/social.css +3 -0
  362. package/src/serve/hub-app/space-st.ts +209 -0
  363. package/src/serve/hub-app/space-view.tsx +196 -0
  364. package/src/serve/hub-app/space.css +27 -0
  365. package/src/serve/hub-app/stores/stores-page.tsx +91 -23
  366. package/src/serve/hub-app/stores/stores-st.ts +44 -19
  367. package/src/serve/hub-app/stores.css +6 -1
  368. package/src/serve/hub-app/theme-st.ts +22 -9
  369. package/src/serve/hub-app/time-charts.tsx +291 -0
  370. package/src/serve/hub-app/time-pages.tsx +749 -0
  371. package/src/serve/hub-app/time-st.ts +162 -0
  372. package/src/serve/hub-app/time-view.tsx +76 -0
  373. package/src/serve/hub-app/time.css +138 -0
  374. package/src/serve/hub-app/tree-build.ts +52 -42
  375. package/src/serve/hub-app/tree-row.tsx +4 -4
  376. package/src/serve/hub-app/tree-svc.ts +18 -9
  377. package/src/serve/hub-app/urls-svc.ts +154 -0
  378. package/src/serve/hub-app/urls-view.tsx +117 -0
  379. package/src/serve/hub-app/urls.css +30 -0
  380. package/src/serve/hub-app/vault-st.ts +127 -0
  381. package/src/serve/hub-app/vault-view.tsx +154 -0
  382. package/src/serve/hub-app/vault.css +38 -0
  383. package/src/serve/hub-app/veille/veille-st.ts +12 -10
  384. package/src/serve/hub-app/waiting-svc.ts +29 -0
  385. package/src/serve/hub-app/wikis-view.tsx +2 -2
  386. package/src/serve/hub-runtime.ts +15 -2
  387. package/src/serve/project-gutter-route.ts +27 -14
  388. package/src/serve/project-gutter.ts +25 -12
  389. package/src/serve/same-origin.ts +10 -0
  390. package/src/serve/serve-hub.ts +13 -4
  391. package/src/shipkit-files.ts +16 -2
  392. package/src/shipkit.ts +1 -1
  393. package/src/shot/shooter.ts +616 -420
  394. package/src/shot/shot-ask.ts +246 -155
  395. package/src/site/desk.ts +2 -2
  396. package/src/smoke/run-smoke.ts +3 -2
  397. package/src/social/cover.ts +202 -0
  398. package/src/social/discord-layout.ts +37 -13
  399. package/src/social/drafts.ts +3 -0
  400. package/src/social/load.ts +23 -2
  401. package/src/social/media-kind.ts +2 -1
  402. package/src/social/publish/discord.ts +5 -2
  403. package/src/social/publish/secret.ts +2 -2
  404. package/src/social/release-stage.ts +28 -13
  405. package/src/social/routes.ts +26 -1
  406. package/src/social/stage.ts +1 -1
  407. package/src/social/stats.ts +12 -9
  408. package/src/social/strip.ts +4 -1
  409. package/src/social/thumbnail.ts +255 -0
  410. package/src/stores/collection.ts +15 -11
  411. package/src/stores/desk.ts +236 -42
  412. package/src/stores/model.ts +72 -6
  413. package/src/stores/routes.ts +37 -12
  414. package/src/stores/unit.ts +14 -8
  415. package/src/suite/judge-suites.ts +113 -16
  416. package/src/suite/select.ts +45 -3
  417. package/src/suite/suite-cli.ts +81 -34
  418. package/src/trailer/bed.ts +1 -1
  419. package/src/trailer/build.ts +134 -21
  420. package/src/trailer/ffmpeg.ts +7 -0
  421. package/src/trailer/fonts.ts +3 -2
  422. package/src/trailer/grammar.ts +201 -2
  423. package/src/trailer/graph.ts +42 -5
  424. package/src/trailer/look.ts +21 -0
  425. package/src/trailer/mock.ts +154 -0
  426. package/src/trailer/passage.ts +65 -26
  427. package/src/trailer/score/heard.ts +89 -0
  428. package/src/trailer/score/sound.ts +14 -8
  429. package/src/trailer/sound/run.ts +16 -6
  430. package/src/trailer/stitch.ts +26 -5
  431. package/src/trailer/titles.ts +82 -19
  432. package/src/trailer/versions.ts +1 -3
  433. package/src/trailer/vertical.ts +3 -1
  434. package/src/urls/frame.ts +195 -0
  435. package/src/urls/routes.ts +43 -0
  436. package/src/urls/rows.ts +171 -0
  437. package/src/urls/unit.ts +73 -0
  438. package/src/vault/house-keys.ts +42 -0
  439. package/src/vault/layout.ts +50 -0
  440. package/src/vault/policy.ts +165 -0
  441. package/src/vault/vault-audit.ts +276 -0
  442. package/src/vault/vault-client.ts +40 -0
  443. package/src/vault/vault-config.ts +159 -0
  444. package/src/vault/vault-destroy.ts +78 -0
  445. package/src/vault/vault-handover.ts +305 -0
  446. package/src/vault/vault-http.ts +352 -0
  447. package/src/vault/vault-import.ts +208 -0
  448. package/src/vault/vault-init.ts +328 -0
  449. package/src/vault/vault-minter.ts +271 -0
  450. package/src/vault/vault-restore.ts +333 -0
  451. package/src/vault/vault-serve.ts +342 -0
  452. package/src/vault/vault-snapshot.ts +281 -0
  453. package/src/veille/asks.ts +1 -1
  454. package/src/veille/desk.ts +2 -2
  455. package/src/wiki/run-wiki.ts +2 -1
  456. package/src/wiki/scan-md.ts +42 -2
@@ -18,8 +18,8 @@ import { mkdirSync } from 'fs'
18
18
  import { dirname, join } from 'path'
19
19
  import sharp from 'sharp'
20
20
  import { defineKind, type CanvasGen, type ComfyGen, type Kind } from '../kit-config.ts'
21
- import { hasFamily, registerFont } from '../../trailer/fonts.ts'
22
- import { alpha, HOUSE_FAMILIES, mixed, type TrailerLookInput } from '../../trailer/look.ts'
21
+ import { googleFont, hasFamily, registerFont } from '../../trailer/fonts.ts'
22
+ import { alpha, darker, HOUSE_FAMILIES, lifted, luminance, mixed, type TrailerLookInput } from '../../trailer/look.ts'
23
23
  import type { TrailerSoundInput } from '../../trailer/sound/brand.ts'
24
24
 
25
25
  export type Brand = {
@@ -171,16 +171,18 @@ export type ReleaseCard = {
171
171
  /** the brand's mark as an image: `markFile` when given (the rendered logo.png, or a comfy mark's pick), else a canvas
172
172
  * mark draws itself. The file comes first because a brand.ts loads its own @napi-rs/canvas from its repo, and an
173
173
  * image of one copy does not draw on a canvas of the other */
174
- async function markImage(brand: Brand, markFile: string | undefined): Promise<Image> {
175
- if (markFile != null) return loadImage(await sharp(markFile).png().toBuffer())
174
+ async function markPng(brand: Brand, markFile: string | undefined): Promise<Buffer> {
175
+ if (markFile != null) return sharp(markFile).png().toBuffer()
176
176
  if (brand.mark.backend === 'canvas') {
177
177
  const c = createCanvas(LOGO_SIZE, LOGO_SIZE)
178
178
  await brand.mark.draw(c.getContext('2d'), { id: 'identity-logo', prompt: '' })
179
- return loadImage(c.toBuffer('image/png'))
179
+ return c.toBuffer('image/png')
180
180
  }
181
181
  throw new Error(`brand '${brand.name}' uses a comfy mark and no roll is picked — ${NO_PICK_FIX}`)
182
182
  }
183
183
 
184
+ const markImage = async (brand: Brand, markFile: string | undefined): Promise<Image> => loadImage(await markPng(brand, markFile))
185
+
184
186
  /** a mark whose corner is opaque is a full bleed tile: it reads as an app icon only inside its squircle */
185
187
  function isTile(mark: Image): boolean {
186
188
  const c = createCanvas(16, 16)
@@ -200,16 +202,28 @@ function drawMark(ctx: SKRSContext2D, mark: Image, x: number, y: number, s: numb
200
202
  ctx.restore()
201
203
  }
202
204
 
203
- /** the display face as a canvas font at a size: the trailer's face (its file, else a family the machine has), else
204
- * the og card's fonts in bold */
205
- function displayFace(brand: Brand, root: string): (px: number) => string {
205
+ /** the house's own Google Fonts face from the machine's cache, fetched once; null offline, where the og fonts stand in */
206
+ async function houseFace(family: string, weight: number): Promise<string | null> {
207
+ try {
208
+ return registerFont(await googleFont(family, weight))
209
+ } catch {
210
+ return null
211
+ }
212
+ }
213
+
214
+ /** the display face as a canvas font at a size: the trailer's face (its file, a family the machine has, else that
215
+ * Google Fonts family, as the trailer draws it), else `house` (a Google Fonts face), else the og card's fonts in bold */
216
+ async function displayFace(brand: Brand, root: string, house?: { family: string; weight: number }): Promise<(px: number) => string> {
206
217
  const f = brand.trailer?.font
207
- const weight = f?.weight ?? 900
218
+ const weight = f?.weight ?? house?.weight ?? 900
208
219
  if (f?.file) {
209
220
  const name = registerFont(join(root, f.file))
210
221
  return (px) => `${weight} ${px}px "${name}"`
211
222
  }
212
223
  if (f?.family && hasFamily(f.family)) return (px) => `${weight} ${px}px ${/[,"']/.test(f.family!) ? f.family : `"${f.family}"`}`
224
+ // a family the brand names fails loud, as the trailer's title does: a misspelled one never draws in another face
225
+ const named = f?.family && !/[,"']/.test(f.family) ? registerFont(await googleFont(f.family, weight)) : house ? await houseFace(house.family, house.weight) : null
226
+ if (named) return (px) => `${weight} ${px}px "${named}"`
213
227
  return (px) => ogFont(px, true)
214
228
  }
215
229
 
@@ -265,7 +279,7 @@ function words(ctx: SKRSContext2D, text: string, x: number, y: number, font: str
265
279
  export async function renderReleaseCard(brand: Brand, root: string, card: ReleaseCard, opts?: { markFile?: string }): Promise<Buffer> {
266
280
  const { bg, accent, ink } = brand.palette
267
281
  const mark = await markImage(brand, opts?.markFile)
268
- const display = displayFace(brand, root)
282
+ const display = await displayFace(brand, root)
269
283
  const c = createCanvas(RELEASE_W, RELEASE_H)
270
284
  const ctx = c.getContext('2d')
271
285
  const name = brand.name.toUpperCase()
@@ -307,3 +321,268 @@ export async function renderReleaseCard(brand: Brand, root: string, card: Releas
307
321
  }
308
322
  return sharp(c.toBuffer('image/png')).png({ compressionLevel: 9 }).toBuffer()
309
323
  }
324
+
325
+ export const THUMB_W = 1280
326
+ export const THUMB_H = 720
327
+ /** YouTube takes a custom thumbnail up to 2 MB */
328
+ export const THUMB_MAX_BYTES = 2_000_000
329
+ /** what a thumbnail weighs when its frame is a usual screen: a jpg past it is still taken, only slower to load */
330
+ export const THUMB_AIM_BYTES = 400_000
331
+
332
+ /** the picture YouTube shows for a video, 1280x720 (wiki tools/shipkit/social.md, A video's thumbnail) */
333
+ export type ThumbnailCard = {
334
+ /** the name, huge: the brand's name unless a video is about another */
335
+ title: string
336
+ /** one short line in the accent under it */
337
+ line?: string
338
+ /** a short code or command in a mono chip: an install line */
339
+ chip?: string
340
+ /** a ribbon word across the top right corner: pre-alpha */
341
+ badge?: string
342
+ /** the frame of the product, already cropped to its interesting part */
343
+ frame: Buffer
344
+ }
345
+
346
+ export type Rect = { x: number; y: number; w: number; h: number }
347
+ export type Point = [number, number]
348
+ export type ThumbnailLayout = {
349
+ mark: Rect | null
350
+ title: Rect & { px: number }
351
+ line: (Rect & { px: number }) | null
352
+ chip: (Rect & { px: number }) | null
353
+ /** the frame's card before its tilt, and its four corners once tilted */
354
+ card: Rect & { angle: number; corners: Point[] }
355
+ badge: { px: number; at: Point; band: number } | null
356
+ }
357
+ /** a text's drawn width at a size, in the face its role takes */
358
+ export type Measure = (text: string, role: 'title' | 'line' | 'chip' | 'badge', px: number) => number
359
+
360
+ const T = { left: 60, gap: 20, cardMaxW: 640, cardMaxH: 520, cardRight: 1246, cardY: 352, tilt: (-3 * Math.PI) / 180, markW: 150, markH: 110, chipPad: 22, ribbon: 130, band: 54 }
361
+ /** each text from its size down to its smallest: smaller does not read at the size YouTube lists a video */
362
+ const SIZES = { title: [118, 64], line: [66, 40], chip: [32, 22], badge: [28, 18] } as const
363
+
364
+ const largest = (text: string, role: keyof typeof SIZES, maxW: number, measure: Measure, pad = 0): { px: number; w: number } | null => {
365
+ const [from, to] = SIZES[role]
366
+ for (let px = from; px >= to; px -= 2) {
367
+ const w = measure(text, role, px) + pad
368
+ if (w <= maxW) return { px, w }
369
+ }
370
+ return null
371
+ }
372
+
373
+ /** a thumbnail's text that does not fit at its smallest size; `flag` names the text */
374
+ export class TooLong extends Error {
375
+ constructor(readonly flag: 'title' | 'line' | 'chip' | 'badge', message: string) {
376
+ super(message)
377
+ }
378
+ }
379
+
380
+ const tooLong = (flag: TooLong['flag'], text: string, role: keyof typeof SIZES, maxW: number, measure: Measure, pad = 0): TooLong =>
381
+ new TooLong(flag, `--${flag} "${text}" does not fit a thumbnail: at ${SIZES[role][1]} px it takes ${Math.round(measure(text, role, SIZES[role][1]) + pad)} px of the ${Math.round(maxW)} its place has; say it shorter`)
382
+
383
+ /** where each part of a thumbnail goes: the frame's card tilted on the right, the mark, the name, the line and the chip
384
+ * in a column on the left, each as large as the room left of the card allows, the column centred on the card. Throws
385
+ * on a text that does not fit at its smallest size, never cuts it */
386
+ export function thumbnailLayout(a: { title: string; line?: string; chip?: string; badge?: string; frame: { w: number; h: number }; mark: { w: number; h: number } | null; measure: Measure }): ThumbnailLayout {
387
+ const aspect = a.frame.w / a.frame.h
388
+ const cw = Math.min(T.cardMaxW, T.cardMaxH * aspect)
389
+ const ch = cw / aspect
390
+ const cx = T.cardRight - cw / 2
391
+ const cos = Math.cos(T.tilt)
392
+ const sin = Math.sin(T.tilt)
393
+ const corners = ([[-1, -1], [1, -1], [1, 1], [-1, 1]] as const).map(([sx, sy]): Point => {
394
+ const x = (sx * cw) / 2
395
+ const y = (sy * ch) / 2
396
+ return [cx + x * cos - y * sin, T.cardY + x * sin + y * cos]
397
+ })
398
+ const maxW = Math.min(...corners.map((c) => c[0])) - T.gap - T.left
399
+ const title = largest(a.title, 'title', maxW, a.measure)
400
+ if (!title) throw tooLong('title', a.title, 'title', maxW, a.measure)
401
+ const line = a.line ? largest(a.line, 'line', maxW, a.measure) : null
402
+ if (a.line && !line) throw tooLong('line', a.line, 'line', maxW, a.measure)
403
+ const chip = a.chip ? largest(a.chip, 'chip', maxW, a.measure, 2 * T.chipPad) : null
404
+ if (a.chip && !chip) throw tooLong('chip', a.chip, 'chip', maxW, a.measure, 2 * T.chipPad)
405
+ const mk = a.mark ? Math.min(T.markW / a.mark.w, T.markH / a.mark.h) : 0
406
+ const markH = a.mark ? a.mark.h * mk : 0
407
+ const chipH = chip ? Math.round(chip.px * 1.25) + 24 : 0
408
+ const parts = [markH ? markH + 22 : 0, title.px, line ? 18 + Math.round(line.px * 1.1) : 0, chip ? 40 + chipH : 0]
409
+ let y = Math.max(40, T.cardY - parts.reduce((s, p) => s + p, 0) / 2)
410
+ const mark = a.mark ? { x: T.left, y, w: a.mark.w * mk, h: markH } : null
411
+ y += parts[0]!
412
+ const titleR = { x: T.left, y, w: title.w, h: title.px, px: title.px }
413
+ y += title.px
414
+ const lineR = line ? { x: T.left, y: y + 18, w: line.w, h: Math.round(line.px * 1.1), px: line.px } : null
415
+ y += parts[2]!
416
+ const chipR = chip ? { x: T.left, y: y + 40, w: chip.w, h: chipH, px: chip.px } : null
417
+ let badge: ThumbnailLayout['badge'] = null
418
+ if (a.badge) {
419
+ const room = 2 * (T.ribbon - T.band / 2)
420
+ const b = largest(a.badge.toUpperCase(), 'badge', room, a.measure)
421
+ if (!b) throw tooLong('badge', a.badge, 'badge', room, a.measure)
422
+ badge = { px: b.px, at: [THUMB_W - T.ribbon / Math.SQRT2, T.ribbon / Math.SQRT2], band: T.band }
423
+ }
424
+ return { mark, title: titleR, line: lineR, chip: chipR, card: { x: cx - cw / 2, y: T.cardY - ch / 2, w: cw, h: ch, angle: T.tilt, corners }, badge }
425
+ }
426
+
427
+ const sansBold = (px: number): string => `800 ${px}px ${OG_FAMILIES}`
428
+
429
+ /** a mark's mean colour over its opaque pixels, as hex */
430
+ function meanOf(mark: Image): string {
431
+ const c = createCanvas(32, 32)
432
+ const x = c.getContext('2d')
433
+ x.drawImage(mark, 0, 0, 32, 32)
434
+ const d = x.getImageData(0, 0, 32, 32).data
435
+ const sum = [0, 0, 0, 0]
436
+ for (let i = 0; i < d.length; i += 4) {
437
+ const a = d[i + 3]! / 255
438
+ sum[0]! += d[i]! * a
439
+ sum[1]! += d[i + 1]! * a
440
+ sum[2]! += d[i + 2]! * a
441
+ sum[3]! += a
442
+ }
443
+ const n = sum[3]! || 1
444
+ return `#${[sum[0]!, sum[1]!, sum[2]!].map((v) => Math.round(v / n).toString(16).padStart(2, '0')).join('')}`
445
+ }
446
+
447
+ /** the WCAG contrast of two colours, 1 to 21 */
448
+ const contrast = (a: string, b: string): number => {
449
+ const [hi, lo] = [luminance(a), luminance(b)].sort((x, y) => y - x) as [number, number]
450
+ return (hi + 0.05) / (lo + 0.05)
451
+ }
452
+
453
+ /** a video's thumbnail, a 1280x720 jpg under YouTube's 2 MB (wiki tools/generate-assets/index.md, The thumbnail): the
454
+ * brand's ground lit round the column, its mark, the name in the trailer's face (else Inter 800), the line in the
455
+ * accent, the chip in a mono face, the frame as a tilted card ringed in the accent, a ribbon when one is asked */
456
+ export async function renderThumbnail(brand: Brand, root: string, t: ThumbnailCard, opts?: { markFile?: string }): Promise<Buffer> {
457
+ const { bg, accent, ink } = brand.palette
458
+ const display = await displayFace(brand, root, { family: 'Inter', weight: 800 })
459
+ const monoName = await houseFace('JetBrains Mono', 700)
460
+ const mono = (px: number): string => (monoName ? `700 ${px}px "${monoName}"` : `700 ${px}px Menlo, "DejaVu Sans Mono", monospace`)
461
+ // a cutout's edge keeps faint alpha: a low threshold trims nothing
462
+ const trimmed = await sharp(await markPng(brand, opts?.markFile)).trim({ threshold: 40 }).png().toBuffer().catch(() => null)
463
+ const mark = trimmed ? await loadImage(trimmed) : null
464
+ const frame = await loadImage(await sharp(t.frame).rotate().png().toBuffer())
465
+ const c = createCanvas(THUMB_W, THUMB_H)
466
+ const ctx = c.getContext('2d')
467
+ const spacing = { title: -0.025, line: -0.015, chip: 0, badge: 0.08 } as const
468
+ const font = (role: keyof typeof spacing, px: number): void => {
469
+ ctx.font = role === 'chip' ? mono(px) : role === 'badge' ? sansBold(px) : display(px)
470
+ ctx.letterSpacing = `${Math.round(px * spacing[role] * 10) / 10}px`
471
+ }
472
+ const measure: Measure = (text, role, px) => {
473
+ font(role, px)
474
+ return ctx.measureText(text).width
475
+ }
476
+ const title = t.title.trim()
477
+ const line = t.line?.trim() || undefined
478
+ const chip = t.chip?.trim() || undefined
479
+ const badge = t.badge?.trim() || undefined
480
+ const L = thumbnailLayout({ title, line, chip, badge, frame: { w: frame.width, h: frame.height }, mark: mark ? { w: mark.width, h: mark.height } : null, measure })
481
+
482
+ // the ground: the brand's ground, lit in its own hue behind the column, deeper at the edges
483
+ ctx.save()
484
+ ctx.scale(1, THUMB_H / THUMB_W)
485
+ const g = ctx.createRadialGradient(THUMB_W * 0.28, THUMB_W * 0.42, 0, THUMB_W * 0.28, THUMB_W * 0.42, THUMB_W * 0.92)
486
+ g.addColorStop(0, lifted(bg, 0.16))
487
+ g.addColorStop(0.55, bg)
488
+ g.addColorStop(1, darker(bg, 0.45))
489
+ ctx.fillStyle = g
490
+ ctx.fillRect(0, 0, THUMB_W, THUMB_W)
491
+ ctx.restore()
492
+
493
+ const k = L.card
494
+ ctx.save()
495
+ ctx.translate(k.x + k.w / 2, k.y + k.h / 2)
496
+ ctx.rotate(k.angle)
497
+ const r = 18
498
+ ctx.beginPath()
499
+ ctx.roundRect(-k.w / 2, -k.h / 2, k.w, k.h, r)
500
+ ctx.shadowColor = 'rgba(0,0,0,0.65)'
501
+ ctx.shadowBlur = 80
502
+ ctx.shadowOffsetY = 30
503
+ ctx.fillStyle = bg
504
+ ctx.fill()
505
+ ctx.shadowColor = 'transparent'
506
+ ctx.save()
507
+ ctx.clip()
508
+ ctx.drawImage(frame, -k.w / 2, -k.h / 2, k.w, k.h)
509
+ ctx.restore()
510
+ ctx.beginPath()
511
+ ctx.roundRect(-k.w / 2 - 2, -k.h / 2 - 2, k.w + 4, k.h + 4, r + 2)
512
+ ctx.lineWidth = 4
513
+ ctx.strokeStyle = alpha(accent, 0.75)
514
+ ctx.stroke()
515
+ ctx.restore()
516
+
517
+ if (mark && L.mark) {
518
+ ctx.save()
519
+ ctx.shadowColor = 'rgba(0,0,0,0.5)'
520
+ ctx.shadowBlur = 30
521
+ ctx.shadowOffsetY = 12
522
+ if (contrast(meanOf(mark), bg) < 3) {
523
+ const m = L.mark
524
+ const halo = ctx.createRadialGradient(m.x + m.w / 2, m.y + m.h / 2, 0, m.x + m.w / 2, m.y + m.h / 2, Math.max(m.w, m.h) * 0.75)
525
+ halo.addColorStop(0, alpha(ink, 0.32))
526
+ halo.addColorStop(1, alpha(ink, 0))
527
+ ctx.fillStyle = halo
528
+ ctx.fillRect(m.x - m.w, m.y - m.h, m.w * 3, m.h * 3)
529
+ }
530
+ if (isTile(mark)) drawMark(ctx, mark, L.mark.x, L.mark.y, Math.min(L.mark.w, L.mark.h))
531
+ else ctx.drawImage(mark, L.mark.x, L.mark.y, L.mark.w, L.mark.h)
532
+ ctx.restore()
533
+ }
534
+
535
+ const text = (s: string, role: keyof typeof spacing, at: Rect & { px: number }, color: string, base: number): void => {
536
+ ctx.save()
537
+ font(role, at.px)
538
+ ctx.fillStyle = color
539
+ ctx.textAlign = 'left'
540
+ ctx.textBaseline = 'alphabetic'
541
+ ctx.shadowColor = 'rgba(0,0,0,0.6)'
542
+ ctx.shadowBlur = role === 'title' ? 24 : 18
543
+ ctx.shadowOffsetY = role === 'title' ? 6 : 4
544
+ ctx.fillText(s, at.x, at.y + at.px * base)
545
+ ctx.restore()
546
+ }
547
+ text(title, 'title', L.title, ink, 0.86)
548
+ if (line && L.line) text(line, 'line', L.line, accent, 0.9)
549
+ if (chip && L.chip) {
550
+ const p = L.chip
551
+ ctx.beginPath()
552
+ ctx.roundRect(p.x, p.y, p.w, p.h, 14)
553
+ ctx.fillStyle = alpha(darker(bg, 0.45), 0.88)
554
+ ctx.fill()
555
+ ctx.lineWidth = 2
556
+ ctx.strokeStyle = accent
557
+ ctx.stroke()
558
+ font('chip', p.px)
559
+ ctx.fillStyle = accent
560
+ ctx.textBaseline = 'middle'
561
+ ctx.fillText(chip, p.x + T.chipPad, p.y + p.h / 2 + 1)
562
+ }
563
+ if (badge && L.badge) {
564
+ const b = L.badge
565
+ ctx.save()
566
+ ctx.translate(b.at[0], b.at[1])
567
+ ctx.rotate(Math.PI / 4)
568
+ ctx.shadowColor = 'rgba(0,0,0,0.45)'
569
+ ctx.shadowBlur = 16
570
+ ctx.shadowOffsetY = 4
571
+ ctx.fillStyle = accent
572
+ ctx.fillRect(-THUMB_W / 2, -b.band / 2, THUMB_W, b.band)
573
+ ctx.shadowColor = 'transparent'
574
+ font('badge', b.px)
575
+ ctx.fillStyle = bg
576
+ ctx.textAlign = 'center'
577
+ ctx.textBaseline = 'middle'
578
+ ctx.fillText(badge.toUpperCase(), 0, 1)
579
+ ctx.restore()
580
+ }
581
+
582
+ // the raw pixels, no png between: mozjpeg would save a few percent for ten times the encode
583
+ const raw = sharp(Buffer.from(ctx.getImageData(0, 0, THUMB_W, THUMB_H).data.buffer), { raw: { width: THUMB_W, height: THUMB_H, channels: 4 } }).removeAlpha()
584
+ for (let q = 88; ; q -= 6) {
585
+ const jpg = await raw.clone().jpeg({ quality: q, chromaSubsampling: q >= 82 ? '4:4:4' : '4:2:0' }).toBuffer()
586
+ if (jpg.length <= THUMB_MAX_BYTES || q <= 52) return jpg
587
+ }
588
+ }
package/src/check.ts CHANGED
@@ -120,7 +120,9 @@ export type CheckDef = {
120
120
  timeoutMs?: number
121
121
  /** what a healthy run takes, in ms, distinct from the ceiling: a run that
122
122
  * passes over it prints a WARN and reads yellow, and never blocks.
123
- * Judged on the wall time of a run that measured, at the quick tier.
123
+ * Judged on the wall time of a run that measured, at the quick tier,
124
+ * and only when its newest kept runs were over it too: a check that
125
+ * waited behind others in one gate is not slow.
124
126
  * Default 1000 for an in process body, 5000 for a build step, a `cmd`
125
127
  * or a world probe (cache `ttl`, `fact` or `never`, core/budget.ts).
126
128
  * The repo's `budgets` wins over it. */
@@ -17,7 +17,7 @@
17
17
  import { readdirSync } from 'fs'
18
18
  import type { RepoConfig } from '../repo-config.ts'
19
19
  import { declaredPublic } from '../core/repo-facts.ts'
20
- import { GENERATED_IGNORE_LINES, GENERATED_TRACKED_PATHS, untrackGenerated } from '../rules/untrack-generated.ts'
20
+ import { commitPolicyBlock, GENERATED_IGNORE_LINES, GENERATED_TRACKED_PATHS, gitignoreBaseline, untrackGenerated } from '../rules/untrack-generated.ts'
21
21
  import { check, type CheckCtx, type FixResult } from '../check.ts'
22
22
  import { gitBin } from '../core/git-bin.ts'
23
23
  import { LAYOUT, SHIPKIT_DIR, TRACKED_DIRS } from '../core/layout.ts'
@@ -240,14 +240,18 @@ function withBlock(text: string | null, config: RepoConfig, legacy: boolean): st
240
240
  return `${out.join(eol)}${out.at(-1) === '' ? '' : eol}`
241
241
  }
242
242
 
243
+ /** what became of a rewrite of the block, as the end of its line: '' when there is nothing to say */
244
+ const landedWords = (l: ReturnType<typeof commitPolicyBlock>): string => (l == null ? '' : 'commit' in l ? `, committed as ${l.commit}` : `; not committed: ${l.left}`)
245
+
243
246
  export const gitignorePolicy = check({
244
247
  id: 'SK004',
245
248
  blocking: true,
246
249
  title: '.gitignore',
247
250
  description: 'the managed .gitignore block keeps private contract folders out of git',
248
251
  owner: 'meta/contracts/index.md',
249
- // unless the run is frozen: its body rewrites a stale block, its repair
250
- // untracks generated files (a commit)
252
+ // unless the run is frozen: its body rewrites a stale block and commits
253
+ // that file when nobody else held a change in it, its repair untracks
254
+ // generated files (a commit)
251
255
  writes: true,
252
256
  runs: { onPreCommit: false, onCi: true, onFull: true, onRelease: true, onHealth: true, onSave: 'moved', onClock: false },
253
257
  // .gitignore plus what git currently TRACKS and IGNORES, which the tree
@@ -286,8 +290,9 @@ export const gitignorePolicy = check({
286
290
  c.lines.push({ kind: 'fix-warn', text: 'any run that is not frozen rewrites it in place (sk check, sk ci)' })
287
291
  return
288
292
  }
293
+ const before = gitignoreBaseline(c.root)
289
294
  writeBlock(c, c.config, legacy)
290
- c.note('.gitignore policy block rewritten in place: the policy or repo-contributed lines moved')
295
+ c.note(`.gitignore policy block rewritten in place: the policy or repo-contributed lines moved${landedWords(commitPolicyBlock(c.root, before))}`)
291
296
  s = blockState(c, c.config, legacy)
292
297
  }
293
298
  switch (s) {
@@ -356,6 +361,7 @@ export const gitignorePolicy = check({
356
361
  : `layout: ${layoutSummary(moved)}${moved.commit != null ? ` (committed as ${moved.commit})` : moved.uncommitted === true ? ', the commit did not land' : ''}`
357
362
  const legacy = hasLegacy(c.root)
358
363
  const before = blockState(c, c.config, legacy)
364
+ const held = gitignoreBaseline(c.root)
359
365
  // terminate an unterminated file even when the block itself is current:
360
366
  // that missing byte is what the next append fuses onto
361
367
  let terminated: string | null = null
@@ -372,12 +378,13 @@ export const gitignorePolicy = check({
372
378
  : removed.length > 0 ? `policy block rewritten in place, removed from it: ${removed.join(', ')} (${REMOVED_FIX})`
373
379
  : 'policy block rewritten in place (repo lines outside it untouched)'
374
380
  if (blockSummary != null) writeBlock(c, c.config, legacy)
381
+ const landed = blockSummary != null || terminated != null ? landedWords(commitPolicyBlock(c.root, held, removed)) : ''
375
382
  // the block must be written FIRST: untracking a path the ignore list
376
383
  // does not yet carry leaves it staged for re-add on the next `git add`.
377
384
  // The untrack is a git COMMIT through the hooks, so it stays in the
378
385
  // module that owns that migration (rules/untrack-generated.ts)
379
386
  const un = untrackGenerated(c.root, { enabled: c.config.untrackGenerated })
380
- const parts = [layout, blockSummary, terminated]
387
+ const parts = [layout, blockSummary, terminated, landed === '' ? null : landed.replace(/^[,;] /, '')]
381
388
  if (un.did === 'untracked') parts.push(`untracked ${un.paths.join(', ')} (generated, now gitignored, committed as ${un.commit})`)
382
389
  if (un.did === 'refused') parts.push(`left ${(await trackedGenerated(c)).join(', ')} tracked: ${un.why}`)
383
390
  const summary = parts.filter((x): x is string => x != null).join(' · ')
@@ -14,7 +14,7 @@
14
14
  // scaffold, so a policy written there would bind exactly one checkout.
15
15
  import { isAbsolute, join } from 'path'
16
16
  import { inferBin } from '../core/canonical-scripts.ts'
17
- import { denyRules, GIT_STASH_RULES, LEGACY_STASH_RULE, RAW_RUNNERS } from '../core/one-way-in-policy.ts'
17
+ import { denyRules, GIT_STASH_RULES, LEGACY_SCOPED_RULES, LEGACY_STASH_RULE, RAW_RUNNERS } from '../core/one-way-in-policy.ts'
18
18
  import { rootPublishesNpm } from '../core/repo-facts.ts'
19
19
  import type { RepoConfig } from '../repo-config.ts'
20
20
  import { repoOff } from '../core/when.ts'
@@ -145,6 +145,9 @@ export const oneWayInPolicy = check({
145
145
  c.fail(`${SETTINGS_PATH}: ${stashMissing.length} stash deny row(s) missing (${stashMissing.slice(0, 2).join(', ')}${stashMissing.length > 2 ? ', …' : ''}), so an agent can stash every other agent's uncommitted work in a shared tree`)
146
146
  if (have.has(LEGACY_STASH_RULE))
147
147
  c.fail(`${SETTINGS_PATH}: the blanket "${LEGACY_STASH_RULE}" row also refuses the read only \`git stash list\` and \`git stash show\``)
148
+ const scopedStale = LEGACY_SCOPED_RULES.filter((r) => have.has(r))
149
+ if (scopedStale.length > 0)
150
+ c.fail(`${SETTINGS_PATH}: ${scopedStale.map((r) => `"${r}"`).join(', ')} also refuses a run of one test file or folder, which is the iteration loop`)
148
151
  if (missing.length > 0)
149
152
  c.fail(`${SETTINGS_PATH}: ${missing.length} raw runner(s) still permitted (${missing.slice(0, 3).join(', ')}${missing.length > 3 ? ', …' : ''}) — those calls never reach shipkit, so nothing is cached and no run can be attached to`)
150
153
  const guard = guardHookCommand(s)
@@ -189,8 +192,10 @@ export const oneWayInPolicy = check({
189
192
  const s: Settings = existing ?? {}
190
193
  const changes: string[] = []
191
194
  const old = s.permissions?.deny ?? []
192
- const deny = old.filter((r) => r !== LEGACY_STASH_RULE)
193
- if (deny.length < old.length) changes.push(`the blanket ${LEGACY_STASH_RULE} row replaced by one row per stash write`)
195
+ const deny = old.filter((r) => r !== LEGACY_STASH_RULE && !LEGACY_SCOPED_RULES.includes(r))
196
+ if (old.includes(LEGACY_STASH_RULE)) changes.push(`the blanket ${LEGACY_STASH_RULE} row replaced by one row per stash write`)
197
+ const scopedStale = old.filter((r) => LEGACY_SCOPED_RULES.includes(r))
198
+ if (scopedStale.length > 0) changes.push(`${scopedStale.join(', ')} replaced by the bare row: a run of one file or folder passes`)
194
199
  const added = want.filter((r) => !deny.includes(r))
195
200
  if (added.length > 0 || deny.length < old.length) {
196
201
  s.permissions = { ...s.permissions, deny: [...deny, ...added] }
@@ -4,7 +4,7 @@
4
4
  // warning: the hub and `shipkit needs` show it. A repo with no queue skips.
5
5
  import { existsSync } from 'fs'
6
6
  import { join } from 'path'
7
- import { checkAsks, listAsks } from '../asks/asks-queue.ts'
7
+ import { checkAsks, isClosed, listAsks } from '../asks/asks-queue.ts'
8
8
  import { check } from '../check.ts'
9
9
  import { LAYOUT } from '../core/layout.ts'
10
10
 
@@ -17,11 +17,11 @@ export const asksAutoclose = check({
17
17
  runs: { onPreCommit: false, onCi: false, onFull: false, onRelease: false, onHealth: true, onSave: false, onClock: { every: ['20h', '28h'], inactive: 'wait' } },
18
18
  cache: { by: 'never', why: "runs each open ask's own probe, a shell command that reads the world" },
19
19
  fix: 'none',
20
- // it only probes an ask that carries one, and archives one marked done
20
+ // it only probes an ask that carries one, archives one marked done or declined, and reopens a declined one set open
21
21
  applies: (env) => {
22
22
  const dir = join(env.root, env.config.asks?.dir ?? LAYOUT.asks)
23
23
  if (!existsSync(dir)) return 'no asks queue'
24
- return listAsks(dir).some((a) => a.check != null || a.status === 'done') ? null : 'no open ask carries a probe'
24
+ return listAsks(dir).some((a) => a.check != null || isClosed(a.status)) || existsSync(join(dir, 'declined')) ? null : 'no open ask carries a probe'
25
25
  },
26
26
  run: async (c) => {
27
27
  const dir = join(c.root, c.config.asks?.dir ?? LAYOUT.asks)
@@ -31,9 +31,9 @@ export const asksAutoclose = check({
31
31
  if (c.frozen) return void c.lines.push({ kind: 'skip', text: 'asks not probed: a frozen run archives nothing' })
32
32
  const events: string[] = []
33
33
  await checkAsks(c.root, dir, (l) => events.push(l))
34
- // `closed + archived <file>` / `archived <file>` are the queue's frozen stdout contract
34
+ // `closed + archived <file>` / `archived <file>` / `reopened <file>` are the queue's frozen stdout contract
35
35
  for (const l of events) {
36
- if (l.startsWith('closed') || l.startsWith('archived')) c.ok(`ask ${l}`)
36
+ if (l.startsWith('closed') || l.startsWith('archived') || l.startsWith('reopened')) c.ok(`ask ${l}`)
37
37
  // the queue could not run (another agent holds the write lease)
38
38
  else if (l.startsWith('WARN')) c.warn(l.replace(/^WARN\s*/, ''))
39
39
  }
@@ -1,86 +1,27 @@
1
1
  // SK028 readme (tools/shipkit/built-in-checks.md): the README.md a repo's hub
2
- // page shows exists and carries what makes the repo recognizable at a glance.
3
- // A list of named requirements, each reporting its own line, so a new
4
- // mandatory item is one more entry. Read through `c` only, so the answer is
5
- // keyed on README.md and the images it points to, never on a clock.
6
- import { posix } from 'path'
2
+ // page shows exists. What it says is not checked. Read through `c` only, so
3
+ // the answer is keyed on README.md, never on a clock.
7
4
  import { check } from '../check.ts'
8
- import type { CheckCtx } from '../core/check-ctx.ts'
9
5
 
10
6
  const README = 'README.md'
11
7
 
12
- /** every image source the README shows: markdown `![..](src)` and html
13
- * `<img src>`, code fences and inline code left out, since a sample there
14
- * shows nothing */
15
- export const imageRefs = (md: string): string[] => {
16
- const prose = md.replace(/^(```|~~~)[^\n]*\n[\s\S]*?^\1[^\n]*$/gm, '').replace(/`[^`\n]*`/g, '')
17
- const refs: { at: number; src: string }[] = []
18
- for (const m of prose.matchAll(/!\[[^\]]*\]\(\s*<?([^\s)>]+)>?(?:\s+["'(][^)]*)?\)/g)) refs.push({ at: m.index, src: m[1]! })
19
- for (const m of prose.matchAll(/<img\b[^>]*?\ssrc\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/gi)) refs.push({ at: m.index, src: (m[1] ?? m[2] ?? m[3])! })
20
- return refs.sort((a, b) => a.at - b.at).map((r) => r.src)
21
- }
22
-
23
- /** a status badge (ci, version, license) shows the repo's state, never what it looks like */
24
- const isBadge = (src: string): boolean => /(^|[/.])(shields\.io|badgen\.net)\//i.test(src) || /badge[^/]*\.svg([?#]|$)/i.test(src)
25
-
26
- /** where an image source lands: an https url, a repo file, or nowhere with why */
27
- const resolveImage = (c: CheckCtx, src: string): { ok: string } | { bad: string } => {
28
- if (isBadge(src)) return { bad: `${src.slice(0, 60)} is a badge` }
29
- if (/^https:\/\//i.test(src)) return { ok: src }
30
- if (/^[a-z][a-z0-9+.-]*:/i.test(src) || src.startsWith('//')) return { bad: `${src.slice(0, 60)} is neither an https url nor a repo file` }
31
- let rel: string
32
- try {
33
- rel = posix.normalize(decodeURI(src.replace(/[?#].*$/, '')).replace(/^\/+/, ''))
34
- } catch {
35
- return { bad: `${src} is not a readable path` }
36
- }
37
- if (rel === '.' || rel.startsWith('../')) return { bad: `${src} points out of the repo` }
38
- return c.exists(rel, 'file') ? { ok: rel } : { bad: `${rel} is missing` }
39
- }
40
-
41
- type Finding = { ok: string } | { warn: string; fix: string }
42
- type Requirement = { name: string; test: (c: CheckCtx, md: string) => Finding }
43
-
44
- /** what every README carries, in order. Add an entry to make one more item mandatory */
45
- const REQUIREMENTS: Requirement[] = [
46
- {
47
- name: 'screenshot',
48
- test: (c, md) => {
49
- const found = imageRefs(md).map((src) => resolveImage(c, src))
50
- const shown = found.find((f): f is { ok: string } => 'ok' in f)
51
- if (shown != null) return { ok: `${README} shows a screenshot: ${shown.ok}` }
52
- const why = found.map((f) => (f as { bad: string }).bad)
53
- return {
54
- warn: `${README}: screenshot: ${why.length === 0 ? 'no image at all' : `no image resolves (${why.join(', ')})`}`,
55
- fix: `add a screenshot to README.md: ![what it looks like](docs/screenshot.png), a file in the repo, or an https url; ${OFF}`,
56
- }
57
- },
58
- },
59
- ]
60
-
61
- /** the other way out, for a repo that cannot show one: the rule off, with the
62
- * reason `defineRepo` requires (core/when.ts) */
63
- const OFF = `or, when this repo cannot show one, turn the rule off with the reason: off: { SK028: '<why this repo shows no screenshot>' } in repo.config.ts, inside its shipkit gate block`
8
+ /** the other way out, for a repo that has none on purpose: the rule off, with
9
+ * the reason `defineRepo` requires (core/when.ts) */
10
+ const OFF = `or, when this repo has none on purpose, turn the rule off with the reason: off: { SK028: '<why this repo has no README>' } in repo.config.ts, inside its shipkit gate block`
64
11
 
65
12
  export const readme = check({
66
13
  id: 'SK028',
67
14
  blocking: false,
68
15
  title: 'readme',
69
- description: 'README.md exists and shows at least one screenshot',
16
+ description: 'README.md exists at the repo root',
70
17
  owner: 'tools/shipkit/built-in-checks.md',
71
18
  runs: { onPreCommit: false, onCi: false, onFull: false, onRelease: false, onHealth: true, onSave: 'moved', onClock: false },
72
19
  cache: { by: 'reads' },
73
20
  fix: 'none',
74
21
  applies: 'always',
75
22
  run: (c) => {
76
- const md = c.read(README)
77
- if (md == null) return c.warn(`${README}: exists: no ${README} at the repo root`, `write README.md: what the repo is, and a screenshot of it; ${OFF}`)
23
+ if (c.read(README) == null) return c.warn(`no ${README} at the repo root`, `write README.md: what the repo is and how to run it; ${OFF}`)
78
24
  c.ok(`${README} exists`)
79
- for (const r of REQUIREMENTS) {
80
- const f = r.test(c, md)
81
- if ('ok' in f) c.ok(f.ok)
82
- else c.warn(f.warn, f.fix)
83
- }
84
25
  },
85
26
  })
86
27
 
@@ -7,6 +7,7 @@ import { join } from 'path'
7
7
  import { check } from '../check.ts'
8
8
 
9
9
  const CLI = join(import.meta.dir, '../cli.ts')
10
+ const SIGNALS: Record<number, string> = { 1: 'SIGHUP', 2: 'SIGINT', 9: 'SIGKILL', 15: 'SIGTERM' }
10
11
 
11
12
  export const cacheAudit = check({
12
13
  id: 'SK030',
@@ -25,7 +26,11 @@ export const cacheAudit = check({
25
26
  run: async (c) => {
26
27
  const r = await c.exec([process.execPath, CLI, 'cache-audit', '--json'], { cwd: c.root, timeoutMs: 600_000 })
27
28
  let out: { pool: number; rows: { id: string; cached: string; fresh: string; keyedOn: string }[]; stale: { id: string; cached: string; fresh: string; keyedOn: string }[] }
28
- try { out = JSON.parse(r.out.trim().split('\n').at(-1) ?? '') } catch { return c.fail(`sk cache-audit did not answer (exit ${r.code}: ${r.out.trim().slice(0, 160)})`) }
29
+ try { out = JSON.parse(r.out.trim().split('\n').at(-1) ?? '') } catch {
30
+ // a signal from outside (128 + n, the ceiling not reached) ended it before it looked at the repo: no verdict
31
+ if (!r.timedOut && r.code > 128) return c.unreachable(`sk cache-audit was killed before it answered (${SIGNALS[r.code - 128] ?? `signal ${r.code - 128}`}): no verdict on this repo until its next run`)
32
+ return c.fail(`sk cache-audit ${r.timedOut ? 'ran past its 10 min ceiling' : 'did not answer'} (exit ${r.code}: ${r.out.trim().slice(0, 160)})`)
33
+ }
29
34
  if (out.rows.length === 0) return c.note(`nothing to audit: the cache answers none of this repo's checks right now`)
30
35
  for (const s of out.stale)
31
36
  c.fail(`${s.id}: the cache said ${s.cached}, a fresh run says ${s.fresh}, so its key misses something it reads`, `${s.keyedOn === 'files' ? 'add the path to its cache.inputs' : 'move the read through c'}, then sk keys --why ${s.id}`)
@@ -16,6 +16,8 @@ export const traceAuditCheck = check({
16
16
  description: 'every path a gate task reads is in its key, gitignored or outside a declared list',
17
17
  owner: 'tools/shipkit/cache.md',
18
18
  blocking: false,
19
+ // an audit runs every gate task once under the tracer, so its healthy time is the gate's own, traced
20
+ budgetMs: 300_000,
19
21
  // never a gate: it runs the gate's tasks. The daemon asks it about once a
20
22
  // day, and only while somebody works in the repo
21
23
  runs: { onPreCommit: false, onCi: false, onFull: false, onRelease: false, onHealth: true, onSave: false, onClock: { every: ['20h', '28h'], inactive: 'wait' } },
@@ -29,7 +29,9 @@ export const globalContribution = check({
29
29
  title: 'global contribution',
30
30
  description: 'agent/global-contribution.md exists and fits in the house context',
31
31
  owner: 'meta/agent-folder/index.md',
32
- runs: { onPreCommit: false, onCi: true, onFull: true, onRelease: true, onHealth: true, onSave: 'moved', onClock: false },
32
+ // never a release gate: that gate reads a clean checkout of HEAD, and a public repo keeps this file out of git,
33
+ // so there it is always missing; the file ships in no package
34
+ runs: { onPreCommit: false, onCi: true, onFull: true, onRelease: false, onHealth: true, onSave: 'moved', onClock: false },
33
35
  // the file sits in the agent folder CLAUDE.md names: agent/, or a folder of the repo's wiki/
34
36
  cache: { by: 'files', inputs: ['CLAUDE.md', 'agent/global-contribution.md', 'wiki'], optional: ['CLAUDE.md', 'agent/global-contribution.md', 'wiki'], key: null },
35
37
  fix: 'ci',
@@ -1,5 +1,5 @@
1
1
  // SK035 public clean (tools/shipkit/units.md, What a unit publishes): what each npm unit would pack names no house
2
- // repo, no identity, no keyword row, and ships no browser extension. Keyed on the work tree and on what no tracked
2
+ // repo, no identity, no machine of the owner, no keyword row, and ships no browser extension. Keyed on the work tree and on what no tracked
3
3
  // file carries (release/public-clean.ts publicCleanKey): each unit's tree on disk, gitignored files included, the
4
4
  // house repos, the identity, keyword and allow files. A release scans fresh
5
5
  import { check, type CheckEnv } from '../check.ts'
@@ -12,7 +12,7 @@ export const publicCleanCheck = check({
12
12
  id: PUBLIC_CLEAN_ID,
13
13
  blocking: true,
14
14
  title: 'public clean',
15
- description: 'what an npm unit publishes names no house repo, identity or keyword row',
15
+ description: 'what an npm unit publishes names no house repo, identity, machine or keyword row',
16
16
  owner: 'tools/shipkit/units.md',
17
17
  runs: { onPreCommit: false, onCi: true, onFull: true, onRelease: true, onHealth: true, onSave: 'moved', onClock: false },
18
18
  cache: { by: 'files', inputs: ['.'], key: (env) => publicCleanKey(env.root, npmUnits(env)) },