rvlib-shipkit 2.21.0 → 2.22.1
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 +23 -0
- package/package.json +1 -1
- package/src/asks/asks-queue.ts +8 -7
- package/src/assets/kits/identity-kit.ts +158 -2
- package/src/cli/cmd_Bump.ts +3 -3
- package/src/cli/cmd_Rec.ts +349 -0
- package/src/cli/cmd_Releases.ts +4 -1
- package/src/cli/cmd_Secret.ts +10 -3
- package/src/cli/cmd_Sign.ts +24 -0
- package/src/cli/cmd_Social.ts +44 -1
- package/src/cli/family-pages.ts +1 -0
- package/src/cli/registry.ts +4 -0
- package/src/core/agent-spawn.ts +4 -17
- package/src/core/code-lines.ts +49 -0
- package/src/core/discover-checks.ts +27 -3
- package/src/core/hard-reset.ts +34 -0
- package/src/core/raw-access.ts +3 -13
- package/src/core/throwaway-worktree.ts +72 -0
- package/src/home/app-sign.ts +98 -0
- package/src/home/gui-app.ts +31 -12
- package/src/home/home-routes.ts +6 -0
- package/src/home/serve-web.ts +1 -1
- package/src/identities/identities.ts +6 -0
- package/src/media-kinds.ts +5 -3
- package/src/media-store/forget.ts +54 -0
- package/src/media-store/put.ts +4 -3
- package/src/media-store/space.ts +63 -24
- package/src/recordings/delete.ts +19 -0
- package/src/recordings/edit.ts +231 -0
- package/src/recordings/load.ts +37 -0
- package/src/recordings/marks-draw.ts +111 -0
- package/src/recordings/marks-png.ts +25 -0
- package/src/recordings/marks.ts +138 -0
- package/src/recordings/media-kind.ts +67 -0
- package/src/recordings/model.ts +170 -0
- package/src/recordings/open.ts +33 -0
- package/src/recordings/place.ts +89 -0
- package/src/recordings/presets.ts +99 -0
- package/src/recordings/recorder-app/Capture.swift +510 -0
- package/src/recordings/recorder-app/Clip.swift +162 -0
- package/src/recordings/recorder-app/Editor.swift +39 -0
- package/src/recordings/recorder-app/Tray.swift +298 -0
- package/src/recordings/recorder-app/main.swift +862 -0
- package/src/recordings/recorder-app.ts +46 -0
- package/src/recordings/recorder.shipkit.ts +11 -0
- package/src/recordings/routes.ts +140 -0
- package/src/recordings/run-recorder.ts +40 -0
- package/src/recordings/share.ts +107 -0
- package/src/recordings/take.ts +146 -0
- package/src/recordings/view.ts +40 -0
- package/src/release/gate-checkout.ts +74 -0
- package/src/release/release-scope.ts +35 -26
- package/src/release/run-bump.ts +79 -37
- package/src/release/run-release.ts +67 -53
- package/src/releases/add.ts +7 -2
- package/src/releases/from-card.ts +3 -3
- package/src/releases/model.ts +29 -7
- package/src/repo-config.ts +7 -3
- package/src/review/trailer-desk.ts +1 -0
- package/src/review/trailer-model.ts +2 -0
- package/src/secrets/manager.ts +18 -1
- package/src/serve/hub-app/home-st.ts +15 -5
- package/src/serve/hub-app/home.html +1 -0
- package/src/serve/hub-app/hub-app.tsx +6 -1
- package/src/serve/hub-app/icons.tsx +2 -0
- package/src/serve/hub-app/palette-st.ts +1 -0
- package/src/serve/hub-app/project-list.tsx +1 -0
- package/src/serve/hub-app/projects-svc.ts +1 -1
- package/src/serve/hub-app/recordings-st.ts +641 -0
- package/src/serve/hub-app/recordings-view.tsx +504 -0
- package/src/serve/hub-app/recordings.css +82 -0
- package/src/serve/hub-app/repo-st.ts +1 -1
- package/src/serve/hub-app/review/trailer-page.tsx +1 -0
- package/src/serve/hub-app/review/trailer-st.ts +16 -0
- package/src/serve/hub-app/review/trailer-timeline.tsx +3 -0
- package/src/serve/hub-app/review.css +2 -0
- package/src/serve/hub-app/social/post-card.tsx +31 -3
- package/src/serve/hub-app/social/social-model.ts +4 -0
- package/src/serve/hub-app/social/social-st.ts +12 -0
- package/src/serve/hub-app/social.css +4 -0
- package/src/shipkit.ts +2 -2
- package/src/shot/box.ts +23 -17
- package/src/shot/browser-slot.ts +13 -3
- package/src/shot/film-box.ts +193 -117
- package/src/shot/shooter.ts +5 -3
- package/src/smoke/run-smoke.ts +8 -6
- package/src/social/compose.ts +14 -0
- package/src/social/drafts.ts +1 -1
- package/src/social/load.ts +16 -2
- package/src/social/publish/index.ts +3 -1
- package/src/social/publish/secret.ts +12 -4
- package/src/social/release-card.ts +69 -0
- package/src/social/release-stage.ts +49 -10
- package/src/social/routes.ts +5 -0
- package/src/social/stage.ts +9 -5
- package/src/trailer/build.ts +24 -0
- package/src/trailer/ffmpeg.ts +8 -0
- package/src/trailer/grammar.ts +9 -2
- package/src/trailer/look.ts +7 -0
- package/src/veille/chrome.ts +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
## 2.22.1
|
|
2
|
+
|
|
3
|
+
- **A screenshot is on the clipboard the instant it is shot.** The recorder writes the clipboard before any encode, its file, PNG and WebP made behind it; a paste that comes first waits for them, so a quick ⌘V never pastes the clipboard from before, whatever the format.
|
|
4
|
+
|
|
5
|
+
## 2.22.0
|
|
6
|
+
|
|
7
|
+
- **A screen recorder replaces Snagit.** A menu bar app, built and run by shipkit, shoots videos and screenshots on global hotkeys. Each preset in `recorder.presets` (`repo.config.ts`) names its keys (one or several), what it shoots, the mic, the system sound, clicks, a countdown and what runs after: upload, a private or public link, the file, markdown, the editor, the Finder. `sk rec presets` lists them and every problem.
|
|
8
|
+
- **Snagit's crosshair.** A click takes a window, a drag takes an area. A video's choice stays on screen to adjust: its handles resize the window itself through Accessibility, and a bar records, switches the mic and the sound, or cancels. While a take records, a red REC pill with the time and Stop is always on screen.
|
|
9
|
+
- **A frozen screenshot.** `shoot: 'freeze'` shoots the screen under the pointer the instant the hotkey is pressed, then runs the crosshair over that frozen image, so a moment that passes while choosing is still the one taken.
|
|
10
|
+
- **A screenshot is on the clipboard at once**, before it is filed: one item that is the file and its image, as PNG, WebP lossless or WebP HQ (cwebp), picked in the menu or the tray.
|
|
11
|
+
- **The Recent captures tray.** The newest captures as thumbs, each with Finder, copy as PNG, copy as WebP and copy link; a spinner while one goes up; the default clipboard format beside « All… ».
|
|
12
|
+
- **Recordings, filed and kept.** A take lands in `<recorder.dir>/<repo>/<id>/` (an external drive while it is mounted), starts unassigned, moves between repos, and goes up to the private Space through the media store. `sk rec` lists, imports, links, copies, renames, moves, edits and deletes them; a delete removes every key the Space ever held.
|
|
13
|
+
- **A Snagit-like editor** on the home's Recordings page and in a window of its own after a screenshot: arrow, rectangle, text, numbered step and blur marks (each with an optional time span, a place outside the take growing the canvas), trim handles, speed, crop and mute, undo and redo, Snagit's ⌃ keys and instant tooltips. The edit is text (`edit.txt`, `sk rec edit`).
|
|
14
|
+
- **A trailer films a recording**: `film recording <name>`, and its shot can be shot again from the page.
|
|
15
|
+
- **Apps signed by the machine's own identity.** `sk sign-setup` makes a local code signing certificate, so macOS keeps an app's permissions (Screen Recording, Accessibility) across rebuilds.
|
|
16
|
+
- **Comms: a media tile copies its local path**, the file brought back from the Space first when the disk let it go.
|
|
17
|
+
- **SubscribeStar.** Tags are chips copied one by one with no #, capped by an account's `max tags`; every post names its tier, or the card suggests the open one; a list always starts after a blank line.
|
|
18
|
+
- **Release posts get a release card first in their media**: the app's icon, name, version and headline, beside a feature.
|
|
19
|
+
- **Releases weigh every change**: major, feature or improvement.
|
|
20
|
+
- **`sk secret get` refuses a name scoped to another repo.**
|
|
21
|
+
- **`sk bump` and `sk release` gate HEAD in a clean checkout**, so another session's unsaved work neither refuses nor reddens a release. A rollback drops no commit and never runs `git reset --hard` on a shared tree; a bump from a branch refuses while tracked files are modified.
|
|
22
|
+
- **`sk shot`**: a boxed repo's films each get a warm browser of their own on the box.
|
|
23
|
+
|
|
1
24
|
## 2.21.0
|
|
2
25
|
|
|
3
26
|
- **Record your own voice for a trailer's lines.** A brand voice can be `{ record: '<name>', standin: '<voice>' }`: a line by that voice plays the recorded take, and until one exists the standin reads it, so the cut sounds the same and nothing rebuilds. `takes: false` plays the standin again; both versions are kept.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rvlib-shipkit",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.22.1",
|
|
4
4
|
"funding": "https://github.com/sponsors/rvion",
|
|
5
5
|
"description": "All-in-one repo companion: ci gate (task DAG), auto-discovered health checks, release-contract fulfillness, asks queue, md-wiki tools, asset atelier, live tui",
|
|
6
6
|
"license": "MIT",
|
package/src/asks/asks-queue.ts
CHANGED
|
@@ -64,20 +64,20 @@ export function doneAsks(dir: string): Ask[] {
|
|
|
64
64
|
* is an uncaught ENOENT rather than a message. The loser waits and finds
|
|
65
65
|
* nothing left to close, which is the correct answer. */
|
|
66
66
|
export async function checkAsks(root: string, dir: string, print: (line: string) => void = console.log): Promise<{ closed: number }> {
|
|
67
|
-
const leased = await withMutateLease(mutateLease(root, 'asks'), { label: 'asks archive', print, maxWaitMs: 45_000 }, () => checkAsksBody(dir, print))
|
|
67
|
+
const leased = await withMutateLease(mutateLease(root, 'asks'), { label: 'asks archive', print, maxWaitMs: 45_000 }, () => checkAsksBody(root, dir, print))
|
|
68
68
|
if (leased.ok) return leased.value
|
|
69
69
|
print(`WARN asks check skipped — ${leased.warn}`)
|
|
70
70
|
return { closed: 0 }
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
function checkAsksBody(dir: string, print: (line: string) => void): { closed: number } {
|
|
73
|
+
function checkAsksBody(root: string, dir: string, print: (line: string) => void): { closed: number } {
|
|
74
74
|
const done = join(dir, 'done')
|
|
75
75
|
mkdirSync(done, { recursive: true })
|
|
76
76
|
let closed = 0
|
|
77
77
|
for (const a of listAsks(dir)) {
|
|
78
78
|
if (a.status === 'done') { renameSync(join(dir, a.file), join(done, a.file)); print(`archived ${a.file} → done/`); continue }
|
|
79
79
|
if (a.check == null) { print(`still ${a.status.padEnd(8)} ${a.file} (manual — no probe)`); continue }
|
|
80
|
-
if (probeAsk(dir, a, a.check).passed) {
|
|
80
|
+
if (probeAsk(root, dir, a, a.check).passed) {
|
|
81
81
|
print(`closed + archived ${a.file}`)
|
|
82
82
|
closed++
|
|
83
83
|
} else {
|
|
@@ -88,11 +88,12 @@ function checkAsksBody(dir: string, print: (line: string) => void): { closed: nu
|
|
|
88
88
|
return { closed }
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
/** one ask's probe
|
|
91
|
+
/** one ask's probe, run at the repo's root (a secret read is gated by the repo
|
|
92
|
+
* it runs in): when it exits 0 the ask is stamped done and archived; else
|
|
92
93
|
* the probe's last stderr line says why */
|
|
93
|
-
function probeAsk(dir: string, a: Ask, check: string): { passed: true } | { passed: false; why: string } {
|
|
94
|
+
function probeAsk(root: string, dir: string, a: Ask, check: string): { passed: true } | { passed: false; why: string } {
|
|
94
95
|
// env named: bun's default is the env the process started with, blind to a later process.env write
|
|
95
|
-
const p = Bun.spawnSync(['bash', '-lc', check], { env: process.env, stdout: 'ignore', stderr: 'pipe' })
|
|
96
|
+
const p = Bun.spawnSync(['bash', '-lc', check], { cwd: root, env: process.env, stdout: 'ignore', stderr: 'pipe' })
|
|
96
97
|
if (p.exitCode !== 0) {
|
|
97
98
|
const tail = p.stderr.toString().trim().split('\n').at(-1) ?? ''
|
|
98
99
|
return { passed: false, why: `exit ${p.exitCode}${tail !== '' ? `: ${tail}` : ''}` }
|
|
@@ -113,7 +114,7 @@ export async function checkAsk(root: string, dir: string, file: string): Promise
|
|
|
113
114
|
const a = openAsks(dir).find((x) => x.file === file)
|
|
114
115
|
if (a == null) return { check: 'failed', why: `${file} is no longer an open ask` }
|
|
115
116
|
if (a.check == null) return { check: 'none' }
|
|
116
|
-
const r = probeAsk(dir, a, a.check)
|
|
117
|
+
const r = probeAsk(root, dir, a, a.check)
|
|
117
118
|
return r.passed ? { check: 'passed' } : { check: 'failed', why: r.why }
|
|
118
119
|
})
|
|
119
120
|
return leased.ok ? leased.value : { check: 'failed', why: `the check did not run: ${leased.warn}` }
|
|
@@ -10,13 +10,16 @@
|
|
|
10
10
|
// loud FAIL, never a placeholder.
|
|
11
11
|
// Outputs are COMMITTED at the web root (public/ unless the deploy says
|
|
12
12
|
// otherwise): favicon.png (512² master), og.png (1200×630), logo.png. Brand
|
|
13
|
-
// data is per-repo and never defaults across repos.
|
|
13
|
+
// data is per-repo and never defaults across repos. The release card
|
|
14
|
+
// (renderReleaseCard) is the same brand drawn for a release post, rendered
|
|
15
|
+
// on demand, never committed here.
|
|
14
16
|
import { createCanvas, loadImage, type Image, type SKRSContext2D } from '@napi-rs/canvas'
|
|
15
17
|
import { mkdirSync } from 'fs'
|
|
16
18
|
import { dirname, join } from 'path'
|
|
17
19
|
import sharp from 'sharp'
|
|
18
20
|
import { defineKind, type CanvasGen, type ComfyGen, type Kind } from '../kit-config.ts'
|
|
19
|
-
import {
|
|
21
|
+
import { hasFamily, registerFont } from '../../trailer/fonts.ts'
|
|
22
|
+
import { alpha, HOUSE_FAMILIES, mixed, type TrailerLookInput } from '../../trailer/look.ts'
|
|
20
23
|
import type { TrailerSoundInput } from '../../trailer/sound/brand.ts'
|
|
21
24
|
|
|
22
25
|
export type Brand = {
|
|
@@ -151,3 +154,156 @@ export async function renderIdentity(brand: Brand, root: string, opts?: { markFi
|
|
|
151
154
|
if (opts?.markFile == null) throw new Error(`brand '${brand.name}' uses a comfy mark and no roll is picked — ${NO_PICK_FIX}`)
|
|
152
155
|
return renderIdentityFromMark(brand, root, await sharp(opts.markFile).png().toBuffer(), opts.webRoot)
|
|
153
156
|
}
|
|
157
|
+
|
|
158
|
+
export const RELEASE_W = 1200
|
|
159
|
+
export const RELEASE_H = 675
|
|
160
|
+
|
|
161
|
+
export type ReleaseCard = {
|
|
162
|
+
version: string
|
|
163
|
+
/** the release in one line: wrapped on two lines at most */
|
|
164
|
+
headline: string
|
|
165
|
+
/** a SAFE still beside the brand (layout B); absent, the poster (layout A) */
|
|
166
|
+
feature?: Buffer | null
|
|
167
|
+
/** where the feature's subject sits across it, 0 left to 1 right: a page shot's sits left of centre */
|
|
168
|
+
focus?: number
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/** the brand's mark as an image: `markFile` when given (the rendered logo.png, or a comfy mark's pick), else a canvas
|
|
172
|
+
* mark draws itself. The file comes first because a brand.ts loads its own @napi-rs/canvas from its repo, and an
|
|
173
|
+
* image of one copy does not draw on a canvas of the other */
|
|
174
|
+
async function markImage(brand: Brand, markFile: string | undefined): Promise<Image> {
|
|
175
|
+
if (markFile != null) return loadImage(await sharp(markFile).png().toBuffer())
|
|
176
|
+
if (brand.mark.backend === 'canvas') {
|
|
177
|
+
const c = createCanvas(LOGO_SIZE, LOGO_SIZE)
|
|
178
|
+
await brand.mark.draw(c.getContext('2d'), { id: 'identity-logo', prompt: '' })
|
|
179
|
+
return loadImage(c.toBuffer('image/png'))
|
|
180
|
+
}
|
|
181
|
+
throw new Error(`brand '${brand.name}' uses a comfy mark and no roll is picked — ${NO_PICK_FIX}`)
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/** a mark whose corner is opaque is a full bleed tile: it reads as an app icon only inside its squircle */
|
|
185
|
+
function isTile(mark: Image): boolean {
|
|
186
|
+
const c = createCanvas(16, 16)
|
|
187
|
+
const ctx = c.getContext('2d')
|
|
188
|
+
ctx.drawImage(mark, 0, 0, 16, 16)
|
|
189
|
+
return ctx.getImageData(0, 0, 1, 1).data[3]! > 200
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function drawMark(ctx: SKRSContext2D, mark: Image, x: number, y: number, s: number): void {
|
|
193
|
+
if (!isTile(mark)) return void ctx.drawImage(mark, x, y, s, s)
|
|
194
|
+
ctx.save()
|
|
195
|
+
ctx.beginPath()
|
|
196
|
+
const i = s * 0.035
|
|
197
|
+
ctx.roundRect(x + i, y + i, s - 2 * i, s - 2 * i, s * 0.2)
|
|
198
|
+
ctx.clip()
|
|
199
|
+
ctx.drawImage(mark, x, y, s, s)
|
|
200
|
+
ctx.restore()
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/** the display face as a canvas font at a size: the trailer's face (its file, else a family the machine has), else
|
|
204
|
+
* the og card's fonts in bold */
|
|
205
|
+
function displayFace(brand: Brand, root: string): (px: number) => string {
|
|
206
|
+
const f = brand.trailer?.font
|
|
207
|
+
const weight = f?.weight ?? 900
|
|
208
|
+
if (f?.file) {
|
|
209
|
+
const name = registerFont(join(root, f.file))
|
|
210
|
+
return (px) => `${weight} ${px}px "${name}"`
|
|
211
|
+
}
|
|
212
|
+
if (f?.family && hasFamily(f.family)) return (px) => `${weight} ${px}px ${/[,"']/.test(f.family!) ? f.family : `"${f.family}"`}`
|
|
213
|
+
return (px) => ogFont(px, true)
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
const sans = (px: number): string => `600 ${px}px ${OG_FAMILIES}`
|
|
217
|
+
|
|
218
|
+
/** `text` at the largest size from `px` down to `min` that fits `maxW` */
|
|
219
|
+
function fitted(ctx: SKRSContext2D, text: string, font: (px: number) => string, px: number, min: number, maxW: number): number {
|
|
220
|
+
for (; px > min; px -= 2) {
|
|
221
|
+
ctx.font = font(px)
|
|
222
|
+
if (ctx.measureText(text).width <= maxW) return px
|
|
223
|
+
}
|
|
224
|
+
ctx.font = font(min)
|
|
225
|
+
return min
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/** the headline's lines at its size: shrunk from `px` until it takes two lines at most, then cut with an ellipsis */
|
|
229
|
+
function headlineLines(ctx: SKRSContext2D, text: string, px: number, maxW: number): { px: number; lines: string[] } {
|
|
230
|
+
const wrap = (size: number): string[] => {
|
|
231
|
+
ctx.font = sans(size)
|
|
232
|
+
const lines: string[] = []
|
|
233
|
+
let line = ''
|
|
234
|
+
for (const w of text.split(/\s+/).filter((x) => x !== '')) {
|
|
235
|
+
const next = line === '' ? w : `${line} ${w}`
|
|
236
|
+
if (line !== '' && ctx.measureText(next).width > maxW) {
|
|
237
|
+
lines.push(line)
|
|
238
|
+
line = w
|
|
239
|
+
} else line = next
|
|
240
|
+
}
|
|
241
|
+
if (line !== '') lines.push(line)
|
|
242
|
+
return lines
|
|
243
|
+
}
|
|
244
|
+
const min = px - 6
|
|
245
|
+
for (let size = px; size >= min; size -= 2) {
|
|
246
|
+
const lines = wrap(size)
|
|
247
|
+
if (lines.length <= 2) return { px: size, lines }
|
|
248
|
+
}
|
|
249
|
+
const lines = wrap(min)
|
|
250
|
+
let last = lines.slice(1).join(' ')
|
|
251
|
+
while (last.includes(' ') && ctx.measureText(`${last}…`).width > maxW) last = last.slice(0, last.lastIndexOf(' '))
|
|
252
|
+
return { px: min, lines: [lines[0]!, `${last.replace(/[\s,.;:]+$/, '')}…`] }
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
function words(ctx: SKRSContext2D, text: string, x: number, y: number, font: string, color: string): void {
|
|
256
|
+
ctx.font = font
|
|
257
|
+
ctx.fillStyle = color
|
|
258
|
+
ctx.textAlign = 'left'
|
|
259
|
+
ctx.textBaseline = 'alphabetic'
|
|
260
|
+
ctx.fillText(text, x, y)
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/** the picture of a release post, 1200×675 png (wiki tools/generate-assets/index.md, The release card): with a
|
|
264
|
+
* feature, B: the brand on a panel on the left, the feature on the right fading into it; without, A: the poster */
|
|
265
|
+
export async function renderReleaseCard(brand: Brand, root: string, card: ReleaseCard, opts?: { markFile?: string }): Promise<Buffer> {
|
|
266
|
+
const { bg, accent, ink } = brand.palette
|
|
267
|
+
const mark = await markImage(brand, opts?.markFile)
|
|
268
|
+
const display = displayFace(brand, root)
|
|
269
|
+
const c = createCanvas(RELEASE_W, RELEASE_H)
|
|
270
|
+
const ctx = c.getContext('2d')
|
|
271
|
+
const name = brand.name.toUpperCase()
|
|
272
|
+
const headline = card.headline.trim()
|
|
273
|
+
if (card.feature != null) {
|
|
274
|
+
const panel = mixed(bg, accent, 0.09)
|
|
275
|
+
ctx.fillStyle = panel
|
|
276
|
+
ctx.fillRect(0, 0, RELEASE_W, RELEASE_H)
|
|
277
|
+
const pic = await loadImage(await sharp(card.feature).rotate().png().toBuffer())
|
|
278
|
+
const x0 = 470
|
|
279
|
+
const rw = RELEASE_W - x0
|
|
280
|
+
const s = Math.max(rw / pic.width, RELEASE_H / pic.height)
|
|
281
|
+
const focus = card.focus ?? 0.3
|
|
282
|
+
const sx = Math.min(Math.max(pic.width * focus - rw / s / 2, 0), pic.width - rw / s)
|
|
283
|
+
const sy = Math.max((pic.height - RELEASE_H / s) / 2, 0)
|
|
284
|
+
ctx.drawImage(pic, sx, sy, rw / s, RELEASE_H / s, x0, 0, rw, RELEASE_H)
|
|
285
|
+
const fade = ctx.createLinearGradient(x0, 0, x0 + 260, 0)
|
|
286
|
+
fade.addColorStop(0, alpha(panel, 1))
|
|
287
|
+
fade.addColorStop(1, alpha(panel, 0))
|
|
288
|
+
ctx.fillStyle = fade
|
|
289
|
+
ctx.fillRect(x0, 0, 260, RELEASE_H)
|
|
290
|
+
drawMark(ctx, mark, 70, 80, 120)
|
|
291
|
+
words(ctx, name, 70, 270, sans(fitted(ctx, name, sans, 30, 18, 520)), accent)
|
|
292
|
+
words(ctx, card.version, 62, 420, display(fitted(ctx, card.version, display, 130, 60, 540)), ink)
|
|
293
|
+
const h = headlineLines(ctx, headline, 28, 520)
|
|
294
|
+
h.lines.forEach((l, i) => words(ctx, l, 70, 490 + i * Math.round(h.px * 1.43), sans(h.px), ink))
|
|
295
|
+
} else {
|
|
296
|
+
const g = ctx.createRadialGradient(RELEASE_W * 0.3, RELEASE_H * 0.4, 50, RELEASE_W * 0.5, RELEASE_H * 0.5, RELEASE_W * 0.8)
|
|
297
|
+
g.addColorStop(0, mixed(bg, accent, 0.15))
|
|
298
|
+
g.addColorStop(1, bg)
|
|
299
|
+
ctx.fillStyle = g
|
|
300
|
+
ctx.fillRect(0, 0, RELEASE_W, RELEASE_H)
|
|
301
|
+
drawMark(ctx, mark, 90, 157, 360)
|
|
302
|
+
const maxW = RELEASE_W - 520 - 48
|
|
303
|
+
words(ctx, name, 520, 250, sans(fitted(ctx, name, sans, 34, 18, maxW)), accent)
|
|
304
|
+
words(ctx, card.version, 512, 400, display(fitted(ctx, card.version, display, 150, 60, maxW)), ink)
|
|
305
|
+
const h = headlineLines(ctx, headline, 30, maxW)
|
|
306
|
+
h.lines.forEach((l, i) => words(ctx, l, 520, 470 + i * Math.round(h.px * 1.43), sans(h.px), ink))
|
|
307
|
+
}
|
|
308
|
+
return sharp(c.toBuffer('image/png')).png({ compressionLevel: 9 }).toBuffer()
|
|
309
|
+
}
|
package/src/cli/cmd_Bump.ts
CHANGED
|
@@ -10,7 +10,7 @@ export class BumpCommand extends Command {
|
|
|
10
10
|
static override usage = Command.Usage({
|
|
11
11
|
category: 'Gate',
|
|
12
12
|
description: 'ship a version: merge, changelog, bump, gate, tag, push, release',
|
|
13
|
-
details: 'ship a version in one word: bumps a unit (default the repo root), run from a feature branch it merges into the release branch first, then promotes the CHANGELOG Unreleased section, bumps package.json, runs the gate and every prepublish script, commits, tags, pushes, and cuts the release. Any failure before the version commit rolls the merge back and returns you to your branch.',
|
|
13
|
+
details: 'ship a version in one word: bumps a unit (default the repo root), run from a feature branch it merges into the release branch first, then promotes the CHANGELOG Unreleased section, bumps package.json, runs the gate on HEAD in a clean checkout (never the shared working tree) and every prepublish script, commits, tags, pushes, and cuts the release. Any failure before the version commit rolls the merge back and returns you to your branch.',
|
|
14
14
|
examples: [
|
|
15
15
|
['a bugfix release of the repo itself', 'sk bump patch'],
|
|
16
16
|
['a feature release', 'sk bump minor'],
|
|
@@ -30,10 +30,10 @@ export class BumpCommand extends Command {
|
|
|
30
30
|
// that is not one of them is a unit id, never an ambiguity
|
|
31
31
|
kind = Option.String({ required: false })
|
|
32
32
|
unit = Option.String({ required: false })
|
|
33
|
-
dryRun = Option.Boolean('--dry-run', false, { description: 'rehearse: run every preflight, the gate and the prepublish scripts, then stop before any version is written. the
|
|
33
|
+
dryRun = Option.Boolean('--dry-run', false, { description: 'rehearse: run every preflight, the gate and the prepublish scripts, then stop before any version is written. the merge is probed rather than performed, so the release branch never moves, and the gate judges the UNMERGED HEAD' })
|
|
34
34
|
noRelease = Option.Boolean('--no-release', false, { description: 'stop after the version commit, do not tag or publish' })
|
|
35
35
|
noMerge = Option.Boolean('--no-merge', false, { description: 'refuse on a feature branch instead of merging it into the release branch' })
|
|
36
|
-
allowDirty = Option.Boolean('--allow-dirty', false, { description: "proceed with uncommitted changes
|
|
36
|
+
allowDirty = Option.Boolean('--allow-dirty', false, { description: "proceed with uncommitted changes in what this release packs or runs from the working tree (the whole repo for an npm root or a root with a post-release step), which then ship UNGATED. Dirt nobody packs is already ignored: the gate judges HEAD in a clean checkout, so another session's unsaved work neither refuses nor reddens a release. The files the version commit writes (every package.json, the changelog, .shipkit/releases/) still refuse, and no flag lifts that: the commit takes them whole, so a dirty line would land in the tag ungated. Neither does it lift a sub-unit's own directory, nor any modified tracked file on a bump from a feature branch, which could block the rollback's way back to the branch" })
|
|
37
37
|
all = Option.Boolean('--all', false, { description: 'bump every unit whose changelog carries Unreleased notes, in declared order, root last. Given a kind it applies to ALL of them. Given none, each unit takes the kind from its own "## Unreleased (minor)" heading, and a unit whose heading is silent refuses' })
|
|
38
38
|
|
|
39
39
|
async execute(): Promise<number> {
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
// sk rec: the screen recorder's takes (recordings/, wiki tools/shipkit/recordings.md): filed under a repo, kept in the
|
|
2
|
+
// media store, edited as text, shared as a link or a file. The menu bar app records and hands each take to `sk rec
|
|
3
|
+
// import`. Every module loads inside execute: the cli registers this file on every `sk` call
|
|
4
|
+
import { Command, Option } from 'clipanion'
|
|
5
|
+
|
|
6
|
+
const DETAILS = `the screen recorder: a hotkey runs a preset of the menu bar app (what it shoots, mic, system sound, clicks, what runs after), each take lands in <recorder.dir>/<repo>/<id>/ (an external drive while it is mounted, else the Mac's disk), goes up to the private Space through the media store, and plays in the hub's Recordings page, where its editor writes edit.txt (keep, speed, crop, mute). A trailer reads one with \`film recording <name>\`. Page: wiki tools/shipkit/recordings.md`
|
|
7
|
+
|
|
8
|
+
type Ctx = { stdout: NodeJS.WritableStream; stderr: NodeJS.WritableStream }
|
|
9
|
+
type Rec = import('../recordings/model.ts').Recording
|
|
10
|
+
type Io = { out: (l: string) => void; err: (l: string) => void }
|
|
11
|
+
|
|
12
|
+
async function run(context: Ctx, body: (io: Io) => Promise<number>): Promise<number> {
|
|
13
|
+
const io: Io = { out: (l) => void context.stdout.write(`${l}\n`), err: (l) => void context.stderr.write(`${l}\n`) }
|
|
14
|
+
try {
|
|
15
|
+
// the recorder app runs sk from the home folder, outside every repo: the machine's house (pm's) is where the
|
|
16
|
+
// config, the Space and the repos are read from
|
|
17
|
+
const { houseRoot, houseRootOf } = await import('../home/home-start.ts')
|
|
18
|
+
if (houseRootOf(process.cwd()) == null) {
|
|
19
|
+
const house = houseRoot(process.cwd())
|
|
20
|
+
if (house != null) process.chdir(house)
|
|
21
|
+
}
|
|
22
|
+
return await body(io)
|
|
23
|
+
} catch (e) {
|
|
24
|
+
io.err(`FAIL: rec: ${e instanceof Error ? e.message : String(e)}`)
|
|
25
|
+
return 1
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** the repo a bare `--repo` or none means: the one asked, else this one */
|
|
30
|
+
async function repoName(asked: string | undefined): Promise<string> {
|
|
31
|
+
const { basename } = await import('node:path')
|
|
32
|
+
if (asked !== undefined) return basename(asked)
|
|
33
|
+
const { findRepoRoot } = await import('../ts/config.ts')
|
|
34
|
+
return basename(findRepoRoot(process.cwd()))
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const find = async (ref: string, repo: string | undefined): Promise<Rec> => {
|
|
38
|
+
const { findRecording } = await import('../recordings/model.ts')
|
|
39
|
+
return findRecording(ref, repo === undefined ? {} : { repo })
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const time = (s: number): string => `${Math.floor(s / 60)}:${String(Math.round(s % 60)).padStart(2, '0')}`
|
|
43
|
+
const line = (r: Rec): string => `${r.repo}/${r.name} ${r.still ? 'still' : time(r.seconds)} ${r.width}x${r.height}${r.audio ? ' sound' : ''} ${r.created.slice(0, 16).replace('T', ' ')} ${r.dir}`
|
|
44
|
+
|
|
45
|
+
const repoOpt = (): string | undefined => Option.String('--repo', { description: 'the repo it belongs to, by name (this one when absent)' })
|
|
46
|
+
|
|
47
|
+
export class RecCommand extends Command {
|
|
48
|
+
static override paths = [['rec']]
|
|
49
|
+
static override usage = Command.Usage({
|
|
50
|
+
category: 'Record',
|
|
51
|
+
description: 'every recording, newest first: repo/name, length, size, where it sits',
|
|
52
|
+
details: DETAILS,
|
|
53
|
+
examples: [['every recording of the machine', 'sk rec'], ['one repo, as json', 'sk rec --repo my-game --json']],
|
|
54
|
+
})
|
|
55
|
+
repo = repoOpt()
|
|
56
|
+
json = Option.Boolean('--json', false, { description: 'one json line a recording' })
|
|
57
|
+
async execute(): Promise<number> {
|
|
58
|
+
return run(this.context, async (io) => {
|
|
59
|
+
const { listRecordings } = await import('../recordings/model.ts')
|
|
60
|
+
const all = await listRecordings(this.repo === undefined ? {} : { repo: this.repo })
|
|
61
|
+
for (const r of all) io.out(this.json ? JSON.stringify(r) : line(r))
|
|
62
|
+
if (!this.json && all.length === 0) io.out('no recording yet: a hotkey of the menu bar app records one (sk rec presets lists them)')
|
|
63
|
+
return 0
|
|
64
|
+
})
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export class RecImportCommand extends Command {
|
|
69
|
+
static override paths = [['rec', 'import']]
|
|
70
|
+
static override usage = Command.Usage({
|
|
71
|
+
category: 'Record',
|
|
72
|
+
description: 'a video or image filed as a recording of a repo, then its preset\'s after steps',
|
|
73
|
+
details: `${DETAILS}\n\nThe file is moved (--copy keeps it): a video is remuxed to an mp4 that plays at once in a browser, transcoded only when its codec needs it; an image becomes raw.png. Its poster and facts are made, then each --after step runs in order (upload, copy-link, copy-public-link, copy-file, copy-markdown, open-editor, reveal). --preset takes that preset's after steps when --after is absent. The menu bar app calls it with --json and shows what it prints.`,
|
|
74
|
+
examples: [['a clip from the disk', 'sk rec import ~/Desktop/demo.mov --repo my-game --name boss-fight --after upload,copy-link']],
|
|
75
|
+
})
|
|
76
|
+
file = Option.String()
|
|
77
|
+
repo = repoOpt()
|
|
78
|
+
name = Option.String('--name', { description: 'its name: lowercase, digits, dashes (its time when absent)' })
|
|
79
|
+
preset = Option.String('--preset', { description: 'the preset that shot it: its after steps run unless --after says' })
|
|
80
|
+
after = Option.String('--after', { description: 'the steps after, comma separated' })
|
|
81
|
+
copy = Option.Boolean('--copy', false, { description: 'leave the file where it is' })
|
|
82
|
+
replace = Option.String('--replace', { description: 'a recording this take replaces: it goes to the Trash, the take takes its name (a trailer shot shot again)' })
|
|
83
|
+
json = Option.Boolean('--json', false, { description: 'one json line: the recording, each step said, the warnings' })
|
|
84
|
+
async execute(): Promise<number> {
|
|
85
|
+
return run(this.context, async (io) => {
|
|
86
|
+
const { resolve } = await import('node:path')
|
|
87
|
+
const { importTake } = await import('../recordings/take.ts')
|
|
88
|
+
const { runAfter } = await import('../recordings/share.ts')
|
|
89
|
+
const { AFTERS } = await import('../recordings/presets.ts')
|
|
90
|
+
const repo = await repoName(this.repo)
|
|
91
|
+
let steps = this.after?.split(',').map((s) => s.trim()).filter((s) => s !== '')
|
|
92
|
+
if (steps === undefined && this.preset !== undefined) {
|
|
93
|
+
const { recorderState } = await import('../recordings/load.ts')
|
|
94
|
+
const p = (await recorderState()).presets.find((x) => x.id === this.preset)
|
|
95
|
+
if (!p) throw new Error(`--preset ${this.preset}: no such preset (sk rec presets)`)
|
|
96
|
+
steps = p.after ?? []
|
|
97
|
+
}
|
|
98
|
+
for (const s of steps ?? []) if (!(AFTERS as readonly string[]).includes(s)) throw new Error(`--after ${s}: one of ${AFTERS.join(', ')}`)
|
|
99
|
+
const old = this.replace === undefined ? null : await find(this.replace, repo)
|
|
100
|
+
const filed = await importTake(resolve(this.file), { repo, ...(this.name && !old ? { name: this.name } : {}), ...(this.preset ? { preset: this.preset } : {}), copy: this.copy })
|
|
101
|
+
let rec = filed.rec
|
|
102
|
+
const warn = filed.warn
|
|
103
|
+
if (old) {
|
|
104
|
+
// the old take leaves first, so its name is free; the Space keeps its copy
|
|
105
|
+
const { trash } = await import('../recordings/open.ts')
|
|
106
|
+
const { rename } = await import('../recordings/model.ts')
|
|
107
|
+
await trash(old.dir)
|
|
108
|
+
rec = rename(rec, this.name ?? old.name)
|
|
109
|
+
}
|
|
110
|
+
if (warn) io.err(warn)
|
|
111
|
+
if (!this.json) io.out(`ok: ${line(rec)}`)
|
|
112
|
+
const said: string[] = []
|
|
113
|
+
let failed: string | null = null
|
|
114
|
+
try {
|
|
115
|
+
const { openEditor } = await import('../recordings/open.ts')
|
|
116
|
+
for (const s of await runAfter(rec, (steps ?? []) as import('../recordings/presets.ts').RecAfter[], { openEditor })) {
|
|
117
|
+
said.push(s.said)
|
|
118
|
+
if (!this.json) io.out(`ok: ${s.said}`)
|
|
119
|
+
}
|
|
120
|
+
} catch (e) {
|
|
121
|
+
failed = (e as Error).message
|
|
122
|
+
}
|
|
123
|
+
if (this.json) io.out(JSON.stringify({ ok: failed === null, recording: rec, said, ...(failed ? { error: failed } : {}), ...(warn ? { warn } : {}) }))
|
|
124
|
+
else if (failed) io.err(`FAIL: ${failed}; the take is filed: ${rec.dir}`)
|
|
125
|
+
return failed ? 1 : 0
|
|
126
|
+
})
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export class RecAfterCommand extends Command {
|
|
131
|
+
static override paths = [['rec', 'after']]
|
|
132
|
+
static override usage = Command.Usage({
|
|
133
|
+
category: 'Record',
|
|
134
|
+
description: "a filed take's after steps, now: the app files a take first and runs these behind it",
|
|
135
|
+
details: `${DETAILS}\n\nThe recorder app files a take with its local steps (it shows at once, its editor works on the disk), then runs the rest here in the background: upload, the links. --json prints one line: ok, each step said, the error.`,
|
|
136
|
+
examples: [['up, and its link on the clipboard', 'sk rec after unassigned/20261109-191230 --steps upload,copy-link']],
|
|
137
|
+
})
|
|
138
|
+
ref = Option.String()
|
|
139
|
+
steps = Option.String('--steps', { description: 'the steps, comma separated' })
|
|
140
|
+
json = Option.Boolean('--json', false, { description: 'one json line: ok, said, error' })
|
|
141
|
+
async execute(): Promise<number> {
|
|
142
|
+
return run(this.context, async (io) => {
|
|
143
|
+
const { runAfter } = await import('../recordings/share.ts')
|
|
144
|
+
const { AFTERS } = await import('../recordings/presets.ts')
|
|
145
|
+
const steps = (this.steps ?? '').split(',').map((s) => s.trim()).filter((s) => s !== '')
|
|
146
|
+
for (const s of steps) if (!(AFTERS as readonly string[]).includes(s)) throw new Error(`--steps ${s}: one of ${AFTERS.join(', ')}`)
|
|
147
|
+
const r = await find(this.ref, undefined)
|
|
148
|
+
const said: string[] = []
|
|
149
|
+
let failed: string | null = null
|
|
150
|
+
try {
|
|
151
|
+
for (const s of await runAfter(r, steps as import('../recordings/presets.ts').RecAfter[])) said.push(s.said)
|
|
152
|
+
} catch (e) {
|
|
153
|
+
failed = (e as Error).message
|
|
154
|
+
}
|
|
155
|
+
if (this.json) io.out(JSON.stringify({ ok: failed === null, said, ...(failed ? { error: failed } : {}) }))
|
|
156
|
+
else for (const l of said) io.out(`ok: ${l}`)
|
|
157
|
+
if (failed && !this.json) io.err(`FAIL: ${failed}`)
|
|
158
|
+
return failed ? 1 : 0
|
|
159
|
+
})
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export class RecPresetsCommand extends Command {
|
|
164
|
+
static override paths = [['rec', 'presets']]
|
|
165
|
+
static override usage = Command.Usage({
|
|
166
|
+
category: 'Record',
|
|
167
|
+
description: 'the presets the menu bar app runs: hotkey, what it shoots, its options, what runs after',
|
|
168
|
+
details: `${DETAILS}\n\nThe house config's recorder.presets (shipkit's own video and still when it names none), then each repo's own as <repo>/<name>. A wrong preset or a hotkey two presets claim is printed and exits 1. --json is what the app reads: presets, problems, the house repos and the one a take goes to by default.`,
|
|
169
|
+
examples: [['what the hotkeys do', 'sk rec presets']],
|
|
170
|
+
})
|
|
171
|
+
json = Option.Boolean('--json', false, { description: 'the app\'s read: presets, problems, repos, the default repo' })
|
|
172
|
+
async execute(): Promise<number> {
|
|
173
|
+
return run(this.context, async (io) => {
|
|
174
|
+
const { recorderState } = await import('../recordings/load.ts')
|
|
175
|
+
const s = await recorderState()
|
|
176
|
+
if (this.json) {
|
|
177
|
+
io.out(JSON.stringify(s))
|
|
178
|
+
return 0
|
|
179
|
+
}
|
|
180
|
+
for (const p of s.presets) {
|
|
181
|
+
const shoot = typeof p.shoot === 'string' ? p.shoot : `window ${p.shoot.window}${p.shoot.size ? ` at ${p.shoot.size}` : ''}`
|
|
182
|
+
const opts = [p.still ? 'still' : 'video', p.mic && 'mic', p.systemAudio && 'system sound', p.clicks && 'clicks', p.countdown && `countdown ${p.countdown}s`, p.seconds && `${p.seconds}s`].filter(Boolean).join(', ')
|
|
183
|
+
io.out(`${p.id.padEnd(18)} ${p.keys.join(' ').padEnd(28)} ${shoot}; ${opts}; then ${(p.after ?? []).join(', ') || 'nothing'} (${p.from})`)
|
|
184
|
+
}
|
|
185
|
+
io.out(`takes go to ${s.repo} (the menu's pick)`)
|
|
186
|
+
for (const p of s.problems) io.err(`FAIL: ${p}`)
|
|
187
|
+
return s.problems.length > 0 ? 1 : 0
|
|
188
|
+
})
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export class RecStartCommand extends Command {
|
|
193
|
+
static override paths = [['rec', 'start']]
|
|
194
|
+
static override usage = Command.Usage({
|
|
195
|
+
category: 'Record',
|
|
196
|
+
description: 'start a preset in the menu bar app, as its hotkey does; the app records, you stop it',
|
|
197
|
+
details: `${DETAILS}\n\nOpens the app through its url scheme, so it starts when it is not running. --repo files the take under that repo.`,
|
|
198
|
+
examples: [['a quick take for this repo', 'sk rec start quick']],
|
|
199
|
+
})
|
|
200
|
+
preset = Option.String()
|
|
201
|
+
repo = repoOpt()
|
|
202
|
+
async execute(): Promise<number> {
|
|
203
|
+
return run(this.context, async (io) => {
|
|
204
|
+
const { recorderUrl } = await import('../recordings/open.ts')
|
|
205
|
+
const url = recorderUrl({ preset: this.preset, repo: await repoName(this.repo) })
|
|
206
|
+
const p = Bun.spawnSync(['open', url], { stdout: 'ignore', stderr: 'pipe' })
|
|
207
|
+
if (p.exitCode !== 0) throw new Error(`open ${url}: ${p.stderr.toString().trim()}; is the recorder built? sk gp start recorder`)
|
|
208
|
+
io.out(`ok: ${this.preset} asked of the recorder`)
|
|
209
|
+
return 0
|
|
210
|
+
})
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export class RecLinkCommand extends Command {
|
|
215
|
+
static override paths = [['rec', 'link']]
|
|
216
|
+
static override usage = Command.Usage({
|
|
217
|
+
category: 'Record',
|
|
218
|
+
description: 'a link to a recording: private and signed (7 days at most), or --public and permanent',
|
|
219
|
+
details: `${DETAILS}\n\nThe link plays what the hub plays: the export of its edit, else the take. It is sent up first when it is not. --public publishes it under public/recording-share/: anyone with the URL watches it, for good.`,
|
|
220
|
+
examples: [['a link for a week, on the clipboard', 'sk rec link boss-fight --copy'], ['a permanent public link', 'sk rec link my-game/boss-fight --public']],
|
|
221
|
+
})
|
|
222
|
+
ref = Option.String()
|
|
223
|
+
repo = repoOpt()
|
|
224
|
+
public = Option.Boolean('--public', false, { description: 'permanent, anyone with it watches' })
|
|
225
|
+
for = Option.String('--for', { description: 'how long a private link lasts: 30m, 2h, 7d (7d)' })
|
|
226
|
+
copy = Option.Boolean('--copy', false, { description: 'on the clipboard too' })
|
|
227
|
+
async execute(): Promise<number> {
|
|
228
|
+
return run(this.context, async (io) => {
|
|
229
|
+
const { copyText, privateLink, publicLink } = await import('../recordings/share.ts')
|
|
230
|
+
const { durationS } = await import('../media-store/put.ts')
|
|
231
|
+
const r = await find(this.ref, this.repo)
|
|
232
|
+
const url = this.public ? await publicLink(r) : (await privateLink(r, durationS(this.for ?? '7d'))).url
|
|
233
|
+
if (this.copy) await copyText(url)
|
|
234
|
+
io.out(url)
|
|
235
|
+
return 0
|
|
236
|
+
})
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export class RecCopyCommand extends Command {
|
|
241
|
+
static override paths = [['rec', 'copy']]
|
|
242
|
+
static override usage = Command.Usage({
|
|
243
|
+
category: 'Record',
|
|
244
|
+
description: 'the recording\'s file on the clipboard: a paste in Slack, Discord or a mail attaches it',
|
|
245
|
+
details: DETAILS,
|
|
246
|
+
examples: [['paste it anywhere', 'sk rec copy boss-fight']],
|
|
247
|
+
})
|
|
248
|
+
ref = Option.String()
|
|
249
|
+
repo = repoOpt()
|
|
250
|
+
async execute(): Promise<number> {
|
|
251
|
+
return run(this.context, async (io) => {
|
|
252
|
+
const { copyRecordingFile } = await import('../recordings/share.ts')
|
|
253
|
+
io.out(`ok: ${await copyRecordingFile(await find(this.ref, this.repo))} on the clipboard`)
|
|
254
|
+
return 0
|
|
255
|
+
})
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
export class RecRenameCommand extends Command {
|
|
260
|
+
static override paths = [['rec', 'rename']]
|
|
261
|
+
static override usage = Command.Usage({
|
|
262
|
+
category: 'Record',
|
|
263
|
+
description: 'a recording\'s name: what a trailer, a link and the hub say',
|
|
264
|
+
details: DETAILS,
|
|
265
|
+
examples: [['name a take', 'sk rec rename 20261109-191230 boss-fight']],
|
|
266
|
+
})
|
|
267
|
+
ref = Option.String()
|
|
268
|
+
name = Option.String()
|
|
269
|
+
repo = repoOpt()
|
|
270
|
+
async execute(): Promise<number> {
|
|
271
|
+
return run(this.context, async (io) => {
|
|
272
|
+
const { rename } = await import('../recordings/model.ts')
|
|
273
|
+
io.out(`ok: ${line(rename(await find(this.ref, this.repo), this.name))}`)
|
|
274
|
+
return 0
|
|
275
|
+
})
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
export class RecMoveCommand extends Command {
|
|
280
|
+
static override paths = [['rec', 'move']]
|
|
281
|
+
static override usage = Command.Usage({
|
|
282
|
+
category: 'Record',
|
|
283
|
+
description: "a take filed under another repo, or back to unassigned (where every take starts)",
|
|
284
|
+
details: `${DETAILS}\n\nThe folder moves on its drive, its meta and its media index rows follow, so its links, its uploads and a delete still find every file.`,
|
|
285
|
+
examples: [['a take for the game', 'sk rec move 20261109-191230 my-game'], ['back to no repo', 'sk rec move my-game/boss-fight unassigned']],
|
|
286
|
+
})
|
|
287
|
+
ref = Option.String()
|
|
288
|
+
to = Option.String()
|
|
289
|
+
repo = repoOpt()
|
|
290
|
+
async execute(): Promise<number> {
|
|
291
|
+
return run(this.context, async (io) => {
|
|
292
|
+
const { moveRecording } = await import('../recordings/model.ts')
|
|
293
|
+
io.out(`ok: ${line(moveRecording(await find(this.ref, this.repo), this.to))}`)
|
|
294
|
+
return 0
|
|
295
|
+
})
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
export class RecEditCommand extends Command {
|
|
300
|
+
static override paths = [['rec', 'edit']]
|
|
301
|
+
static override usage = Command.Usage({
|
|
302
|
+
category: 'Record',
|
|
303
|
+
description: 'a recording\'s edit as text: printed, or set and exported (keep, speed, crop, mute)',
|
|
304
|
+
details: `${DETAILS}\n\nOne line a verb: \`keep 0:01.5-0:12, 0:15-0:40\`, \`speed 2x 0:20-0:30\`, \`crop 1280x720+40+80\`, \`mute\`. Times are the take's. Setting it exports out.mp4 in one ffmpeg pass; an empty text removes the edit, and the take plays again. The take itself never changes.`,
|
|
305
|
+
examples: [['what it is now', 'sk rec edit boss-fight'], ['trim both ends', 'sk rec edit boss-fight --set "keep 0:02-0:31"']],
|
|
306
|
+
})
|
|
307
|
+
ref = Option.String()
|
|
308
|
+
repo = repoOpt()
|
|
309
|
+
set = Option.String('--set', { description: 'the whole edit, lines split by a newline or a semicolon' })
|
|
310
|
+
async execute(): Promise<number> {
|
|
311
|
+
return run(this.context, async (io) => {
|
|
312
|
+
const { editText, saveEdit } = await import('../recordings/take.ts')
|
|
313
|
+
const r = await find(this.ref, this.repo)
|
|
314
|
+
if (this.set === undefined) {
|
|
315
|
+
io.out(editText(r) || '(no edit: the take plays whole)')
|
|
316
|
+
return 0
|
|
317
|
+
}
|
|
318
|
+
const after = await saveEdit(r, this.set.replace(/;\s*/g, '\n'))
|
|
319
|
+
io.out(`ok: ${line(after)}`)
|
|
320
|
+
return 0
|
|
321
|
+
})
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
export class RecRmCommand extends Command {
|
|
326
|
+
static override paths = [['rec', 'rm']]
|
|
327
|
+
static override usage = Command.Usage({
|
|
328
|
+
category: 'Record',
|
|
329
|
+
description: 'a recording deleted for good: off the Space, every version and export, its folder to the Trash',
|
|
330
|
+
details: `${DETAILS}\n\nThe one delete the media store allows: the take, every export and poster it ever had and every public copy leave the Space for good, then the folder goes to the Trash. A private link dies at once; a public one can play from the CDN's cache for up to an hour. A content another recording still holds stays up. --yes is required: there is no undo in the Space.`,
|
|
331
|
+
examples: [['a take that showed too much', 'sk rec rm 20261109-191230 --yes']],
|
|
332
|
+
})
|
|
333
|
+
ref = Option.String()
|
|
334
|
+
repo = repoOpt()
|
|
335
|
+
yes = Option.Boolean('--yes', false, { description: 'yes, for good: no undo in the Space' })
|
|
336
|
+
async execute(): Promise<number> {
|
|
337
|
+
return run(this.context, async (io) => {
|
|
338
|
+
const r = await find(this.ref, this.repo)
|
|
339
|
+
if (!this.yes) throw new Error(`${r.repo}/${r.name} would leave the Space for good, every link to it dead: add --yes`)
|
|
340
|
+
const { deleteRecording } = await import('../recordings/delete.ts')
|
|
341
|
+
const res = await deleteRecording(r)
|
|
342
|
+
io.out(`ok: ${r.repo}/${r.name} deleted: ${res.gone} files off the Space, the folder in the Trash`)
|
|
343
|
+
for (const k of res.kept) io.out(`kept up: ${k}`)
|
|
344
|
+
return 0
|
|
345
|
+
})
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
export const REC_COMMANDS = [RecCommand, RecImportCommand, RecAfterCommand, RecPresetsCommand, RecStartCommand, RecLinkCommand, RecCopyCommand, RecRenameCommand, RecMoveCommand, RecEditCommand, RecRmCommand]
|