rvlib-shipkit 2.31.0 → 2.32.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 (384) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/package.json +1 -1
  3. package/src/advisors/acts.ts +16 -15
  4. package/src/advisors/advice.ts +56 -102
  5. package/src/advisors/advisor-view.ts +98 -73
  6. package/src/advisors/app-graph.ts +1 -1
  7. package/src/advisors/app.ts +3 -11
  8. package/src/advisors/cf-api.ts +1 -1
  9. package/src/advisors/dir-bucket.ts +4 -3
  10. package/src/advisors/edge/api.ts +26 -198
  11. package/src/advisors/edge/bucket.ts +2 -2
  12. package/src/advisors/edge/handler.ts +13 -155
  13. package/src/advisors/edge/here.ts +5 -5
  14. package/src/advisors/edge/pages.ts +12 -9
  15. package/src/advisors/edge/shell.ts +6 -5
  16. package/src/advisors/edge/sign-in.ts +101 -36
  17. package/src/advisors/edge/status.ts +19 -6
  18. package/src/advisors/edge/types.ts +36 -60
  19. package/src/advisors/expose.ts +29 -29
  20. package/src/advisors/here.ts +12 -12
  21. package/src/advisors/invite-send.ts +79 -35
  22. package/src/advisors/invite.ts +31 -8
  23. package/src/advisors/job.ts +24 -16
  24. package/src/advisors/login.ts +40 -15
  25. package/src/advisors/owner-store.ts +46 -22
  26. package/src/advisors/photos.ts +3 -3
  27. package/src/advisors/project.ts +25 -23
  28. package/src/advisors/reach.ts +89 -0
  29. package/src/advisors/rights.ts +1 -1
  30. package/src/advisors/routes.ts +55 -74
  31. package/src/advisors/scan.ts +0 -4
  32. package/src/advisors/setup-run.ts +14 -14
  33. package/src/advisors/share-trace.ts +3 -3
  34. package/src/advisors/{door-probe.ts → sign-in-probe.ts} +7 -6
  35. package/src/advisors/speaks.ts +29 -0
  36. package/src/advisors/sync.ts +92 -182
  37. package/src/advisors/tunnel.ts +6 -5
  38. package/src/advisors/users-listen.ts +92 -0
  39. package/src/advisors/users-router.ts +257 -85
  40. package/src/advisors/users-store.ts +81 -0
  41. package/src/agent-time/blocked-scan.ts +181 -0
  42. package/src/agent-time/registry.ts +12 -5
  43. package/src/agent-time/store.ts +9 -109
  44. package/src/asks/ask-bar-fold.ts +2 -1
  45. package/src/asks/ask-close.ts +2 -1
  46. package/src/asks/ask-doc.ts +2 -1
  47. package/src/asks/ask-migrate.ts +3 -2
  48. package/src/asks/ask-steps-fold.ts +2 -1
  49. package/src/asks/ask-store.ts +4 -3
  50. package/src/check.ts +3 -43
  51. package/src/checks/SK001-package-json-shape.check.ts +4 -55
  52. package/src/checks/SK004-gitignore-policy.check.ts +24 -69
  53. package/src/checks/SK013-one-way-in-policy.check.ts +3 -7
  54. package/src/checks/SK017-vscode-hub-task.check.ts +4 -4
  55. package/src/checks/SK019-tests-run-in-units.check.ts +3 -14
  56. package/src/checks/SK020-self-spawning-check.check.ts +5 -7
  57. package/src/checks/SK035-public-clean.check.ts +1 -1
  58. package/src/checks/SK039-vscode-watch-generated.check.ts +1 -1
  59. package/src/checks/SK042-post-kinds.check.ts +5 -14
  60. package/src/checks/SK054-agent-allow-list.check.ts +5 -74
  61. package/src/checks/SK055-retired-config-keys.check.ts +45 -0
  62. package/src/cli/cmd_Advisors.ts +11 -45
  63. package/src/cli/cmd_Asks.ts +3 -10
  64. package/src/cli/cmd_Backup.ts +25 -127
  65. package/src/cli/cmd_BackupTargets.ts +1 -1
  66. package/src/cli/cmd_Checks.ts +0 -14
  67. package/src/cli/cmd_Db.ts +3 -82
  68. package/src/cli/cmd_Home.ts +4 -32
  69. package/src/cli/cmd_Hq.ts +0 -17
  70. package/src/cli/cmd_Releases.ts +57 -4
  71. package/src/cli/cmd_Review.ts +333 -354
  72. package/src/cli/cmd_SocialDrafts.ts +6 -13
  73. package/src/cli/cmd_ThreadSyncNeeds.ts +6 -2
  74. package/src/cli/cmd_Time.ts +1 -1
  75. package/src/cli/cmd_Trailer.ts +1 -1
  76. package/src/cli/inbox-hook-run.ts +5 -23
  77. package/src/cli/registry-heads.ts +5 -55
  78. package/src/cli/registry.ts +1 -5
  79. package/src/cli/review-here.ts +1 -1
  80. package/src/cli.ts +2 -2
  81. package/src/collections/collection-types.ts +1 -1
  82. package/src/collections/review.ts +5 -4
  83. package/src/core/agent-allow-policy.ts +32 -2
  84. package/src/core/agent-env.ts +8 -0
  85. package/src/core/allow-rows.ts +74 -0
  86. package/src/core/check-file-names.ts +19 -106
  87. package/src/core/footprint.ts +17 -13
  88. package/src/core/identities-root.ts +1 -4
  89. package/src/core/layout.ts +1 -2
  90. package/src/core/machine-db.ts +33 -208
  91. package/src/core/machine-layout.ts +14 -127
  92. package/src/core/mask-source.ts +60 -0
  93. package/src/core/memory-watch.ts +17 -14
  94. package/src/core/motherhome.ts +8 -35
  95. package/src/core/one-way-in-policy.ts +0 -3
  96. package/src/core/repo-walk.ts +0 -9
  97. package/src/core/retention.ts +1 -9
  98. package/src/core/retired-checks.ts +2 -0
  99. package/src/core/tmux-policy.ts +1 -1
  100. package/src/core/tree-watch.ts +2 -2
  101. package/src/core/when.ts +7 -45
  102. package/src/gate/discover-checks.ts +42 -32
  103. package/src/gate/gate-checks.ts +21 -131
  104. package/src/gate/pre-commit-discovery.ts +16 -25
  105. package/src/gate/run-check.ts +0 -4
  106. package/src/gate/run-fix.ts +5 -17
  107. package/src/gate/run-fixers.ts +6 -42
  108. package/src/home/app-sign.ts +2 -2
  109. package/src/home/backup-status.ts +52 -92
  110. package/src/home/backup-verdict.ts +2 -2
  111. package/src/home/daemon-jobs.ts +51 -95
  112. package/src/home/database-words.ts +1 -2
  113. package/src/home/databases.ts +9 -25
  114. package/src/home/home-launchd.ts +0 -6
  115. package/src/home/home-paths.ts +8 -4
  116. package/src/home/home-routes.ts +3 -10
  117. package/src/home/home-state.ts +2 -14
  118. package/src/home/inbox-shape.ts +14 -15
  119. package/src/home/inbox.ts +1 -1
  120. package/src/home/machine-repair.ts +102 -103
  121. package/src/home/resume.ts +1 -15
  122. package/src/home/run-daemon.ts +4 -11
  123. package/src/home/space-page.ts +3 -2
  124. package/src/home/supervise.ts +3 -7
  125. package/src/hooks/hook-config.ts +6 -7
  126. package/src/hooks/leak-guard.ts +1 -1
  127. package/src/hooks/run-hooks.ts +0 -5
  128. package/src/hq/daemon-db.ts +8 -8
  129. package/src/hq/door.ts +3 -16
  130. package/src/hq/hq-db.ts +4 -3
  131. package/src/hq/hq-local.ts +1 -2
  132. package/src/hq/hq-store.ts +0 -15
  133. package/src/hq/item-direct.ts +8 -10
  134. package/src/hq/item-fill.ts +37 -0
  135. package/src/hq/kinds/item-gone.ts +7 -10
  136. package/src/hq/kinds/item-msg.ts +12 -18
  137. package/src/hq/kinds/item.ts +13 -19
  138. package/src/hq/kinds/report.ts +3 -4
  139. package/src/hq/owner-switch.ts +3 -3
  140. package/src/hq/report.ts +5 -9
  141. package/src/hq/switch.ts +2 -11
  142. package/src/hq/thread-sync.ts +5 -17
  143. package/src/hq/{shapes-words.ts → threads-words.ts} +2 -12
  144. package/src/http/owner-word.ts +1 -1
  145. package/src/identities/machine.ts +16 -0
  146. package/src/init-repo.ts +0 -1
  147. package/src/ledger/check-stats.ts +6 -5
  148. package/src/ledger/db.ts +2 -4
  149. package/src/ledger/record-kept.ts +117 -48
  150. package/src/ledger/run-log.ts +21 -2
  151. package/src/ledger/slow-tests.ts +96 -0
  152. package/src/ledger/store.ts +3 -86
  153. package/src/ledger/suite-log.ts +8 -2
  154. package/src/media-store/backup/facts.ts +3 -37
  155. package/src/media-store/backup/keys.ts +1 -8
  156. package/src/media-store/backup/manifest.ts +6 -67
  157. package/src/media-store/backup/restore.ts +4 -13
  158. package/src/media-store/backup/retention.ts +13 -1
  159. package/src/media-store/backup/run.ts +6 -267
  160. package/src/media-store/backup/snapshot.ts +2 -38
  161. package/src/media-store/backup/sources.ts +3 -113
  162. package/src/media-store/backup/target-send.ts +5 -29
  163. package/src/media-store/db.ts +8 -7
  164. package/src/media-store/forget-one.ts +1 -1
  165. package/src/media-store/forget.ts +1 -80
  166. package/src/orchestrator/guards.ts +0 -1
  167. package/src/orchestrator/presence.ts +2 -2
  168. package/src/orchestrator/routes.ts +1 -1
  169. package/src/orchestrator/started.ts +0 -9
  170. package/src/orchestrator/talk-key.ts +3 -4
  171. package/src/orchestrator/unheard.ts +1 -1
  172. package/src/recordings/edit.ts +3 -3
  173. package/src/recordings/marks-draw.ts +17 -6
  174. package/src/recordings/marks.ts +120 -9
  175. package/src/reflections/reflections-queue.ts +3 -10
  176. package/src/release/notes.ts +1 -1
  177. package/src/release/public-clean.ts +66 -6
  178. package/src/release/run-bump.ts +11 -0
  179. package/src/release/run-release.ts +4 -0
  180. package/src/releases/from-thread.ts +3 -3
  181. package/src/releases/model.ts +186 -36
  182. package/src/releases/store.ts +13 -3
  183. package/src/releases/validate.ts +83 -0
  184. package/src/repo-config.ts +29 -64
  185. package/src/review/answer-kinds.ts +61 -4
  186. package/src/review/blocked-guard.ts +11 -0
  187. package/src/review/blocked-object.ts +298 -0
  188. package/src/review/cells.ts +116 -229
  189. package/src/review/close.ts +39 -1
  190. package/src/review/doc-save.ts +3 -2
  191. package/src/review/draft-item.ts +1 -1
  192. package/src/review/events.ts +3 -7
  193. package/src/review/expect.ts +23 -39
  194. package/src/review/format.ts +79 -46
  195. package/src/review/glyphs.ts +1 -0
  196. package/src/review/hand-over.ts +3 -3
  197. package/src/review/heard.ts +1 -1
  198. package/src/review/holds-sync.ts +2 -1
  199. package/src/review/inbox-hook.ts +2 -2
  200. package/src/review/inbox-read.ts +39 -33
  201. package/src/review/instruction-guards.ts +12 -0
  202. package/src/review/instructions.ts +0 -1
  203. package/src/review/item-db.ts +13 -43
  204. package/src/review/item-hq.ts +2 -2
  205. package/src/review/item-rows.ts +3 -14
  206. package/src/review/kind-catalog.ts +3 -1
  207. package/src/review/kinds.ts +18 -8
  208. package/src/review/live-view.ts +3 -0
  209. package/src/review/media-kind.ts +1 -1
  210. package/src/review/mentions.ts +1 -2
  211. package/src/review/model.ts +158 -114
  212. package/src/review/move.ts +149 -0
  213. package/src/review/need-threads.ts +3 -2
  214. package/src/review/object-card.ts +11 -0
  215. package/src/review/object-read.ts +6 -1
  216. package/src/review/one-block.ts +1 -1
  217. package/src/review/owner-read.ts +1 -1
  218. package/src/review/phone-push.ts +10 -9
  219. package/src/review/previews.ts +32 -4
  220. package/src/review/push.ts +2 -2
  221. package/src/review/recap.ts +129 -0
  222. package/src/review/referring.ts +6 -3
  223. package/src/review/reflection-object.ts +4 -3
  224. package/src/review/routes.ts +49 -19
  225. package/src/review/secret-route.ts +3 -2
  226. package/src/review/settle.ts +0 -6
  227. package/src/review/snooze.ts +5 -3
  228. package/src/review/speaker.ts +68 -0
  229. package/src/review/start-title.ts +19 -0
  230. package/src/review/store.ts +86 -59
  231. package/src/review/{wakes.ts → thread-events.ts} +92 -7
  232. package/src/review/thread-md.ts +35 -14
  233. package/src/review/thread-state.ts +798 -0
  234. package/src/review/threads.ts +29 -347
  235. package/src/review/traces.ts +104 -7
  236. package/src/review/trailer-item.ts +1 -1
  237. package/src/review/unit.ts +7 -9
  238. package/src/review/verdict-items.ts +12 -10
  239. package/src/review/view-layout.ts +25 -1
  240. package/src/review/watch-feed.ts +1 -2
  241. package/src/review/working-guards.ts +2 -3
  242. package/src/rules/untrack-generated.ts +1 -15
  243. package/src/secrets/lapse.ts +2 -1
  244. package/src/serve/hub-app/advisor-app.tsx +4 -4
  245. package/src/serve/hub-app/advisor-face.tsx +9 -3
  246. package/src/serve/hub-app/advisor-host.ts +27 -27
  247. package/src/serve/hub-app/advisors-model.ts +17 -8
  248. package/src/serve/hub-app/advisors-rights.tsx +1 -1
  249. package/src/serve/hub-app/advisors-st.ts +15 -14
  250. package/src/serve/hub-app/advisors-view.tsx +13 -11
  251. package/src/serve/hub-app/app-bridge.ts +23 -3
  252. package/src/serve/hub-app/asks-page.tsx +1 -1
  253. package/src/serve/hub-app/auto-text.tsx +71 -16
  254. package/src/serve/hub-app/check-view.tsx +0 -8
  255. package/src/serve/hub-app/controls.css +14 -3
  256. package/src/serve/hub-app/database-view.tsx +1 -2
  257. package/src/serve/hub-app/git-view.tsx +3 -1
  258. package/src/serve/hub-app/hub.css +12 -5
  259. package/src/serve/hub-app/icons.tsx +1 -1
  260. package/src/serve/hub-app/inbox-view.tsx +1 -2
  261. package/src/serve/hub-app/live-sources.ts +2 -2
  262. package/src/serve/hub-app/main-panel.tsx +2 -1
  263. package/src/serve/hub-app/panel-repo.ts +0 -9
  264. package/src/serve/hub-app/pic.tsx +29 -12
  265. package/src/serve/hub-app/polled.ts +16 -2
  266. package/src/serve/hub-app/recordings-st.ts +23 -2
  267. package/src/serve/hub-app/recordings-view.tsx +68 -10
  268. package/src/serve/hub-app/ref-pill.ts +1 -1
  269. package/src/serve/hub-app/repo-st.ts +1 -2
  270. package/src/serve/hub-app/review/advisor-add.tsx +1 -1
  271. package/src/serve/hub-app/review/advisor-invite.tsx +1 -1
  272. package/src/serve/hub-app/review/draft-body.tsx +2 -2
  273. package/src/serve/hub-app/review/heard-line.tsx +1 -1
  274. package/src/serve/hub-app/review/instructions-view.tsx +1 -8
  275. package/src/serve/hub-app/review/kind-states.tsx +14 -9
  276. package/src/serve/hub-app/review/kit.tsx +4 -11
  277. package/src/serve/hub-app/review/lane-bar.tsx +3 -3
  278. package/src/serve/hub-app/review/lightbox.tsx +15 -11
  279. package/src/serve/hub-app/review/line-window.ts +4 -1
  280. package/src/serve/hub-app/review/live-bar-st.ts +2 -2
  281. package/src/serve/hub-app/review/live-view.tsx +57 -1
  282. package/src/serve/hub-app/review/object-panel.tsx +20 -8
  283. package/src/serve/hub-app/review/question-views.tsx +181 -54
  284. package/src/serve/hub-app/review/recap-bar.tsx +40 -0
  285. package/src/serve/hub-app/review/request-cell.tsx +48 -0
  286. package/src/serve/hub-app/review/review-cells.tsx +154 -96
  287. package/src/serve/hub-app/review/review-host.ts +2 -2
  288. package/src/serve/hub-app/review/review-kit.ts +17 -11
  289. package/src/serve/hub-app/review/review-list.tsx +23 -31
  290. package/src/serve/hub-app/review/review-st.ts +30 -40
  291. package/src/serve/hub-app/review/review-thread.tsx +139 -85
  292. package/src/serve/hub-app/review/review-views.tsx +124 -68
  293. package/src/serve/hub-app/review/share-lines.tsx +4 -4
  294. package/src/serve/hub-app/review/start-st.ts +2 -5
  295. package/src/serve/hub-app/review/superseded-runs.ts +4 -3
  296. package/src/serve/hub-app/review/thread-close.tsx +10 -7
  297. package/src/serve/hub-app/review/thread-st.ts +372 -201
  298. package/src/serve/hub-app/review/tone-bar.tsx +126 -0
  299. package/src/serve/hub-app/review/tones.ts +35 -0
  300. package/src/serve/hub-app/review/trailer-body.tsx +2 -2
  301. package/src/serve/hub-app/review/trailer-st.ts +3 -2
  302. package/src/serve/hub-app/review/trailer-voices-st.ts +3 -2
  303. package/src/serve/hub-app/review.css +180 -106
  304. package/src/serve/hub-app/search-view.tsx +1 -1
  305. package/src/serve/hub-app/social/social-model.ts +0 -4
  306. package/src/serve/hub-app/source-acts.ts +2 -1
  307. package/src/serve/hub-app/stores/stores-page.tsx +2 -2
  308. package/src/serve/hub-app/terminal-sources.tsx +2 -1
  309. package/src/serve/hub-app/thread-row.tsx +3 -4
  310. package/src/serve/hub-app/tree-build.ts +0 -4
  311. package/src/serve/hub-app/urls-view.tsx +2 -1
  312. package/src/serve/hub-app/view-layout.css +13 -3
  313. package/src/serve/hub-app/wikis-view.tsx +5 -2
  314. package/src/serve/hub-runtime.ts +7 -37
  315. package/src/serve/project-gutter-route.ts +6 -2
  316. package/src/serve/read-thread.ts +20 -2
  317. package/src/serve/read-worker.ts +9 -1
  318. package/src/serve/record-pages.ts +46 -0
  319. package/src/serve/serve-hub.ts +2 -2
  320. package/src/serve/terminal-host.ts +1 -1
  321. package/src/serve/terminal-route.ts +1 -3
  322. package/src/serve/tracked-watch.ts +1 -3
  323. package/src/setup-house.ts +2 -2
  324. package/src/shipkit-files.ts +1 -1
  325. package/src/shipkit.ts +1 -6
  326. package/src/shot/film-box.ts +0 -20
  327. package/src/social/drafts.ts +1 -1
  328. package/src/social/kinds.ts +6 -29
  329. package/src/social/load.ts +2 -2
  330. package/src/social/post-object.ts +3 -2
  331. package/src/social/release-stage.ts +1 -1
  332. package/src/social/stage.ts +2 -2
  333. package/src/stores/model.ts +4 -0
  334. package/src/stores/routes.ts +11 -3
  335. package/src/suite/judge-suites.ts +58 -0
  336. package/src/suite/red-alone.ts +54 -18
  337. package/src/suite/runner-shapes.ts +2 -2
  338. package/src/suite/suite-cli.ts +67 -14
  339. package/src/suite/test-units.ts +2 -1
  340. package/src/urls/fill.ts +1 -1
  341. package/src/urls/places.ts +1 -2
  342. package/src/vault/vault-config.ts +2 -2
  343. package/src/vault/vault-init.ts +1 -5
  344. package/src/wiki/graph-page.ts +14 -2
  345. package/src/advisors/copy-truth.ts +0 -49
  346. package/src/advisors/door-child.ts +0 -112
  347. package/src/advisors/door-serve.ts +0 -52
  348. package/src/advisors/door.ts +0 -118
  349. package/src/checks/SK016-legacy-check-shapes.check.ts +0 -189
  350. package/src/checks/SK029-explicit-check-files.check.ts +0 -112
  351. package/src/checks/SK048-one-local-file.check.ts +0 -36
  352. package/src/core/config-rewrite.ts +0 -111
  353. package/src/core/daemon-port.ts +0 -10
  354. package/src/core/legacy-shapes.ts +0 -263
  355. package/src/core/migrate-layout.ts +0 -638
  356. package/src/core/port-check-cli.ts +0 -52
  357. package/src/core/port-check-file.ts +0 -295
  358. package/src/core/port-check-files.ts +0 -31
  359. package/src/gate/discover-legacy-checks.ts +0 -26
  360. package/src/home/home-move.ts +0 -527
  361. package/src/home/machine-fold.ts +0 -810
  362. package/src/hq/item-shapes.ts +0 -54
  363. package/src/hq/kinds/items-read.ts +0 -4
  364. package/src/media-store/backup/daemon.ts +0 -220
  365. package/src/media-store/backup/kept.ts +0 -241
  366. package/src/media-store/backup/prune.ts +0 -359
  367. package/src/media-store/backup/secret.ts +0 -88
  368. package/src/media-store/backup/ssh-space.ts +0 -202
  369. package/src/media-store/backup/watch.ts +0 -117
  370. package/src/review/band.ts +0 -182
  371. package/src/review/folders.ts +0 -216
  372. package/src/review/hook-ask.ts +0 -58
  373. package/src/review/role.ts +0 -48
  374. package/src/review/thread-fold.ts +0 -64
  375. package/src/review/wait.ts +0 -91
  376. package/src/rules/rule.ts +0 -43
  377. package/src/serve/hook-thread.ts +0 -37
  378. package/src/serve/hook-work.ts +0 -92
  379. package/src/serve/hook-worker.ts +0 -57
  380. package/src/serve/hub-app/review/dock.tsx +0 -147
  381. package/src/serve/hub-app/review/faces.tsx +0 -18
  382. package/src/serve/hub-app/review/item-verdict.tsx +0 -112
  383. package/src/serve/hub-app/review/review-board.tsx +0 -48
  384. /package/src/{scaffold → core}/jsonc-spans.ts +0 -0
@@ -1,6 +1,6 @@
1
1
  // SK001 — canonical package.json shape (patterns/rv-conventions/package-json.md):
2
- // private:true, no license, capability-required script names FAIL, banned
3
- // aliases + missing baseline scripts WARN. Blocking, so it runs in `shipkit
2
+ // private:true, no license, capability-required script names FAIL, missing
3
+ // baseline scripts WARN. Blocking, so it runs in `shipkit
4
4
  // ci` like every other rule. It reads only through `c`, so it is cached on
5
5
  // what it read: package.json, the probes below, the test file listing, and
6
6
  // whatever the floor resolution read.
@@ -33,23 +33,8 @@ type Pkg = { name?: string; private?: boolean; license?: string; scripts?: Recor
33
33
 
34
34
  const OWNER = 'patterns/rv-conventions/package-json.md'
35
35
 
36
- // alias → { canonical, bodyMatch } — WARN only when the body proves the
37
- // alias really is the canonical capability (a `serve` that serves a dist/
38
- // folder must not be told to rename)
39
- const ALIASES: Record<string, { canonical: string; bodyMatch: RegExp }> = {
40
- 'serve': { canonical: 'hub', bodyMatch: /(?:^|\s)(?:shipkit|\S*shipkit\S*\/cli\.ts) serve\b/ },
41
- 'check-types': { canonical: 'typecheck', bodyMatch: /./ },
42
- }
43
-
44
36
  const BASELINE = ['test', 'lint'] as const
45
37
 
46
- // tools bun's built-ins replaced (a formatter is SK051's). Never repaired here: a linter swap changes
47
- // which rules gate the repo, and dropping a dependency moves bun.lock, which
48
- // only an install rewrites
49
- const RETIRED: Array<{ tool: string; deps: string[]; config: string; how: string }> = [
50
- { tool: 'oxlint', deps: ['oxlint', 'oxlint-tsgolint'], config: '.oxlintrc.json', how: 'port its rules into [lint] in bunfig.toml (`bun lint` is the house linter), then' },
51
- ]
52
-
53
38
  // no per-line fix pointers here — the rule framework appends ONE pointer
54
39
  // (docsBase + OWNER) to a failing/warning run, the same one-per-severity
55
40
  // doctrine the contracts engine follows
@@ -88,19 +73,7 @@ export function evaluatePackageJson(t: CheckCtx): void {
88
73
  if (pkg.license != null) t.fail(`package.json: license field is banned on project repos (rvlib-* sub-packages excepted)`)
89
74
  }
90
75
 
91
- // aliases first — an alias satisfies the requirement but earns a WARN,
92
- // never a double report (alias WARN + missing-canonical FAIL). A banned
93
- // alias lingering NEXT TO its canonical still WARNs (sweep on sight),
94
- // it just doesn't satisfy anything.
95
- const aliased = new Set<string>()
96
- for (const [name, a] of Object.entries(ALIASES)) {
97
- const body = scripts[name]
98
- if (body == null || !a.bodyMatch.test(body)) continue
99
- if (scripts[a.canonical] == null) aliased.add(a.canonical)
100
- t.warn(`package.json: script '${name}' is the house '${a.canonical}' — ${scripts[a.canonical] == null ? 'rename it' : `delete it ('${a.canonical}' exists)`}`)
101
- }
102
-
103
- const has = (name: string): boolean => scripts[name] != null || aliased.has(name)
76
+ const has = (name: string): boolean => scripts[name] != null
104
77
 
105
78
  const required = requiredScripts(t)
106
79
  const missing = required.filter((r) => !has(r.name))
@@ -144,24 +117,6 @@ export function evaluatePackageJson(t: CheckCtx): void {
144
117
  t.warn(`package.json: script 'check' shadows \`bun check\`, the type checker an agent runs: rename it (until then \`bun check --no-script\` type checks)`)
145
118
  if (missingBaseline.length > 0)
146
119
  t.warn(`package.json: missing baseline: ${missingBaseline.map((n) => (n === 'test' ? `script 'test'` : `[${n}] in bunfig.toml (or a '${n}' script)`)).join(', ')}`)
147
- for (const r of RETIRED) {
148
- // the tool as a command word: `bunx oxlint@latest`, `"oxlint;"`, never `.oxlintrc` or `oxlint-smoke.ts`
149
- const word = new RegExp(`(^|[^\\w.-])${r.tool}(?![\\w-])`)
150
- const sole = new RegExp(`^\\s*(?:(?:bunx|npx|bun\\s+x)\\s+)?(?:\\S*/)?${r.tool}(?:@\\S+)?(?:\\s+[^;&|]*)?$`)
151
- const deps = r.deps.filter((d) => [pkg.dependencies, pkg.devDependencies, pkg.optionalDependencies].some((m) => m?.[d] != null))
152
- const using = Object.entries(scripts).filter(([, body]) => word.test(body))
153
- const whole = using.filter(([, body]) => sole.test(body)).map(([name]) => `'${name}'`)
154
- const steps = using.filter(([, body]) => !sole.test(body)).map(([name]) => `'${name}'`)
155
- const del = [
156
- ...deps.map((d) => `the ${d} dependency`),
157
- ...(whole.length > 0 ? [`script ${whole.join(', ')}`] : []),
158
- ...(t.exists(r.config) ? [r.config] : []),
159
- ]
160
- if (deps.length === 0 && using.length === 0) continue
161
- const parts = [...(del.length > 0 ? [`delete ${del.join(', ')}`] : []), ...(steps.length > 0 ? [`take the ${r.tool} step out of script ${steps.join(', ')}, which does more`] : [])]
162
- t.warn(`package.json: ${r.tool} is retired: ${r.how} ${parts.join(', and ')}`)
163
- }
164
-
165
120
  if (!t.failed && !t.warned)
166
121
  t.ok(`package.json shape ok (${isLib || !housePrivateApps(t) ? '' : 'private, no license, '}${required.length} required script(s) present)`)
167
122
  }
@@ -278,13 +233,7 @@ export const packageJsonShape = check({
278
233
  const bin = inferBin(pkg.scripts)
279
234
  const bodies: Record<string, string> = { ...canonicalBodies({ bin }), ...conditionalBodies({ bin }) }
280
235
  const skipped: string[] = []
281
- // a banned alias satisfies a requirement for the lint — adding its
282
- // canonical beside it would create the exact duplicate the lint then
283
- // tells a human to delete
284
- const aliasSatisfied = new Set<string>()
285
- for (const [name, a] of Object.entries(ALIASES))
286
- if (pkg.scripts[name] != null && a.bodyMatch.test(pkg.scripts[name]!)) aliasSatisfied.add(a.canonical)
287
- for (const m of requiredScripts(c).filter((r) => pkg.scripts![r.name] == null && !aliasSatisfied.has(r.name))) {
236
+ for (const m of requiredScripts(c).filter((r) => pkg.scripts![r.name] == null)) {
288
237
  const body = bodies[m.name]
289
238
  if (body == null) { skipped.push(m.name); continue }
290
239
  pkg.scripts[m.name] = body
@@ -14,13 +14,11 @@
14
14
  // depends on the index, `.git/info/exclude` and the user's global excludes
15
15
  // file, which no read set records exactly, and a body that asked git through
16
16
  // `c.git` is never stored on its reads.
17
- import { readdirSync } from 'fs'
18
17
  import type { RepoConfig } from '../repo-config.ts'
19
18
  import { declaredPublic } from '../core/repo-facts.ts'
20
- import { commitPolicyBlock, GENERATED_IGNORE_LINES, GENERATED_TRACKED_PATHS, gitignoreBaseline, untrackGenerated } from '../rules/untrack-generated.ts'
19
+ import { commitPolicyBlock, GENERATED_TRACKED_PATHS, gitignoreBaseline, untrackGenerated } from '../rules/untrack-generated.ts'
21
20
  import { check, type CheckCtx, type FixResult } from '../check.ts'
22
21
  import { LAYOUT, SHIPKIT_DIR, TRACKED_DIRS } from '../core/layout.ts'
23
- import { LEGACY_CONTRACT_PREFIX, LEGACY_IGNORED, LEGACY_TMP, LEGACY_VENUES, layoutSummary, legacyLayoutLeft, migrateLayout } from '../core/migrate-layout.ts'
24
22
 
25
23
  /** what this check reads, writes and asks git through */
26
24
  type Disk = Pick<CheckCtx, 'root' | 'read' | 'write' | 'exists' | 'git'>
@@ -69,10 +67,6 @@ export const POLICY_LINES = [
69
67
  // nothing durable lives in the scratch, and a review narrates agent process
70
68
  `${LAYOUT.tmp}/`,
71
69
  `${LAYOUT.reviews}/`,
72
- // a root scratch stays out of git too: the fix pass moves it under
73
- // .shipkit/, its dated plans into .shipkit/plans/, and until it runs
74
- // nothing there is exposed
75
- `${LEGACY_TMP}/`,
76
70
  'CLAUDE.local.md',
77
71
  // atomicWrite lands every file via `.<name>.tmp-<pid>` next to its target,
78
72
  // so a run killed mid write leaves one behind ANYWHERE in the tree, and an
@@ -88,10 +82,6 @@ export const POLICY_LINES = [
88
82
  '.comfy-ts/*',
89
83
  DRAFTS_BACK,
90
84
  '*.loras.local.txt',
91
- // shipkit's own per-run output. Ignoring is only half of it: the fixer
92
- // also removes these from the index, because .gitignore does nothing to a
93
- // file already tracked (untrack-generated.ts owns the pair)
94
- ...GENERATED_IGNORE_LINES,
95
85
  ]
96
86
 
97
87
  /** the policy one repo carries. A declared public tree ships to strangers,
@@ -99,41 +89,20 @@ export const POLICY_LINES = [
99
89
  * repo, private words in a public one */
100
90
  const policyLines = (config: RepoConfig): string[] => declaredPublic(config) ? POLICY_LINES.filter((l) => !PRIVATE_ONLY.has(l)) : POLICY_LINES
101
91
 
102
- const LEGACY = '# the old root layout, ignored until the fix pass moves it under .shipkit/'
103
-
104
- /** `legacy`: the repo still carries contract folders at its root from before `.shipkit/`. Their names
105
- * stay ignored until they move, so no private file is ever exposed by a block
106
- * that is newer than the tree it guards */
107
- export function expectedBlock(config: RepoConfig, legacy = false): string {
92
+ export function expectedBlock(config: RepoConfig): string {
108
93
  const extra = config.gitignore ?? []
109
- return [BEGIN, ...policyLines(config), ...(legacy ? [LEGACY, ...LEGACY_IGNORED] : []), ...(extra.length > 0 ? [CONTRIB, ...extra] : []), END].join('\n')
110
- }
111
-
112
- export function policyPatterns(config: RepoConfig, legacy = false): string[] {
113
- return [...policyLines(config).filter((l) => !l.startsWith('#')), ...(legacy ? LEGACY_IGNORED : []), ...(config.gitignore ?? [])]
94
+ return [BEGIN, ...policyLines(config), ...(extra.length > 0 ? [CONTRIB, ...extra] : []), END].join('\n')
114
95
  }
115
96
 
116
- /** does the root still hold a contract folder from before `.shipkit/` */
117
- function hasLegacy(root: string): boolean {
118
- try { return readdirSync(root).some((e) => e.startsWith(LEGACY_CONTRACT_PREFIX)) } catch { return false }
97
+ export function policyPatterns(config: RepoConfig): string[] {
98
+ return [...policyLines(config).filter((l) => !l.startsWith('#')), ...(config.gitignore ?? [])]
119
99
  }
120
100
 
121
- /** the .gitignore text with its policy block rendered, every repo line kept
122
- * where it was. The layout migration writes it before it moves a single
123
- * folder, with `legacy` on while an old folder is still on disk */
124
- export const renderPolicy = (text: string, config: RepoConfig, legacy = false): string => withBlock(text, config, legacy)
125
-
126
101
  function endsWithNewline(d: Disk): boolean {
127
102
  const text = d.read('.gitignore')
128
103
  return text == null || text === '' || text.endsWith('\n')
129
104
  }
130
105
 
131
- // a venue folder is DESIGNED to be unignored below the block once a listing
132
- // is live (last-match-wins), so an override on one of them is the mechanism
133
- // working. Every other policy path is a claim the block makes, and a claim git
134
- // contradicts is a bug.
135
- const OVERRIDABLE = new Set(LEGACY_VENUES)
136
-
137
106
  /** a path git can be asked about, for a pattern that may be a glob or a dir */
138
107
  function probePath(anchored: string): string {
139
108
  const pattern = anchored.replace(/^\//, '')
@@ -207,33 +176,33 @@ function parseText(text: string | null): Parsed | null {
207
176
 
208
177
  type BlockState = 'missing-file' | 'missing-block' | 'corrupted' | 'stale' | 'current'
209
178
 
210
- function blockState(d: Disk, config: RepoConfig, legacy: boolean): BlockState {
179
+ function blockState(d: Disk, config: RepoConfig): BlockState {
211
180
  const f = parse(d)
212
181
  if (f == null) return 'missing-file'
213
182
  if (f.b === -1 && f.e === -1) return 'missing-block'
214
183
  if (f.b === -1 || f.e === -1 || f.e < f.b) return 'corrupted'
215
- return f.lines.slice(f.b, f.e + 1).join('\n') === expectedBlock(config, legacy) ? 'current' : 'stale'
184
+ return f.lines.slice(f.b, f.e + 1).join('\n') === expectedBlock(config) ? 'current' : 'stale'
216
185
  }
217
186
 
218
187
  /** the lines of a well-formed block the current one no longer holds: a line a repo wrote inside it, or one the policy
219
188
  * retired. Only the repair removes them, and it names each */
220
- export function removedLines(text: string | null, config: RepoConfig, legacy = false): string[] {
189
+ export function removedLines(text: string | null, config: RepoConfig): string[] {
221
190
  const f = parseText(text)
222
191
  if (f == null || f.b === -1 || f.e === -1 || f.e < f.b) return []
223
- const kept = new Set([...expectedBlock(config, legacy).split('\n'), CONTRIB, LEGACY])
192
+ const kept = new Set([...expectedBlock(config).split('\n'), CONTRIB])
224
193
  return f.lines.slice(f.b + 1, f.e).filter((l) => l.trim() !== '' && !kept.has(l))
225
194
  }
226
195
 
227
196
  const REMOVED_FIX = 'a line of the repo goes below the block, or in repo.config.ts gitignore:'
228
197
 
229
- function writeBlock(d: Disk, config: RepoConfig, legacy: boolean): void {
230
- d.write('.gitignore', withBlock(d.read('.gitignore'), config, legacy))
198
+ function writeBlock(d: Disk, config: RepoConfig): void {
199
+ d.write('.gitignore', withBlock(d.read('.gitignore'), config))
231
200
  }
232
201
 
233
202
  /** PURE: the .gitignore text with the current block in it */
234
- function withBlock(text: string | null, config: RepoConfig, legacy: boolean): string {
203
+ function withBlock(text: string | null, config: RepoConfig): string {
235
204
  const f = parseText(text)
236
- const block = expectedBlock(config, legacy).split('\n')
205
+ const block = expectedBlock(config).split('\n')
237
206
  let out: string[]
238
207
  if (f == null) out = block
239
208
  else if (f.b !== -1 && f.e !== -1 && f.e >= f.b)
@@ -279,19 +248,12 @@ export const gitignorePolicy = check({
279
248
  c.fail(`${tracked.join(', ')} generated on every run but TRACKED — gitignore does not apply to a tracked file, so it dirties every tree`)
280
249
  c.lines.push({ kind: 'fix-fail', text: 'shipkit ci (or check --fix SK004) untracks it in one commit, the file stays on disk' })
281
250
  }
282
- // the old root layout is a move a machine makes, so it is red until made
283
- const left = legacyLayoutLeft(c.root)
284
- if (left.length > 0) {
285
- c.fail(`old layout: ${left.join(' ')} still at the repo root, shipkit keeps them under ${SHIPKIT_DIR}/`)
286
- c.lines.push({ kind: 'fix-fail', text: 'shipkit ci (or check --fix SK004) moves them and lands one commit' })
287
- }
288
- const legacy = hasLegacy(c.root)
289
- let s = blockState(c, c.config, legacy)
251
+ let s = blockState(c, c.config)
290
252
  // a stale block means shipkit's policy moved, not that this repo broke:
291
253
  // every run that may write renders it in place, so a policy change never
292
254
  // turns the whole fleet red until each repo runs its gate
293
255
  if (s === 'stale') {
294
- const removed = removedLines(c.read('.gitignore'), c.config, legacy)
256
+ const removed = removedLines(c.read('.gitignore'), c.config)
295
257
  if (removed.length > 0) {
296
258
  c.warn(`.gitignore policy block is stale, and its rewrite removes ${removed.join(', ')}: left for the repair, which names each line`)
297
259
  c.lines.push({ kind: 'fix-warn', text: `${REMOVED_FIX}; sk ci (or check --fix SK004) rewrites it` })
@@ -303,9 +265,9 @@ export const gitignorePolicy = check({
303
265
  return
304
266
  }
305
267
  const before = gitignoreBaseline(c.root, c.git)
306
- writeBlock(c, c.config, legacy)
268
+ writeBlock(c, c.config)
307
269
  c.note(`.gitignore policy block rewritten in place: the policy or repo-contributed lines moved${landedWords(commitPolicyBlock(c.root, before, [], c.git))}`)
308
- s = blockState(c, c.config, legacy)
270
+ s = blockState(c, c.config)
309
271
  }
310
272
  switch (s) {
311
273
  case 'missing-file': return c.fail('.gitignore missing — the contract git policy is unenforced')
@@ -330,8 +292,8 @@ export const gitignorePolicy = check({
330
292
  // a claim all the same, and the opposite one: a repo line BELOW the
331
293
  // block re-ignoring the parent leaves the re-inclusion dead while the
332
294
  // block text stays current, which is the same silent contradiction
333
- const patterns = policyPatterns(c.config, legacy)
334
- const claimed = patterns.filter((p) => !OVERRIDABLE.has(p) && !p.startsWith('!'))
295
+ const patterns = policyPatterns(c.config)
296
+ const claimed = patterns.filter((p) => !p.startsWith('!'))
335
297
  const probes = new Map(claimed.map((p) => [probePath(p), p]))
336
298
  const backProbes = new Map(patterns.filter((p) => p.startsWith('!')).map((p) => [probePath(p.slice(1)), p]))
337
299
  const miss = await notIgnored(c, [...probes.keys(), ...backProbes.keys()])
@@ -366,14 +328,7 @@ export const gitignorePolicy = check({
366
328
  }
367
329
  },
368
330
  repair: async (c): Promise<FixResult> => {
369
- // the move first: it writes the new block itself, before any folder moves
370
- const moved = process.env.SHIPKIT_FROZEN === '1' ? null : migrateLayout(c.root, { config: c.config, renderGitignore: (t, legacy, cfg) => renderPolicy(t, cfg ?? c.config, legacy) })
371
- const layout = moved == null ? null
372
- : moved.deferred != null ? `layout move deferred: ${moved.deferred}`
373
- : layoutSummary(moved) === '' ? null
374
- : `layout: ${layoutSummary(moved)}${moved.commit != null ? ` (committed as ${moved.commit})` : moved.uncommitted === true ? ', the commit did not land' : ''}`
375
- const legacy = hasLegacy(c.root)
376
- const before = blockState(c, c.config, legacy)
331
+ const before = blockState(c, c.config)
377
332
  const held = gitignoreBaseline(c.root, c.git)
378
333
  // terminate an unterminated file even when the block itself is current:
379
334
  // that missing byte is what the next append fuses onto
@@ -382,7 +337,7 @@ export const gitignorePolicy = check({
382
337
  c.write('.gitignore', `${c.read('.gitignore') ?? ''}\n`)
383
338
  terminated = '.gitignore terminated with a newline (the next append would have fused onto its last line)'
384
339
  }
385
- const removed = before === 'stale' ? removedLines(c.read('.gitignore'), c.config, legacy) : []
340
+ const removed = before === 'stale' ? removedLines(c.read('.gitignore'), c.config) : []
386
341
  const blockSummary = before === 'current'
387
342
  ? null
388
343
  : before === 'missing-file' ? '.gitignore created with the policy block'
@@ -390,18 +345,18 @@ export const gitignorePolicy = check({
390
345
  : before === 'corrupted' ? 'policy block rebuilt (stray markers dropped, repo lines kept visible)'
391
346
  : removed.length > 0 ? `policy block rewritten in place, removed from it: ${removed.join(', ')} (${REMOVED_FIX})`
392
347
  : 'policy block rewritten in place (repo lines outside it untouched)'
393
- if (blockSummary != null) writeBlock(c, c.config, legacy)
348
+ if (blockSummary != null) writeBlock(c, c.config)
394
349
  const landed = blockSummary != null || terminated != null ? landedWords(commitPolicyBlock(c.root, held, removed, c.git)) : ''
395
350
  // the block must be written FIRST: untracking a path the ignore list
396
351
  // does not yet carry leaves it staged for re-add on the next `git add`.
397
352
  // The untrack is a git COMMIT through the hooks, so it stays in the
398
353
  // module that owns that migration (rules/untrack-generated.ts)
399
354
  const un = untrackGenerated(c.root, { enabled: c.config.untrackGenerated }, c.git)
400
- const parts = [layout, blockSummary, terminated, landed === '' ? null : landed.replace(/^[,;] /, '')]
355
+ const parts = [blockSummary, terminated, landed === '' ? null : landed.replace(/^[,;] /, '')]
401
356
  if (un.did === 'untracked') parts.push(`untracked ${un.paths.join(', ')} (generated, now gitignored, committed as ${un.commit})`)
402
357
  if (un.did === 'refused') parts.push(`left ${(await trackedGenerated(c)).join(', ')} tracked: ${un.why}`)
403
358
  const summary = parts.filter((x): x is string => x != null).join(' · ')
404
- return { changed: layout != null || blockSummary != null || terminated != null || un.did === 'untracked', summary: summary === '' ? 'policy block already current' : summary }
359
+ return { changed: blockSummary != null || terminated != null || un.did === 'untracked', summary: summary === '' ? 'policy block already current' : summary }
405
360
  },
406
361
  })
407
362
 
@@ -14,11 +14,10 @@
14
14
  // scaffold, so a policy written there would bind exactly one checkout.
15
15
  import { isAbsolute, join } from 'path'
16
16
  import { inferBin } from '../core/canonical-scripts.ts'
17
- import { denyRules, GIT_STASH_RULES, LEGACY_PREFIX_RULES, LEGACY_SCOPED_RULES, LEGACY_STASH_RULE, RAW_RUNNERS, slotRows } from '../core/one-way-in-policy.ts'
17
+ import { denyRules, GIT_STASH_RULES, LEGACY_PREFIX_RULES, LEGACY_SCOPED_RULES, RAW_RUNNERS, slotRows } from '../core/one-way-in-policy.ts'
18
18
  import { rootPublishesNpm } from '../core/repo-facts.ts'
19
19
  import { EDIT_MATCHER, hasEditGuard } from '../hooks/edit-guard.ts'
20
20
  import type { RepoConfig } from '../repo-config.ts'
21
- import { repoOff } from '../core/when.ts'
22
21
  import { check, type CheckCtx, type FixResult } from '../check.ts'
23
22
 
24
23
  const OWNER = 'tools/shipkit/one-way-in.md'
@@ -33,7 +32,7 @@ type Settings = {
33
32
  * either: ONE declaration governs the script name and the raw call together */
34
33
  export function exemptSlots(c: RepoConfig): Set<string> {
35
34
  const off = new Set(c.oneWayIn?.exempt ?? [])
36
- for (const id of [...Object.keys(c.defaults ?? {}), ...Object.keys(c.off ?? {}), ...Object.keys(c.when ?? {})]) if (repoOff(c, id) != null) off.add(id)
35
+ for (const id of Object.keys(c.off ?? {})) off.add(id)
37
36
  return off
38
37
  }
39
38
 
@@ -148,8 +147,6 @@ export const oneWayInPolicy = check({
148
147
  const stashMissing = GIT_STASH_RULES.filter((r) => !have.has(r))
149
148
  if (stashMissing.length > 0)
150
149
  c.fail(`${SETTINGS_PATH}: ${stashMissing.length} stash deny row(s) missing (${stashMissing.slice(0, 2).join(', ')}${stashMissing.length > 2 ? ', …' : ''}), so an agent can stash every other agent's uncommitted work in a shared tree`)
151
- if (have.has(LEGACY_STASH_RULE))
152
- c.fail(`${SETTINGS_PATH}: the blanket "${LEGACY_STASH_RULE}" row also refuses the read only \`git stash list\` and \`git stash show\``)
153
150
  const scopedStale = LEGACY_SCOPED_RULES.filter((r) => have.has(r))
154
151
  if (scopedStale.length > 0)
155
152
  c.fail(`${SETTINGS_PATH}: ${scopedStale.map((r) => `"${r}"`).join(', ')} also refuses a run of one test file or folder, which is the iteration loop`)
@@ -206,8 +203,7 @@ export const oneWayInPolicy = check({
206
203
  const s: Settings = existing ?? {}
207
204
  const changes: string[] = []
208
205
  const old = s.permissions?.deny ?? []
209
- const deny = old.filter((r) => r !== LEGACY_STASH_RULE && !LEGACY_SCOPED_RULES.includes(r) && !LEGACY_PREFIX_RULES.includes(r) && !exempt.has(r))
210
- if (old.includes(LEGACY_STASH_RULE)) changes.push(`the blanket ${LEGACY_STASH_RULE} row replaced by one row per stash write`)
206
+ const deny = old.filter((r) => !LEGACY_SCOPED_RULES.includes(r) && !LEGACY_PREFIX_RULES.includes(r) && !exempt.has(r))
211
207
  const scopedStale = old.filter((r) => LEGACY_SCOPED_RULES.includes(r) && !exempt.has(r))
212
208
  if (scopedStale.length > 0) changes.push(`${scopedStale.join(', ')} replaced by the bare row: a run of one file or folder passes`)
213
209
  const prefixStale = old.filter((r) => LEGACY_PREFIX_RULES.includes(r) && !exempt.has(r))
@@ -13,7 +13,7 @@ import type { CheckCtx } from '../core/check-ctx.ts'
13
13
  import { checkFloorReader, resolveFloor } from '../core/floor-resolve.ts'
14
14
  import { rootPublishesNpm } from '../core/repo-facts.ts'
15
15
  import { repoOff } from '../core/when.ts'
16
- import { indentAt, parseSpans, plain, removalSpans, type Node } from '../scaffold/jsonc-spans.ts'
16
+ import { indentAt, parseSpans, plain, removalSpans, type Node } from '../core/jsonc-spans.ts'
17
17
 
18
18
  export const TSC_LABEL = '👁 TSC'
19
19
  const TASKS = '.vscode/tasks.json'
@@ -160,13 +160,13 @@ export function repairTasks(text: string, o: RepairOpts): { text: string; change
160
160
  return { text: out, changes, kept, empty: onlyTasks && tasks.items.length > 0 && remove.size === tasks.items.length }
161
161
  }
162
162
 
163
- /** whether this repo's gate runs a typecheck: a floor slot or a task that
164
- * resolves, and no `off` entry turning it off */
163
+ /** whether this repo's gate runs a typecheck: a floor slot that resolves, and
164
+ * no `off` entry turning it off */
165
165
  export function typecheckOn(c: CheckCtx): boolean {
166
166
  const config = c.config
167
167
  let floor: ReturnType<typeof resolveFloor>
168
168
  try { floor = resolveFloor(config, c.root, checkFloorReader(c)) } catch { return false }
169
- const t = [...floor.tasks, ...(config.tasks ?? [])].find((x) => x.id === 'typecheck')
169
+ const t = floor.tasks.find((x) => x.id === 'typecheck')
170
170
  return t != null && repoOff(config, t.id) == null
171
171
  }
172
172
 
@@ -12,7 +12,7 @@
12
12
  // here), so each keeps its own key, row and `off` switch.
13
13
  import { dirname, posix, relative } from 'path'
14
14
  import { check } from '../check.ts'
15
- import { repoCheckSources } from '../core/legacy-shapes.ts'
15
+ import { repoCheckUnits } from '../core/check-file-names.ts'
16
16
  import { argvRunsTests, commandRunsTests, sourceRunsTests, type ScriptReader } from '../suite/runner-shapes.ts'
17
17
  import type { CheckCtx } from '../core/check-ctx.ts'
18
18
  import { repoOff } from '../core/when.ts'
@@ -43,26 +43,15 @@ export const testsRunInUnits = check({
43
43
  fix: 'none',
44
44
  applies: 'always',
45
45
  run: (c) => {
46
- // the toolkit's own checks (this file's dir) live inside the repo that
47
- // hosts it, and a built-in that WRITES a test script (SK001) is not a
48
- // runner. Read off import.meta, since importing discovery pulls in fs
49
- const builtins = relative(c.root, import.meta.dir).replace(/\\/g, '/')
50
- const files = repoCheckSources(c).filter((f) => !f.rel.startsWith(`${builtins}/`))
46
+ const files = repoCheckUnits(c)
51
47
  let hits = 0
52
48
  const say = (where: string, how: string): void => { hits++; c.fail(`${where} runs ${how} itself`, FIX) }
53
49
  const root = scriptsIn(c, '')
54
50
  const cwdOf = (cwd: string | undefined): string => (cwd == null ? '' : relative(c.root, posix.resolve(c.root, cwd)))
55
51
  for (const f of files) for (const how of sourceRunsTests(f.src ?? '', scriptsIn(c, dirname(f.rel)))) say(f.rel, how)
56
- for (const t of c.config.tasks ?? []) {
57
- const scripts = scriptsIn(c, cwdOf(t.cwd))
58
- const how = t.cmd != null ? argvRunsTests(t.cmd, scripts) : null
59
- if (how != null) say(`repo.config.ts tasks '${t.id}'`, how)
60
- else if (t.logic != null) for (const h of sourceRunsTests(String(t.logic), scripts)) say(`repo.config.ts tasks '${t.id}'`, h)
61
- }
62
- for (const r of c.config.rules ?? []) for (const h of sourceRunsTests(String(r.lint), root)) say(`repo.config.ts rules '${r.id}'`, h)
63
52
  const defaults = c.config.defaults ?? {}
64
53
  for (const [id, d] of Object.entries(defaults)) {
65
- if (id === 'test' || d === false || d.cmd == null) continue
54
+ if (id === 'test' || d.cmd == null) continue
66
55
  const how = argvRunsTests(d.cmd, scriptsIn(c, cwdOf(d.cwd)))
67
56
  if (how != null) say(`repo.config.ts defaults '${id}'`, how)
68
57
  }
@@ -4,12 +4,10 @@
4
4
  // `import.meta.main` guard: a second way to write a body, with none of what
5
5
  // `c` gives (recorded reads, one pass, one runner).
6
6
  //
7
- // It reads each check file's SOURCE through `c`, never imports it, so it is
8
- // cached on the listing and the sources. A legacy check SCRIPT (no check
9
- // object) is SK016's, read through its window, and never counted here.
7
+ // It reads each check unit file's SOURCE through `c`, never imports it, so it
8
+ // is cached on the listing and the sources.
10
9
  import { check } from '../check.ts'
11
- import { isLegacyCheckSource } from '../core/check-file-names.ts'
12
- import { repoCheckSources } from '../core/legacy-shapes.ts'
10
+ import { repoCheckUnits } from '../core/check-file-names.ts'
13
11
 
14
12
  const OWNER = 'tools/shipkit/writing-a-check.md'
15
13
 
@@ -137,8 +135,8 @@ export const selfSpawningCheck = check({
137
135
  fix: 'none',
138
136
  applies: 'always',
139
137
  run: (c) => {
140
- const found = repoCheckSources(c).flatMap((f) => {
141
- if (f.src == null || isLegacyCheckSource(f.src)) return []
138
+ const found = repoCheckUnits(c).flatMap((f) => {
139
+ if (f.src == null) return []
142
140
  const why = selfSpawn(f.rel, f.src)
143
141
  return why == null ? [] : [`${f.rel}: ${why}`]
144
142
  })
@@ -1,6 +1,6 @@
1
1
  // SK035 public clean (tools/shipkit/units.md, What a unit publishes): what each npm unit would pack names no house
2
2
  // repo, no identity, no machine of the owner, no keyword row, and ships no browser extension. Keyed on the work tree and on what no tracked
3
- // file carries (release/public-clean.ts publicCleanKey): each unit's tree on disk, gitignored files included, the
3
+ // file carries (release/public-clean.ts publicCleanKey): what npm can pack of each unit on disk, gitignored files included, the
4
4
  // house repos, the identity, keyword and allow files. A release scans fresh
5
5
  import { check, type CheckEnv } from '../check.ts'
6
6
  import { PUBLIC_CLEAN_ID, publicClean, publicCleanKey } from '../release/public-clean.ts'
@@ -7,7 +7,7 @@
7
7
  import { check } from '../check.ts'
8
8
  import type { CheckCtx } from '../core/check-ctx.ts'
9
9
  import { rootPublishesNpm } from '../core/repo-facts.ts'
10
- import { indentAt, insertPoint, parseSpans, splice, type Node } from '../scaffold/jsonc-spans.ts'
10
+ import { indentAt, insertPoint, parseSpans, splice, type Node } from '../core/jsonc-spans.ts'
11
11
 
12
12
  const SETTINGS = '.vscode/settings.json'
13
13
  const KEY = 'files.watcherExclude'
@@ -1,7 +1,7 @@
1
1
  // SK042 post kinds (tools/shipkit/built-in-checks-contracts-and-visibility.md): every post group of the repo (its events
2
2
  // in the thread store) names what it is for, a kind of the closed set or of the social unit's own `kinds` (wiki
3
- // guides/post-kinds/index.md), through the load's one check, kinds.ts kindProblem. A word of the old words table only
4
- // warns: each repo moves its own groups. Keyed on the repo's newest group write, the unit file's text and whether each
3
+ // guides/post-kinds/index.md), through the load's one check, kinds.ts kindProblem. Keyed on the repo's newest group
4
+ // write, the unit file's text and whether each
5
5
  // page its text names is a file: kinds a module the unit imports declares keep a stale green until one of those moves
6
6
  import { existsSync, readFileSync } from 'node:fs'
7
7
  import { join } from 'node:path'
@@ -26,7 +26,6 @@ export function unitKey(root: string, file: string): string {
26
26
  }
27
27
 
28
28
  const FIX ='set the kind to one of wiki guides/post-kinds/index.md (a custom one with its kindWhy) with sk social draft save, or declare the project kind in its social unit, then sk ci --only SK042'
29
- const FIX_OLD = "move each draft to the kind its intent reads as (wiki guides/post-kinds/old-words.md): the repo's own step, never a blind replace"
30
29
 
31
30
  export const postKinds = check({
32
31
  id: 'SK042',
@@ -52,23 +51,15 @@ export const postKinds = check({
52
51
  const own = unit?.kinds ?? []
53
52
  for (const k of own) if (!existsSync(join(c.root, k.page))) c.fail(ownPageMissing(k), `write its rules page, in the shape of a page of wiki guides/post-kinds/`)
54
53
  let bad = 0
55
- let old = 0
56
54
  for (const g of groups) {
57
- const rel = `draft:${g.group.slug}`
58
55
  const { kind, why } = kindOfMeta(g.group.meta)
59
56
  const p = kindProblem(kind, why, own)
60
57
  if (p == null) continue
61
- if (p.old) {
62
- old++
63
- c.lines.push({ kind: 'warn', text: `${rel}: ${p.text}` })
64
- } else {
65
- bad++
66
- c.lines.push({ kind: 'fail', text: `${rel}: ${p.text}` })
67
- }
58
+ bad++
59
+ c.lines.push({ kind: 'fail', text: `draft:${g.group.slug}: ${p}` })
68
60
  }
69
61
  if (bad > 0) c.fail(`${bad} draft${bad === 1 ? '' : 's'} with no kind of the set`, FIX)
70
- if (old > 0) c.warn(`${old} draft${old === 1 ? '' : 's'} on an old kind word`, FIX_OLD)
71
- if (bad === 0 && old === 0 && !c.failed) c.ok(`${groups.length} draft${groups.length === 1 ? '' : 's'}, each names its kind`)
62
+ if (bad === 0 && !c.failed) c.ok(`${groups.length} draft${groups.length === 1 ? '' : 's'}, each names its kind`)
72
63
  },
73
64
  })
74
65
 
@@ -3,13 +3,13 @@
3
3
  // reads, reports to the owner, ends a share, or is the gate. The rows go into the tracked .claude/settings.json, or
4
4
  // into this machine's .claude/settings.local.json for a foreign repo (its tracked file is the team's) and for a root
5
5
  // that publishes to npm (its tracked file binds strangers), as SK003 and SK049 put their house lines there.
6
- // The repair owns `permissions.allow` alone: it appends the missing rows in the file's own layout, takes out a row of
7
- // RETIRED_ALLOW (one it wrote itself, found too wide) and leaves every other byte, so a row a human added, its order,
8
- // the deny list and the hooks stay. A row that lets a publish, a share, a secret or a delete through is reported,
6
+ // The repair owns `permissions.allow` alone, through core/allow-rows.ts: it appends the missing rows in the file's own
7
+ // layout, takes out a row of RETIRED_ALLOW (one it wrote itself, found too wide) and leaves every other byte, so a row
8
+ // a human added, its order, the deny list and the hooks stay. A row that lets a publish, a share, a secret or a delete through is reported,
9
9
  // never removed: it may be his
10
- import { AGENT_ALLOW, outRowsIn, RETIRED_ALLOW } from '../core/agent-allow-policy.ts'
10
+ import { AGENT_ALLOW, outRowsIn } from '../core/agent-allow-policy.ts'
11
+ import { agentAllowRowsOf } from '../core/allow-rows.ts'
11
12
  import { rootPublishesNpm } from '../core/repo-facts.ts'
12
- import { appendEdits, indentAt, insertPoint, parseSpans, removalSpans, splice, type Node } from '../scaffold/jsonc-spans.ts'
13
13
  import { check, type CheckCtx, type FixResult } from '../check.ts'
14
14
 
15
15
  const OWNER = 'tools/shipkit/built-in-checks-repo-wiring.md'
@@ -17,75 +17,6 @@ const TRACKED = '.claude/settings.json'
17
17
  const LOCAL = '.claude/settings.local.json'
18
18
  const BARE = 'run these commands bare: a pipe, `;`, `&&` or a leading `VAR=value` makes Claude Code judge each part on its own'
19
19
 
20
- type Obj = Extract<Node, { kind: 'object' }>
21
-
22
- /** the allow array of a settings tree, null when it has none; 'broken' when a key holds another kind */
23
- function allowArray(root: Node): Extract<Node, { kind: 'array' }> | null | 'broken' {
24
- if (root.kind !== 'object') return 'broken'
25
- const perms = root.props.find((p) => p.key === 'permissions')
26
- if (perms == null) return null
27
- if (perms.value.kind !== 'object') return 'broken'
28
- const allow = perms.value.props.find((p) => p.key === 'allow')
29
- if (allow == null) return null
30
- return allow.value.kind === 'array' ? allow.value : 'broken'
31
- }
32
-
33
- /** the rows of AGENT_ALLOW the settings text lacks, the retired rows it still holds, and the text with the retired
34
- * ones taken out and the missing ones appended to `permissions.allow` in the file's own layout, every other byte
35
- * kept; a file that is no object, or whose permissions or allow is of another kind, is 'broken' */
36
- export function agentAllowRowsOf(
37
- text: string | null,
38
- rows: readonly string[] = AGENT_ALLOW.map((x) => x.row),
39
- retired: readonly string[] = RETIRED_ALLOW,
40
- ): { missing: string[]; stale: string[]; text: string } | 'broken' {
41
- let out = text
42
- let stale: string[] = []
43
- if (text != null && text.trim() !== '') {
44
- let root: Node
45
- try { root = parseSpans(text) } catch { return 'broken' }
46
- const arr = allowArray(root)
47
- if (arr === 'broken') return 'broken'
48
- const gone = arr == null ? [] : arr.items.flatMap((n, i) => (n.kind === 'scalar' && retired.includes(n.value as string) ? [i] : []))
49
- if (arr != null && gone.length > 0) {
50
- stale = gone.map((i) => (arr.items[i] as { value: string }).value)
51
- out = removalSpans(text, arr, gone).sort((a, b) => b[0] - a[0]).reduce((t, [s, e]) => t.slice(0, s) + t.slice(e), text)
52
- }
53
- }
54
- const r = appendRows(out, rows)
55
- return r === 'broken' ? r : { ...r, stale }
56
- }
57
-
58
- function appendRows(text: string | null, rows: readonly string[]): { missing: string[]; text: string } | 'broken' {
59
- if (text == null || text.trim() === '') {
60
- const body = rows.map((x) => ` ${JSON.stringify(x)}`).join(',\n')
61
- return { missing: [...rows], text: `{\n "permissions": {\n "allow": [\n${body}\n ]\n }\n}\n` }
62
- }
63
- let root: Node
64
- try { root = parseSpans(text) } catch { return 'broken' }
65
- if (root.kind !== 'object') return 'broken'
66
- const perms = root.props.find((p) => p.key === 'permissions')
67
- if (perms != null && perms.value.kind !== 'object') return 'broken'
68
- const allow = perms == null ? undefined : (perms.value as Obj).props.find((p) => p.key === 'allow')
69
- if (allow != null && allow.value.kind !== 'array') return 'broken'
70
- const have = new Set(allow == null || allow.value.kind !== 'array' ? [] : allow.value.items.map((n) => (n.kind === 'scalar' ? n.value : null)))
71
- const missing = rows.filter((x) => !have.has(x))
72
- if (missing.length === 0) return { missing, text }
73
- const values = missing.map((x) => JSON.stringify(x))
74
- // the indent step the file uses, read from its first key: two spaces where it has none
75
- const unit = root.props[0] == null ? ' ' : indentAt(text, root.props[0].keyStart) || ' '
76
- if (allow != null && allow.value.kind === 'array') {
77
- return { missing, text: splice(text, appendEdits(text, allow.value, values, `${indentAt(text, allow.keyStart)}${unit}`)) }
78
- }
79
- const into = perms == null ? root : (perms.value as Obj)
80
- const outer = perms == null ? '' : indentAt(text, perms.keyStart)
81
- const p = insertPoint(text, into, `${outer}${unit}`)
82
- const list = (at: string): string => `[\n${values.map((v) => `${at}${unit}${v}`).join(',\n')}\n${at}]`
83
- const block = perms == null ? `"permissions": {\n${p.indent}${unit}"allow": ${list(`${p.indent}${unit}`)}\n${p.indent}}` : `"allow": ${list(p.indent)}`
84
- const close = into.props.length === 0 ? `\n${outer}` : ''
85
- const edits = [{ at: p.at, put: `\n${p.indent}${block}${close}` }, ...(p.comma != null ? [{ at: p.comma, put: ',' }] : [])]
86
- return { missing, text: splice(text, edits) }
87
- }
88
-
89
20
  /** the file the rows belong in: the tracked one, unless it is the team's or a package's contributors' */
90
21
  const targetOf = (c: CheckCtx): { file: string; local: boolean } =>
91
22
  c.config.foreign === true || rootPublishesNpm(c.config) ? { file: LOCAL, local: true } : { file: TRACKED, local: false }