rvlib-shipkit 2.13.0 → 2.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (268) hide show
  1. package/CHANGELOG.md +32 -13
  2. package/package.json +1 -1
  3. package/src/assets/run-assets.ts +2 -2
  4. package/src/assets/server/studio-server.ts +27 -23
  5. package/src/check.ts +3 -3
  6. package/src/checks/SK001-package-json-shape.check.ts +4 -4
  7. package/src/checks/SK002-contracts-fulfillness.check.ts +2 -2
  8. package/src/checks/SK003-claude-md-shape.check.ts +19 -12
  9. package/src/checks/SK004-gitignore-policy.check.ts +18 -4
  10. package/src/checks/SK005-rvlib-versions.check.ts +1 -1
  11. package/src/checks/SK006-npm-publish-safety.check.ts +3 -3
  12. package/src/checks/SK007-github-visibility.check.ts +2 -2
  13. package/src/checks/SK008-reviewer-agent.check.ts +1 -1
  14. package/src/checks/SK010-undeclared-unit.check.ts +2 -2
  15. package/src/checks/SK011-sibling-unit-ranges.check.ts +2 -2
  16. package/src/checks/SK012-config-barrel-import.check.ts +1 -1
  17. package/src/checks/SK013-one-way-in-policy.check.ts +2 -2
  18. package/src/checks/SK015-nested-repo.check.ts +2 -2
  19. package/src/checks/SK016-legacy-check-shapes.check.ts +2 -2
  20. package/src/checks/SK017-vscode-hub-task.check.ts +2 -2
  21. package/src/checks/SK018-test-files-run.check.ts +2 -2
  22. package/src/checks/SK019-tests-run-in-units.check.ts +2 -2
  23. package/src/checks/SK020-self-spawning-check.check.ts +2 -2
  24. package/src/checks/SK022-machine-runs-the-pin.check.ts +2 -2
  25. package/src/checks/SK024-identity-colors.check.ts +1 -1
  26. package/src/checks/SK025-release-drift.check.ts +2 -2
  27. package/src/checks/SK026-asks-autoclose.check.ts +2 -2
  28. package/src/checks/SK027-agent-wiki-links.check.ts +8 -2
  29. package/src/checks/SK028-readme.check.ts +2 -2
  30. package/src/checks/SK029-explicit-check-files.check.ts +3 -3
  31. package/src/checks/SK030-cache-audit.check.ts +7 -5
  32. package/src/checks/SK031-trace-audit.check.ts +7 -7
  33. package/src/checks/SK032-ignored-inputs.check.ts +3 -3
  34. package/src/checks/SK033-global-contribution.check.ts +11 -4
  35. package/src/checks/SK034-commit-gates-armed.check.ts +2 -2
  36. package/src/checks/SK035-public-clean.check.ts +4 -4
  37. package/src/checks/SK036-draft-media-size.check.ts +2 -2
  38. package/src/checks/SK037-keyword-additions.check.ts +43 -0
  39. package/src/cli/cmd_Backup.ts +2 -2
  40. package/src/cli/cmd_Commands.ts +4 -4
  41. package/src/cli/cmd_ConfigKeys.ts +2 -2
  42. package/src/cli/cmd_Drill.ts +1 -1
  43. package/src/cli/cmd_Home.ts +1 -1
  44. package/src/cli/cmd_Init.ts +1 -1
  45. package/src/cli/cmd_Media.ts +4 -4
  46. package/src/cli/cmd_Mv.ts +14 -7
  47. package/src/cli/cmd_Review.ts +2 -2
  48. package/src/cli/cmd_Smoke.ts +1 -1
  49. package/src/cli/cmd_Social.ts +3 -3
  50. package/src/cli/cmd_Sound.ts +1 -1
  51. package/src/cli/cmd_TraceAudit.ts +6 -6
  52. package/src/cli/cmd_Trailer.ts +2 -2
  53. package/src/cli/cmd_Veille.ts +2 -2
  54. package/src/cli/cmd_When.ts +2 -2
  55. package/src/cli/family-pages.ts +19 -19
  56. package/src/collections/collection-types.ts +2 -2
  57. package/src/collections/review.ts +1 -1
  58. package/src/comfy/comfy-panel.ts +2 -2
  59. package/src/contracts/manifests/discord.contract.ts +1 -1
  60. package/src/contracts/manifests/identity.contract.ts +1 -1
  61. package/src/contracts/manifests/itch.contract.ts +1 -1
  62. package/src/contracts/manifests/steam.contract.ts +1 -1
  63. package/src/core/agent-dir-at.ts +12 -0
  64. package/src/core/agent-dir.ts +16 -0
  65. package/src/core/budget.ts +1 -1
  66. package/src/core/canonical-scripts.ts +2 -2
  67. package/src/core/discover-checks.ts +1 -1
  68. package/src/core/global-contribution.ts +4 -1
  69. package/src/core/ignored-block.ts +1 -1
  70. package/src/core/ignored-inputs.ts +3 -2
  71. package/src/core/layout.ts +3 -3
  72. package/src/core/loop-watch.ts +1 -1
  73. package/src/core/motherhome.ts +2 -2
  74. package/src/core/one-way-in-policy.ts +8 -8
  75. package/src/core/run-ci.ts +3 -3
  76. package/src/core/runs-matrix.ts +1 -1
  77. package/src/core/slots.ts +14 -5
  78. package/src/core/trace-audit.ts +50 -9
  79. package/src/core/tree-rev.ts +1 -1
  80. package/src/drill/run.ts +1 -1
  81. package/src/home/daemon-jobs.ts +1 -1
  82. package/src/home/global-context.ts +11 -8
  83. package/src/home/gui-app/ShipkitGui.swift +91 -2
  84. package/src/home/inbox-shape.ts +1 -1
  85. package/src/home/inbox.ts +1 -1
  86. package/src/home/pm-config.ts +4 -1
  87. package/src/home/pm-inputs.ts +2 -0
  88. package/src/home/resources.ts +7 -2
  89. package/src/home/run-pm.ts +1 -1
  90. package/src/home/serve-web.ts +2 -2
  91. package/src/hooks/commit-message.ts +1 -1
  92. package/src/hooks/hook-gates.ts +1 -1
  93. package/src/hooks/leak-guard.ts +61 -8
  94. package/src/hooks/run-hooks.ts +18 -18
  95. package/src/identities/identities.ts +1 -1
  96. package/src/identities/machine-route.ts +1 -1
  97. package/src/identities/machine.ts +1 -1
  98. package/src/init-repo.ts +2 -2
  99. package/src/ledger/gate-checks.ts +1 -1
  100. package/src/ledger/record-kept.ts +1 -1
  101. package/src/media-kinds.ts +1 -1
  102. package/src/media-store/backup/daemon.ts +1 -1
  103. package/src/media-store/backup/keys.ts +1 -1
  104. package/src/media-store/backup/manifest.ts +1 -1
  105. package/src/media-store/backup/restore.ts +1 -1
  106. package/src/media-store/backup/run.ts +1 -1
  107. package/src/media-store/backup/secret.ts +1 -1
  108. package/src/media-store/backup/snapshot.ts +1 -1
  109. package/src/media-store/backup/sources.ts +1 -1
  110. package/src/media-store/content.ts +1 -1
  111. package/src/media-store/daemon.ts +1 -1
  112. package/src/media-store/db.ts +1 -1
  113. package/src/media-store/fact.ts +1 -1
  114. package/src/media-store/hand.ts +1 -1
  115. package/src/media-store/kind.ts +1 -1
  116. package/src/media-store/purge.ts +1 -1
  117. package/src/media-store/put.ts +1 -1
  118. package/src/media-store/remote.ts +1 -1
  119. package/src/media-store/space.ts +1 -1
  120. package/src/mv/mv-md.ts +63 -22
  121. package/src/pages/forward.ts +1 -1
  122. package/src/pages/frame-client.ts +1 -1
  123. package/src/pages/routes.ts +1 -1
  124. package/src/pages/unit.ts +1 -1
  125. package/src/plan/planner.ts +1 -1
  126. package/src/plan/repo-source.ts +1 -1
  127. package/src/release/public-clean.ts +25 -7
  128. package/src/release/run-bump.ts +1 -1
  129. package/src/release/run-release.ts +3 -3
  130. package/src/repo-config.ts +23 -16
  131. package/src/review/anim.ts +1 -1
  132. package/src/review/auto.ts +1 -1
  133. package/src/review/cells.ts +15 -1
  134. package/src/review/format.ts +2 -2
  135. package/src/review/marks.ts +1 -1
  136. package/src/review/media-kind.ts +1 -1
  137. package/src/review/media-read.ts +1 -1
  138. package/src/review/model.ts +14 -4
  139. package/src/review/notes.ts +52 -4
  140. package/src/review/previews.ts +1 -1
  141. package/src/review/project.ts +1 -1
  142. package/src/review/role.ts +1 -1
  143. package/src/review/routes.ts +14 -2
  144. package/src/review/store.ts +2 -2
  145. package/src/review/threads.ts +1 -1
  146. package/src/review/trailer-desk.ts +3 -3
  147. package/src/review/trailer-media.ts +1 -1
  148. package/src/review/trailer-model.ts +1 -1
  149. package/src/review/trailer-routes.ts +1 -1
  150. package/src/review/trailer-shots.ts +1 -1
  151. package/src/review/unit.ts +1 -1
  152. package/src/scaffold/files/tsconfig.json +1 -1
  153. package/src/scaffold/project-scaffold.ts +1 -1
  154. package/src/serve/embed.ts +1 -1
  155. package/src/serve/hub-app/check-words.ts +1 -1
  156. package/src/serve/hub-app/frames-st.ts +1 -1
  157. package/src/serve/hub-app/hash-route.ts +1 -1
  158. package/src/serve/hub-app/home-st.ts +1 -1
  159. package/src/serve/hub-app/home-strip.css +1 -1
  160. package/src/serve/hub-app/hub-app.tsx +2 -2
  161. package/src/serve/hub-app/identities-st.ts +1 -1
  162. package/src/serve/hub-app/identities-view.tsx +5 -4
  163. package/src/serve/hub-app/identity-address.ts +1 -1
  164. package/src/serve/hub-app/inbox-st.ts +1 -1
  165. package/src/serve/hub-app/inbox-view.tsx +1 -1
  166. package/src/serve/hub-app/kept-cols.tsx +30 -0
  167. package/src/serve/hub-app/keys.ts +1 -1
  168. package/src/serve/hub-app/media-svc.ts +1 -1
  169. package/src/serve/hub-app/pages-frames.tsx +1 -1
  170. package/src/serve/hub-app/pages-svc.ts +1 -1
  171. package/src/serve/hub-app/projects-svc.ts +1 -1
  172. package/src/serve/hub-app/repo-st.ts +1 -1
  173. package/src/serve/hub-app/review/review-board.tsx +1 -1
  174. package/src/serve/hub-app/review/review-cells.tsx +3 -2
  175. package/src/serve/hub-app/review/review-page.tsx +5 -4
  176. package/src/serve/hub-app/review/review-st.ts +15 -7
  177. package/src/serve/hub-app/review/review-thread.tsx +52 -5
  178. package/src/serve/hub-app/review/review-views.tsx +50 -33
  179. package/src/serve/hub-app/review/thread-st.ts +79 -27
  180. package/src/serve/hub-app/review/trailer-page.tsx +5 -4
  181. package/src/serve/hub-app/review/trailer-st.ts +1 -1
  182. package/src/serve/hub-app/review.css +9 -1
  183. package/src/serve/hub-app/site/site-part.tsx +1 -1
  184. package/src/serve/hub-app/site/site-st.ts +1 -1
  185. package/src/serve/hub-app/social/calendar.tsx +1 -1
  186. package/src/serve/hub-app/social/comms-page.tsx +29 -5
  187. package/src/serve/hub-app/social/kit.tsx +1 -1
  188. package/src/serve/hub-app/social/post-card.tsx +1 -1
  189. package/src/serve/hub-app/social/social-model.ts +1 -1
  190. package/src/serve/hub-app/social/social-page.tsx +12 -5
  191. package/src/serve/hub-app/social/social-st.ts +31 -3
  192. package/src/serve/hub-app/social.css +1 -1
  193. package/src/serve/hub-app/stores/stores-page.tsx +5 -4
  194. package/src/serve/hub-app/stores/stores-st.ts +1 -1
  195. package/src/serve/hub-app/stores.css +1 -1
  196. package/src/serve/hub-app/tree-row.tsx +1 -1
  197. package/src/serve/hub-app/veille/veille-page.tsx +5 -4
  198. package/src/serve/hub-app/veille/veille-st.ts +1 -1
  199. package/src/serve/hub-app/veille.css +1 -1
  200. package/src/serve/hub-runtime.ts +6 -2
  201. package/src/serve/project-gutter-route.ts +1 -1
  202. package/src/shot/box.ts +5 -7
  203. package/src/shot/browser-slot.ts +18 -6
  204. package/src/shot/client.ts +1 -2
  205. package/src/shot/clip-encoder.ts +16 -13
  206. package/src/shot/film-box.ts +132 -28
  207. package/src/shot/shooter.ts +21 -2
  208. package/src/shot/stepped-clip.ts +1 -1
  209. package/src/site/desk.ts +2 -2
  210. package/src/site/routes.ts +1 -1
  211. package/src/site/unit.ts +1 -1
  212. package/src/social/card-drafts.ts +24 -0
  213. package/src/social/compose.ts +2 -2
  214. package/src/social/desk-index.ts +1 -1
  215. package/src/social/desk-wire.ts +1 -1
  216. package/src/social/drafts.ts +3 -3
  217. package/src/social/load.ts +14 -1
  218. package/src/social/media-facts.ts +1 -1
  219. package/src/social/media-kind.ts +1 -1
  220. package/src/social/media-limit.ts +1 -1
  221. package/src/social/media-of.ts +1 -1
  222. package/src/social/migrate.ts +1 -1
  223. package/src/social/post-url.ts +1 -1
  224. package/src/social/presence.ts +2 -2
  225. package/src/social/public-read.ts +1 -1
  226. package/src/social/publish/bluesky.ts +1 -1
  227. package/src/social/publish/discord.ts +1 -1
  228. package/src/social/push.ts +10 -4
  229. package/src/social/richtext.ts +1 -1
  230. package/src/social/routes.ts +10 -4
  231. package/src/social/stats.ts +1 -1
  232. package/src/social/text.ts +1 -1
  233. package/src/social/tracker-route.ts +1 -1
  234. package/src/social/tracker.ts +1 -1
  235. package/src/social/unit.ts +1 -1
  236. package/src/social/writes.ts +1 -1
  237. package/src/stores/collection.ts +1 -1
  238. package/src/stores/desk.ts +1 -1
  239. package/src/stores/model.ts +1 -1
  240. package/src/stores/routes.ts +1 -1
  241. package/src/stores/unit.ts +1 -1
  242. package/src/suite/judge-suites.ts +1 -1
  243. package/src/trace/tracer.ts +12 -5
  244. package/src/trailer/adapter.ts +1 -1
  245. package/src/trailer/build.ts +6 -4
  246. package/src/trailer/holes.ts +1 -1
  247. package/src/trailer/passage.ts +1 -1
  248. package/src/trailer/prune.ts +1 -1
  249. package/src/trailer/states.ts +1 -1
  250. package/src/trailer/versions.ts +1 -1
  251. package/src/trailer/words.ts +1 -1
  252. package/src/tui/run-tui.ts +1 -1
  253. package/src/tui/tui-store.ts +1 -1
  254. package/src/veille/asks.ts +1 -1
  255. package/src/veille/auto.ts +1 -1
  256. package/src/veille/batch.ts +1 -1
  257. package/src/veille/chrome.ts +1 -1
  258. package/src/veille/collection.ts +1 -1
  259. package/src/veille/desk.ts +1 -1
  260. package/src/veille/identity.ts +1 -1
  261. package/src/veille/import.ts +1 -1
  262. package/src/veille/log.ts +1 -1
  263. package/src/veille/platforms.ts +1 -1
  264. package/src/veille/reads.ts +1 -1
  265. package/src/veille/replied.ts +1 -1
  266. package/src/veille/routes.ts +2 -2
  267. package/src/veille/watch.ts +1 -1
  268. package/src/veille/worth.ts +2 -2
@@ -8,7 +8,7 @@ import { dirname, join, relative } from 'path'
8
8
  import { fileURLToPath } from 'url'
9
9
  import { KEYWORD_FILE, LAYOUT } from '../core/layout.ts'
10
10
  import { commitMessageOffenses } from './commit-message.ts'
11
- import { globalAllowFile, globalKeywordFile, maskPattern, patternFingerprint, runLeakGuard, SECRET_ROWS, type LeakAllowEntry, type LeakHit, type LeakWaiver } from './leak-guard.ts'
11
+ import { globalAllowFile, globalKeywordFile, maskPattern, patternFingerprint, runLeakGuard, type LeakAllowEntry, type LeakHit, type LeakWaiver } from './leak-guard.ts'
12
12
  import { runRootIdentity } from './root-identity.ts'
13
13
  import { readStaged } from './staged.ts'
14
14
  import { ALLOW_MASS_DELETE, runTreeShrink } from './tree-shrink.ts'
@@ -62,7 +62,7 @@ export type HooksConfig = {
62
62
  languageAllow?: string[]
63
63
  /** RETIRED, read as `off` while SK029 ports it there: a commit gate is
64
64
  * turned off like any check, `off: { <gate id>: '<why>' }`
65
- * (build/shipkit/runs.md). Dies once `shipkit fleet` shows no repo
65
+ * (tools/shipkit/runs.md). Dies once `shipkit fleet` shows no repo
66
66
  * carrying it */
67
67
  disable?: HookGateId[]
68
68
  }
@@ -152,27 +152,27 @@ export function installHooks(root: string, binInvocation: string, keywordFile?:
152
152
  }
153
153
  }
154
154
 
155
- // a starter so the leak guard bites from day one instead of skipping forever:
156
- // generic secret shapes only. private names live in the machine-global
157
- // ~/.shipkit/private/banned-keywords.txt, which the guard reads on every run
158
- // (never copied into a repo: a copy rots and a copy can leak)
159
- export const KEYWORD_STARTER = `# banned-keywords — the leak guard greps every commit (added lines, paths,
160
- # message) for these rows. one row = one case-insensitive substring, or
161
- # re:<regex>. add repo-specific names here; machine-wide private names go in
162
- # ~/.shipkit/private/banned-keywords.txt, read automatically alongside this file.
155
+ // a starter that names what belongs here: this repo's ADDITIONS. The official list is the machine's
156
+ // ~/.shipkit/private/banned-keywords.txt and the secret shapes are built into the guard, so neither is copied
157
+ // into a repo (a copy rots: SK037 strips one)
158
+ export const KEYWORD_STARTER = `# banned-keywords: THIS repo's additions to the leak guard, which greps every
159
+ # commit (added lines, paths, message) and every npm tarball for these rows.
160
+ # one row = one case-insensitive substring, w:<word> (whole words), or re:<regex>.
161
+ # the official list is ~/.shipkit/private/banned-keywords.txt and the generic
162
+ # secret shapes are built in: both are read with this file, never copied here.
163
+ # a word the list bans that this repo must say: repo.config.ts hooks.leakAllow.
163
164
  # this file is gitignored on purpose: the list itself is private.
164
- ${SECRET_ROWS.join('\n')}
165
165
  `
166
166
 
167
- /** seed the configured keyword file with the generic starter so the guard is
168
- * ARMED, not a skip. an existing file is never touched. */
167
+ /** seed the configured keyword file with the starter: its presence ARMS the guard (the built-in secret shapes
168
+ * scan from then on), and it says what the repo adds. an existing file is never touched. */
169
169
  function seedKeywordFile(root: string, keywordFile?: string): string | null {
170
170
  const rel = keywordFile ?? KEYWORD_FILE
171
171
  const dest = join(root, rel)
172
172
  if (existsSync(dest)) return null
173
173
  mkdirSync(dirname(dest), { recursive: true })
174
174
  writeFileSync(dest, KEYWORD_STARTER)
175
- return `${rel} (starter shapes)`
175
+ return `${rel} (the repo's additions, empty)`
176
176
  }
177
177
 
178
178
  export type GateOutcome = { id: string; ok: boolean; lines: string[] }
@@ -182,7 +182,7 @@ export type GateOutcome = { id: string; ok: boolean; lines: string[] }
182
182
  * exempt it. The file rides along for a content hit; a staged-PATH hit adds
183
183
  * nothing, because there the path IS what matched. */
184
184
  const hitLine = (x: LeakHit): string =>
185
- ` ${x.where}${x.where === 'staged content' && x.file != null ? ` ${x.file}` : ''}: ${maskPattern(x.pattern)} [${patternFingerprint(x.pattern)}]`
185
+ ` ${x.where}${x.where === 'staged content' && x.file != null ? ` ${x.file}` : ''}: ${maskPattern(x.pattern)} [${patternFingerprint(x.pattern)}]${x.over == null ? '' : `, ${x.over.found} added where ${x.over.source} allows ${x.over.count}`}`
186
186
 
187
187
  /** what the allowlist let through, one line per waiver. An allowlist that
188
188
  * fires invisibly is a silent weakening, so a waived match is as loud as a
@@ -215,7 +215,7 @@ export function blockedStaged(staged: string[], config: RepoConfig): string[] {
215
215
  const draftsOpen = (c: RepoConfig): boolean => c.visibility === 'private'
216
216
 
217
217
  /** the pre-commit gate: built-in leak guard, then the repo's own commands.
218
- * A commit takes ~1s (build/shipkit/commit-gates.md): the gate times itself, and going
218
+ * A commit takes ~1s (tools/shipkit/commit-gates.md): the gate times itself, and going
219
219
  * over budget WARNs naming the fix, so drift back to slow commits is loud. */
220
220
  export async function runPreCommit(root: string, config: RepoConfig): Promise<GateOutcome[]> {
221
221
  const started = performance.now()
@@ -307,7 +307,7 @@ export async function runPreCommit(root: string, config: RepoConfig): Promise<Ga
307
307
  out.push({
308
308
  id: 'hook-budget',
309
309
  ok: true,
310
- lines: [`WARN pre-commit took ${(elapsed / 1000).toFixed(1)}s (budget ${HOOK_BUDGET_MS / 1000}s) — move slow preCommit commands to ci tasks, or a check off onPreCommit (build/shipkit/runs.md)`],
310
+ lines: [`WARN pre-commit took ${(elapsed / 1000).toFixed(1)}s (budget ${HOOK_BUDGET_MS / 1000}s) — move slow preCommit commands to ci tasks, or a check off onPreCommit (tools/shipkit/runs.md)`],
311
311
  })
312
312
  return out
313
313
  }
@@ -347,7 +347,7 @@ async function runPreCommitChecks(root: string, config: RepoConfig): Promise<Gat
347
347
  out.push({
348
348
  id: 'slow-import',
349
349
  ok: true,
350
- lines: [`WARN ${relative(root, s.path)} took ${Math.round(s.ms)}ms to import, over ${SLOW_IMPORT_MS}ms: every surface that lists the checks pays it, so move its heavy imports inside \`run\` (build/shipkit/writing-a-check.md)`],
350
+ lines: [`WARN ${relative(root, s.path)} took ${Math.round(s.ms)}ms to import, over ${SLOW_IMPORT_MS}ms: every surface that lists the checks pays it, so move its heavy imports inside \`run\` (tools/shipkit/writing-a-check.md)`],
351
351
  })
352
352
  const pass = new CheckPass(root, config, undefined, false)
353
353
  for (const k of found.checks) {
@@ -1,4 +1,4 @@
1
- // the identities, who speaks (wiki build/shipkit/social.md, Identities): one folder an identity in the house repo,
1
+ // the identities, who speaks (wiki tools/shipkit/social.md, Identities): one folder an identity in the house repo,
2
2
  // `.shipkit/identities/<id>/`, its profile, brand, accounts and their places, and a company's legal rows. Read from
3
3
  // the disk as it is on every call; the one constraint: never in the npm package, a project names its identity
4
4
  import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs'
@@ -1,4 +1,4 @@
1
- // the home's identities page (wiki build/shipkit/home.md, Identities): every identity, its accounts, the repos that
1
+ // the home's identities page (wiki tools/shipkit/home.md, Identities): every identity, its accounts, the repos that
2
2
  // speak as it, and where its data lives on disk. `POST /api/home/identities/open` opens one of those places in VS Code
3
3
  // or the Finder; it names an identity, a place and a repo, never a path
4
4
  import { existsSync, readdirSync } from 'node:fs'
@@ -1,4 +1,4 @@
1
- // the identities as the machine's surfaces show them (wiki build/shipkit/social.md, Identities): the project list's
1
+ // the identities as the machine's surfaces show them (wiki tools/shipkit/social.md, Identities): the project list's
2
2
  // headers (`railIdentities`: a name, a colour, a mark) and the repo each row speaks as. Read again only when an
3
3
  // `identity.md` of the folder moves, so the list's 5 s poll costs a few stats
4
4
  import { existsSync, readdirSync, statSync } from 'node:fs'
package/src/init-repo.ts CHANGED
@@ -118,7 +118,7 @@ export async function initRepo(root: string, opts: InitOpts = {}): Promise<numbe
118
118
  let added = 0
119
119
  // canonical script bodies — ONE source (core/canonical-scripts.ts),
120
120
  // shared with rule SK001's autofix; vocabulary owned by
121
- // meta/rv-conventions/package-json.md
121
+ // patterns/rv-conventions/package-json.md
122
122
  // `test` is scaffolded only once the repo has tests: `bun test` exits
123
123
  // non-zero with none, and a scaffold that reds the gate is a bad scaffold
124
124
  for (const [k, v] of Object.entries(canonicalBodies({ bin: opts.bin }))) {
@@ -166,7 +166,7 @@ export async function initRepo(root: string, opts: InitOpts = {}): Promise<numbe
166
166
  }
167
167
 
168
168
  /** ONE WAY IN, both halves, through the SAME fixers `shipkit check --fix` runs
169
- * (build/shipkit/one-way-in.md). Nothing here is a second implementation: rule SK001
169
+ * (tools/shipkit/one-way-in.md). Nothing here is a second implementation: rule SK001
170
170
  * routes the package.json scripts, rule SK013 writes the harness policy, and
171
171
  * init just calls them so a wired repo is born enforced and a re-run repairs
172
172
  * one that was not. The deny is a RESTRICTION, which is why it lands
@@ -301,7 +301,7 @@ export async function composeChecks(root: string, c: RepoConfig, o: ComposeOpts
301
301
  // what it likes, and a gate that guesses which one is the tests will miss
302
302
  // one.
303
303
  // a compose is seconds of sync work on a large repo: the loop goes back to the pages between its parts (wiki
304
- // build/shipkit/home.md, Nothing heavy on the daemon's loop)
304
+ // tools/shipkit/home.md, Nothing heavy on the daemon's loop)
305
305
  await yieldLoop()
306
306
  const rootTest = rootTestKey(root, c, floor)
307
307
  await yieldLoop()
@@ -3,7 +3,7 @@
3
3
  // db file's and its WAL's time and size: any write moves one of them. A table that only grows at its end and loses its
4
4
  // oldest rows (runs, suites: every write sweeps what is past the keep window) is read whole once, then by the rows
5
5
  // written since, the swept ones dropped from its front; what does not add up reads it whole again. `warmTable` is the
6
- // same whole read in pages, the loop given back between two (wiki build/shipkit/home.md, Nothing heavy on the
6
+ // same whole read in pages, the loop given back between two (wiki tools/shipkit/home.md, Nothing heavy on the
7
7
  // daemon's loop)
8
8
  import { statSync } from 'fs'
9
9
  import type { Database } from 'bun:sqlite'
@@ -1,4 +1,4 @@
1
- // every kind the machine's media store holds (wiki build/shipkit/media-store.md, A kind): the daemon and `sk media` read
1
+ // every kind the machine's media store holds (wiki tools/shipkit/media-store.md, A kind): the daemon and `sk media` read
2
2
  // this list. A new caller writes its kind beside its own code and adds its line here
3
3
  import type { MediaKind } from './media-store/kind.ts'
4
4
  import { handKind, labelsInIndex } from './media-store/hand.ts'
@@ -1,4 +1,4 @@
1
- // the daemon's backup job (wiki build/shipkit/media-store.md, Backup, The daemon): one look, in a child process the
1
+ // the daemon's backup job (wiki tools/shipkit/media-store.md, Backup, The daemon): one look, in a child process the
2
2
  // daemon starts every 2 min (home/daemon-jobs.ts), never on its loop. A cheap stamp of the sources (paths, sizes,
3
3
  // times, no hashing); once it moved and then held still for one look, a run, at most one each 10 min; a run every 6 h
4
4
  // whatever moved, which takes the sqlite snapshots. Each failure is one line in the log
@@ -1,4 +1,4 @@
1
- // where the backup keeps its objects in the private Space (wiki build/shipkit/media-store.md, Backup): a file's bytes
1
+ // where the backup keeps its objects in the private Space (wiki tools/shipkit/media-store.md, Backup): a file's bytes
2
2
  // under `backup/<sha256>.<ext>`, a sqlite snapshot gzipped under `backup/<sha256 of the gz>.gz`, one manifest a run
3
3
  // under `backup/runs/<time>-<digest>.json.gz`. Nothing under the prefix is ever deleted
4
4
  export const BACKUP_LABEL = 'backup'
@@ -1,4 +1,4 @@
1
- // one backup run as a record (wiki build/shipkit/media-store.md, Backup, In the Space): every file the machine held,
1
+ // one backup run as a record (wiki tools/shipkit/media-store.md, Backup, In the Space): every file the machine held,
2
2
  // its sha, size, time and the key its bytes are under, and every file refused with the reason. A run of version 2 keeps
3
3
  // its files in PARTS, one a group (the home, the memories, a house repo; a big group cut in buckets by folder), each
4
4
  // part content addressed: a run that changes one file writes that file's part and the run's list of parts. A run of
@@ -1,4 +1,4 @@
1
- // A RESTORE (wiki build/shipkit/media-store.md, Backup, Restore): a run's files written back from the Space, each one
1
+ // A RESTORE (wiki tools/shipkit/media-store.md, Backup, Restore): a run's files written back from the Space, each one
2
2
  // checked by its sha before it lands. Into a folder that is empty or new, by default. In place only when asked, and
3
3
  // then a live file that differs is copied aside first, and a sqlite lands beside its live file (`.restored`): a live
4
4
  // db is never swapped under the process that writes it. The DRILL restores into a scratch folder and compares every
@@ -1,4 +1,4 @@
1
- // A BACKUP RUN (wiki build/shipkit/media-store.md, Backup): every source read once, refused or hashed (a sqlite
1
+ // A BACKUP RUN (wiki tools/shipkit/media-store.md, Backup): every source read once, refused or hashed (a sqlite
2
2
  // snapshotted first), each object the Space lacks sent from the bytes that were hashed (never
3
3
  // the live file again: it may have moved), then the run's parts the Space lacks, then the run itself, last, so a run
4
4
  // never names an object the Space lacks. A run whose state equals the last one writes nothing. The objects are never
@@ -1,4 +1,4 @@
1
- // what the backup never sends (wiki build/shipkit/media-store.md, Backup): a secret's home is the keychain, never the
1
+ // what the backup never sends (wiki tools/shipkit/media-store.md, Backup): a secret's home is the keychain, never the
2
2
  // Space. A file is refused by its name (an env file, a key file, a name that says secret, token, password, api key), by
3
3
  // the leak guard's secret shapes in its bytes, by a credential line whose value is no keychain pointer, or by its
4
4
  // size (over 50 MB is a question for the owner first, unless his repo names the path whole: `backup.paths`). The
@@ -1,4 +1,4 @@
1
- // a live sqlite copied consistently (wiki build/shipkit/media-store.md, Backup): the live file attached read only into
1
+ // a live sqlite copied consistently (wiki tools/shipkit/media-store.md, Backup): the live file attached read only into
2
2
  // a fresh database, the tables kept copied inside ONE transaction (one read snapshot of the WAL), then vacuumed. Never a
3
3
  // copy of the file while a process writes it. The same rows give the same bytes, so an unchanged db is one object.
4
4
  // A cut leaves out the rows that move by themselves (a pid, the backup's own records): else every run differs
@@ -1,4 +1,4 @@
1
- // WHAT THE BACKUP HOLDS (wiki build/shipkit/media-store.md, Backup, The inventory): every file of the machine that no
1
+ // WHAT THE BACKUP HOLDS (wiki tools/shipkit/media-store.md, Backup, The inventory): every file of the machine that no
2
2
  // git and no Space keeps, its authored or irreplaceable state. The home's veille logs, the rail order, the media index
3
3
  // and the machine db (consistent sqlite snapshots), the machine's private folder, the agents' memories of each house
4
4
  // repo; in each house repo, every untracked file of `.shipkit/` and the hand tuned `.comfy-ts/` files, and its
@@ -1,4 +1,4 @@
1
- // a media file by its content (wiki build/shipkit/media-store.md): its sha256, size and type, and the one key the Space
1
+ // a media file by its content (wiki tools/shipkit/media-store.md): its sha256, size and type, and the one key the Space
2
2
  // keeps it under, `<kind>/<sha256>.<ext>`, the same for every caller and repo that names it
3
3
  import { existsSync, statSync } from 'node:fs'
4
4
  import { extname, join } from 'node:path'
@@ -1,4 +1,4 @@
1
- // the daemon's media job (wiki build/shipkit/media-store.md, The daemon): one pass, in a child process the daemon
1
+ // the daemon's media job (wiki tools/shipkit/media-store.md, The daemon): one pass, in a child process the daemon
2
2
  // starts every 30 s (home/daemon-jobs.ts), never on its loop. Every kind of every house repo scanned into the machine
3
3
  // index once its store moved, what waits sent up, and (when the owner turned it on) the disk purged under 40 GB free.
4
4
  // Each failure is one line in the daemon's log
@@ -1,4 +1,4 @@
1
- // THE MACHINE'S MEDIA INDEX (wiki build/shipkit/media-store.md, The index): one sqlite file in the home's state folder,
1
+ // THE MACHINE'S MEDIA INDEX (wiki tools/shipkit/media-store.md, The index): one sqlite file in the home's state folder,
2
2
  // never in a repo, for every media file of this machine, whatever kind holds it. It is DERIVED: each kind's files stay
3
3
  // the truth, and a deleted index builds again from them (a file's place in the Space is found again by a HEAD). It holds
4
4
  // each file a kind names (local or not), each Space object (up or waiting, its retries), and the review store's item
@@ -1,4 +1,4 @@
1
- // a media file known by its content (wiki build/shipkit/media-store.md): the shape every caller records beside its file
1
+ // a media file known by its content (wiki tools/shipkit/media-store.md): the shape every caller records beside its file
2
2
  // name. Pure, so a page's types read it too
3
3
  export interface MediaFact {
4
4
  /** sha256, hex */
@@ -1,4 +1,4 @@
1
- // the generic kind (wiki build/shipkit/media-store.md, Put a file from any repo): a label no `MediaKind` of the code
1
+ // the generic kind (wiki tools/shipkit/media-store.md, Put a file from any repo): a label no `MediaKind` of the code
2
2
  // owns, its files named by hand through `sk media put`. The index is its only record, so its scan reads the index's
3
3
  // own rows back and asks the disk whether each file still holds the bytes of its key; nothing else names them
4
4
  import { statSync } from 'node:fs'
@@ -1,4 +1,4 @@
1
- // what a caller of the media store plugs in (wiki build/shipkit/media-store.md, A kind): where its files live in a repo,
1
+ // what a caller of the media store plugs in (wiki tools/shipkit/media-store.md, A kind): where its files live in a repo,
2
2
  // what they are, and what must stay on the disk. The store does the rest: the index, the upload, the signed URL, the
3
3
  // fetch back, the purge. A row's path is always `join(store, item, name)`, the one form every scan, pin and delete uses
4
4
  import type { MediaFact } from './fact.ts'
@@ -1,4 +1,4 @@
1
- // the disk lets go of media the Space holds (wiki build/shipkit/media-store.md, The purge). A file goes only when the
1
+ // the disk lets go of media the Space holds (wiki tools/shipkit/media-store.md, The purge). A file goes only when the
2
2
  // index says up AND a HEAD answers its size AND its kind's `beforePurge` passed. Kept: every row its kind pins, every
3
3
  // row used in the last `older` days, every row nothing names. Oldest first. The candidates and the delete read one path
4
4
  // form, `join(store, item, name)`, from the same index rows
@@ -1,4 +1,4 @@
1
- // a file put in the store by hand, and a fresh link to anything it holds (wiki build/shipkit/media-store.md, Put a file
1
+ // a file put in the store by hand, and a fresh link to anything it holds (wiki tools/shipkit/media-store.md, Put a file
2
2
  // from any repo): the one way a repo's agent keeps a file in the private Space. The index row is written before the
3
3
  // upload, so a failed upload waits for the daemon like any other; a link lasts at most 7 days, the object for good
4
4
  import { realpathSync, statSync } from 'node:fs'
@@ -1,4 +1,4 @@
1
- // a media file from the disk or the Space (wiki build/shipkit/media-store.md, Read): a URL signed for a file the disk
1
+ // a media file from the disk or the Space (wiki tools/shipkit/media-store.md, Read): a URL signed for a file the disk
2
2
  // let go, and the file fetched back into its place, checked by its sha, for a tool that needs its bytes
3
3
  import { existsSync, renameSync, rmSync, statSync } from 'node:fs'
4
4
  import { resolve } from 'node:path'
@@ -1,4 +1,4 @@
1
- // the private S3 bucket that keeps every media file of the machine's store (wiki build/shipkit/media-store.md), named by
1
+ // the private S3 bucket that keeps every media file of the machine's store (wiki tools/shipkit/media-store.md), named by
2
2
  // the house config's `serve.mediaSpace`. Every object is PRIVATE: never a public-read ACL, never a bucket policy. A page
3
3
  // reads one through a URL signed for one hour, on the CDN edge. The key pair (`KEY:SECRET`) is read through the house's
4
4
  // `credsReadCommand`, held in memory only: never written to a file, never printed
package/src/mv/mv-md.ts CHANGED
@@ -1,4 +1,4 @@
1
- // shipkit mv — rename an md page the AGILE way: one command moves the .md,
1
+ // shipkit mv — rename an md page the AGILE way: one command moves the .md (or makes it a `<topic>/index.md`),
2
2
  // its sibling asset dir and <name>.check.ts, then sweeps EVERY tracked text
3
3
  // file for refs (full path, docs-root-relative id, check filename). Dry by
4
4
  // default; --write applies; --commit adds one conventional commit (the
@@ -6,19 +6,20 @@
6
6
  // script it runs after the moves (repo-specific re-stamps). TS module moves
7
7
  // are a different concern (a TS-aware renamer owns import graphs).
8
8
  import { execSync } from 'child_process'
9
- import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from 'fs'
9
+ import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from 'fs'
10
10
  import { basename, dirname, join, relative } from 'path'
11
11
  import { isVendored } from '../core/vendored.ts'
12
12
  import { vendoredAround } from '../core/vendored-read.ts'
13
13
 
14
14
  export type MvIo = { print: (l: string) => void; printErr: (l: string) => void }
15
- export type MvOpts = { write?: boolean; commit?: boolean }
15
+ export type MvOpts = { write?: boolean; commit?: boolean; /** run the repo's `mv:after` script (a batch runs it once, at the end) */ after?: boolean }
16
16
 
17
17
  const sh = (cmd: string, cwd: string): string => execSync(cmd, { cwd }).toString()
18
18
 
19
- /** a page's own probe, named after the page: a check file, or a legacy
20
- * check script, which shares the suffix. */
21
- const SIBLING_SUFFIXES = ['.check.ts'] as const
19
+ /** a page's own files, named after the page: its check file (either suffix)
20
+ * and its unit file (a global process or a widget). Longest first, so the
21
+ * unit suffix never claims a check file. */
22
+ const SIBLING_SUFFIXES = ['.check.shipkit.ts', '.check.ts', '.shipkit.ts'] as const
22
23
 
23
24
  const posix = (p: string): string => p.replace(/\\/g, '/')
24
25
  /** a link points at a file. A directory that happens to share a prose word's
@@ -99,25 +100,31 @@ export function movePage(root: string, oldRel: string, newRel: string, io: MvIo,
99
100
  // refusing, so the probe lands one level too deep and the run still says
100
101
  // ok. Unreachable while every move was a same-dir rename, likely the
101
102
  // moment a move crosses directories
102
- const oldSiblingDir = oldRel.slice(0, -3)
103
- if (existsSync(join(root, oldSiblingDir)) && existsSync(join(root, newRel.slice(0, -3))))
104
- return die(`${newRel.slice(0, -3)}/ already exists, and ${oldSiblingDir}/ would be nested inside it rather than become it — move or merge it by hand first`)
103
+ // the index form: `<topic>/index.md` names a topic folder, so the page's
104
+ // asset dir BECOMES that folder instead of sitting beside the page
105
+ const indexForm = basename(newRel) === 'index.md' && basename(oldRel) !== 'index.md'
106
+ const oldBase = oldRel.slice(0, -3) // full path sans .md, the sibling dir
107
+ const newBase = indexForm ? dirOf(newRel) : newRel.slice(0, -3)
108
+ // in place: the page moves into its own asset dir, which already is the topic folder
109
+ const inPlace = indexForm && newBase === oldBase
110
+ if (indexForm && !inPlace && existsSync(join(root, newBase))) return die(`${newBase}/ already exists: a topic folder is created by its move, never merged into`)
111
+ if (!indexForm && existsSync(join(root, oldBase)) && existsSync(join(root, newBase)))
112
+ return die(`${newBase}/ already exists, and ${oldBase}/ would be nested inside it rather than become it: move or merge it by hand first`)
105
113
 
106
114
  const write = o.write === true || o.commit === true
107
115
  const oldName = basename(oldRel, '.md')
108
- const newName = basename(newRel, '.md')
109
- const oldBase = oldRel.slice(0, -3) // full path sans .md — the sibling dir
110
- const newBase = newRel.slice(0, -3)
116
+ const newName = basename(newBase)
111
117
  // docs-root-relative id: refs inside a wiki usually omit the top dir
112
118
  // (`build/state`, not `wiki/build/state`) — sweep both forms
113
119
  const tail = (p: string): string | null => { const seg = p.split('/'); return seg.length >= 3 ? seg.slice(1).join('/') : null }
114
120
  const oldId = tail(oldBase)
115
121
  const newId = tail(newBase)
122
+ const newPageId = tail(newRel.slice(0, -3))
116
123
 
117
124
  // longest-first so `wiki/x/state.md` beats `x/state` beats bare tokens
118
125
  const pairs: [string, string][] = [
119
- [`${oldBase}.md`, `${newBase}.md`],
120
- ...(oldId != null ? [[`${oldId}.md`, `${newId}.md`] as [string, string]] : []),
126
+ [`${oldBase}.md`, newRel],
127
+ ...(oldId != null ? [[`${oldId}.md`, `${newPageId}.md`] as [string, string]] : []),
121
128
  // probe file is named after its page; DIR-qualified so another
122
129
  // page's same-named check.ts in a different dir never gets rewritten
123
130
  ...SIBLING_SUFFIXES.flatMap((sfx): [string, string][] => [
@@ -142,7 +149,9 @@ export function movePage(root: string, oldRel: string, newRel: string, io: MvIo,
142
149
  // whole subtree, and the probe is renamed after the page, so its own entry
143
150
  // is written LAST and wins over the subtree rule.
144
151
  const moves = new Map<string, string>([[oldRel, newRel]])
145
- if (existsSync(join(root, oldBase))) {
152
+ // an asset dir is one git tracks: an empty leftover dir is not, and git mv refuses it
153
+ const hasDir = tracked.some((f) => f.startsWith(`${oldBase}/`))
154
+ if (hasDir) {
146
155
  moves.set(oldBase, newBase)
147
156
  for (const f of tracked) if (f.startsWith(`${oldBase}/`)) moves.set(f, `${newBase}${f.slice(oldBase.length)}`)
148
157
  for (const sfx of SIBLING_SUFFIXES) {
@@ -171,10 +180,15 @@ export function movePage(root: string, oldRel: string, newRel: string, io: MvIo,
171
180
  // moves AFTER the sweep (the sweep rewrote files at their old paths).
172
181
  // git mv refuses into a directory that is not there yet, and a move
173
182
  // between directories is the case where it usually is not
183
+ // the index form moves the asset dir FIRST, so it becomes the topic
184
+ // folder; created first, git mv would nest it one level down
185
+ if (!hasDir && existsSync(join(root, oldBase)) && readdirSync(join(root, oldBase)).every((e) => e === '.DS_Store')) rmSync(join(root, oldBase), { recursive: true })
186
+ mkdirSync(join(root, dirOf(hasDir ? newBase : newRel)), { recursive: true })
187
+ if (indexForm && hasDir && !inPlace) sh(`git mv ${JSON.stringify(oldBase)} ${JSON.stringify(newBase)}`, root)
174
188
  mkdirSync(join(root, dirOf(newRel)), { recursive: true })
175
189
  sh(`git mv ${JSON.stringify(oldRel)} ${JSON.stringify(newRel)}`, root)
176
- if (existsSync(join(root, oldBase))) {
177
- sh(`git mv ${JSON.stringify(oldBase)} ${JSON.stringify(newBase)}`, root)
190
+ if (hasDir) {
191
+ if (!indexForm) sh(`git mv ${JSON.stringify(oldBase)} ${JSON.stringify(newBase)}`, root)
178
192
  // the probe is named after its page, so it only moves when the NAME
179
193
  // changed. A move that keeps the name and changes the directory takes
180
194
  // the probe along inside the dir, and `git mv X X` is a fatal
@@ -184,11 +198,7 @@ export function movePage(root: string, oldRel: string, newRel: string, io: MvIo,
184
198
  }
185
199
  }
186
200
 
187
- // repo-specific re-stamps (e.g. wiki depth frontmatter) — loud on failure
188
- const pkg = existsSync(join(root, 'package.json')) ? (JSON.parse(readFileSync(join(root, 'package.json'), 'utf8')) as { scripts?: Record<string, string> }) : {}
189
- if (pkg.scripts?.['mv:after'] != null) {
190
- try { execSync('bun run mv:after', { cwd: root, stdio: 'inherit' }) } catch { return die('mv:after failed, fix before committing') }
191
- }
201
+ if (o.after !== false && !runAfter(root)) return die('mv:after failed, fix before committing')
192
202
  if (o.commit === true) {
193
203
  sh('git add -A', root)
194
204
  try {
@@ -198,3 +208,34 @@ export function movePage(root: string, oldRel: string, newRel: string, io: MvIo,
198
208
  io.print(`ok: ${oldBase} → ${newBase}${o.commit === true ? ' (committed)' : ''}`)
199
209
  return 0
200
210
  }
211
+
212
+ /** the repo's own follow up to a move (`mv:after` in package.json), loud on failure */
213
+ function runAfter(root: string): boolean {
214
+ const pkg = existsSync(join(root, 'package.json')) ? (JSON.parse(readFileSync(join(root, 'package.json'), 'utf8')) as { scripts?: Record<string, string> }) : {}
215
+ if (pkg.scripts?.['mv:after'] == null) return true
216
+ try { execSync('bun run mv:after', { cwd: root, stdio: 'inherit' }); return true } catch { return false }
217
+ }
218
+
219
+ /** a move map: one `<old> <new>` pair per line, `#` comments and blank lines skipped */
220
+ export function parseMoveMap(text: string): [string, string][] {
221
+ return text.split('\n').map((l) => l.replace(/#.*/, '').trim()).filter(Boolean).map((l, i) => {
222
+ const parts = l.split(/\s+/)
223
+ if (parts.length !== 2) throw new Error(`move map line ${i + 1}: want "<old> <new>", got "${l}"`)
224
+ return [parts[0]!, parts[1]!]
225
+ })
226
+ }
227
+
228
+ /** many pages in one run, in map order: each move sweeps the tree the previous
229
+ * one left, and `mv:after` runs once at the end. A dry run shows each move
230
+ * against the CURRENT tree, so a later pair that depends on an earlier one
231
+ * only reports true once applied. Stops at the first failure. */
232
+ export function movePages(root: string, pairs: [string, string][], io: MvIo, o: MvOpts = {}): number {
233
+ if (o.commit === true) { io.printErr('FAIL: a move map applies with --write, then you commit what you own'); return 1 }
234
+ for (const [from, to] of pairs) {
235
+ const code = movePage(root, from, to, io, { ...o, after: false })
236
+ if (code !== 0) return code
237
+ }
238
+ if (o.write === true && !runAfter(root)) { io.printErr('FAIL: mv:after failed, fix before committing'); return 1 }
239
+ io.print(`ok: ${pairs.length} move(s)${o.write === true ? '' : ' (dry run)'}`)
240
+ return 0
241
+ }
@@ -1,4 +1,4 @@
1
- // a repo page's request sent on to the repo's process and streamed back (wiki build/shipkit/project-pages.md, The
1
+ // a repo page's request sent on to the repo's process and streamed back (wiki tools/shipkit/project-pages.md, The
2
2
  // proxy): the daemon's hub route and the web's direct path both go through here. Light on purpose: the web imports it
3
3
  /** what names the browser or this hop: the page's process sees a plain local client */
4
4
  const DROP = new Set(['host', 'origin', 'referer', 'sec-fetch-site', 'sec-fetch-mode', 'sec-fetch-dest', 'connection', 'keep-alive', 'content-length'])
@@ -1,4 +1,4 @@
1
- // the page side of a repo page's frame (wiki build/shipkit/project-pages.md, The frame contract): the one module a
1
+ // the page side of a repo page's frame (wiki tools/shipkit/project-pages.md, The frame contract): the one module a
2
2
  // repo's page bundles to live in the hub. No framework, no hub code beyond the keys table. Framed, it speaks the
3
3
  // `{ shipkit: <verb> }` messages on its origin; alone at its own url, it keeps the keys in its own address, so the
4
4
  // page works the same either way
@@ -1,4 +1,4 @@
1
- // a repo's own pages on the hub (wiki build/shipkit/project-pages.md): their list, and the proxy that serves each one
1
+ // a repo's own pages on the hub (wiki tools/shipkit/project-pages.md): their list, and the proxy that serves each one
2
2
  // from the repo's process under the hub's origin, `/page/<id>/<rest>` to `<url><rest>`, streamed both ways. The one
3
3
  // constraint a reader breaks first: a page must use relative paths, an absolute one reaches the hub, never the page
4
4
  import { forwardPage, pagePath } from './forward.ts'
package/src/pages/unit.ts CHANGED
@@ -1,4 +1,4 @@
1
- // a repo's own pages in its hub (wiki build/shipkit/project-pages.md): a `page({...})` unit of any `<name>.shipkit.ts`,
1
+ // a repo's own pages in its hub (wiki tools/shipkit/project-pages.md): a `page({...})` unit of any `<name>.shipkit.ts`,
2
2
  // one page or an array of them as the default export. Every unit file imports this module, so it stays light: the
3
3
  // daemon reads the declarations and never the page's code
4
4
  import { existsSync } from 'node:fs'
@@ -379,7 +379,7 @@ export class Planner {
379
379
  }
380
380
 
381
381
  /** the last results of every repo whose look is due, read one repo at a time with the loop given back between
382
- * two, so the sync reads of the run records never stand together (wiki build/shipkit/home.md, Nothing heavy on
382
+ * two, so the sync reads of the run records never stand together (wiki tools/shipkit/home.md, Nothing heavy on
383
383
  * the daemon's loop). The host calls it before `tick`, which then finds them read */
384
384
  async refresh(): Promise<void> {
385
385
  for (const r of [...this.repos.values()]) {
@@ -127,7 +127,7 @@ export function repoSource(d: RepoSourceDeps): PlanSource {
127
127
  const facts = new Map<string, string>()
128
128
  const cache = (): WorldCache => ({ db: answersDb(d.root), ns: d.config().name, now: Date.now })
129
129
  /** the three reads of the run record the plan looks at every LAST_EVERY_MS, read again only once the record moved:
130
- * over a large record they are a sync read of every run (wiki build/shipkit/home.md, Nothing heavy on the daemon's
130
+ * over a large record they are a sync read of every run (wiki tools/shipkit/home.md, Nothing heavy on the daemon's
131
131
  * loop) */
132
132
  let held: { stamp: string; results: Record<string, LastResult>; costs: Record<string, { at: number; ms: number }>; gatedAt: number | null } | null = null
133
133
  const readRecord = (): NonNullable<typeof held> => {
@@ -1,4 +1,4 @@
1
- // what an npm unit publishes names nothing of the house (wiki build/shipkit/units.md): the file list is npm's own
1
+ // what an npm unit publishes names nothing of the house (wiki tools/shipkit/units.md): the file list is npm's own
2
2
  // pack list, the words come from the data (house repos, identities, the keyword file), so a new repo or identity is
3
3
  // covered the day it exists. A hit reports file:line and the masked word, never the word
4
4
  import { createHash } from 'crypto'
@@ -6,7 +6,7 @@ import { existsSync, readdirSync, readFileSync, statSync } from 'fs'
6
6
  import { homedir } from 'os'
7
7
  import { dirname, join, relative } from 'path'
8
8
  import { scanFleet } from '../fleet/scan-fleet.ts'
9
- import { evaluateLeak, globalAllowFile, globalKeywordFile, leakAllowProblem, loadAllowFile, maskPattern, occurrences, parsePatterns, patternFingerprint, type LoadedAllow } from '../hooks/leak-guard.ts'
9
+ import { evaluateLeak, globalAllowFile, withBuiltinRows, globalKeywordFile, leakAllowProblem, loadAllowFile, maskPattern, occurrences, parsePatterns, patternFingerprint, type LoadedAllow } from '../hooks/leak-guard.ts'
10
10
  import { readIdentities, type Identities } from '../identities/identities.ts'
11
11
  import { KEYWORD_FILE, LAYOUT } from '../core/layout.ts'
12
12
  import { parseDirectives, reaches } from '../core/waivers.ts'
@@ -119,7 +119,9 @@ export function allowedWords(pkg: Pkg): AllowedWord[] {
119
119
  const BINARY = /\.(png|jpe?g|gif|webp|ico|woff2?|ttf|eot|otf|zip|gz|wasm|mp3|mp4|ogg|wav|flac|node)$/i
120
120
 
121
121
  /** `directive`: the reason of the in-file `sk-disable-… SK035` that waives the site, null when none does */
122
- export type PublicSite = { file: string; line: number; masked: string; fingerprint: string; what: string; directive: string | null }
122
+ /** `count`: the matches of this pattern in this file, what an allowlist entry's `count` names. `over`: an entry
123
+ * allowed fewer */
124
+ export type PublicSite = { file: string; line: number; masked: string; fingerprint: string; what: string; directive: string | null; count: number; over?: { count: number; source: string } }
123
125
 
124
126
  export const PUBLIC_CLEAN_ID = 'SK035'
125
127
 
@@ -196,11 +198,12 @@ export function scanPublic(o: PublicCleanInput): Omit<PublicCleanResult, 'files'
196
198
  const file = h.file!
197
199
  const content = byFile.get(file) ?? ''
198
200
  if (!found.has(file)) found.set(file, occurrences(content, patterns))
199
- const lines = new Set((found.get(file)!.get(h.pattern) ?? []).map(([s]) => lineAt(content, s)))
201
+ const spans = found.get(file)!.get(h.pattern) ?? []
202
+ const lines = new Set(spans.map(([s]) => lineAt(content, s)))
200
203
  const label = what.get(h.pattern) ?? 'a keyword row'
201
204
  const directives = parseDirectives(file, content).filter((d) => d.reason != null && d.ids.includes(PUBLIC_CLEAN_ID))
202
205
  for (const line of [...lines].sort((a, b) => a - b))
203
- sites.push({ file, line, masked: maskPattern(h.pattern), fingerprint: patternFingerprint(h.pattern), what: label, directive: directives.find((d) => reaches(d, line))?.reason ?? null })
206
+ sites.push({ file, line, masked: maskPattern(h.pattern), fingerprint: patternFingerprint(h.pattern), what: label, directive: directives.find((d) => reaches(d, line))?.reason ?? null, count: spans.length, ...(h.over == null ? {} : { over: { count: h.over.count, source: h.over.source } }) })
204
207
  }
205
208
  sites.sort((a, b) => a.file.localeCompare(b.file) || a.line - b.line)
206
209
  return { hits: sites, refused, allowed, waived: waived.map((w) => ({ file: w.file ?? w.where, masked: maskPattern(w.pattern), reason: w.reason, source: w.source })) }
@@ -249,7 +252,7 @@ export async function publicClean(root: string, config: RepoConfig, unit: { dir:
249
252
  rel,
250
253
  files,
251
254
  words: [...houseRepoWords(root), ...(ids == null ? [] : identityWords(ids))],
252
- keywordText: kwFiles.map((f) => read(f) ?? '').join('\n'),
255
+ keywordText: withBuiltinRows(kwFiles.map((f) => read(f) ?? '')),
253
256
  allowedWords: allowedWords(pkg),
254
257
  allow: allow.entries,
255
258
  })
@@ -257,12 +260,27 @@ export async function publicClean(root: string, config: RepoConfig, unit: { dir:
257
260
  }
258
261
 
259
262
  /** the release preflight's refusals: one line a site, the word masked */
263
+ /** the packed files that name a checkout the house config lists under `start.skip` (a day-job repo): such a
264
+ * tarball never ships, and no waiver lifts it. The names come from the machine, so this file names none */
265
+ export function skippedNameSites(files: readonly { file: string; content: string }[], names: readonly string[]): string[] {
266
+ const lower = names.map((n) => n.toLowerCase()).filter((n) => n !== '')
267
+ return files.filter((f) => lower.some((n) => f.content.toLowerCase().includes(n))).map((f) => f.file)
268
+ }
269
+
260
270
  export async function publicCleanBlockers(root: string, config: RepoConfig, unit: { id: string; dir: string; targets: { npm: boolean } }): Promise<string[]> {
261
271
  if (!unit.targets.npm) return []
272
+ const { houseSkip } = await import('../start-repo.ts')
273
+ const skip = await houseSkip(homedir())
274
+ if (skip.length > 0) {
275
+ const listed = await packList(unit.dir)
276
+ if ('error' in listed) return [`unit '${unit.id}': ${listed.error}`]
277
+ const named = skippedNameSites(listed.files.map((f) => ({ file: f, content: readPlain(join(unit.dir, f)) ?? '' })), skip)
278
+ if (named.length > 0) return [`unit '${unit.id}': its tarball names a checkout the house never publishes (start.skip in the house config), no waiver lifts it:\n${named.join('\n')}`]
279
+ }
262
280
  const r = await publicClean(root, config, unit)
263
281
  const sites = [...r.refused.map((x) => `${x.file}: ${x.why}`), ...r.hits.filter((h) => h.directive == null).map((h) => `${h.file}:${h.line}: names ${h.what} (${h.masked}, ${h.fingerprint})`)]
264
282
  if (sites.length === 0) return []
265
- return [`unit '${unit.id}': its tarball names the house (rule SK035, build/shipkit/units.md), ${sites.length} site${sites.length === 1 ? '' : 's'}:\n${sites.slice(0, 20).join('\n')}${sites.length > 20 ? `\n… ${sites.length - 20} more: sk ci --only SK035` : ''}`]
283
+ return [`unit '${unit.id}': its tarball names the house (rule SK035, tools/shipkit/units.md), ${sites.length} site${sites.length === 1 ? '' : 's'}:\n${sites.slice(0, 20).join('\n')}${sites.length > 20 ? `\n… ${sites.length - 20} more: sk ci --only SK035` : ''}`]
266
284
  }
267
285
 
268
286
  /** every file under `dir` on the disk, ignored ones included (npm packs a gitignored file under `files`), as
@@ -254,7 +254,7 @@ export async function runBump(root: string, config: RepoConfig, kind: BumpKind |
254
254
  const s = new Set<string>([LAYOUT.status])
255
255
  if (c.docsBase != null) {
256
256
  const base = c.docsBase.startsWith('~/') ? join(homedir(), c.docsBase.slice(2)) : c.docsBase
257
- const page = join(base, 'build/shipkit/local-projects.md')
257
+ const page = join(base, 'tools/shipkit/local-projects.md')
258
258
  const prefix = r.endsWith('/') ? r : `${r}/`
259
259
  if (page.startsWith(prefix)) s.add(relative(r, page))
260
260
  }