rvlib-shipkit 2.12.0 → 2.14.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 (378) hide show
  1. package/CHANGELOG.md +75 -21
  2. package/README.md +1 -1
  3. package/package.json +4 -2
  4. package/src/agent-time/store.ts +2 -2
  5. package/src/assets/run-assets.ts +2 -2
  6. package/src/assets/server/studio-server.ts +27 -23
  7. package/src/check.ts +4 -4
  8. package/src/checks/SK001-package-json-shape.check.ts +8 -4
  9. package/src/checks/SK002-contracts-fulfillness.check.ts +2 -2
  10. package/src/checks/SK003-claude-md-shape.check.ts +20 -13
  11. package/src/checks/SK004-gitignore-policy.check.ts +45 -6
  12. package/src/checks/SK005-rvlib-versions.check.ts +2 -2
  13. package/src/checks/SK006-npm-publish-safety.check.ts +3 -3
  14. package/src/checks/SK007-github-visibility.check.ts +2 -2
  15. package/src/checks/SK008-reviewer-agent.check.ts +3 -3
  16. package/src/checks/SK010-undeclared-unit.check.ts +2 -2
  17. package/src/checks/SK011-sibling-unit-ranges.check.ts +2 -2
  18. package/src/checks/SK012-config-barrel-import.check.ts +2 -2
  19. package/src/checks/SK013-one-way-in-policy.check.ts +2 -2
  20. package/src/checks/SK015-nested-repo.check.ts +3 -3
  21. package/src/checks/SK016-legacy-check-shapes.check.ts +2 -2
  22. package/src/checks/SK017-vscode-hub-task.check.ts +2 -2
  23. package/src/checks/SK018-test-files-run.check.ts +2 -2
  24. package/src/checks/SK019-tests-run-in-units.check.ts +2 -2
  25. package/src/checks/SK020-self-spawning-check.check.ts +2 -2
  26. package/src/checks/SK022-machine-runs-the-pin.check.ts +2 -2
  27. package/src/checks/SK024-identity-colors.check.ts +1 -1
  28. package/src/checks/SK025-release-drift.check.ts +2 -2
  29. package/src/checks/SK026-asks-autoclose.check.ts +2 -2
  30. package/src/checks/SK027-agent-wiki-links.check.ts +8 -2
  31. package/src/checks/SK028-readme.check.ts +2 -2
  32. package/src/checks/SK029-explicit-check-files.check.ts +3 -3
  33. package/src/checks/SK030-cache-audit.check.ts +7 -5
  34. package/src/checks/SK031-trace-audit.check.ts +7 -7
  35. package/src/checks/SK032-ignored-inputs.check.ts +3 -3
  36. package/src/checks/SK033-global-contribution.check.ts +11 -4
  37. package/src/checks/SK034-commit-gates-armed.check.ts +2 -2
  38. package/src/checks/SK035-public-clean.check.ts +46 -0
  39. package/src/checks/SK036-draft-media-size.check.ts +28 -0
  40. package/src/checks/SK037-keyword-additions.check.ts +43 -0
  41. package/src/cli/cmd_Backup.ts +152 -0
  42. package/src/cli/cmd_Ci.ts +8 -11
  43. package/src/cli/cmd_Commands.ts +4 -4
  44. package/src/cli/cmd_ConfigKeys.ts +2 -2
  45. package/src/cli/cmd_Drill.ts +145 -0
  46. package/src/cli/cmd_Home.ts +50 -3
  47. package/src/cli/cmd_Init.ts +1 -1
  48. package/src/cli/cmd_Media.ts +10 -8
  49. package/src/cli/cmd_Mv.ts +14 -7
  50. package/src/cli/cmd_Review.ts +6 -4
  51. package/src/cli/cmd_Shot.ts +5 -2
  52. package/src/cli/cmd_Smoke.ts +5 -2
  53. package/src/cli/cmd_Social.ts +226 -0
  54. package/src/cli/cmd_Sound.ts +1 -1
  55. package/src/cli/cmd_Start.ts +1 -1
  56. package/src/cli/cmd_Time.ts +1 -1
  57. package/src/cli/cmd_TraceAudit.ts +6 -6
  58. package/src/cli/cmd_Trailer.ts +7 -4
  59. package/src/cli/cmd_Veille.ts +173 -0
  60. package/src/cli/cmd_When.ts +2 -2
  61. package/src/cli/family-pages.ts +19 -16
  62. package/src/cli/registry.ts +13 -2
  63. package/src/cli.ts +5 -2
  64. package/src/collections/actions.ts +1 -49
  65. package/src/collections/checks.ts +2 -1
  66. package/src/collections/collection-types.ts +12 -3
  67. package/src/collections/providers.ts +4 -4
  68. package/src/collections/review.ts +3 -2
  69. package/src/collections/tests.ts +19 -8
  70. package/src/comfy/comfy-panel.ts +2 -2
  71. package/src/contracts/apply-contracts.ts +1 -3
  72. package/src/contracts/contract-manifests.ts +2 -3
  73. package/src/contracts/contract-types.ts +0 -1
  74. package/src/contracts/contracts-engine.ts +0 -3
  75. package/src/contracts/manifests/discord.contract.ts +1 -1
  76. package/src/contracts/manifests/identity.contract.ts +1 -1
  77. package/src/contracts/manifests/itch.contract.ts +1 -1
  78. package/src/contracts/manifests/steam.contract.ts +1 -1
  79. package/src/core/agent-dir-at.ts +12 -0
  80. package/src/core/agent-dir.ts +16 -0
  81. package/src/core/app-icon.ts +9 -3
  82. package/src/core/budget.ts +1 -1
  83. package/src/core/bun-builtins.ts +2 -2
  84. package/src/core/canonical-scripts.ts +2 -2
  85. package/src/core/discover-checks.ts +38 -6
  86. package/src/core/fix-scope.ts +4 -2
  87. package/src/core/floor-resolve.ts +68 -48
  88. package/src/core/floor.ts +9 -0
  89. package/src/core/git-root.ts +24 -0
  90. package/src/core/global-contribution.ts +4 -1
  91. package/src/core/ignored-block.ts +1 -1
  92. package/src/core/ignored-inputs.ts +3 -2
  93. package/src/core/last-good.ts +3 -1
  94. package/src/core/layout.ts +8 -0
  95. package/src/core/log-stamp.ts +36 -0
  96. package/src/core/loop-watch.ts +93 -0
  97. package/src/core/machine-link.ts +134 -0
  98. package/src/core/memory-watch.ts +41 -0
  99. package/src/core/motherhome.ts +2 -2
  100. package/src/core/one-way-in-policy.ts +34 -26
  101. package/src/core/run-ci.ts +9 -11
  102. package/src/core/run-fixers.ts +9 -9
  103. package/src/core/runs-matrix.ts +1 -1
  104. package/src/core/slots.ts +30 -0
  105. package/src/core/trace-audit.ts +50 -9
  106. package/src/core/tree-rev.ts +60 -0
  107. package/src/core/unit-files.ts +42 -0
  108. package/src/drill/render.ts +140 -0
  109. package/src/drill/run.ts +269 -0
  110. package/src/fleet/scan-fleet.ts +6 -5
  111. package/src/home/daemon-jobs.ts +201 -0
  112. package/src/home/global-context.ts +44 -8
  113. package/src/home/gui-app/ShipkitGui.swift +91 -2
  114. package/src/home/home-routes.ts +22 -15
  115. package/src/home/hubs.ts +10 -3
  116. package/src/home/inbox-shape.ts +54 -5
  117. package/src/home/inbox.ts +17 -2
  118. package/src/home/lib-watch.ts +10 -3
  119. package/src/home/machine-stores.ts +15 -29
  120. package/src/home/pm-config.ts +4 -1
  121. package/src/home/pm-inputs.ts +2 -0
  122. package/src/home/resources.ts +7 -2
  123. package/src/home/run-daemon.ts +15 -18
  124. package/src/home/run-pm.ts +3 -1
  125. package/src/home/serve-daemon.ts +4 -3
  126. package/src/home/serve-web.ts +104 -1
  127. package/src/hooks/commit-message.ts +29 -20
  128. package/src/hooks/hook-gates.ts +1 -1
  129. package/src/hooks/leak-guard.ts +69 -9
  130. package/src/hooks/run-hooks.ts +18 -22
  131. package/src/identities/identities.ts +334 -0
  132. package/src/identities/machine-route.ts +126 -0
  133. package/src/identities/machine.ts +62 -0
  134. package/src/init-repo.ts +3 -3
  135. package/src/ledger/check-stats.ts +10 -9
  136. package/src/ledger/gate-checks.ts +32 -1
  137. package/src/ledger/record-kept.ts +112 -0
  138. package/src/ledger/repo-view.ts +10 -0
  139. package/src/ledger/run-log.ts +17 -12
  140. package/src/ledger/run-timeline.ts +8 -4
  141. package/src/ledger/store.ts +7 -0
  142. package/src/ledger/suite-log.ts +17 -13
  143. package/src/media-kinds.ts +3 -2
  144. package/src/media-store/backup/daemon.ts +73 -0
  145. package/src/media-store/backup/keys.ts +25 -0
  146. package/src/media-store/backup/manifest.ts +193 -0
  147. package/src/media-store/backup/restore.ts +192 -0
  148. package/src/media-store/backup/run.ts +278 -0
  149. package/src/media-store/backup/secret.ts +86 -0
  150. package/src/media-store/backup/snapshot.ts +64 -0
  151. package/src/media-store/backup/sources.ts +199 -0
  152. package/src/media-store/content.ts +1 -1
  153. package/src/media-store/daemon.ts +56 -70
  154. package/src/media-store/db.ts +1 -1
  155. package/src/media-store/fact.ts +1 -1
  156. package/src/media-store/hand.ts +1 -1
  157. package/src/media-store/kind.ts +1 -1
  158. package/src/media-store/purge.ts +1 -1
  159. package/src/media-store/put.ts +5 -3
  160. package/src/media-store/remote.ts +1 -1
  161. package/src/media-store/space.ts +24 -5
  162. package/src/mv/mv-md.ts +63 -22
  163. package/src/pages/forward.ts +35 -0
  164. package/src/pages/frame-client.ts +118 -0
  165. package/src/pages/routes.ts +29 -0
  166. package/src/pages/unit.ts +92 -0
  167. package/src/plan/planner.ts +12 -0
  168. package/src/plan/repo-source.ts +19 -5
  169. package/src/reflect/transcript.ts +35 -10
  170. package/src/release/public-clean.ts +319 -0
  171. package/src/release/published-here.ts +22 -0
  172. package/src/release/run-bump.ts +3 -2
  173. package/src/release/run-release.ts +7 -4
  174. package/src/repo-config.ts +71 -13
  175. package/src/review/anim.ts +1 -1
  176. package/src/review/auto.ts +1 -1
  177. package/src/review/cells.ts +15 -1
  178. package/src/review/format.ts +2 -2
  179. package/src/review/http.ts +16 -2
  180. package/src/review/marks.ts +1 -1
  181. package/src/review/media-kind.ts +1 -1
  182. package/src/review/media-read.ts +1 -1
  183. package/src/review/model.ts +27 -6
  184. package/src/review/notes.ts +125 -0
  185. package/src/review/previews.ts +1 -1
  186. package/src/review/project.ts +7 -39
  187. package/src/review/role.ts +1 -1
  188. package/src/review/routes.ts +18 -14
  189. package/src/review/store.ts +42 -2
  190. package/src/review/threads.ts +1 -1
  191. package/src/review/trailer-desk.ts +3 -3
  192. package/src/review/trailer-media.ts +8 -5
  193. package/src/review/trailer-model.ts +1 -1
  194. package/src/review/trailer-routes.ts +1 -1
  195. package/src/review/trailer-shots.ts +22 -5
  196. package/src/review/unit.ts +2 -2
  197. package/src/scaffold/files/agent-handoff.md +3 -0
  198. package/src/scaffold/files/agent-index.md +4 -12
  199. package/src/scaffold/files/tsconfig.json +1 -1
  200. package/src/scaffold/project-scaffold.ts +6 -5
  201. package/src/serve/embed.ts +2 -2
  202. package/src/serve/hub-app/check-words.ts +1 -1
  203. package/src/serve/hub-app/col-card.tsx +3 -17
  204. package/src/serve/hub-app/col-tables-view.tsx +2 -1
  205. package/src/serve/hub-app/cols-svc.ts +0 -13
  206. package/src/serve/hub-app/dock-st.ts +4 -2
  207. package/src/serve/hub-app/dock-view.tsx +2 -0
  208. package/src/serve/hub-app/frames-st.ts +35 -0
  209. package/src/serve/hub-app/hash-route.ts +64 -1
  210. package/src/serve/hub-app/home-st.ts +32 -8
  211. package/src/serve/hub-app/home-strip.css +9 -1
  212. package/src/serve/hub-app/home-strip.tsx +7 -6
  213. package/src/serve/hub-app/home.html +5 -0
  214. package/src/serve/hub-app/hub-app.tsx +51 -7
  215. package/src/serve/hub-app/hub.css +29 -11
  216. package/src/serve/hub-app/icons.tsx +16 -1
  217. package/src/serve/hub-app/identities-st.ts +210 -0
  218. package/src/serve/hub-app/identities-view.tsx +353 -0
  219. package/src/serve/hub-app/identities.css +48 -0
  220. package/src/serve/hub-app/identity-address.ts +52 -0
  221. package/src/serve/hub-app/inbox-st.ts +60 -7
  222. package/src/serve/hub-app/inbox-view.tsx +49 -7
  223. package/src/serve/hub-app/inbox.css +12 -1
  224. package/src/serve/hub-app/index.html +3 -0
  225. package/src/serve/hub-app/kept-cols.tsx +30 -0
  226. package/src/serve/hub-app/keys.ts +10 -2
  227. package/src/serve/hub-app/list-walk.ts +89 -0
  228. package/src/serve/hub-app/machine-st.ts +12 -0
  229. package/src/serve/hub-app/media-svc.ts +1 -1
  230. package/src/serve/hub-app/media-view.tsx +2 -1
  231. package/src/serve/hub-app/pages-frames.tsx +134 -0
  232. package/src/serve/hub-app/pages-svc.ts +111 -0
  233. package/src/serve/hub-app/palette-st.ts +18 -3
  234. package/src/serve/hub-app/palette-view.tsx +9 -2
  235. package/src/serve/hub-app/planned-view.tsx +2 -1
  236. package/src/serve/hub-app/project-list.css +18 -14
  237. package/src/serve/hub-app/project-list.tsx +88 -49
  238. package/src/serve/hub-app/projects-svc.ts +33 -3
  239. package/src/serve/hub-app/repo-sections.ts +19 -2
  240. package/src/serve/hub-app/repo-st.ts +76 -20
  241. package/src/serve/hub-app/review/review-board.tsx +1 -1
  242. package/src/serve/hub-app/review/review-cells.tsx +6 -5
  243. package/src/serve/hub-app/review/review-kit.ts +30 -7
  244. package/src/serve/hub-app/review/review-page.tsx +6 -5
  245. package/src/serve/hub-app/review/review-st.ts +34 -15
  246. package/src/serve/hub-app/review/review-thread.tsx +63 -14
  247. package/src/serve/hub-app/review/review-views.tsx +133 -51
  248. package/src/serve/hub-app/review/thread-st.ts +80 -37
  249. package/src/serve/hub-app/review/trailer-page.tsx +7 -5
  250. package/src/serve/hub-app/review/trailer-st.ts +1 -1
  251. package/src/serve/hub-app/review.css +26 -9
  252. package/src/serve/hub-app/site/site-part.tsx +173 -0
  253. package/src/serve/hub-app/site/site-st.ts +157 -0
  254. package/src/serve/hub-app/site.css +35 -0
  255. package/src/serve/hub-app/social/calendar.tsx +182 -0
  256. package/src/serve/hub-app/social/comms-page.tsx +330 -0
  257. package/src/serve/hub-app/social/kit.tsx +244 -0
  258. package/src/serve/hub-app/social/post-card.tsx +456 -0
  259. package/src/serve/hub-app/social/problems.tsx +60 -0
  260. package/src/serve/hub-app/social/social-model.ts +154 -0
  261. package/src/serve/hub-app/social/social-page.tsx +681 -0
  262. package/src/serve/hub-app/social/social-st.ts +1014 -0
  263. package/src/serve/hub-app/social.css +289 -0
  264. package/src/serve/hub-app/stores/stores-page.tsx +312 -0
  265. package/src/serve/hub-app/stores/stores-st.ts +286 -0
  266. package/src/serve/hub-app/stores.css +54 -0
  267. package/src/serve/hub-app/timeline-geometry.ts +1 -1
  268. package/src/serve/hub-app/timeline-view.tsx +3 -2
  269. package/src/serve/hub-app/tree-build.ts +6 -0
  270. package/src/serve/hub-app/tree-row.tsx +27 -4
  271. package/src/serve/hub-app/tree-svc.ts +18 -49
  272. package/src/serve/hub-app/veille/veille-page.tsx +515 -0
  273. package/src/serve/hub-app/veille/veille-st.ts +443 -0
  274. package/src/serve/hub-app/veille.css +84 -0
  275. package/src/serve/hub-runtime.ts +20 -11
  276. package/src/serve/project-gutter-route.ts +44 -12
  277. package/src/serve/run-lanes.ts +7 -4
  278. package/src/serve/same-origin.ts +1 -1
  279. package/src/serve/serve-hub.ts +20 -12
  280. package/src/serve/tracked-watch.ts +24 -3
  281. package/src/serve/warm-cell.ts +5 -1
  282. package/src/shipkit-files.ts +15 -4
  283. package/src/shipkit.ts +0 -1
  284. package/src/shot/box.ts +160 -0
  285. package/src/shot/browser-slot.ts +74 -0
  286. package/src/shot/client.ts +42 -7
  287. package/src/shot/clip-encoder.ts +108 -24
  288. package/src/shot/film-box.ts +292 -0
  289. package/src/shot/shooter.ts +71 -17
  290. package/src/shot/shot-ask.ts +10 -2
  291. package/src/shot/stepped-clip.ts +5 -4
  292. package/src/site/desk.ts +242 -0
  293. package/src/site/routes.ts +66 -0
  294. package/src/site/unit.ts +62 -0
  295. package/src/social/brands.ts +22 -0
  296. package/src/social/card-drafts.ts +24 -0
  297. package/src/social/compose.ts +97 -0
  298. package/src/social/desk-index.ts +123 -0
  299. package/src/social/desk-wire.ts +64 -0
  300. package/src/social/drafts.ts +183 -0
  301. package/src/social/house.ts +24 -0
  302. package/src/social/load.ts +332 -0
  303. package/src/social/md.ts +70 -0
  304. package/src/social/media-facts.ts +53 -0
  305. package/src/social/media-kind.ts +189 -0
  306. package/src/social/media-limit.ts +42 -0
  307. package/src/social/media-of.ts +30 -0
  308. package/src/social/migrate.ts +123 -0
  309. package/src/social/open.ts +17 -0
  310. package/src/social/post-url.ts +158 -0
  311. package/src/social/presence.ts +332 -0
  312. package/src/social/public-read.ts +53 -0
  313. package/src/social/publish/bluesky.ts +168 -0
  314. package/src/social/publish/discord.ts +76 -0
  315. package/src/social/publish/index.ts +24 -0
  316. package/src/social/publish/secret.ts +13 -0
  317. package/src/social/push.ts +37 -0
  318. package/src/social/richtext.ts +37 -0
  319. package/src/social/routes.ts +186 -0
  320. package/src/social/stats.ts +134 -0
  321. package/src/social/text.ts +267 -0
  322. package/src/social/tracker-route.ts +39 -0
  323. package/src/social/tracker.ts +255 -0
  324. package/src/social/unit.ts +53 -0
  325. package/src/social/writes.ts +130 -0
  326. package/src/start-repo.ts +14 -9
  327. package/src/stores/collection.ts +27 -0
  328. package/src/stores/desk.ts +336 -0
  329. package/src/stores/model.ts +187 -0
  330. package/src/stores/routes.ts +126 -0
  331. package/src/stores/unit.ts +57 -0
  332. package/src/suite/calibrate.ts +127 -0
  333. package/src/suite/core-counters.ts +91 -0
  334. package/src/suite/judge-suites.ts +95 -35
  335. package/src/suite/suite-cli.ts +44 -10
  336. package/src/suite/suite-cpu-preload.ts +34 -9
  337. package/src/trace/tracer.ts +12 -5
  338. package/src/trailer/adapter.ts +5 -1
  339. package/src/trailer/build.ts +45 -12
  340. package/src/trailer/ffmpeg.ts +11 -0
  341. package/src/trailer/footage.ts +30 -13
  342. package/src/trailer/grammar.ts +18 -2
  343. package/src/trailer/graph.ts +28 -6
  344. package/src/trailer/holes.ts +1 -1
  345. package/src/trailer/passage.ts +18 -6
  346. package/src/trailer/plan.ts +74 -3
  347. package/src/trailer/prune.ts +1 -1
  348. package/src/trailer/states.ts +1 -1
  349. package/src/trailer/stitch.ts +67 -26
  350. package/src/trailer/url.ts +1 -1
  351. package/src/trailer/versions.ts +24 -0
  352. package/src/trailer/words.ts +1 -1
  353. package/src/ts/gate-typecheck.ts +32 -0
  354. package/src/ts/typecheck-cli.ts +9 -11
  355. package/src/tui/run-tui.ts +1 -1
  356. package/src/tui/tui-app.tsx +0 -1
  357. package/src/tui/tui-store.ts +1 -1
  358. package/src/veille/asks.ts +155 -0
  359. package/src/veille/auto.ts +31 -0
  360. package/src/veille/batch.ts +27 -0
  361. package/src/veille/chrome.ts +127 -0
  362. package/src/veille/collection.ts +28 -0
  363. package/src/veille/desk.ts +242 -0
  364. package/src/veille/identity.ts +80 -0
  365. package/src/veille/import.ts +68 -0
  366. package/src/veille/log.ts +183 -0
  367. package/src/veille/platforms.ts +118 -0
  368. package/src/veille/reads.ts +66 -0
  369. package/src/veille/replied.ts +110 -0
  370. package/src/veille/routes.ts +185 -0
  371. package/src/veille/service.ts +81 -0
  372. package/src/veille/watch.ts +116 -0
  373. package/src/veille/worth.ts +46 -0
  374. package/src/wiki/scan-md.ts +18 -0
  375. package/src/collections/posts.ts +0 -142
  376. package/src/contracts/manifests/social.contract.ts +0 -20
  377. package/src/scaffold/files/agent-coding.md +0 -35
  378. package/src/ts/typecheck-cache.ts +0 -11
@@ -0,0 +1,319 @@
1
+ // what an npm unit publishes names nothing of the house (wiki tools/shipkit/units.md): the file list is npm's own
2
+ // pack list, the words come from the data (house repos, identities, the keyword file), so a new repo or identity is
3
+ // covered the day it exists. A hit reports file:line and the masked word, never the word
4
+ import { createHash } from 'crypto'
5
+ import { existsSync, readdirSync, readFileSync, statSync } from 'fs'
6
+ import { homedir } from 'os'
7
+ import { dirname, join, relative } from 'path'
8
+ import { scanFleet } from '../fleet/scan-fleet.ts'
9
+ import { evaluateLeak, globalAllowFile, withBuiltinRows, globalKeywordFile, leakAllowProblem, loadAllowFile, maskPattern, occurrences, parsePatterns, patternFingerprint, type LoadedAllow } from '../hooks/leak-guard.ts'
10
+ import { readIdentities, type Identities } from '../identities/identities.ts'
11
+ import { KEYWORD_FILE, LAYOUT } from '../core/layout.ts'
12
+ import { parseDirectives, reaches } from '../core/waivers.ts'
13
+ import { fileStamp } from '../core/file-stamp.ts'
14
+ import { gitRoot } from '../core/git-root.ts'
15
+ import { houseIndex, houseRepos } from '../serve/project-gutter.ts'
16
+ import type { RepoConfig } from '../repo-config.ts'
17
+
18
+ /** a word the tarball may not carry, and what it is (never the word itself) */
19
+ export type HouseWord = { word: string; what: string }
20
+
21
+ /** a word the tarball may carry, with why: printed every time it applies */
22
+ export type AllowedWord = { word: string; reason: string }
23
+
24
+ /** reads a file by absolute path, null when absent: the check records each read for its cache, the release reads plainly */
25
+ export type Read = (abs: string) => string | null
26
+
27
+ export const readPlain: Read = (abs) => {
28
+ try {
29
+ return readFileSync(abs, 'utf8')
30
+ } catch {
31
+ return null
32
+ }
33
+ }
34
+
35
+ /** what npm would put in the tarball, unit-relative and sorted: its own pack list, never a guess of it */
36
+ export async function packList(unitDir: string): Promise<{ files: string[] } | { error: string }> {
37
+ const npm = Bun.which('npm')
38
+ if (npm == null) return { error: 'npm is not installed: the pack list is npm\'s own, nothing else can say what ships' }
39
+ const p = Bun.spawn([npm, 'pack', '--dry-run', '--json', '--ignore-scripts'], { cwd: unitDir, stdout: 'pipe', stderr: 'pipe' })
40
+ const [out, err, code] = await Promise.all([new Response(p.stdout).text(), new Response(p.stderr).text(), p.exited])
41
+ if (code !== 0) return { error: `npm pack --dry-run exited ${code}: ${err.trim().split('\n').slice(-2).join(' ')}` }
42
+ try {
43
+ const [packed] = JSON.parse(out) as { files: { path: string }[] }[]
44
+ return { files: (packed?.files ?? []).map((f) => f.path).sort() }
45
+ } catch (e) {
46
+ return { error: `npm pack --dry-run --json printed no pack list (${String(e).slice(0, 120)})` }
47
+ }
48
+ }
49
+
50
+ /** every house repo on this disk by name: the house discovery (archived ones too) and the fleet */
51
+ export function houseRepoWords(root: string, home = homedir()): HouseWord[] {
52
+ const house = houseRepos(root, home)
53
+ const names = new Set([...house.repos, ...house.archived].map((r) => r.name))
54
+ for (const r of scanFleet(dirname(house.home))) names.add(r.name)
55
+ return [...names].sort().map((word) => ({ word, what: 'a house repo' }))
56
+ }
57
+
58
+ /** the identities folder of the house this repo belongs to, null with no house */
59
+ export function houseIdentitiesDir(root: string, home = homedir()): string | null {
60
+ const env = process.env['SHIPKIT_IDENTITIES_DIR']
61
+ if (env) return env
62
+ const index = houseIndex(houseRepos(root, home).home, home)
63
+ const top = index == null ? null : gitRoot(dirname(index))?.top
64
+ return top == null ? null : join(top, LAYOUT.identities)
65
+ }
66
+
67
+ const host = (url: string): string => {
68
+ try {
69
+ return new URL(url).hostname.replace(/^www\./, '')
70
+ } catch {
71
+ return ''
72
+ }
73
+ }
74
+
75
+ /** a handle's own part: `@x`, `u/x`, `@x@instance` and `x.bsky.social` are all `x`; a platform host is never a word */
76
+ export function handleWord(handle: string): string {
77
+ const h = handle.trim().replace(/^u\//, '').replace(/^@/, '')
78
+ const user = h.split('@')[0] ?? ''
79
+ return (user.includes('.') ? (user.replace(/^www\./, '').split('.')[0] ?? '') : user).trim()
80
+ }
81
+
82
+ /** every word that names an identity: id, name, site domain, site repo, email, each account's handle */
83
+ export function identityWords(ids: Identities): HouseWord[] {
84
+ const out: HouseWord[] = []
85
+ const add = (word: string, what: string): void => {
86
+ const w = word.trim()
87
+ if (w.length >= 3 && !out.some((x) => x.word.toLowerCase() === w.toLowerCase())) out.push({ word: w, what })
88
+ }
89
+ for (const i of ids.identities) {
90
+ add(i.id, 'an identity id')
91
+ add(i.name, 'an identity name')
92
+ add(host(i.site), 'an identity site domain')
93
+ add(i.siteRepo, 'an identity site repo')
94
+ for (const r of i.rows) if (r.field === 'email') add(r.value, 'an identity email')
95
+ for (const a of i.accounts) {
96
+ add(handleWord(a.handle), 'an identity handle')
97
+ for (const r of a.rows) if (r.field === 'email') add(r.value, 'an identity email')
98
+ }
99
+ }
100
+ return out
101
+ }
102
+
103
+ type Pkg = { name?: string; author?: string | { name?: string }; funding?: string | { url?: string }; repository?: string | { url?: string } } & Partial<Record<'dependencies' | 'devDependencies' | 'peerDependencies' | 'optionalDependencies', Record<string, string>>>
104
+
105
+ const githubOwner = (v: string | { url?: string } | undefined): string | null => /github\.com\/(?:sponsors\/)?([A-Za-z0-9-]+)/.exec(typeof v === 'string' ? v : (v?.url ?? ''))?.[1] ?? null
106
+
107
+ /** what the package itself makes public: its name, its declared author, the packages it names as dependencies */
108
+ export function allowedWords(pkg: Pkg): AllowedWord[] {
109
+ const out: AllowedWord[] = []
110
+ if (pkg.name) out.push({ word: pkg.name, reason: "the package's own name" })
111
+ const author = typeof pkg.author === 'string' ? pkg.author.replace(/\s*[<(].*$/, '') : pkg.author?.name
112
+ for (const a of [author, githubOwner(pkg.funding), githubOwner(pkg.repository)]) if (a) out.push({ word: a, reason: 'the declared author (package.json author, funding, repository)' })
113
+ for (const block of ['dependencies', 'devDependencies', 'peerDependencies', 'optionalDependencies'] as const)
114
+ for (const d of Object.keys(pkg[block] ?? {})) out.push({ word: d, reason: `a declared dependency (${block}), a public package` })
115
+ const seen = new Set<string>()
116
+ return out.filter((a) => !seen.has(a.word.toLowerCase()) && (seen.add(a.word.toLowerCase()), true))
117
+ }
118
+
119
+ const BINARY = /\.(png|jpe?g|gif|webp|ico|woff2?|ttf|eot|otf|zip|gz|wasm|mp3|mp4|ogg|wav|flac|node)$/i
120
+
121
+ /** `directive`: the reason of the in-file `sk-disable-… SK035` that waives the site, null when none does */
122
+ /** `count`: the matches of this pattern in this file, what an allowlist entry's `count` names. `over`: an entry
123
+ * allowed fewer */
124
+ export type PublicSite = { file: string; line: number; masked: string; fingerprint: string; what: string; directive: string | null; count: number; over?: { count: number; source: string } }
125
+
126
+ export const PUBLIC_CLEAN_ID = 'SK035'
127
+
128
+ export type PublicCleanResult = {
129
+ files: string[]
130
+ hits: PublicSite[]
131
+ /** a file npm would pack that must never ship whatever it says (a browser extension) */
132
+ refused: { file: string; why: string }[]
133
+ allowed: { word: string; reason: string }[]
134
+ waived: { file: string; masked: string; reason: string; source: string }[]
135
+ notes: string[]
136
+ }
137
+
138
+ export type PublicCleanInput = {
139
+ /** repo-relative unit dir, '' for the root */
140
+ rel: string
141
+ files: { file: string; content: string }[]
142
+ words: HouseWord[]
143
+ keywordText: string
144
+ allowedWords: AllowedWord[]
145
+ allow: LoadedAllow[]
146
+ }
147
+
148
+ const lineAt = (text: string, at: number): number => {
149
+ let n = 1
150
+ for (let i = text.indexOf('\n'); i !== -1 && i < at; i = text.indexOf('\n', i + 1)) n++
151
+ return n
152
+ }
153
+
154
+ /** the whole decision, with no disk in it */
155
+ export function scanPublic(o: PublicCleanInput): Omit<PublicCleanResult, 'files' | 'notes'> {
156
+ const allowedSet = new Map(o.allowedWords.map((a) => [a.word.toLowerCase(), a.reason]))
157
+ const what = new Map<string, string>()
158
+ const allowed: AllowedWord[] = []
159
+ for (const w of o.words) {
160
+ const k = w.word.toLowerCase()
161
+ if (allowedSet.has(k)) {
162
+ if (!allowed.some((a) => a.word.toLowerCase() === k)) allowed.push({ word: w.word, reason: allowedSet.get(k)! })
163
+ } else if (!what.has(k)) what.set(k, w.what)
164
+ }
165
+ const kw = parsePatterns(o.keywordText)
166
+ // a keyword row the package itself makes public is allowed too, printed masked: the list stays unquotable
167
+ const allowRow = (id: string): boolean => {
168
+ const reason = allowedSet.get(id)
169
+ if (reason != null && !allowed.some((a) => a.word === maskPattern(id))) allowed.push({ word: maskPattern(id), reason: `a keyword row, ${reason}` })
170
+ return reason == null
171
+ }
172
+ const patterns = parsePatterns([...what.keys()].map((w) => `w:${w}`).join('\n'))
173
+ patterns.substrings.push(...kw.substrings.filter(allowRow))
174
+ patterns.words.push(...kw.words.filter((w) => !what.has(w.word) && allowRow(w.word)))
175
+ patterns.regexes.push(...kw.regexes)
176
+
177
+ // an allowed word is one token (a dependency `garden-ui` holds a house word `garden`): blanked to spaces of its
178
+ // length, so lines and offsets stay; a token that goes on as a host (`name.tld`) stays to be scanned
179
+ const tokens = o.allowedWords.map((a) => new RegExp(`(?<![\\p{L}\\p{N}_-]|[\\p{L}\\p{N}]\\.)${a.word.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}(?![\\p{L}\\p{N}_-]|\\.[\\p{L}\\p{N}])`, 'giu'))
180
+ const lowerAllowed = o.allowedWords.map((a) => a.word.toLowerCase())
181
+ const blankAllowed = (text: string): string => {
182
+ const lower = text.toLowerCase()
183
+ return tokens.reduce((t, re, i) => (lower.includes(lowerAllowed[i]!) ? t.replace(re, (m) => ' '.repeat(m.length)) : t), text)
184
+ }
185
+ const at = (f: string): string => (o.rel === '' ? f : `${o.rel}/${f}`)
186
+ const refused: PublicCleanResult['refused'] = []
187
+ const targets = []
188
+ for (const f of o.files) {
189
+ if (/(^|\/)manifest\.json$/.test(f.file) && /"manifest_version"\s*:/.test(f.content))
190
+ refused.push({ file: at(f.file), why: 'a browser extension: it is loaded unpacked, never installed from npm' })
191
+ if (!BINARY.test(f.file)) targets.push({ where: 'packed file', file: at(f.file), content: blankAllowed(f.content) })
192
+ }
193
+ const { hits, waived } = evaluateLeak(targets, patterns, o.allow)
194
+ const byFile = new Map(targets.map((t) => [t.file, t.content]))
195
+ const found = new Map<string, Map<string, [number, number][]>>()
196
+ const sites: PublicSite[] = []
197
+ for (const h of hits) {
198
+ const file = h.file!
199
+ const content = byFile.get(file) ?? ''
200
+ if (!found.has(file)) found.set(file, occurrences(content, patterns))
201
+ const spans = found.get(file)!.get(h.pattern) ?? []
202
+ const lines = new Set(spans.map(([s]) => lineAt(content, s)))
203
+ const label = what.get(h.pattern) ?? 'a keyword row'
204
+ const directives = parseDirectives(file, content).filter((d) => d.reason != null && d.ids.includes(PUBLIC_CLEAN_ID))
205
+ for (const line of [...lines].sort((a, b) => a - b))
206
+ sites.push({ file, line, masked: maskPattern(h.pattern), fingerprint: patternFingerprint(h.pattern), what: label, directive: directives.find((d) => reaches(d, line))?.reason ?? null, count: spans.length, ...(h.over == null ? {} : { over: { count: h.over.count, source: h.over.source } }) })
207
+ }
208
+ sites.sort((a, b) => a.file.localeCompare(b.file) || a.line - b.line)
209
+ return { hits: sites, refused, allowed, waived: waived.map((w) => ({ file: w.file ?? w.where, masked: maskPattern(w.pattern), reason: w.reason, source: w.source })) }
210
+ }
211
+
212
+ /** the repo's declared waivers and the machine's, as the commit leak guard loads them */
213
+ export function publicAllow(config: RepoConfig, read: Read): { entries: LoadedAllow[]; notes: string[] } {
214
+ const entries: LoadedAllow[] = []
215
+ const notes: string[] = []
216
+ ;(config.hooks?.leakAllow ?? []).forEach((e, i) => {
217
+ const problem = leakAllowProblem(e, `repo.config.ts hooks.leakAllow[${i}]`, true)
218
+ if (problem != null) notes.push(`${problem}, entry IGNORED`)
219
+ else entries.push({ ...e, source: `repo.config.ts hooks.leakAllow[${i}]` })
220
+ })
221
+ const g = globalAllowFile()
222
+ if (g != null && read(g) != null) {
223
+ const loaded = loadAllowFile(g, false)
224
+ entries.push(...loaded.entries)
225
+ notes.push(...loaded.notes)
226
+ }
227
+ return { entries, notes }
228
+ }
229
+
230
+ /** one unit's tarball against every house word. `read` sees every file the answer depends on */
231
+ export async function publicClean(root: string, config: RepoConfig, unit: { dir: string }, read: Read = readPlain): Promise<PublicCleanResult> {
232
+ const rel = relative(root, unit.dir)
233
+ const notes: string[] = []
234
+ const listed = await packList(unit.dir)
235
+ if ('error' in listed) return { files: [], hits: [], refused: [{ file: rel || '.', why: listed.error }], allowed: [], waived: [], notes }
236
+ const files = listed.files.map((f) => ({ file: f, content: read(join(unit.dir, f)) ?? '' }))
237
+ let pkg: Pkg = {}
238
+ try {
239
+ pkg = JSON.parse(read(join(unit.dir, 'package.json')) ?? '{}') as Pkg
240
+ } catch {
241
+ notes.push(`${rel || '.'}/package.json does not parse: nothing is allowed by name`)
242
+ }
243
+ const kwFiles = [join(root, KEYWORD_FILE), globalKeywordFile()].filter((f): f is string => f != null && read(f) != null)
244
+ if (kwFiles.length === 0) notes.push('no keyword file (.shipkit/private/banned-keywords.txt, here or machine global): its rows are not scanned')
245
+ const idsDir = houseIdentitiesDir(root)
246
+ const ids = idsDir != null && existsSync(idsDir) ? readIdentities(idsDir) : null
247
+ if (ids == null) notes.push('no identities folder in this house: no identity word is scanned')
248
+ else for (const i of ids.identities) for (const f of [i.file, ...i.accounts.map((a) => a.file)]) read(f)
249
+ const allow = publicAllow(config, read)
250
+ notes.push(...allow.notes)
251
+ const scanned = scanPublic({
252
+ rel,
253
+ files,
254
+ words: [...houseRepoWords(root), ...(ids == null ? [] : identityWords(ids))],
255
+ keywordText: withBuiltinRows(kwFiles.map((f) => read(f) ?? '')),
256
+ allowedWords: allowedWords(pkg),
257
+ allow: allow.entries,
258
+ })
259
+ return { files: listed.files, notes, ...scanned }
260
+ }
261
+
262
+ /** the release preflight's refusals: one line a site, the word masked */
263
+ /** the packed files that name a checkout the house config lists under `start.skip` (a day-job repo): such a
264
+ * tarball never ships, and no waiver lifts it. The names come from the machine, so this file names none */
265
+ export function skippedNameSites(files: readonly { file: string; content: string }[], names: readonly string[]): string[] {
266
+ const lower = names.map((n) => n.toLowerCase()).filter((n) => n !== '')
267
+ return files.filter((f) => lower.some((n) => f.content.toLowerCase().includes(n))).map((f) => f.file)
268
+ }
269
+
270
+ export async function publicCleanBlockers(root: string, config: RepoConfig, unit: { id: string; dir: string; targets: { npm: boolean } }): Promise<string[]> {
271
+ if (!unit.targets.npm) return []
272
+ const { houseSkip } = await import('../start-repo.ts')
273
+ const skip = await houseSkip(homedir())
274
+ if (skip.length > 0) {
275
+ const listed = await packList(unit.dir)
276
+ if ('error' in listed) return [`unit '${unit.id}': ${listed.error}`]
277
+ const named = skippedNameSites(listed.files.map((f) => ({ file: f, content: readPlain(join(unit.dir, f)) ?? '' })), skip)
278
+ if (named.length > 0) return [`unit '${unit.id}': its tarball names a checkout the house never publishes (start.skip in the house config), no waiver lifts it:\n${named.join('\n')}`]
279
+ }
280
+ const r = await publicClean(root, config, unit)
281
+ const sites = [...r.refused.map((x) => `${x.file}: ${x.why}`), ...r.hits.filter((h) => h.directive == null).map((h) => `${h.file}:${h.line}: names ${h.what} (${h.masked}, ${h.fingerprint})`)]
282
+ if (sites.length === 0) return []
283
+ return [`unit '${unit.id}': its tarball names the house (rule SK035, tools/shipkit/units.md), ${sites.length} site${sites.length === 1 ? '' : 's'}:\n${sites.slice(0, 20).join('\n')}${sites.length > 20 ? `\n… ${sites.length - 20} more: sk ci --only SK035` : ''}`]
284
+ }
285
+
286
+ /** every file under `dir` on the disk, ignored ones included (npm packs a gitignored file under `files`), as
287
+ * path, size and mtime; dependency and git folders left out */
288
+ function treeStamp(dir: string, out: string[], base = dir): void {
289
+ let names: string[]
290
+ try {
291
+ names = readdirSync(dir).sort()
292
+ } catch {
293
+ return
294
+ }
295
+ for (const n of names) {
296
+ if (n === 'node_modules' || n === '.git') continue
297
+ const abs = join(dir, n)
298
+ let s
299
+ try {
300
+ s = statSync(abs)
301
+ } catch {
302
+ continue
303
+ }
304
+ if (s.isDirectory()) treeStamp(abs, out, base)
305
+ else out.push(`${relative(base, abs)}:${s.size}:${Math.floor(s.mtimeMs)}`)
306
+ }
307
+ }
308
+
309
+ /** the cache key part no tracked file carries: each unit's tree on disk, the house repos, the identity files, the
310
+ * keyword and allow files. A new house repo moves it, so the answer never outlives the words it was asked with */
311
+ export function publicCleanKey(root: string, units: { dir: string }[]): string {
312
+ const parts: string[] = []
313
+ for (const u of units) treeStamp(u.dir, parts)
314
+ parts.push(houseRepoWords(root).map((w) => w.word).join(','))
315
+ const ids = houseIdentitiesDir(root)
316
+ if (ids != null) treeStamp(ids, parts)
317
+ for (const f of [join(root, KEYWORD_FILE), globalKeywordFile(), globalAllowFile()]) if (f != null) parts.push(fileStamp(f))
318
+ return createHash('sha256').update(parts.join('\n')).digest('hex').slice(0, 16)
319
+ }
@@ -0,0 +1,22 @@
1
+ // the npm versions this machine published, so a fleet run minutes after a
2
+ // release never reads the registry's cached « latest » as the truth: npm's
3
+ // /latest answer lags a publish by minutes, the machine's own record does not
4
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs'
5
+ import { homedir } from 'os'
6
+ import { dirname, join } from 'path'
7
+
8
+ const file = (): string => process.env['SHIPKIT_PUBLISHED_FILE'] || join(homedir(), '.cache', 'shipkit', 'published.json')
9
+
10
+ const read = (): Record<string, string> => {
11
+ try { return existsSync(file()) ? (JSON.parse(readFileSync(file(), 'utf8')) as Record<string, string>) : {} }
12
+ catch { return {} }
13
+ }
14
+
15
+ export function recordPublished(name: string, version: string): void {
16
+ const all = { ...read(), [name]: version }
17
+ mkdirSync(dirname(file()), { recursive: true })
18
+ writeFileSync(file(), JSON.stringify(all, null, 2) + '\n')
19
+ }
20
+
21
+ /** the last version of `name` this machine published, or null */
22
+ export const publishedHere = (name: string): string | null => read()[name] ?? null
@@ -32,6 +32,7 @@ import { join, relative } from 'path'
32
32
  import { declaredKind, hasUnreleasedNotes, promoteUnreleased } from './changelog.ts'
33
33
  import { deriveRemote, dirtyPathList, dirtyPaths, git as gitAt, mergeProbe, remoteTags, tagExistsLocally } from './git-facts.ts'
34
34
  import { unitBlockers } from './unit-gate.ts'
35
+ import { publicCleanBlockers } from './public-clean.ts'
35
36
  import { releaseScope } from './release-scope.ts'
36
37
  import { formatUnitError, releaseOrder, renderTag, resolveUnits, unitById, unitPrepublishScripts, unknownUnit, type ReleaseUnit } from './units.ts'
37
38
  import { environmentBlockers, runReleaseGate, releaseUnit } from './run-release.ts'
@@ -253,7 +254,7 @@ export async function runBump(root: string, config: RepoConfig, kind: BumpKind |
253
254
  const s = new Set<string>([LAYOUT.status])
254
255
  if (c.docsBase != null) {
255
256
  const base = c.docsBase.startsWith('~/') ? join(homedir(), c.docsBase.slice(2)) : c.docsBase
256
- const page = join(base, 'build/shipkit/local-projects.md')
257
+ const page = join(base, 'tools/shipkit/local-projects.md')
257
258
  const prefix = r.endsWith('/') ? r : `${r}/`
258
259
  if (page.startsWith(prefix)) s.add(relative(r, page))
259
260
  }
@@ -412,7 +413,7 @@ export async function runBump(root: string, config: RepoConfig, kind: BumpKind |
412
413
  blockers.push(`unit '${unit.id}': tag ${tag} already exists on '${remote.remote}' — that version number is taken, pick another bump`)
413
414
  continue
414
415
  }
415
- blockers.push(...unitBlockers(root, config, unit))
416
+ blockers.push(...unitBlockers(root, config, unit), ...(await publicCleanBlockers(root, config, unit)))
416
417
  selected.push({ unit, version, changelogRel, kind: unitKind })
417
418
  }
418
419
  // everything the release needs that does not depend on the new version.
@@ -13,13 +13,15 @@ import { extractChangelogSection } from './changelog.ts'
13
13
  import { deriveRemote, dirtyPaths, git, remoteTagState, tagExistsLocally, type RemoteTagState } from './git-facts.ts'
14
14
  import { releaseScope } from './release-scope.ts'
15
15
  import { publishCommand, unitBlockers, type Publisher } from './unit-gate.ts'
16
+ import { recordPublished } from './published-here.ts'
17
+ import { publicCleanBlockers } from './public-clean.ts'
16
18
  import { formatUnitError, resolveUnits, unitById, unknownUnit, type ReleaseUnit } from './units.ts'
17
19
  import type { RepoConfig } from '../repo-config.ts'
18
20
  import { nestedIn, nestedRefusal } from '../core/nesting.ts'
19
21
  import { declaredTestUnits, testCheckId } from '../suite/test-units.ts'
20
22
 
21
23
  // adding a FOURTH knob here is the signal that this shape wants rethinking
22
- // rather than another key (meta/gaps.md, release-path config keys accreting)
24
+ // rather than another key (meta/gaps/index.md, release-path config keys accreting)
23
25
  export type ReleaseConfig = {
24
26
  /** releases ship from this branch only (default 'main') */
25
27
  branch?: string
@@ -31,7 +33,7 @@ export type ReleaseConfig = {
31
33
  * package.json is not private refuses to release until this says true or
32
34
  * false. A private package NEVER publishes, whatever this says. True makes
33
35
  * the root package.json a public contract. What each check does with it:
34
- * wiki/build/shipkit/built-in-checks.md */
36
+ * wiki/tools/shipkit/built-in-checks.md */
35
37
  npm?: boolean
36
38
  /** argv printing an npm auth token on stdout, as in a secret-manager read.
37
39
  * Absent = rely on ambient npm auth. Never put a token in config.
@@ -53,7 +55,7 @@ export type ReleaseConfig = {
53
55
  tsconfig?: string
54
56
  /** check ids the release gate skips: a repo-wide task (a full matrix
55
57
  * build) that is about the REPO rather than the release. Which unit test
56
- * checks a release runs is not this key's: → build/shipkit/units.md */
58
+ * checks a release runs is not this key's: → tools/shipkit/units.md */
57
59
  skipTasks?: string[]
58
60
  /** `shipkit bump` run from a feature branch merges it into the release
59
61
  * branch first, with a merge commit. Default true. A branch is a GATE, so
@@ -223,7 +225,7 @@ export async function releaseUnit(root: string, config: RepoConfig, unit: Releas
223
225
  blockers.push(`uncommitted changes in ${scope.describe} (--allow-dirty overrides):\n${dirty.split('\n').slice(0, 10).join('\n')}`)
224
226
  if (scope.specs != null) blockers.push('dirt elsewhere in the worktree is deliberately ignored, it cannot reach this tarball or this tag')
225
227
  }
226
- if (o.skipUnitGate !== true) blockers.push(...unitBlockers(root, config, unit))
228
+ if (o.skipUnitGate !== true) blockers.push(...unitBlockers(root, config, unit), ...(await publicCleanBlockers(root, config, unit)))
227
229
 
228
230
  let alreadyPublished = false
229
231
  if (wantNpm) {
@@ -316,6 +318,7 @@ export async function releaseUnit(root: string, config: RepoConfig, unit: Releas
316
318
  const cmd = publishCommand({ publisher, npmrc, token })
317
319
  const p = Bun.spawnSync(cmd.argv, { cwd: unit.dir, env: { ...env, ...cmd.env }, stdout: 'inherit', stderr: 'inherit' })
318
320
  if (p.exitCode !== 0) { print(`FAIL: ${publisher} publish failed for ${unit.id} (exit ${p.exitCode})`); return 1 }
321
+ recordPublished(name, version)
319
322
  print(`ok: published ${name}@${version}`)
320
323
  }
321
324
 
@@ -21,6 +21,7 @@ import { RETIRED_CHECK_IDS } from './core/retired-checks.ts'
21
21
  import { parseWhen } from './core/when.ts'
22
22
  import { normalizeVendored, vendoredOfText, vendoredProblem } from './core/vendored.ts'
23
23
  import { budgetValueProblem } from './core/budget.ts'
24
+ import { browsersProblem } from './core/slots.ts'
24
25
  import type { Rule } from './check.ts'
25
26
  import { leakAllowProblems } from './hooks/leak-guard.ts'
26
27
  import type { HooksConfig } from './hooks/run-hooks.ts'
@@ -40,7 +41,7 @@ export type ServeConfig = {
40
41
  port?: number
41
42
  /** the comfy-ts panel the comfy section embeds runs as its own process on
42
43
  * its own port — house range 5800+, default = the hub port plus 1000
43
- * (build/comfyui.md owns that surface) */
44
+ * (tools/comfyui/index.md owns that surface) */
44
45
  comfyPort?: number
45
46
  /** false hides the asset kit from the hub page (no asset rows, an empty
46
47
  * studio) and from `shipkit needs`, for a repo whose own tool mounts
@@ -74,6 +75,24 @@ export type ServeConfig = {
74
75
  * media store (review cards, trailer cuts...), read only in the house
75
76
  * config; its key pair read through `credsReadCommand` */
76
77
  mediaSpace?: import('./media-store/space.ts').MediaSpace
78
+ /** the secret whose value is a Cloudflare API token, read through
79
+ * `credsReadCommand`, only in the house config: the site desk asks Pages
80
+ * for a site's last production deployment with it */
81
+ cloudflareToken?: string
82
+ }
83
+
84
+ export type RepoBackup = {
85
+ /** files or folders kept whole, an archive over 50 MB included (each file read once: an unchanged size and time
86
+ * is not read again) */
87
+ paths?: string[]
88
+ /** live sqlite files (a glob: `data/*.db`), each a consistent snapshot; `except` leaves rows out per table (a
89
+ * where clause: `{ sessions: '1' }` keeps no login token) */
90
+ sqlite?: (string | {
91
+ /** the live sqlite file, repo relative (a glob matches several) */
92
+ path: string
93
+ /** rows left out of the snapshot, per table: a where clause naming the rows that go */
94
+ except?: Record<string, string>
95
+ })[]
77
96
  }
78
97
 
79
98
  export type RepoConfig = {
@@ -83,8 +102,15 @@ export type RepoConfig = {
83
102
  name: string
84
103
  /** venue ids this repo ships on — selects which contracts are REQUIRED */
85
104
  venues?: string[]
86
- /** social channels with a .shipkit/social/<channel>/ post folder */
105
+ /** retired with the v2 social contract: read by nothing; delete the line (`sk social migrate` moves the posts) */
87
106
  social?: string[]
107
+ /** the identity that speaks for this repo in public, an id of the house repo's `.shipkit/identities/` (`sk
108
+ * identities`); unset, the one marked `default: true` speaks. A draft may name another (wiki
109
+ * tools/shipkit/social.md) */
110
+ speaksAs?: string
111
+ /** machine-only state of this repo the backup keeps beyond its own rule (wiki tools/shipkit/media-store.md,
112
+ * Backup, What a repo adds). Paths are repo relative; what git tracks never goes; a secret is refused as always */
113
+ backup?: RepoBackup
88
114
  /** prefix for contract fix: pointers (docs checkout or URL) — written by init, never baked in */
89
115
  docsBase?: string
90
116
  /** a floor slot: a def with a `cmd` or `logic` REPLACES it, and a def
@@ -156,12 +182,13 @@ export type RepoConfig = {
156
182
  /** repo-contributed .gitignore lines, rendered INSIDE rule SK004's managed
157
183
  * block — for ecosystem-specific names the published lib may not carry */
158
184
  gitignore?: string[]
159
- /** gitignored paths a task READS, by task id (`'*'` for every task),
160
- * repo-relative: a path joins that task's key by content (generated
161
- * types, a local fixture), and `dir/**` by the names under the dir (an
162
- * output folder a suite lists). A task keyed on the whole work tree sees
163
- * no gitignored file, and a declared list names none either, so both
164
- * carry these. The traced audit (SK031) finds the missing ones and the
185
+ /** paths a task READS outside its key, by task id (`'*'` for every
186
+ * task), repo-relative: a path joins that task's key by content
187
+ * (generated types, a local fixture, a doc a unit's test reads outside
188
+ * its dir), and `dir/**` by the names under the dir (an output folder a
189
+ * suite lists). A task keyed on the whole work tree sees no gitignored
190
+ * file, and a declared list (a unit's `test:<unit>`) sees nothing outside
191
+ * it, so both carry these. The traced audit (SK031) finds the missing ones and the
165
192
  * fix pass writes them into their own managed block; an entry written
166
193
  * outside it stops that repair */
167
194
  ignoredInputs?: Record<string, string[]>
@@ -177,7 +204,7 @@ export type RepoConfig = {
177
204
  nested?: boolean
178
205
  /** THE CHECKS THIS REPO TURNS OFF, check id → why, for a whole check it
179
206
  * does not own (one false finding is waived at its site instead): where
180
- * a check runs is its own declaration (build/shipkit/runs.md), and an
207
+ * a check runs is its own declaration (tools/shipkit/runs.md), and an
181
208
  * off check runs in no context. `defineRepo` throws on a blank reason and on a rule id no
182
209
  * check carries. The hub writes this map through the managed block in
183
210
  * this file (core/when-block.ts). */
@@ -207,7 +234,7 @@ export type RepoConfig = {
207
234
  archived?: boolean
208
235
  /** declared github visibility INTENT (absent = 'private'): public means
209
236
  * strangers read the tracked tree. What each check does with it:
210
- * wiki/build/shipkit/built-in-checks.md */
237
+ * wiki/tools/shipkit/built-in-checks.md */
211
238
  visibility?: 'private' | 'public'
212
239
  /** the reviewer agent type this repo declares: `.claude/agents/<name>.md`,
213
240
  * whose system prompt points at `brief` (an md file holding the standing
@@ -223,7 +250,7 @@ export type RepoConfig = {
223
250
  /** widens the read-only tool allowlist SK008 enforces (default Read, Grep, Glob, Bash) */
224
251
  tools?: string[]
225
252
  }
226
- /** ONE WAY IN escape hatch (build/shipkit/one-way-in.md): governed script names this
253
+ /** ONE WAY IN escape hatch (tools/shipkit/one-way-in.md): governed script names this
227
254
  * repo keeps as a direct tool call. Declared per NAME, never as a list of
228
255
  * banned binaries: the invariant is about which VERBS an agent reaches
229
256
  * for, and a binary blocklist goes stale the day a repo changes runner.
@@ -287,6 +314,27 @@ export type RepoConfig = {
287
314
  * visits after a deploy, and how it logs in. The password is a secret
288
315
  * NAME: the value never sits in config, argv or env. smoke/run-smoke.ts */
289
316
  smoke?: SmokeConfig
317
+ /** what `sk start` does from this repo when it is the house, read only in the house config */
318
+ start?: {
319
+ /** repo names `sk start` never touches: no CLAUDE.md include, no git, no scaffold, no push (a day-job checkout) */
320
+ skip?: string[]
321
+ }
322
+ /** the headless browsers that shoot or record for this repo at once, on any machine (an sk shot ask, a take, a
323
+ * look sheet's tabs, the trailer's films, sk smoke): each holds a slot of the repo's pool for its whole life,
324
+ * and a waiter says whom it waits on. shot/browser-slot.ts */
325
+ browsers?: {
326
+ /** how many at once, a whole number of 1 or more. Default 2 */
327
+ max?: number
328
+ /** the box that films for this repo from a Mac, like { host: 'wm', max: 5 }: there every browser start goes to
329
+ * that ssh host's warm browser (shot/box.ts), at most `max` at once (default 2, a pool apart from `max`), and
330
+ * browserSlot refuses any other start. SK_FILM_HERE=1 films on the Mac for one run, under `max` */
331
+ box?: {
332
+ /** the ssh host, as ~/.ssh/config names it */
333
+ host: string
334
+ /** how many at once there, a whole number of 1 or more. Default 2 */
335
+ max?: number
336
+ }
337
+ }
290
338
  /** the suite budget for a plain `bun test` floor: per suite time limit, the
291
339
  * slow suites the quick tier leaves out, and the suites that cannot run in
292
340
  * parallel, each with its reason. suite/judge-suites.ts */
@@ -314,11 +362,12 @@ export type RepoConfig = {
314
362
  logDir?: string
315
363
  }
316
364
 
317
- const KNOWN_KEYS = new Set(['name', 'venues', 'social', 'docsBase', 'defaults', 'tasks', 'asks', 'creds', 'credsCommand', 'credsReadCommand', 'notifyCommand', 'contracts', 'gitignore', 'ignoredInputs', 'untrackGenerated', 'nested', 'off', 'when', 'budgets', 'ruleExempt', 'visibility', 'archived', 'reviewer', 'oneWayIn', 'rules', 'release', 'units', 'notReleasable', 'vendored', 'hooks', 'checkDefaults', 'tui', 'serve', 'identity', 'logDir', 'smoke', 'tests'])
365
+ const KNOWN_KEYS = new Set(['name', 'venues', 'social', 'speaksAs', 'backup', 'docsBase', 'defaults', 'tasks', 'asks', 'creds', 'credsCommand', 'credsReadCommand', 'notifyCommand', 'contracts', 'gitignore', 'ignoredInputs', 'untrackGenerated', 'nested', 'off', 'when', 'budgets', 'ruleExempt', 'visibility', 'archived', 'reviewer', 'oneWayIn', 'rules', 'release', 'units', 'notReleasable', 'vendored', 'hooks', 'checkDefaults', 'tui', 'serve', 'identity', 'logDir', 'smoke', 'tests', 'browsers', 'start'])
318
366
 
319
367
  export function defineRepo(c: RepoConfig): RepoConfig {
320
368
  if (typeof c.name !== 'string' || c.name === '') throw new Error('defineRepo: name is required')
321
369
  for (const v of c.venues ?? []) if (!/^[a-z0-9-]+$/.test(v)) throw new Error(`defineRepo: venue '${v}' must be kebab-case`)
370
+ if (c.speaksAs != null && !/^[a-z0-9][a-z0-9-]*$/.test(c.speaksAs)) throw new Error(`defineRepo: speaksAs '${String(c.speaksAs)}' must be an identity id, kebab-case (sk identities)`)
322
371
  if (c.visibility != null && c.visibility !== 'private' && c.visibility !== 'public')
323
372
  throw new Error(`defineRepo: visibility '${String(c.visibility)}' — 'private' or 'public' only`)
324
373
  // a half-declared reviewer would lint a path like `.claude/agents/.md`
@@ -413,7 +462,7 @@ export function defineRepo(c: RepoConfig): RepoConfig {
413
462
  const w = parseWhen(raw)
414
463
  if (typeof w === 'string') throw new Error(`defineRepo: when.${id} ${w}`)
415
464
  if (w.at !== 'off')
416
- throw new Error(`defineRepo: when.${id} '${raw}' no longer places a check: every check declares where it runs (build/shipkit/runs.md). A repo can only turn one off: off: { ${id}: '<why>' }`)
465
+ throw new Error(`defineRepo: when.${id} '${raw}' no longer places a check: every check declares where it runs (tools/shipkit/runs.md). A repo can only turn one off: off: { ${id}: '<why>' }`)
417
466
  }
418
467
  // a budget turns a slow pass yellow, so a value it cannot compare with dies here
419
468
  for (const [id, v] of Object.entries(c.budgets ?? {})) {
@@ -431,6 +480,15 @@ export function defineRepo(c: RepoConfig): RepoConfig {
431
480
  }
432
481
  // a smoke typo would land as a run that visits nothing and exits 0
433
482
  if (c.smoke != null) validateSmokeConfig(c.smoke)
483
+ const browsers = browsersProblem(c.browsers)
484
+ if (browsers != null) throw new Error(`defineRepo: ${browsers}`)
485
+ // a malformed skip list would let sk start wire the checkout it exists to leave alone
486
+ if (c.start !== undefined) {
487
+ const skip = (c.start as { skip?: unknown }).skip
488
+ const extra = Object.keys(c.start).filter((k) => k !== 'skip')
489
+ if (extra.length > 0 || (skip !== undefined && !(Array.isArray(skip) && skip.every((n) => typeof n === 'string' && /^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(n)))))
490
+ throw new Error(`defineRepo: start is { skip?: <repo names> }, got ${JSON.stringify(c.start)}`)
491
+ }
434
492
  // a leak-guard waiver is the one config row that can make a gate quieter,
435
493
  // so a malformed one dies here rather than being dropped at commit time
436
494
  if (c.hooks?.leakAllow != null) {
@@ -1,4 +1,4 @@
1
- // a card's before and after as a looping animation to send (wiki build/shipkit/review.md, Verbs on the store): the one
1
+ // a card's before and after as a looping animation to send (wiki tools/shipkit/review.md, Verbs on the store): the one
2
2
  // function behind the hub's « animation » and `sk review anim`. One cycle is drawn by ffmpeg's own filters (no per pixel
3
3
  // expression: a card renders in a few seconds), an mp4 then repeats it with no second encode
4
4
  import { createCanvas, GlobalFonts } from '@napi-rs/canvas'
@@ -1,4 +1,4 @@
1
- // auto rules (wiki build/shipkit/review.md, A project's parts): a rule of the repo's review unit answers on a clock, and
1
+ // auto rules (wiki tools/shipkit/review.md, A project's parts): a rule of the repo's review unit answers on a clock, and
2
2
  // its answer is raised as an item to a lane, open from the start. One open item a rule and key. The hub's daemon runs
3
3
  // them (startAuto), `sk review auto` reads their logs and runs one now
4
4
  import { mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs'