rvlib-shipkit 2.20.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 (91) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/package.json +1 -1
  3. package/src/checks/SK004-gitignore-policy.check.ts +6 -3
  4. package/src/cli/cmd_GlobalProcesses.ts +2 -107
  5. package/src/cli/cmd_Home.ts +1 -1
  6. package/src/cli/cmd_Overview.ts +2 -1
  7. package/src/cli/cmd_Releases.ts +39 -3
  8. package/src/cli/cmd_Review.ts +22 -13
  9. package/src/cli/cmd_Social.ts +13 -7
  10. package/src/cli/cmd_Sound.ts +17 -4
  11. package/src/cli/cmd_Trailer.ts +67 -1
  12. package/src/cli/registry.ts +2 -1
  13. package/src/collections/collection-types.ts +1 -1
  14. package/src/collections/review.ts +23 -4
  15. package/src/core/layout.ts +6 -0
  16. package/src/home/gui-app/ShipkitGui.swift +35 -0
  17. package/src/home/gui-app.ts +1 -0
  18. package/src/home/pm-switch.ts +112 -0
  19. package/src/identities/identities.ts +11 -6
  20. package/src/messages/brief.ts +3 -3
  21. package/src/messages/score.ts +2 -0
  22. package/src/releases/add.ts +33 -5
  23. package/src/releases/before.ts +31 -0
  24. package/src/releases/from-card.ts +104 -19
  25. package/src/releases/model.ts +73 -13
  26. package/src/releases/pictures.ts +29 -8
  27. package/src/review/http.ts +1 -1
  28. package/src/review/model.ts +12 -2
  29. package/src/review/stage-card.ts +1 -1
  30. package/src/review/store.ts +12 -2
  31. package/src/review/trailer-desk.ts +19 -0
  32. package/src/review/trailer-model.ts +65 -0
  33. package/src/review/trailer-routes.ts +98 -1
  34. package/src/review/trailer-voices.ts +144 -0
  35. package/src/review/watchers.ts +58 -1
  36. package/src/serve/hub-app/benign-errors.ts +22 -0
  37. package/src/serve/hub-app/hash-route.ts +27 -15
  38. package/src/serve/hub-app/home-st.ts +8 -0
  39. package/src/serve/hub-app/hub-app.tsx +2 -0
  40. package/src/serve/hub-app/project-list.css +7 -2
  41. package/src/serve/hub-app/project-list.tsx +9 -0
  42. package/src/serve/hub-app/projects-svc.ts +16 -6
  43. package/src/serve/hub-app/releases/releases-page.tsx +121 -28
  44. package/src/serve/hub-app/releases/releases-st.ts +46 -4
  45. package/src/serve/hub-app/releases.css +30 -3
  46. package/src/serve/hub-app/repo-sections.ts +1 -1
  47. package/src/serve/hub-app/repo-st.ts +15 -10
  48. package/src/serve/hub-app/review/clip-st.ts +3 -1
  49. package/src/serve/hub-app/review/kit.tsx +3 -3
  50. package/src/serve/hub-app/review/trailer-page.tsx +31 -6
  51. package/src/serve/hub-app/review/trailer-st.ts +168 -8
  52. package/src/serve/hub-app/review/trailer-timeline.tsx +36 -4
  53. package/src/serve/hub-app/review/trailer-voices-st.ts +370 -0
  54. package/src/serve/hub-app/review/trailer-voices.tsx +574 -0
  55. package/src/serve/hub-app/review.css +88 -0
  56. package/src/serve/hub-app/social/comms-page.tsx +10 -5
  57. package/src/serve/hub-app/social/next-release.tsx +118 -0
  58. package/src/serve/hub-app/social/social-model.ts +2 -0
  59. package/src/serve/hub-app/social/social-st.ts +38 -1
  60. package/src/serve/hub-app/social.css +8 -0
  61. package/src/serve/hub-app/tree-build.ts +2 -0
  62. package/src/serve/project-gutter-route.ts +8 -0
  63. package/src/serve/project-gutter.ts +4 -2
  64. package/src/shot/box.ts +33 -12
  65. package/src/shot/client.ts +1 -1
  66. package/src/shot/shooter.ts +19 -9
  67. package/src/social/desk-index.ts +49 -8
  68. package/src/social/discord-layout.ts +6 -2
  69. package/src/social/drafts.ts +1 -1
  70. package/src/social/kinds.ts +3 -2
  71. package/src/social/load.ts +26 -7
  72. package/src/social/publish/index.ts +24 -9
  73. package/src/social/release-stage.ts +133 -29
  74. package/src/social/routes.ts +2 -1
  75. package/src/social/stage.ts +39 -20
  76. package/src/trailer/bed.ts +111 -0
  77. package/src/trailer/build.ts +57 -38
  78. package/src/trailer/ffmpeg.ts +6 -0
  79. package/src/trailer/grammar.ts +23 -2
  80. package/src/trailer/graph.ts +12 -1
  81. package/src/trailer/shot-plan.ts +75 -0
  82. package/src/trailer/shot-state.ts +191 -0
  83. package/src/trailer/sound/audio.ts +28 -0
  84. package/src/trailer/sound/brand.ts +53 -3
  85. package/src/trailer/sound/gen.ts +61 -2
  86. package/src/trailer/sound/index.ts +25 -11
  87. package/src/trailer/sound/presets.ts +86 -5
  88. package/src/trailer/sound/run.ts +1 -1
  89. package/src/trailer/sound/takes.ts +94 -0
  90. package/src/trailer/titles.ts +36 -0
  91. package/src/trailer/url.ts +1 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ ## 2.21.0
2
+
3
+ - **Record your own voice for a trailer's lines.** A brand voice can be `{ record: '<name>', standin: '<voice>' }`: a line by that voice plays the recorded take, and until one exists the standin reads it, so the cut sounds the same and nothing rebuilds. `takes: false` plays the standin again; both versions are kept.
4
+ - **The Voices page.** Each line's waveforms with a moving cursor, a take played over the music, a microphone picker, a take dragged into place and its noises painted out, the line's passage as one looping video with a clamped play bar and a volume. A take is made mono and centred at -16 LUFS like a generated line, and a voice can carry a light `tweak: { pitch, formant }` (`sk sound voice --tweak`).
5
+ - **The trailer player plays the whole cut in the recorded voice or the standin's**, a toggle on the page, the playhead kept across a switch.
6
+ - **Each shot's state in plain words** (queued, filming, waiting on a card, ready), on the hub and in `sk trailer check`; a 🎙 pill on the project list counts the lines waiting for a recording.
7
+ - **Release pictures carry their rating.** A release's picture line is rated, and each venue gets the highest rated shot its ceiling takes (`--rating` on `sk review add --changelog` and `sk releases add`). A pair shows as two stills with Before and After tabs, After first; a blank or identical before stays out.
8
+ - **The Releases page has two tabs**, Cards and Notes (the release as one page to read), and Communications opens on a foldable « Next release (unreleased) ».
9
+ - **`sk social post --publish --edit`** sends a posted message again: Discord edits it at its link. `sk social post` takes a draft's path.
10
+ - **The shipkit app can use the microphone** for the machine's pages.
11
+ - **The shipkit app keeps its icon** wherever `sk gui` runs: a repo that includes only its own `./agent/index.md` is no longer taken for the house.
12
+ - **The hub's dev overlay ignores the ResizeObserver loop notice**; every real error still opens it.
13
+ - **`sk shot`**: a wait for a browser slot no longer counts against a shot's time cap, and a close always frees its slot, even when the browser never answers.
14
+ - **Review**: the answer bar names who listens in words, a `sk review watch` ends with its owner, and `sk review stage` prints the kind the draft takes.
15
+ - **Messages**: the gatekeepers brief names each gatekeeper, and a run missing one is refused.
16
+
1
17
  ## 2.20.0
2
18
 
3
19
  - **Post kinds: a closed set, checked.** A draft's `kind` is one of `announcement`, `feature`, `iteration`, `showcase`, `release`, `trailer`, `throwback` or `custom`, or a kind its social unit declares (`kinds: [{ id, for, page }]`). SK042 fails a draft with no kind, a word outside the set, or a `custom` with no `kindWhy:` line; an older word only warns and names its kind. A kind problem never blocks Publish. The Communications desk filters by kind and links each kind's rules page.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rvlib-shipkit",
3
- "version": "2.20.0",
3
+ "version": "2.21.0",
4
4
  "funding": "https://github.com/sponsors/rvion",
5
5
  "description": "All-in-one repo companion: ci gate (task DAG), auto-discovered health checks, release-contract fulfillness, asks queue, md-wiki tools, asset atelier, live tui",
6
6
  "license": "MIT",
@@ -32,11 +32,12 @@ 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}/`
35
36
 
36
37
  /** re-includes a private repo carries and a declared public one drops: a
37
38
  * draft names private loras, a plan or a board quotes the owner, a social
38
- * draft carries his angles and notes */
39
- const PRIVATE_ONLY: ReadonlySet<string> = new Set([DRAFTS_BACK, `!${LAYOUT.plans}/`, SOCIAL_BACK])
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])
40
41
 
41
42
  export const POLICY_LINES = [
42
43
  // everything shipkit keeps lives under .shipkit/ (core/layout.ts). Local
@@ -50,6 +51,8 @@ export const POLICY_LINES = [
50
51
  // desks date posts from. A rendered trailer is made again by its command
51
52
  SOCIAL_BACK,
52
53
  `${LAYOUT.social}/drafts/**/*-trailer.mp4`,
54
+ // his takes of a trailer's lines: a recording is never made again
55
+ VOICE_BACK,
53
56
  `${LAYOUT.assets}/out/`,
54
57
  // already covered by the line above, and spelled out anyway so this check
55
58
  // asks git about it: a negation below the block that exposed the keyword
@@ -167,7 +170,7 @@ async function trackedGenerated(d: Disk): Promise<string[]> {
167
170
  async function trackedPrivate(d: Disk, config: RepoConfig): Promise<Map<string, number>> {
168
171
  const out = new Map<string, number>()
169
172
  if (!declaredPublic(config) || !d.exists('.git')) return out
170
- const dirs = [LAYOUT.plans, LAYOUT.social]
173
+ const dirs = [LAYOUT.plans, LAYOUT.social, LAYOUT.voice]
171
174
  const r = await d.exec([gitBin(), 'ls-files', '-z', '--', ...dirs], { cwd: d.root })
172
175
  if (r.code !== 0) return out
173
176
  for (const f of r.out.split('\0')) {
@@ -8,8 +8,8 @@ import { homedir } from 'os'
8
8
  import { Command, Option } from 'clipanion'
9
9
  import { daemonPort, daemonUrl, homePort, pmPort, pmUrl } from '../home/home-paths.ts'
10
10
  import { houseRootOf } from '../home/home-start.ts'
11
- import { ROLES, type PmAnswer, type Role } from '../home/pm.ts'
12
- import type { ResourceView } from '../home/resources.ts'
11
+ import type { PmAnswer } from '../home/pm.ts'
12
+ import { askPm, pmSwitchDeps, switchProcess, type SwitchAct } from '../home/pm-switch.ts'
13
13
  import { coreGroup, declaredRow, groupRows, processGroups, stateWords, type ProcessGroup } from '../home/process-rows.ts'
14
14
  import type { PmConfig } from '../home/pm-config.ts'
15
15
  import { readPmConfig } from '../home/run-pm.ts'
@@ -60,18 +60,6 @@ export async function askDaemon(url = daemonUrl()): Promise<{ version: string; h
60
60
  }
61
61
  }
62
62
 
63
- /** pm's status answer, or null when it does not answer */
64
- export async function askPm(url = pmUrl()): Promise<PmAnswer | null> {
65
- try {
66
- const r = await fetch(`${url}/api/pm/status.json`, { signal: AbortSignal.timeout(1_500) })
67
- if (!r.ok) return null
68
- const j = (await r.json()) as PmAnswer
69
- return j.pm === 'shipkit-pm' ? j : null
70
- } catch {
71
- return null
72
- }
73
- }
74
-
75
63
  /** the project list's order and the declared units, read from disk the way
76
64
  * pm reads them: what the table falls back on while pm does not answer */
77
65
  export async function localProcessDeps(cwd: string): Promise<Pick<GlobalProcessesDeps, 'declared' | 'order'>> {
@@ -157,99 +145,6 @@ export class GlobalProcessesCommand extends Command {
157
145
  }
158
146
  }
159
147
 
160
- export type SwitchAct = 'start' | 'stop' | 'restart'
161
-
162
- /** what a switch follows, the same on a global process and on one of pm's own roles (the daemon, the web) */
163
- export type SwitchView = Pick<ResourceView, 'status' | 'pid' | 'want' | 'note' | 'tail'>
164
-
165
- export type SwitchDeps = {
166
- /** pm's answer to the switch: null when it took it, else why not */
167
- post: (id: string, act: SwitchAct | 'open' | 'chrome' | 'app') => Promise<string | null>
168
- /** the process as pm sees it now, null when pm does not answer */
169
- view: (id: string) => Promise<SwitchView | null>
170
- sleep: (ms: number) => Promise<void>
171
- now: () => number
172
- log: (line: string) => void
173
- }
174
-
175
- /** the longest a switch is followed: a bring-up polls its health for minutes */
176
- export const SWITCH_WAIT_MS = 10 * 60_000
177
- const SWITCH_POLL_MS = 1_000
178
- /** how long the state the switch left counts as pm not having acted yet */
179
- export const SWITCH_GRACE_MS = 30_000
180
-
181
- /** flip a global process, or one of pm's own roles, through pm, then follow
182
- * pm's state until its probe settles it: 0 once it is up (or down for stop),
183
- * 1 otherwise. A restart is up only on a new pid: the old one still answers
184
- * until pm stops it (pm stops the web after its answer is out). The
185
- * launcher's exit code proves nothing, pm's probe does */
186
- export async function switchProcess(id: string, act: SwitchAct, d: SwitchDeps, waitMs = SWITCH_WAIT_MS): Promise<number> {
187
- const before = act === 'restart' ? ((await d.view(id))?.pid ?? null) : null
188
- const refused = await d.post(id, act)
189
- if (refused != null) {
190
- d.log(`FAIL ${act} ${id}: ${refused}`)
191
- return 1
192
- }
193
- const want = act === 'stop' ? 'down' : 'up'
194
- const start = d.now()
195
- const end = start + waitMs
196
- let said = ''
197
- for (;;) {
198
- const v = await d.view(id)
199
- if (v == null) {
200
- d.log(`FAIL pm stopped answering while ${id} was switched ${want}: shipkit gp`)
201
- return 1
202
- }
203
- if (v.status !== said) {
204
- said = v.status
205
- d.log(`${id}: ${v.status}`)
206
- }
207
- // the state it is leaving, read just after the switch, is pm not there yet
208
- const graced = d.now() - start < SWITCH_GRACE_MS
209
- const leaving = v.status === (want === 'up' ? 'down' : 'up') && graced
210
- const old = before != null && v.pid === before
211
- const moving = v.status === 'starting' || v.status === 'stopping' || v.want !== want || leaving || (old && graced)
212
- if (!moving) {
213
- if (old && v.status === 'up') {
214
- d.log(`FAIL ${id} still runs pid ${before} ${Math.round(SWITCH_GRACE_MS / 1000)}s after the restart: pm did not restart it`)
215
- return 1
216
- }
217
- if (v.status === want) return 0
218
- d.log(`FAIL ${id} is ${v.status}, not ${want}${v.note == null ? '' : `: ${v.note}`}`)
219
- for (const l of v.tail.slice(-10)) d.log(` log: ${l}`)
220
- return 1
221
- }
222
- if (d.now() >= end) {
223
- d.log(`FAIL ${id} still ${v.status} after ${Math.round(waitMs / 1000)}s: shipkit gp shows where it stands`)
224
- return 1
225
- }
226
- await d.sleep(SWITCH_POLL_MS)
227
- }
228
- }
229
-
230
- const isRole = (id: string): id is Role => (ROLES as string[]).includes(id)
231
-
232
- /** the switch against the running pm: pm's own roles (the daemon, the web) through its child api, every other id a
233
- * global process */
234
- export const pmSwitchDeps = (log: (line: string) => void, url = pmUrl()): SwitchDeps => ({
235
- post: async (id, act) => {
236
- try {
237
- const r = await fetch(`${url}/api/pm/${isRole(id) ? 'child' : 'resource'}`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ id, act }), signal: AbortSignal.timeout(5_000) })
238
- return r.ok ? null : await r.text()
239
- } catch (e) {
240
- return `pm does not answer on ${url} (${(e as Error).message}): shipkit pm install`
241
- }
242
- },
243
- view: async (id) => {
244
- const a = await askPm(url)
245
- if (a == null) return null
246
- return (isRole(id) ? a.children.find((c) => c.id === id) : a.resources.find((r) => r.id === id)) ?? null
247
- },
248
- sleep: (ms) => Bun.sleep(ms),
249
- now: () => Date.now(),
250
- log,
251
- })
252
-
253
148
  abstract class SwitchCommand extends Command {
254
149
  abstract readonly act: SwitchAct
255
150
  id = Option.String({ required: true, name: 'id' })
@@ -8,7 +8,7 @@ import { markAutostart } from '../home/autostart.ts'
8
8
  import { installHome, uninstallHome } from '../home/home-launchd.ts'
9
9
  import { homeInstalled, houseCli, houseRoot, houseRootOf, openWindow, startHome } from '../home/home-start.ts'
10
10
  import { ROLES } from '../home/pm.ts'
11
- import { pmSwitchDeps, switchProcess } from './cmd_GlobalProcesses.ts'
11
+ import { pmSwitchDeps, switchProcess } from '../home/pm-switch.ts'
12
12
  import { homeUp, homeUrl, hubBase } from '../home/home-paths.ts'
13
13
  import { homeRepo, houseIndex } from '../serve/project-gutter.ts'
14
14
  import { homedir } from 'os'
@@ -9,7 +9,8 @@ import { daemonUrl } from '../home/home-paths.ts'
9
9
  import type { WidgetsAnswer } from '../home/home-routes.ts'
10
10
  import type { ChildView, PmAnswer } from '../home/pm.ts'
11
11
  import { splitWidgetHead, widgetText } from '../home/widget-text.ts'
12
- import { askDaemon, askPm, globalProcessesAnswer, localProcessDeps, renderGlobalProcesses, type GlobalProcessesAnswer, type GlobalProcessesDeps } from './cmd_GlobalProcesses.ts'
12
+ import { askPm } from '../home/pm-switch.ts'
13
+ import { askDaemon, globalProcessesAnswer, localProcessDeps, renderGlobalProcesses, type GlobalProcessesAnswer, type GlobalProcessesDeps } from './cmd_GlobalProcesses.ts'
13
14
 
14
15
  export type OverviewAnswer = {
15
16
  now: number
@@ -47,12 +47,14 @@ export class ReleasesAddCommand extends Command {
47
47
 
48
48
  static override usage = Command.Usage({
49
49
  category: 'Gate',
50
- description: 'a change of .shipkit/releases/next.md by hand: its line, text, picture, bullets',
50
+ description: 'a change of .shipkit/releases/next.md by hand: its line, text, picture, before, bullets',
51
51
  details:
52
- "one change of the release being filled. With --card, the card's changelog line and after picture (what his approval adds, run again by hand when it failed); 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 picture kept unless given. A picture goes to the Space private; `sk bump` makes it public. The repo's guard reads every word first. Committed by pathspec",
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
53
  examples: [
54
54
  ['the change of an approved card, again', 'sk releases add --card 20261108-115317-move-her'],
55
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'],
56
58
  ['the next release is a minor one', 'sk releases add --kind minor'],
57
59
  ],
58
60
  })
@@ -62,7 +64,9 @@ export class ReleasesAddCommand extends Command {
62
64
  text = Option.String('--text', { description: 'its description, markdown' })
63
65
  bullets = Option.Array('--bullet', { description: 'a bullet under it (repeat it)' })
64
66
  image = Option.String('--image', { description: 'its picture: a png, jpg, webp or a clip' })
65
- card = Option.String('--card', { description: 'the review card it comes from: its line and after picture' })
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' })
66
70
  commit = Option.String('--commit', { description: 'the commit it ships' })
67
71
  kind = Option.String('--kind', { description: 'what kind of release next is: major, minor or patch' })
68
72
  heading = Option.String('--release-title', { description: "the release's own title, its # heading" })
@@ -76,6 +80,8 @@ export class ReleasesAddCommand extends Command {
76
80
  ...(this.text !== undefined ? { text: this.text } : {}),
77
81
  ...(this.bullets !== undefined ? { bullets: this.bullets } : {}),
78
82
  ...(this.image !== undefined ? { image: this.image } : {}),
83
+ ...(this.before !== undefined ? { before: this.before } : {}),
84
+ ...(this.rating !== undefined ? { rating: this.rating } : {}),
79
85
  ...(this.card !== undefined ? { card: this.card } : {}),
80
86
  ...(this.commit !== undefined ? { commit: this.commit } : {}),
81
87
  ...(this.kind !== undefined ? { kind: this.kind } : {}),
@@ -89,3 +95,33 @@ export class ReleasesAddCommand extends Command {
89
95
  }
90
96
  }
91
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
+ }
@@ -157,6 +157,7 @@ const ADD_FLAGS = `flags:
157
157
  --what "<what>" what changed and why, short markdown: one line, then - bullets
158
158
  --post "<line>" the public line for a post of it, what a user gets (the repo's guard reads it)
159
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)
160
161
  --image <a.png> the subject; a clip (webm, mp4) goes anywhere an image goes
161
162
  --video <clip.mp4> a clip
162
163
  --audio <sound.wav> a sound: a waveform and a player (wav, mp3, flac, ogg, opus, m4a)
@@ -247,7 +248,7 @@ export class ReviewAddCommand extends Command {
247
248
  const kindName = rest[rest.indexOf('--subject') + 1]
248
249
  const kind = rest.includes('--subject') && kindName ? h.unit?.kinds?.[kindName] : undefined
249
250
  const own = [...Object.keys(kind?.flags ?? {}), ...Object.keys(h.unit?.flags ?? {})]
250
- const f = flagsOf(rest, ['title', 'what', 'post', 'changelog', 'image', 'video', 'audio', 'before', 'after', 'label', 'topic', 'subject', 'commit', 'lane', 'supersedes', 'keeps', 'why', 'live', 'trailer', 'version', 'shots', 'pick'], ['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'])
251
252
  if (f.positionals.length > 0) throw new Error(`unexpected ${f.positionals.join(' ')}`)
252
253
  const o = f.one
253
254
  const trailer = await trailerOfFlags(o, views.length > 0 || f.on.has('wip') || f.on.has('choice'))
@@ -271,6 +272,7 @@ export class ReviewAddCommand extends Command {
271
272
  if (problems.length > 0) throw new Error(`--post: the repo's guard refuses it: ${problems.join('; ')}`)
272
273
  }
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')
274
276
  if (o.changelog !== undefined) {
275
277
  // its category and line are public words: the repo's guard reads them before the card holds them
276
278
  const { dirname } = await import('node:path')
@@ -278,6 +280,11 @@ export class ReviewAddCommand extends Command {
278
280
  const { publicProblems } = await import('../social/unit.ts')
279
281
  const { undeclaredReleases } = await import('../releases/store.ts')
280
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
+ }
281
288
  const why = await undeclaredReleases(dirname(dirname(h.dir)))
282
289
  if (why) throw new Error(`--changelog: ${why}`)
283
290
  const problems = await publicProblems(dirname(dirname(h.dir)), { texts: [changelog.category, changelog.line] })
@@ -938,7 +945,7 @@ export class ReviewStageCommand extends Command {
938
945
  static override usage = Command.Usage({
939
946
  category: 'Review',
940
947
  description: "one media of a card staged as a post: a draft in .shipkit/social/drafts/, never posted",
941
- 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. --dry prints what the draft would be: 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`,
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`,
942
949
  examples: [
943
950
  ['the first media, a safe post', 'sk review stage <id> --text "Hands now pinch and lift." --rating safe'],
944
951
  ["the second view's wipe, polished by an agent", 'sk review stage <id> --view B --side wipe --text "…" --rating mild --polish'],
@@ -949,9 +956,9 @@ export class ReviewStageCommand extends Command {
949
956
  view = Option.String('--view', { description: 'the view by its letter (A, B…) of the newest version, or <n>.<letter> of an older one' })
950
957
  side = Option.String('--side', { description: 'a pair: after (default), before or wipe' })
951
958
  tile = Option.String('--tile', { description: 'a gallery: the tile by its label' })
952
- text = Option.String('--text', { required: true, description: 'the post' })
953
- rating = Option.String('--rating', { required: true, description: 'safe, mild or explicit' })
954
- kind = Option.String('--kind', { description: 'what the post is for, a kind of the set or the unit (default feature)' })
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)" })
955
962
  kindWhy = Option.String('--kind-why', { description: 'with --kind custom: one line on why no kind fits' })
956
963
  alt = Option.String('--alt', { description: 'what the media shows' })
957
964
  slot = Option.String('--slot', { description: '<YYYY-MM-DD> <tag>, a slot of the rhythm' })
@@ -966,8 +973,10 @@ export class ReviewStageCommand extends Command {
966
973
  return run(this.context, async (h) => {
967
974
  const { dirname, join } = await import('node:path')
968
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 ')}`)
969
978
  const { stageInputOf, stageOfCard } = await import('../review/stage-card.ts')
970
- const { askPolish, fitStage, stageDraft, stageDry } = await import('../social/stage.ts')
979
+ const { askPolish, fitStage, stagedKind, stageDraft, stageDry } = await import('../social/stage.ts')
971
980
  const { loadSocialUnit } = await import('../social/unit.ts')
972
981
  if (!isPostRating(this.rating)) throw new Error(`--rating ${this.rating}: one of ${POST_RATINGS.join(', ')}`)
973
982
  const root = dirname(dirname(h.dir))
@@ -990,7 +999,8 @@ export class ReviewStageCommand extends Command {
990
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)
991
1000
  const unit = await loadSocialUnit(root)
992
1001
  const r = this.dry ? await stageDry(root, input, { unit }) : await stageDraft(root, this.fit ? await fitStage(root, input, { unit }) : input, { unit })
993
- h.out(`${this.dry ? 'would stage' : 'staged'} ${r.slug}${input.media ? `: ${input.media.name}` : ''}, ${input.rating}`)
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`)
994
1004
  for (const p of r.draft?.posts ?? []) h.out(` ${p.key}${p.place ? ` #${p.place}` : ''} ${p.length}${p.refused ? ` refused: ${p.refused}` : ''}`)
995
1005
  for (const k of r.draft?.skipped ?? []) h.out(` ${k.account} skipped: ${k.why}`)
996
1006
  for (const e of r.errors) h.err(`WARN ${e}`)
@@ -1056,8 +1066,8 @@ export class ReviewWatchCommand extends Command {
1056
1066
  static override paths = [['review', 'watch']]
1057
1067
  static override usage = Command.Usage({
1058
1068
  category: 'Review',
1059
- description: 'one line per verdict, reply or raised note as it lands; every unseen one at start; never exits',
1060
- 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.`,
1061
1071
  examples: [['the cards this session sent', 'sk review watch --mine'], ["one lane's items", 'sk review watch --lane interaction']],
1062
1072
  })
1063
1073
  mine = Option.Boolean('--mine', false, { description: "only this Claude Code session's cards" })
@@ -1071,13 +1081,14 @@ export class ReviewWatchCommand extends Command {
1071
1081
  const { AGENT_RE, coversCard, laneOf, UNTAKEN_AGAIN_MS, untakenOf } = await import('../review/model.ts')
1072
1082
  const { followedIds, unseen } = await import('../review/threads.ts')
1073
1083
  const { raisedLine, untakenLine, watchLines } = await import('../review/format.ts')
1074
- const { liveWatchers, registerWatch } = await import('../review/watchers.ts')
1084
+ const { exitWithOwner, liveWatchers, registerWatch } = await import('../review/watchers.ts')
1075
1085
  const session = await sessionOf(this.mine, this.session)
1076
1086
  const lane = this.lane?.trim() || null
1077
1087
  if (lane !== null && !AGENT_RE.test(lane)) throw new Error(`--lane: « ${lane} » is no lane id (${AGENT_RE.source})`)
1078
1088
  const mine = (x: Parameters<typeof coversCard>[1]): boolean => coversCard({ session, lane }, x)
1079
1089
  registerWatch(h.dir, { session, lane })
1080
- const parent = process.ppid
1090
+ // before any await: a pull that hangs never keeps a watch alive past its owner
1091
+ exitWithOwner()
1081
1092
  const shown = new Set<string>()
1082
1093
  const tick = (): void => {
1083
1094
  const all = readAll(h.dir)
@@ -1132,8 +1143,6 @@ export class ReviewWatchCommand extends Command {
1132
1143
  if (h.unit?.sources?.length) setInterval(() => void pull(h), 30_000)
1133
1144
  let stamp = scanStamp(h.dir)
1134
1145
  setInterval(() => {
1135
- // a watch whose parent died (a monitor's timeout) exits
1136
- if (process.ppid !== parent) process.exit(0)
1137
1146
  const now = scanStamp(h.dir)
1138
1147
  if (now !== stamp) again()
1139
1148
  stamp = now
@@ -106,33 +106,39 @@ class SocialPostCommand extends Command {
106
106
  category: 'Social',
107
107
  description: 'one draft across every account of its headings: posted with its date and link, or waiting',
108
108
  details:
109
- "--publish posts the waiting messages of its accounts whose automation is live (Discord, Bluesky), each link recorded in its ## Posted; --only <account> keeps that account's alone. A message the repo's guard or a place refuses never posts. Every other account waits for his paste: nothing posts without an order. Page: wiki tools/shipkit/social.md, A post staged",
109
+ "The draft by its folder's name, its topic or its path (its draft.md too). --publish posts the waiting messages of its accounts whose automation is live (Discord, Bluesky), each link recorded in its ## Posted; a posted one stays « already posted ». --edit sends a posted message's text again at its link where the venue edits in place (Discord), and names why where it cannot: never a second copy. --only <key> keeps one message, its heading's key (`discord`, `discord/nsfw`), else an account's every message. A message the repo's guard or a place refuses never posts. Every other account waits for his paste: nothing posts without an order. Page: wiki tools/shipkit/social.md, `sk social`",
110
110
  examples: [
111
111
  ['by its topic', 'sk social post arena-face-lift'],
112
112
  ['by its whole name', 'sk social post 20261025-131139-arena-face-lift'],
113
+ ['by its path', 'sk social post .shipkit/social/drafts/20261025-131139-arena-face-lift/'],
114
+ ['a pinned #welcome whose text changed, edited at its link', 'sk social post welcome --only discord --publish --edit'],
113
115
  ["a release's #announcements line, at release", 'sk social post 20261108-120000-app-1-2-0 --only discord --publish'],
114
116
  ],
115
117
  })
116
118
  draft = Option.String({ required: true })
117
- only = Option.String('--only', { description: 'one account: its messages alone' })
119
+ only = Option.String('--only', { description: "one message by its key (discord, discord/nsfw), else one account's messages" })
118
120
  publish = Option.Boolean('--publish', false, { description: 'post the waiting messages of its live accounts now' })
121
+ edit = Option.Boolean('--edit', false, { description: "with --publish: a posted message's text sent again at its link, where the venue edits in place" })
119
122
  override async execute(): Promise<number> {
120
123
  return guarded(this.context, async () => {
121
124
  const { desk } = await model(undefined)
122
- const d = desk.drafts.find((x) => x.slug === this.draft || x.slug.replace(/^\d{8}-\d{6}-/, '') === this.draft)
123
- if (d == null) throw new Error(`no draft "${this.draft}" in .shipkit/social/drafts/: give its folder's name or its topic`)
125
+ const { findDraft } = await import('../social/load.ts')
126
+ const d = findDraft(desk, this.draft, process.cwd())
127
+ if (this.edit && !this.publish) throw new Error('--edit sends again what is posted: it goes with --publish')
124
128
  const only = this.only
125
- if (only != null && !d.posts.some((p) => p.platform === only)) throw new Error(`${d.slug} has no message to ${only} (${[...new Set(d.posts.map((p) => p.platform))].join(', ') || 'none'})`)
129
+ if (only != null && !d.posts.some((p) => p.platform === only || p.key === only)) throw new Error(`${d.slug} has no message to ${only} (${[...new Set(d.posts.map((p) => p.key))].join(', ') || 'none'})`)
126
130
  if (this.publish) {
127
131
  const { publishDraft } = await import('../social/publish/index.ts')
128
132
  const { socialMediaBack } = await import('../social/media-kind.ts')
129
133
  const before = async (p: { media: { path: string } | null }): Promise<void> => void (p.media ? await socialMediaBack(desk.root, p.media.path) : undefined)
130
- for (const r of await publishDraft(desk, d.slug, { ...(only != null ? { only } : {}), before })) say(this.context)(`${r.key}: ${r.line}`)
134
+ for (const r of await publishDraft(desk, d.slug, { ...(only != null ? { only } : {}), edit: this.edit, before })) say(this.context)(`${r.key}: ${r.line}`)
131
135
  return 0
132
136
  }
133
137
  const { socialModel, postText } = await import('../social/text.ts')
138
+ const { onlyOf } = await import('../social/publish/index.ts')
134
139
  const lines = postText(socialModel(desk, d.identity), d.slug)
135
- for (const l of only == null ? lines : lines.filter((l) => !/^[a-z0-9-]+(?:\/[a-z0-9-]+)?\s{2}/.test(l) || l.startsWith(`${only} `) || l.startsWith(`${only}/`))) say(this.context)(l)
140
+ const keys = new Set(onlyOf(d.posts, only ?? undefined).map((p) => p.key))
141
+ for (const l of only == null ? lines : lines.filter((l) => !/^[a-z0-9-]+(?:\/[a-z0-9-]+)?\s{2}/.test(l) || keys.has(l.split(/\s{2}/)[0]!))) say(this.context)(l)
136
142
  return 0
137
143
  })
138
144
  }
@@ -52,6 +52,7 @@ export class SoundVoiceCommand extends Command {
52
52
  ['an ElevenLabs voice, its second take', 'sk sound voice "[whispers] Hey." --eleven pNInz6obpgDQGcFmaJgB --seed 2 --out hey.wav'],
53
53
  ['a clip cloned, free', 'sk sound voice "Ahoy." --clone voices/sailor.flac --out ahoy.wav'],
54
54
  ['a voice designed from words, free', 'sk sound voice "Ahoy." --design "an old sailor, gravelly and warm" --out ahoy.wav'],
55
+ ['your own recording, trimmed and levelled', 'sk sound voice "Ahoy." --take .shipkit/voice/takes/me/0a1b2c3d4e5f.webm --out ahoy.wav'],
55
56
  ],
56
57
  })
57
58
  text = Option.String({ required: true, name: 'line' })
@@ -70,14 +71,22 @@ export class SoundVoiceCommand extends Command {
70
71
  language = Option.String('--language', { description: 'en, fr… (ElevenLabs) or English, French… (comfy-ts)' })
71
72
  comfy = Option.String('--comfy', { description: COMFY })
72
73
  seed = Option.String('--seed', { description: 'the take (default 1)' })
74
+ take = Option.String('--take', { description: 'your own recording of the line, repo relative: trimmed and levelled, no voice made' })
75
+ offset = Option.String('--offset', { description: 'with --take: where the recording\'s 0 sits on the line, seconds (negative cuts its head; default its first sound)' })
76
+ mask = Option.String('--mask', { description: 'with --take: ranges of the recording played silent, seconds, a-b,c-d' })
77
+ tweak = Option.String('--tweak', { description: 'with --take: a light disguise in semitones, pitch=<n>,formant=<n>; the length kept' })
73
78
  out = Option.String('--out', { description: 'the file it writes (required)' })
74
79
 
75
80
  execute(): Promise<number> {
76
81
  return run(this.context, async (say, root, cwd) => {
77
- const [{ resolve }, { genVoice }, { voiceOf }] = await Promise.all([import('node:path'), import('../trailer/sound/gen.ts'), import('../trailer/sound/brand.ts')])
82
+ const [{ resolve }, { genVoice, genTake }, { voiceOf, isRecord, standinOf, DEFAULT_VOICE }] = await Promise.all([import('node:path'), import('../trailer/sound/gen.ts'), import('../trailer/sound/brand.ts')])
83
+ const given = [this.eleven, this.clone, this.design, this.take].filter((x) => x !== undefined).length
84
+ if (given > 1) throw new Error('one voice: --eleven, --clone, --design or --take')
85
+ if (this.take !== undefined) {
86
+ const { maskOf, tweakOf } = await import('../trailer/sound/presets.ts')
87
+ return genTake({ take: resolve(root, this.take), offset: this.offset === undefined ? null : num('--offset', this.offset, 0), mask: maskOf(this.mask), tweak: tweakOf(this.tweak), out: resolve(cwd, outOf(this.out)), say })
88
+ }
78
89
  const brand = await brandSound(root)
79
- const given = [this.eleven, this.clone, this.design].filter((x) => x !== undefined).length
80
- if (given > 1) throw new Error('one voice: --eleven, --clone or --design')
81
90
  const n = (k: string, v: string | undefined): number | undefined => (v === undefined ? undefined : num(k, v, 0))
82
91
  const lang = this.language !== undefined ? { language: this.language } : {}
83
92
  const eng = this.engine !== undefined ? { engine: this.engine } : {}
@@ -85,7 +94,11 @@ export class SoundVoiceCommand extends Command {
85
94
  if (this.eleven !== undefined) voice = { eleven: this.eleven, ...(this.model ? { model: this.model } : {}), ...strip({ stability: n('--stability', this.stability), similarity: n('--similarity', this.similarity), speed: n('--speed', this.speed) }), ...lang }
86
95
  else if (this.clone !== undefined) voice = { clone: this.clone, ...(this.transcript !== undefined ? { transcript: this.transcript } : {}), ...eng, ...lang }
87
96
  else if (this.design !== undefined) voice = { design: this.design, ...(this.designLine !== undefined ? { line: this.designLine } : {}), ...strip({ seed: n('--design-seed', this.designSeed) }), ...eng, ...lang }
88
- else voice = voiceOf(brand, this.by)
97
+ else {
98
+ // a recorded voice says its line through its standin here: his take comes by --take
99
+ const v = voiceOf(brand, this.by)
100
+ voice = isRecord(v) ? standinOf(brand, v, this.by ?? DEFAULT_VOICE).voice : v
101
+ }
89
102
  await genVoice({ root, text: this.text, voice, seed: num('--seed', this.seed, 1), comfy: this.comfy ?? brand?.comfy, elevenKey: brand?.elevenKey, out: resolve(cwd, outOf(this.out)), say })
90
103
  })
91
104
  }
@@ -89,7 +89,7 @@ export class TrailerCheckCommand extends Command {
89
89
  const b = await import('../trailer/build.ts')
90
90
  const l = await b.load(b.trailerFile(this.file, root, cwd), root, this.variant !== undefined ? { variant: this.variant } : {})
91
91
  if (!b.sayErrors(l, say, cwd)) return 1
92
- for (const line of b.timeline(l, b.takesOfLoaded(l), await b.worldOf(l), cwd)) say(line)
92
+ for (const line of await b.planTimeline(l, b.takesOfLoaded(l), await b.worldOf(l), cwd)) say(line)
93
93
  for (const line of await b.soundLines(l)) say(` ${line}`)
94
94
  for (const line of await b.fontLines(l)) say(` ${line}`)
95
95
  say(`ok: checked in ${((performance.now() - t0) / 1000).toFixed(2)} s`)
@@ -98,6 +98,71 @@ export class TrailerCheckCommand extends Command {
98
98
  }
99
99
  }
100
100
 
101
+ export class TrailerPlanCommand extends Command {
102
+ static override paths = [['trailer', 'plan']]
103
+
104
+ static override usage = Command.Usage({
105
+ category: 'Trailer',
106
+ description: 'each shot\'s state for the owner: queued, filming, waiting on a card, ready',
107
+ details: `${DETAILS}. The plan of a cut is .shipkit/trailer-plan/<trailer>/<cut>.json, local to this machine like its takes. A shot no lane speaks for is ready once filmed: a take of an older world stays ready. A waiting shot turns ready when the owner approves its card, and queued again on any other answer. With no mark: every shot's state and the summary line. The cut is a file, a folder or a cut's name (v3-voice)`,
108
+ examples: [
109
+ ['what the lanes plan, every shot', 'sk trailer plan v3-voice'],
110
+ ['two shots to film again', 'sk trailer plan v3-voice hook,buy --queued --by trailer --why "old studio UI"'],
111
+ ['filming them now', 'sk trailer plan v3-voice hook buy --filming --by trailer'],
112
+ ['their new takes on a card', 'sk trailer plan v3-voice hook,buy --waiting 20261108-221500-hook --by trailer'],
113
+ ['compared with a refilm and kept', 'sk trailer plan v3-voice tz-close --ready --by trailer --why "take compared and kept"'],
114
+ ['no lane speaks for them any more', 'sk trailer plan v3-voice hook --clear'],
115
+ ],
116
+ })
117
+
118
+ words = Option.Rest({ required: 0 })
119
+ queued = Option.Boolean('--queued', false, { description: 'a lane will film them again' })
120
+ filming = Option.Boolean('--filming', false, { description: 'a lane films them now' })
121
+ waiting = Option.String('--waiting', { description: 'their new take waits for the owner\'s answer on this card' })
122
+ ready = Option.Boolean('--ready', false, { description: 'checked and kept: final' })
123
+ clear = Option.Boolean('--clear', false, { description: 'drop their entries: ready once filmed' })
124
+ by = Option.String('--by', { description: 'the lane\'s name (default: SK_AGENT)' })
125
+ why = Option.String('--why', { description: 'why, in plain words: "old studio UI", "new dress"' })
126
+
127
+ async execute(): Promise<number> {
128
+ return run(this.context, async (say, root, cwd) => {
129
+ const { existsSync } = await import('node:fs')
130
+ const { basename, resolve } = await import('node:path')
131
+ const b = await import('../trailer/build.ts')
132
+ const { cutIdOf, writePlan } = await import('../trailer/shot-plan.ts')
133
+ const { ID_RE } = await import('../review/model.ts')
134
+ const [first, ...rest] = this.words
135
+ // the first word names the cut: a path, or the stem of one cut under trailer/
136
+ const named = first === undefined ? [] : b.cutFiles(root).filter((f) => basename(f, '.trailer') === first)
137
+ if (named.length > 1) throw new b.Refused(`several cuts are named ${first}: ${named.map((f) => f.slice(root.length + 1)).join(', ')}; name its file`)
138
+ const isPath = first !== undefined && (first.endsWith('.trailer') || existsSync(resolve(cwd, first)))
139
+ const file = named[0] ?? b.trailerFile(isPath ? first : undefined, root, cwd)
140
+ const shots = (named.length > 0 || isPath ? rest : this.words).flatMap((w) => w.split(',')).filter(Boolean)
141
+ const marks = [this.queued && 'queued', this.filming && 'filming', this.waiting !== undefined && 'waiting', this.ready && 'ready', this.clear && 'clear'].filter((x): x is string => typeof x === 'string')
142
+ if (marks.length > 1) throw new b.Refused(`one mark at a time, got --${marks.join(' --')}`)
143
+ const l = await b.load(file, root)
144
+ if (!b.sayErrors(l, say, cwd)) return 1
145
+ if (marks.length === 1) {
146
+ if (shots.length === 0) throw new b.Refused(`--${marks[0]} marks shots: name them after the cut (hook,buy)`)
147
+ const known = new Set([...l.t.shots, ...l.t.footage].map((s) => s.name))
148
+ const unknown = shots.filter((s) => !known.has(s))
149
+ if (unknown.length > 0) throw new b.Refused(`${basename(file)} has no shot ${unknown.join(', ')}; its shots: ${[...known].join(', ')}`)
150
+ if (this.waiting !== undefined && !ID_RE.test(this.waiting)) throw new b.Refused(`--waiting takes a review card's id (YYYYMMDD-HHMMSS-slug, as sk review add prints it), got ${this.waiting}`)
151
+ const by = this.by ?? process.env.SK_AGENT
152
+ if (marks[0] !== 'clear' && !by) throw new b.Refused('--by <lane>: the owner reads who plans each shot (or set SK_AGENT)')
153
+ const { trailer, cut } = cutIdOf(file)
154
+ writePlan(root, trailer, cut, shots, marks[0] === 'clear' ? null : { mark: marks[0] as 'queued' | 'filming' | 'waiting' | 'ready', by: by!, ...(this.why ? { why: this.why } : {}), ...(this.waiting ? { card: this.waiting } : {}) })
155
+ } else if (shots.length > 0) throw new b.Refused(`a mark says what happens to ${shots.join(', ')}: --queued, --filming, --waiting <card>, --ready or --clear`)
156
+ const lines = await b.planTimeline(l, b.takesOfLoaded(l), await b.worldOf(l), cwd)
157
+ // after a mark: the marked shots' lines and the summary; with none, the whole timeline
158
+ const only = new Set(shots)
159
+ const nameOf = (line: string): string | undefined => /^\s+(?:\d+\s+[\d.]+ s|footage)\s+(\S+)\s/.exec(line)?.[1]
160
+ for (const line of lines) if (only.size === 0 || only.has(nameOf(line) ?? '') || line === lines.at(-1)) say(line)
161
+ return 0
162
+ })
163
+ }
164
+ }
165
+
101
166
  export class TrailerScoreCommand extends Command {
102
167
  static override paths = [['trailer', 'score']]
103
168
 
@@ -376,6 +441,7 @@ export class TrailerPruneCommand extends Command {
376
441
  export const TRAILER_COMMANDS = [
377
442
  TrailerCommand,
378
443
  TrailerCheckCommand,
444
+ TrailerPlanCommand,
379
445
  TrailerScoreCommand,
380
446
  TrailerShotCommand,
381
447
  TrailerSectionCommand,
@@ -33,7 +33,7 @@ import { NeedsCommand } from './cmd_Needs.ts'
33
33
  import { PbCollectionCommand } from './cmd_Pb.ts'
34
34
  import { ReflectCommand } from './cmd_Reflect.ts'
35
35
  import { ReleaseCommand } from './cmd_Release.ts'
36
- import { ReleasesAddCommand, ReleasesCommand } from './cmd_Releases.ts'
36
+ import { ReleasesAddCommand, ReleasesCommand, ReleasesRefreshCommand } from './cmd_Releases.ts'
37
37
  import { ChecksCommand, UnitsAliasCommand } from './cmd_Checks.ts'
38
38
  import { WhenCommand } from './cmd_When.ts'
39
39
  import { CacheAuditCommand } from './cmd_CacheAudit.ts'
@@ -84,6 +84,7 @@ export function buildCli(): Cli {
84
84
  cli.register(ReleaseCommand)
85
85
  cli.register(ReleasesCommand)
86
86
  cli.register(ReleasesAddCommand)
87
+ cli.register(ReleasesRefreshCommand)
87
88
  cli.register(HooksInstallCommand)
88
89
  cli.register(HooksPreCommitCommand)
89
90
  cli.register(HooksCommitMsgCommand)