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.
- package/CHANGELOG.md +16 -0
- package/package.json +1 -1
- package/src/checks/SK004-gitignore-policy.check.ts +6 -3
- package/src/cli/cmd_GlobalProcesses.ts +2 -107
- package/src/cli/cmd_Home.ts +1 -1
- package/src/cli/cmd_Overview.ts +2 -1
- package/src/cli/cmd_Releases.ts +39 -3
- package/src/cli/cmd_Review.ts +22 -13
- package/src/cli/cmd_Social.ts +13 -7
- package/src/cli/cmd_Sound.ts +17 -4
- package/src/cli/cmd_Trailer.ts +67 -1
- package/src/cli/registry.ts +2 -1
- package/src/collections/collection-types.ts +1 -1
- package/src/collections/review.ts +23 -4
- package/src/core/layout.ts +6 -0
- package/src/home/gui-app/ShipkitGui.swift +35 -0
- package/src/home/gui-app.ts +1 -0
- package/src/home/pm-switch.ts +112 -0
- package/src/identities/identities.ts +11 -6
- package/src/messages/brief.ts +3 -3
- package/src/messages/score.ts +2 -0
- package/src/releases/add.ts +33 -5
- package/src/releases/before.ts +31 -0
- package/src/releases/from-card.ts +104 -19
- package/src/releases/model.ts +73 -13
- package/src/releases/pictures.ts +29 -8
- package/src/review/http.ts +1 -1
- package/src/review/model.ts +12 -2
- package/src/review/stage-card.ts +1 -1
- package/src/review/store.ts +12 -2
- package/src/review/trailer-desk.ts +19 -0
- package/src/review/trailer-model.ts +65 -0
- package/src/review/trailer-routes.ts +98 -1
- package/src/review/trailer-voices.ts +144 -0
- package/src/review/watchers.ts +58 -1
- package/src/serve/hub-app/benign-errors.ts +22 -0
- package/src/serve/hub-app/hash-route.ts +27 -15
- package/src/serve/hub-app/home-st.ts +8 -0
- package/src/serve/hub-app/hub-app.tsx +2 -0
- package/src/serve/hub-app/project-list.css +7 -2
- package/src/serve/hub-app/project-list.tsx +9 -0
- package/src/serve/hub-app/projects-svc.ts +16 -6
- package/src/serve/hub-app/releases/releases-page.tsx +121 -28
- package/src/serve/hub-app/releases/releases-st.ts +46 -4
- package/src/serve/hub-app/releases.css +30 -3
- package/src/serve/hub-app/repo-sections.ts +1 -1
- package/src/serve/hub-app/repo-st.ts +15 -10
- package/src/serve/hub-app/review/clip-st.ts +3 -1
- package/src/serve/hub-app/review/kit.tsx +3 -3
- package/src/serve/hub-app/review/trailer-page.tsx +31 -6
- package/src/serve/hub-app/review/trailer-st.ts +168 -8
- package/src/serve/hub-app/review/trailer-timeline.tsx +36 -4
- package/src/serve/hub-app/review/trailer-voices-st.ts +370 -0
- package/src/serve/hub-app/review/trailer-voices.tsx +574 -0
- package/src/serve/hub-app/review.css +88 -0
- package/src/serve/hub-app/social/comms-page.tsx +10 -5
- package/src/serve/hub-app/social/next-release.tsx +118 -0
- package/src/serve/hub-app/social/social-model.ts +2 -0
- package/src/serve/hub-app/social/social-st.ts +38 -1
- package/src/serve/hub-app/social.css +8 -0
- package/src/serve/hub-app/tree-build.ts +2 -0
- package/src/serve/project-gutter-route.ts +8 -0
- package/src/serve/project-gutter.ts +4 -2
- package/src/shot/box.ts +33 -12
- package/src/shot/client.ts +1 -1
- package/src/shot/shooter.ts +19 -9
- package/src/social/desk-index.ts +49 -8
- package/src/social/discord-layout.ts +6 -2
- package/src/social/drafts.ts +1 -1
- package/src/social/kinds.ts +3 -2
- package/src/social/load.ts +26 -7
- package/src/social/publish/index.ts +24 -9
- package/src/social/release-stage.ts +133 -29
- package/src/social/routes.ts +2 -1
- package/src/social/stage.ts +39 -20
- package/src/trailer/bed.ts +111 -0
- package/src/trailer/build.ts +57 -38
- package/src/trailer/ffmpeg.ts +6 -0
- package/src/trailer/grammar.ts +23 -2
- package/src/trailer/graph.ts +12 -1
- package/src/trailer/shot-plan.ts +75 -0
- package/src/trailer/shot-state.ts +191 -0
- package/src/trailer/sound/audio.ts +28 -0
- package/src/trailer/sound/brand.ts +53 -3
- package/src/trailer/sound/gen.ts +61 -2
- package/src/trailer/sound/index.ts +25 -11
- package/src/trailer/sound/presets.ts +86 -5
- package/src/trailer/sound/run.ts +1 -1
- package/src/trailer/sound/takes.ts +94 -0
- package/src/trailer/titles.ts +36 -0
- package/src/trailer/url.ts +1 -1
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// the owner's own takes of a trailer's lines (wiki tools/trailer/trailer-sound.md, Your own voice): one take a text,
|
|
2
|
+
// `.shipkit/voice/takes/<voice>/<key>.<ext>` with `<key>.txt`, the words he read, beside it. A line's key is its
|
|
3
|
+
// words alone (audio tags dropped, spaces folded, case folded), so the same words in two shots or two cuts ask for one
|
|
4
|
+
// take, and a cut edited around a line never asks for it again
|
|
5
|
+
import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from 'node:fs'
|
|
6
|
+
import { join } from 'node:path'
|
|
7
|
+
import { LAYOUT } from '../../core/layout.ts'
|
|
8
|
+
|
|
9
|
+
/** the audio a browser records or a file brings: the first found is the take */
|
|
10
|
+
export const TAKE_EXTS = ['webm', 'ogg', 'm4a', 'mp4', 'wav', 'mp3', 'flac'] as const
|
|
11
|
+
export type TakeExt = (typeof TAKE_EXTS)[number]
|
|
12
|
+
|
|
13
|
+
export const takesDir = (root: string, voice: string): string => join(root, LAYOUT.voice, 'takes', voice)
|
|
14
|
+
|
|
15
|
+
/** the words a take is of: tags (`[excited]`) are a direction, never words */
|
|
16
|
+
export const takeWords = (text: string): string => text.replace(/\[[^\]]*\]/g, ' ').replace(/\s+/g, ' ').trim()
|
|
17
|
+
|
|
18
|
+
export const takeKey = (text: string): string => new Bun.CryptoHasher('sha1').update(takeWords(text).toLowerCase()).digest('hex').slice(0, 12)
|
|
19
|
+
|
|
20
|
+
export const TAKE_KEY_RE = /^[0-9a-f]{12}$/
|
|
21
|
+
export const VOICE_NAME_RE = /^[a-z0-9][a-z0-9-]*$/
|
|
22
|
+
|
|
23
|
+
/** how he edited a take on the page, kept beside it as `<key>.json`; a new recording starts with none:
|
|
24
|
+
* `offset`: where the recording's own 0 sits on the line's time, in seconds (the line starts at 0, so a negative
|
|
25
|
+
* offset cuts the recording's head, a positive one plays silence first); null: at its first sound, as it was trimmed
|
|
26
|
+
* `mask`: ranges of the recording's own seconds played silent (a tongue click, a breath) */
|
|
27
|
+
export type TakeEdit = { offset: number | null; mask: [number, number][] }
|
|
28
|
+
export const OFFSET_LIMIT = 5
|
|
29
|
+
|
|
30
|
+
/** the take of these words, repo relative, with its mtime and its edit; null when he has not recorded it */
|
|
31
|
+
export function takeOf(root: string, voice: string, text: string): ({ path: string; mtime: number } & TakeEdit) | null {
|
|
32
|
+
const dir = takesDir(root, voice)
|
|
33
|
+
if (!existsSync(dir)) return null
|
|
34
|
+
const key = takeKey(text)
|
|
35
|
+
for (const ext of TAKE_EXTS) {
|
|
36
|
+
const f = join(dir, `${key}.${ext}`)
|
|
37
|
+
if (existsSync(f)) return { path: join(LAYOUT.voice, 'takes', voice, `${key}.${ext}`), mtime: statSync(f).mtimeMs, ...editOf(join(dir, `${key}.json`)) }
|
|
38
|
+
}
|
|
39
|
+
return null
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function editOf(file: string): TakeEdit {
|
|
43
|
+
if (!existsSync(file)) return { offset: null, mask: [] }
|
|
44
|
+
return cleanEdit(JSON.parse(readFileSync(file, 'utf8')))
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** an edit as it is kept: the offset within OFFSET_LIMIT, the mask's ranges ordered, merged and at least 5 ms long,
|
|
48
|
+
* every number to the millisecond */
|
|
49
|
+
export function cleanEdit(v: unknown): TakeEdit {
|
|
50
|
+
const o = v as { offset?: unknown; mask?: unknown } | null
|
|
51
|
+
const ms = (n: number): number => Math.round(n * 1000) / 1000
|
|
52
|
+
const offset = typeof o?.offset === 'number' && Number.isFinite(o.offset) ? ms(Math.max(-OFFSET_LIMIT, Math.min(OFFSET_LIMIT, o.offset))) : null
|
|
53
|
+
const ranges = (Array.isArray(o?.mask) ? o.mask : [])
|
|
54
|
+
.flatMap((r: unknown) => (Array.isArray(r) && typeof r[0] === 'number' && typeof r[1] === 'number' && Number.isFinite(r[0]) && Number.isFinite(r[1]) ? [[ms(Math.max(0, Math.min(r[0], r[1]))), ms(Math.max(r[0], r[1]))] as [number, number]] : []))
|
|
55
|
+
.sort((a, b) => a[0] - b[0])
|
|
56
|
+
const mask: [number, number][] = []
|
|
57
|
+
for (const r of ranges) {
|
|
58
|
+
const last = mask.at(-1)
|
|
59
|
+
if (last && r[0] <= last[1]) last[1] = Math.max(last[1], r[1])
|
|
60
|
+
else mask.push([r[0], r[1]])
|
|
61
|
+
}
|
|
62
|
+
return { offset, mask: mask.filter(([a, b]) => b - a >= 0.005) }
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** the take's edit set; none left removes the file */
|
|
66
|
+
export function setTakeEdit(root: string, voice: string, text: string, edit: unknown): TakeEdit {
|
|
67
|
+
if (!takeOf(root, voice, text)) throw new Error('no take of these words to edit')
|
|
68
|
+
const e = cleanEdit(edit)
|
|
69
|
+
const file = join(takesDir(root, voice), `${takeKey(text)}.json`)
|
|
70
|
+
if (e.offset === null && e.mask.length === 0) rmSync(file, { force: true })
|
|
71
|
+
else writeFileSync(file, `${JSON.stringify(e)}\n`)
|
|
72
|
+
return e
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** his take of these words kept, the one before it replaced */
|
|
76
|
+
export function writeTake(root: string, voice: string, text: string, bytes: Uint8Array, ext: TakeExt): string {
|
|
77
|
+
if (bytes.byteLength < 1000) throw new Error(`a take of ${bytes.byteLength} bytes is no recording`)
|
|
78
|
+
dropTake(root, voice, text)
|
|
79
|
+
const dir = takesDir(root, voice)
|
|
80
|
+
mkdirSync(dir, { recursive: true })
|
|
81
|
+
const key = takeKey(text)
|
|
82
|
+
writeFileSync(join(dir, `${key}.${ext}`), bytes)
|
|
83
|
+
writeFileSync(join(dir, `${key}.txt`), `${takeWords(text)}\n`)
|
|
84
|
+
return join(dir, `${key}.${ext}`)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function dropTake(root: string, voice: string, text: string): boolean {
|
|
88
|
+
const dir = takesDir(root, voice)
|
|
89
|
+
if (!existsSync(dir)) return false
|
|
90
|
+
const key = takeKey(text)
|
|
91
|
+
const gone = readdirSync(dir).filter((f) => f.startsWith(`${key}.`))
|
|
92
|
+
for (const f of gone) rmSync(join(dir, f), { force: true })
|
|
93
|
+
return gone.some((f) => !f.endsWith('.txt') && !f.endsWith('.json'))
|
|
94
|
+
}
|
package/src/trailer/titles.ts
CHANGED
|
@@ -655,6 +655,42 @@ export async function titlePng(dir: string, r: TitleRequest): Promise<TitleImage
|
|
|
655
655
|
return { file, ...(JSON.parse(readFileSync(where, 'utf8')) as Omit<TitleImage, 'file'>) }
|
|
656
656
|
}
|
|
657
657
|
|
|
658
|
+
/** the band's height, a share of the frame's: thin, its words still read on a phone */
|
|
659
|
+
const BAND_SHARE = 0.044
|
|
660
|
+
export const bandHeight = (H: number): number => 2 * Math.round((H * BAND_SHARE) / 2)
|
|
661
|
+
|
|
662
|
+
/** the band across the top of the frame (`band "<text>"`): the look's edge, its words centred in the look's face and
|
|
663
|
+
* light, an accent hairline under it; opaque, in its own strip or `over` the picture alike, so a page filmed with a
|
|
664
|
+
* band of its own in that place reads as the same band */
|
|
665
|
+
export function drawBand(text: string, [W, H]: readonly [number, number], look: TrailerLook): Buffer {
|
|
666
|
+
const B = bandHeight(H)
|
|
667
|
+
const c = createCanvas(W, B)
|
|
668
|
+
const g = c.getContext('2d')
|
|
669
|
+
g.fillStyle = look.edge
|
|
670
|
+
g.fillRect(0, 0, W, B)
|
|
671
|
+
const line = Math.max(1, Math.round(H / 720))
|
|
672
|
+
g.fillStyle = look.accent
|
|
673
|
+
g.fillRect(0, B - line, W, line)
|
|
674
|
+
face(g, look, B * 0.56)
|
|
675
|
+
;(g as unknown as { letterSpacing: string }).letterSpacing = `${Math.round(B * 0.06)}px`
|
|
676
|
+
g.textAlign = 'center'
|
|
677
|
+
g.textBaseline = 'middle'
|
|
678
|
+
g.fillStyle = look.light
|
|
679
|
+
g.fillText(text, W / 2, (B - line) / 2 + B * 0.03)
|
|
680
|
+
return Buffer.from(c.toBuffer('image/png'))
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
/** the PNG of the band for a frame, a look and its words, drawn once */
|
|
684
|
+
export function bandPng(dir: string, text: string, size: readonly [number, number], look: TrailerLook, root: string): string {
|
|
685
|
+
const file = join(dir, `band-${key(['band', text, size, look.edge, look.accent, look.light, look.font, lookFiles(look, root)])}.png`)
|
|
686
|
+
if (!existsSync(file)) {
|
|
687
|
+
registerFace(look, root)
|
|
688
|
+
mkdirSync(dir, { recursive: true })
|
|
689
|
+
writeFileSync(file, drawBand(text, size, look))
|
|
690
|
+
}
|
|
691
|
+
return file
|
|
692
|
+
}
|
|
693
|
+
|
|
658
694
|
/** the card's ground's PNG file for a frame and a look */
|
|
659
695
|
export const cardFile = (dir: string, size: readonly [number, number], look: TrailerLook): string => join(dir, `card-${key(['card', size, look.ground])}.png`)
|
|
660
696
|
|
package/src/trailer/url.ts
CHANGED
|
@@ -76,7 +76,7 @@ async function resolveBase(root: string, base: string | null, say: (l: string) =
|
|
|
76
76
|
const { pmUp, pmUrl } = await import('../home/home-paths.ts')
|
|
77
77
|
if (process.env['CI'] == null && process.env['SHIPKIT_NO_HOME'] == null && (await pmUp())) {
|
|
78
78
|
say(` starting ${pick.id}: ${pick.url} does not answer (sk gp start ${pick.id})`)
|
|
79
|
-
const { pmSwitchDeps, switchProcess } = await import('../
|
|
79
|
+
const { pmSwitchDeps, switchProcess } = await import('../home/pm-switch.ts')
|
|
80
80
|
if ((await switchProcess(pick.id, 'start', pmSwitchDeps(say, pmUrl()), 120_000)) !== 0) throw new Error(`${pick.id} did not start through pm: sk gp shows where it stands`)
|
|
81
81
|
return pick.url
|
|
82
82
|
}
|