rvlib-shipkit 2.19.0 → 2.21.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 (196) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/package.json +1 -1
  3. package/src/annex/annex.ts +227 -0
  4. package/src/annex/offload.ts +279 -0
  5. package/src/checks/SK004-gitignore-policy.check.ts +6 -3
  6. package/src/checks/SK040-release-words.check.ts +43 -0
  7. package/src/checks/SK041-annex-links.check.ts +28 -0
  8. package/src/checks/SK042-post-kinds.check.ts +73 -0
  9. package/src/cli/cmd_Annex.ts +179 -0
  10. package/src/cli/cmd_Commands.ts +4 -1
  11. package/src/cli/cmd_GlobalProcesses.ts +2 -107
  12. package/src/cli/cmd_Home.ts +4 -3
  13. package/src/cli/cmd_Messages.ts +155 -0
  14. package/src/cli/cmd_Overview.ts +2 -1
  15. package/src/cli/cmd_Releases.ts +84 -0
  16. package/src/cli/cmd_Review.ts +176 -12
  17. package/src/cli/cmd_Shot.ts +4 -4
  18. package/src/cli/cmd_Social.ts +151 -8
  19. package/src/cli/cmd_Sound.ts +17 -4
  20. package/src/cli/cmd_Trailer.ts +67 -1
  21. package/src/cli/family-pages.ts +2 -0
  22. package/src/cli/kit/index.ts +1 -1
  23. package/src/cli/kit/verb.ts +11 -3
  24. package/src/cli/registry.ts +7 -1
  25. package/src/collections/collection-types.ts +8 -1
  26. package/src/collections/providers.ts +4 -1
  27. package/src/collections/review.ts +23 -4
  28. package/src/commands/model.ts +36 -0
  29. package/src/commands/registry.ts +49 -0
  30. package/src/commands/routes.ts +59 -0
  31. package/src/commands/runner.ts +35 -0
  32. package/src/commands/runs.ts +112 -0
  33. package/src/core/app-icon.ts +4 -3
  34. package/src/core/icon-type.ts +8 -0
  35. package/src/core/jobs.ts +4 -3
  36. package/src/core/layout.ts +11 -2
  37. package/src/core/squircle.ts +95 -0
  38. package/src/home/daemon-jobs.ts +26 -2
  39. package/src/home/global-units.ts +3 -0
  40. package/src/home/gui-app/ShipkitGui.swift +337 -5
  41. package/src/home/gui-app.ts +64 -33
  42. package/src/home/hmr-keep.ts +134 -0
  43. package/src/home/home-start.ts +2 -2
  44. package/src/home/lib-watch.ts +21 -11
  45. package/src/home/pm-switch.ts +112 -0
  46. package/src/home/pm.ts +1 -1
  47. package/src/home/process-apps.ts +181 -0
  48. package/src/home/resources.ts +3 -3
  49. package/src/home/run-web.ts +7 -4
  50. package/src/home/serve-web.ts +64 -14
  51. package/src/identities/collection.ts +49 -0
  52. package/src/identities/identities.ts +121 -14
  53. package/src/identities/machine.ts +4 -3
  54. package/src/identities/rating.ts +33 -0
  55. package/src/identities/shown.ts +170 -0
  56. package/src/identities/steps.ts +5 -0
  57. package/src/media-store/purge.ts +15 -1
  58. package/src/media-store/remote.ts +22 -6
  59. package/src/messages/brief.ts +117 -0
  60. package/src/messages/collection.ts +40 -0
  61. package/src/messages/model.ts +171 -0
  62. package/src/messages/routes.ts +15 -0
  63. package/src/messages/score.ts +182 -0
  64. package/src/messages/tabs.ts +13 -0
  65. package/src/release/notes.ts +130 -0
  66. package/src/release/run-bump.ts +41 -18
  67. package/src/release/run-release.ts +22 -4
  68. package/src/release/run-releases.ts +17 -15
  69. package/src/release/unit-resolve.ts +9 -0
  70. package/src/releases/add.ts +94 -0
  71. package/src/releases/before.ts +31 -0
  72. package/src/releases/collection.ts +36 -0
  73. package/src/releases/from-card.ts +151 -0
  74. package/src/releases/model.ts +327 -0
  75. package/src/releases/pictures.ts +110 -0
  76. package/src/releases/routes.ts +36 -0
  77. package/src/releases/store.ts +71 -0
  78. package/src/repo-config.ts +5 -0
  79. package/src/review/cells.ts +0 -11
  80. package/src/review/format.ts +10 -6
  81. package/src/review/http.ts +1 -1
  82. package/src/review/model.ts +102 -3
  83. package/src/review/notes.ts +2 -48
  84. package/src/review/routes.ts +28 -10
  85. package/src/review/stage-card.ts +197 -0
  86. package/src/review/stage-routes.ts +123 -0
  87. package/src/review/store.ts +47 -1
  88. package/src/review/trailer-card.ts +99 -0
  89. package/src/review/trailer-desk.ts +76 -4
  90. package/src/review/trailer-model.ts +106 -7
  91. package/src/review/trailer-notes.ts +45 -0
  92. package/src/review/trailer-routes.ts +119 -13
  93. package/src/review/trailer-voices.ts +144 -0
  94. package/src/review/watchers.ts +58 -1
  95. package/src/serve/hub-app/app-bridge.ts +71 -0
  96. package/src/serve/hub-app/benign-errors.ts +22 -0
  97. package/src/serve/hub-app/commands/commands-page.tsx +122 -0
  98. package/src/serve/hub-app/commands/commands-st.ts +177 -0
  99. package/src/serve/hub-app/commands.css +24 -0
  100. package/src/serve/hub-app/hash-route.ts +59 -8
  101. package/src/serve/hub-app/home-st.ts +19 -2
  102. package/src/serve/hub-app/home.html +3 -0
  103. package/src/serve/hub-app/hub-app.tsx +8 -0
  104. package/src/serve/hub-app/icons.tsx +5 -0
  105. package/src/serve/hub-app/identities-view.tsx +4 -1
  106. package/src/serve/hub-app/identities.css +1 -0
  107. package/src/serve/hub-app/index.html +3 -0
  108. package/src/serve/hub-app/keys.ts +2 -2
  109. package/src/serve/hub-app/machine-st.ts +41 -10
  110. package/src/serve/hub-app/messages/messages-page.tsx +354 -0
  111. package/src/serve/hub-app/messages/messages-st.ts +74 -0
  112. package/src/serve/hub-app/messages.css +35 -0
  113. package/src/serve/hub-app/project-list.css +7 -2
  114. package/src/serve/hub-app/project-list.tsx +9 -0
  115. package/src/serve/hub-app/projects-svc.ts +16 -6
  116. package/src/serve/hub-app/releases/releases-page.tsx +187 -0
  117. package/src/serve/hub-app/releases/releases-st.ts +111 -0
  118. package/src/serve/hub-app/releases.css +52 -0
  119. package/src/serve/hub-app/repo-sections.ts +16 -2
  120. package/src/serve/hub-app/repo-st.ts +66 -10
  121. package/src/serve/hub-app/review/clip-st.ts +34 -4
  122. package/src/serve/hub-app/review/kit.tsx +3 -3
  123. package/src/serve/hub-app/review/note-place.ts +31 -0
  124. package/src/serve/hub-app/review/review-cells.tsx +27 -3
  125. package/src/serve/hub-app/review/review-st.ts +77 -2
  126. package/src/serve/hub-app/review/review-thread.tsx +9 -31
  127. package/src/serve/hub-app/review/review-views.tsx +164 -58
  128. package/src/serve/hub-app/review/thread-st.ts +108 -41
  129. package/src/serve/hub-app/review/trailer-card.tsx +187 -0
  130. package/src/serve/hub-app/review/trailer-page.tsx +92 -36
  131. package/src/serve/hub-app/review/trailer-st.ts +306 -34
  132. package/src/serve/hub-app/review/trailer-timeline.tsx +68 -23
  133. package/src/serve/hub-app/review/trailer-voices-st.ts +370 -0
  134. package/src/serve/hub-app/review/trailer-voices.tsx +574 -0
  135. package/src/serve/hub-app/review.css +137 -6
  136. package/src/serve/hub-app/social/comms-page.tsx +65 -28
  137. package/src/serve/hub-app/social/identity-pictures.ts +46 -8
  138. package/src/serve/hub-app/social/kit.tsx +9 -6
  139. package/src/serve/hub-app/social/next-release.tsx +118 -0
  140. package/src/serve/hub-app/social/post-card.tsx +10 -2
  141. package/src/serve/hub-app/social/social-model.ts +39 -3
  142. package/src/serve/hub-app/social/social-page.tsx +179 -65
  143. package/src/serve/hub-app/social/social-st.ts +117 -27
  144. package/src/serve/hub-app/social/stage-popup.tsx +268 -0
  145. package/src/serve/hub-app/social/stage-st.ts +310 -0
  146. package/src/serve/hub-app/social/step-layout.ts +42 -0
  147. package/src/serve/hub-app/social.css +68 -1
  148. package/src/serve/hub-app/tree-build.ts +40 -1
  149. package/src/serve/hub-app/tree-svc.ts +10 -3
  150. package/src/serve/project-gutter-route.ts +12 -2
  151. package/src/serve/project-gutter.ts +4 -2
  152. package/src/serve/same-origin.ts +24 -1
  153. package/src/serve/serve-hub.ts +15 -1
  154. package/src/shipkit-files.ts +9 -7
  155. package/src/shot/box.ts +33 -12
  156. package/src/shot/client.ts +1 -1
  157. package/src/shot/shooter.ts +22 -12
  158. package/src/shot/shot-ask.ts +14 -3
  159. package/src/shot/shot.shipkit.ts +1 -1
  160. package/src/social/desk-index.ts +49 -8
  161. package/src/social/discord-layout.ts +54 -7
  162. package/src/social/drafts.ts +1 -1
  163. package/src/social/fit.ts +84 -0
  164. package/src/social/identity-words.ts +74 -0
  165. package/src/social/kind-pages.ts +41 -0
  166. package/src/social/kinds.ts +93 -0
  167. package/src/social/load.ts +125 -10
  168. package/src/social/media-limit.ts +63 -2
  169. package/src/social/presence.ts +1 -1
  170. package/src/social/publish/bluesky.ts +58 -19
  171. package/src/social/publish/index.ts +47 -6
  172. package/src/social/reach.ts +49 -0
  173. package/src/social/release-stage.ts +277 -0
  174. package/src/social/routes.ts +44 -8
  175. package/src/social/stage.ts +246 -0
  176. package/src/social/strip.ts +85 -0
  177. package/src/social/text.ts +6 -2
  178. package/src/social/unit.ts +57 -1
  179. package/src/social/writes.ts +11 -0
  180. package/src/trailer/bed.ts +111 -0
  181. package/src/trailer/build.ts +72 -40
  182. package/src/trailer/ffmpeg.ts +6 -0
  183. package/src/trailer/grammar.ts +37 -6
  184. package/src/trailer/graph.ts +12 -1
  185. package/src/trailer/public-words.ts +41 -0
  186. package/src/trailer/shot-plan.ts +75 -0
  187. package/src/trailer/shot-state.ts +191 -0
  188. package/src/trailer/sound/audio.ts +28 -0
  189. package/src/trailer/sound/brand.ts +53 -3
  190. package/src/trailer/sound/gen.ts +61 -2
  191. package/src/trailer/sound/index.ts +25 -11
  192. package/src/trailer/sound/presets.ts +86 -5
  193. package/src/trailer/sound/run.ts +1 -1
  194. package/src/trailer/sound/takes.ts +94 -0
  195. package/src/trailer/titles.ts +36 -0
  196. package/src/trailer/url.ts +1 -1
@@ -41,3 +41,87 @@ export class ReleasesCommand extends Command {
41
41
  }
42
42
  }
43
43
  }
44
+
45
+ export class ReleasesAddCommand extends Command {
46
+ static override paths = [['releases', 'add']]
47
+
48
+ static override usage = Command.Usage({
49
+ category: 'Gate',
50
+ description: 'a change of .shipkit/releases/next.md by hand: its line, text, picture, before, bullets',
51
+ details:
52
+ "one change of the release being filled. With --card, the card's changelog line and media (what his approval adds, run again by hand when it failed: a pair as its after and its before, two stills, the before dropped when blank or the same as the after; a clip as it is, else its image); a category and a title given beside it win. A change of the same card, else of the same title, is replaced, its description, bullets and shots kept unless given; a new --image takes the place of the shot of its rating and drops that shot's before unless --before gives one. Every picture carries its rating (--rating, else the card's; unrated reads explicit, so no SFW venue shows it). A picture goes to the Space private; `sk bump` makes it public. The repo's guard reads every word first. Committed by pathspec",
53
+ examples: [
54
+ ['the change of an approved card, again', 'sk releases add --card 20261108-115317-move-her'],
55
+ ['a change by hand', 'sk releases add Studio "Move the body anywhere on the floor" --text "Drag the ring at the feet." --bullet "double tap: back to the middle" --image shot.webp'],
56
+ ["a card's change, a new after and its before", 'sk releases add --card 20261108-115317-move-her --image after.webp --before before.webp'],
57
+ ["a card's picture looked at: safe", 'sk releases add --card 20261108-115317-move-her --rating safe'],
58
+ ['the next release is a minor one', 'sk releases add --kind minor'],
59
+ ],
60
+ })
61
+
62
+ category = Option.String({ required: false })
63
+ title = Option.String({ required: false })
64
+ text = Option.String('--text', { description: 'its description, markdown' })
65
+ bullets = Option.Array('--bullet', { description: 'a bullet under it (repeat it)' })
66
+ image = Option.String('--image', { description: 'its picture: a png, jpg, webp or a clip' })
67
+ before = Option.String('--before', { description: 'what it looked like before: a png, jpg or webp, a tab beside the picture' })
68
+ rating = Option.String('--rating', { description: "what its picture shows: safe, mild or explicit; with no new picture, rates the change's one unrated shot" })
69
+ card = Option.String('--card', { description: 'the review card it comes from: its line and media' })
70
+ commit = Option.String('--commit', { description: 'the commit it ships' })
71
+ kind = Option.String('--kind', { description: 'what kind of release next is: major, minor or patch' })
72
+ heading = Option.String('--release-title', { description: "the release's own title, its # heading" })
73
+
74
+ async execute(): Promise<number> {
75
+ try {
76
+ const { addByHand } = await import('../releases/add.ts')
77
+ const file = await addByHand(process.cwd(), {
78
+ ...(this.category !== undefined ? { category: this.category } : {}),
79
+ ...(this.title !== undefined ? { title: this.title } : {}),
80
+ ...(this.text !== undefined ? { text: this.text } : {}),
81
+ ...(this.bullets !== undefined ? { bullets: this.bullets } : {}),
82
+ ...(this.image !== undefined ? { image: this.image } : {}),
83
+ ...(this.before !== undefined ? { before: this.before } : {}),
84
+ ...(this.rating !== undefined ? { rating: this.rating } : {}),
85
+ ...(this.card !== undefined ? { card: this.card } : {}),
86
+ ...(this.commit !== undefined ? { commit: this.commit } : {}),
87
+ ...(this.kind !== undefined ? { kind: this.kind } : {}),
88
+ ...(this.heading !== undefined ? { heading: this.heading } : {}),
89
+ })
90
+ this.context.stdout.write(`ok: ${file}\n`)
91
+ return 0
92
+ } catch (e) {
93
+ this.context.stderr.write(`FAIL: ${e instanceof Error ? e.message : String(e)}\n`)
94
+ return 1
95
+ }
96
+ }
97
+ }
98
+
99
+ export class ReleasesRefreshCommand extends Command {
100
+ static override paths = [['releases', 'refresh']]
101
+
102
+ static override usage = Command.Usage({
103
+ category: 'Gate',
104
+ description: "every change of next.md still showing a pair's wipe takes its card's stills: the after, the before",
105
+ details:
106
+ "each change of .shipkit/releases/next.md whose picture is still a clip while its card's media is a pair of images (the looping wipe an approval no longer writes) takes that card's newest approved version as two stills: the after as its picture, the before beside it, dropped when blank or the same as the after. Any other picture stays, a retake by hand included. Its title, description and bullets stay. Kept private in the Space; `sk bump` makes it public. Committed by pathspec",
107
+ examples: [
108
+ ['what would move', 'sk releases refresh --dry'],
109
+ ["next.md's wipes, as stills", 'sk releases refresh'],
110
+ ],
111
+ })
112
+
113
+ dry = Option.Boolean('--dry', false, { description: 'list the changes that would move, write nothing' })
114
+
115
+ async execute(): Promise<number> {
116
+ try {
117
+ const { refreshFromCards } = await import('../releases/from-card.ts')
118
+ const r = await refreshFromCards(process.cwd(), { dry: this.dry })
119
+ for (const m of r.moved) this.context.stdout.write(`${this.dry ? '' : 'stills: '}${m.title}${this.dry ? '' : `, before ${m.before}`}\n`)
120
+ this.context.stdout.write(this.dry ? `ok: ${r.moved.length} changes would take stills\n` : r.file ? `ok: ${r.moved.length} changes took stills, ${r.file}\n` : 'ok: no change shows a wipe\n')
121
+ return 0
122
+ } catch (e) {
123
+ this.context.stderr.write(`FAIL: ${e instanceof Error ? e.message : String(e)}\n`)
124
+ return 1
125
+ }
126
+ }
127
+ }
@@ -155,14 +155,22 @@ function flagsOf(args: readonly string[], values: readonly string[], repeat: rea
155
155
  const ADD_FLAGS = `flags:
156
156
  --title "<title>" one short line: what he looks at
157
157
  --what "<what>" what changed and why, short markdown: one line, then - bullets
158
- --image <a.png> the subject; a clip (webm, mp4) goes anywhere an image goes
158
+ --post "<line>" the public line for a post of it, what a user gets (the repo's guard reads it)
159
+ --changelog "<category>: <line>" its change in the release being filled: on his approval it lands in .shipkit/releases/next.md with the card's after picture (the repo's guard reads it)
160
+ --rating <safe|mild|explicit> with --changelog: what its media shows at full size, the rating its picture lands with; unset, unrated (reads explicit: no SFW venue shows it)
161
+ --image <a.png> the subject; a clip (webm, mp4) goes anywhere an image goes
159
162
  --video <clip.mp4> a clip
160
163
  --audio <sound.wav> a sound: a waveform and a player (wav, mp3, flac, ogg, opus, m4a)
161
164
  --before <a.png> --after <b.png> a before and after: two images, two clips of one size, or two sounds
162
165
  --label "<label>" the first view's label
163
166
  --view "<label>" <a.png> [<b.png>] another view of the same subject (repeat it); --note "<text>" right after it: a line on that view
164
167
  --choice every view is an option he scores and picks one of (two --view or more)
168
+ --pick <view> with --choice: the option you suggest, by its letter (B) or its label; the hub pills it « my pick » (later: sk review pick <id> <view>)
165
169
  --gallery "<label>" <a.png> … a grid he rates tile by tile (stars, OK, fix or no, a word), alone or beside other views; a tile is "[<row>/]<label>=[<before>,]<after>": a redraw carries its before, a row holds one asset's variants
170
+ --trailer <cut.trailer> a trailer cut, played in the card by the trailer entry's player, never a compiled clip; his notes land on its shots
171
+ --version v<n> with --trailer: a kept version of that cut, else the cut's own render
172
+ --before v<m> | <cut> with --trailer: the render he switches to on the same shot
173
+ --shots <a,b> with --trailer: the shots the change touched (else, with --before, the shots whose block differs)
166
174
  --topic <topic> what part of the project it is about (sk review topics)
167
175
  --subject <kind> what is judged (default shot; the repo's unit names its kinds)
168
176
  --commit <sha> the commit it shows
@@ -185,6 +193,33 @@ async function helpWithUnit(context: Ctx, usage: string, kinds: boolean): Promis
185
193
  return 0
186
194
  }
187
195
 
196
+ /** --trailer and its flags as a card: its cut, pinned renders and shots, the image it keeps (a still cut into a temp
197
+ * folder `drop` removes); null without --trailer, which then refuses its own flags */
198
+ export async function trailerOfFlags(o: Record<string, string>, others: boolean): Promise<{ card: import('../review/model.ts').TrailerCard; image: string; drop: () => void } | null> {
199
+ if (o.trailer === undefined) {
200
+ for (const k of ['version', 'shots']) if (o[k] !== undefined) throw new Error(`--${k}: only with --trailer <cut.trailer>`)
201
+ return null
202
+ }
203
+ const clash = ['image', 'video', 'audio', 'after', 'live'].filter((k) => o[k] !== undefined)
204
+ if (clash.length > 0 || others) throw new Error(`--trailer: the card plays the cut; no ${clash.length > 0 ? clash.map((k) => `--${k}`).join(', ') : '--view, --gallery, --choice or --wip'} beside it`)
205
+ const { mkdtempSync, rmSync } = await import('node:fs')
206
+ const { tmpdir } = await import('node:os')
207
+ const { join } = await import('node:path')
208
+ const { findRepoRoot } = await import('../ts/config.ts')
209
+ const { trailerCardOf } = await import('../review/trailer-card.ts')
210
+ const tmp = mkdtempSync(join(tmpdir(), 'trailer-card-'))
211
+ const drop = (): void => rmSync(tmp, { recursive: true, force: true })
212
+ try {
213
+ const shots = o.shots?.split(',').map((s) => s.trim()).filter((s) => s !== '')
214
+ const input = { file: o.trailer, ...(o.version ? { version: o.version } : {}), ...(o.before ? { before: o.before } : {}), ...(shots ? { shots } : {}) }
215
+ const r = await trailerCardOf(findRepoRoot(process.cwd()), process.cwd(), input, join(tmp, 'still.png'))
216
+ return { ...r, drop }
217
+ } catch (e) {
218
+ drop()
219
+ throw e
220
+ }
221
+ }
222
+
188
223
  export class ReviewAddCommand extends Command {
189
224
  static override paths = [['review', 'add']]
190
225
  static override usage = Command.Usage({
@@ -195,8 +230,9 @@ export class ReviewAddCommand extends Command {
195
230
  ['one image', 'sk review add --title "the new menu" --what "the menu, bigger" --image shots/menu.png'],
196
231
  ['a before and after', 'sk review add --title "lamps lit" --what "..." --before a.png --after b.png'],
197
232
  ['a second version after his answer', 'sk review add --title "lamps lit" --what "..." --image c.png --supersedes <id>'],
198
- ['a pick among three voices', 'sk review add --choice --title "the narrator" --what "..." --view "voice 0" a.flac --note "low, breathy" --view "voice 1" b.flac --view "voice 2" c.flac'],
233
+ ['a pick among three voices, yours on the second', 'sk review add --choice --pick B --title "the narrator" --what "..." --view "voice 0" a.flac --note "low, breathy" --view "voice 1" b.flac --view "voice 2" c.flac'],
199
234
  ['icons he rates one by one', 'sk review add --title "buff icons" --what "..." --gallery "icons" vitality=a.png haste=b.png greed=c.png'],
235
+ ['a trailer cut against its last kept version', 'sk review add --trailer trailer/demo/main.trailer --version v4 --before v3 --title "the drop, recut" --what "..."'],
200
236
  ],
201
237
  })
202
238
  args = Option.Proxy()
@@ -212,9 +248,10 @@ export class ReviewAddCommand extends Command {
212
248
  const kindName = rest[rest.indexOf('--subject') + 1]
213
249
  const kind = rest.includes('--subject') && kindName ? h.unit?.kinds?.[kindName] : undefined
214
250
  const own = [...Object.keys(kind?.flags ?? {}), ...Object.keys(h.unit?.flags ?? {})]
215
- const f = flagsOf(rest, ['title', 'what', 'image', 'video', 'audio', 'before', 'after', 'label', 'topic', 'subject', 'commit', 'lane', 'supersedes', 'keeps', 'why', 'live'], ['answers', ...own], ['new', 'wip', 'choice'])
251
+ const f = flagsOf(rest, ['title', 'what', 'post', 'changelog', 'rating', 'image', 'video', 'audio', 'before', 'after', 'label', 'topic', 'subject', 'commit', 'lane', 'supersedes', 'keeps', 'why', 'live', 'trailer', 'version', 'shots', 'pick'], ['answers', ...own], ['new', 'wip', 'choice'])
216
252
  if (f.positionals.length > 0) throw new Error(`unexpected ${f.positionals.join(' ')}`)
217
253
  const o = f.one
254
+ const trailer = await trailerOfFlags(o, views.length > 0 || f.on.has('wip') || f.on.has('choice'))
218
255
  const repoFlags = Object.fromEntries(own.flatMap((k) => (f.many[k] ? [[k, f.many[k]]] : [])))
219
256
  const parsed = kind?.parse ? kind.parse(Object.fromEntries(Object.keys(kind.flags ?? {}).map((k) => [k, f.many[k] ?? []]))) : null
220
257
  if (f.on.has('wip') !== (o.live !== undefined)) throw new Error('--wip --live <name>: a draft card names its live shot, and a live shot makes a draft card')
@@ -226,16 +263,46 @@ export class ReviewAddCommand extends Command {
226
263
  wipViews = [{ label: '', image: fr.image }, ...(fr.history.length > 0 ? [{ label: 'history', gallery: fr.history }] : [])]
227
264
  }
228
265
  const answers = await Promise.all((f.many.answers ?? []).map((a) => idOf(h.dir, a)))
266
+ if (o.post !== undefined) {
267
+ // a public line: the repo's guard reads it before the card holds it
268
+ const { dirname } = await import('node:path')
269
+ const { loadSocialUnit } = await import('../social/unit.ts')
270
+ const unit = await loadSocialUnit(dirname(dirname(h.dir)))
271
+ const problems = unit?.guard ? [...unit.guard({ title: '', alt: '', texts: [o.post], files: [] })] : []
272
+ if (problems.length > 0) throw new Error(`--post: the repo's guard refuses it: ${problems.join('; ')}`)
273
+ }
274
+ let changelog: import('../review/model.ts').CardChangelog | undefined
275
+ if (o.rating !== undefined && o.changelog === undefined) throw new Error('--rating rates the picture its --changelog line lands with: give --changelog too')
276
+ if (o.changelog !== undefined) {
277
+ // its category and line are public words: the repo's guard reads them before the card holds them
278
+ const { dirname } = await import('node:path')
279
+ const { changelogOfFlag } = await import('../review/model.ts')
280
+ const { publicProblems } = await import('../social/unit.ts')
281
+ const { undeclaredReleases } = await import('../releases/store.ts')
282
+ changelog = changelogOfFlag(o.changelog)
283
+ if (o.rating !== undefined) {
284
+ const { isPostRating, POST_RATINGS } = await import('../identities/rating.ts')
285
+ if (!isPostRating(o.rating)) throw new Error(`--rating ${o.rating}: one of ${POST_RATINGS.join(', ')}`)
286
+ changelog.rating = o.rating
287
+ }
288
+ const why = await undeclaredReleases(dirname(dirname(h.dir)))
289
+ if (why) throw new Error(`--changelog: ${why}`)
290
+ const problems = await publicProblems(dirname(dirname(h.dir)), { texts: [changelog.category, changelog.line] })
291
+ if (problems.length > 0) throw new Error(`--changelog: the repo's guard refuses it: ${problems.join('; ')}`)
292
+ }
229
293
  const topic = o.topic ?? parsed?.topic
230
294
  let input: import('../review/store.ts').AddInput = {
231
295
  title: o.title ?? '',
232
296
  what: o.what ?? '',
233
- ...(parsed ? { subject: parsed.subject } : o.subject ? { subject: { kind: o.subject } } : {}),
297
+ ...(o.post ? { post: o.post } : {}),
298
+ ...(changelog ? { changelog } : {}),
299
+ ...(parsed ? { subject: parsed.subject } : o.subject ? { subject: { kind: o.subject } } : trailer ? { subject: { kind: 'trailer' } } : {}),
234
300
  ...(topic ? { topic } : {}),
301
+ ...(trailer ? { image: trailer.image, trailer: trailer.card } : {}),
235
302
  ...(o.image ? { image: o.image } : {}),
236
303
  ...(o.video ? { video: o.video } : {}),
237
304
  ...(o.audio ? { audio: o.audio } : {}),
238
- ...(o.before ? { before: o.before } : {}),
305
+ ...(o.before && !trailer ? { before: o.before } : {}),
239
306
  ...(o.after ? { after: o.after } : {}),
240
307
  ...(o.label ? { label: o.label } : {}),
241
308
  ...(o.commit ? { commit: o.commit } : {}),
@@ -246,12 +313,15 @@ export class ReviewAddCommand extends Command {
246
313
  ...(answers.length > 0 ? { answers } : {}),
247
314
  ...(f.on.has('new') ? { fresh: true } : {}),
248
315
  ...(f.on.has('choice') ? { choice: true } : {}),
316
+ ...(o.pick !== undefined ? { agentPick: o.pick } : {}),
249
317
  ...(o.live !== undefined ? { image: wipViews[0]?.image ?? '', views: wipViews.slice(1), wip: { live: o.live } } : { views }),
250
318
  }
251
319
  if (h.unit?.add) input = await h.unit.add(input, repoFlags)
252
- const item = await addItem(h.dir, input)
320
+ const item = await addItem(h.dir, input).finally(() => trailer?.drop())
253
321
  h.out(item.id)
322
+ if (item.trailer) h.out(`trailer card: ${item.trailer.trailer}/${item.trailer.after.cut}${item.trailer.before ? ` against ${item.trailer.before.cut}` : ''}${item.trailer.shots.length > 0 ? `, shots ${item.trailer.shots.join(', ')}` : ''}`)
254
323
  if (item.origin.by === 'agent' && !item.origin.lane) h.err('no lane on the card: pass --lane <id> (or SK_AGENT), so the hub colours it')
324
+ if (item.choice && item.agentPick === undefined) h.err(`a choice with no pick of yours: every question carries one, sk review pick ${item.id} <view> (or --pick on add)`)
255
325
  const { unheardLine } = await import('../review/model.ts')
256
326
  const { liveWatchers } = await import('../review/watchers.ts')
257
327
  const unheard = unheardLine(item, liveWatchers(h.dir))
@@ -553,6 +623,29 @@ export class ReviewReopenCommand extends Command {
553
623
  }
554
624
  }
555
625
 
626
+ export class ReviewPickCommand extends Command {
627
+ static override paths = [['review', 'pick']]
628
+ static override usage = Command.Usage({
629
+ category: 'Review',
630
+ description: "the option you suggest on a choice card he has not answered: the hub's « my pick » pill on it",
631
+ details: `${DETAILS}\n\nsk review pick <id> <view>: the view by its letter (B) or its label; one pick a card, a new one replaces it. On add: --choice … --pick <view>.`,
632
+ examples: [['suggest the second option', 'sk review pick <id> B'], ['by its label', 'sk review pick <id> "Zen Garden"']],
633
+ })
634
+ id = Option.String({ required: true })
635
+ view = Option.String({ required: true })
636
+
637
+ async execute(): Promise<number> {
638
+ return run(this.context, async (h) => {
639
+ const { setAgentPick } = await import('../review/store.ts')
640
+ const { viewLetter, viewName } = await import('../review/model.ts')
641
+ const item = setAgentPick(h.dir, this.id, this.view)
642
+ const n = item.agentPick ?? 0
643
+ h.out(`${this.id}: my pick ${viewLetter(n)} "${viewName(item.views[n], n)}"`)
644
+ return 0
645
+ })
646
+ }
647
+ }
648
+
556
649
  type ActOp = 'fixed' | 'wontfix' | 'claim' | 'release' | 'blocked' | 'done' | 'dispatch' | 'ask' | 'drop' | 'reassign'
557
650
 
558
651
  /** one state change: by a worker on its claim, or by the dispatcher on what it routes; the item, then the new state */
@@ -847,6 +940,76 @@ export class ReviewAnimCommand extends Command {
847
940
  }
848
941
  }
849
942
 
943
+ export class ReviewStageCommand extends Command {
944
+ static override paths = [['review', 'stage']]
945
+ static override usage = Command.Usage({
946
+ category: 'Review',
947
+ description: "one media of a card staged as a post: a draft in .shipkit/social/drafts/, never posted",
948
+ details: `${DETAILS}\n\nThe media copied in with its metadata left out, the repo's guard run first, the draft committed by its paths. Without --view, the newest version's first media. Without --kind, iteration: feature, a change users can use now, is picked by hand. --dry prints the draft as it would be written, then each account, its place, its count, what it skips. It never publishes: Publish stays his, in Communications. Page: wiki tools/shipkit/review-raised-items.md, A post staged from a card`,
949
+ examples: [
950
+ ['the first media, a safe post', 'sk review stage <id> --text "Hands now pinch and lift." --rating safe'],
951
+ ["the second view's wipe, polished by an agent", 'sk review stage <id> --view B --side wipe --text "…" --rating mild --polish'],
952
+ ['what it would be', 'sk review stage <id> --text "…" --rating safe --dry'],
953
+ ],
954
+ })
955
+ id = Option.String({ required: true })
956
+ view = Option.String('--view', { description: 'the view by its letter (A, B…) of the newest version, or <n>.<letter> of an older one' })
957
+ side = Option.String('--side', { description: 'a pair: after (default), before or wipe' })
958
+ tile = Option.String('--tile', { description: 'a gallery: the tile by its label' })
959
+ text = Option.String('--text', { description: 'the post (required)' })
960
+ rating = Option.String('--rating', { description: 'safe, mild or explicit: what the media shows at full size (required)' })
961
+ kind = Option.String('--kind', { description: "what the post is for, a kind of the set or the unit (default iteration: feature, a change users can use now, is picked by hand)" })
962
+ kindWhy = Option.String('--kind-why', { description: 'with --kind custom: one line on why no kind fits' })
963
+ alt = Option.String('--alt', { description: 'what the media shows' })
964
+ slot = Option.String('--slot', { description: '<YYYY-MM-DD> <tag>, a slot of the rhythm' })
965
+ tags = Option.String('--tags', { description: '#a #b' })
966
+ polish = Option.Boolean('--polish', false, { description: "an agent rewrites it in the identity's voice" })
967
+ from = Option.String('--from', { description: "a clip's passage: its in, in seconds" })
968
+ to = Option.String('--to', { description: "a clip's passage: its out, in seconds" })
969
+ fit = Option.Boolean('--fit', false, { description: 'one copy within the tightest limits of the venues it reaches' })
970
+ dry = Option.Boolean('--dry', false, { description: 'write nothing: print the draft as it would load' })
971
+
972
+ async execute(): Promise<number> {
973
+ return run(this.context, async (h) => {
974
+ const { dirname, join } = await import('node:path')
975
+ const { isPostRating, POST_RATINGS } = await import('../identities/rating.ts')
976
+ const missing = [this.text === undefined ? '--text "<the post>"' : null, this.rating === undefined ? `--rating <${POST_RATINGS.join('|')}>` : null].filter((x) => x !== null)
977
+ if (this.text === undefined || this.rating === undefined) throw new Error(`sk review stage ${this.id} needs ${missing.join(' and ')}`)
978
+ const { stageInputOf, stageOfCard } = await import('../review/stage-card.ts')
979
+ const { askPolish, fitStage, stagedKind, stageDraft, stageDry } = await import('../social/stage.ts')
980
+ const { loadSocialUnit } = await import('../social/unit.ts')
981
+ if (!isPostRating(this.rating)) throw new Error(`--rating ${this.rating}: one of ${POST_RATINGS.join(', ')}`)
982
+ const root = dirname(dirname(h.dir))
983
+ const id = await idOf(h.dir, this.id)
984
+ const s = stageOfCard(h.dir, id)
985
+ let pick: string | undefined
986
+ if (this.view) {
987
+ const m = /^(?:(\d+)\.)?([A-Z]+)$/i.exec(this.view)
988
+ if (m == null) throw new Error(`--view ${this.view}: a letter, or <n>.<letter>`)
989
+ const tag = `${m[1] ?? Math.max(...s.media.map((x) => Number(x.label.split('.')[0])))}.${m[2]!.toUpperCase()}`
990
+ const of = s.media.filter((x) => x.label.startsWith(`${tag} `))
991
+ const tile = this.tile
992
+ const hit = tile ? of.find((x) => x.tile !== undefined && (x.label.endsWith(`/${tile}`) || x.label.endsWith(` ${tile}`))) : of.find((x) => (x.side ?? 'after') === (this.side ?? 'after'))
993
+ if (hit == null) throw new Error(`no media ${tag}${this.side ? ` ${this.side}` : ''}${this.tile ? ` tile ${this.tile}` : ''}: ${s.media.map((x) => x.label).join(', ')}`)
994
+ pick = hit.key
995
+ }
996
+ const font = h.unit?.anim?.font ? join(root, h.unit.anim.font) : undefined
997
+ if ((this.from === undefined) !== (this.to === undefined)) throw new Error('a passage takes --from and --to')
998
+ const passage = this.from !== undefined && this.to !== undefined ? { from: Number(this.from), to: Number(this.to) } : null
999
+ const { input } = await stageInputOf(h.dir, id, { ...(pick ? { pick } : {}), text: this.text, rating: this.rating, ...(this.kind ? { kind: this.kind } : {}), ...(this.kindWhy ? { kindWhy: this.kindWhy } : {}), ...(this.alt ? { alt: this.alt } : {}), ...(this.slot ? { slot: this.slot } : {}), ...(this.tags ? { tags: this.tags } : {}), ...(passage ? { passage } : {}) }, font)
1000
+ const unit = await loadSocialUnit(root)
1001
+ const r = this.dry ? await stageDry(root, input, { unit }) : await stageDraft(root, this.fit ? await fitStage(root, input, { unit }) : input, { unit })
1002
+ h.out(`${this.dry ? 'would stage' : 'staged'} ${r.slug}${input.media ? `: ${input.media.name}` : ''}, ${input.rating}, kind ${r.draft?.kind || stagedKind(input)}`)
1003
+ if (this.dry && r.text) h.out(`\n${r.text.trimEnd()}\n`)
1004
+ for (const p of r.draft?.posts ?? []) h.out(` ${p.key}${p.place ? ` #${p.place}` : ''} ${p.length}${p.refused ? ` refused: ${p.refused}` : ''}`)
1005
+ for (const k of r.draft?.skipped ?? []) h.out(` ${k.account} skipped: ${k.why}`)
1006
+ for (const e of r.errors) h.err(`WARN ${e}`)
1007
+ if (this.polish && !this.dry) h.out(`polish asked: ${(await askPolish(root, r.slug, input.title, unit)).id}`)
1008
+ return 0
1009
+ })
1010
+ }
1011
+ }
1012
+
850
1013
  export class ReviewAutoCommand extends Command {
851
1014
  static override paths = [['review', 'auto']]
852
1015
  static override usage = Command.Usage({
@@ -903,8 +1066,8 @@ export class ReviewWatchCommand extends Command {
903
1066
  static override paths = [['review', 'watch']]
904
1067
  static override usage = Command.Usage({
905
1068
  category: 'Review',
906
- description: 'one line per verdict, reply or raised note as it lands; every unseen one at start; never exits',
907
- details: `${DETAILS}\n\nRun it under a monitor, unfiltered (a grep holds a burst's last line). It registers itself, so the hub shows who listens. An item nobody takes prints 2 minutes after its last message, then every 2 hours.`,
1069
+ description: 'one line per verdict, reply or raised note as it lands; every unseen one first; ends with its owner',
1070
+ details: `${DETAILS}\n\nRun it under a monitor, unfiltered (a grep holds a burst's last line). It registers itself, so the hub shows who listens. It exits within 2 s once a process above it at start is gone or nothing reads its output. An item nobody takes prints 2 minutes after its last message, then every 2 hours.`,
908
1071
  examples: [['the cards this session sent', 'sk review watch --mine'], ["one lane's items", 'sk review watch --lane interaction']],
909
1072
  })
910
1073
  mine = Option.Boolean('--mine', false, { description: "only this Claude Code session's cards" })
@@ -918,13 +1081,14 @@ export class ReviewWatchCommand extends Command {
918
1081
  const { AGENT_RE, coversCard, laneOf, UNTAKEN_AGAIN_MS, untakenOf } = await import('../review/model.ts')
919
1082
  const { followedIds, unseen } = await import('../review/threads.ts')
920
1083
  const { raisedLine, untakenLine, watchLines } = await import('../review/format.ts')
921
- const { liveWatchers, registerWatch } = await import('../review/watchers.ts')
1084
+ const { exitWithOwner, liveWatchers, registerWatch } = await import('../review/watchers.ts')
922
1085
  const session = await sessionOf(this.mine, this.session)
923
1086
  const lane = this.lane?.trim() || null
924
1087
  if (lane !== null && !AGENT_RE.test(lane)) throw new Error(`--lane: « ${lane} » is no lane id (${AGENT_RE.source})`)
925
1088
  const mine = (x: Parameters<typeof coversCard>[1]): boolean => coversCard({ session, lane }, x)
926
1089
  registerWatch(h.dir, { session, lane })
927
- const parent = process.ppid
1090
+ // before any await: a pull that hangs never keeps a watch alive past its owner
1091
+ exitWithOwner()
928
1092
  const shown = new Set<string>()
929
1093
  const tick = (): void => {
930
1094
  const all = readAll(h.dir)
@@ -979,8 +1143,6 @@ export class ReviewWatchCommand extends Command {
979
1143
  if (h.unit?.sources?.length) setInterval(() => void pull(h), 30_000)
980
1144
  let stamp = scanStamp(h.dir)
981
1145
  setInterval(() => {
982
- // a watch whose parent died (a monitor's timeout) exits
983
- if (process.ppid !== parent) process.exit(0)
984
1146
  const now = scanStamp(h.dir)
985
1147
  if (now !== stamp) again()
986
1148
  stamp = now
@@ -1000,6 +1162,7 @@ export const REVIEW_COMMANDS = [
1000
1162
  ReviewReplyCommand,
1001
1163
  ReviewWithdrawCommand,
1002
1164
  ReviewReopenCommand,
1165
+ ReviewPickCommand,
1003
1166
  ReviewFixedCommand,
1004
1167
  ReviewWontfixCommand,
1005
1168
  ReviewClaimCommand,
@@ -1018,6 +1181,7 @@ export const REVIEW_COMMANDS = [
1018
1181
  ReviewDeleteCommand,
1019
1182
  ReviewMarksCommand,
1020
1183
  ReviewAnimCommand,
1184
+ ReviewStageCommand,
1021
1185
  ReviewAutoCommand,
1022
1186
  ReviewWatchCommand,
1023
1187
  ]
@@ -1,4 +1,4 @@
1
- // sk shot: a png of any url, or a clip with --video, through the machine's
1
+ // sk shot: a still of any url (webp by default), or a clip with --video, through the machine's
2
2
  // one warm browser (shot/client.ts). A repo's own CLI wraps it with its setup
3
3
  // flags; the trailer's `url` film calls the same functions.
4
4
  import { relative } from 'path'
@@ -22,11 +22,11 @@ export class ShotCommand extends Command {
22
22
 
23
23
  static override usage = Command.Usage({
24
24
  category: 'Serve',
25
- description: 'a png of any url through the warm browser, or an mp4 clip with --video',
25
+ description: 'a webp of any url through the warm browser (a png with --out x.png), or an mp4 clip with --video',
26
26
  details:
27
27
  'one warm headless chromium for the whole machine (the `shot` global process, started when down). A still reuses the warm page when it already shows the url, so a warm shot answers in about 0.1 s. A page with `<meta name="shot-ready" content="wait">` is shot once it sets content="ready"; any other page --wait ms after its load. --video films a page that is a canvas through its WebCodecs encoder (H.264 muxed with no second encode), and any other page as chromium paints it (its screencast, encoded by ffmpeg as the frames arrive); --dom films the page even when a canvas fills it. --step <hook> films frame by frame: before each frame the page draws its time t (seconds) in `await window[hook](t)`, then its ready mark, so a slow page films smooth at its fps; a canvas page is encoded by its own WebCodecs at the exact time n / fps, any other page a screenshot a frame. A still with --step is the page drawn at --at s',
28
28
  examples: [
29
- ['a png of a running dev server', 'sk shot localhost:5173/'],
29
+ ['a still of a running dev server', 'sk shot localhost:5173/'],
30
30
  ['a phone screen, at the pixel ratio of a phone', 'sk shot :5173/play --viewport 390,844 --dpr 3 --out shots/phone.png'],
31
31
  ['a 3 s clip', 'sk shot :4808/ --video 3 --out clips/walk.mp4'],
32
32
  ['a clip of a whole web app page, canvas or not', 'sk shot :5173/settings --video 3 --dom'],
@@ -37,7 +37,7 @@ export class ShotCommand extends Command {
37
37
  url = Option.String({ required: true, name: 'url' })
38
38
  viewport = Option.String('--viewport', { description: 'w,h in css pixels (default 1280,720)' })
39
39
  dpr = Option.String('--dpr', { description: 'device pixel ratio (default 1)' })
40
- out = Option.String('--out', { description: 'the file (default .shipkit/tmp/shots/<url>.png, or .mp4 with --video)' })
40
+ out = Option.String('--out', { description: 'the file (default .shipkit/tmp/shots/<url>.webp, or .mp4 with --video); its extension picks the still: .webp and .jpg at quality 90, .png lossless' })
41
41
  reload = Option.Boolean('--reload', false, { description: 'load the page again even when the warm page shows this url' })
42
42
  wait = Option.String('--wait', { description: 'ms after load for a page with no ready mark (default 300)' })
43
43
  video = Option.String('--video', { description: 'seconds of clip: an mp4 of the page (its canvas when a canvas fills it)' })