rvlib-shipkit 2.18.0 → 2.20.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 (186) hide show
  1. package/CHANGELOG.md +31 -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/asks/asks-queue.ts +63 -10
  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_Asks.ts +3 -1
  11. package/src/cli/cmd_Commands.ts +4 -1
  12. package/src/cli/cmd_GlobalProcesses.ts +34 -11
  13. package/src/cli/cmd_Home.ts +41 -4
  14. package/src/cli/cmd_Messages.ts +155 -0
  15. package/src/cli/cmd_Releases.ts +48 -0
  16. package/src/cli/cmd_Review.ts +161 -6
  17. package/src/cli/cmd_Secret.ts +4 -30
  18. package/src/cli/cmd_Shot.ts +4 -4
  19. package/src/cli/cmd_Social.ts +179 -3
  20. package/src/cli/cmd_Trailer.ts +15 -3
  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 +8 -2
  25. package/src/collections/actions.ts +29 -1
  26. package/src/collections/collection-types.ts +10 -1
  27. package/src/collections/providers.ts +5 -2
  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 +5 -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 +302 -5
  41. package/src/home/gui-app.ts +63 -33
  42. package/src/home/hmr-keep.ts +134 -0
  43. package/src/home/home-paths.ts +5 -1
  44. package/src/home/home-start.ts +14 -14
  45. package/src/home/lib-watch.ts +21 -11
  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-daemon.ts +11 -2
  50. package/src/home/run-pm.ts +9 -1
  51. package/src/home/run-web.ts +7 -4
  52. package/src/home/serve-web.ts +64 -14
  53. package/src/home/supervise.ts +3 -1
  54. package/src/identities/collection.ts +49 -0
  55. package/src/identities/identities.ts +130 -11
  56. package/src/identities/machine.ts +4 -3
  57. package/src/identities/rating.ts +33 -0
  58. package/src/identities/shown.ts +170 -0
  59. package/src/identities/steps.ts +5 -0
  60. package/src/media-store/purge.ts +15 -1
  61. package/src/media-store/remote.ts +22 -6
  62. package/src/messages/brief.ts +117 -0
  63. package/src/messages/collection.ts +40 -0
  64. package/src/messages/model.ts +171 -0
  65. package/src/messages/routes.ts +15 -0
  66. package/src/messages/score.ts +180 -0
  67. package/src/messages/tabs.ts +13 -0
  68. package/src/release/notes.ts +130 -0
  69. package/src/release/run-bump.ts +41 -18
  70. package/src/release/run-release.ts +22 -4
  71. package/src/release/run-releases.ts +17 -15
  72. package/src/release/unit-resolve.ts +9 -0
  73. package/src/releases/add.ts +66 -0
  74. package/src/releases/collection.ts +36 -0
  75. package/src/releases/from-card.ts +66 -0
  76. package/src/releases/model.ts +267 -0
  77. package/src/releases/pictures.ts +89 -0
  78. package/src/releases/routes.ts +36 -0
  79. package/src/releases/store.ts +71 -0
  80. package/src/repo-config.ts +5 -0
  81. package/src/review/cells.ts +0 -11
  82. package/src/review/format.ts +10 -6
  83. package/src/review/http.ts +7 -2
  84. package/src/review/model.ts +92 -3
  85. package/src/review/notes.ts +2 -48
  86. package/src/review/routes.ts +28 -10
  87. package/src/review/stage-card.ts +197 -0
  88. package/src/review/stage-routes.ts +123 -0
  89. package/src/review/store.ts +117 -19
  90. package/src/review/trailer-card.ts +99 -0
  91. package/src/review/trailer-desk.ts +57 -4
  92. package/src/review/trailer-model.ts +41 -7
  93. package/src/review/trailer-notes.ts +45 -0
  94. package/src/review/trailer-routes.ts +22 -13
  95. package/src/secrets/manager.ts +59 -0
  96. package/src/secrets/name.ts +2 -0
  97. package/src/serve/hub-app/app-bridge.ts +71 -0
  98. package/src/serve/hub-app/col-card.tsx +10 -0
  99. package/src/serve/hub-app/cols-svc.ts +37 -6
  100. package/src/serve/hub-app/commands/commands-page.tsx +122 -0
  101. package/src/serve/hub-app/commands/commands-st.ts +177 -0
  102. package/src/serve/hub-app/commands.css +24 -0
  103. package/src/serve/hub-app/hash-route.ts +40 -1
  104. package/src/serve/hub-app/home-st.ts +11 -2
  105. package/src/serve/hub-app/home.html +3 -0
  106. package/src/serve/hub-app/hub-app.tsx +6 -0
  107. package/src/serve/hub-app/hub.css +1 -0
  108. package/src/serve/hub-app/icons.tsx +5 -0
  109. package/src/serve/hub-app/identities-view.tsx +4 -1
  110. package/src/serve/hub-app/identities.css +1 -0
  111. package/src/serve/hub-app/index.html +3 -0
  112. package/src/serve/hub-app/keys.ts +2 -2
  113. package/src/serve/hub-app/machine-st.ts +41 -10
  114. package/src/serve/hub-app/messages/messages-page.tsx +354 -0
  115. package/src/serve/hub-app/messages/messages-st.ts +74 -0
  116. package/src/serve/hub-app/messages.css +35 -0
  117. package/src/serve/hub-app/releases/releases-page.tsx +94 -0
  118. package/src/serve/hub-app/releases/releases-st.ts +69 -0
  119. package/src/serve/hub-app/releases.css +25 -0
  120. package/src/serve/hub-app/repo-sections.ts +15 -1
  121. package/src/serve/hub-app/repo-st.ts +56 -5
  122. package/src/serve/hub-app/review/clip-st.ts +31 -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 +62 -31
  131. package/src/serve/hub-app/review/trailer-st.ts +138 -26
  132. package/src/serve/hub-app/review/trailer-timeline.tsx +39 -26
  133. package/src/serve/hub-app/review.css +49 -6
  134. package/src/serve/hub-app/social/comms-page.tsx +55 -23
  135. package/src/serve/hub-app/social/identity-pictures.ts +112 -0
  136. package/src/serve/hub-app/social/kit.tsx +9 -6
  137. package/src/serve/hub-app/social/post-card.tsx +10 -2
  138. package/src/serve/hub-app/social/social-model.ts +37 -3
  139. package/src/serve/hub-app/social/social-page.tsx +236 -82
  140. package/src/serve/hub-app/social/social-st.ts +79 -26
  141. package/src/serve/hub-app/social/stage-popup.tsx +268 -0
  142. package/src/serve/hub-app/social/stage-st.ts +310 -0
  143. package/src/serve/hub-app/social/step-layout.ts +42 -0
  144. package/src/serve/hub-app/social.css +68 -4
  145. package/src/serve/hub-app/tree-build.ts +38 -1
  146. package/src/serve/hub-app/tree-svc.ts +10 -3
  147. package/src/serve/project-gutter-route.ts +4 -2
  148. package/src/serve/same-origin.ts +24 -1
  149. package/src/serve/serve-hub.ts +27 -3
  150. package/src/shipkit-files.ts +9 -7
  151. package/src/shot/shooter.ts +3 -3
  152. package/src/shot/shot-ask.ts +14 -3
  153. package/src/shot/shot.shipkit.ts +1 -1
  154. package/src/social/discord-layout.ts +282 -0
  155. package/src/social/fit.ts +84 -0
  156. package/src/social/identity-words.ts +74 -0
  157. package/src/social/kind-pages.ts +41 -0
  158. package/src/social/kinds.ts +92 -0
  159. package/src/social/load.ts +105 -9
  160. package/src/social/md.ts +14 -6
  161. package/src/social/media-limit.ts +63 -2
  162. package/src/social/presence.ts +1 -1
  163. package/src/social/publish/bluesky.ts +58 -19
  164. package/src/social/publish/discord.ts +3 -2
  165. package/src/social/publish/index.ts +31 -5
  166. package/src/social/reach.ts +49 -0
  167. package/src/social/release-stage.ts +173 -0
  168. package/src/social/routes.ts +44 -9
  169. package/src/social/stage.ts +227 -0
  170. package/src/social/strip.ts +85 -0
  171. package/src/social/text.ts +6 -2
  172. package/src/social/unit.ts +57 -1
  173. package/src/social/writes.ts +11 -0
  174. package/src/stores/routes.ts +2 -2
  175. package/src/suite/judge-suites.ts +1 -1
  176. package/src/suite/suite-cli.ts +5 -5
  177. package/src/trailer/build.ts +90 -52
  178. package/src/trailer/draft.ts +28 -0
  179. package/src/trailer/footage.ts +4 -2
  180. package/src/trailer/grammar.ts +25 -13
  181. package/src/trailer/graph.ts +32 -9
  182. package/src/trailer/profile.ts +35 -0
  183. package/src/trailer/prune.ts +15 -10
  184. package/src/trailer/public-words.ts +41 -0
  185. package/src/trailer/stitch.ts +22 -10
  186. package/src/trailer/titles.ts +47 -2
@@ -0,0 +1,85 @@
1
+ // a media copied into a draft with what it says about where it was made left out (wiki tools/shipkit/social.md, A post
2
+ // staged): a png's text, time and exif chunks, a jpeg's exif, xmp, iptc and comments, a webp's exif and xmp, a clip's
3
+ // tags, chapters and encoder name. The pixels and the colour profile stay. Images are rewritten here, byte for byte
4
+ // the rest; a clip goes through ffmpeg, its streams copied, never encoded again
5
+ import { readFileSync, writeFileSync } from 'node:fs'
6
+ import { extname } from 'node:path'
7
+
8
+ const PNG_SIG = Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a])
9
+ /** the png chunks that carry words, a time or exif */
10
+ const PNG_DROP = new Set(['tEXt', 'zTXt', 'iTXt', 'eXIf', 'tIME'])
11
+
12
+ export function stripPng(b: Buffer): Buffer {
13
+ if (!b.subarray(0, 8).equals(PNG_SIG)) throw new Error('not a png')
14
+ const keep: Buffer[] = [PNG_SIG]
15
+ for (let at = 8; at + 12 <= b.length; ) {
16
+ const len = b.readUInt32BE(at)
17
+ const type = b.toString('latin1', at + 4, at + 8)
18
+ const end = at + 12 + len
19
+ if (!PNG_DROP.has(type)) keep.push(b.subarray(at, end))
20
+ at = end
21
+ if (type === 'IEND') break
22
+ }
23
+ return Buffer.concat(keep)
24
+ }
25
+
26
+ /** the jpeg segments that carry exif or xmp (APP1), iptc (APP13) and comments (COM) */
27
+ const JPEG_DROP = new Set([0xe1, 0xed, 0xfe])
28
+
29
+ export function stripJpeg(b: Buffer): Buffer {
30
+ if (b[0] !== 0xff || b[1] !== 0xd8) throw new Error('not a jpeg')
31
+ const keep: Buffer[] = [b.subarray(0, 2)]
32
+ let at = 2
33
+ while (at + 4 <= b.length && b[at] === 0xff) {
34
+ const marker = b[at + 1]!
35
+ // the scan: the rest is the image
36
+ if (marker === 0xda) break
37
+ const end = at + 2 + b.readUInt16BE(at + 2)
38
+ if (!JPEG_DROP.has(marker)) keep.push(b.subarray(at, end))
39
+ at = end
40
+ }
41
+ keep.push(b.subarray(at))
42
+ return Buffer.concat(keep)
43
+ }
44
+
45
+ export function stripWebp(b: Buffer): Buffer {
46
+ if (b.toString('latin1', 0, 4) !== 'RIFF' || b.toString('latin1', 8, 12) !== 'WEBP') throw new Error('not a webp')
47
+ const keep: Buffer[] = []
48
+ for (let at = 12; at + 8 <= b.length; ) {
49
+ const type = b.toString('latin1', at, at + 4)
50
+ const len = b.readUInt32LE(at + 4)
51
+ const end = at + 8 + len + (len % 2)
52
+ if (type === 'VP8X') {
53
+ const c = Buffer.from(b.subarray(at, end))
54
+ // the flags say no exif (bit 3) and no xmp (bit 2) any more
55
+ c[8] = c[8]! & ~0x0c
56
+ keep.push(c)
57
+ } else if (type !== 'EXIF' && type !== 'XMP ') keep.push(b.subarray(at, end))
58
+ at = end
59
+ }
60
+ const body = Buffer.concat(keep)
61
+ const head = Buffer.alloc(12)
62
+ head.write('RIFF', 0, 'latin1')
63
+ head.writeUInt32LE(body.length + 4, 4)
64
+ head.write('WEBP', 8, 'latin1')
65
+ return Buffer.concat([head, body])
66
+ }
67
+
68
+ const CLIP = new Set(['.mp4', '.m4v', '.mov', '.webm'])
69
+
70
+ /** `from` copied to `to` with its metadata left out; a kind it cannot clean is refused, never copied as it is */
71
+ export function stripCopy(from: string, to: string): void {
72
+ const ext = extname(from).toLowerCase()
73
+ if (ext === '.png') return writeFileSync(to, stripPng(readFileSync(from)))
74
+ if (ext === '.jpg' || ext === '.jpeg') return writeFileSync(to, stripJpeg(readFileSync(from)))
75
+ if (ext === '.webp') return writeFileSync(to, stripWebp(readFileSync(from)))
76
+ if (!CLIP.has(ext)) throw new Error(`${from}: a ${ext || 'file'} is no media a draft takes (png, jpg, webp, mp4, mov, webm)`)
77
+ const r = Bun.spawnSync(
78
+ ['ffmpeg', '-v', 'error', '-y', '-i', from, '-map', '0', '-c', 'copy', '-map_metadata', '-1', '-map_metadata:s', '-1', '-map_chapters', '-1', '-fflags', '+bitexact', '-flags:v', '+bitexact', '-flags:a', '+bitexact', to],
79
+ { stdout: 'ignore', stderr: 'pipe' },
80
+ )
81
+ if (r.exitCode !== 0) {
82
+ // a stream ffmpeg cannot copy into the same container: the file is refused, the reason named
83
+ throw new Error(`ffmpeg could not clean ${from}: ${r.stderr.toString().trim().split('\n').at(-1) ?? `exit ${r.exitCode}`}`)
84
+ }
85
+ }
@@ -106,6 +106,7 @@ export function overviewText(m: Model, today: string, stats: Readonly<Record<str
106
106
  if (waiting.length > 8) out.push(` … and ${waiting.length - 8} more: sk social plan`)
107
107
  out.push('', sourcesLine(sent))
108
108
  if (social.errors.length) out.push('', `${plural(social.errors.length, 'error')} in .shipkit/social/:`, ...social.errors.map((e) => ` ${e}`))
109
+ if (social.warnings.length) out.push('', `${plural(social.warnings.length, 'warning')}, never an error (an old kind word stays until the repo moves its drafts):`, ...social.warnings.map((e) => ` ${e}`))
109
110
  return out
110
111
  }
111
112
 
@@ -163,11 +164,14 @@ export function postText(m: Model, slug: string): string[] {
163
164
  const w = Math.max(0, ...posts.map((p) => p.key.length))
164
165
  for (const p of posts) {
165
166
  const s = m.sent.find((x) => x.slug === d.slug && x.key === p.key)
166
- out.push(`${pad(p.key, w)} ${pad(fam(p), 7)} ${s ? `posted ${when(s)} ${s.url}` : `waiting, ${p.length} characters${p.tags.length ? `, ${p.tags.join(' ')}` : ''}`}`)
167
+ const at = p.place ? ` in ${p.place}` : ''
168
+ out.push(`${pad(p.key, w)} ${pad(fam(p), 7)} ${s ? `posted ${when(s)} ${s.url}` : p.refused ? `refused: ${p.refused}` : `waiting${at}, ${p.length} characters${p.tags.length ? `, ${p.tags.join(' ')}` : ''}`}`)
167
169
  }
170
+ for (const k of d.skipped) out.push(`${pad(k.account, w)} skipped: ${k.why}`)
171
+ if (d.rating !== 'safe') out.splice(2, 0, `rated ${d.rating}`)
168
172
  const left = d.posts.filter((p) => p.posted === '').length
169
173
  out.push('', left ? `${left} of ${d.posts.length} messages waiting` : `every message posted`)
170
- const errors = m.social.errors.filter((e) => e.includes(d.slug))
174
+ const errors = [...m.social.errors, ...m.social.warnings].filter((e) => e.includes(d.slug))
171
175
  if (errors.length) out.push('', ...errors)
172
176
  return out
173
177
  }
@@ -4,6 +4,7 @@
4
4
  import { existsSync } from 'node:fs'
5
5
  import { importFresh } from '../core/discover-checks.ts'
6
6
  import { unitFilesDeclaring } from '../core/unit-files.ts'
7
+ import { ownKindsProblem, type OwnKind } from './kinds.ts'
7
8
 
8
9
  /** what the desk shows of a draft's `post.md` beyond its front matter */
9
10
  export interface ArticleInfo {
@@ -11,9 +12,43 @@ export interface ArticleInfo {
11
12
  url: string
12
13
  }
13
14
 
15
+ /** what the repo's guard reads of a draft: every word it says in public and every media file it carries */
16
+ export interface GuardInput {
17
+ title: string
18
+ alt: string
19
+ /** each heading's text, as he writes it */
20
+ texts: readonly string[]
21
+ /** each media, absolute */
22
+ files: readonly string[]
23
+ /** what a picture shows, in words (a trailer shot a line sits over): held to what a picture may show, never to the
24
+ * rules of a public word */
25
+ shows?: readonly string[]
26
+ }
27
+
28
+ /** a line the stage popup offers, and where it comes from (`tested`, a message's id) */
29
+ export interface SuggestedLine {
30
+ text: string
31
+ source: string
32
+ }
33
+
34
+ /** the headings a release stages, each a group or an account of the identity with the options a draft writes */
35
+ export interface ReleaseHeading {
36
+ id: string
37
+ place?: string
38
+ }
39
+
14
40
  export interface SocialDef {
15
41
  /** the words a draft's `topics` take; another word fails the load. Unset, any word */
16
42
  topics?: readonly string[]
43
+ /** the project's own post kinds beside the shared set (kinds.ts), each with its rules page in the repo */
44
+ kinds?: readonly OwnKind[]
45
+ /** why a draft may not go out, one line a problem: run at stage and at every load, so a draft with one never
46
+ * publishes, opens or copies */
47
+ guard?(d: GuardInput): readonly string[]
48
+ /** the lines the stage popup offers for a card; unset, the tested phrasings of the repo's messages store */
49
+ lines?(card: { id: string; title: string }): readonly SuggestedLine[]
50
+ /** a release of the repo stages one draft with these headings; unset, a release stages nothing */
51
+ release?: { headings: readonly ReleaseHeading[] }
17
52
  /** a draft folder holding a `post.md`: its address on the site */
18
53
  article?(dir: string): ArticleInfo
19
54
  /** the article as the site renders it, html; its media paths under `mediaBase` */
@@ -29,7 +64,14 @@ const WORD = /^[a-z][a-z0-9-]*$/
29
64
  /** why a social unit cannot be read, or null */
30
65
  export function socialProblem(d: SocialDef): string | null {
31
66
  for (const t of d.topics ?? []) if (!WORD.test(t)) return `social: topic '${t}' is a lowercase word`
32
- for (const f of ['article', 'preview'] as const) if (d[f] !== undefined && typeof d[f] !== 'function') return `social: ${f} is a function`
67
+ if (d.kinds !== undefined) {
68
+ if (!Array.isArray(d.kinds)) return 'social: kinds is a list of { id, for, page }'
69
+ const why = ownKindsProblem(d.kinds)
70
+ if (why !== null) return why
71
+ }
72
+ for (const f of ['article', 'preview', 'guard', 'lines'] as const) if (d[f] !== undefined && typeof d[f] !== 'function') return `social: ${f} is a function`
73
+ for (const h of d.release?.headings ?? []) if (!WORD.test(h.id)) return `social: release heading '${h.id}' is a group or an account id`
74
+ if (d.release !== undefined && d.release.headings.length === 0) return 'social: release names no heading'
33
75
  if (d.notes !== undefined && !WORD.test(d.notes)) return `social: notes '${d.notes}' is a review topic, a lowercase word`
34
76
  return null
35
77
  }
@@ -40,6 +82,20 @@ export function social(d: SocialDef): SocialUnit {
40
82
  return { ...d, kind: 'social' }
41
83
  }
42
84
 
85
+ /** THE repo's public text guard on one input (wiki tools/shipkit/social.md, The guard): the unit's `guard`, one line
86
+ * a problem; a guard that throws is one problem naming why; no unit or no guard, none */
87
+ export function guardWith(unit: SocialUnit | null | undefined, input: Partial<GuardInput>): string[] {
88
+ if (unit?.guard == null) return []
89
+ try {
90
+ return [...unit.guard({ title: input.title ?? '', alt: input.alt ?? '', texts: input.texts ?? [], files: input.files ?? [], ...(input.shows ? { shows: input.shows } : {}) })]
91
+ } catch (e) {
92
+ return [`the repo's guard failed: ${(e as Error).message}`]
93
+ }
94
+ }
95
+
96
+ /** the guard of the repo at `root`, its unit read fresh: a release note, a phrasing of the messages store */
97
+ export const publicProblems = async (root: string, input: Partial<GuardInput>): Promise<string[]> => guardWith(await loadSocialUnit(root), input)
98
+
43
99
  /** the repo's social unit, or null; two of them is an error naming both files */
44
100
  export async function loadSocialUnit(root: string): Promise<SocialUnit | null> {
45
101
  if (!existsSync(root)) return null
@@ -6,6 +6,7 @@ import { existsSync, readFileSync, writeFileSync } from 'node:fs'
6
6
  import { join } from 'node:path'
7
7
  import { gitBin } from '../core/git-bin.ts'
8
8
  import { STEP, type Account } from '../identities/identities.ts'
9
+ import { recordShown, TEXT_FILE } from '../identities/shown.ts'
9
10
  import { setHeadingText, setPostedLine } from './drafts.ts'
10
11
  import { accountOf, draftPost, draftsDir, type Desk } from './load.ts'
11
12
  import { setMeta } from './md.ts'
@@ -108,6 +109,16 @@ export function setLive(desk: Desk, identity: string, account: string, url: stri
108
109
  return [a.file]
109
110
  }
110
111
 
112
+ /** « Done, uploaded »: the account now shows one of a picture row's files (its first when none is named), recorded in
113
+ * its shown.md; a file the row does not name is refused, so the client never names a path of its own. « Done,
114
+ * pasted »: a text row as its value is now, refused when `sha` (what the page showed) is no longer it */
115
+ export function setShown(desk: Desk, identity: string, account: string, row: string, file?: string, sha?: string): string[] {
116
+ const a = accountOf(desk, identity, account)
117
+ const { abs, row: r } = recordShown(a, row, file, sha)
118
+ commitPaths([abs], `identities: ${identity} ${account} shows its ${row}, ${r.file === TEXT_FILE ? 'pasted' : r.file} (${r.sha})`)
119
+ return [abs]
120
+ }
121
+
111
122
  /** one step of `## Setup` ticked or not, by its index among the bullets; its message and errors name it from 1, as the
112
123
  * page numbers it */
113
124
  export function setStep(desk: Desk, identity: string, account: string, index: number, done: boolean): string[] {
@@ -4,7 +4,7 @@
4
4
  import { readdirSync, readFileSync, statSync, writeFileSync } from 'node:fs'
5
5
  import { join } from 'node:path'
6
6
  import { machineCommit } from '../core/machine-commit.ts'
7
- import { bad, NO_STORE, ranged } from '../review/http.ts'
7
+ import { bad, FRESH, NO_STORE, ranged } from '../review/http.ts'
8
8
  import { noteOn } from '../review/notes.ts'
9
9
  import { openReview } from '../review/project.ts'
10
10
  import { FILE_ROUTE, loadStoresUnit, shownFile, storesState, textFiles } from './desk.ts'
@@ -111,7 +111,7 @@ export async function storesRoutes(root: string, req: Request, path: string): Pr
111
111
  }
112
112
  if (path.startsWith(FILE_ROUTE) && req.method === 'GET') {
113
113
  const abs = shownFile(root, decodeURIComponent(path.slice(FILE_ROUTE.length)))
114
- return abs ? ranged(req, abs) : bad(`${path}?`, 404)
114
+ return abs ? ranged(req, abs, FRESH) : bad(`${path}?`, 404)
115
115
  }
116
116
  if (req.method !== 'POST') return bad(`stores: no route ${req.method} ${path}`, 404)
117
117
  const body = (await req.json().catch(() => ({}))) as Record<string, unknown>
@@ -47,7 +47,7 @@ export const FULL_TIMEOUT_MS = 120_000
47
47
  * trigger), so without this a hang lasts until something outside kills it. The quick
48
48
  * tier answers in seconds, so two minutes is far from any real run. */
49
49
  export const QUICK_CEILING_MS = 120_000
50
- /** the full tier runs every suite one after the other, about three minutes */
50
+ /** the full tier's ceiling: it runs every suite, slow ones included */
51
51
  export const FULL_CEILING_MS = 1_800_000
52
52
  const TESTS_KEYS = ['budgetMs', 'slow', 'serial', 'select']
53
53
  const SLOW_KEYS = ['file', 'catches', 'whyNotFast']
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bun
2
- // the floor `test` slot for a plain `bun test` script: quick tier suites in
3
- // parallel workers, the full tier one at a time, the declared serial ones after,
2
+ // the floor `test` slot for a plain `bun test` script: every suite in parallel
3
+ // workers (the full tier adds the slow ones), the declared serial ones after,
4
4
  // and each quick tier suite timed against the budget.
5
5
  // The LAST stdout line is the task headline the gate prints, and it keeps bun's
6
6
  // `Ran N tests` so the gate can still report what ran.
@@ -124,9 +124,9 @@ async function runSuites(argv: string[], ctx: SelectCtx): Promise<number> {
124
124
 
125
125
  const help = Bun.spawnSync(['bun', 'test', '--help'], { stdout: 'pipe', stderr: 'pipe' })
126
126
  const helpText = `${help.stdout.toString()}${help.stderr.toString()}`
127
- // the full tier runs one suite at a time: its suites spawn git and whole
128
- // gates, and sharing a run measured slower than sequential and timed out
129
- const parallel = helpText.includes('--parallel') && tier === 'quick'
127
+ // both tiers share workers: the full tier adds the slow suites to the parallel phase, and a suite that cannot
128
+ // share a run is named in tests.serial
129
+ const parallel = helpText.includes('--parallel')
130
130
  const timed = helpText.includes('--update-timings')
131
131
  // bun drops these the moment any ignore reaches its command line
132
132
  const bunfig = bunfigTest(existsSync('bunfig.toml') ? readFileSync('bunfig.toml', 'utf8') : null)
@@ -14,6 +14,8 @@ import type { TitleMotion } from './motion.ts'
14
14
  import type { TitleRequest } from './titles.ts'
15
15
  import type { Stitched } from './stitch.ts'
16
16
  import { projectCli, readVocab } from './vocab.ts'
17
+ import { timed } from './profile.ts'
18
+ import type { Draft } from './draft.ts'
17
19
 
18
20
  export type Say = (line: string) => void
19
21
 
@@ -122,8 +124,21 @@ export async function load(file: string, root: string, o: { text?: string; dir?:
122
124
  l.score = c.score
123
125
  l.errors.push(...c.errors)
124
126
  }
125
- if (l.errors.length === 0 && l.unit?.check && o.check !== false) {
126
- for (const f of await l.unit.check(checkInput(l))) (f.warn ? l.warnings : l.errors).push({ line: f.line, message: f.message })
127
+ if (l.errors.length === 0 && o.check !== false) {
128
+ // the cut's public words through the repo's one guard, beside the unit's own check
129
+ const { cutProblems, cutWords } = await import('./public-words.ts')
130
+ const { loadSocialUnit } = await import('../social/unit.ts')
131
+ const guarded = await loadSocialUnit(root).then(
132
+ (social) => {
133
+ const { words, unread } = cutWords(t, (p) => fileOf(p, l))
134
+ // with no guard there is nothing to read the voices with, and nothing to say about them
135
+ if (social?.guard != null) l.warnings.push(...unread.map((u) => ({ line: u.line, message: u.why })))
136
+ return cutProblems(social, words)
137
+ },
138
+ (e: Error) => [{ line: 1, message: `the social unit does not load, so no guard read the cut's words: ${e.message}` }],
139
+ )
140
+ if (l.unit?.check) for (const f of await l.unit.check(checkInput(l))) (f.warn ? l.warnings : l.errors).push({ line: f.line, message: f.message })
141
+ l.errors.push(...guarded)
127
142
  l.warnings.sort((a, b) => a.line - b.line)
128
143
  }
129
144
  l.errors.sort((a, b) => a.line - b.line)
@@ -458,6 +473,10 @@ export interface BuildOptions {
458
473
  final: boolean
459
474
  say: Say
460
475
  cwd: string
476
+ /** a draft of the cut (draft.ts): smaller, quicker, its own mp4, no strip unless `strip` */
477
+ draft?: Draft
478
+ /** the strip of a draft too */
479
+ strip?: boolean
461
480
  }
462
481
 
463
482
  /** the shots `names` names and the cells their grids and splits read: what a preview films */
@@ -476,16 +495,16 @@ async function browserLanes(root: string): Promise<number> {
476
495
  }
477
496
 
478
497
  /** film the takes missing (and what --refilm names), as many at once as the repo's browser cap; every shot is tried,
479
- * the failures said together */
480
- async function filmAll(l: Loaded, world: World, refilm: Refilm, say: Say, only?: ReadonlySet<string>): Promise<Take[]> {
481
- const { filmTake } = await import('./footage.ts')
482
- const takes = takesOfLoaded(l)
498
+ * the failures said together. A draft's (`small`, the draft's trailer) reads the cut's own takes and films the rest small */
499
+ async function filmAll(l: Loaded, world: World, refilm: Refilm, say: Say, only?: ReadonlySet<string>, small?: Trailer): Promise<Take[]> {
500
+ const [{ filmTake, takesOf }, { draftTakes }] = await Promise.all([import('./footage.ts'), import('./draft.ts')])
501
+ const takes = small ? draftTakes(takesOfLoaded(l), takesOf(small, l.root, l), world, refilm) : takesOfLoaded(l)
483
502
  const ask = takesToFilm(takes, world, refilm, only)
484
503
  const failed: string[] = []
485
504
  const lane = async (): Promise<void> => {
486
505
  for (let group = ask.shift(); group; group = ask.shift()) {
487
506
  try {
488
- const got = await filmTake(group[0]!, { root: l.root, t: l.t, world: worldFor(world, group[0]!), cli: l.cli, holes: l.unit?.holes === true, say })
507
+ const got = await timed(`film ${group[0]!.shot.name}`, () => filmTake(group[0]!, { root: l.root, t: small ?? l.t, world: worldFor(world, group[0]!), cli: l.cli, holes: l.unit?.holes === true, draft: small !== undefined, say }))
489
508
  for (const tk of group) {
490
509
  const i = takes.indexOf(tk)
491
510
  takes[i] = { ...tk, stamp: got.stamp }
@@ -528,8 +547,32 @@ export async function scoreFile(l: Loaded, seconds: number, say: Say): Promise<s
528
547
  return w.file
529
548
  }
530
549
 
531
- /** everything the stitch reads but its output: sources, titles, sounds, the look */
532
- async function stitchInput(l: Loaded, takes: readonly Take[], shots: readonly Shot[], silent: boolean, say: Say = () => undefined) {
550
+ /** every sound the shots play, made where the house or the unit has to: the music cues, each shot's sfx and voices */
551
+ async function soundsOf(l: Loaded, shots: readonly Shot[], say: Say) {
552
+ const { durationOf } = await import('./ffmpeg.ts')
553
+ const resolve = (req: SoundRequest): Promise<string> => soundFile(l, req, say)
554
+ const ask = (kind: SoundRequest['kind'], text: string, x: { prompt?: true; gen?: SoundGen; run?: SoundRun; line: number }, seconds?: number, take?: string): SoundRequest => soundRequest(kind, text, x, l.dir, seconds, take)
555
+ const music = await timed('sounds', () => Promise.all(
556
+ musicCues(l.t).map(({ cue, at, end }) => {
557
+ if (cue.song === SCORE) return scoreFile(l, cue.from + end - at, say)
558
+ const seconds = cue.from + end - at
559
+ if (isFileSound(cue.song, cue)) return cue.song.endsWith('.mid') ? resolve(ask('music', fileOf(cue.song, l)!, cue, seconds)) : fileOf(cue.song, l)!
560
+ return resolve(ask('music', cue.song, cue, seconds, cue.take))
561
+ }),
562
+ ))
563
+ const sfx = await Promise.all(shots.map((s) => Promise.all(s.sfx.map(async (x) => {
564
+ const file = isFileSound(x.id, x) ? fileOf(x.id, l)! : await resolve(ask('sfx', x.id, x))
565
+ return { file, seconds: await durationOf(file) }
566
+ }))))
567
+ const voices = await Promise.all(shots.map((s) => Promise.all(s.voices.map(async (v) => {
568
+ const file = v.file ? fileOf(v.file, l)! : await resolve(ask('voice', v.text ?? 'run', v))
569
+ return { file, seconds: await durationOf(file) }
570
+ }))))
571
+ return { music, sfx, voices }
572
+ }
573
+
574
+ /** everything the stitch reads but its output: sources, titles, sounds (`sounds` when the caller started them), the look */
575
+ async function stitchInput(l: Loaded, takes: readonly Take[], shots: readonly Shot[], silent: boolean, say: Say = () => undefined, sounds?: ReturnType<typeof soundsOf>) {
533
576
  const { gridMask, splitMasks } = await import('./stitch.ts')
534
577
  const [{ cardPng, titlePng }, { lookOf }, { durationOf }, { trailerCache }, { loadBrand, identityLogo }] = await Promise.all([
535
578
  import('./titles.ts'),
@@ -569,27 +612,9 @@ async function stitchInput(l: Loaded, takes: readonly Take[], shots: readonly Sh
569
612
  const styleErrors = resolveStyles(l.t, brand?.trailer?.styles ?? {})
570
613
  if (styleErrors.length > 0) throw new Refused(styleErrors.map((e) => `${relative(l.root, l.file)}:${e.line}: ${e.message}`).join('\n'))
571
614
  const motions = titleMotions({ ...l.t, shots: [...shots] })
572
- const drawn = await Promise.all(shots.map((s, i) => Promise.all(s.titles.map(async (ti, j) => titlePng(titles, { ...titleRequest(l, ti, look, motions[i]![j]!), font: await titleFont(l, ti) })))))
615
+ const drawn = await timed('titles', () => Promise.all(shots.map((s, i) => Promise.all(s.titles.map(async (ti, j) => titlePng(titles, { ...titleRequest(l, ti, look, motions[i]![j]!), font: await titleFont(l, ti) }))))))
573
616
  if (silent) return { ...base, sources, titles: drawn, music: [], sfx: shots.map(() => []), voices: shots.map(() => []) }
574
- const resolve = (req: SoundRequest): Promise<string> => soundFile(l, req, say)
575
- const ask = (kind: SoundRequest['kind'], text: string, x: { prompt?: true; gen?: SoundGen; run?: SoundRun; line: number }, seconds?: number, take?: string): SoundRequest => soundRequest(kind, text, x, l.dir, seconds, take)
576
- const music = await Promise.all(
577
- musicCues(l.t).map(({ cue, at, end }) => {
578
- if (cue.song === SCORE) return scoreFile(l, cue.from + end - at, say)
579
- const seconds = cue.from + end - at
580
- if (isFileSound(cue.song, cue)) return cue.song.endsWith('.mid') ? resolve(ask('music', fileOf(cue.song, l)!, cue, seconds)) : fileOf(cue.song, l)!
581
- return resolve(ask('music', cue.song, cue, seconds, cue.take))
582
- }),
583
- )
584
- const sfx = await Promise.all(shots.map((s) => Promise.all(s.sfx.map(async (x) => {
585
- const file = isFileSound(x.id, x) ? fileOf(x.id, l)! : await resolve(ask('sfx', x.id, x))
586
- return { file, seconds: await durationOf(file) }
587
- }))))
588
- const voices = await Promise.all(shots.map((s) => Promise.all(s.voices.map(async (v) => {
589
- const file = v.file ? fileOf(v.file, l)! : await resolve(ask('voice', v.text ?? 'run', v))
590
- return { file, seconds: await durationOf(file) }
591
- }))))
592
- return { ...base, sources, titles: drawn, music, sfx, voices }
617
+ return { ...base, sources, titles: drawn, ...(await (sounds ?? soundsOf(l, shots, say))) }
593
618
  }
594
619
 
595
620
  /** a vertical cut finished: what the brand's vertical look draws over the stitched cut, the outro, the end card. The
@@ -671,38 +696,51 @@ async function pruneAfter(root: string, say: Say): Promise<void> {
671
696
  /** the whole cut: out/<cut>.mp4, its strip, montage page and shelf of takes; the timeline and what was rendered, said */
672
697
  export async function build(l: Loaded, o: BuildOptions): Promise<string> {
673
698
  const t0 = performance.now()
674
- const [{ trailerCache }, { stitch, strip, rendered }, { ffmpegMissing }] = await Promise.all([import('./footage.ts'), import('./stitch.ts'), import('./ffmpeg.ts')])
699
+ const [{ trailerCache }, { stitch, strip, rendered, renderMix }, { ffmpegMissing }] = await Promise.all([import('./footage.ts'), import('./stitch.ts'), import('./ffmpeg.ts')])
675
700
  const missing = ffmpegMissing()
676
701
  if (missing) throw new Refused(missing)
677
- const world = await worldOf(l)
678
- const takes = await filmAll(l, world, o.refilm, o.say)
679
- shelve(l, takes)
702
+ // the sound reads no take: it is made and mixed while the takes film, off the stitch's path
703
+ const sounds = soundsOf(l, l.t.shots, o.say)
704
+ const mixing = timed('the sound mixed', async () => renderMix({ t: l.t, ...(await sounds), cache: trailerCache(l.root, 'pieces') }))
705
+ // a take that fails throws first: the sound's own failure is said where the stitch awaits it
706
+ mixing.catch(() => undefined)
707
+ const world = await timed('world', () => worldOf(l))
708
+ // a draft draws the picture of its own smaller trailer (draft.ts); the sound stays the cut's
709
+ const small = o.draft ? (await import('./draft.ts')).draftOf(l.t, o.draft) : undefined
710
+ const lv: Loaded = small ? { ...l, t: small } : l
711
+ const takes = await timed('filming', () => filmAll(l, world, o.refilm, o.say, undefined, small))
712
+ // the shelf is what `keep` clones: a draft never writes it
713
+ if (!small) await timed('shelve', () => shelve(l, takes))
680
714
  const tFilm = performance.now()
681
- const input = await stitchInput(l, takes, l.t.shots, false, o.say)
682
- const out = join(outDir(l), `${l.t.name}.mp4`)
715
+ const input = await timed('stitch input (sources, titles, sounds)', () => stitchInput(lv, takes, lv.t.shots, false, o.say, sounds))
716
+ const out = join(outDir(l), `${lv.t.name}.mp4`)
683
717
  // a vertical cut stitches into the cache, and its finish writes the mp4
684
- const cut = l.t.vertical ? join(trailerCache(l.root, 'pieces'), `${l.t.name}-cut.mp4`) : out
685
- const done = await stitch({ ...input, t: l.t, out: cut, cache: trailerCache(l.root, 'pieces'), encoder: o.final ? 'final' : 'draft' })
686
- const finished = l.t.vertical ? await finishVertical(l, input, done, cut, out, o.final) : null
687
- const stripFile = join(outDir(l), `${l.t.name}.strip.png`)
688
- // the strip is drawn from the pieces' thumbs: the same pieces draw the same strip, so a build that rendered no
689
- // section keeps it
690
- const stripKey = join(trailerCache(l.root, 'pieces'), `${l.t.name}.strip.key`)
691
- const key = done.pieces.map((p) => p.thumbs).join('\n')
692
- const drawn = (): string => `${key}\n${statSync(stripFile).mtimeMs}`
693
- if (!existsSync(stripFile) || !existsSync(stripKey) || readFileSync(stripKey, 'utf8') !== drawn()) {
694
- await strip(done.pieces, stripFile)
695
- writeFileSync(stripKey, drawn())
718
+ const cut = lv.t.vertical ? join(trailerCache(l.root, 'pieces'), `${lv.t.name}-cut.mp4`) : out
719
+ const withStrip = !small || o.strip === true
720
+ const done = await timed('stitch', () => stitch({ ...input, t: lv.t, out: cut, cache: trailerCache(l.root, 'pieces'), encoder: o.final ? 'final' : 'draft', mixing, thumbs: withStrip }))
721
+ const finished = lv.t.vertical ? await finishVertical(lv, input, done, cut, out, o.final) : null
722
+ const stripFile = join(outDir(l), `${lv.t.name}.strip.png`)
723
+ if (withStrip) {
724
+ // the strip is drawn from the pieces' thumbs: the same pieces draw the same strip, so a build that rendered no
725
+ // section keeps it
726
+ const stripKey = join(trailerCache(l.root, 'pieces'), `${lv.t.name}.strip.key`)
727
+ const key = done.pieces.map((p) => p.thumbs).join('\n')
728
+ const drawn = (): string => `${key}\n${statSync(stripFile).mtimeMs}`
729
+ if (!existsSync(stripFile) || !existsSync(stripKey) || readFileSync(stripKey, 'utf8') !== drawn()) {
730
+ await timed('strip', () => strip(done.pieces, stripFile))
731
+ writeFileSync(stripKey, drawn())
732
+ }
696
733
  }
697
- writeFileSync(join(outDir(l), `${l.t.name}.montage.md`), montage(l.t, basename(l.file)))
734
+ if (!small) writeFileSync(join(outDir(l), `${l.t.name}.montage.md`), montage(l.t, basename(l.file)))
698
735
  for (const line of timeline(l, takes, world, o.cwd)) o.say(line)
699
- o.say(`ok: ${out} (${(finished?.seconds ?? total(l.t)).toFixed(2)} s) in ${((performance.now() - t0) / 1000).toFixed(1)} s: filming ${((tFilm - t0) / 1000).toFixed(1)} s, ${rendered(done)}${finished ? `, ${finished.note}` : ''}`)
700
- o.say(`ok: ${stripFile}`)
736
+ const what = small ? `a draft at ${small.size.join('x')}, ` : ''
737
+ o.say(`ok: ${out} (${what}${(finished?.seconds ?? total(lv.t)).toFixed(2)} s) in ${((performance.now() - t0) / 1000).toFixed(1)} s: filming ${((tFilm - t0) / 1000).toFixed(1)} s, ${rendered(done)}${finished ? `, ${finished.note}` : ''}`)
738
+ if (withStrip) o.say(`ok: ${stripFile}`)
701
739
  // the vertical's finish can lay an outro's own sound after the mix: its mp4 is what is measured then
702
740
  const heard = finished ? out : done.mix
703
741
  if (heard) {
704
742
  const [{ loudness, loudnessKept }, { MIX_TRUE_PEAK }] = await Promise.all([import('./ffmpeg.ts'), import('./graph.ts')])
705
- const { lufs, truePeak } = await (finished ? loudness(heard) : loudnessKept(heard))
743
+ const { lufs, truePeak } = await timed('the mix measured', () => (finished ? loudness(heard) : loudnessKept(heard)))
706
744
  const { master } = l.t
707
745
  const line = `the mix: ${lufs.toFixed(1)} LUFS integrated${master === null ? '' : ` (master ${master})`}, true peak ${truePeak.toFixed(1)} dBTP`
708
746
  if (truePeak > 0) refuse(`${line}, past 0 dBTP: it clips on a player. ${out} is written; lower the loudest sounds (a score's volume, a sfx or voice volume)`)
@@ -711,7 +749,7 @@ export async function build(l: Loaded, o: BuildOptions): Promise<string> {
711
749
  else if (Math.abs(off) > 0.5) o.say(`WARN ${line}, ${Math.abs(off).toFixed(1)} LU ${off < 0 ? 'under' : 'over'} its master, past what one gain into the ${MIX_TRUE_PEAK} dBTP limiter reaches (its loudest sound held down while the rest stays quiet)`)
712
750
  else o.say(`ok: ${line}`)
713
751
  }
714
- await pruneAfter(l.root, o.say)
752
+ await timed('prune', () => pruneAfter(l.root, o.say))
715
753
  return out
716
754
  }
717
755
 
@@ -0,0 +1,28 @@
1
+ // a cut's draft (`sk trailer --draft`): the same cut, smaller and quicker, to judge its beats. It reads every take the
2
+ // cut has filmed as it is and films a missing one small, under a key of its own (a take's key holds its size), so a
3
+ // draft take never stands in a full build or a kept version. Its rate stays the cut's: every take decodes each of its
4
+ // frames anyway, and a rate converted down made the stitch slower (8.3 s at 30 fps, 11.9 s at 15 on a 74 s cut). Its
5
+ // sound is the cut's own mix, its pieces render under `<name>-draft-<section>`, its mp4 is `out/<name>-draft.mp4`
6
+ import { type Refilm, type Take, takesToFilm, type World } from './plan.ts'
7
+ import type { Trailer } from './grammar.ts'
8
+
9
+ /** how a draft is smaller than its cut: each side scaled */
10
+ export interface Draft {
11
+ scale: number
12
+ }
13
+
14
+ export const DRAFT: Draft = { scale: 0.5 }
15
+
16
+ /** the name a draft's pieces, takes and mp4 go under */
17
+ export const draftName = (name: string): string => `${name}-draft`
18
+
19
+ /** the cut as its draft draws it: its size scaled (even sides, as H.264 takes), its own name */
20
+ export function draftOf<T extends Pick<Trailer, 'name' | 'size'>>(t: T, d: Draft = DRAFT): T {
21
+ const even = (x: number): number => Math.max(2, 2 * Math.round((x * d.scale) / 2))
22
+ return { ...t, name: draftName(t.name), size: [even(t.size[0]), even(t.size[1])] }
23
+ }
24
+
25
+ /** the takes a draft reads: the cut's own wherever it has one the build would not film again, else the draft's */
26
+ export function draftTakes(full: readonly Take[], small: readonly Take[], world: World, refilm: Refilm): Take[] {
27
+ return full.map((tk, i) => (takesToFilm([tk], world, refilm).length === 0 ? tk : small[i]!))
28
+ }
@@ -122,6 +122,8 @@ export interface FilmContext {
122
122
  cli: readonly string[] | null
123
123
  /** a clip take that drops its picture is filmed again once, then refused (the unit's `holes`) */
124
124
  holes?: boolean
125
+ /** a draft's take (draft.ts): `t` is the draft's size and rate, and the row is told so */
126
+ draft?: boolean
125
127
  say: (line: string) => void
126
128
  }
127
129
 
@@ -167,8 +169,8 @@ export async function filmTake(tk: Take, c: FilmContext): Promise<Take> {
167
169
  async function commandTake(tk: Take, f: Exclude<TakeFilm, { kind: 'url' | 'page' }>, part: string, seconds: number | null, c: FilmContext): Promise<string> {
168
170
  if (f.kind === 'cli' && c.cli === null) throw new Error(`shot ${tk.shot.name} (line ${f.line}): film ${f.argv.join(' ')} needs the project CLI (the cli script of package.json)`)
169
171
  const argv = f.kind === 'run' ? ['sh', '-c', runCommand(f, { out: part, seconds, size: c.t.size, fps: c.t.fps })] : cliArgv(c.cli!, f, part, seconds, tk.argv)
170
- // the cut's frame and rate: a row that films at the cut's size reads them
171
- const env = { ...process.env, SK_TRAILER_SIZE: `${c.t.size[0]}x${c.t.size[1]}`, SK_TRAILER_FPS: String(c.t.fps) }
172
+ // the cut's frame and rate: a row that films at the cut's size reads them; a draft's row may film smaller and quicker
173
+ const env = { ...process.env, SK_TRAILER_SIZE: `${c.t.size[0]}x${c.t.size[1]}`, SK_TRAILER_FPS: String(c.t.fps), ...(c.draft ? { SK_TRAILER_DRAFT: '1' } : {}) }
172
174
  const p = Bun.spawn(argv, { cwd: c.root, stdout: 'pipe', stderr: 'pipe', env })
173
175
  const [out, err, code] = await Promise.all([new Response(p.stdout).text(), new Response(p.stderr).text(), p.exited])
174
176
  const said = `${out}${err}`.trim()