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
@@ -7,7 +7,7 @@ import { defineContract, file, glob, png } from 'rvlib-shipkit/src/contracts/con
7
7
  export default defineContract({
8
8
  venue: 'identity',
9
9
  dir: '.shipkit/identity',
10
- owner: 'build/generate-assets.md',
10
+ owner: 'tools/generate-assets/index.md',
11
11
  appliesTo: 'always',
12
12
  gate: 'public-surface',
13
13
  detect: [],
@@ -4,7 +4,7 @@ import { custom, defineContract, dirExists, fileContains, glob, md, png, script
4
4
  export default defineContract({
5
5
  venue: 'itch',
6
6
  dir: '.shipkit/itch',
7
- owner: 'distribute/itch.md',
7
+ owner: 'guides/itch/index.md',
8
8
  appliesTo: 'declared',
9
9
  detect: [script('^(up|push):itch$'), fileContains('deploy.sh', 'butler push'), dirExists('.shipkit/itch')],
10
10
  artifacts: [
@@ -5,7 +5,7 @@ import { custom, defineContract, dirExists, file, fileContains, glob, md, png, s
5
5
  export default defineContract({
6
6
  venue: 'steam',
7
7
  dir: '.shipkit/steam',
8
- owner: 'distribute/steam.md',
8
+ owner: 'guides/steam/index.md',
9
9
  appliesTo: 'declared',
10
10
  detect: [script('^(up|push):steam$'), fileContains('deploy.sh', 'run_app_build'), dirExists('.shipkit/steam')],
11
11
  artifacts: [
@@ -0,0 +1,12 @@
1
+ // the agent folder of a repo on disk (core/agent-dir.ts owns the rule)
2
+ import { readFileSync } from 'fs'
3
+ import { join } from 'path'
4
+ import { DEFAULT_AGENT_DIR, agentDirOf } from './agent-dir.ts'
5
+
6
+ /** the agent folder of the repo at `root` */
7
+ export function agentDirAt(root: string): string {
8
+ try { return agentDirOf(readFileSync(join(root, 'CLAUDE.md'), 'utf8')) } catch { return DEFAULT_AGENT_DIR }
9
+ }
10
+
11
+ /** the repo's own global contribution file, in the agent folder its CLAUDE.md names */
12
+ export const contributionFileAt = (root: string): string => `${agentDirAt(root)}/global-contribution.md`
@@ -0,0 +1,16 @@
1
+ // a repo's agent folder: the folder CLAUDE.md's LAST include names
2
+ // (`@./<dir>/index.md`). `agent` by default; a repo that hosts a base wiki may
3
+ // name a folder of it. CLAUDE.md is the one place it is declared. Pure: the
4
+ // disk side is agent-dir-at.ts, so a cached check importing this reads nothing.
5
+
6
+ export const DEFAULT_AGENT_DIR = 'agent'
7
+
8
+ /** the agent folder a CLAUDE.md text names, DEFAULT_AGENT_DIR when it names none */
9
+ export function agentDirOf(claude: string | null): string {
10
+ const last = (claude ?? '').split('\n').map((l) => l.trim()).filter((l) => l.startsWith('@')).at(-1)
11
+ const m = last == null ? null : /^@\.\/((?:[\w.-]+\/)*[\w.-]+)\/index\.md$/.exec(last)
12
+ return m?.[1] ?? DEFAULT_AGENT_DIR
13
+ }
14
+
15
+ /** a folder of another wiki (`docs/wiki/agent`), whose own lint and graph cover it */
16
+ export const nestedAgentDir = (dir: string): boolean => dir.includes('/')
@@ -96,8 +96,12 @@ function plate(ctx: ReturnType<Canvas['getContext']>, o: number): void {
96
96
  ctx.roundRect(o, o, PLATE, PLATE, RADIUS)
97
97
  }
98
98
 
99
+ /** how the plate is drawn: `plateAlpha` fades the plate alone, the mark stays whole
100
+ * (the rail's unselected rows). A tile has no plate apart from its mark, so it ignores it */
101
+ export type PlateLook = { plateAlpha?: number }
102
+
99
103
  /** the icon at 1024px, and the plate colour it used (null: the mark is the plate) */
100
- export async function drawAppIcon(bytes: Uint8Array, id: Identity): Promise<{ canvas: Canvas; plate: string | null }> {
104
+ export async function drawAppIcon(bytes: Uint8Array, id: Identity, look: PlateLook = {}): Promise<{ canvas: Canvas; plate: string | null }> {
101
105
  const img = await decode(bytes)
102
106
  const src = createCanvas(img.width, img.height)
103
107
  const sctx = src.getContext('2d')
@@ -127,8 +131,10 @@ export async function drawAppIcon(bytes: Uint8Array, id: Identity): Promise<{ ca
127
131
  g.addColorStop(0, towardWhite(colour, 0.14))
128
132
  g.addColorStop(1, colour)
129
133
  ctx.fillStyle = g
134
+ ctx.globalAlpha = look.plateAlpha ?? 1
130
135
  plate(ctx, o)
131
136
  ctx.fill()
137
+ ctx.globalAlpha = 1
132
138
  const s = (PLATE * MARK) / Math.max(box.w, box.h)
133
139
  ctx.drawImage(src, box.x, box.y, box.w, box.h, ICON_PX / 2 - (box.w * s) / 2, ICON_PX / 2 - (box.h * s) / 2, box.w * s, box.h * s)
134
140
  return { canvas: out, plate: colour }
@@ -138,8 +144,8 @@ export async function drawAppIcon(bytes: Uint8Array, id: Identity): Promise<{ ca
138
144
  * grid's margin away, the rounded plate edge to edge (the hub's rail);
139
145
  * `square` fills the plate's corners with its own edge colours, edge to edge
140
146
  * with no transparency (a phone's home screen cuts its own corners) */
141
- export async function appIconPngs(bytes: Uint8Array, id: Identity, sizes: number[] = [ICON_PX], crop: 'canvas' | 'plate' | 'square' = 'canvas'): Promise<Buffer[]> {
142
- const { canvas } = await drawAppIcon(bytes, id)
147
+ export async function appIconPngs(bytes: Uint8Array, id: Identity, sizes: number[] = [ICON_PX], crop: 'canvas' | 'plate' | 'square' = 'canvas', look: PlateLook = {}): Promise<Buffer[]> {
148
+ const { canvas } = await drawAppIcon(bytes, id, look)
143
149
  const o = crop === 'canvas' ? 0 : (ICON_PX - PLATE) / 2
144
150
  const side = crop === 'canvas' ? ICON_PX : PLATE
145
151
  const edge = (y: number): string => {
@@ -7,7 +7,7 @@ import { availableParallelism, loadavg } from 'os'
7
7
  import type { MachineLoad } from '../suite/judge-suites.ts'
8
8
 
9
9
  /** an in process body, a rule or a page check: the house bar is under 1 s
10
- * (identity/how-we-work.md, Velocity). The median rule answers in under 50ms */
10
+ * (preferences/how-we-work/index.md, Velocity). The median rule answers in under 50ms */
11
11
  export const IN_PROCESS_BUDGET_MS = 1_000
12
12
 
13
13
  /** a subprocess (a build step, a test suite, a `cmd` check) or a world probe
@@ -2,7 +2,7 @@
2
2
  // manual `bun fmt` (never a gate step). A repo opts in by declaring the tool's
3
3
  // section in bunfig.toml: the section is where its config lives.
4
4
  //
5
- // bun before 1.4.4 has neither command, and there `bun lint` falls through to
5
+ // bun before 1.4.4 has neither command, nor `bun check` (ts/gate-typecheck.ts), and there `bun lint` falls through to
6
6
  // the package.json `lint` script. A script that calls `bun lint` then calls
7
7
  // itself forever, so an old bun gets a loud refusal instead of a spawn. The
8
8
  // lint slot runs through core/bun-tool-cli.ts, which keeps a same-named script out.
@@ -12,7 +12,7 @@ export type BunTool = 'lint' | 'fmt'
12
12
 
13
13
  export const BUN_TOOLS_SINCE = '1.4.4'
14
14
 
15
- /** does the bun running shipkit ship `bun lint` and `bun fmt` */
15
+ /** does the bun running shipkit ship `bun lint`, `bun fmt` and `bun check` */
16
16
  export const bunHasTools = (version: string = Bun.version): boolean => Bun.semver.order(version.replace(/-.*$/, ''), BUN_TOOLS_SINCE) >= 0
17
17
 
18
18
  const header = (tool: BunTool): RegExp => new RegExp(`^\\s*\\[${tool}(?:\\.[^\\]]+)?\\]\\s*(?:#.*)?$`)
@@ -1,5 +1,5 @@
1
1
  // The canonical package.json script bodies for a shipkit repo — vocabulary
2
- // owned by meta/rv-conventions/package-json.md. ONE source: `shipkit init`
2
+ // owned by patterns/rv-conventions/package-json.md. ONE source: `shipkit init`
3
3
  // scaffolds from it and rule SK001's autofix repairs from it.
4
4
  //
5
5
  // a script that only forwards to a shipkit verb is NOT canon: the verb is the
@@ -30,7 +30,7 @@ export function conditionalBodies(_opts: ScriptStyle = {}): Record<string, strin
30
30
  }
31
31
  }
32
32
 
33
- // ONE WAY IN (build/shipkit/one-way-in.md): the verification verbs an agent types from
33
+ // ONE WAY IN (tools/shipkit/one-way-in.md): the verification verbs an agent types from
34
34
  // muscle memory ROUTE to shipkit, so `bun run test` gets the cache and the
35
35
  // job attachment without anyone having to remember a rule. The tool body they
36
36
  // used to hold moves to `<name>:raw`, which is what shipkit itself runs and
@@ -57,18 +57,50 @@ export type DiscoveredCheck = {
57
57
  from: CheckFrom
58
58
  }
59
59
 
60
- function walk(dir: string, out: string[], suffix = SUFFIX, dirs?: string[], prune?: ReadonlySet<string>): void {
60
+ function walk(dir: string, out: string[], suffix = SUFFIX, dirs?: string[], prune?: ReadonlySet<string>, times?: [string, number][]): void {
61
61
  dirs?.push(dir)
62
+ // the time before the read: a write between the two then reads as moved
63
+ if (times != null) {
64
+ try { times.push([dir, statSync(dir).mtimeMs]) } catch { times.push([dir, -1]) }
65
+ }
62
66
  let entries
63
67
  try { entries = readdirSync(dir, { withFileTypes: true }) } catch { return }
64
68
  for (const e of entries) {
65
69
  if (e.isDirectory()) {
66
70
  const sub = join(dir, e.name)
67
- if (!IGNORED_DIRS.has(e.name) && !e.name.startsWith('.') && prune?.has(sub) !== true) walk(sub, out, suffix, dirs, prune)
71
+ if (!IGNORED_DIRS.has(e.name) && !e.name.startsWith('.') && prune?.has(sub) !== true) walk(sub, out, suffix, dirs, prune, times)
68
72
  } else if (e.name.endsWith(suffix)) out.push(join(dir, e.name))
69
73
  }
70
74
  }
71
75
 
76
+ /** the last walk of each (root, suffix, prune), with the time of every dir it read: a dir's time moves when an entry
77
+ * is added, removed or renamed in it, so while none moved the list is the same, at a stat per dir (2 ms for a
78
+ * thousand dirs, where the walk takes 40 to 60 ms). The daemon's warm answers walk each repo many times */
79
+ const walks = new Map<string, { dirs: [string, number][]; out: string[] }>()
80
+ const WALKS_MAX = 256
81
+
82
+ function walkKept(dir: string, out: string[], suffix: string, dirs: string[] | undefined, prune: ReadonlySet<string>): void {
83
+ const key = `${dir}\0${suffix}\0${[...prune].sort().join('\0')}`
84
+ const held = walks.get(key)
85
+ const same = held != null && held.dirs.every(([d, t]) => {
86
+ try { return statSync(d).mtimeMs === t } catch { return false }
87
+ })
88
+ if (held != null && same) {
89
+ out.push(...held.out)
90
+ for (const [d] of held.dirs) dirs?.push(d)
91
+ return
92
+ }
93
+ const seen: string[] = []
94
+ const found: string[] = []
95
+ const timed: [string, number][] = []
96
+ walk(dir, found, suffix, seen, prune, timed)
97
+ walks.delete(key)
98
+ walks.set(key, { dirs: timed, out: found })
99
+ if (walks.size > WALKS_MAX) walks.delete(walks.keys().next().value!)
100
+ out.push(...found)
101
+ dirs?.push(...seen)
102
+ }
103
+
72
104
  /** the absolute vendored dirs of a repo, which no repo walk enters */
73
105
  const vendoredPrune = (root: string): ReadonlySet<string> => new Set(readVendored(root).map((d) => join(root, d)))
74
106
 
@@ -77,7 +109,7 @@ const vendoredPrune = (root: string): ReadonlySet<string> => new Set(readVendore
77
109
  * mtime, which is how a reader tells the list moved without walking again */
78
110
  export function repoUnitFiles(root: string, dirs?: string[]): string[] {
79
111
  const out: string[] = []
80
- walk(root, out, UNIT_SUFFIX, dirs, vendoredPrune(root))
112
+ walkKept(root, out, UNIT_SUFFIX, dirs, vendoredPrune(root))
81
113
  return out.sort()
82
114
  }
83
115
 
@@ -102,7 +134,7 @@ export async function importFresh(path: string): Promise<unknown> {
102
134
  * Sorted. */
103
135
  export function repoCheckFiles(root: string): string[] {
104
136
  const out: string[] = []
105
- walk(root, out, SUFFIX, undefined, vendoredPrune(root))
137
+ walkKept(root, out, SUFFIX, undefined, vendoredPrune(root))
106
138
  return out.sort()
107
139
  }
108
140
 
@@ -174,7 +206,7 @@ function brokenBuiltin(path: string, message: string): CheckDef {
174
206
  }
175
207
  }
176
208
 
177
- const BUILTIN_OWNER = 'build/shipkit/built-in-checks.md'
209
+ const BUILTIN_OWNER = 'tools/shipkit/built-in-checks.md'
178
210
 
179
211
  /** every check this repo can run: its own files, plus the toolkit's. Throws
180
212
  * on a registration nobody can act on (a duplicate id, a repo check squatting
@@ -197,7 +229,7 @@ export async function discoverChecks(root: string, o: DiscoverOpts = {}): Promis
197
229
  const builtins: string[] = []
198
230
  walk(builtinDir, builtins)
199
231
  const found: string[] = []
200
- walk(root, found, SUFFIX, undefined, vendoredPrune(root))
232
+ walkKept(root, found, SUFFIX, undefined, vendoredPrune(root))
201
233
  const units = repoUnitFiles(root)
202
234
  // the repo that HOSTS the toolkit walks over `src/checks/` too, and a file
203
235
  // discovered twice is a duplicate id rather than a second check. Real paths,
@@ -1,5 +1,7 @@
1
1
  // does a gate run its repair pass (core/run-fixers.ts). A leaf, so the hub's
2
2
  // run lanes read the same answer the gate acts on without loading the gate.
3
3
 
4
- /** `fix` named wins. Unnamed: a whole gate repairs, a narrowed run does not */
5
- export const fixPassRuns = (o: { fix?: boolean; onlyIds?: readonly string[] }): boolean => o.fix ?? (o.onlyIds ?? []).length === 0
4
+ /** every run repairs: a whole gate all it can, a narrowed run what its named
5
+ * checks own. A repair is mechanical and safe by contract, in a shared tree
6
+ * too. Only an internal report-only run (frozen, the hub's auto) passes false */
7
+ export const fixPassRuns = (o: { fix?: boolean; onlyIds?: readonly string[] }): boolean => o.fix ?? true
@@ -19,23 +19,23 @@ import { rawName, slotBody } from './canonical-scripts.ts'
19
19
  import type { CheckCtx } from './check-ctx.ts'
20
20
  import { checkUnitReader, type UnitReader } from '../release/unit-resolve.ts'
21
21
  import { parseJsonc } from '../ts/jsonc.ts'
22
- import { resolveTypecheckProjects } from '../ts/tsconfig-resolve.ts'
23
- import { gateBuildInfoArgs } from '../ts/typecheck-cache.ts'
22
+ import { gateCheckCmd, tscFallbackNote } from '../ts/gate-typecheck.ts'
24
23
  import { parseBunTestScript, suiteFlags } from '../suite/judge-suites.ts'
25
24
  import { declaredTestUnits, siblingUnits, testCheckId, unitIgnores, unitTestBody, unitTsconfig, type TestUnitDecl } from '../suite/test-units.ts'
26
25
  import { describeFirst, type TaskDef } from '../check.ts'
27
26
  import type { RepoConfig } from '../repo-config.ts'
28
27
  import { repoOff } from './when.ts'
29
- import { bunfigDeclares, bunLintCmd } from './bun-builtins.ts'
28
+ import { bunfigDeclares, bunHasTools, bunLintCmd } from './bun-builtins.ts'
30
29
  import { normalizeVendored } from './vendored.ts'
31
30
 
32
- /** how the floor reads the repo, by repo-relative path, plus the one lookup
33
- * outside it: a binary on PATH */
34
- export type FloorReader = UnitReader & { which: (bin: string) => string | null }
31
+ /** how the floor reads the repo, by repo-relative path, plus the lookups
32
+ * outside it: a binary on PATH, and the bun version (default: the bun
33
+ * running shipkit) */
34
+ export type FloorReader = UnitReader & { which: (bin: string) => string | null; bunVersion?: string }
35
35
 
36
36
  /** the check context as a floor reader. A PATH lookup is not a repo read, so
37
- * it marks the answer untracked, and only a repo with no local tsc and no
38
- * typecheck script ever asks it */
37
+ * it marks the answer untracked, and only the tsc fallback of a bun with no
38
+ * `bun check` ever asks it */
39
39
  export function checkFloorReader(c: CheckCtx): FloorReader {
40
40
  return {
41
41
  ...checkUnitReader(c),
@@ -53,7 +53,7 @@ export const FLOOR_IDS = ['lint', 'typecheck', 'test', 'imports:check', 'cycles'
53
53
  * outside them, since each unit has its own `test:<unit>` */
54
54
  export function slotDescription(id: string, withUnits: boolean): string {
55
55
  if (id === 'lint') return 'the linter reports no problem in the repo'
56
- if (id === 'typecheck') return 'tsc finds no type error in the repo'
56
+ if (id === 'typecheck') return 'the type checker finds no type error in the repo'
57
57
  if (id === 'test') return withUnits ? 'every test file outside the units passes' : 'every test file in the repo passes'
58
58
  if (id === 'imports:check') return 'every local import is absolute, carries its extension and resolves'
59
59
  if (id === 'cycles') return 'no import cycle between modules'
@@ -66,7 +66,7 @@ export const unitTestDescription = (u: { id: string; rel: string }): string =>
66
66
 
67
67
  /** what a unit's own typecheck asserts */
68
68
  export const unitTypecheckDescription = (u: { id: string; rel: string }): string =>
69
- describeFirst(`tsc finds no type error under ${u.rel}`, `tsc finds no type error in unit ${u.id}`)
69
+ describeFirst(`the type checker finds no type error under ${u.rel}`, `the type checker finds no type error in unit ${u.id}`)
70
70
 
71
71
  export type FloorSource = 'package.json script' | 'repo.config override' | 'built-in (shipkit)' | 'built-in (tsc)' | 'built-in (bun)' | 'unit'
72
72
  export type FloorResolution = {
@@ -84,7 +84,12 @@ export type FloorResolution = {
84
84
  /** a package.json body for a slot. A plain `bun test` in the test slot runs
85
85
  * through the suite runner (parallel, timed against the budget), anything
86
86
  * else runs as written and the gate says what that costs */
87
- function scriptCmd(c: RepoConfig, id: string, name: string, body: string, notes: string[], subs: TestUnitDecl[]): string[] {
87
+ function scriptCmd(c: RepoConfig, root: string, io: FloorReader, id: string, name: string, body: string, notes: string[], subs: TestUnitDecl[]): string[] {
88
+ if (id === 'typecheck') {
89
+ const project = plainTypecheckProject(body)
90
+ const cmd = project == null || !io.exists(project, 'file') ? null : gateTypecheckCmd(root, io, project, ['node_modules/.bin/tsc'], notes)
91
+ return cmd == null || typeof cmd === 'string' ? ['bun', 'run', name] : cmd
92
+ }
88
93
  if (id !== 'test') return ['bun', 'run', name]
89
94
  const args = parseBunTestScript(body)
90
95
  if (args == null) {
@@ -97,6 +102,43 @@ function scriptCmd(c: RepoConfig, id: string, name: string, body: string, notes:
97
102
  }
98
103
 
99
104
  const SUITE_CLI = fileURLToPath(import.meta.resolve('rvlib-shipkit/src/suite/suite-cli.ts'))
105
+ const TYPECHECK_CLI = fileURLToPath(import.meta.resolve('rvlib-shipkit/src/ts/typecheck-cli.ts'))
106
+
107
+ /** the tsconfig a script that only typechecks one config checks,
108
+ * repo-relative: `tsc --noEmit` or `bun check`, with at most a
109
+ * `-p`/`--project` (and, for bun check, the flags the gate passes itself).
110
+ * null for any other body, which runs as written */
111
+ export function plainTypecheckProject(body: string): string | null {
112
+ const words = body.trim().split(/\s+/)
113
+ const bunCheck = words[0] === 'bun' && words[1] === 'check'
114
+ if (!bunCheck && (words[0] !== 'tsc' || !words.includes('--noEmit'))) return null
115
+ const own = bunCheck ? GATE_CHECK_FLAGS : new Set(['--noEmit'])
116
+ const args = words.slice(bunCheck ? 2 : 1)
117
+ let project = '.'
118
+ for (let i = 0; i < args.length; i++) {
119
+ if (own.has(args[i]!)) continue
120
+ if ((args[i] === '-p' || args[i] === '--project') && args[i + 1] != null) { project = args[++i]!; continue }
121
+ return null
122
+ }
123
+ return project.endsWith('.json') ? posix.normalize(project) : posix.join(project, 'tsconfig.json')
124
+ }
125
+
126
+ const GATE_CHECK_FLAGS = new Set(['-b', '--build', '--all', '--no-pretty', '--no-script'])
127
+
128
+ /** the gate's typecheck over one repo-relative tsconfig, the same for a plain
129
+ * script, the built-in and a unit: `bun check` (ts/gate-typecheck.ts). On a
130
+ * bun without it, the cold tsc runner over the first tsc found (`tscAt`,
131
+ * repo-relative, then PATH), with a note; the reason when no tsc is found */
132
+ function gateTypecheckCmd(root: string, io: FloorReader, rel: string, tscAt: string[], notes: string[]): string[] | string {
133
+ const tsconfig = join(root, rel)
134
+ if (bunHasTools(io.bunVersion)) return gateCheckCmd(tsconfig)
135
+ const local = tscAt.find((p) => io.exists(p))
136
+ const tsc = local != null ? join(root, local) : io.which('tsc')
137
+ if (tsc == null) return `bun ${io.bunVersion ?? Bun.version} has no \`bun check\` and no tsc resolves (${[...tscAt, 'PATH'].join(', ')}): \`bun upgrade --canary\``
138
+ const note = tscFallbackNote(io.bunVersion)
139
+ if (!notes.includes(note)) notes.push(note)
140
+ return ['bun', TYPECHECK_CLI, tsc, tsconfig]
141
+ }
100
142
 
101
143
  /** one test check per declared sub-unit, `test:<unit id>`, a `release: false`
102
144
  * one included, run in the unit's own dir through the suite runner, so its
@@ -124,11 +166,10 @@ function unitTestTasks(root: string, io: FloorReader, subs: TestUnitDecl[], sibl
124
166
  /** one typecheck per declared sub-unit with a tsconfig of its own,
125
167
  * `typecheck:<unit id>`: the root tsconfig excludes a unit's dir (it compiles
126
168
  * standalone), so without this a green root typecheck hides every error only
127
- * the unit's tsconfig sees. It runs the same runner the root slot falls back
128
- * to, so a solution style config is checked project by project and says what
129
- * it checked. tsc comes from the unit's node_modules, else the repo's, else
130
- * PATH. Keyed and ordered like the unit's test check */
131
- function unitTypecheckTasks(root: string, io: FloorReader, subs: TestUnitDecl[], siblings: Map<string, string[]>, unfilled: { id: string; reason: string }[]): TaskDef[] {
169
+ * the unit's tsconfig sees. It runs the root slot's command. The tsc
170
+ * fallback takes the unit's node_modules, else the repo's, else PATH. Keyed
171
+ * and ordered like the unit's test check */
172
+ function unitTypecheckTasks(root: string, io: FloorReader, subs: TestUnitDecl[], siblings: Map<string, string[]>, notes: string[], unfilled: { id: string; reason: string }[]): TaskDef[] {
132
173
  const out: TaskDef[] = []
133
174
  for (const u of subs) {
134
175
  const id = `typecheck:${u.id}`
@@ -137,12 +178,10 @@ function unitTypecheckTasks(root: string, io: FloorReader, subs: TestUnitDecl[],
137
178
  if (u.tsconfig != null) unfilled.push({ id, reason: `units['${u.rel}'].tsconfig names '${u.tsconfig}', which does not exist` })
138
179
  continue
139
180
  }
140
- const local = join(u.rel, 'node_modules/.bin/tsc')
141
- const tsc = io.exists(local) ? join(root, local) : io.exists('node_modules/.bin/tsc') ? join(root, 'node_modules/.bin/tsc') : io.which('tsc')
142
- if (tsc == null) { unfilled.push({ id, reason: `unit '${u.id}' has a tsconfig and no tsc resolves (its node_modules, the repo's, PATH): add typescript` }); continue }
143
- const cli = fileURLToPath(import.meta.resolve('rvlib-shipkit/src/ts/typecheck-cli.ts'))
181
+ const cmd = gateTypecheckCmd(root, io, tsconfig, [join(u.rel, 'node_modules/.bin/tsc'), 'node_modules/.bin/tsc'], notes)
182
+ if (typeof cmd === 'string') { unfilled.push({ id, reason: `unit '${u.id}': ${cmd}` }); continue }
144
183
  const outside = tsconfigChain(tsconfig, io).filter((f) => f !== u.rel && !f.startsWith(`${u.rel}/`))
145
- out.push({ id, description: unitTypecheckDescription(u), cmd: ['bun', cli, tsc, join(root, tsconfig)], cwd: join(root, u.rel), inputs: [u.rel, ...(siblings.get(u.id) ?? []), ...outside], ...(u.deps == null ? {} : { deps: u.deps }) })
184
+ out.push({ id, description: unitTypecheckDescription(u), cmd, cwd: join(root, u.rel), inputs: [u.rel, ...(siblings.get(u.id) ?? []), ...outside], ...(u.deps == null ? {} : { deps: u.deps }) })
146
185
  }
147
186
  return out
148
187
  }
@@ -164,10 +203,10 @@ function tsconfigChain(rel: string, io: FloorReader): string[] {
164
203
  }
165
204
 
166
205
  // zero-config floor (O6): with no script, imports:check/cycles resolve to
167
- // shipkit's own rvlib-ts-tools dep, typecheck to the repo's tsc, lint to
206
+ // shipkit's own rvlib-ts-tools dep, typecheck to `bun check`, lint to
168
207
  // `bun lint` once bunfig.toml declares [lint]. Returns the task, or the
169
208
  // reason the slot stays empty.
170
- function builtinFloorTask(id: string, root: string, io: FloorReader, vendored: readonly string[]): { task: TaskDef; source: FloorSource } | string {
209
+ function builtinFloorTask(id: string, root: string, io: FloorReader, vendored: readonly string[], notes: string[]): { task: TaskDef; source: FloorSource } | string {
171
210
  if (id === 'lint') {
172
211
  if (!bunfigDeclares(io.text('bunfig.toml'), 'lint')) return `no 'lint' script and no [lint] section in bunfig.toml`
173
212
  return { task: { id, cmd: bunLintCmd(vendored) }, source: 'built-in (bun)' }
@@ -183,29 +222,10 @@ function builtinFloorTask(id: string, root: string, io: FloorReader, vendored: r
183
222
  }
184
223
  }
185
224
  if (id === 'typecheck') {
186
- const tsconfig = join(root, 'tsconfig.json')
187
225
  if (!io.exists('tsconfig.json')) return `no 'typecheck' script and no tsconfig.json`
188
- const local = join(root, 'node_modules/.bin/tsc')
189
- const tsc = io.exists('node_modules/.bin/tsc') ? local : io.which('tsc')
190
- if (tsc == null) return `no 'typecheck' script and tsc not found — add typescript or a typecheck script`
191
- // `tsc --noEmit` over a solution-style config (`files: []` plus
192
- // `references`) compiles ZERO files and exits 0, so the slot reports a
193
- // green nobody measured. only a config that is its OWN single project
194
- // keeps the plain command; everything else goes through the runner,
195
- // which resolves and REPORTS what it checked.
196
- //
197
- // a config that compiles nothing, or references a path that is gone,
198
- // registers the runner too rather than leaving the slot unfilled: an
199
- // unfilled slot is a skip, `shipkit ci` still exits 0, and a repo with
200
- // no typecheck coverage would look the same as a repo that passed.
201
- let plain = false
202
- try {
203
- const projects = resolveTypecheckProjects(tsconfig, io, root)
204
- plain = projects.projects.length === 1 && projects.projects[0] === tsconfig && projects.missing.length === 0
205
- } catch { plain = false }
206
- if (plain) return { task: { id, cmd: [tsc, '--noEmit', ...gateBuildInfoArgs(tsconfig)] }, source: 'built-in (tsc)' }
207
- const cli = fileURLToPath(import.meta.resolve('rvlib-shipkit/src/ts/typecheck-cli.ts'))
208
- return { task: { id, cmd: ['bun', cli, tsc, tsconfig] }, source: 'built-in (tsc)' }
226
+ const cmd = gateTypecheckCmd(root, io, 'tsconfig.json', ['node_modules/.bin/tsc'], notes)
227
+ if (typeof cmd === 'string') return `no 'typecheck' script, and ${cmd}`
228
+ return { task: { id, cmd }, source: bunHasTools(io.bunVersion) ? 'built-in (bun)' : 'built-in (tsc)' }
209
229
  }
210
230
  return `no package.json '${id}' script`
211
231
  }
@@ -258,8 +278,8 @@ export function resolveFloor(c: RepoConfig, root: string, io: FloorReader): Floo
258
278
  const t = { description, ...b }
259
279
  return override == null || override === false ? t : { ...t, ...override, id }
260
280
  }
261
- if (slot.kind === 'script') { tasks.push(decorate({ id, cmd: scriptCmd(c, id, slot.name, slot.body, notes, subs) })); sources[id] = 'package.json script'; continue }
262
- const b = builtinFloorTask(id, root, io, (c.vendored ?? []).map(normalizeVendored))
281
+ if (slot.kind === 'script') { tasks.push(decorate({ id, cmd: scriptCmd(c, root, io, id, slot.name, slot.body, notes, subs) })); sources[id] = 'package.json script'; continue }
282
+ const b = builtinFloorTask(id, root, io, (c.vendored ?? []).map(normalizeVendored), notes)
263
283
  // a routed script with nothing behind it measures NOTHING, and the
264
284
  // reason must say that rather than `no '<id>' script`, which is false
265
285
  if (typeof b === 'string') unfilled.push({ id, reason: slot.kind === 'routed-empty' ? `script '${id}' routes to shipkit and there is no '${rawName(id)}' body to run` : b })
@@ -267,6 +287,6 @@ export function resolveFloor(c: RepoConfig, root: string, io: FloorReader): Floo
267
287
  }
268
288
  const siblings = siblingUnits(subs, io.text)
269
289
  for (const t of unitTestTasks(root, io, subs, siblings, notes, unfilled)) { tasks.push(t); sources[t.id] = 'unit' }
270
- for (const t of unitTypecheckTasks(root, io, subs, siblings, unfilled)) { tasks.push(t); sources[t.id] = 'unit' }
290
+ for (const t of unitTypecheckTasks(root, io, subs, siblings, notes, unfilled)) { tasks.push(t); sources[t.id] = 'unit' }
271
291
  return { tasks, disabled, unfilled, sources, notes }
272
292
  }
package/src/core/floor.ts CHANGED
@@ -6,6 +6,7 @@ import { join } from 'path'
6
6
  import { gitBin } from './git-bin.ts'
7
7
  import { fsUnitReader } from '../release/units.ts'
8
8
  import { resolveFloor as resolveWith, type FloorReader, type FloorResolution } from './floor-resolve.ts'
9
+ import { keptOnTree } from './tree-rev.ts'
9
10
  import type { RepoConfig } from '../repo-config.ts'
10
11
 
11
12
  export * from './floor-resolve.ts'
@@ -20,6 +21,14 @@ export function resolveFloor(c: RepoConfig, root: string, io: FloorReader = fsFl
20
21
  * relative: the listing test discovery and the root test key read. Outside
21
22
  * git, a disk walk with installs and dot dirs left out */
22
23
  export function listRepoFiles(root: string): string[] {
24
+ return keptOnTree(listings, root, () => listNow(root)).slice()
25
+ }
26
+
27
+ /** the last listing of each root a save watch follows (core/tree-rev.ts): a git spawn and a stat per file, read again
28
+ * only once a file moved */
29
+ const listings = new Map<string, { rev: number; value: string[] }>()
30
+
31
+ function listNow(root: string): string[] {
23
32
  const p = Bun.spawnSync([gitBin(), 'ls-files', '-co', '--exclude-standard', '-z'], { cwd: root, stdout: 'pipe', stderr: 'ignore' })
24
33
  if (p.exitCode === 0) return p.stdout.toString().split('\0').filter((f) => f !== '' && existsSync(join(root, f))).sort()
25
34
  try {
@@ -153,3 +153,27 @@ export function shipkitRoot(root: string): string {
153
153
  const dir = gitRoot(root)?.commonDir
154
154
  return dir == null ? join(root, LAYOUT.cache) : join(dir, 'shipkit')
155
155
  }
156
+
157
+ /** the commit HEAD names, read from the git dir's files: no spawn, so a long lived process can key a cache on it each
158
+ * call. null when the files do not say it plainly (no repo, an unborn branch) */
159
+ export function headCommit(dir: string): string | null {
160
+ const r = gitRoot(dir)
161
+ if (r == null) return null
162
+ const sha = /^[0-9a-f]{40,64}$/
163
+ const read = (f: string): string | null => {
164
+ try {
165
+ return readFileSync(f, 'utf8')
166
+ } catch {
167
+ return null
168
+ }
169
+ }
170
+ const head = read(join(r.gitDir, 'HEAD'))?.trim() ?? ''
171
+ if (sha.test(head)) return head
172
+ const ref = /^ref: (refs\/\S+)$/.exec(head)?.[1]
173
+ if (ref == null) return null
174
+ const loose = read(join(r.commonDir, ref))?.trim() ?? ''
175
+ if (sha.test(loose)) return loose
176
+ // a packed ref: its line in packed-refs
177
+ const packed = (read(join(r.commonDir, 'packed-refs')) ?? '').split('\n').find((l) => l.endsWith(` ${ref}`))?.split(' ')[0] ?? ''
178
+ return sha.test(packed) ? packed : null
179
+ }
@@ -5,8 +5,11 @@
5
5
  // everywhere: CONTRIBUTION_MAX_LINES and CONTRIBUTION_MAX_BYTES bound it.
6
6
 
7
7
  import { readFileSync } from 'fs'
8
+ import { DEFAULT_AGENT_DIR } from './agent-dir.ts'
9
+
10
+ /** where a repo with the default agent folder keeps it */
11
+ export const CONTRIBUTION_FILE = `${DEFAULT_AGENT_DIR}/global-contribution.md`
8
12
 
9
- export const CONTRIBUTION_FILE = 'agent/global-contribution.md'
10
13
  /** the line a house index carries to load the generated context */
11
14
  export const CONTEXT_INCLUDE = '@generated/global-context.md'
12
15
  export const CONTRIBUTION_MAX_LINES = 40
@@ -1,5 +1,5 @@
1
1
  // THE IGNORED INPUTS BLOCK in `repo.config.ts`: the one place the traced
2
- // audit (core/trace-audit.ts) writes the gitignored paths each task reads.
2
+ // audit (core/trace-audit.ts) writes the paths each task reads outside its key.
3
3
  //
4
4
  // Its own markers, apart from the gate block (core/when-block.ts), so a repo
5
5
  // that writes `off` or `tests` by hand, with its comments, keeps them exactly
@@ -7,7 +7,8 @@ export type AuditTask = {
7
7
  /** `audited` when its trace had no hole, else why it could not be */
8
8
  status: 'audited' | 'unaudited'
9
9
  why?: string
10
- /** ignored paths it read that its key does not cover */
10
+ /** paths it read that its key does not cover: gitignored ones, and
11
+ * tracked files outside a declared list */
11
12
  uncovered: string[]
12
13
  /** the fewest `ignoredInputs` entries that cover them */
13
14
  propose: string[]
@@ -37,7 +38,7 @@ export function pendingByTask(r: AuditReport | null, have: IgnoredInputs): Ignor
37
38
  return out
38
39
  }
39
40
 
40
- /** `ignoredInputs`: task id → gitignored paths it reads, `'*'` for every task */
41
+ /** `ignoredInputs`: task id → paths it reads outside its key, `'*'` for every task */
41
42
  export type IgnoredInputs = Record<string, string[]>
42
43
 
43
44
  /** the entries that join one task's key */
@@ -7,6 +7,7 @@
7
7
  // statically, so it imports node builtins only. A lib import here would let
8
8
  // a broken file stop the boot before it can fall back.
9
9
  import { constants, copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync, readlinkSync, realpathSync, renameSync, rmSync, symlinkSync, writeFileSync } from 'fs'
10
+ import { rm } from 'fs/promises'
10
11
  import { homedir } from 'os'
11
12
  import { join, relative } from 'path'
12
13
 
@@ -109,7 +110,8 @@ export async function takeLastGood(lib: string, o: { home?: string; now?: number
109
110
  if (at == null || e === name) continue
110
111
  let since = Number(at[1])
111
112
  try { since = Number(readFileSync(join(base, e, RETIRED), 'utf8')) } catch { /* never current: a clone that failed or was cut */ }
112
- if (now - since > OLD_COPY_MS) rmSync(join(base, e), { recursive: true, force: true })
113
+ // a copy is thousands of files: removed off the loop, the daemon serves meanwhile
114
+ if (now - since > OLD_COPY_MS) await rm(join(base, e), { recursive: true, force: true })
113
115
  }
114
116
  return { dir, ms: performance.now() - t0 }
115
117
  }
@@ -25,10 +25,18 @@ export const LAYOUT = {
25
25
  // plans, arc boards and lane files: live state a crashed session resumes
26
26
  // from. Tracked in a private repo only, since a board quotes the owner
27
27
  plans: sk('plans'),
28
+ // the house repo's identities, who speaks: one folder each, its accounts; the house repo tracks it with its own
29
+ // gitignore line (wiki tools/shipkit/social.md)
30
+ identities: sk('identities'),
28
31
  // local: drafts, private notes, venue listings until they go live
29
32
  private: sk('private'),
30
33
  reflections: sk('reflections'),
34
+ // the social folder (contract v3): one folder a draft, the week's rhythm. The SK004 block re-includes it in a
35
+ // private repo only, like plans (wiki tools/shipkit/social.md)
31
36
  social: sk('social'),
37
+ // local: the facts (sha, size, type) of every draft media, so a file the disk let go keeps its key in the media
38
+ // store (wiki tools/shipkit/social.md, Media)
39
+ socialMedia: sk('social-media.json'),
32
40
  journal: sk('journal'),
33
41
  domain: sk('domain'),
34
42
  itch: sk('itch'),
@@ -0,0 +1,36 @@
1
+ // every line a long running role (pm, the daemon, the web) writes to its log starts with its local time: the log
2
+ // file has no other clock, and a restart or a stall can only be dated from it. Only the role's own entry stamps,
3
+ // so a test that runs a role in process keeps its console as it is
4
+ import { format } from 'node:util'
5
+
6
+ const pad = (n: number, w = 2): string => String(n).padStart(w, '0')
7
+
8
+ /** `2026-11-04 17:15:03.120` */
9
+ export const stampOf = (d: Date): string =>
10
+ `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}.${pad(d.getMilliseconds(), 3)}`
11
+
12
+ /** each line of `text` behind the stamp of `at` */
13
+ export const stampLines = (text: string, at: Date): string => {
14
+ const s = stampOf(at)
15
+ return text.split('\n').map((l) => `${s} ${l}`).join('\n')
16
+ }
17
+
18
+ type Io = { print: (l: string) => void; printErr: (l: string) => void }
19
+
20
+ /** the role's io with every line stamped */
21
+ export const stampedIo = (io: Io, now: () => Date = () => new Date()): Io => ({
22
+ print: (l) => io.print(stampLines(l, now())),
23
+ printErr: (l) => io.printErr(stampLines(l, now())),
24
+ })
25
+
26
+ let stamping = false
27
+
28
+ /** console.log, info, warn and error stamp each line from now on, in this process */
29
+ export function stampConsole(now: () => Date = () => new Date()): void {
30
+ if (stamping) return
31
+ stamping = true
32
+ for (const k of ['log', 'info', 'warn', 'error'] as const) {
33
+ const raw = console[k].bind(console)
34
+ console[k] = (...a: unknown[]) => raw(stampLines(format(...a), now()))
35
+ }
36
+ }