rvlib-shipkit 2.22.1 → 2.24.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 (139) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/package.json +1 -1
  3. package/src/agent-time/render.ts +28 -14
  4. package/src/agent-time/report.ts +46 -25
  5. package/src/agent-time/store.ts +30 -10
  6. package/src/agent-time/timeline.ts +43 -15
  7. package/src/annex/annex.ts +3 -0
  8. package/src/annex/born.ts +464 -0
  9. package/src/annex/flush.ts +46 -0
  10. package/src/annex/offload.ts +171 -38
  11. package/src/annex/snapshots.ts +53 -0
  12. package/src/annex/tidy.ts +368 -0
  13. package/src/asks/asks-queue.ts +32 -11
  14. package/src/checks/SK041-annex-links.check.ts +4 -2
  15. package/src/checks/SK043-scratch-on-the-mac.check.ts +45 -0
  16. package/src/checks/SK044-behind-upstream.check.ts +38 -0
  17. package/src/cli/cmd_Annex.ts +60 -9
  18. package/src/cli/cmd_Asks.ts +2 -0
  19. package/src/cli/cmd_Backup.ts +7 -5
  20. package/src/cli/cmd_Bump.ts +1 -0
  21. package/src/cli/cmd_Capacity.ts +26 -0
  22. package/src/cli/cmd_Check.ts +1 -0
  23. package/src/cli/cmd_Checks.ts +1 -0
  24. package/src/cli/cmd_Ci.ts +1 -0
  25. package/src/cli/cmd_Commands.ts +50 -14
  26. package/src/cli/cmd_Home.ts +0 -1
  27. package/src/cli/cmd_Hooks.ts +1 -0
  28. package/src/cli/cmd_Mv.ts +1 -0
  29. package/src/cli/cmd_Rec.ts +17 -7
  30. package/src/cli/cmd_Reflect.ts +1 -0
  31. package/src/cli/cmd_Releases.ts +1 -0
  32. package/src/cli/cmd_Review.ts +124 -17
  33. package/src/cli/cmd_Secret.ts +41 -2
  34. package/src/cli/cmd_Shot.ts +1 -0
  35. package/src/cli/cmd_Status.ts +1 -0
  36. package/src/cli/cmd_Time.ts +3 -1
  37. package/src/cli/cmd_Tmp.ts +82 -0
  38. package/src/cli/cmd_Wiki.ts +1 -0
  39. package/src/cli/registry.ts +13 -1
  40. package/src/collections/pings.ts +1 -1
  41. package/src/core/capacity.ts +71 -0
  42. package/src/core/check-runner.ts +86 -15
  43. package/src/core/machine-db.ts +8 -0
  44. package/src/core/motherhome.ts +67 -9
  45. package/src/core/slots.ts +49 -12
  46. package/src/core/trace-audit.ts +4 -1
  47. package/src/drill/run.ts +5 -2
  48. package/src/home/daemon-jobs.ts +10 -3
  49. package/src/home/global-units.ts +3 -0
  50. package/src/home/gui-app/ShipkitGui.swift +1 -0
  51. package/src/home/home-launchd.ts +11 -3
  52. package/src/home/home-routes.ts +11 -4
  53. package/src/home/machine-host.ts +65 -0
  54. package/src/home/machine-stores.ts +30 -4
  55. package/src/home/machine-temp.ts +493 -0
  56. package/src/home/other-macs.ts +74 -0
  57. package/src/home/pm.ts +4 -1
  58. package/src/home/run-daemon.ts +10 -2
  59. package/src/home/run-pm.ts +1 -0
  60. package/src/home/serve-web.ts +2 -2
  61. package/src/home/via-hub.ts +6 -1
  62. package/src/identities/identities.ts +92 -24
  63. package/src/init-repo.ts +7 -3
  64. package/src/ledger/ledger.ts +6 -0
  65. package/src/ledger/store.ts +6 -0
  66. package/src/media-store/backup/keys.ts +21 -6
  67. package/src/media-store/backup/manifest.ts +52 -11
  68. package/src/media-store/backup/restore.ts +17 -10
  69. package/src/media-store/backup/run.ts +5 -2
  70. package/src/media-store/backup/sources.ts +2 -1
  71. package/src/media-store/daemon.ts +2 -2
  72. package/src/media-store/purge.ts +4 -0
  73. package/src/mv/mv-md.ts +121 -42
  74. package/src/recordings/load.ts +3 -3
  75. package/src/recordings/model.ts +7 -0
  76. package/src/recordings/open.ts +12 -0
  77. package/src/recordings/presets.ts +12 -5
  78. package/src/recordings/recorder-app/Capture.swift +34 -5
  79. package/src/recordings/recorder-app/Clip.swift +126 -17
  80. package/src/recordings/recorder-app/Editor.swift +177 -7
  81. package/src/recordings/recorder-app/Hud.swift +189 -0
  82. package/src/recordings/recorder-app/Tray.swift +179 -36
  83. package/src/recordings/recorder-app/icon.svg +16 -0
  84. package/src/recordings/recorder-app/main.swift +349 -18
  85. package/src/recordings/recorder-app.ts +8 -4
  86. package/src/recordings/recorder.shipkit.ts +2 -1
  87. package/src/recordings/routes.ts +52 -6
  88. package/src/recordings/run-recorder.ts +2 -1
  89. package/src/recordings/share.ts +27 -0
  90. package/src/recordings/take.ts +36 -4
  91. package/src/recordings/view.ts +11 -0
  92. package/src/reflect/transcript.ts +56 -11
  93. package/src/releases/from-card.ts +45 -3
  94. package/src/releases/model.ts +6 -0
  95. package/src/releases/store.ts +8 -1
  96. package/src/repo-config.ts +14 -4
  97. package/src/review/cells.ts +24 -3
  98. package/src/review/format.ts +33 -9
  99. package/src/review/media-kind.ts +14 -11
  100. package/src/review/media-read.ts +6 -5
  101. package/src/review/model.ts +104 -7
  102. package/src/review/paste.ts +2 -1
  103. package/src/review/previews.ts +123 -36
  104. package/src/review/routes.ts +29 -18
  105. package/src/review/store.ts +74 -12
  106. package/src/review/threads.ts +7 -5
  107. package/src/secrets/copy.ts +110 -0
  108. package/src/secrets/list.ts +17 -7
  109. package/src/serve/hub-app/home-strip.css +5 -0
  110. package/src/serve/hub-app/home-strip.tsx +18 -0
  111. package/src/serve/hub-app/hub-app.tsx +2 -1
  112. package/src/serve/hub-app/hub.css +18 -0
  113. package/src/serve/hub-app/inbox.css +1 -0
  114. package/src/serve/hub-app/pull-refresh.tsx +88 -0
  115. package/src/serve/hub-app/recordings-st.ts +135 -24
  116. package/src/serve/hub-app/recordings-view.tsx +293 -54
  117. package/src/serve/hub-app/recordings.css +77 -24
  118. package/src/serve/hub-app/review/review-cells.tsx +52 -13
  119. package/src/serve/hub-app/review/review-list.tsx +6 -1
  120. package/src/serve/hub-app/review/review-st.ts +6 -5
  121. package/src/serve/hub-app/review/review-thread.tsx +3 -1
  122. package/src/serve/hub-app/review/review-views.tsx +18 -11
  123. package/src/serve/hub-app/review/thread-st.ts +82 -14
  124. package/src/serve/hub-app/review.css +15 -2
  125. package/src/serve/hub-runtime.ts +2 -1
  126. package/src/serve/run-serve.ts +4 -2
  127. package/src/serve/serve-hub.ts +9 -2
  128. package/src/shipkit-files.ts +5 -0
  129. package/src/social/drafts.ts +4 -3
  130. package/src/social/load.ts +7 -2
  131. package/src/social/publish/discord.ts +10 -3
  132. package/src/suite/child-tools.ts +45 -0
  133. package/src/suite/judge-suites.ts +10 -22
  134. package/src/suite/select.ts +83 -8
  135. package/src/suite/suite-cli.ts +38 -14
  136. package/src/suite/suite-cores.ts +68 -0
  137. package/src/suite/suite-reads-preload.ts +8 -6
  138. package/src/ts/config.ts +44 -0
  139. package/src/ts/rename.ts +11 -1
@@ -29,6 +29,7 @@ import * as cpLive from 'node:child_process'
29
29
  import { appendFileSync, realpathSync } from 'node:fs'
30
30
  import { isAbsolute, join, relative, resolve, sep } from 'node:path'
31
31
  import { fileURLToPath } from 'node:url'
32
+ import { childCwd, readsNoFile } from './child-tools.ts'
32
33
  import { SUITE_OWNER_ENV, SUITE_READS_ENV, SUITE_ROOT_ENV } from './reads-env.ts'
33
34
 
34
35
  const out = process.env[SUITE_READS_ENV]
@@ -174,7 +175,7 @@ function install(outFile: string, rootDir: string): void {
174
175
  }
175
176
  const SHELLS = new Set(['sh', 'bash', 'zsh', 'dash', 'fish', 'env', 'xargs', 'nice', 'time', 'timeout'])
176
177
  // tools that read only the files their arguments name, nothing they find through them
177
- const FILE_TOOLS = new Set(['true', 'false', 'echo', 'sleep', 'kill', 'rm', 'mkdir', 'touch', 'cwebp', 'dwebp'])
178
+ const FILE_TOOLS = new Set(['true', 'false', 'echo', 'sleep', 'kill', 'rm', 'mkdir', 'touch', 'chmod', 'mkfifo', 'cp', 'cwebp', 'dwebp'])
178
179
  const isBun = (bin: unknown): boolean => typeof bin === 'string' && (bin === 'bun' || bin === process.execPath || /(^|\/)bun$/.test(bin))
179
180
  const childEnv = (env: unknown): Record<string, string | undefined> => {
180
181
  const base = (typeof env === 'object' && env != null ? env : process.env) as Record<string, string | undefined>
@@ -188,14 +189,15 @@ function install(outFile: string, rootDir: string): void {
188
189
  }
189
190
  }
190
191
  // a child that is not bun reads what nobody records. It is trusted only
191
- // when it runs outside the repo and names nothing in it (git in a temp
192
- // repo); a tool known to read only the files it names (cwebp) records
193
- // them; any other child in or about the repo makes its module opaque
192
+ // when it opens no file at all (ps, lsof of a port), when it runs outside
193
+ // the repo and names nothing in it (git in a temp repo, or `git -C` one);
194
+ // a tool known to read only the files it names (cwebp) records them; any
195
+ // other child in or about the repo makes its module opaque
194
196
  const spawned = (cmd: unknown, cwdOpt: unknown): void => {
195
197
  const argv = (Array.isArray(cmd) ? cmd : typeof cmd === 'string' ? [cmd] : []).map(String)
196
- if (isBun(argv[0])) return
198
+ if (isBun(argv[0]) || readsNoFile(argv)) return
197
199
  const tool = (argv[0] ?? '?').split('/').pop() ?? '?'
198
- const cwd = typeof cwdOpt === 'string' ? resolve(cwdOpt) : cwdOpt instanceof URL ? fileURLToPath(cwdOpt) : process.cwd()
200
+ const cwd = childCwd(argv, typeof cwdOpt === 'string' ? resolve(cwdOpt) : cwdOpt instanceof URL ? fileURLToPath(cwdOpt) : process.cwd())
199
201
  const shell = SHELLS.has(tool)
200
202
  const words = argv.slice(1).flatMap((a) => (shell ? a.split(/[\s;&|<>()'"`=]+/) : [a.replace(/^--?[\w-]+=/, '')])).filter((w) => w !== '' && !w.startsWith('-'))
201
203
  const inRepo: string[] = []
package/src/ts/config.ts CHANGED
@@ -117,6 +117,50 @@ function discoverPackages(root: string, roots: string[], skip: string[], vendore
117
117
  return found.sort((a, b) => b.dir.length - a.dir.length)
118
118
  }
119
119
 
120
+ // the package.json `workspaces` (an array, or `{ packages }`), each a dir or a glob of dirs, with each one's `exports`:
121
+ // a workspace outside the roots is still imported by its name, and the test selection's graph follows that edge
122
+ export function workspacePackages(root: string, vendored: readonly string[] = []): (RvtPackage & { exports?: unknown })[] {
123
+ let globs: string[] = []
124
+ try {
125
+ const w = (JSON.parse(readFileSync(join(root, 'package.json'), 'utf8')) as { workspaces?: string[] | { packages?: string[] } }).workspaces
126
+ globs = Array.isArray(w) ? w : w?.packages ?? []
127
+ } catch {
128
+ return []
129
+ }
130
+ const dirs = (pattern: string): string[] => {
131
+ let at = ['']
132
+ for (const seg of pattern.replace(/\/+$/, '').split('/')) {
133
+ if (!seg.includes('*')) {
134
+ at = at.map((d) => (d === '' ? seg : `${d}/${seg}`))
135
+ continue
136
+ }
137
+ const re = new RegExp(`^${seg.replace(/[.+?^${}()|[\]\\]/g, '\\$&').replace(/\*/g, '.*')}$`)
138
+ at = at.flatMap((d) => {
139
+ try {
140
+ return readdirSync(join(root, d), { withFileTypes: true }).filter((e) => e.isDirectory() && re.test(e.name)).map((e) => (d === '' ? e.name : `${d}/${e.name}`))
141
+ } catch {
142
+ return []
143
+ }
144
+ })
145
+ }
146
+ return at
147
+ }
148
+ const out: (RvtPackage & { exports?: unknown })[] = []
149
+ for (const g of globs) {
150
+ if (g.startsWith('!')) continue
151
+ for (const dir of dirs(g)) {
152
+ if (isVendored(dir, vendored)) continue
153
+ try {
154
+ const m = JSON.parse(readFileSync(join(root, dir, 'package.json'), 'utf8')) as { name?: string; exports?: unknown }
155
+ if (m.name != null && m.name !== '') out.push({ name: m.name, dir, ...(m.exports !== undefined ? { exports: m.exports } : {}) })
156
+ } catch {
157
+ // no named manifest: not a package
158
+ }
159
+ }
160
+ }
161
+ return out
162
+ }
163
+
120
164
  export function loadConfig(cwd: string = process.cwd()): RvtConfig {
121
165
  const root = findRepoRoot(cwd)
122
166
  let roots: string[] = []
package/src/ts/rename.ts CHANGED
@@ -251,6 +251,16 @@ function relativeRewrites(file: string, content: string, movedTo: (rel: string)
251
251
  return out
252
252
  }
253
253
 
254
+ /** the next occurrence of a path that ENDS there: `server/staged` inside
255
+ * `server/staged.ts` or `server/staged-x` names another file, never the folder */
256
+ function pathAt(text: string, needle: string, from: number): number {
257
+ for (let idx = text.indexOf(needle, from); idx !== -1; idx = text.indexOf(needle, idx + 1)) {
258
+ const next = text.slice(idx + needle.length, idx + needle.length + 2)
259
+ if (!/^[\w-]/.test(next) && !/^\.\w/.test(next)) return idx
260
+ }
261
+ return -1
262
+ }
263
+
254
264
  // simultaneous multi-needle replace: earliest match wins (longest needle on a
255
265
  // tie) and the scan continues PAST the replacement — sequential split/join
256
266
  // would let one pair's output feed the next (the package form is a substring
@@ -264,7 +274,7 @@ function scanPairs(text: string, pairs: { from: string; to: string }[]): { text:
264
274
  let hit: { from: string; to: string } | null = null
265
275
  for (const p of pairs) {
266
276
  if (p.from.length === 0) continue
267
- const idx = text.indexOf(p.from, i)
277
+ const idx = pathAt(text, p.from, i)
268
278
  if (idx === -1) continue
269
279
  if (at === -1 || idx < at || (idx === at && p.from.length > (hit?.from.length ?? 0))) {
270
280
  at = idx