rvlib-shipkit 2.20.0 → 2.22.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 (156) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/package.json +1 -1
  3. package/src/asks/asks-queue.ts +8 -7
  4. package/src/assets/kits/identity-kit.ts +158 -2
  5. package/src/checks/SK004-gitignore-policy.check.ts +6 -3
  6. package/src/cli/cmd_Bump.ts +3 -3
  7. package/src/cli/cmd_GlobalProcesses.ts +2 -107
  8. package/src/cli/cmd_Home.ts +1 -1
  9. package/src/cli/cmd_Overview.ts +2 -1
  10. package/src/cli/cmd_Rec.ts +349 -0
  11. package/src/cli/cmd_Releases.ts +42 -3
  12. package/src/cli/cmd_Review.ts +22 -13
  13. package/src/cli/cmd_Secret.ts +10 -3
  14. package/src/cli/cmd_Sign.ts +24 -0
  15. package/src/cli/cmd_Social.ts +57 -8
  16. package/src/cli/cmd_Sound.ts +17 -4
  17. package/src/cli/cmd_Trailer.ts +67 -1
  18. package/src/cli/family-pages.ts +1 -0
  19. package/src/cli/registry.ts +6 -1
  20. package/src/collections/collection-types.ts +1 -1
  21. package/src/collections/review.ts +23 -4
  22. package/src/core/agent-spawn.ts +4 -17
  23. package/src/core/code-lines.ts +49 -0
  24. package/src/core/discover-checks.ts +27 -3
  25. package/src/core/hard-reset.ts +34 -0
  26. package/src/core/layout.ts +6 -0
  27. package/src/core/raw-access.ts +3 -13
  28. package/src/core/throwaway-worktree.ts +72 -0
  29. package/src/home/app-sign.ts +98 -0
  30. package/src/home/gui-app/ShipkitGui.swift +35 -0
  31. package/src/home/gui-app.ts +31 -11
  32. package/src/home/home-routes.ts +6 -0
  33. package/src/home/pm-switch.ts +112 -0
  34. package/src/home/serve-web.ts +1 -1
  35. package/src/identities/identities.ts +17 -6
  36. package/src/media-kinds.ts +5 -3
  37. package/src/media-store/forget.ts +54 -0
  38. package/src/media-store/put.ts +4 -3
  39. package/src/media-store/space.ts +63 -24
  40. package/src/messages/brief.ts +3 -3
  41. package/src/messages/score.ts +2 -0
  42. package/src/recordings/delete.ts +19 -0
  43. package/src/recordings/edit.ts +231 -0
  44. package/src/recordings/load.ts +37 -0
  45. package/src/recordings/marks-draw.ts +111 -0
  46. package/src/recordings/marks-png.ts +25 -0
  47. package/src/recordings/marks.ts +138 -0
  48. package/src/recordings/media-kind.ts +67 -0
  49. package/src/recordings/model.ts +170 -0
  50. package/src/recordings/open.ts +33 -0
  51. package/src/recordings/place.ts +89 -0
  52. package/src/recordings/presets.ts +99 -0
  53. package/src/recordings/recorder-app/Capture.swift +510 -0
  54. package/src/recordings/recorder-app/Clip.swift +107 -0
  55. package/src/recordings/recorder-app/Editor.swift +39 -0
  56. package/src/recordings/recorder-app/Tray.swift +298 -0
  57. package/src/recordings/recorder-app/main.swift +859 -0
  58. package/src/recordings/recorder-app.ts +46 -0
  59. package/src/recordings/recorder.shipkit.ts +11 -0
  60. package/src/recordings/routes.ts +140 -0
  61. package/src/recordings/run-recorder.ts +40 -0
  62. package/src/recordings/share.ts +107 -0
  63. package/src/recordings/take.ts +146 -0
  64. package/src/recordings/view.ts +40 -0
  65. package/src/release/gate-checkout.ts +74 -0
  66. package/src/release/release-scope.ts +35 -26
  67. package/src/release/run-bump.ts +79 -37
  68. package/src/release/run-release.ts +67 -53
  69. package/src/releases/add.ts +38 -5
  70. package/src/releases/before.ts +31 -0
  71. package/src/releases/from-card.ts +105 -20
  72. package/src/releases/model.ts +100 -18
  73. package/src/releases/pictures.ts +29 -8
  74. package/src/repo-config.ts +7 -3
  75. package/src/review/http.ts +1 -1
  76. package/src/review/model.ts +12 -2
  77. package/src/review/stage-card.ts +1 -1
  78. package/src/review/store.ts +12 -2
  79. package/src/review/trailer-desk.ts +20 -0
  80. package/src/review/trailer-model.ts +67 -0
  81. package/src/review/trailer-routes.ts +98 -1
  82. package/src/review/trailer-voices.ts +144 -0
  83. package/src/review/watchers.ts +58 -1
  84. package/src/secrets/manager.ts +18 -1
  85. package/src/serve/hub-app/benign-errors.ts +22 -0
  86. package/src/serve/hub-app/hash-route.ts +27 -15
  87. package/src/serve/hub-app/home-st.ts +23 -5
  88. package/src/serve/hub-app/home.html +1 -0
  89. package/src/serve/hub-app/hub-app.tsx +8 -1
  90. package/src/serve/hub-app/icons.tsx +2 -0
  91. package/src/serve/hub-app/palette-st.ts +1 -0
  92. package/src/serve/hub-app/project-list.css +7 -2
  93. package/src/serve/hub-app/project-list.tsx +10 -0
  94. package/src/serve/hub-app/projects-svc.ts +17 -7
  95. package/src/serve/hub-app/recordings-st.ts +641 -0
  96. package/src/serve/hub-app/recordings-view.tsx +504 -0
  97. package/src/serve/hub-app/recordings.css +82 -0
  98. package/src/serve/hub-app/releases/releases-page.tsx +121 -28
  99. package/src/serve/hub-app/releases/releases-st.ts +46 -4
  100. package/src/serve/hub-app/releases.css +30 -3
  101. package/src/serve/hub-app/repo-sections.ts +1 -1
  102. package/src/serve/hub-app/repo-st.ts +16 -11
  103. package/src/serve/hub-app/review/clip-st.ts +3 -1
  104. package/src/serve/hub-app/review/kit.tsx +3 -3
  105. package/src/serve/hub-app/review/trailer-page.tsx +32 -6
  106. package/src/serve/hub-app/review/trailer-st.ts +184 -8
  107. package/src/serve/hub-app/review/trailer-timeline.tsx +39 -4
  108. package/src/serve/hub-app/review/trailer-voices-st.ts +370 -0
  109. package/src/serve/hub-app/review/trailer-voices.tsx +574 -0
  110. package/src/serve/hub-app/review.css +90 -0
  111. package/src/serve/hub-app/social/comms-page.tsx +10 -5
  112. package/src/serve/hub-app/social/next-release.tsx +118 -0
  113. package/src/serve/hub-app/social/post-card.tsx +31 -3
  114. package/src/serve/hub-app/social/social-model.ts +6 -0
  115. package/src/serve/hub-app/social/social-st.ts +50 -1
  116. package/src/serve/hub-app/social.css +12 -0
  117. package/src/serve/hub-app/tree-build.ts +2 -0
  118. package/src/serve/project-gutter-route.ts +8 -0
  119. package/src/serve/project-gutter.ts +4 -2
  120. package/src/shipkit.ts +2 -2
  121. package/src/shot/box.ts +49 -22
  122. package/src/shot/browser-slot.ts +13 -3
  123. package/src/shot/client.ts +1 -1
  124. package/src/shot/film-box.ts +193 -117
  125. package/src/shot/shooter.ts +20 -8
  126. package/src/smoke/run-smoke.ts +8 -6
  127. package/src/social/compose.ts +14 -0
  128. package/src/social/desk-index.ts +49 -8
  129. package/src/social/discord-layout.ts +6 -2
  130. package/src/social/drafts.ts +1 -1
  131. package/src/social/kinds.ts +3 -2
  132. package/src/social/load.ts +42 -9
  133. package/src/social/publish/index.ts +27 -10
  134. package/src/social/publish/secret.ts +12 -4
  135. package/src/social/release-card.ts +69 -0
  136. package/src/social/release-stage.ts +173 -30
  137. package/src/social/routes.ts +7 -1
  138. package/src/social/stage.ts +45 -22
  139. package/src/trailer/bed.ts +111 -0
  140. package/src/trailer/build.ts +81 -38
  141. package/src/trailer/ffmpeg.ts +14 -0
  142. package/src/trailer/grammar.ts +32 -4
  143. package/src/trailer/graph.ts +12 -1
  144. package/src/trailer/look.ts +7 -0
  145. package/src/trailer/shot-plan.ts +75 -0
  146. package/src/trailer/shot-state.ts +191 -0
  147. package/src/trailer/sound/audio.ts +28 -0
  148. package/src/trailer/sound/brand.ts +53 -3
  149. package/src/trailer/sound/gen.ts +61 -2
  150. package/src/trailer/sound/index.ts +25 -11
  151. package/src/trailer/sound/presets.ts +86 -5
  152. package/src/trailer/sound/run.ts +1 -1
  153. package/src/trailer/sound/takes.ts +94 -0
  154. package/src/trailer/titles.ts +36 -0
  155. package/src/trailer/url.ts +1 -1
  156. package/src/veille/chrome.ts +6 -3
@@ -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
  }
@@ -194,6 +200,49 @@ class SocialReleaseCommand extends Command {
194
200
  }
195
201
  }
196
202
 
203
+ class SocialReleaseCardCommand extends Command {
204
+ static override paths = [['social', 'release-card']]
205
+ static override usage = Command.Usage({
206
+ category: 'Social',
207
+ description: "a release draft's picture: the brand's icon, name and version beside a feature, first in its media",
208
+ details:
209
+ "Renders the identity kit's release card (1200x675) into the draft's media/release-<version>.png, puts it first in its media and sets its alt, then commits the two files. The feature is the release file's first safe still unless --feature names one: a SAFE still only, every venue attaches the card; --feature none draws the poster (no feature). The headline is the release file's title, else the change its feature shows, else its first change; --headline gives it. --focus is where the feature's subject sits across it, 0 to 1 (default 0.3). Page: wiki tools/shipkit/social.md, The release card",
210
+ examples: [
211
+ ['the release file decides', 'sk social release-card 20261108-120000-app-1-2-0'],
212
+ ['a feature and a headline picked', 'sk social release-card app-1-2-0 --feature shots/hands.png --headline "Hands that pinch. A new room."'],
213
+ ['the poster', 'sk social release-card app-1-2-1 --feature none'],
214
+ ],
215
+ })
216
+ draft = Option.String({ required: true })
217
+ feature = Option.String('--feature', { description: 'a SAFE still beside the brand, or none for the poster (default: the release file\'s first safe still)' })
218
+ headline = Option.String('--headline', { description: "the card's one line (default: the release's title, else its feature's change, else its first change)" })
219
+ focus = Option.String('--focus', { description: "where the feature's subject sits across it, 0 left to 1 right (default 0.3)" })
220
+ override async execute(): Promise<number> {
221
+ return guarded(this.context, async () => {
222
+ const { resolve } = await import('node:path')
223
+ const { desk } = await model(undefined)
224
+ const { findDraft } = await import('../social/load.ts')
225
+ const { loadSocialUnit } = await import('../social/unit.ts')
226
+ const { releaseCardDraft } = await import('../social/release-stage.ts')
227
+ const focus = this.focus === undefined ? undefined : Number(this.focus)
228
+ if (focus !== undefined && !(focus >= 0 && focus <= 1)) throw new Error(`--focus ${this.focus}: a number from 0 to 1`)
229
+ const d = findDraft(desk, this.draft, process.cwd())
230
+ const r = await releaseCardDraft(
231
+ desk.root,
232
+ d.slug,
233
+ {
234
+ ...(this.feature === undefined ? {} : { feature: this.feature === 'none' ? null : resolve(process.cwd(), this.feature) }),
235
+ ...(this.headline === undefined ? {} : { headline: this.headline }),
236
+ ...(focus === undefined ? {} : { focus }),
237
+ },
238
+ { unit: await loadSocialUnit(desk.root) },
239
+ )
240
+ say(this.context)(`ok: ${d.slug} ${r.media}, ${r.feature ? `beside ${r.feature}` : 'the poster'}, "${r.headline}"`)
241
+ return 0
242
+ })
243
+ }
244
+ }
245
+
197
246
  class SocialPlanCommand extends Command {
198
247
  static override paths = [['social', 'plan']]
199
248
  static override usage = Command.Usage({
@@ -409,4 +458,4 @@ class IdentitiesPushCommand extends Command {
409
458
  }
410
459
  }
411
460
 
412
- export const SOCIAL_COMMANDS = [SocialCommand, SocialTimelineCommand, SocialCoverageCommand, SocialPostCommand, SocialReleaseCommand, SocialPlanCommand, SocialStateCommand, SocialMigrateCommand, SocialDiscordApplyCommand, IdentitiesCommand, IdentitiesPushCommand]
461
+ export const SOCIAL_COMMANDS = [SocialCommand, SocialTimelineCommand, SocialCoverageCommand, SocialPostCommand, SocialReleaseCommand, SocialReleaseCardCommand, SocialPlanCommand, SocialStateCommand, SocialMigrateCommand, SocialDiscordApplyCommand, IdentitiesCommand, IdentitiesPushCommand]
@@ -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,
@@ -14,6 +14,7 @@ export const FAMILY_PAGES: Readonly<Record<string, string>> = {
14
14
  Home: 'tools/shipkit/home.md',
15
15
  Media: 'tools/shipkit/media-store.md',
16
16
  Messages: 'tools/shipkit/messages.md',
17
+ Record: 'tools/shipkit/recordings.md',
17
18
  Refactor: 'patterns/typescript/index.md',
18
19
  Review: 'tools/shipkit/review.md',
19
20
  Scaffold: 'patterns/pocketbase/index.md',
@@ -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'
@@ -48,6 +48,8 @@ import { SOUND_COMMANDS } from './cmd_Sound.ts'
48
48
  import { REVIEW_COMMANDS } from './cmd_Review.ts'
49
49
  import { SOCIAL_COMMANDS } from './cmd_Social.ts'
50
50
  import { MEDIA_COMMANDS } from './cmd_Media.ts'
51
+ import { REC_COMMANDS } from './cmd_Rec.ts'
52
+ import { SignSetupCommand } from './cmd_Sign.ts'
51
53
  import { ANNEX_COMMANDS } from './cmd_Annex.ts'
52
54
  import { BACKUP_COMMANDS } from './cmd_Backup.ts'
53
55
  import { VEILLE_COMMANDS } from './cmd_Veille.ts'
@@ -84,6 +86,7 @@ export function buildCli(): Cli {
84
86
  cli.register(ReleaseCommand)
85
87
  cli.register(ReleasesCommand)
86
88
  cli.register(ReleasesAddCommand)
89
+ cli.register(ReleasesRefreshCommand)
87
90
  cli.register(HooksInstallCommand)
88
91
  cli.register(HooksPreCommitCommand)
89
92
  cli.register(HooksCommitMsgCommand)
@@ -96,6 +99,8 @@ export function buildCli(): Cli {
96
99
  for (const c of REVIEW_COMMANDS) cli.register(c)
97
100
  for (const c of SOCIAL_COMMANDS) cli.register(c)
98
101
  for (const c of MEDIA_COMMANDS) cli.register(c)
102
+ for (const c of REC_COMMANDS) cli.register(c)
103
+ cli.register(SignSetupCommand)
99
104
  for (const c of ANNEX_COMMANDS) cli.register(c)
100
105
  for (const c of BACKUP_COMMANDS) cli.register(c)
101
106
  for (const c of VEILLE_COMMANDS) cli.register(c)
@@ -32,7 +32,7 @@ export const NO_CHECK = 'in no check'
32
32
  * section a row lives under (hub-app/tree-build.ts KIND_SECTION). There is no
33
33
  * catch all kind: a row belongs to an owner, and what belongs to the hub
34
34
  * itself is its status (serve/hub-problems.ts), never a row */
35
- export const RESOURCE_TYPES = ['ask', 'secret', 'asset', 'post', 'workflow', 'wiki', 'contract', 'check', 'test', 'reflection', 'process', 'command', 'card', 'cut', 'store', 'release', 'veille', 'message'] as const
35
+ export const RESOURCE_TYPES = ['ask', 'secret', 'asset', 'post', 'workflow', 'wiki', 'contract', 'check', 'test', 'reflection', 'process', 'command', 'card', 'cut', 'voice', 'store', 'release', 'veille', 'message'] as const
36
36
 
37
37
  /** the collection of the review cards that wait on him (collections/review.ts) */
38
38
  export const REVIEW_COL = 'review'
@@ -1,13 +1,16 @@
1
1
  // the review store and the trailer cuts as tree rows (wiki tools/shipkit/review.md). Under the review section, one row a
2
2
  // card that waits on HIM (the owner's verdict, his answer to a question): yellow, so `sk needs` lists it too. Under the trailer
3
- // section, one row a cut, its open frame notes in the slot: they wait on agents, never on him, so a cut is never yellow.
4
- // Each collection exists only where the repo has its folder, so a repo with none draws the section greyed
3
+ // section, one row a cut, its open frame notes in the slot: they wait on agents, never on him, so a cut is never yellow;
4
+ // and one yellow row a line of his own voice he has not recorded yet (the page's Voices). Each collection exists only where the repo has its folder, so a repo with none draws the section greyed
5
5
  import { existsSync } from 'node:fs'
6
6
  import { join } from 'node:path'
7
7
  import { STATUS_LABEL, isFrame, stateOf, type ReviewItem } from '../review/model.ts'
8
8
  import { readAllCached, storeDir, storeStamp, warmStore } from '../review/store.ts'
9
9
  import { statusOf, waitingOnOwner, type Thread } from '../review/threads.ts'
10
10
  import { cutsOf, trailerIds } from '../review/trailer-desk.ts'
11
+ import { voicesDesk } from '../review/trailer-voices.ts'
12
+ import { recordVoices } from '../trailer/sound/brand.ts'
13
+ import { brandSound } from '../trailer/sound/index.ts'
11
14
  import { REVIEW_COL, TRAILER_COL, type Collection, type Instance } from './collection-types.ts'
12
15
 
13
16
  const waiting = new Map<string, { stamp: string; threads: Thread[]; items: ReviewItem[] }>()
@@ -66,7 +69,23 @@ export function trailersCollection(root: string): Collection | null {
66
69
  const s = x.item.subject
67
70
  if (isFrame(s) && stateOf(x, false).state !== 'closed') open.set(`${s.trailer}/${s.cut}`, (open.get(`${s.trailer}/${s.cut}`) ?? 0) + 1)
68
71
  }
69
- return ids.flatMap((id) =>
72
+ // a line of his recorded voice with no take waits on him: yellow, one row a text
73
+ const voices: Instance[] = []
74
+ const brand = await brandSound(root).catch(() => undefined)
75
+ if (recordVoices(brand).length > 0)
76
+ for (const id of ids)
77
+ for (const l of (await voicesDesk(root, id, brand))?.lines ?? [])
78
+ if (l.mine && !l.take)
79
+ voices.push({
80
+ id: `voice:${id}/${l.key}`,
81
+ text: `${id}: "${l.words}" waits for your voice`,
82
+ label: l.words.length > 48 ? `${l.words.slice(0, 47).trimEnd()}…` : l.words,
83
+ slot: 'to record',
84
+ type: 'voice',
85
+ path: l.uses[0]?.file ?? `trailer/${id}`,
86
+ severity: 'yellow',
87
+ })
88
+ return [...voices, ...ids.flatMap((id) =>
70
89
  cutsOf(join(root, 'trailer', id)).map((c): Instance => {
71
90
  const n = open.get(`${id}/${c.cut}`) ?? 0
72
91
  const rendered = existsSync(join(root, 'trailer', id, 'out', `${c.name}.mp4`))
@@ -80,7 +99,7 @@ export function trailersCollection(root: string): Collection | null {
80
99
  state: rendered ? 'idle' : 'quiet',
81
100
  }
82
101
  }),
83
- )
102
+ )]
84
103
  },
85
104
  }
86
105
  }
@@ -6,6 +6,8 @@
6
6
  // a string that only MENTIONS claude (a url, `~/.claude/projects`, a help
7
7
  // line naming the product) is no spawn, and comments are skipped.
8
8
 
9
+ import { codeLines } from './code-lines.ts'
10
+
9
11
  export type AgentSpawn = { line: number; what: string }
10
12
 
11
13
  const SHAPES: { re: RegExp; what: string }[] = [
@@ -23,24 +25,9 @@ const SHAPES: { re: RegExp; what: string }[] = [
23
25
 
24
26
  /** the first agent spawn in one source text, 1-based line, comments skipped */
25
27
  export function agentSpawnIn(src: string): AgentSpawn | null {
26
- const lines = src.split('\n')
27
- let inBlock = false
28
+ const lines = codeLines(src)
28
29
  for (let i = 0; i < lines.length; i++) {
29
- let l = lines[i]!
30
- if (inBlock) {
31
- const end = l.indexOf('*/')
32
- if (end < 0) continue
33
- l = l.slice(end + 2)
34
- inBlock = false
35
- }
36
- l = l.replace(/\/\*.*?\*\//g, '')
37
- const open = l.indexOf('/*')
38
- if (open >= 0) {
39
- inBlock = true
40
- l = l.slice(0, open)
41
- }
42
- l = l.replace(/(^|\s)\/\/.*$/, '$1')
43
- for (const s of SHAPES) if (s.re.test(l)) return { line: i + 1, what: s.what }
30
+ for (const s of SHAPES) if (s.re.test(lines[i]!)) return { line: i + 1, what: s.what }
44
31
  }
45
32
  return null
46
33
  }
@@ -0,0 +1,49 @@
1
+ // a source text's lines with its comments blanked, one entry per line so a
2
+ // hit keeps its 1-based line number. A static guard reads code, never the
3
+ // comment that names what it forbids. String bodies are kept (a guard reads
4
+ // them) and tracked, so a `/*` or `//` inside a glob or a url opens nothing.
5
+ // A regex literal is told from a division by the token before it (a
6
+ // punctuator or a keyword like `return`); a miss can open a false comment, so
7
+ // a guard that must never go blind also reads the raw line (core/hard-reset.ts).
8
+
9
+ /** what ends the code before a `/` that opens a regex literal rather than a division (empty: the line starts) */
10
+ const REGEX_BEFORE = /(?:^|[(,=:[!&|?{};+\-*%<>~^]|\b(?:return|typeof|case|in|of|yield|await|void|delete|throw|else|do|instanceof|new))$/
11
+
12
+ export function codeLines(src: string): string[] {
13
+ const out: string[] = []
14
+ let state: 'code' | 'block' | 'regex' | "'" | '"' | '`' = 'code'
15
+ let inClass = false
16
+ for (const line of src.split('\n')) {
17
+ if (state === "'" || state === '"' || state === 'regex') state = 'code'
18
+ let kept = ''
19
+ for (let i = 0; i < line.length; i++) {
20
+ const c = line[i]!
21
+ const next = line[i + 1]
22
+ if (state === 'block') {
23
+ if (c === '*' && next === '/') { state = 'code'; i++ }
24
+ continue
25
+ }
26
+ if (state === 'regex') {
27
+ kept += c
28
+ if (c === '\\') { kept += next ?? ''; i++ }
29
+ else if (c === '[') inClass = true
30
+ else if (c === ']') inClass = false
31
+ else if (c === '/' && !inClass) state = 'code'
32
+ continue
33
+ }
34
+ if (state !== 'code') {
35
+ kept += c
36
+ if (c === '\\') { kept += next ?? ''; i++ }
37
+ else if (c === state) state = 'code'
38
+ continue
39
+ }
40
+ if (c === '/' && next === '/') break
41
+ if (c === '/' && next === '*') { state = 'block'; i++; continue }
42
+ if (c === '/' && REGEX_BEFORE.test(kept.trimEnd())) { state = 'regex'; inClass = false; kept += c; continue }
43
+ if (c === "'" || c === '"' || c === '`') state = c
44
+ kept += c
45
+ }
46
+ out.push(kept)
47
+ }
48
+ return out
49
+ }
@@ -18,8 +18,8 @@
18
18
  // Skipped dirs: node_modules, dist, tmp, references (templates for other
19
19
  // repos), every dot-dir, and the repo's vendored dirs (core/vendored.ts).
20
20
  import { RETIRED_CHECK_IDS } from './retired-checks.ts'
21
- import { readdirSync, readFileSync, realpathSync, statSync } from 'fs'
22
- import { basename, join, relative } from 'path'
21
+ import { existsSync, readdirSync, readFileSync, realpathSync, statSync } from 'fs'
22
+ import { basename, dirname, join, relative } from 'path'
23
23
  import { check, type CheckDef, type CheckFrom } from '../check.ts'
24
24
 
25
25
  import { CHECK_SUFFIX as SUFFIX, fallbackNames, isLegacyCheckSource, SKIPPED_DIRS as IGNORED_DIRS, UNIT_SUFFIX, unitBase } from './check-file-names.ts'
@@ -237,8 +237,32 @@ export type DiscoverOpts = {
237
237
  builtinDir?: string
238
238
  }
239
239
 
240
+ /** the nearest folder above `from` (itself included) that holds `marker` */
241
+ function above(from: string, marker: string): string | null {
242
+ for (let d = from; ; d = dirname(d)) {
243
+ if (existsSync(join(d, marker))) return d
244
+ if (dirname(d) === d) return null
245
+ }
246
+ }
247
+
248
+ const pkgName = (dir: string): string | null => {
249
+ try { return (JSON.parse(readFileSync(join(dir, 'package.json'), 'utf8')) as { name?: string }).name ?? null } catch { return null }
250
+ }
251
+
252
+ /** the built-ins a root gates with: its own copy of the toolkit when it is a checkout of the toolkit's repo (a
253
+ * release gate's clean worktree of HEAD), at the same place and of the same package; else the running toolkit's */
254
+ export function builtinsOf(root: string, running: string): string {
255
+ const pkg = above(running, 'package.json')
256
+ const repo = pkg && above(pkg, '.git')
257
+ if (!pkg || !repo) return running
258
+ const copy = join(root, relative(repo, running))
259
+ const same = (a: string, b: string): boolean => { try { return realpathSync(a) === realpathSync(b) } catch { return false } }
260
+ if (same(copy, running) || !existsSync(copy) || pkgName(join(root, relative(repo, pkg))) !== pkgName(pkg)) return running
261
+ return copy
262
+ }
263
+
240
264
  export async function discoverChecks(root: string, o: DiscoverOpts = {}): Promise<DiscoveredCheck[]> {
241
- const builtinDir = o.builtinDir ?? BUILTIN_CHECK_DIR
265
+ const builtinDir = builtinsOf(root, o.builtinDir ?? BUILTIN_CHECK_DIR)
242
266
  const builtins: string[] = []
243
267
  walk(builtinDir, builtins)
244
268
  const found: string[] = []
@@ -0,0 +1,34 @@
1
+ // HARD RESET, found statically: code that runs or tells someone to run
2
+ // `git reset --hard`. In a tree several sessions share it wipes every one of
3
+ // their edits to tracked files, so the sweep tests (tests/no-hard-reset.test.ts,
4
+ // and the house repo's own) fail on any hit outside core/throwaway-worktree.ts,
5
+ // which wipes only a worktree it proved it made.
6
+ //
7
+ // the other resets (`--soft`, `--keep`, `--merge`, `reset -- <path>`) are
8
+ // not this guard's, and a comment may name the command to forbid it: a hit
9
+ // counts on the comment free line, or on the raw line unless it starts as a
10
+ // comment, so a mistracked comment never hides one.
11
+ import { codeLines } from './code-lines.ts'
12
+
13
+ export type HardReset = { line: number; what: string }
14
+
15
+ const SHAPES: { re: RegExp; what: string }[] = [
16
+ // a command line in a string or a shell script: `git reset --hard`, `reset -q --hard HEAD`, `reset origin/main --hard`
17
+ { re: /\breset(?:[ \t]+[^\s'"`;|&)]+)*?[ \t]+--hard\b/, what: 'a hard reset command line' },
18
+ // the flag alone as a literal: any argv that carries it, split over lines or held in a const
19
+ { re: /(['"`])--hard\1/, what: 'a --hard flag literal' },
20
+ ]
21
+
22
+ /** every hard reset in one source text, 1-based lines, comments skipped */
23
+ export function hardResetsIn(src: string): HardReset[] {
24
+ const lines = codeLines(src)
25
+ const raw = src.split('\n')
26
+ const hits: HardReset[] = []
27
+ for (let i = 0; i < lines.length; i++) {
28
+ const r = raw[i]!.trimStart()
29
+ const comment = r.startsWith('//') || r.startsWith('*') || r.startsWith('/*')
30
+ const s = SHAPES.find((x) => x.re.test(lines[i]!) || (!comment && x.re.test(raw[i]!)))
31
+ if (s != null) hits.push({ line: i + 1, what: s.what })
32
+ }
33
+ return hits
34
+ }
@@ -37,6 +37,9 @@ export const LAYOUT = {
37
37
  // the social folder (contract v3): one folder a draft, the week's rhythm. The SK004 block re-includes it in a
38
38
  // private repo only, like plans (wiki tools/shipkit/social.md)
39
39
  social: sk('social'),
40
+ // the owner's own voice: his takes of a trailer's lines, one a text (trailer/sound/takes.ts). The SK004 block
41
+ // re-includes it in a private repo only: a recording is his voice
42
+ voice: sk('voice'),
40
43
  // local: the facts (sha, size, type) of every draft media, so a file the disk let go keeps its key in the media
41
44
  // store (wiki tools/shipkit/social.md, Media)
42
45
  socialMedia: sk('social-media.json'),
@@ -53,6 +56,9 @@ export const LAYOUT = {
53
56
  tmp: sk('tmp'),
54
57
  // a CLI's call log, `<cli>-calls.jsonl`: local, never tracked
55
58
  logs: sk('logs'),
59
+ // local: what the lanes plan for each shot of a cut, `<trailer>/<cut>.json` (trailer/shot-plan.ts). It speaks of
60
+ // this machine's takes, which live in the cache, and lanes rewrite it many times an hour
61
+ trailerPlan: sk('trailer-plan'),
56
62
  // holds no app: a process app lives in ~/Applications, and the apps job removes any shipkit bundle here (home/process-apps.ts)
57
63
  wrapper: sk('wrapper'),
58
64
  // generated on every run
@@ -10,6 +10,7 @@ import { readFileSync } from 'fs'
10
10
  import { join, relative } from 'path'
11
11
  import { loadConfig, type RvtConfig } from '../ts/config.ts'
12
12
  import { importClosure } from '../ts/source-graph.ts'
13
+ import { codeLines } from './code-lines.ts'
13
14
 
14
15
  /** where a module reaches the disk or a process around the check context */
15
16
  export type RawAccess = { file: string; line: number; what: string }
@@ -44,20 +45,9 @@ const HITS_MEMO_MAX = 4000
44
45
 
45
46
  function scanSource(src: string, o: ClosureKind): { line: number; what: string } | null {
46
47
  const SHAPES = [o.dynamic === false ? STATIC_IMPORTS : IMPORTS, CALLS]
47
- const lines = src.split('\n')
48
- let inBlock = false
48
+ const lines = codeLines(src)
49
49
  for (let i = 0; i < lines.length; i++) {
50
- let l = lines[i]!
51
- if (inBlock) {
52
- const end = l.indexOf('*/')
53
- if (end < 0) continue
54
- l = l.slice(end + 2)
55
- inBlock = false
56
- }
57
- l = l.replace(/\/\*.*?\*\//g, '')
58
- const open = l.indexOf('/*')
59
- if (open >= 0) { inBlock = true; l = l.slice(0, open) }
60
- l = l.replace(/(^|\s)\/\/.*$/, '$1')
50
+ const l = lines[i]!
61
51
  if (/^\s*import\s+type\b/.test(l)) continue
62
52
  for (const s of SHAPES) {
63
53
  const m = l.match(s.re)