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
@@ -1,4 +1,4 @@
1
- // SK032 ignored inputs current (build/shipkit/cache.md owns the key): what the
1
+ // SK032 ignored inputs current (tools/shipkit/cache.md owns the key): what the
2
2
  // last traced audit (SK031) found a task reading outside its key is in
3
3
  // repo.config.ts ignoredInputs, so other machines and clones key it too. The repair writes the missing entries into
4
4
  // the managed block, so the gate's fix pass carries each finding into the
@@ -46,8 +46,8 @@ function kept(text: string | null): AuditReport | null {
46
46
  export const ignoredInputsCheck = check({
47
47
  id: 'SK032',
48
48
  title: 'ignored inputs current',
49
- description: 'every gitignored path the traced audit saw a task read is in ignoredInputs',
50
- owner: 'build/shipkit/cache.md',
49
+ description: 'every path the traced audit saw a task read outside its key is in ignoredInputs',
50
+ owner: 'tools/shipkit/cache.md',
51
51
  blocking: false,
52
52
  runs: { onPreCommit: false, onCi: true, onFull: true, onRelease: false, onHealth: true, onSave: false, onClock: false },
53
53
  cache: { by: 'reads' },
@@ -1,4 +1,4 @@
1
- // SK033 global contribution (meta/agent-folder.md): every house repo carries
1
+ // SK033 global contribution (meta/agent-folder/index.md): every house repo carries
2
2
  // agent/global-contribution.md, what it offers every agent of every house
3
3
  // repo (a house whose index loads @generated/global-context.md), which the house concatenates into the context each session loads
4
4
  // (home/global-context.ts). A new one is a comment only, so it contributes
@@ -7,7 +7,8 @@
7
7
  // the house index, never from agent/index.md, so SK027 leaves it out.
8
8
  import { homedir } from 'os'
9
9
  import { check, type FixResult } from '../check.ts'
10
- import { CONTRIBUTION_FILE, CONTRIBUTION_STUB, CONTEXT_INCLUDE, contributionBody, contributionOver, loadsContext } from '../core/global-contribution.ts'
10
+ import { agentDirOf } from '../core/agent-dir.ts'
11
+ import { CONTRIBUTION_STUB, CONTEXT_INCLUDE, contributionBody, contributionOver, loadsContext } from '../core/global-contribution.ts'
11
12
  import { homeRepo, houseIndex } from '../serve/project-gutter.ts'
12
13
 
13
14
  /** why a repo gives SK033 nothing to do, or null in a repo whose house
@@ -19,17 +20,22 @@ export function notHouse(root: string, home: string = homedir()): string | null
19
20
  return null
20
21
  }
21
22
 
23
+ /** the contribution file, in the agent folder CLAUDE.md names */
24
+ const fileOf = (c: { read(rel: string): string | null }): string => `${agentDirOf(c.read('CLAUDE.md'))}/global-contribution.md`
25
+
22
26
  export const globalContribution = check({
23
27
  id: 'SK033',
24
28
  blocking: true,
25
29
  title: 'global contribution',
26
30
  description: 'agent/global-contribution.md exists and fits in the house context',
27
- owner: 'meta/agent-folder.md',
31
+ owner: 'meta/agent-folder/index.md',
28
32
  runs: { onPreCommit: false, onCi: true, onFull: true, onRelease: true, onHealth: true, onSave: 'moved', onClock: false },
29
- cache: { by: 'files', inputs: [CONTRIBUTION_FILE], key: null },
33
+ // the file sits in the agent folder CLAUDE.md names: agent/, or a folder of the repo's wiki/
34
+ cache: { by: 'files', inputs: ['CLAUDE.md', 'agent/global-contribution.md', 'wiki'], key: null },
30
35
  fix: 'ci',
31
36
  applies: (env) => notHouse(env.root),
32
37
  run: (c) => {
38
+ const CONTRIBUTION_FILE = fileOf(c)
33
39
  const text = c.read(CONTRIBUTION_FILE)
34
40
  if (text == null) return void c.fail(`${CONTRIBUTION_FILE} is missing: every house repo carries one, empty until it has something to offer`, 'shipkit ci writes the empty one')
35
41
  const body = contributionBody(text)
@@ -38,6 +44,7 @@ export const globalContribution = check({
38
44
  c.ok(body === '' ? `${CONTRIBUTION_FILE} is there, contributing nothing yet` : `${CONTRIBUTION_FILE} contributes ${body.split('\n').length} line(s)`)
39
45
  },
40
46
  repair: (c): FixResult => {
47
+ const CONTRIBUTION_FILE = fileOf(c)
41
48
  if (c.read(CONTRIBUTION_FILE) != null) return { changed: false, summary: `${CONTRIBUTION_FILE} is there: its size is the author's to fix` }
42
49
  c.write(CONTRIBUTION_FILE, CONTRIBUTION_STUB)
43
50
  return { changed: true, summary: `wrote the empty ${CONTRIBUTION_FILE}` }
@@ -1,4 +1,4 @@
1
- // SK034 commit gates armed (build/shipkit/commit-gates.md): the leak guard and
1
+ // SK034 commit gates armed (tools/shipkit/commit-gates.md): the leak guard and
2
2
  // the message gate run only from git's hooks, so a repo whose hooksPath is
3
3
  // unset, or points at a foreign dir that never calls shipkit, commits with
4
4
  // both dark and nothing says so. `sk ci` arms an unset path; a foreign one is
@@ -58,7 +58,7 @@ export const commitGatesArmed = check({
58
58
  blocking: true,
59
59
  title: 'commit gates armed',
60
60
  description: 'git runs the shipkit pre-commit and commit-msg gates on every commit',
61
- owner: 'build/shipkit/commit-gates.md',
61
+ owner: 'tools/shipkit/commit-gates.md',
62
62
  runs: { onPreCommit: false, onCi: true, onFull: true, onRelease: true, onHealth: true, onSave: 'moved', onClock: false },
63
63
  // git config and hook files outside any tree id, so they are the key
64
64
  cache: { by: 'files', inputs: [CONFIG_FILE], key: gatesKey },
@@ -0,0 +1,46 @@
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
3
+ // file carries (release/public-clean.ts publicCleanKey): each unit's tree on disk, gitignored files included, the
4
+ // house repos, the identity, keyword and allow files. A release scans fresh
5
+ import { check, type CheckEnv } from '../check.ts'
6
+ import { PUBLIC_CLEAN_ID, publicClean, publicCleanKey } from '../release/public-clean.ts'
7
+ import { resolveUnits, type ReleaseUnit } from '../release/units.ts'
8
+
9
+ const npmUnits = (env: CheckEnv): ReleaseUnit[] => resolveUnits(env.root, env.config).units.filter((u) => u.targets.npm)
10
+
11
+ export const publicCleanCheck = check({
12
+ id: PUBLIC_CLEAN_ID,
13
+ blocking: true,
14
+ title: 'public clean',
15
+ description: 'what an npm unit publishes names no house repo, identity or keyword row',
16
+ owner: 'tools/shipkit/units.md',
17
+ runs: { onPreCommit: false, onCi: true, onFull: true, onRelease: true, onHealth: true, onSave: 'moved', onClock: false },
18
+ cache: { by: 'files', inputs: ['.'], key: (env) => publicCleanKey(env.root, npmUnits(env)) },
19
+ fix: 'none',
20
+ applies: (env) => (npmUnits(env).length === 0 ? 'no unit publishes to npm' : null),
21
+ run: async (c) => {
22
+ const units = npmUnits(c)
23
+ // one npm pack each, all at once: npm's start is most of the wall time
24
+ const results = await Promise.all(units.map((u) => publicClean(c.root, c.config, u)))
25
+ for (const [i, unit] of units.entries()) {
26
+ const r = results[i]!
27
+ for (const n of r.notes) c.note(`${unit.id}: ${n}`)
28
+ for (const a of r.allowed) c.note(`${unit.id}: allowed ${a.word} (${a.reason})`)
29
+ const waived = new Map<string, number>()
30
+ for (const w of r.waived) {
31
+ const k = `${w.masked}: ${w.reason} [${w.source}]`
32
+ waived.set(k, (waived.get(k) ?? 0) + 1)
33
+ }
34
+ for (const [w, n] of waived) c.note(`${unit.id}: waived in ${n} file${n === 1 ? '' : 's'}, ${w}`)
35
+ for (const x of r.refused) c.fail(`${x.file}: ${x.why}`, { fix: `keep it out of the tarball: a "!<path>" row in the unit's package.json files`, at: { file: x.file } })
36
+ for (const h of r.hits)
37
+ c.fail(`${h.file}:${h.line}: names ${h.what} (${h.masked}, ${h.fingerprint}): this file ships on npm${h.over == null ? '' : `, and holds it ${h.count} times where ${h.over.source} allows ${h.over.count}`}`, {
38
+ fix: `say it without the name (« a project », « the project's own page »); a word that must stay, reviewed: hooks.leakAllow += { reason: '<why>', paths: ['${h.file}'], patterns: ['${h.fingerprint}'], count: ${h.count} }; one site: sk-disable-next-line ${PUBLIC_CLEAN_ID} -- <reason>`,
39
+ at: { file: h.file, line: h.line },
40
+ })
41
+ if (r.refused.length === 0 && r.hits.filter((h) => h.directive == null).length === 0) c.ok(`${unit.id}: the ${r.files.length} files npm packs name nothing of the house`)
42
+ }
43
+ },
44
+ })
45
+
46
+ export default publicCleanCheck
@@ -0,0 +1,28 @@
1
+ // SK036 draft media size (tools/shipkit/built-in-checks.md): no file git would commit under `.shipkit/social/` is over
2
+ // 95 MB. GitHub refuses a file over 100 MB, and the desk pushes its commits in the background, so the refusal would
3
+ // come after the commit, with the draft stuck on this Mac. It reads the index (staged and tracked), never the files
4
+ import { check } from '../check.ts'
5
+ import { LAYOUT } from '../core/layout.ts'
6
+ import { heavyStaged, mbOf, MEDIA_MAX_BYTES } from '../social/media-limit.ts'
7
+
8
+ export const draftMediaSize = check({
9
+ id: 'SK036',
10
+ blocking: true,
11
+ title: 'draft media size',
12
+ description: 'no file git would commit under .shipkit/social/ is over 95 MB (GitHub refuses 100)',
13
+ owner: 'tools/shipkit/social.md',
14
+ runs: { onPreCommit: { budgetMs: 60 }, onCi: true, onFull: true, onRelease: true, onHealth: true, onSave: 'moved', onClock: false },
15
+ // the folder's files; the hook runs it raw on the index, so a file staged since a cached green is still seen there
16
+ cache: { by: 'files', inputs: [LAYOUT.social], key: null },
17
+ fix: 'none',
18
+ applies: 'always',
19
+ run: (c) => {
20
+ const heavy = heavyStaged(c.root, LAYOUT.social)
21
+ if (heavy.length === 0) return c.ok(`every file git holds under ${LAYOUT.social}/ is under ${mbOf(MEDIA_MAX_BYTES)}`)
22
+ c.fail(`${heavy.length} file${heavy.length === 1 ? '' : 's'} under ${LAYOUT.social}/ over ${mbOf(MEDIA_MAX_BYTES)}: GitHub refuses the push`)
23
+ for (const h of heavy.slice(0, 10)) c.lines.push({ kind: 'fail', text: `${h.path}: ${mbOf(h.size)}` })
24
+ c.lines.push({ kind: 'fix-fail', text: `git reset -q -- ${heavy[0]!.path}, then shrink it, name it *-trailer.mp4 when its command renders it, or keep it with sk media put` })
25
+ },
26
+ })
27
+
28
+ export default draftMediaSize
@@ -0,0 +1,43 @@
1
+ // SK037 keyword additions (tools/shipkit/commit-gates.md, the leak guard): the banned keyword list lives in ONE
2
+ // place, the machine's ~/.shipkit/private/banned-keywords.txt, and the secret shapes are built into the guard. A
3
+ // repo's own .shipkit/private/banned-keywords.txt holds its ADDITIONS only. A row it shares with either is a copy,
4
+ // and a copy rots: it keeps a shape the list has since changed (a substring row the list made whole word stays
5
+ // stricter in that one repo) and survives the list dropping it. The file is gitignored, so the run strips copies in
6
+ // place; a frozen run warns. Reads the machine list, which no repo key covers, so it is never cached
7
+ import { readFileSync } from 'fs'
8
+ import { check } from '../check.ts'
9
+ import { KEYWORD_FILE } from '../core/layout.ts'
10
+ import { globalKeywordFile, repoAdditions } from '../hooks/leak-guard.ts'
11
+
12
+ export const keywordAdditions = check({
13
+ id: 'SK037',
14
+ blocking: false,
15
+ title: 'keyword additions',
16
+ description: "the repo's banned keyword file holds its additions only, never a copy of the official list",
17
+ owner: 'tools/shipkit/commit-gates.md',
18
+ writes: true,
19
+ // it reads the machine list, a world fact no quick gate reads: the health pass, and the daemon about daily
20
+ runs: { onPreCommit: false, onCi: false, onFull: false, onRelease: false, onHealth: true, onSave: false, onClock: { every: '24h', inactive: 'wait' } },
21
+ cache: { by: 'never', why: 'it reads the machine list outside the repo, and the read costs a millisecond' },
22
+ fix: 'none',
23
+ applies: 'always',
24
+ run: (c) => {
25
+ const rel = c.config.hooks?.keywordFile ?? KEYWORD_FILE
26
+ const text = c.read(rel)
27
+ if (text == null) return c.ok(`no ${rel}: this repo adds nothing to the official list`)
28
+ const official = globalKeywordFile()
29
+ const r = repoAdditions(text, official == null ? '' : readFileSync(official, 'utf8'))
30
+ const own = `${r.own} row${r.own === 1 ? '' : 's'} of its own`
31
+ if (r.copies.length === 0) return c.ok(`${rel}: ${own}, no copy of the official list${official == null ? ' (no machine list on this machine)' : ''}`)
32
+ const n = `${r.copies.length} row${r.copies.length === 1 ? '' : 's'}`
33
+ if (c.frozen) {
34
+ c.warn(`${rel} copies ${n} the official list or the built-in shapes already hold, beside ${own}`)
35
+ c.lines.push({ kind: 'fix-warn', text: 'any run that is not frozen strips them (sk check)' })
36
+ return
37
+ }
38
+ c.write(rel, r.text)
39
+ c.note(`${rel}: ${n} the official list or the built-in shapes already hold stripped, ${own} kept`)
40
+ },
41
+ })
42
+
43
+ export default keywordAdditions
@@ -0,0 +1,152 @@
1
+ // sk backup: the machine-only state of the house kept in the private Space (media-store/backup/, wiki
2
+ // tools/shipkit/media-store.md, Backup): a run now, what is not backed up yet, the runs, a restore, the drill.
3
+ // Every module loads inside execute: the cli registers this file on every `sk` call
4
+ import { Command, Option } from 'clipanion'
5
+
6
+ const DETAILS = `the files of the house that no git and no Space keeps (the veille logs, the media index and the machine db as sqlite snapshots, the rail order, the machine's private folder, the agents' memories, each house repo's untracked .shipkit/ files, its hand tuned .comfy-ts/ files, its gitignored *.local.* files, and what its repo.config.ts names under backup: paths kept whole, sqlite files) go up to the owner's private Space under backup/<sha256>, each run under backup/runs/ with its parts under backup/parts/ (a part unchanged since the last run is not written again). Every version stays: nothing is ever deleted. Secrets never go: a file whose name or text says it holds one is refused, with the reason. The daemon runs it on change (debounced) and every 6 h. Page: wiki tools/shipkit/media-store.md, Backup`
7
+
8
+ type Ctx = { stdout: NodeJS.WritableStream; stderr: NodeJS.WritableStream }
9
+
10
+ interface Here {
11
+ out: (l: string) => void
12
+ err: (l: string) => void
13
+ home: string
14
+ repos: string[]
15
+ space: import('../media-store/space.ts').Space
16
+ }
17
+
18
+ async function run(context: Ctx, body: (h: Here) => Promise<number>): Promise<number> {
19
+ const out = (l: string): void => void context.stdout.write(`${l}\n`)
20
+ const err = (l: string): void => void context.stderr.write(`${l}\n`)
21
+ try {
22
+ const { homedir } = await import('node:os')
23
+ const { findRepoRoot } = await import('../ts/config.ts')
24
+ const { houseRepos } = await import('../serve/project-gutter.ts')
25
+ const { machineSpace } = await import('../media-store/space.ts')
26
+ const home = homedir()
27
+ const house = houseRepos(findRepoRoot(process.cwd()), home)
28
+ const repos = [...house.repos, ...house.archived].map((r) => r.path)
29
+ if (repos.length === 0) throw new Error(`no house repo seen from ${process.cwd()}: run it inside one`)
30
+ const { space, why } = await machineSpace()
31
+ if (!space) throw new Error(why)
32
+ return await body({ out, err, home, repos, space })
33
+ } catch (e) {
34
+ err(`FAIL: backup: ${e instanceof Error ? e.message : String(e)}`)
35
+ return 1
36
+ }
37
+ }
38
+
39
+ const mb = (b: number): string => `${(b / 1e6).toFixed(1)} MB`
40
+
41
+ export class BackupCommand extends Command {
42
+ static override paths = [['backup']]
43
+ static override usage = Command.Usage({
44
+ category: 'Media',
45
+ description: 'the machine-only state of the house up to the private Space now: every version kept, secrets refused',
46
+ details: `${DETAILS}\n\nA run reads every source, hashes it (a sqlite: a consistent snapshot first), sends each object the Space lacks, then writes ONE manifest (path, sha, size, time of every file), last. A run whose state equals the last one writes nothing. --check sends nothing: it prints what the Space lacks, what changed since the last run, and what is refused, and exits 1 when something waits.`,
47
+ examples: [['back up now', 'sk backup'], ['what is not backed up yet', 'sk backup --check']],
48
+ })
49
+ check = Option.Boolean('--check', false, { description: 'send nothing: what is not backed up yet, exit 1 when something waits' })
50
+ async execute(): Promise<number> {
51
+ return run(this.context, async (h) => {
52
+ const { backupCheck, backupRun } = await import('../media-store/backup/run.ts')
53
+ const refusedLines = (list: { path: string; why: string }[]): void => {
54
+ for (const r of list) h.out(` refused ~/${r.path}: ${r.why}`)
55
+ }
56
+ if (this.check) {
57
+ const c = await backupCheck(h.space, { home: h.home, repos: h.repos })
58
+ h.out(`${c.files} files read; the last run: ${c.last ? `${c.last.at} (${c.last.key})` : 'none'}`)
59
+ h.out(`${c.waiting.length} not in the Space yet (${mb(c.waiting.reduce((n, w) => n + w.size, 0))}), ${c.changed.length} changed since the last run, ${c.refused.length} refused`)
60
+ for (const w of c.waiting.slice(0, 40)) h.out(` waiting ~/${w.path}`)
61
+ if (c.waiting.length > 40) h.out(` … ${c.waiting.length - 40} more`)
62
+ refusedLines(c.refused)
63
+ return c.waiting.length > 0 || c.changed.length > 0 ? 1 : 0
64
+ }
65
+ const t0 = Date.now()
66
+ const r = await backupRun(h.space, { home: h.home, repos: h.repos })
67
+ h.out(`${r.files} files (${mb(r.bytes)}): ${r.sent} objects up (${mb(r.sentBytes)}), ${r.there} already there, ${r.refused.length} refused, in ${((Date.now() - t0) / 1000).toFixed(1)} s`)
68
+ refusedLines(r.refused)
69
+ for (const f of r.failed.slice(0, 5)) h.err(`FAIL: ${f.key}: ${f.error}`)
70
+ if (r.failed.length > 0) {
71
+ h.err(`FAIL: ${r.failed.length} objects did not go up: no manifest written, the next run tries again`)
72
+ return 1
73
+ }
74
+ h.out(r.manifest ? `run ${r.manifest}: ${r.record.partsSent} of ${r.record.parts} parts written (${(r.record.partsBytes / 1e3).toFixed(1)} kB), the run ${(r.record.runBytes / 1e3).toFixed(1)} kB` : `unchanged since ${r.last?.at} (${r.last?.key}): nothing written`)
75
+ return 0
76
+ })
77
+ }
78
+ }
79
+
80
+ export class BackupRunsCommand extends Command {
81
+ static override paths = [['backup', 'runs']]
82
+ static override usage = Command.Usage({
83
+ category: 'Media',
84
+ description: 'every backup run the Space holds, oldest first: its time and manifest key',
85
+ details: DETAILS,
86
+ examples: [['the runs', 'sk backup runs']],
87
+ })
88
+ async execute(): Promise<number> {
89
+ return run(this.context, async (h) => {
90
+ const { runsOf } = await import('../media-store/backup/manifest.ts')
91
+ const runs = await runsOf(h.space)
92
+ for (const r of runs) h.out(`${r.at.toISOString()} ${r.key} ${(r.size / 1e3).toFixed(0)} kB`)
93
+ h.out(`${runs.length} runs`)
94
+ return 0
95
+ })
96
+ }
97
+ }
98
+
99
+ export class BackupRestoreCommand extends Command {
100
+ static override paths = [['backup', 'restore']]
101
+ static override usage = Command.Usage({
102
+ category: 'Media',
103
+ description: 'a backup run written back, every sha checked: to an empty folder, or in place',
104
+ details: `${DETAILS}\n\nThe run is the last one at or before --at (the last one when it is left out). --to writes every file under the folder, at its path under the home (the folder must be empty or new). --in-place writes over the live files: a live file with other bytes is copied to ~/.shipkit/backup-replaced/<time>/ first, and a sqlite lands beside its live file as <file>.restored (stop pm, then move it). --path keeps the files under one path of the home.`,
105
+ examples: [['the last run into a folder', 'sk backup restore --to ~/restore-1'], ['the veille logs as they were on a day, in place', 'sk backup restore --at 2026-11-04 --in-place --path .config/shipkit/home/veille']],
106
+ })
107
+ to = Option.String('--to', { description: 'an empty or new folder the files land under' })
108
+ inPlace = Option.Boolean('--in-place', false, { description: 'over the live files, each one replaced copied aside first' })
109
+ at = Option.String('--at', { description: 'the last run at or before this time: 2026-11-04T13:50Z, 2026-11-04 or 20261104T135000Z' })
110
+ under = Option.String('--path', { description: 'only the files under this path of the home: .config/shipkit/home/veille' })
111
+ async execute(): Promise<number> {
112
+ return run(this.context, async (h) => {
113
+ const { restore } = await import('../media-store/backup/restore.ts')
114
+ const { parseAt } = await import('../media-store/backup/keys.ts')
115
+ const r = await restore(h.space, { home: h.home, ...(this.to !== undefined ? { to: this.to } : {}), inPlace: this.inPlace, ...(this.at ? { at: parseAt(this.at) } : {}), ...(this.under ? { only: this.under } : {}) })
116
+ h.out(`run ${r.at} (${r.run}): ${r.files} files, ${r.written} written (${mb(r.bytes)})${this.inPlace ? `, ${r.same} already the same` : ''}`)
117
+ if (r.aside.n > 0) h.out(`${r.aside.n} live files copied aside first, into ${r.aside.dir}`)
118
+ for (const b of r.beside) h.out(` a sqlite landed beside its live file: ${b} (stop pm, then move it over)`)
119
+ for (const f of r.failed) h.err(`FAIL: ~/${f.path}: ${f.error}`)
120
+ return r.failed.length > 0 ? 1 : 0
121
+ })
122
+ }
123
+ }
124
+
125
+ export class BackupDrillCommand extends Command {
126
+ static override paths = [['backup', 'drill']]
127
+ static override usage = Command.Usage({
128
+ category: 'Media',
129
+ description: 'a backup run restored into a scratch folder, every sha compared with the live files',
130
+ details: `${DETAILS}\n\n--at drills an older run (a run of the first version, one manifest, reads too). A file the live machine changed since the run counts apart (the next run takes it), and so does one gone from the disk; a sqlite compares its rows per table. Exit 1 when a file did not come back with its sha. The scratch folder is removed unless --to names one.`,
131
+ examples: [['the drill', 'sk backup drill'], ['an older run', 'sk backup drill --at 20261104T130646Z']],
132
+ })
133
+ to = Option.String('--to', { description: 'restore into this empty or new folder, and keep it' })
134
+ at = Option.String('--at', { description: 'the last run at or before this time, an older run: 2026-11-04T13:50Z or 20261104T135000Z' })
135
+ async execute(): Promise<number> {
136
+ return run(this.context, async (h) => {
137
+ const { drill } = await import('../media-store/backup/restore.ts')
138
+ const { parseAt } = await import('../media-store/backup/keys.ts')
139
+ const t0 = Date.now()
140
+ const d = await drill(h.space, { home: h.home, ...(this.to !== undefined ? { to: this.to } : {}), ...(this.at ? { at: parseAt(this.at) } : {}) })
141
+ h.out(`run ${d.at} (${d.run}, version ${d.v}): ${d.files} files (${mb(d.bytes)}), ${d.restored} restored with their sha, in ${((Date.now() - t0) / 1000).toFixed(1)} s`)
142
+ h.out(`against the live files: ${d.sameAsLive} the same, ${d.liveMoved.length} moved since the run, ${d.liveGone.length} gone from the disk, ${d.failed.length} failed`)
143
+ for (const s of d.sqlite) h.out(` sqlite ~/${s.path}: restored ${JSON.stringify(s.restored)}, live now ${JSON.stringify(s.live)}`)
144
+ for (const p of d.liveMoved.slice(0, 20)) h.out(` moved since ~/${p}`)
145
+ for (const p of d.liveGone.slice(0, 20)) h.out(` gone ~/${p}`)
146
+ for (const f of d.failed) h.err(`FAIL: ~/${f.path}: ${f.error}`)
147
+ return d.failed.length > 0 ? 1 : 0
148
+ })
149
+ }
150
+ }
151
+
152
+ export const BACKUP_COMMANDS = [BackupCommand, BackupRunsCommand, BackupRestoreCommand, BackupDrillCommand]
package/src/cli/cmd_Ci.ts CHANGED
@@ -18,11 +18,8 @@ export class CiCommand extends Command {
18
18
  details: 'THE command. Repairs what a machine can (imports, repo shape), then runs every check the gate asks for, through one DAG. A check that declares blocking:false warns instead of failing. Run this instead of anything else.',
19
19
  examples: [
20
20
  ['full gate, mechanical fixes applied', 'sk ci'],
21
- ['gate without the repair pass (checks can still write)', 'sk ci --no-fix'],
22
- ['leave repo config files alone', 'sk ci --no-fix-rules'],
23
21
  ['stop at the first failure', 'sk ci --bail'],
24
- ['one check + its dep closure, the tree left alone', 'sk ci --only typecheck'],
25
- ['one check, its own repair first', 'sk ci --only SK004 --fix'],
22
+ ['one check + its dep closure, its own repair first', 'sk ci --only typecheck'],
26
23
  ['every check declaring one group', 'sk ci --only wiki'],
27
24
  ['run everything, take nothing from the cache', 'sk ci --fresh'],
28
25
  ['include an opt in check', 'sk ci --with up:itch'],
@@ -33,12 +30,14 @@ export class CiCommand extends Command {
33
30
 
34
31
  bail = Option.Boolean('--bail', false, { description: 'stop at the first failure' })
35
32
  json = Option.Boolean('--json', false, { description: 'machine-readable result instead of wire lines' })
36
- fix = Option.Boolean('--fix', { description: 'repair before gating. Default on for a whole gate and off for a --only run, which leaves the tree alone unless --fix is named, and then repairs only what the named checks own. Nothing ever formats. --no-fix skips the repair pass, the checks can still write. Under CI the fixers still run but the gate FAILS on any file they rewrite' })
37
- fixRules = Option.Boolean('--fix-rules', true, { description: 'apply the structural autofixes of the built-in checks too. Default on. --no-fix-rules leaves repo config alone' })
33
+ // every run repairs (core/fix-scope.ts). The flags stay accepted and ignored
34
+ // until 2026-11-18, so a session started under the old rule keeps working
35
+ fix = Option.Boolean('--fix', { hidden: true })
36
+ fixRules = Option.Boolean('--fix-rules', true, { hidden: true })
38
37
  frozen = Option.Boolean('--frozen', false, { description: 'report-only mode for self-maintaining checks: SK005 never touches package.json, and generated paths are never untracked. STATUS.md is still refreshed on disk, but it is gitignored, so a run leaves the tree clean' })
39
38
  skip = Option.Array('--skip', [], { description: 'skip a check group (repeatable)' })
40
39
  withIds = Option.Array('--with', [], { description: 'include a check the quick gate leaves out (repeatable)' })
41
- only = Option.Array('--only', [], { description: 'run only this check + its dep closure (repeatable, or comma separated). A group name runs every check declaring that group. No repair pass unless --fix is named' })
40
+ only = Option.Array('--only', [], { description: 'run only this check + its dep closure (repeatable, or comma separated). A group name runs every check declaring that group. Repairs only what the named checks own' })
42
41
  fresh = Option.Boolean('--fresh', false, { description: 'run every check: no answer comes from the cache, and what this run finds is stored fresh' })
43
42
  full = Option.Boolean('--full', false, { description: `run the FULL test tier: every suite the repo declares, the slow ones it skips while you work included. What the release path always runs. Same as SHIPKIT_TEST_FULL=1` })
44
43
 
@@ -70,8 +69,6 @@ export class CiCommand extends Command {
70
69
  return [
71
70
  ...(this.bail ? ['--bail'] : []),
72
71
  ...(this.json ? ['--json'] : []),
73
- ...(this.fix === true ? ['--fix'] : this.fix === false ? ['--no-fix'] : []),
74
- ...(this.fixRules ? [] : ['--no-fix-rules']),
75
72
  ...(this.frozen ? ['--frozen'] : []),
76
73
  ...this.skip.flatMap((v) => ['--skip', v]),
77
74
  ...this.withIds.flatMap((v) => ['--with', v]),
@@ -90,8 +87,7 @@ export class CiCommand extends Command {
90
87
  const opts = {
91
88
  bail: this.bail,
92
89
  json: this.json,
93
- fix: this.fix,
94
- fixRules: this.fixRules,
90
+ fix: true,
95
91
  armHooks: true,
96
92
  frozen: this.frozen,
97
93
  skipGroups: this.skip,
@@ -102,6 +98,7 @@ export class CiCommand extends Command {
102
98
  ...(this.verbose ? { verbose: true } : {}),
103
99
  }
104
100
  const print = (l: string): void => { this.context.stdout.write(`${l}\n`) }
101
+ if (this.fix === false || !this.fixRules) this.context.stderr.write('note: --no-fix and --no-fix-rules are ignored: every run repairs, a repair is mechanical and safe in a shared tree\n')
105
102
  // on a machine with the home, the repo's hub runs it (home/via-hub.ts)
106
103
  // a job is already the run, wherever it was started from
107
104
  const via = this.job != null ? null : await runViaHub(root, 'ci', opts, { print, printErr: (l) => this.context.stderr.write(`${l}\n`) })
@@ -18,7 +18,7 @@ export type CommandRow = {
18
18
  examples: [string, string][]
19
19
  /** a filmable command (cli/kit/verb.ts): takes --out, a clip also --seconds */
20
20
  film?: Film
21
- /** a filmable command's take version and length (build/trailer.md, Film lines) */
21
+ /** a filmable command's take version and length (tools/trailer/index.md, Film lines) */
22
22
  version?: number | string
23
23
  length?: 'own'
24
24
  words?: Record<string, unknown>
@@ -119,7 +119,7 @@ export function renderMarkdown(rows: CommandRow[], bin = 'sk'): string {
119
119
  /** the eager form: one line per command, its positional arguments and its
120
120
  * description. Flags and examples are `<bin> <command> --help`, so a page every
121
121
  * session loads costs a line per command, not a screen. `pages` puts each
122
- * family's owner page in its heading: `### Trailer → build/trailer.md` */
122
+ * family's owner page in its heading: `### Trailer → tools/trailer/index.md` */
123
123
  export function renderCompact(rows: CommandRow[], bin = 'sk', pages: Readonly<Record<string, string>> | null = null): string {
124
124
  const out: string[] = []
125
125
  let cat = ''
@@ -211,8 +211,8 @@ export class CommandsCommand extends Command {
211
211
  ['markdown index', 'sk commands'],
212
212
  ['machine-readable', 'sk commands --json'],
213
213
  ['write into a docs page between the markers', 'sk commands --out docs/commands.md'],
214
- ['one line per command, for a page every session loads', 'sk commands --compact --out wiki/build/shipkit-cli.md'],
215
- ['fail if that page is stale (lint mode)', 'sk commands --compact --out wiki/build/shipkit-cli.md --check'],
214
+ ['one line per command, for a page every session loads', 'sk commands --compact --out wiki/tools/shipkit/commands.md'],
215
+ ['fail if that page is stale (lint mode)', 'sk commands --compact --out wiki/tools/shipkit/commands.md --check'],
216
216
  ],
217
217
  })
218
218
 
@@ -24,8 +24,8 @@ export class ConfigKeysCommand extends Command {
24
24
  examples: [
25
25
  ['markdown reference', 'sk config-keys'],
26
26
  ['machine-readable', 'sk config-keys --json'],
27
- ['write into a docs page between the markers', 'sk config-keys --out wiki/build/shipkit/config-keys.md'],
28
- ['fail if that page is stale (lint mode)', 'sk config-keys --out wiki/build/shipkit/config-keys.md --check'],
27
+ ['write into a docs page between the markers', 'sk config-keys --out wiki/tools/shipkit/config-keys.md'],
28
+ ['fail if that page is stale (lint mode)', 'sk config-keys --out wiki/tools/shipkit/config-keys.md --check'],
29
29
  ['name the keys carrying no doc comment', 'sk config-keys --undocumented'],
30
30
  ],
31
31
  })
@@ -0,0 +1,145 @@
1
+ // `sk drill`: the records of a measured drill (wiki meta/speed-up-agents/index.md). report = one run's transcript
2
+ // as run<n>.json + run<n>.md, verdict = the judged quality added to a run, compare = every run of a drill side
3
+ // by side. It reads transcripts and writes files; it never starts an agent (core/agent-spawn.ts). Exit 0 with
4
+ // the files written, 1 when a transcript or a run is missing or an argument does not parse, 2 on a bad verdict or --out.
5
+ import { Command, Option } from 'clipanion'
6
+ import { existsSync, readdirSync, readFileSync, writeFileSync } from 'fs'
7
+ import { basename, dirname, join, resolve } from 'path'
8
+
9
+ const RUN_FILE = /^run(\d+)\.json$/
10
+
11
+ /** a transcript by path, or by a session or agent id, under every config root */
12
+ async function findTranscript(ref: string): Promise<string | null> {
13
+ if (ref.endsWith('.jsonl')) return existsSync(ref) ? resolve(ref) : null
14
+ const { discoverConfigRoots } = await import('../reflect/prompt-corpus.ts')
15
+ const id = ref.replace(/^agent-/, '')
16
+ for (const root of discoverConfigRoots()) {
17
+ if (!existsSync(root.projects)) continue
18
+ for (const pattern of [`*/${id}.jsonl`, `*/*/subagents/agent-${id}.jsonl`]) {
19
+ for (const hit of new Bun.Glob(pattern).scanSync({ cwd: root.projects, onlyFiles: true })) return join(root.projects, hit)
20
+ }
21
+ }
22
+ return null
23
+ }
24
+
25
+ const writeRun = async (outBase: string, run: import('../drill/run.ts').DrillRun): Promise<void> => {
26
+ const { renderRun } = await import('../drill/render.ts')
27
+ writeFileSync(`${outBase}.json`, JSON.stringify(run, null, 2) + '\n')
28
+ writeFileSync(`${outBase}.md`, renderRun(run, basename(outBase)))
29
+ }
30
+
31
+ export class DrillReportCommand extends Command {
32
+ static override paths = [['drill', 'report']]
33
+ static override usage = Command.Usage({
34
+ category: 'Drill',
35
+ description: 'one drill run read from its transcript: run<n>.json and run<n>.md, numbers, pages read, phases, cost',
36
+ details: [
37
+ 'The transcript is a path, or a session or agent id (the agent id an Agent call returns), found under every config root.',
38
+ 'Counts calls, turns, failures, searches, reads, tokens and context at end; times the first md page read, the first write and the first check; lists every md page read with when; splits the wall into model and tools like `sk time`.',
39
+ '--root names the run folder, cut from every path so runs in two folders compare. --patch adds the stats of the run diff the method keeps. Text is masked through the leak guard before it is written.',
40
+ ].join(' '),
41
+ examples: [
42
+ ['a sub-agent run, by its agent id', 'sk drill report a7e0f9cd61f44cfb4 --out .shipkit/plans/20261104-speed-up/form/run1 --root ~/drills/app--form --patch .shipkit/plans/20261104-speed-up/form/run1.patch'],
43
+ ['a transcript file', 'sk drill report ~/.claude/projects/x/abc.jsonl --out runs/run1'],
44
+ ],
45
+ })
46
+ ref = Option.String({ required: true, name: 'transcript' })
47
+ out = Option.String('--out', { required: true, description: 'the run record, without extension: <dir>/run<n> gets .json and .md' })
48
+ root = Option.String('--root', { description: 'the run folder, cut from every path' })
49
+ patch = Option.String('--patch', { description: 'the run diff, for its stats' })
50
+
51
+ async execute(): Promise<number> {
52
+ const err = this.context.stderr
53
+ const file = await findTranscript(this.ref)
54
+ if (file == null) {
55
+ err.write(`FAIL: no transcript for ${this.ref}: a .jsonl path, or a session or agent id under ~/.claude*/projects\n`)
56
+ return 1
57
+ }
58
+ if (this.patch != null && !existsSync(this.patch)) {
59
+ err.write(`FAIL: --patch ${this.patch} does not exist\n`)
60
+ return 1
61
+ }
62
+ const outDir = dirname(resolve(this.out))
63
+ if (!existsSync(outDir)) {
64
+ err.write(`FAIL: --out ${this.out}: the folder ${outDir} does not exist\n`)
65
+ return 2
66
+ }
67
+ const { drillRun } = await import('../drill/run.ts')
68
+ const { loadMasker } = await import('../agent-time/mask.ts')
69
+ const run = drillRun(readFileSync(file, 'utf8').split('\n'), {
70
+ transcript: file.replace(process.env.HOME ?? '\0', '~'),
71
+ root: this.root == null ? undefined : resolve(this.root.replace(/^~(?=\/)/, process.env.HOME ?? '~')),
72
+ patch: this.patch == null ? undefined : readFileSync(this.patch, 'utf8'),
73
+ mask: loadMasker(process.cwd()),
74
+ })
75
+ const base = resolve(this.out)
76
+ await writeRun(base, run)
77
+ this.context.stdout.write(`ok: ${base}.json and .md: ${run.calls} calls, ${run.turns} turns, ${Math.round(run.wall / 1000)}s, ${run.docs.length} md pages read, ${run.errors} failed\n`)
78
+ return 0
79
+ }
80
+ }
81
+
82
+ export class DrillVerdictCommand extends Command {
83
+ static override paths = [['drill', 'verdict']]
84
+ static override usage = Command.Usage({
85
+ category: 'Drill',
86
+ description: 'the judged result added to a drill run: done, quality, tests, design, and its md written again',
87
+ details: 'A saving counts only when the verdict holds, so compare shows these rows beside the speed. Fields: done=<n>/<m>, quality=1-5, tests=ran|written|none, design=ok|wrong, and an optional note=<text> with no comma.',
88
+ examples: [['judge run 2, quoted so a note can hold spaces', 'sk drill verdict .shipkit/plans/20261104-speed-up/form/run2.json "done=3/3,quality=4,tests=ran,design=ok,note=its own endpoint"']],
89
+ })
90
+ run = Option.String({ required: true, name: 'run.json' })
91
+ verdict = Option.String({ required: true, name: 'verdict' })
92
+
93
+ async execute(): Promise<number> {
94
+ const err = this.context.stderr
95
+ if (!existsSync(this.run)) {
96
+ err.write(`FAIL: ${this.run} does not exist: write it with sk drill report first\n`)
97
+ return 1
98
+ }
99
+ const { parseVerdict } = await import('../drill/run.ts')
100
+ const v = parseVerdict(this.verdict)
101
+ if (typeof v === 'string') {
102
+ err.write(`FAIL: ${v}\n`)
103
+ return 2
104
+ }
105
+ const run = JSON.parse(readFileSync(this.run, 'utf8')) as import('../drill/run.ts').DrillRun
106
+ await writeRun(resolve(this.run).replace(/\.json$/, ''), { ...run, verdict: v })
107
+ this.context.stdout.write(`ok: ${this.run}: done ${v.done}, quality ${v.quality}, tests ${v.tests}, design ${v.design}\n`)
108
+ return 0
109
+ }
110
+ }
111
+
112
+ export class DrillCompareCommand extends Command {
113
+ static override paths = [['drill', 'compare']]
114
+ static override usage = Command.Usage({
115
+ category: 'Drill',
116
+ description: 'every run of a drill side by side in compare.md: deltas, verdicts, when each md page was read',
117
+ details: 'Reads the run<n>.json records of one task folder in run order and writes compare.md beside them. Flags a run whose prompt differs from the first. A ratio always reads up from 1: "1.7x more", never "0.6x fewer".',
118
+ examples: [['one task of a speed-up drill', 'sk drill compare .shipkit/plans/20261104-speed-up/form']],
119
+ })
120
+ dir = Option.String({ required: true, name: 'dir' })
121
+
122
+ async execute(): Promise<number> {
123
+ const err = this.context.stderr
124
+ const dir = resolve(this.dir)
125
+ if (!existsSync(dir)) {
126
+ err.write(`FAIL: ${this.dir} does not exist\n`)
127
+ return 1
128
+ }
129
+ const labels = readdirSync(dir)
130
+ .map((f) => RUN_FILE.exec(f))
131
+ .filter((m): m is RegExpExecArray => m != null)
132
+ .sort((a, b) => Number(a[1]) - Number(b[1]))
133
+ .map((m) => `run${m[1]}`)
134
+ if (labels.length === 0) {
135
+ err.write(`FAIL: no run<n>.json in ${this.dir}: write each with sk drill report --out ${this.dir}/run<n>\n`)
136
+ return 1
137
+ }
138
+ const { renderCompare } = await import('../drill/render.ts')
139
+ const runs = labels.map((label) => ({ label, run: JSON.parse(readFileSync(join(dir, `${label}.json`), 'utf8')) as import('../drill/run.ts').DrillRun }))
140
+ const out = join(dir, 'compare.md')
141
+ writeFileSync(out, renderCompare(basename(dir), runs))
142
+ this.context.stdout.write(`ok: ${out}: ${runs.length} runs\n`)
143
+ return 0
144
+ }
145
+ }