rvlib-shipkit 2.23.0 → 2.25.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 (150) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/package.json +1 -1
  3. package/src/agent-time/live.ts +153 -0
  4. package/src/agent-time/render.ts +28 -14
  5. package/src/agent-time/report.ts +46 -25
  6. package/src/agent-time/store.ts +30 -10
  7. package/src/agent-time/timeline.ts +43 -15
  8. package/src/annex/offload.ts +16 -7
  9. package/src/asks/asks-queue.ts +32 -11
  10. package/src/check.ts +3 -1
  11. package/src/checks/SK004-gitignore-policy.check.ts +32 -11
  12. package/src/checks/SK027-agent-wiki-links.check.ts +1 -1
  13. package/src/checks/SK033-global-contribution.check.ts +1 -1
  14. package/src/checks/SK036-draft-media-size.check.ts +1 -1
  15. package/src/checks/SK040-release-words.check.ts +1 -1
  16. package/src/checks/SK042-post-kinds.check.ts +1 -1
  17. package/src/checks/SK044-behind-upstream.check.ts +38 -0
  18. package/src/cli/cmd_Annex.ts +12 -7
  19. package/src/cli/cmd_Asks.ts +2 -0
  20. package/src/cli/cmd_Assets.ts +5 -5
  21. package/src/cli/cmd_Backup.ts +16 -8
  22. package/src/cli/cmd_Bump.ts +1 -0
  23. package/src/cli/cmd_Capacity.ts +30 -0
  24. package/src/cli/cmd_Check.ts +1 -0
  25. package/src/cli/cmd_Checks.ts +13 -1
  26. package/src/cli/cmd_Ci.ts +3 -2
  27. package/src/cli/cmd_Commands.ts +61 -16
  28. package/src/cli/cmd_ConfigKeys.ts +17 -0
  29. package/src/cli/cmd_Home.ts +1 -30
  30. package/src/cli/cmd_Hooks.ts +1 -0
  31. package/src/cli/cmd_Keys.ts +4 -1
  32. package/src/cli/cmd_Lanes.ts +35 -0
  33. package/src/cli/cmd_Mv.ts +7 -7
  34. package/src/cli/cmd_Rec.ts +22 -7
  35. package/src/cli/cmd_Reflect.ts +1 -0
  36. package/src/cli/cmd_Releases.ts +1 -0
  37. package/src/cli/cmd_Review.ts +200 -49
  38. package/src/cli/cmd_Secret.ts +41 -2
  39. package/src/cli/cmd_Shot.ts +16 -4
  40. package/src/cli/cmd_Status.ts +7 -5
  41. package/src/cli/cmd_Time.ts +13 -5
  42. package/src/cli/cmd_Tmp.ts +82 -0
  43. package/src/cli/cmd_Veille.ts +10 -6
  44. package/src/cli/cmd_Wiki.ts +1 -0
  45. package/src/cli/family-help.ts +136 -0
  46. package/src/cli/family-pages.ts +0 -19
  47. package/src/cli/kit/calls.ts +35 -0
  48. package/src/cli/kit/project-cli.ts +2 -12
  49. package/src/cli/registry.ts +52 -7
  50. package/src/cli.ts +8 -4
  51. package/src/collections/pings.ts +1 -1
  52. package/src/core/capacity.ts +127 -0
  53. package/src/core/check-runner.ts +91 -16
  54. package/src/core/floor-resolve.ts +6 -2
  55. package/src/core/floor.ts +6 -2
  56. package/src/core/history-files.ts +18 -0
  57. package/src/core/jobs.ts +35 -16
  58. package/src/core/layout.ts +2 -2
  59. package/src/core/motherhome.ts +67 -9
  60. package/src/core/nearest.ts +16 -0
  61. package/src/core/remove-tree.ts +19 -0
  62. package/src/core/runs.ts +12 -3
  63. package/src/core/slots.ts +49 -12
  64. package/src/core/throwaway-worktree.ts +22 -4
  65. package/src/core/trace-audit.ts +21 -5
  66. package/src/drill/run.ts +5 -2
  67. package/src/home/daemon-jobs.ts +41 -4
  68. package/src/home/gui-app/ShipkitGui.swift +1 -0
  69. package/src/home/home-launchd.ts +11 -3
  70. package/src/home/home-routes.ts +11 -4
  71. package/src/home/machine-host.ts +65 -0
  72. package/src/home/machine-stores.ts +19 -17
  73. package/src/home/machine-temp.ts +485 -0
  74. package/src/home/other-macs.ts +74 -0
  75. package/src/home/run-daemon.ts +10 -2
  76. package/src/home/serve-web.ts +2 -2
  77. package/src/home/via-hub.ts +6 -1
  78. package/src/init-repo.ts +7 -3
  79. package/src/ledger/gate-checks.ts +3 -2
  80. package/src/ledger/git-key.ts +25 -4
  81. package/src/ledger/git-scan.ts +10 -0
  82. package/src/ledger/ledger.ts +6 -0
  83. package/src/ledger/store.ts +6 -0
  84. package/src/media-store/backup/daemon.ts +92 -20
  85. package/src/media-store/backup/keys.ts +21 -6
  86. package/src/media-store/backup/manifest.ts +52 -11
  87. package/src/media-store/backup/restore.ts +17 -10
  88. package/src/media-store/backup/run.ts +26 -17
  89. package/src/media-store/backup/sources.ts +168 -22
  90. package/src/media-store/backup/watch.ts +106 -0
  91. package/src/media-store/daemon.ts +36 -8
  92. package/src/media-store/hand.ts +3 -1
  93. package/src/mv/mv-md.ts +167 -56
  94. package/src/pb/run-pb.ts +2 -10
  95. package/src/plan/repo-source.ts +25 -14
  96. package/src/recordings/model.ts +1 -1
  97. package/src/reflect/transcript.ts +56 -11
  98. package/src/release/run-bump.ts +3 -2
  99. package/src/release/run-release.ts +12 -4
  100. package/src/releases/from-card.ts +45 -3
  101. package/src/releases/model.ts +6 -0
  102. package/src/releases/store.ts +8 -1
  103. package/src/repo-config.ts +5 -3
  104. package/src/review/cells.ts +26 -4
  105. package/src/review/format.ts +34 -10
  106. package/src/review/media-kind.ts +14 -11
  107. package/src/review/media-read.ts +6 -5
  108. package/src/review/model.ts +85 -4
  109. package/src/review/paste.ts +2 -1
  110. package/src/review/previews.ts +123 -36
  111. package/src/review/routes.ts +29 -18
  112. package/src/review/store.ts +89 -19
  113. package/src/review/threads.ts +7 -5
  114. package/src/review/trailer-model.ts +2 -2
  115. package/src/secrets/copy.ts +110 -0
  116. package/src/secrets/list.ts +17 -7
  117. package/src/serve/hub-app/home-strip.css +5 -0
  118. package/src/serve/hub-app/home-strip.tsx +18 -0
  119. package/src/serve/hub-app/hub-app.tsx +2 -1
  120. package/src/serve/hub-app/hub.css +14 -0
  121. package/src/serve/hub-app/inbox.css +1 -0
  122. package/src/serve/hub-app/pull-refresh.tsx +88 -0
  123. package/src/serve/hub-app/review/review-cells.tsx +52 -13
  124. package/src/serve/hub-app/review/review-list.tsx +6 -1
  125. package/src/serve/hub-app/review/review-st.ts +6 -5
  126. package/src/serve/hub-app/review/review-thread.tsx +3 -1
  127. package/src/serve/hub-app/review/review-views.tsx +18 -11
  128. package/src/serve/hub-app/review/thread-st.ts +82 -14
  129. package/src/serve/hub-app/review.css +15 -2
  130. package/src/serve/hub-runtime.ts +2 -1
  131. package/src/serve/run-serve.ts +4 -2
  132. package/src/serve/serve-hub.ts +9 -2
  133. package/src/shot/client.ts +4 -2
  134. package/src/shot/serve-shot.ts +71 -2
  135. package/src/shot/shooter.ts +65 -11
  136. package/src/shot/shot-ask.ts +32 -9
  137. package/src/suite/child-tools.ts +45 -0
  138. package/src/suite/judge-suites.ts +10 -22
  139. package/src/suite/select.ts +95 -9
  140. package/src/suite/suite-cli.ts +38 -14
  141. package/src/suite/suite-cores.ts +68 -0
  142. package/src/suite/suite-reads-preload.ts +8 -6
  143. package/src/suite/test-units.ts +31 -12
  144. package/src/trailer/graph.ts +2 -1
  145. package/src/ts/config.ts +21 -0
  146. package/src/ts/rename.ts +37 -13
  147. package/src/ts/workspaces.ts +45 -0
  148. package/src/wiki/run-wiki.ts +7 -2
  149. package/src/wiki/scan-md.ts +2 -1
  150. package/src/home/claude-temp.ts +0 -139
@@ -23,21 +23,29 @@ export type Call = {
23
23
  perm: string
24
24
  /** it only read (turns.ts isReadOnly, judged when indexed) */
25
25
  read: boolean
26
+ /** the call returned while its command ran on in the background: `end`
27
+ * is when it returned, `bgEnd` when the run ended (its task notification),
28
+ * null while no end is recorded */
29
+ bg: boolean
30
+ bgEnd: number | null
26
31
  }
27
32
 
28
- export type Mark = { at: number; kind: 'prompt' | 'wake' | 'message' | 'reply' }
33
+ /** `end`: the agent ended its turn (a text block, stop_reason end_turn) */
34
+ export type Mark = { at: number; kind: 'prompt' | 'wake' | 'message' | 'reply' | 'end' }
29
35
 
30
36
  export type Stream = { calls: Call[]; marks: Mark[] }
31
37
 
32
- /** where a slice of wall time went */
33
- export type Bucket = 'model' | 'tools' | 'approval' | 'subagent' | 'background' | 'human' | 'idle'
38
+ /** where a slice of wall time went. `human`: stopped until his typed prompt;
39
+ * `parked`: stopped until a message relayed in (the coordinator, another
40
+ * session), so a lane that handed back and waits to be written to */
41
+ export type Bucket = 'model' | 'tools' | 'approval' | 'subagent' | 'background' | 'parked' | 'human' | 'idle' | 'unknown'
34
42
 
35
43
  export type Breakdown = Record<Bucket, number>
36
44
 
37
45
  /** a wait on him longer than this is the session parked, not a wait */
38
46
  export const IDLE_MS = 30 * 60 * 1000
39
47
 
40
- export const emptyBreakdown = (): Breakdown => ({ model: 0, tools: 0, approval: 0, subagent: 0, background: 0, human: 0, idle: 0 })
48
+ export const emptyBreakdown = (): Breakdown => ({ model: 0, tools: 0, approval: 0, subagent: 0, background: 0, parked: 0, human: 0, idle: 0, unknown: 0 })
41
49
 
42
50
  /** a foreground sub-agent call: the session waits on another agent's work */
43
51
  export const isAgentCall = (c: Call): boolean => c.tool === 'Agent' || c.tool === 'Task'
@@ -61,7 +69,7 @@ export type Closed = Call & { stop: number; open: boolean }
61
69
 
62
70
  /** sorted by start */
63
71
  export function closeCalls(s: Stream): Closed[] {
64
- const turns = s.marks.filter((m) => m.kind !== 'reply').map((m) => m.at).sort((a, b) => a - b)
72
+ const turns = s.marks.filter((m) => m.kind !== 'reply' && m.kind !== 'end').map((m) => m.at).sort((a, b) => a - b)
65
73
  let last = 0
66
74
  for (const m of s.marks) if (m.at > last) last = m.at
67
75
  for (const c of s.calls) if ((c.end ?? c.start) > last) last = c.end ?? c.start
@@ -77,20 +85,32 @@ export function closeCalls(s: Stream): Closed[] {
77
85
  /** the call's own duration in ms */
78
86
  export const callMs = (c: { start: number; stop: number }): number => Math.max(0, c.stop - c.start)
79
87
 
88
+ /** how long the command really ran: a background run from its start to its
89
+ * notification (null while none is recorded), any other call its own time */
90
+ export const runMs = (c: Closed): number | null => (!c.bg ? callMs(c) : c.bgEnd == null ? null : Math.max(0, c.bgEnd - c.start))
91
+
80
92
  type Point = { at: number; d: 'start' | 'stop' | Mark['kind']; lane: 'tool' | 'agent' | 'approval'; ix: number }
81
93
 
82
94
  /** the wall of one stream cut into buckets, clipped to [from, to]. Between two
83
95
  * boundaries: a tool in flight → tools; only calls waiting for his allow →
84
96
  * approval; only a sub-agent in flight → subagent;
85
97
  * nothing in flight and the next thing is his prompt → human (idle past
86
- * IDLE_MS); the next thing is a wake (a task notification, a hand-back) →
87
- * background; a message relayed in counts as a prompt (a sub-agent that
88
- * handed back sits parked until the coordinator or he writes to it); anything else → the model was working.
98
+ * IDLE_MS); a message relayed in → parked (idle past IDLE_MS: a sub-agent
99
+ * that handed back sits there until the coordinator writes to it); a wake (a
100
+ * task notification, a hand-back) → background. Else, when the agent ended
101
+ * its turn (an `end` mark) and nothing since: it was stopped, and no record
102
+ * says on what → unknown (idle past IDLE_MS); else the agent was in its turn,
103
+ * its API request in flight → model.
104
+ *
105
+ * Past the stream's last event nothing counts, a run that ended included,
106
+ * but one case: the report runs (`to`, finite) while the stream is stopped
107
+ * on a background run of its own that has no end yet, its stop under
108
+ * IDLE_MS old → background up to `to`.
89
109
  *
90
110
  * `turnModel` (one slot per closed call) receives the model stretch that
91
111
  * ended in each call: the turn that issued it, split evenly over the calls
92
- * of one batch. A stretch that ends in his prompt or a wake was the final
93
- * reply and goes to no call */
112
+ * of one batch. A stretch that ends in his prompt, a wake or the turn's end
113
+ * was the final reply and goes to no call */
94
114
  export function wallBreakdown(s: Stream, from = -Infinity, to = Infinity, idleMs = IDLE_MS, closed: Closed[] = closeCalls(s), turnModel?: Float64Array): Breakdown {
95
115
  const out = emptyBreakdown()
96
116
  const points: Point[] = []
@@ -104,6 +124,7 @@ export function wallBreakdown(s: Stream, from = -Infinity, to = Infinity, idleMs
104
124
  let agents = 0
105
125
  let approvals = 0
106
126
  let pending = 0
127
+ let stopped = false
107
128
  const issued: number[] = []
108
129
  let i = 0
109
130
  while (i < points.length) {
@@ -117,14 +138,19 @@ export function wallBreakdown(s: Stream, from = -Infinity, to = Infinity, idleMs
117
138
  else if (p.lane === 'approval') approvals += n
118
139
  else tools += n
119
140
  if (p.d === 'start') issued.push(p.ix)
120
- else if (p.d === 'prompt' || p.d === 'wake' || p.d === 'message') ended = true
141
+ else if (p.d === 'prompt' || p.d === 'wake' || p.d === 'message' || p.d === 'end') ended = true
142
+ if (p.d !== 'stop') stopped = p.d === 'end'
121
143
  i++
122
144
  }
123
145
  if (turnModel != null) {
124
146
  if (issued.length > 0) for (const ix of issued) turnModel[ix] = (turnModel[ix] ?? 0) + pending / issued.length
125
147
  if (issued.length > 0 || ended) pending = 0
126
148
  }
127
- if (i >= points.length) break
149
+ if (i >= points.length) {
150
+ const waitsOnItsOwn = stopped && Number.isFinite(to) && to - at <= idleMs && closed.some((c) => c.bg && c.start <= at && (c.bgEnd == null || c.bgEnd > at))
151
+ if (waitsOnItsOwn) out.background += Math.max(0, to - Math.max(at, from))
152
+ break
153
+ }
128
154
  const nextAt = (points[i] as Point).at
129
155
  const a = Math.max(at, from)
130
156
  const b = Math.min(nextAt, to)
@@ -136,16 +162,18 @@ export function wallBreakdown(s: Stream, from = -Infinity, to = Infinity, idleMs
136
162
  else if (agents > 0) bucket = 'subagent'
137
163
  else {
138
164
  let next = i
139
- let prompt = false
165
+ let typed = false
166
+ let message = false
140
167
  let wake = false
141
168
  while (next < points.length && (points[next] as Point).at === nextAt) {
142
169
  const d = (points[next] as Point).d
143
- if (d === 'prompt' || d === 'message') prompt = true
170
+ if (d === 'prompt') typed = true
171
+ if (d === 'message') message = true
144
172
  if (d === 'wake') wake = true
145
173
  next++
146
174
  }
147
175
  const gap = nextAt - at
148
- bucket = prompt ? (gap > idleMs ? 'idle' : 'human') : wake ? 'background' : 'model'
176
+ bucket = typed ? (gap > idleMs ? 'idle' : 'human') : message ? (gap > idleMs ? 'idle' : 'parked') : wake ? 'background' : !stopped ? 'model' : gap > idleMs ? 'idle' : 'unknown'
149
177
  }
150
178
  out[bucket] += len
151
179
  if (bucket === 'model') pending += len
@@ -397,16 +397,25 @@ export async function drift(root: string): Promise<Drift[]> {
397
397
  }
398
398
  }
399
399
  const targets = offloads().map((x) => x.target)
400
- const reached = (p: string): boolean => targets.some((t) => p === t || p.startsWith(`${t}/`) || t.startsWith(`${p}/`))
401
400
  for (const a of await presentAnnexes()) {
402
401
  const dir = join(a.path, 'offload', basename(root))
403
402
  if (!existsSync(dir)) continue
404
- for (const e of entries(dir)) {
405
- const p = join(dir, e.rel)
406
- if (e.dir || reached(p) || /\.\d+\.part(\/|$)/.test(p)) continue
407
- out.push({ kind: 'orphan', path: p, why: 'on the annex, and no recorded offload of any repo reaches it', fix: `nothing on the Mac reaches it: delete ${p}` })
408
- break
409
- }
403
+ const p = firstOrphan(dir, targets)
404
+ if (p !== undefined) out.push({ kind: 'orphan', path: p, why: 'on the annex, and no recorded offload of any repo reaches it', fix: `nothing on the Mac reaches it: delete ${p}` })
410
405
  }
411
406
  return out
412
407
  }
408
+
409
+ /** the first file under `dir` no target reaches, depth first; a folder a target reaches, or a copy in flight
410
+ * (`<name>.<n>.part`), is never read: the drive holds hundreds of thousands of files under the targets */
411
+ function firstOrphan(dir: string, targets: readonly string[]): string | undefined {
412
+ for (const e of readdirSync(dir, { withFileTypes: true })) {
413
+ if (/\.\d+\.part$/.test(e.name)) continue
414
+ const p = join(dir, e.name)
415
+ if (targets.some((t) => p === t || p.startsWith(`${t}/`))) continue
416
+ if (!e.isDirectory()) return p
417
+ const found = firstOrphan(p, targets)
418
+ if (found !== undefined) return found
419
+ }
420
+ return undefined
421
+ }
@@ -25,9 +25,34 @@ export function slugify(title: string, max = 40): string {
25
25
  return (lastDash > 0 ? cut.slice(0, lastDash) : cut).replace(/-+$/, '')
26
26
  }
27
27
 
28
+ /** the front matter block, between the first two `---` lines: the only place
29
+ * a key lives. A body line that starts with `check:` is prose, and read as a
30
+ * key it would run as shell */
31
+ const splitFront = (md: string): { head: string[]; body: string[] } | null => {
32
+ const lines = md.split(/\r?\n/)
33
+ const end = lines[0]?.trim() === '---' ? lines.findIndex((l, i) => i > 0 && l.trim() === '---') : -1
34
+ return end === -1 ? null : { head: lines.slice(1, end), body: lines.slice(end + 1) }
35
+ }
36
+ const frontMatter = (md: string): string => splitFront(md)?.head.join('\n') ?? ''
37
+
38
+ /** the ask with these keys set in its front matter, where parse reads them; an
39
+ * ask with no block gets one */
40
+ const withKeys = (md: string, keys: [string, string][]): string => {
41
+ const f = splitFront(md) ?? { head: [], body: ['', ...md.split(/\r?\n/)] }
42
+ const head = [...f.head]
43
+ for (const [k, v] of keys) {
44
+ const at = head.findIndex((l) => l.startsWith(`${k}:`))
45
+ if (at === -1) head.push(`${k}: ${v}`)
46
+ else head[at] = `${k}: ${v}`
47
+ }
48
+ return ['---', ...head, '---', ...f.body].join('\n')
49
+ }
50
+ const closedKeys = (): [string, string][] => [['status', 'done'], ['closed', new Date().toISOString().slice(0, 10)]]
51
+
28
52
  const parse = (dir: string, file: string): Ask => {
29
53
  const md = readFileSync(join(dir, file), 'utf8')
30
- const fm = (key: string): string | null => md.match(new RegExp(`^${key}:\\s*(.+)$`, 'm'))?.[1]?.trim() ?? null
54
+ const head = frontMatter(md)
55
+ const fm = (key: string): string | null => head.match(new RegExp(`^${key}:\\s*(.+)$`, 'm'))?.[1]?.trim() ?? null
31
56
  return {
32
57
  file,
33
58
  status: fm('status') ?? 'open',
@@ -100,8 +125,7 @@ function probeAsk(root: string, dir: string, a: Ask, check: string): { passed: t
100
125
  }
101
126
  const done = join(dir, 'done')
102
127
  mkdirSync(done, { recursive: true })
103
- const md = readFileSync(join(dir, a.file), 'utf8').replace(/^status:.*$/m, `status: done\nclosed: ${new Date().toISOString().slice(0, 10)}`)
104
- atomicWrite(join(dir, a.file), md)
128
+ atomicWrite(join(dir, a.file), withKeys(readFileSync(join(dir, a.file), 'utf8'), closedKeys()))
105
129
  renameSync(join(dir, a.file), join(done, a.file))
106
130
  return { passed: true }
107
131
  }
@@ -206,8 +230,7 @@ ${whyBlock}${opts?.kind === 'decision' ? DECISION_BODY : secrets.length > 0 ? cr
206
230
  export function archiveAsk(dir: string, file: string): void {
207
231
  const p = join(dir, file)
208
232
  if (!existsSync(p)) throw new Error(`no such ask: ${file}`)
209
- const md = readFileSync(p, 'utf8').replace(/^status:.*$/m, `status: done\nclosed: ${new Date().toISOString().slice(0, 10)}`)
210
- writeFileSync(p, md)
233
+ writeFileSync(p, withKeys(readFileSync(p, 'utf8'), closedKeys()))
211
234
  const done = join(dir, 'done')
212
235
  mkdirSync(done, { recursive: true })
213
236
  renameSync(p, join(done, file))
@@ -227,12 +250,10 @@ export function markPinged(dir: string, file: string): boolean {
227
250
  const p = join(dir, file)
228
251
  if (!existsSync(p)) return false
229
252
  const md = readFileSync(p, 'utf8')
230
- if (/^pinged:/m.test(md)) return false
231
- const line = `pinged: ${new Date().toISOString().slice(0, 10)}`
232
- const withMark = md.replace(/^status:(.*)$/m, `status:$1\n${line}`)
233
- // a hand-edited ask without status: still gets a durable marker — a
234
- // no-op write here would re-fire the ping every tick forever
235
- writeFileSync(p, withMark !== md ? withMark : `${line}\n${md}`)
253
+ if (/^pinged:/m.test(frontMatter(md))) return false
254
+ // in the front matter, where it is read: a marker parse misses re-fires
255
+ // the ping every tick forever
256
+ writeFileSync(p, withKeys(md, [['pinged', new Date().toISOString().slice(0, 10)]]))
236
257
  return true
237
258
  }
238
259
 
package/src/check.ts CHANGED
@@ -90,7 +90,9 @@ export type CheckDef = {
90
90
  * not own OFF with `off` in repo.config.ts, never elsewhere. */
91
91
  runs: Runs
92
92
  /** HOW ITS ANSWER IS KEPT, one variant, every parameter explicit:
93
- * `files` (keyed on these paths), `reads` (keyed on what the body read),
93
+ * `files` (keyed on these paths; `optional` names the ones a repo may
94
+ * lack, keyed as absent, and any other missing path refuses the key),
95
+ * `reads` (keyed on what the body read),
94
96
  * `ttl` (a world answer that keeps a span), `fact` (a decided value, once
95
97
  * per key), `never` (with the reason). The file's own path joins every
96
98
  * key automatically, so nothing declares its own code. */
@@ -32,12 +32,11 @@ const CONTRIB = '# repo-contributed lines (repo.config.ts gitignore:)'
32
32
 
33
33
  const DRAFTS_BACK = '!.comfy-ts/drafts/'
34
34
  const SOCIAL_BACK = `!${LAYOUT.social}/`
35
- const VOICE_BACK = `!${LAYOUT.voice}/`
36
35
 
37
36
  /** re-includes a private repo carries and a declared public one drops: a
38
37
  * draft names private loras, a plan or a board quotes the owner, a social
39
- * draft carries his angles and notes, a take is his own voice */
40
- const PRIVATE_ONLY: ReadonlySet<string> = new Set([DRAFTS_BACK, `!${LAYOUT.plans}/`, SOCIAL_BACK, VOICE_BACK])
38
+ * draft carries his angles and notes */
39
+ const PRIVATE_ONLY: ReadonlySet<string> = new Set([DRAFTS_BACK, `!${LAYOUT.plans}/`, SOCIAL_BACK])
41
40
 
42
41
  export const POLICY_LINES = [
43
42
  // everything shipkit keeps lives under .shipkit/ (core/layout.ts). Local
@@ -51,9 +50,11 @@ export const POLICY_LINES = [
51
50
  // desks date posts from. A rendered trailer is made again by its command
52
51
  SOCIAL_BACK,
53
52
  `${LAYOUT.social}/drafts/**/*-trailer.mp4`,
54
- // his takes of a trailer's lines: a recording is never made again
55
- VOICE_BACK,
56
53
  `${LAYOUT.assets}/out/`,
54
+ // recordings of a person's own voice never go to git, in any repo: covered
55
+ // by `.shipkit/*` and spelled out so this check asks git about it (the
56
+ // backup keeps the files)
57
+ `${LAYOUT.voice}/takes/`,
57
58
  // already covered by the line above, and spelled out anyway so this check
58
59
  // asks git about it: a negation below the block that exposed the keyword
59
60
  // list would otherwise pass as a venue override
@@ -165,12 +166,12 @@ async function trackedGenerated(d: Disk): Promise<string[]> {
165
166
  return GENERATED_TRACKED_PATHS.filter((p) => listed.has(p))
166
167
  }
167
168
 
168
- /** a declared public repo's files under the private only folders git still tracks: the block ignores what git does
169
- * not hold yet, never a file tracked before the flip */
169
+ /** files git still tracks under a folder this repo keeps local: the private only folders of a declared public repo,
170
+ * and recorded voice in any repo. The block ignores what git does not hold yet, never a file tracked before */
170
171
  async function trackedPrivate(d: Disk, config: RepoConfig): Promise<Map<string, number>> {
171
172
  const out = new Map<string, number>()
172
- if (!declaredPublic(config) || !d.exists('.git')) return out
173
- const dirs = [LAYOUT.plans, LAYOUT.social, LAYOUT.voice]
173
+ if (!d.exists('.git')) return out
174
+ const dirs = [...(declaredPublic(config) ? [LAYOUT.plans, LAYOUT.social] : []), LAYOUT.voice]
174
175
  const r = await d.exec([gitBin(), 'ls-files', '-z', '--', ...dirs], { cwd: d.root })
175
176
  if (r.code !== 0) return out
176
177
  for (const f of r.out.split('\0')) {
@@ -203,6 +204,17 @@ function blockState(d: Disk, config: RepoConfig, legacy: boolean): BlockState {
203
204
  return f.lines.slice(f.b, f.e + 1).join('\n') === expectedBlock(config, legacy) ? 'current' : 'stale'
204
205
  }
205
206
 
207
+ /** the lines of a well-formed block the current one no longer holds: a line a repo wrote inside it, or one the policy
208
+ * retired. Only the repair removes them, and it names each */
209
+ export function removedLines(text: string | null, config: RepoConfig, legacy = false): string[] {
210
+ const f = parseText(text)
211
+ if (f == null || f.b === -1 || f.e === -1 || f.e < f.b) return []
212
+ const kept = new Set([...expectedBlock(config, legacy).split('\n'), CONTRIB, LEGACY])
213
+ return f.lines.slice(f.b + 1, f.e).filter((l) => l.trim() !== '' && !kept.has(l))
214
+ }
215
+
216
+ const REMOVED_FIX = 'a line of the repo goes below the block, or in repo.config.ts gitignore:'
217
+
206
218
  function writeBlock(d: Disk, config: RepoConfig, legacy: boolean): void {
207
219
  d.write('.gitignore', withBlock(d.read('.gitignore'), config, legacy))
208
220
  }
@@ -263,6 +275,12 @@ export const gitignorePolicy = check({
263
275
  // every run that may write renders it in place, so a policy change never
264
276
  // turns the whole fleet red until each repo runs its gate
265
277
  if (s === 'stale') {
278
+ const removed = removedLines(c.read('.gitignore'), c.config, legacy)
279
+ if (removed.length > 0) {
280
+ c.warn(`.gitignore policy block is stale, and its rewrite removes ${removed.join(', ')}: left for the repair, which names each line`)
281
+ c.lines.push({ kind: 'fix-warn', text: `${REMOVED_FIX}; sk ci (or check --fix SK004) rewrites it` })
282
+ return
283
+ }
266
284
  if (c.frozen) {
267
285
  c.warn('.gitignore policy block is stale: the policy moved, and a frozen run rewrites nothing')
268
286
  c.lines.push({ kind: 'fix-warn', text: 'any run that is not frozen rewrites it in place (sk check, sk ci)' })
@@ -324,7 +342,8 @@ export const gitignorePolicy = check({
324
342
  }
325
343
  c.ok(`.gitignore policy block current, ${claimed.length + backProbes.size} patterns verified against git`)
326
344
  for (const [dir, n] of await trackedPrivate(c, c.config)) {
327
- c.warn(`a public repo still tracks ${n} file${n === 1 ? '' : 's'} under ${dir}/: strangers read them, and the block keeps only new ones local`)
345
+ const files = `${n} file${n === 1 ? '' : 's'} under ${dir}/`
346
+ c.warn(dir === LAYOUT.voice ? `this repo still tracks ${files}: recorded voice, and the block keeps only new ones local` : `a public repo still tracks ${files}: strangers read them, and the block keeps only new ones local`)
328
347
  c.lines.push({ kind: 'fix-warn', text: `git rm -r --cached -q ${dir} && git commit -m "untrack ${dir}" -- ${dir} (the files stay on the disk)` })
329
348
  }
330
349
  },
@@ -344,12 +363,14 @@ export const gitignorePolicy = check({
344
363
  c.write('.gitignore', `${c.read('.gitignore') ?? ''}\n`)
345
364
  terminated = '.gitignore terminated with a newline (the next append would have fused onto its last line)'
346
365
  }
366
+ const removed = before === 'stale' ? removedLines(c.read('.gitignore'), c.config, legacy) : []
347
367
  const blockSummary = before === 'current'
348
368
  ? null
349
369
  : before === 'missing-file' ? '.gitignore created with the policy block'
350
370
  : before === 'missing-block' ? 'policy block appended (repo lines untouched)'
351
371
  : before === 'corrupted' ? 'policy block rebuilt (stray markers dropped, repo lines kept visible)'
352
- : 'policy block rewritten in place (repo lines untouched)'
372
+ : removed.length > 0 ? `policy block rewritten in place, removed from it: ${removed.join(', ')} (${REMOVED_FIX})`
373
+ : 'policy block rewritten in place (repo lines outside it untouched)'
353
374
  if (blockSummary != null) writeBlock(c, c.config, legacy)
354
375
  // the block must be written FIRST: untracking a path the ignore list
355
376
  // does not yet carry leaves it staged for re-add on the next `git add`.
@@ -23,7 +23,7 @@ export const agentWikiLinks = check({
23
23
  owner: 'meta/agent-folder/index.md',
24
24
  runs: { onPreCommit: false, onCi: true, onFull: true, onRelease: true, onHealth: true, onSave: 'moved', onClock: false },
25
25
  // the md lint walks agent/ on disk rather than through `c`; the loaded context starts at CLAUDE.md
26
- cache: { by: 'files', inputs: ['agent', 'CLAUDE.md', 'CLAUDE.local.md'], key: null },
26
+ cache: { by: 'files', inputs: ['agent', 'CLAUDE.md', 'CLAUDE.local.md'], optional: ['agent', 'CLAUDE.md', 'CLAUDE.local.md'], key: null },
27
27
  fix: 'none',
28
28
  applies: 'always',
29
29
  run: (c) => {
@@ -31,7 +31,7 @@ export const globalContribution = check({
31
31
  owner: 'meta/agent-folder/index.md',
32
32
  runs: { onPreCommit: false, onCi: true, onFull: true, onRelease: true, onHealth: true, onSave: 'moved', onClock: false },
33
33
  // the file sits in the agent folder CLAUDE.md names: agent/, or a folder of the repo's wiki/
34
- cache: { by: 'files', inputs: ['CLAUDE.md', 'agent/global-contribution.md', 'wiki'], key: null },
34
+ cache: { by: 'files', inputs: ['CLAUDE.md', 'agent/global-contribution.md', 'wiki'], optional: ['CLAUDE.md', 'agent/global-contribution.md', 'wiki'], key: null },
35
35
  fix: 'ci',
36
36
  applies: (env) => notHouse(env.root),
37
37
  run: (c) => {
@@ -13,7 +13,7 @@ export const draftMediaSize = check({
13
13
  owner: 'tools/shipkit/social.md',
14
14
  runs: { onPreCommit: { budgetMs: 60 }, onCi: true, onFull: true, onRelease: true, onHealth: true, onSave: 'moved', onClock: false },
15
15
  // the folder's files; the hook runs it raw on the index, so a file staged since a cached green is still seen there
16
- cache: { by: 'files', inputs: [LAYOUT.social], key: null },
16
+ cache: { by: 'files', inputs: [LAYOUT.social], optional: [LAYOUT.social], key: null },
17
17
  fix: 'none',
18
18
  applies: 'always',
19
19
  run: (c) => {
@@ -20,7 +20,7 @@ export const releaseWords = check({
20
20
  owner: 'tools/shipkit/units.md',
21
21
  runs: { onPreCommit: false, onCi: true, onFull: true, onRelease: true, onHealth: true, onSave: 'moved', onClock: false },
22
22
  // the release files and the messages store the guard reads, and the text of the social unit files that declare it
23
- cache: { by: 'files', inputs: [LAYOUT.releases, '.shipkit/messages'], key: (env) => unitFilesDeclaring(env.root, 'social').map((f) => `${f}:${Bun.hash(readFileSync(f, 'utf8'))}`).join('\n') },
23
+ cache: { by: 'files', inputs: [LAYOUT.releases, '.shipkit/messages'], optional: [LAYOUT.releases, '.shipkit/messages'], key: (env) => unitFilesDeclaring(env.root, 'social').map((f) => `${f}:${Bun.hash(readFileSync(f, 'utf8'))}`).join('\n') },
24
24
  fix: 'none',
25
25
  applies: 'always',
26
26
  run: async (c) => {
@@ -31,7 +31,7 @@ export const postKinds = check({
31
31
  owner: 'tools/shipkit/built-in-checks-contracts-and-visibility.md',
32
32
  runs: { onPreCommit: false, onCi: true, onFull: true, onRelease: true, onHealth: true, onSave: 'moved', onClock: false },
33
33
  // the social folder, the text of the social unit files that declare its own kinds, and each page they name
34
- cache: { by: 'files', inputs: [LAYOUT.social], key: (env) => unitFilesDeclaring(env.root, 'social').map((f) => unitKey(env.root, f)).join('\n') },
34
+ cache: { by: 'files', inputs: [LAYOUT.social], optional: [LAYOUT.social], key: (env) => unitFilesDeclaring(env.root, 'social').map((f) => unitKey(env.root, f)).join('\n') },
35
35
  fix: 'none',
36
36
  applies: 'always',
37
37
  run: async (c) => {
@@ -0,0 +1,38 @@
1
+ // SK044 behind upstream: after a fetch, the branch holds every commit its upstream has. Two Macs work one repo through
2
+ // git alone (tools/shipkit/home.md, Two machines), so a session on one Mac must learn that the other pushed. It warns
3
+ // and never pulls: a pull moves the tree under every session working in it. No git, no upstream, a fetch that fails:
4
+ // a skip, never red, since it reports the world.
5
+ import { check } from '../check.ts'
6
+ import { probeGitRoot } from '../core/git-root.ts'
7
+
8
+ const firstLine = (text: string): string => text.trim().split('\n')[0] ?? ''
9
+
10
+ export const behindUpstream = check({
11
+ id: 'SK044',
12
+ blocking: false,
13
+ title: 'behind upstream',
14
+ description: 'the branch holds every commit its upstream has, after a fetch',
15
+ owner: 'tools/shipkit/home.md',
16
+ runs: { onPreCommit: false, onCi: false, onFull: false, onRelease: false, onHealth: true, onSave: false, onClock: { every: '30m', inactive: 'wait' } },
17
+ cache: { by: 'never', why: 'it asks the remote what it holds now' },
18
+ fix: 'none',
19
+ applies: 'always',
20
+ run: async (c) => {
21
+ const skip = (why: string): void => void c.lines.push({ kind: 'skip', text: `behind upstream unverified: ${why}` })
22
+ if (probeGitRoot(c.root).root == null) return skip('no git')
23
+ const up = await c.exec(['git', 'rev-parse', '--abbrev-ref', '--symbolic-full-name', '@{u}'], { cwd: c.root })
24
+ if (up.code !== 0) return skip('the branch has no upstream')
25
+ const upstream = up.out.trim()
26
+ // with no remote named, git fetches the branch's own remote
27
+ const fetched = await c.exec(['git', 'fetch', '--quiet'], { cwd: c.root, timeoutMs: 20_000 })
28
+ if (fetched.code !== 0) return skip(`git fetch failed (${firstLine(fetched.out) || `exit ${fetched.code}`})`)
29
+ const count = await c.exec(['git', 'rev-list', '--left-right', '--count', 'HEAD...@{u}'], { cwd: c.root })
30
+ if (count.code !== 0) return skip(`git rev-list says ${firstLine(count.out)}`)
31
+ const [ahead, behind] = count.out.trim().split(/\s+/).map(Number) as [number, number]
32
+ if (behind === 0) return c.ok(`the branch holds every commit of ${upstream}`)
33
+ const how = ahead === 0 ? 'git pull --ff-only' : `git pull, a merge: the branch also holds ${ahead} commit(s) ${upstream} lacks`
34
+ c.warn(`${behind} commit(s) on ${upstream} that this branch lacks: another Mac or session pushed. Pull before you work: ${how}`)
35
+ },
36
+ })
37
+
38
+ export default behindUpstream
@@ -31,10 +31,11 @@ export class AnnexCommand extends Command {
31
31
  static override paths = [['annex']]
32
32
  static override usage = Command.Usage({
33
33
  category: 'Annex',
34
- description: 'each annex: present or not, free space, its media, every offloaded folder and its link',
35
- details: `${DETAILS}\n\nA folder with no marker where an annex should be is named: the drive is unplugged, or a phantom folder took its place.`,
36
- examples: [['where the annexes stand', 'sk annex']],
34
+ description: 'each annex: present or not, free space, its media, the offloaded folders, each link that fails',
35
+ details: `${DETAILS}\n\nA folder with no marker where an annex should be is named: the drive is unplugged, or a phantom folder took its place. Each repo with offloaded folders takes one line; a folder whose link does not hold is named under it with the command that settles it. --all lists every folder.`,
36
+ examples: [['where the annexes stand', 'sk annex'], ['every offloaded folder', 'sk annex --all']],
37
37
  })
38
+ all = Option.Boolean('--all', false, { description: 'list every offloaded folder, its links that hold included' })
38
39
  async execute(): Promise<number> {
39
40
  return run(this.context, async (out) => {
40
41
  const { annexSpecs, driveFree, isPresent, mediaFiles } = await import('../annex/annex.ts')
@@ -66,12 +67,16 @@ export class AnnexCommand extends Command {
66
67
  for (const l of waitingBorn()) out(` waits: ${l.replace(/^WARN annex: /, '')}`)
67
68
  for (const repo of [...new Set(list.map((x) => x.repo))]) {
68
69
  const bad = new Map((await drift(repo)).map((d) => [d.path, d] as const))
69
- for (const x of list.filter((y) => y.repo === repo)) {
70
+ const mine = list.filter((y) => y.repo === repo)
71
+ const born = mine.filter((x) => x.born).length
72
+ const moved = mine.reduce((s, x) => s + (x.born ? 0 : x.bytes), 0)
73
+ out(` ${repo} ${mine.length} ${mine.length === 1 ? 'folder' : 'folders'} (${born} born, ${gb(moved)} moved) ${bad.size === 0 ? 'every link holds' : `${bad.size} ${bad.size === 1 ? 'needs' : 'need'} a hand`}`)
74
+ for (const x of mine) {
70
75
  const d = bad.get(`${x.repo}/${x.rel}`)
71
- out(` ${repo}/${x.rel} ${x.born ? 'born' : `${gb(x.bytes)} moved`} ${d ? `${d.kind.toUpperCase()}: ${d.why}` : 'link holds'}`)
76
+ if (d || this.all) out(` ${x.rel} ${x.born ? 'born' : `${gb(x.bytes)} moved`} ${d ? `${d.kind.toUpperCase()}: ${d.why}` : 'link holds'}`)
72
77
  }
73
- for (const d of bad.values()) if (d.kind === 'orphan' || !list.some((x) => `${x.repo}/${x.rel}` === d.path)) out(` ${d.kind.toUpperCase()} ${d.path}: ${d.why}`)
74
- for (const d of bad.values()) out(` → ${d.fix}`)
78
+ for (const d of bad.values()) if (d.kind === 'orphan' || !list.some((x) => `${x.repo}/${x.rel}` === d.path)) out(` ${d.kind.toUpperCase()} ${d.path}: ${d.why}`)
79
+ for (const d of bad.values()) out(` → ${d.fix}`)
75
80
  }
76
81
  const { readdirSync } = await import('node:fs')
77
82
  const { join } = await import('node:path')
@@ -11,6 +11,7 @@ const asksDir = async (root: string): Promise<string> => join(root, (await loadR
11
11
 
12
12
  export class AsksCommand extends Command {
13
13
  static override paths = [['asks']]
14
+ static essential = {}
14
15
 
15
16
  static override usage = Command.Usage({
16
17
  category: 'Asks',
@@ -54,6 +55,7 @@ export class AsksCheckCommand extends Command {
54
55
 
55
56
  export class AskNewCommand extends Command {
56
57
  static override paths = [['ask'], ['asks', 'new']]
58
+ static essential = { args: '<title>' }
57
59
 
58
60
  static override usage = Command.Usage({
59
61
  category: 'Asks',
@@ -21,10 +21,10 @@ export class AssetsFillCommand extends Command {
21
21
 
22
22
  static override usage = Command.Usage({
23
23
  category: 'Assets',
24
- description: 'top rolls up to N per asset (canvas or comfy), sparsest-first',
24
+ description: 'top rolls up to N per asset, sparsest first; a comfy asset renders on the GPU box, a job a roll',
25
25
  examples: [
26
- ['every asset up to 8 rolls', 'sk assets fill 8'],
27
26
  ['only two categories', 'sk assets fill 8 icons sprites'],
27
+ ['every asset up to 8 rolls: one GPU job for each roll missing', 'sk assets fill 8'],
28
28
  ],
29
29
  })
30
30
 
@@ -46,8 +46,8 @@ export class AssetsAddCommand extends Command {
46
46
 
47
47
  static override usage = Command.Usage({
48
48
  category: 'Assets',
49
- description: 'N more rolls per asset (canvas or comfy), regardless of what it has',
50
- examples: [['3 fresh rolls everywhere', 'sk assets add 3']],
49
+ description: 'N more rolls per asset, whatever it has; a comfy asset renders on the GPU box, a job a roll',
50
+ examples: [['3 fresh rolls for one category', 'sk assets add 3 icons'], ['3 fresh rolls everywhere: 3 GPU jobs for each comfy asset', 'sk assets add 3']],
51
51
  })
52
52
 
53
53
  n = Option.String({ required: true })
@@ -68,7 +68,7 @@ export class AssetsGenCommand extends Command {
68
68
 
69
69
  static override usage = Command.Usage({
70
70
  category: 'Assets',
71
- description: 'one-shot rolls for a single asset (canvas or comfy)',
71
+ description: 'rolls for one asset now; a comfy asset renders on the GPU box, a job a roll',
72
72
  examples: [
73
73
  ['one roll', 'sk assets gen hero'],
74
74
  ['five rolls', 'sk assets gen hero --n 5'],
@@ -77,20 +77,26 @@ export class BackupCommand extends Command {
77
77
  }
78
78
  }
79
79
 
80
+ /** the runs `sk backup runs` prints without --all: a run every few minutes makes thousands */
81
+ const RUNS_SHOWN = 20
82
+
80
83
  export class BackupRunsCommand extends Command {
81
84
  static override paths = [['backup', 'runs']]
82
85
  static override usage = Command.Usage({
83
86
  category: 'Media',
84
- description: 'every backup run the Space holds, oldest first: its time and manifest key',
85
- details: DETAILS,
86
- examples: [['the runs', 'sk backup runs']],
87
+ description: 'the backup runs in the Space, newest first: the count per machine, then time, machine and key',
88
+ details: `${DETAILS}\n\nThe first line counts the runs per machine; the newest ${RUNS_SHOWN} follow, newest first. --all lists every run, oldest first.`,
89
+ examples: [['the latest runs', 'sk backup runs'], ['every run', 'sk backup runs --all']],
87
90
  })
91
+ all = Option.Boolean('--all', false, { description: 'every run, oldest first' })
88
92
  async execute(): Promise<number> {
89
93
  return run(this.context, async (h) => {
90
94
  const { runsOf } = await import('../media-store/backup/manifest.ts')
91
95
  const runs = await runsOf(h.space)
92
- for (const r of runs) h.out(`${r.at.toISOString()} ${r.key} ${(r.size / 1e3).toFixed(0)} kB`)
93
- h.out(`${runs.length} runs`)
96
+ const per = new Map<string, number>()
97
+ for (const r of runs) per.set(r.machine ?? '(host inside)', (per.get(r.machine ?? '(host inside)') ?? 0) + 1)
98
+ h.out(`${runs.length} runs: ${[...per].map(([m, n]) => `${n} of ${m}`).join(', ')}${!this.all && runs.length > RUNS_SHOWN ? `; the newest ${RUNS_SHOWN} below, --all for every one` : ''}`)
99
+ for (const r of this.all ? runs : runs.slice(-RUNS_SHOWN).reverse()) h.out(`${r.at.toISOString()} ${r.machine ?? '(host inside)'} ${r.key} ${(r.size / 1e3).toFixed(0)} kB`)
94
100
  return 0
95
101
  })
96
102
  }
@@ -101,18 +107,19 @@ export class BackupRestoreCommand extends Command {
101
107
  static override usage = Command.Usage({
102
108
  category: 'Media',
103
109
  description: 'a backup run written back, every sha checked: to an empty folder, or in place',
104
- details: `${DETAILS}\n\nThe run is the last one at or before --at (the last one when it is left out). --to writes every file under the folder, at its path under the home (the folder must be empty or new). --in-place writes over the live files: a live file with other bytes is copied to ~/.shipkit/backup-replaced/<time>/ first, and a sqlite lands beside its live file as <file>.restored (stop pm, then move it). --path keeps the files under one path of the home.`,
110
+ details: `${DETAILS}\n\nThe run is this Mac's last one at or before --at (the last one when it is left out); --host reads another Mac's runs, as a new Mac restoring the one it replaces. --to writes every file under the folder, at its path under the home (the folder must be empty or new). --in-place writes over the live files: a live file with other bytes is copied to ~/.shipkit/backup-replaced/<time>/ first, and a sqlite lands beside its live file as <file>.restored (stop pm, then move it). --path keeps the files under one path of the home.`,
105
111
  examples: [['the last run into a folder', 'sk backup restore --to ~/restore-1'], ['the veille logs as they were on a day, in place', 'sk backup restore --at 2026-11-04 --in-place --path .config/shipkit/home/veille']],
106
112
  })
107
113
  to = Option.String('--to', { description: 'an empty or new folder the files land under' })
108
114
  inPlace = Option.Boolean('--in-place', false, { description: 'over the live files, each one replaced copied aside first' })
109
115
  at = Option.String('--at', { description: 'the last run at or before this time: 2026-11-04T13:50Z, 2026-11-04 or 20261104T135000Z' })
110
116
  under = Option.String('--path', { description: 'only the files under this path of the home: .config/shipkit/home/veille' })
117
+ host = Option.String('--host', { description: "another Mac's runs, by the name `sk backup runs` prints: this Mac's when absent" })
111
118
  async execute(): Promise<number> {
112
119
  return run(this.context, async (h) => {
113
120
  const { restore } = await import('../media-store/backup/restore.ts')
114
121
  const { parseAt } = await import('../media-store/backup/keys.ts')
115
- const r = await restore(h.space, { home: h.home, ...(this.to !== undefined ? { to: this.to } : {}), inPlace: this.inPlace, ...(this.at ? { at: parseAt(this.at) } : {}), ...(this.under ? { only: this.under } : {}) })
122
+ const r = await restore(h.space, { home: h.home, ...(this.to !== undefined ? { to: this.to } : {}), inPlace: this.inPlace, ...(this.at ? { at: parseAt(this.at) } : {}), ...(this.under ? { only: this.under } : {}), ...(this.host ? { machine: this.host } : {}) })
116
123
  h.out(`run ${r.at} (${r.run}): ${r.files} files, ${r.written} written (${mb(r.bytes)})${this.inPlace ? `, ${r.same} already the same` : ''}`)
117
124
  if (r.aside.n > 0) h.out(`${r.aside.n} live files copied aside first, into ${r.aside.dir}`)
118
125
  for (const b of r.beside) h.out(` a sqlite landed beside its live file: ${b} (stop pm, then move it over)`)
@@ -132,12 +139,13 @@ export class BackupDrillCommand extends Command {
132
139
  })
133
140
  to = Option.String('--to', { description: 'restore into this empty or new folder, and keep it' })
134
141
  at = Option.String('--at', { description: 'the last run at or before this time, an older run: 2026-11-04T13:50Z or 20261104T135000Z' })
142
+ host = Option.String('--host', { description: "another Mac's runs, by the name `sk backup runs` prints: this Mac's when absent" })
135
143
  async execute(): Promise<number> {
136
144
  return run(this.context, async (h) => {
137
145
  const { drill } = await import('../media-store/backup/restore.ts')
138
146
  const { parseAt } = await import('../media-store/backup/keys.ts')
139
147
  const t0 = Date.now()
140
- const d = await drill(h.space, { home: h.home, ...(this.to !== undefined ? { to: this.to } : {}), ...(this.at ? { at: parseAt(this.at) } : {}) })
148
+ const d = await drill(h.space, { home: h.home, ...(this.to !== undefined ? { to: this.to } : {}), ...(this.at ? { at: parseAt(this.at) } : {}), ...(this.host ? { machine: this.host } : {}) })
141
149
  h.out(`run ${d.at} (${d.run}, version ${d.v}): ${d.files} files (${mb(d.bytes)}), ${d.restored} restored with their sha, in ${((Date.now() - t0) / 1000).toFixed(1)} s`)
142
150
  h.out(`against the live files: ${d.sameAsLive} the same, ${d.liveMoved.length} moved since the run, ${d.liveGone.length} gone from the disk, ${d.failed.length} failed`)
143
151
  for (const s of d.sqlite) h.out(` sqlite ~/${s.path}: restored ${JSON.stringify(s.restored)}, live now ${JSON.stringify(s.live)}`)
@@ -6,6 +6,7 @@ import { runBump, type BumpKind } from '../release/run-bump.ts'
6
6
 
7
7
  export class BumpCommand extends Command {
8
8
  static override paths = [['bump']]
9
+ static essential = { args: '[kind] [unit]' }
9
10
 
10
11
  static override usage = Command.Usage({
11
12
  category: 'Gate',