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,137 +1,24 @@
1
1
  // Where the machine keeps its own state: ONE folder, `~/.shipkit/`, and every path of it comes from machinePath.
2
- // A machine that has not moved (sk home move) is still read in its old root. This half reads the disk, so it
3
- // lives apart from core/layout.ts, which cached checks import.
4
- import { lstatSync, readFileSync, realpathSync, statSync } from 'fs'
2
+ // `~/.config/shipkit` is a link to it, kept for the paths written before one root (the vault's among them): nothing
3
+ // here reads, writes or removes that link
5
4
  import { homedir } from 'os'
6
5
  import { join } from 'path'
7
6
  import { SHIPKIT_DIR } from './layout.ts'
8
7
 
9
- /** where the machine kept its home and its db before one root: `~/.config/shipkit/` */
10
- export const OLD_MACHINE_ROOT = join('.config', 'shipkit')
11
- /** the entries the old root holds: each one stays read there until the machine moves (sk home move) */
12
- export const OLD_ROOT_ENTRIES: readonly string[] = ['home', 'shipkit.sqlite', 'projects-order.txt']
8
+ /** where the machine kept its state before one root, a link to `~/.shipkit` since: a backup run of then names its
9
+ * files under it */
10
+ const OLD_MACHINE_ROOT = join('.config', 'shipkit')
13
11
 
14
- /** where the machine's state is now: `old`, every entry in `~/.config/shipkit`; `moved`, that folder is a link to
15
- * `~/.shipkit` or is gone; `split`, a move stopped between two entries; `both`, one entry in both places */
16
- export type MachineRootState = 'old' | 'moved' | 'split' | 'both'
12
+ /** THE path of one entry of the machine's state, `~/.shipkit/<entry>` */
13
+ export const machinePath = (entry: string, home: string = homedir()): string => join(home, SHIPKIT_DIR, entry)
17
14
 
18
- /** the move's record (home/home-move.ts writes it first and removes it last, under the new root, which both layouts
19
- * read): while it exists, each entry it names is where it says */
20
- export const MOVE_RECORD = 'home-move.json'
21
- export type MoveRecord = { v: 1; way?: 'go' | 'back'; from?: string; to?: string; mode?: number; at?: number; entries: string[]; moved?: string[]; done: boolean }
22
-
23
- export const moveRecordPath = (home: string = homedir()): string => join(home, SHIPKIT_DIR, MOVE_RECORD)
24
-
25
- export function readMoveRecord(home: string = homedir()): MoveRecord | null {
26
- try {
27
- return JSON.parse(readFileSync(moveRecordPath(home), 'utf8')) as MoveRecord
28
- } catch {
29
- return null
30
- }
31
- }
32
-
33
- /** the root a recorded entry is in now: a move that went keeps it new once moved or done, one that goes back keeps
34
- * it new until moved back */
35
- const recordedAt = (r: MoveRecord, entry: string): 'old' | 'new' => (r.way === 'back' ? ((r.moved ?? []).includes(entry) ? 'old' : 'new') : r.done || (r.moved ?? []).includes(entry) ? 'new' : 'old')
36
-
37
- type Place = { old: string; neu: string; oldIsDir: boolean; oldIsLink: boolean; linksHere: boolean }
38
-
39
- function placeOf(home: string): Place {
40
- const old = join(home, OLD_MACHINE_ROOT)
41
- const neu = join(home, SHIPKIT_DIR)
42
- const l = lstatSync(old, { throwIfNoEntry: false })
43
- const oldIsLink = l?.isSymbolicLink() === true
44
- let linksHere = false
45
- if (oldIsLink) {
46
- try { linksHere = realpathSync(old) === realpathSync(neu) } catch { linksHere = false }
47
- }
48
- // a link the owner made to a folder elsewhere is still the old place: only a link to the new one marks a move
49
- const oldIsDir = !linksHere && (l?.isDirectory() === true || (oldIsLink && statSync(old, { throwIfNoEntry: false })?.isDirectory() === true))
50
- return { old, neu, oldIsDir, oldIsLink, linksHere }
51
- }
52
-
53
- /** a path under a FILE answers ENOTDIR: absent, never a throw */
54
- const has = (p: string): boolean => {
55
- try {
56
- return lstatSync(p, { throwIfNoEntry: false }) != null
57
- } catch {
58
- return false
59
- }
60
- }
61
-
62
- /** where one entry of the old root is read: the old place while the old folder holds it, or holds the others and the
63
- * new one lacks it; the new place once the old folder is a link to it, is gone, or lacks the entry the new one has */
64
- function resolveEntry(entry: string, home: string): string {
65
- const r = readMoveRecord(home)
66
- if (r != null && r.entries.includes(entry)) return join(home, recordedAt(r, entry) === 'new' ? SHIPKIT_DIR : OLD_MACHINE_ROOT, entry)
67
- const p = placeOf(home)
68
- if (!p.oldIsDir) return join(p.neu, entry)
69
- if (has(join(p.old, entry))) return join(p.old, entry)
70
- if (has(join(p.neu, entry))) return join(p.neu, entry)
71
- return join(p.old, entry)
72
- }
73
-
74
- const resolved = new Map<string, string>()
75
-
76
- /** THE path of one entry of the machine's state, `~/.shipkit/<entry>`: an entry of the old root is resolved once a
77
- * process (a few lstats), every other one is a join */
78
- export function machinePath(entry: string, home: string = homedir()): string {
79
- if (!OLD_ROOT_ENTRIES.includes(entry)) return join(home, SHIPKIT_DIR, entry)
80
- const k = `${home}\0${entry}`
81
- let p = resolved.get(k)
82
- if (p == null) {
83
- p = resolveEntry(entry, home)
84
- resolved.set(k, p)
85
- }
86
- return p
87
- }
88
-
89
- /** the resolved paths forgotten: the move, and a test that builds a home of its own */
90
- export const forgetMachinePaths = (): void => resolved.clear()
91
-
92
- /** where the old root's entries are now, read fresh (no cache) */
93
- export function machineRootState(home: string = homedir()): { state: MachineRootState; old: string; neu: string; oldHolds: string[]; newHolds: string[]; link: boolean } {
94
- const p = placeOf(home)
95
- const oldHolds = p.oldIsDir ? OLD_ROOT_ENTRIES.filter((e) => has(join(p.old, e))) : []
96
- const newHolds = OLD_ROOT_ENTRIES.filter((e) => has(join(p.neu, e)))
97
- const state: MachineRootState = !p.oldIsDir ? 'moved' : oldHolds.some((e) => newHolds.includes(e)) ? 'both' : newHolds.length > 0 ? 'split' : 'old'
98
- return { state, old: p.old, neu: p.neu, oldHolds, newHolds, link: p.linksHere }
99
- }
100
-
101
- /** a path under the user home in its one-root form: one under `~/.config/shipkit/<entry>` of an old root entry is
102
- * named under `~/.shipkit/<entry>`, every other path is itself. Two forms of one file compare equal through it */
15
+ /** a path under the user home in its one root form: one under `~/.config/shipkit/` is named under `~/.shipkit/`, the
16
+ * folder that link names, every other path is itself. Two forms of one file compare equal through it */
103
17
  export function oneRootRel(rel: string): string {
104
- const old = `${OLD_MACHINE_ROOT}/`
105
- if (!rel.startsWith(old) && rel !== OLD_MACHINE_ROOT) return rel
106
- const rest = rel.slice(old.length)
107
- return OLD_ROOT_ENTRIES.includes(rest.split('/')[0] ?? '') ? `${SHIPKIT_DIR}/${rest}` : rel
18
+ if (rel === OLD_MACHINE_ROOT) return SHIPKIT_DIR
19
+ return rel.startsWith(`${OLD_MACHINE_ROOT}/`) ? `${SHIPKIT_DIR}/${rel.slice(OLD_MACHINE_ROOT.length + 1)}` : rel
108
20
  }
109
21
 
110
- /** where a file named by its path under the user home is now: one under either root of an old root entry is where
111
- * that entry is (machinePath), so a backup run of either shape lands on the machine's live state */
112
- export function livePath(home: string, rel: string): string {
113
- const one = oneRootRel(rel)
114
- const parts = one.split('/')
115
- if (parts[0] === SHIPKIT_DIR && parts.length > 1 && OLD_ROOT_ENTRIES.includes(parts[1]!)) return join(machinePath(parts[1]!, home), ...parts.slice(2))
116
- return join(home, rel)
117
- }
118
-
119
- /** why no store may be CREATED at `path` now, null when it may (or exists already, or lies outside both roots'
120
- * entries): a move of the machine's state runs (a process that resolved its paths before it would make a second,
121
- * empty home), or the other root holds the live entry this one lacks. Every store's open asks it first, before it
122
- * makes the folder: a few lstats and one read, on a create only */
123
- export function createRefusal(path: string, home: string = homedir()): string | null {
124
- if (has(path)) return null
125
- const old = join(home, OLD_MACHINE_ROOT)
126
- const neu = join(home, SHIPKIT_DIR)
127
- for (const [root, other] of [[old, neu], [neu, old]] as const) {
128
- if (!path.startsWith(`${root}/`)) continue
129
- const entry = path.slice(root.length + 1).split('/')[0]!
130
- if (!OLD_ROOT_ENTRIES.includes(entry)) return null
131
- const r = readMoveRecord(home)
132
- if (r != null && !r.done) return `a move of the machine's state runs (${moveRecordPath(home)}): no store is made under ${root} until it ends`
133
- if (!has(join(root, entry)) && has(join(other, entry))) return `the live ${entry} is in ${other}, not ${root}: no store is made beside it`
134
- return null
135
- }
136
- return null
137
- }
22
+ /** where a file named by its path under the user home is now: a backup run of either root's form lands on the
23
+ * machine's live state under `~/.shipkit` */
24
+ export const livePath = (home: string, rel: string): string => join(home, oneRootRel(rel))
@@ -0,0 +1,60 @@
1
+ // a TS source with its strings, comments, template text and regex literals blanked, so a scanner that matches code
2
+ // by text finds code only, at the same offsets as the original.
3
+
4
+ /** the source with every string, comment, template text and regex literal
5
+ * blanked to spaces, newlines kept, so offsets line up with the original */
6
+ export function maskSource(src: string): string {
7
+ const out = src.split('')
8
+ const blank = (from: number, to: number): void => { for (let k = from; k < to; k++) if (out[k] !== '\n') out[k] = ' ' }
9
+ let i = 0
10
+ // one entry per open template: the brace depth of its current `${`
11
+ const tpl: number[] = []
12
+ let last = ''
13
+ const regexOk = (): boolean => last === '' || '(,=:[!&|?{};+-*%<>~^'.includes(last)
14
+ const readTemplateText = (): void => {
15
+ // at a character inside template text: blank until `${` or the closing backtick
16
+ const start = i
17
+ while (i < src.length && src[i] !== '`' && !(src[i] === '$' && src[i + 1] === '{')) i += src[i] === '\\' ? 2 : 1
18
+ blank(start, i)
19
+ if (src[i] === '`') { i++; tpl.pop(); last = 'x' } else { i += 2; tpl[tpl.length - 1] = 0; last = '{' }
20
+ }
21
+ while (i < src.length) {
22
+ const ch = src[i]!
23
+ const next = src[i + 1]
24
+ if (ch === '/' && next === '/') { const s = i; while (i < src.length && src[i] !== '\n') i++; blank(s, i); continue }
25
+ if (ch === '/' && next === '*') { const s = i; const e = src.indexOf('*/', i + 2); i = e < 0 ? src.length : e + 2; blank(s, i); continue }
26
+ if (ch === "'" || ch === '"') {
27
+ const s = i
28
+ i++
29
+ while (i < src.length && src[i] !== ch && src[i] !== '\n') i += src[i] === '\\' ? 2 : 1
30
+ i++
31
+ blank(s + 1, i - 1)
32
+ last = 'x'
33
+ continue
34
+ }
35
+ if (ch === '`') { tpl.push(-1); i++; readTemplateText(); continue }
36
+ if (tpl.length > 0 && tpl[tpl.length - 1]! >= 0) {
37
+ if (ch === '{') tpl[tpl.length - 1]!++
38
+ if (ch === '}') {
39
+ if (tpl[tpl.length - 1] === 0) { tpl[tpl.length - 1] = -1; i++; readTemplateText(); continue }
40
+ tpl[tpl.length - 1]!--
41
+ }
42
+ }
43
+ if (ch === '/' && regexOk()) {
44
+ const s = i
45
+ let j = i + 1
46
+ let inClass = false
47
+ while (j < src.length && src[j] !== '\n') {
48
+ if (src[j] === '\\') { j += 2; continue }
49
+ if (src[j] === '[') inClass = true
50
+ else if (src[j] === ']') inClass = false
51
+ else if (src[j] === '/' && !inClass) break
52
+ j++
53
+ }
54
+ if (src[j] === '/') { j++; while (/[a-z]/.test(src[j] ?? '')) j++; blank(s + 1, j - 1); i = j; last = 'x'; continue }
55
+ }
56
+ if (!/\s/.test(ch)) last = ch
57
+ i++
58
+ }
59
+ return out.join('')
60
+ }
@@ -3,8 +3,10 @@
3
3
  // the log past its cap (capLog), so the disk never fills from it. A restart in place starts it again from zero.
4
4
  // Beside it, the budget: a look every 30 s, a WARN at most every 10 minutes while the footprint (core/footprint.ts; the
5
5
  // resident size where none is read) is over it, and the last pass kept in the machine db row MEMORY_OVER, which the
6
- // house check daemon-memory turns red for an hour
7
- import { footprint } from './footprint.ts'
6
+ // house check daemon-memory turns red for an hour. The footprint counts every thread, the read thread too; the heap is
7
+ // the loop's thread alone. The resident size ps shows counts the pages bun's allocator freed and keeps mapped, which the
8
+ // footprint does not (4.7 GB resident for a footprint of 822 MB)
9
+ import { footprintAndPeak } from './footprint.ts'
8
10
  import { machineSet } from './machine-db.ts'
9
11
  import { bytesWords } from './words.ts'
10
12
 
@@ -19,8 +21,11 @@ export const BUDGET_EVERY_MS = 30_000
19
21
  /** the machine db row of the daemon's last pass over its budget */
20
22
  export const MEMORY_OVER = 'daemon-memory-over'
21
23
 
22
- /** `footprint` absent where the system gives none: the budget then reads the resident size */
23
- export type Memory = { rss: number; heap: number; footprint?: number }
24
+ /** `footprint` and `peak` (the highest footprint since the start) absent where the system gives none: the budget then
25
+ * reads the resident size */
26
+ export type Memory = { rss: number; heap: number; footprint?: number; peak?: number }
27
+ const held = (m: Memory): number => m.footprint ?? m.rss
28
+ const heldWords = (m: Memory): string => (m.footprint == null ? `${bytesWords(m.rss)} resident` : `${bytesWords(m.footprint)} footprint${m.peak == null ? '' : ` (peak ${bytesWords(m.peak)})`}`)
24
29
  /** a pass over the budget, as the row keeps it: `held` is what the budget measured */
25
30
  export type MemoryOver = { at: number; held: number; rss: number; heap: number; budget: number; boot: boolean; pid: number }
26
31
 
@@ -36,8 +41,8 @@ export class MemoryWatch {
36
41
  constructor(
37
42
  private read: () => Memory = () => {
38
43
  const m = process.memoryUsage()
39
- const f = footprint()
40
- return { rss: m.rss, heap: m.heapUsed, ...(f == null ? {} : { footprint: f }) }
44
+ const f = footprintAndPeak()
45
+ return { rss: m.rss, heap: m.heapUsed, ...(f == null ? {} : { footprint: f.now, peak: f.peak }) }
41
46
  },
42
47
  private now: () => number = Date.now,
43
48
  private record: (over: MemoryOver) => void = (over) => void machineSet(MEMORY_OVER, over),
@@ -46,13 +51,13 @@ export class MemoryWatch {
46
51
  this.started = now()
47
52
  }
48
53
 
49
- /** one look: the line when the resident size moved by MEMORY_STEP since the last line (or the start), else null */
54
+ /** one look: the line when the footprint moved by MEMORY_STEP since the last line (or the start), else null */
50
55
  look(): string | null {
51
56
  const m = this.read()
52
57
  const base = this.said ?? this.from
53
- if (Math.abs(m.rss - base.rss) < base.rss * MEMORY_STEP) return null
58
+ if (Math.abs(held(m) - held(base)) < held(base) * MEMORY_STEP) return null
54
59
  this.said = m
55
- return `memory: ${bytesWords(m.rss)} resident, ${bytesWords(m.heap)} heap (${m.rss >= base.rss ? 'up' : 'down'} from ${bytesWords(base.rss)}, ${bytesWords(this.from.rss)} at start)`
60
+ return `memory: ${heldWords(m)}, ${bytesWords(m.heap)} main heap (${held(m) >= held(base) ? 'up' : 'down'} from ${bytesWords(held(base))}, ${bytesWords(held(this.from))} at start)`
56
61
  }
57
62
 
58
63
  /** one look at the budget: each pass over it is recorded; the line, at most once per MEMORY_EVERY_MS, else null */
@@ -61,13 +66,11 @@ export class MemoryWatch {
61
66
  const t = this.now()
62
67
  const since = t - this.started
63
68
  const budget = budgetAt(since)
64
- const held = m.footprint ?? m.rss
65
- if (held <= budget) return null
66
- this.record({ at: t, held, rss: m.rss, heap: m.heap, budget, boot: since < BOOT_MS, pid: process.pid })
69
+ if (held(m) <= budget) return null
70
+ this.record({ at: t, held: held(m), rss: m.rss, heap: m.heap, budget, boot: since < BOOT_MS, pid: process.pid })
67
71
  if (t - this.warnedAt < MEMORY_EVERY_MS) return null
68
72
  this.warnedAt = t
69
- const what = m.footprint == null ? `${bytesWords(held)} resident` : `${bytesWords(held)} (its footprint; ${bytesWords(m.rss)} resident)`
70
- return `the daemon holds ${what}, ${bytesWords(m.heap)} heap, over its budget of ${bytesWords(budget)}${since < BOOT_MS ? ' while it boots' : ''}`
73
+ return `the daemon holds ${heldWords(m)}, ${bytesWords(m.heap)} main heap, over its budget of ${bytesWords(budget)}${since < BOOT_MS ? ' while it boots' : ''}`
71
74
  }
72
75
 
73
76
  /** looks on a timer and says each move and each pass over the budget; returns its stop */
@@ -32,12 +32,9 @@ import { LIB_VERSION } from './lib-version.ts'
32
32
  import { machineName } from '../home/machine-host.ts'
33
33
  import { dayStamp } from './day-stamp.ts'
34
34
 
35
- /** the block before the per Mac markers */
36
- const LEGACY_BEGIN = '<!-- >>> shipkit local-projects — machine-written, edit outside the markers -->'
37
- const LEGACY_END = '<!-- <<< shipkit local-projects -->'
38
35
  export const blockBegin = (machine: string): string => `<!-- >>> shipkit local-projects on ${machine} — machine-written, edit outside the markers -->`
39
36
  export const blockEnd = (machine: string): string => `<!-- <<< shipkit local-projects on ${machine} -->`
40
- const ANY_END = /^<!-- <<< shipkit local-projects( on .+)? -->$/
37
+ const ANY_END = /^<!-- <<< shipkit local-projects on .+ -->$/
41
38
  const STALE_DAYS = 7
42
39
  /** the longest the page waits for a changed row: one commit a day at most */
43
40
  export const LAND_GAP_MS = 24 * 60 * 60 * 1000
@@ -121,36 +118,13 @@ function blockAt(lines: string[], begin: string, end: string): [number, number]
121
118
 
122
119
  const rowsIn = (lines: string[], [b, e]: [number, number]): Row[] => lines.slice(b + 1, e).map(parseRow).filter((row): row is Row => row != null)
123
120
 
124
- /** the page once this Mac's filed rows land in its own block; null when its markers are missing or out of order.
125
- * The legacy block keeps the rows of another Mac and goes once it holds none */
126
- export function landPage(text: string, filed: Row[], machine: string, home: string): string | null {
127
- let lines = text.split('\n')
128
- const legacy = blockAt(lines, LEGACY_BEGIN, LEGACY_END)
129
- if (legacy === 'broken') return null
130
- let carried: Row[] = []
131
- if (legacy != null) {
132
- const [b, e] = legacy
133
- const rows = rowsIn(lines, legacy)
134
- // this Mac's: under its home, or a repo it filed (a checkout on another volume)
135
- const filedHere = new Set(filed.map((f) => f.root))
136
- const mine = (r: Row): boolean => r.root === home || r.root.startsWith(`${home}/`) || filedHere.has(r.root)
137
- const kept = rows.filter((r) => !mine(r))
138
- if (kept.length > 0) {
139
- carried = rows.filter(mine)
140
- lines = [...lines.slice(0, b + 1), ...kept.map(rowLine), ...lines.slice(e)]
141
- } else if (blockAt(lines, blockBegin(machine), blockEnd(machine)) == null) {
142
- // every row is this Mac's: the block becomes its own, in place
143
- lines = [...lines.slice(0, b), blockBegin(machine), ...lines.slice(b + 1, e), blockEnd(machine), ...lines.slice(e + 1)]
144
- } else {
145
- carried = rows
146
- lines = [...lines.slice(0, b), ...lines.slice(e + 1)]
147
- if (lines[b - 1] === '' && lines[b] === '') lines.splice(b, 1)
148
- }
149
- }
121
+ /** the page once this Mac's filed rows land in its own block; null when its markers are missing or out of order */
122
+ export function landPage(text: string, filed: Row[], machine: string): string | null {
123
+ const lines = text.split('\n')
150
124
  const own = blockAt(lines, blockBegin(machine), blockEnd(machine))
151
125
  if (own === 'broken') return null
152
126
  if (own != null) {
153
- const block = mergeRows([...rowsIn(lines, own), ...carried], filed).map(rowLine)
127
+ const block = mergeRows(rowsIn(lines, own), filed).map(rowLine)
154
128
  return [...lines.slice(0, own[0] + 1), ...block, ...lines.slice(own[1])].join('\n')
155
129
  }
156
130
  // no block of this Mac yet: a new one right after the last block of any Mac, every line of it a marker or a row,
@@ -158,15 +132,14 @@ export function landPage(text: string, filed: Row[], machine: string, home: stri
158
132
  const ends = lines.flatMap((l, i) => (ANY_END.test(l) ? [i] : []))
159
133
  if (ends.length === 0) return null
160
134
  const at = ends[ends.length - 1]! + 1
161
- return [...lines.slice(0, at), blockBegin(machine), ...mergeRows(carried, filed).map(rowLine), blockEnd(machine), ...lines.slice(at)].join('\n')
135
+ return [...lines.slice(0, at), blockBegin(machine), ...mergeRows([], filed).map(rowLine), blockEnd(machine), ...lines.slice(at)].join('\n')
162
136
  }
163
137
 
164
138
  /** render every filed row into its page and land each changed page as one
165
139
  * commit, at most once per LAND_GAP_MS. Returns what to print */
166
- export function landMotherhome(o: { now?: number; gapMs?: number; machine?: string; home?: string } = {}): string[] {
140
+ export function landMotherhome(o: { now?: number; gapMs?: number; machine?: string } = {}): string[] {
167
141
  const now = o.now ?? Date.now()
168
142
  const machine = o.machine ?? machineName()
169
- const home = o.home ?? homedir()
170
143
  const notes: string[] = []
171
144
  const filed = machineList<Filed>(ROW)
172
145
  for (const f of filed) if (!existsSync(f.value.root)) machineDelete(f.name)
@@ -179,7 +152,7 @@ export function landMotherhome(o: { now?: number; gapMs?: number; machine?: stri
179
152
  if (last != null && now - last < (o.gapMs ?? LAND_GAP_MS)) continue
180
153
  const r = withFileLock(page, (): boolean => {
181
154
  const text = readFileSync(page, 'utf8')
182
- const next = landPage(text, rows, machine, home)
155
+ const next = landPage(text, rows, machine)
183
156
  if (next == null) { notes.push(`WARN motherhome: markers missing or out of order in ${page}, rows not written`); return false }
184
157
  if (next === text) return false
185
158
  atomicWrite(page, next)
@@ -151,9 +151,6 @@ const STASH_READS = new Set(['list', 'show'])
151
151
  const STASH_WRITES = ['push', 'pop', 'apply', 'drop', 'clear', 'save', 'store', 'create', 'branch'] as const
152
152
  export const GIT_STASH_RULES: readonly string[] = [`Bash(${GIT_STASH_HEAD})`, `Bash(${GIT_STASH_HEAD} -*)`, ...STASH_WRITES.map((w) => `Bash(${GIT_STASH_HEAD} ${w}*)`)]
153
153
 
154
- /** the blanket row older repos carry: it blocks the reads too, SK013 replaces it with GIT_STASH_RULES */
155
- export const LEGACY_STASH_RULE = `Bash(${GIT_STASH_HEAD}*)`
156
-
157
154
  /** git's global options that take their value as the NEXT word */
158
155
  const GIT_VALUE_OPTS = new Set(['-C', '-c', '--git-dir', '--work-tree', '--namespace', '--config-env', '--exec-path'])
159
156
 
@@ -93,12 +93,3 @@ export async function importFresh(path: string): Promise<unknown> {
93
93
  try { real = realpathSync(path) } catch {}
94
94
  return ((await import(`${real}?v=${stamp}`)) as { default?: unknown }).default
95
95
  }
96
-
97
- /** every `*.check.ts` file under a repo root, check files and legacy
98
- * scripts alike, by the same walk discovery takes, without importing one.
99
- * Sorted. */
100
- export function repoCheckFiles(root: string): string[] {
101
- const out: string[] = []
102
- walkKept(root, out, SUFFIX, undefined, prunedDirs(root))
103
- return out.sort()
104
- }
@@ -18,7 +18,7 @@ import { GONE, GONE_KEEP_MS, goneUse, sweepGone } from '../review/gone.ts'
18
18
  import { compactDb, dbPath, shipkitRoot } from '../ledger/db.ts'
19
19
  import { SCAN_INDEX_KEEP_MS, sweepScanIndexes } from '../ledger/git-scan.ts'
20
20
  import { KEEP_MS as RECORD_KEEP_MS, MAX_ROWS, recordUse, sweepRuns } from '../ledger/run-log.ts'
21
- import { answersDb, answersUse, importLegacyStore, KEEP_MS as ANSWERS_KEEP_MS, legacyStoreDir, MAX_ANSWERS, slimAnswers, sweepAnswers } from '../ledger/store.ts'
21
+ import { answersDb, answersUse, KEEP_MS as ANSWERS_KEEP_MS, MAX_ANSWERS, slimAnswers, sweepAnswers } from '../ledger/store.ts'
22
22
  import { ageWords, bytesWords } from './words.ts'
23
23
 
24
24
  export type Cap = {
@@ -112,14 +112,6 @@ export function repoStores(root: string): Store[] {
112
112
  },
113
113
  sweep: (now) => { sweepAnswers(answersDb(root), now) },
114
114
  },
115
- {
116
- // the json store this table replaced: read once, then gone
117
- id: 'json answers',
118
- where: legacyStoreDir(root),
119
- cap: { maxCount: 0 },
120
- measure: () => walkUse(legacyStoreDir(root)),
121
- sweep: async (now) => { await importLegacyStore(root, now) },
122
- },
123
115
  {
124
116
  id: 'run record',
125
117
  where: `${dbPath(root)} (runs, invocations, suites)`,
@@ -4,6 +4,8 @@
4
4
  export const RETIRED_CHECK_IDS: Readonly<Record<string, string>> = {
5
5
  SK009: 'the AI attribution guard is gone: no rule polices commit trailers',
6
6
  SK014: 'the STE prose rule is gone: no rule polices prose style',
7
+ SK016: 'the legacy check shapes are gone: defineRepo refuses each removed key by name, and discovery fails a repo `*.check.ts` with the unit file to write',
7
8
  SK021: "the gh login is a machine fact: the house repo's github-login check runs src/core/gh-login.ts",
8
9
  SK023: "the store caps are the machine daemon's health: the house repo's stores-under-cap check",
10
+ SK029: 'the implicit check file keys are gone: check() refuses each retired key at load, and defineRepo refuses every old way to turn a check off',
9
11
  }
@@ -125,7 +125,7 @@ function collect(script: string, c: Ctx, depth: number): void {
125
125
  }
126
126
  }
127
127
 
128
- const shipkitSockets = (home: string): string[] => [`${home}/.shipkit/home/terminals.sock`, `${home}/.shipkit/terminals.sock`, `${home}/.config/shipkit/home/terminals.sock`]
128
+ const shipkitSockets = (home: string): string[] => [`${home}/.shipkit/home/terminals.sock`, `${home}/.shipkit/terminals.sock`]
129
129
 
130
130
  /** true for shipkit's socket, and for a `terminals.sock` nothing proves to be another: a relative path, an unknown variable */
131
131
  function isShipkitSocket(path: string, env: KillEnv): boolean {
@@ -1,5 +1,5 @@
1
- // one recursive watch of a folder for the whole process, its events handed to every listener (the save watch, the
2
- // backup's watch): a second watch of the same tree doubles what fseventsd delivers. A folder of UNWATCHED is never
1
+ // one recursive watch of a folder for the whole process, its events handed to every listener (the save watch): a
2
+ // second watch of the same tree doubles what fseventsd delivers. A folder of UNWATCHED is never
3
3
  // watched. Bun watches any folder through a recursive FSEvents stream, even with `recursive: false` (a write deep
4
4
  // down is heard as its top entry), so a folder above an unwatched one is never watched itself: each of its folders
5
5
  // gets its own watch, each of its files a watch of the file, and a listing every LIST_MS finds what was added or
package/src/core/when.ts CHANGED
@@ -3,12 +3,6 @@
3
3
  // its own declaration (core/runs.ts); a repo says of a whole check it does
4
4
  // not own only that it does not run here, and why. An off row runs in
5
5
  // no context, and every surface shows it with its reason.
6
- //
7
- // Four retired spellings still read as off while SK029 ports them: a `when`
8
- // entry `'off:<why>'` (defineRepo refuses the other words), `ruleExempt`,
9
- // `hooks.disable` and a floor slot `defaults: { <slot>: false }`. The last two
10
- // never carried a reason, so they read with one that says so. They die once
11
- // `shipkit fleet` shows no repo carrying them.
12
6
  import type { CheckRow } from '../gate/gate-checks.ts'
13
7
  import type { ResolvedRuns } from './runs.ts'
14
8
  import type { RepoConfig } from '../repo-config.ts'
@@ -16,55 +10,23 @@ import type { RepoConfig } from '../repo-config.ts'
16
10
  /** the coarse word a resolved row reads as on the check page */
17
11
  export type WhenAt = 'always' | 'release' | 'health' | 'commit' | 'off'
18
12
 
19
- /** which declaration is answering: the repo's `off`, one of its two retired
20
- * spellings, the check file, the `defaults` block, or a derived row */
21
- export type WhenSource = 'off' | 'when' | 'ruleExempt' | 'hooks.disable' | 'check-file' | 'defaults' | 'default'
13
+ /** which declaration is answering: the repo's `off`, the check file, or a derived row */
14
+ export type WhenSource = 'off' | 'check-file' | 'default'
22
15
 
23
16
  export type WhenDecl = { at: WhenAt; reason: string | null; source: WhenSource }
24
17
 
25
- /** the words a retired `when` value used */
26
- const WORDS: Record<string, WhenAt> = { always: 'always', release: 'release', health: 'health' }
27
-
28
- /** one retired `when` value, or the problem with it. defineRepo refuses every
29
- * word but `off:<why>`, which reads as `off` */
30
- export function parseWhen(raw: unknown): WhenDecl | string {
31
- if (typeof raw !== 'string') return `must be a string: off:<reason>`
32
- const v = raw.trim()
33
- if (v === 'off' || v.startsWith('off:')) {
34
- const reason = v.slice(4).trim()
35
- if (reason === '') return `off needs a reason ('off:<why this repo turns it off>') — a check nobody can explain is a silenced gate`
36
- return { at: 'off', reason, source: 'when' }
37
- }
38
- const at = WORDS[v]
39
- if (at == null) return `'${v}' is not a when value (off:<reason>)`
40
- return { at, reason: null, source: 'when' }
41
- }
42
-
43
- /** the repo turned this check off, with why and where it said so, or null */
44
- export type RepoOff = { reason: string; source: 'off' | 'when' | 'ruleExempt' | 'hooks.disable' | 'defaults' }
45
-
46
- /** the reason a spelling that never carried one reads with, and the one the
47
- * SK029 port writes when no comment beside the entry says more. A machine
48
- * cannot invent a reason, so every surface shows the gap */
49
- export const legacyOffReason = (source: 'hooks.disable' | 'defaults', id: string): string =>
50
- source === 'defaults' ? `was defaults: { ${/^[A-Za-z_$][\w$]*$/.test(id) ? id : `'${id}'`}: false }, no reason recorded` : `was hooks.disable: ['${id}'], no reason recorded`
18
+ /** the repo turned this check off, with why */
19
+ export type RepoOff = { reason: string; source: 'off' }
51
20
 
52
21
  /** the keys `repoOff` reads, so a caller holding part of a config can ask */
53
- export type OffKeys = Pick<RepoConfig, 'off' | 'when' | 'ruleExempt'> & { hooks?: { disable?: readonly string[] }; defaults?: Record<string, unknown> }
22
+ export type OffKeys = Pick<RepoConfig, 'off'>
54
23
 
55
24
  /** THE one answer to "is this id off here", for a check, a floor slot and a
56
25
  * commit gate alike. A floor slot that is off is off everywhere: no task, no
57
26
  * routed script, no deny rule */
58
27
  export function repoOff(c: OffKeys, id: string): RepoOff | null {
59
28
  const own = c.off?.[id]
60
- if (own != null) return { reason: own, source: 'off' }
61
- const w = c.when?.[id] == null ? null : parseWhen(c.when[id])
62
- if (w != null && typeof w !== 'string' && w.at === 'off') return { reason: w.reason ?? '', source: 'when' }
63
- const exempt = c.ruleExempt?.[id]
64
- if (exempt != null) return { reason: exempt, source: 'ruleExempt' }
65
- if (c.hooks?.disable?.includes(id) === true) return { reason: legacyOffReason('hooks.disable', id), source: 'hooks.disable' }
66
- if (c.defaults?.[id] === false) return { reason: legacyOffReason('defaults', id), source: 'defaults' }
67
- return null
29
+ return own == null ? null : { reason: own, source: 'off' }
68
30
  }
69
31
 
70
32
  /** a resolved row the repo turned off: it runs in no context */
@@ -84,5 +46,5 @@ export function whenSummary(r: ResolvedRuns, off: RepoOff | null, fromFile: bool
84
46
  * check is discovered on disk, so this is where the rest is caught, loud */
85
47
  export function unknownOffIds(rows: CheckRow[], c: RepoConfig): string[] {
86
48
  const known = new Set(rows.map((r) => r.decl.id))
87
- return [...new Set([...Object.keys(c.off ?? {}), ...Object.keys(c.when ?? {})])].filter((id) => !known.has(id))
49
+ return Object.keys(c.off ?? {}).filter((id) => !known.has(id))
88
50
  }