trace-avatar-render 0.1.6 → 0.2.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/dist/cli.js CHANGED
@@ -1,424 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
- CORNERS,
4
- RenderError,
5
- brandFile,
6
- canvasOf,
7
- providerOf,
8
- render,
9
- suggestScript,
10
- voiceOf,
11
- watermarkOf
12
- } from "./chunk-ZNHFXKD3.js";
13
-
14
- // src/cli.ts
15
- import { existsSync, readFileSync, writeFileSync } from "fs";
16
- import { apply as applySuggestions, suggest } from "trace-avatar/assist";
17
- import { parseArgs } from "util";
18
- var USAGE = `Usage: trace-avatar-render <trace.json> --url <page> --out <file.gif|file.mp4> [options]
19
-
20
- --url <url> the page the guide starts on (required)
21
- --out <file> .gif or .mp4; repeat for several (required). <file>@<shape> gives that output its own
22
- canvas (e.g. --out wide.mp4@16:9 --out square.mp4@1:1): several shapes from one capture
23
- --mode <overlay|perform> Show me (default) or Do it for me
24
- --allow-perform needed for perform: it clicks and types for real (use a sandbox account)
25
- --width <px> output width (GIF default 800, MP4 the capture's)
26
- --fps <n> frames per second (GIF default 12, MP4 30)
27
- --viewport <WxH> default: the trace's meta.viewport, else 1280x800
28
- --scale <n> device pixel ratio of the capture (2 for crisp video)
29
- --storage-state <file> a signed-in Playwright session
30
- --max-wait <ms> waits longer than this are cut to it (default 800, 0 keeps them)
31
- --hide <selector> hidden before capture; repeatable
32
- --blur <selector> blurred before capture (as well as [data-trace-blur]); repeatable
33
- --allow-stall render a stalled guide anyway instead of failing
34
- --navigate a step on another page: load that page, as the app's router would (without it, a
35
- Show me guide that crosses pages waits on "Open \u2026 to continue")
36
- --security [guards] perform: leave these to the viewer (a hand-off): all, or secrets,money,files
37
- --value <name=text> perform: a value to type, by name or field label (e.g. password=demo-pass); repeatable
38
- --player <file> the trace-perform.min.js to use (default: the installed trace-avatar)
39
- --timeline <file> write the timeline and the cuts as JSON
40
- --timeout <ms> give up after this long (default 120000)
41
- --report <file> write what happened as JSON: { outcome: passed|stalled|failed, step, reason, message }
42
- (for CI: one result per guide, whatever the exit code)
43
- --headed show the browser
44
-
45
- Polish (all off by default):
46
- --frame <none|browser> a browser window around the app, on a background
47
- --background <css> the background behind the window and on the cards
48
- --camera zoom in on each action and pan between close ones
49
- --zoom <n> how far the camera goes in (default 1.6; implies --camera)
50
- --captions <burn|vtt|both> burn the steps' words in, write <out>.vtt + <out>.chapters.vtt, or both
51
- --captions-at <top|bottom> where burned-in captions sit (default bottom; top when the app's own UI is low)
52
- --poster [file] a PNG at the first click (default <out>.png)
53
- --title-card [title] a 1.5 s card first (default: the trace's title)
54
- --end-card [title] a 2 s card last (default: "Done")
55
- --canvas <shape> compose onto 9:16 (1080x1920), 4:5, 1:1, 16:9 or WxH: the app between safe margins on the
56
- background, for Reels, Stories and feeds (--width scales the whole canvas)
57
- --watermark <text> a small badge on every frame, cards too, e.g. "Created with TraceAvatar \xB7 traceavatar.com"
58
- --watermark-at <corner> top-left, top-right, bottom-left or bottom-right (default)
59
- --brand <file.json> the look in one file: canvas, watermark, frame, background, camera, captions, captionsAt,
60
- titleCard, endCard ({ title, url, logo, color }); flags given here win over it
61
-
62
- AI (nothing calls a model without --ai):
63
- --ai <provider> gateway: our AI gateway (AI_GATEWAY_URL, AI_GATEWAY_KEY), DeepSeek first, then Gemini,
64
- then OpenAI; or gateway:<provider>[/<model>][,<provider>\u2026]; openai:<model> (OPENAI_API_KEY,
65
- OPENAI_BASE_URL for any OpenAI-compatible server); or ./provider.js
66
- --ai-vision <model> the model for --qa's frames (gateway's DeepSeek default: deepseek-flash)
67
- --qa [strict] send a frame per step to the AI to look for errors, empty states, a stall, personal
68
- data; strict exits 1 when anything is flagged (needs a vision model)
69
- --alt write <out>.alt.txt; with --captions vtt, AI names the chapters
70
- --repair when a step can't find its element, or a wait's text never shows, propose a fix in
71
- <out>.repair.json (verified by playing again); still exits 1. With --ai, unsure
72
- cases are asked (DeepSeek first)
73
- --repair-vision with --repair and --ai: send a screenshot of the stalled page too (elements only)
74
-
75
- Narration (MP4 only; nothing speaks without --voice):
76
- --voice <voice> gateway (our AI gateway: Gemini speech, AI_GATEWAY_URL/KEY), gateway:gemini/<model>:<voice>,
77
- openai:<model>[:<voice>] (OPENAI_API_KEY / OPENAI_BASE_URL), say[:<voice>] (macOS, offline),
78
- or ./voice.js. Each step's caption is spoken; the video holds where a line runs long
79
- --script <file.json> the spoken lines instead: { "lines": [{ "n": 1, "text": "\u2026" }] }
80
- --voice-out <file.wav> also write the narration track
81
- --voice-strict fail when a line needs a hold longer than 8 s
82
- --no-voice-cache don't keep spoken lines in .trace-avatar-cache/voice
83
-
84
- Suggestions for a person to accept (the renderer never changes a trace):
85
- trace-avatar-render suggest <trace.json> --task captions|title|waits|narration --ai <provider> [--tone friendly|terse|formal]
86
- [--hints hints.json] [--out suggestions.json]
87
- trace-avatar-render apply <trace.json> <suggestions.json> --accept 1,3|all --out <new.trace.json>
88
- `;
89
- function parse(argv) {
90
- const extra = {};
91
- const flags = { "--poster": "poster", "--title-card": "title", "--end-card": "end", "--qa": "qa" };
92
- const rest = [];
93
- for (let k = 0; k < argv.length; k += 1) {
94
- const a = argv[k];
95
- const eq = a.indexOf("=");
96
- const name = eq > 0 ? a.slice(0, eq) : a;
97
- if (flags[name]) {
98
- if (eq > 0) extra[flags[name]] = a.slice(eq + 1);
99
- else if (argv[k + 1] !== void 0 && !argv[k + 1].startsWith("-") && !/\.json$/i.test(argv[k + 1]) && (flags[name] !== "qa" || argv[k + 1] === "strict")) {
100
- extra[flags[name]] = argv[k + 1];
101
- k += 1;
102
- } else extra[flags[name]] = true;
103
- continue;
104
- }
105
- rest.push(a);
106
- }
107
- const { values, positionals } = parseArgs({
108
- args: rest,
109
- allowPositionals: true,
110
- options: {
111
- url: { type: "string" },
112
- out: { type: "string", multiple: true },
113
- mode: { type: "string" },
114
- "allow-perform": { type: "boolean" },
115
- width: { type: "string" },
116
- fps: { type: "string" },
117
- viewport: { type: "string" },
118
- scale: { type: "string" },
119
- "storage-state": { type: "string" },
120
- "max-wait": { type: "string" },
121
- hide: { type: "string", multiple: true },
122
- blur: { type: "string", multiple: true },
123
- "allow-stall": { type: "boolean" },
124
- navigate: { type: "boolean" },
125
- security: { type: "string" },
126
- value: { type: "string", multiple: true },
127
- player: { type: "string" },
128
- timeline: { type: "string" },
129
- timeout: { type: "string" },
130
- headed: { type: "boolean" },
131
- help: { type: "boolean", short: "h" },
132
- frame: { type: "string" },
133
- background: { type: "string" },
134
- camera: { type: "boolean" },
135
- zoom: { type: "string" },
136
- captions: { type: "string" },
137
- "captions-at": { type: "string" },
138
- ai: { type: "string" },
139
- "ai-vision": { type: "string" },
140
- alt: { type: "boolean" },
141
- voice: { type: "string" },
142
- script: { type: "string" },
143
- "voice-out": { type: "string" },
144
- "voice-strict": { type: "boolean" },
145
- "no-voice-cache": { type: "boolean" },
146
- repair: { type: "boolean" },
147
- "repair-vision": { type: "boolean" },
148
- report: { type: "string" },
149
- canvas: { type: "string" },
150
- watermark: { type: "string" },
151
- "watermark-at": { type: "string" },
152
- brand: { type: "string" }
153
- }
154
- });
155
- if (values.help) throw new UsageError("");
156
- const trace = positionals[0];
157
- if (!trace) throw new UsageError("a trace file is needed");
158
- if (positionals.length > 1) throw new UsageError(`one trace at a time (got ${positionals.join(", ")})`);
159
- if (!values.url) throw new UsageError("--url is needed");
160
- if (!values.out?.length) throw new UsageError("--out is needed");
161
- const num = (name, v, min = 0) => {
162
- if (v === void 0) return void 0;
163
- const n = Number(v);
164
- if (!Number.isFinite(n) || n < min) throw new UsageError(`--${name} must be a number \u2265 ${min}`);
165
- return n;
166
- };
167
- const mode = values.mode ?? "overlay";
168
- if (mode !== "overlay" && mode !== "perform") throw new UsageError("--mode is overlay or perform");
169
- let viewport;
170
- if (values.viewport) {
171
- const m = /^(\d+)x(\d+)$/i.exec(values.viewport);
172
- if (!m) throw new UsageError("--viewport is WIDTHxHEIGHT, e.g. 1280x800");
173
- viewport = { w: Number(m[1]), h: Number(m[2]) };
174
- }
175
- if (values.frame && values.frame !== "none" && values.frame !== "browser") throw new UsageError("--frame is none or browser");
176
- const captions = values.captions;
177
- if (captions !== void 0 && captions !== "burn" && captions !== "vtt" && captions !== "both") throw new UsageError("--captions is burn, vtt or both");
178
- const captionsAt = values["captions-at"];
179
- if (captionsAt !== void 0 && captionsAt !== "top" && captionsAt !== "bottom") throw new UsageError("--captions-at is top or bottom");
180
- const zoom = num("zoom", values.zoom, 1);
181
- if (extra.qa !== void 0 && extra.qa !== true && extra.qa !== "strict") throw new UsageError("--qa takes nothing or strict");
182
- if ((extra.qa !== void 0 || values.alt || values["ai-vision"]) && !values.ai) throw new UsageError("--qa, --alt and --ai-vision need --ai");
183
- if (values["repair-vision"] && !(values.repair && values.ai)) throw new UsageError("--repair-vision needs --repair and --ai");
184
- if ((values.script || values["voice-out"] || values["voice-strict"] || values["no-voice-cache"]) && !values.voice) throw new UsageError("--script, --voice-out, --voice-strict and --no-voice-cache need --voice");
185
- if (values.voice && !values.out.some((f) => /\.mp4(@.*)?$/i.test(f))) throw new UsageError("--voice needs an .mp4 output (a GIF has no sound)");
186
- let security;
187
- if (values.security !== void 0) {
188
- const s = values.security.trim().toLowerCase();
189
- const guards = s === "" || s === "all" || s === "true" ? true : s.split(/[\s,]+/).filter(Boolean);
190
- if (Array.isArray(guards) && guards.some((g) => !["secrets", "money", "files"].includes(g))) throw new UsageError("--security is all, or a list of secrets, money, files");
191
- security = guards;
192
- }
193
- const typed = {};
194
- for (const v of values.value ?? []) {
195
- const k = v.indexOf("=");
196
- if (k < 1) throw new UsageError("--value is name=text, e.g. password=demo-pass");
197
- typed[v.slice(0, k)] = v.slice(k + 1);
198
- }
199
- if ((security !== void 0 || values.value?.length) && mode !== "perform") throw new UsageError("--security and --value are for --mode perform");
200
- const tryUsage = (f) => {
201
- try {
202
- return f();
203
- } catch (e) {
204
- throw new UsageError(e.message);
205
- }
206
- };
207
- if (values.canvas !== void 0) tryUsage(() => canvasOf(values.canvas));
208
- for (const o of values.out ?? []) {
209
- const m = /^.+\.(?:gif|mp4)@(.+)$/i.exec(o);
210
- if (m) tryUsage(() => canvasOf(m[1]));
211
- }
212
- const at = values["watermark-at"];
213
- if (at !== void 0 && !CORNERS.includes(at)) throw new UsageError(`--watermark-at is ${CORNERS.join(", ")}`);
214
- const brand = values.brand !== void 0 ? tryUsage(() => brandFile(values.brand)) : {};
215
- let watermark = values.watermark !== void 0 ? tryUsage(() => watermarkOf(values.watermark)) : brand.watermark;
216
- if (at !== void 0) {
217
- if (watermark === void 0) throw new UsageError("--watermark-at needs a watermark (--watermark, or one in --brand)");
218
- watermark = { ...typeof watermark === "string" ? { text: watermark } : watermark, at };
219
- }
220
- const width = num("width", values.width, 16);
221
- const fps = num("fps", values.fps, 1);
222
- const maxWait = num("max-wait", values["max-wait"]);
223
- return {
224
- trace,
225
- options: {
226
- // The brand first: the flags below win over it.
227
- ...brand,
228
- trace,
229
- url: values.url,
230
- mode,
231
- allowPerform: !!values["allow-perform"],
232
- out: values.out.map((spec) => {
233
- const m = /^(.+\.(?:gif|mp4))@(.+)$/i.exec(spec);
234
- const file = m ? m[1] : spec;
235
- return { file, ...width ? { width } : {}, ...fps ? { fps } : {}, ...m ? { canvas: m[2] } : {} };
236
- }),
237
- ...viewport ? { viewport } : {},
238
- ...values.scale ? { scale: num("scale", values.scale, 1) } : {},
239
- ...values["storage-state"] ? { storageState: values["storage-state"] } : {},
240
- ...maxWait !== void 0 ? { cuts: { maxWaitMs: maxWait } } : {},
241
- ...values.hide ? { hide: values.hide } : {},
242
- ...values.blur ? { blur: values.blur } : {},
243
- allowStall: !!values["allow-stall"],
244
- ...values.navigate ? { navigate: true } : {},
245
- ...security !== void 0 ? { security } : {},
246
- ...values.value?.length ? { values: typed } : {},
247
- ...values.player ? { player: values.player } : {},
248
- ...values.timeline ? { timeline: values.timeline } : {},
249
- ...values.timeout ? { timeoutMs: num("timeout", values.timeout, 1) } : {},
250
- headless: !values.headed,
251
- ...values.frame ? { frame: values.frame } : {},
252
- ...values.background ? { background: values.background } : {},
253
- ...zoom ? { camera: { zoom } } : values.camera ? { camera: true } : {},
254
- ...captions ? { captions } : {},
255
- ...captionsAt ? { captionsAt } : {},
256
- ...extra.poster !== void 0 ? { poster: extra.poster } : {},
257
- ...extra.title !== void 0 ? { titleCard: extra.title } : {},
258
- ...extra.end !== void 0 ? { endCard: extra.end } : {},
259
- ...values.canvas !== void 0 ? { canvas: values.canvas } : {},
260
- ...watermark !== void 0 ? { watermark } : {},
261
- ...extra.qa !== void 0 ? { qa: true } : {},
262
- ...values.alt ? { alt: true } : {},
263
- ...values.script ? { script: values.script } : {},
264
- ...values["voice-out"] ? { voiceOut: values["voice-out"] } : {},
265
- ...values["voice-strict"] ? { voiceStrict: true } : {},
266
- ...values.repair ? { repair: true } : {},
267
- ...values["repair-vision"] ? { repairVision: true } : {}
268
- },
269
- ...values.ai ? { ai: values.ai } : {},
270
- ...values["ai-vision"] ? { aiVision: values["ai-vision"] } : {},
271
- ...values.voice ? { voice: values.voice } : {},
272
- ...values["no-voice-cache"] ? { noVoiceCache: true } : {},
273
- ...extra.qa === "strict" ? { strict: true } : {},
274
- ...values.report ? { report: values.report } : {}
275
- };
276
- }
277
- function reportOf(err, traceFile, repairFile) {
278
- if (!err) return { outcome: "passed", step: null, reason: null, message: null };
279
- const stall = err instanceof RenderError ? err.stall : void 0;
280
- if (stall && Number.isInteger(stall.index)) {
281
- let say = null;
282
- try {
283
- say = JSON.parse(readFileSync(traceFile, "utf8")).steps?.[stall.index]?.say ?? null;
284
- } catch {
285
- }
286
- return {
287
- outcome: "stalled",
288
- step: stall.index,
289
- reason: stall.reason === "until-timeout" ? "until-timeout" : "not-found",
290
- message: say ?? err.message,
291
- ...repairFile && existsSync(repairFile) ? { repair: repairFile } : {}
292
- };
293
- }
294
- return { outcome: "failed", step: null, reason: null, message: err?.message ?? String(err) };
295
- }
296
- var UsageError = class extends Error {
297
- };
298
- async function main(argv, io = { log: console.log, error: console.error }) {
299
- if (argv[0] === "suggest" || argv[0] === "apply") {
300
- try {
301
- return await (argv[0] === "suggest" ? suggestCmd(argv.slice(1), io) : applyCmd(argv.slice(1), io));
302
- } catch (e) {
303
- io.error(`trace-avatar-render ${argv[0]}: ${e.message}`);
304
- if (e instanceof UsageError) io.error(USAGE);
305
- return e instanceof UsageError ? 2 : 1;
306
- }
307
- }
308
- let p;
309
- try {
310
- p = parse(argv);
311
- } catch (e) {
312
- const msg = e.message;
313
- if (msg) io.error(`trace-avatar-render: ${msg}
314
- `);
315
- io.error(USAGE);
316
- return e instanceof UsageError && !msg ? 0 : 2;
317
- }
318
- try {
319
- if (p.ai) p.options.ai = await providerOf(p.ai, process.env, p.aiVision ? { vision: p.aiVision } : {});
320
- if (p.voice) p.options.voice = await voiceOf(p.voice, process.env, p.noVoiceCache ? { cacheDir: null } : {});
321
- const r = await render(p.options);
322
- for (const o of r.outputs) io.log(`${o.file} ${o.width}\xD7${o.height} ${o.fps} fps ${(r.durationMs / 1e3).toFixed(1)} s ${(o.bytes / 1024).toFixed(0)} KB`);
323
- if (r.rawMs > r.durationMs + 50) io.log(`cut ${((r.rawMs - r.durationMs) / 1e3).toFixed(1)} s of waiting`);
324
- for (const f of [r.poster, r.vtt, r.chapters, r.alt]) if (f) io.log(f);
325
- if (r.narration) {
326
- io.log(`narration: ${r.narration.lines.length} line${r.narration.lines.length === 1 ? "" : "s"}${r.narration.holdMs ? `, the video holds ${(r.narration.holdMs / 1e3).toFixed(1)} s for them` : ""} ${r.narration.text}`);
327
- if (r.narration.wav) io.log(r.narration.wav);
328
- }
329
- for (const w of r.warnings ?? []) io.error(`warning: ${w}`);
330
- if (p.report) writeFileSync(p.report, `${JSON.stringify(reportOf(null, p.trace), null, 2)}
331
- `);
332
- if (r.qa) {
333
- if (!r.qa.length) io.log("qa: nothing flagged");
334
- for (const f of r.qa) io.log(`qa: ${(f.at / 1e3).toFixed(1)} s ${f.kind} ${f.note}`);
335
- if (p.strict && r.qa.length) {
336
- io.error(`trace-avatar-render: qa flagged ${r.qa.length} problem${r.qa.length > 1 ? "s" : ""} (--qa strict)`);
337
- return 1;
338
- }
339
- }
340
- return 0;
341
- } catch (e) {
342
- io.error(`trace-avatar-render: ${e.message}`);
343
- if (p.report) {
344
- const first = p.options.out[0];
345
- const base = (typeof first === "string" ? first : first.file).replace(/\.[^./]+$/, "");
346
- writeFileSync(p.report, `${JSON.stringify(reportOf(e, p.trace, `${base}.repair.json`), null, 2)}
347
- `);
348
- }
349
- if (e instanceof RenderError && e.screenshot) {
350
- const first = p.options.out[0];
351
- const shot = `${(typeof first === "string" ? first : first.file).replace(/\.[^./]+$/, "")}.failure.png`;
352
- writeFileSync(shot, e.screenshot);
353
- io.error(`the page at that moment: ${shot}`);
354
- }
355
- return 1;
356
- }
357
- }
358
- var readJson = (file) => {
359
- try {
360
- return JSON.parse(readFileSync(file, "utf8"));
361
- } catch (e) {
362
- throw new Error(`could not read ${file}: ${e.message}`);
363
- }
364
- };
365
- async function suggestCmd(argv, io) {
366
- const { values, positionals } = parseArgs({ args: argv, allowPositionals: true, options: {
367
- task: { type: "string" },
368
- ai: { type: "string" },
369
- tone: { type: "string" },
370
- hints: { type: "string" },
371
- out: { type: "string" },
372
- "send-typed": { type: "boolean" }
373
- } });
374
- const [file] = positionals;
375
- if (!file) throw new UsageError("suggest needs a trace file");
376
- const task = values.task;
377
- if (task !== "captions" && task !== "title" && task !== "waits" && task !== "narration") throw new UsageError("--task is captions, title, waits or narration");
378
- if (!values.ai) throw new UsageError("suggest needs --ai");
379
- if (task === "narration") {
380
- const r2 = await suggestScript(await providerOf(values.ai), readJson(file));
381
- const out2 = JSON.stringify({ ...r2.script, ...r2.dropped.length ? { dropped: r2.dropped } : {} }, null, 2);
382
- if (values.out) {
383
- writeFileSync(values.out, `${out2}
384
- `);
385
- io.log(`${r2.script.lines.length} line${r2.script.lines.length === 1 ? "" : "s"} in ${values.out}: edit them, then --script ${values.out}`);
386
- } else io.log(out2);
387
- return 0;
388
- }
389
- const tone = values.tone;
390
- if (tone !== void 0 && tone !== "friendly" && tone !== "terse" && tone !== "formal") throw new UsageError("--tone is friendly, terse or formal");
391
- const trace = readJson(file);
392
- const hints = values.hints ? readJson(values.hints) : void 0;
393
- const r = await suggest(task, trace, { ai: await providerOf(values.ai), ...hints ? { hints } : {}, ...tone ? { tone } : {}, ...values["send-typed"] ? { sendTyped: true } : {} });
394
- const out = JSON.stringify({ task, suggestions: r.suggestions.map((sg, k) => ({ id: k + 1, ...sg })), dropped: r.dropped }, null, 2);
395
- if (values.out) {
396
- writeFileSync(values.out, `${out}
397
- `);
398
- io.log(`${r.suggestions.length} suggestion${r.suggestions.length === 1 ? "" : "s"} in ${values.out}`);
399
- } else io.log(out);
400
- return 0;
401
- }
402
- async function applyCmd(argv, io) {
403
- const { values, positionals } = parseArgs({ args: argv, allowPositionals: true, options: { accept: { type: "string" }, out: { type: "string" } } });
404
- const [file, sugFile] = positionals;
405
- if (!file || !sugFile) throw new UsageError("apply needs a trace file and a suggestions file");
406
- if (!values.accept) throw new UsageError("apply needs --accept 1,3 (or all): a person picks what goes in");
407
- if (!values.out) throw new UsageError("apply needs --out for the new trace");
408
- const all = readJson(sugFile).suggestions ?? [];
409
- const ids = values.accept === "all" ? all.map((x) => x.id) : values.accept.split(",").map((x) => Number(x.trim()));
410
- const missing = ids.filter((id) => !all.some((x) => x.id === id));
411
- if (missing.length) throw new UsageError(`no suggestion ${missing.join(", ")} in ${sugFile}`);
412
- const next = applySuggestions(readJson(file), all.filter((x) => ids.includes(x.id)));
413
- writeFileSync(values.out, `${JSON.stringify(next, null, 2)}
414
- `);
415
- io.log(`applied ${ids.length} of ${all.length} to ${values.out}`);
416
- return 0;
417
- }
418
- var isMain = import.meta.url === `file://${process.argv[1]}` || process.argv[1]?.endsWith("/trace-avatar-render") || process.argv[1]?.endsWith("/cli.js");
419
- if (isMain) void main(process.argv.slice(2)).then((code) => {
420
- process.exitCode = code;
421
- });
3
+ USAGE,
4
+ UsageError,
5
+ main,
6
+ parse,
7
+ reportOf
8
+ } from "./chunk-EAMOVIQK.js";
422
9
  export {
423
10
  USAGE,
424
11
  UsageError,
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * trace-avatar-render invoice.trace.json --url http://localhost:3000/app --out invoice.gif --out invoice.mp4\n *\n * Exit codes: 0 rendered, 1 the render failed (a stalled guide, an error in the app), 2 wrong usage.\n */\n\nimport { existsSync, readFileSync, writeFileSync } from 'node:fs';\nimport { apply as applySuggestions, suggest } from 'trace-avatar/assist';\nimport type { Suggestion } from 'trace-avatar/assist';\nimport { providerOf } from './ai';\nimport { suggestScript } from './narration';\nimport { voiceOf } from './voice';\nimport { parseArgs } from 'node:util';\nimport { RenderError } from './capture';\nimport { render } from './render';\nimport { brandFile, canvasOf, CORNERS, watermarkOf } from './brand';\nimport type { Corner, Watermark } from './brand';\n\nexport const USAGE = `Usage: trace-avatar-render <trace.json> --url <page> --out <file.gif|file.mp4> [options]\n\n --url <url> the page the guide starts on (required)\n --out <file> .gif or .mp4; repeat for several (required). <file>@<shape> gives that output its own\n canvas (e.g. --out wide.mp4@16:9 --out square.mp4@1:1): several shapes from one capture\n --mode <overlay|perform> Show me (default) or Do it for me\n --allow-perform needed for perform: it clicks and types for real (use a sandbox account)\n --width <px> output width (GIF default 800, MP4 the capture's)\n --fps <n> frames per second (GIF default 12, MP4 30)\n --viewport <WxH> default: the trace's meta.viewport, else 1280x800\n --scale <n> device pixel ratio of the capture (2 for crisp video)\n --storage-state <file> a signed-in Playwright session\n --max-wait <ms> waits longer than this are cut to it (default 800, 0 keeps them)\n --hide <selector> hidden before capture; repeatable\n --blur <selector> blurred before capture (as well as [data-trace-blur]); repeatable\n --allow-stall render a stalled guide anyway instead of failing\n --navigate a step on another page: load that page, as the app's router would (without it, a\n Show me guide that crosses pages waits on \"Open … to continue\")\n --security [guards] perform: leave these to the viewer (a hand-off): all, or secrets,money,files\n --value <name=text> perform: a value to type, by name or field label (e.g. password=demo-pass); repeatable\n --player <file> the trace-perform.min.js to use (default: the installed trace-avatar)\n --timeline <file> write the timeline and the cuts as JSON\n --timeout <ms> give up after this long (default 120000)\n --report <file> write what happened as JSON: { outcome: passed|stalled|failed, step, reason, message }\n (for CI: one result per guide, whatever the exit code)\n --headed show the browser\n\n Polish (all off by default):\n --frame <none|browser> a browser window around the app, on a background\n --background <css> the background behind the window and on the cards\n --camera zoom in on each action and pan between close ones\n --zoom <n> how far the camera goes in (default 1.6; implies --camera)\n --captions <burn|vtt|both> burn the steps' words in, write <out>.vtt + <out>.chapters.vtt, or both\n --captions-at <top|bottom> where burned-in captions sit (default bottom; top when the app's own UI is low)\n --poster [file] a PNG at the first click (default <out>.png)\n --title-card [title] a 1.5 s card first (default: the trace's title)\n --end-card [title] a 2 s card last (default: \"Done\")\n --canvas <shape> compose onto 9:16 (1080x1920), 4:5, 1:1, 16:9 or WxH: the app between safe margins on the\n background, for Reels, Stories and feeds (--width scales the whole canvas)\n --watermark <text> a small badge on every frame, cards too, e.g. \"Created with TraceAvatar · traceavatar.com\"\n --watermark-at <corner> top-left, top-right, bottom-left or bottom-right (default)\n --brand <file.json> the look in one file: canvas, watermark, frame, background, camera, captions, captionsAt,\n titleCard, endCard ({ title, url, logo, color }); flags given here win over it\n\n AI (nothing calls a model without --ai):\n --ai <provider> gateway: our AI gateway (AI_GATEWAY_URL, AI_GATEWAY_KEY), DeepSeek first, then Gemini,\n then OpenAI; or gateway:<provider>[/<model>][,<provider>…]; openai:<model> (OPENAI_API_KEY,\n OPENAI_BASE_URL for any OpenAI-compatible server); or ./provider.js\n --ai-vision <model> the model for --qa's frames (gateway's DeepSeek default: deepseek-flash)\n --qa [strict] send a frame per step to the AI to look for errors, empty states, a stall, personal\n data; strict exits 1 when anything is flagged (needs a vision model)\n --alt write <out>.alt.txt; with --captions vtt, AI names the chapters\n --repair when a step can't find its element, or a wait's text never shows, propose a fix in\n <out>.repair.json (verified by playing again); still exits 1. With --ai, unsure\n cases are asked (DeepSeek first)\n --repair-vision with --repair and --ai: send a screenshot of the stalled page too (elements only)\n\n Narration (MP4 only; nothing speaks without --voice):\n --voice <voice> gateway (our AI gateway: Gemini speech, AI_GATEWAY_URL/KEY), gateway:gemini/<model>:<voice>,\n openai:<model>[:<voice>] (OPENAI_API_KEY / OPENAI_BASE_URL), say[:<voice>] (macOS, offline),\n or ./voice.js. Each step's caption is spoken; the video holds where a line runs long\n --script <file.json> the spoken lines instead: { \"lines\": [{ \"n\": 1, \"text\": \"…\" }] }\n --voice-out <file.wav> also write the narration track\n --voice-strict fail when a line needs a hold longer than 8 s\n --no-voice-cache don't keep spoken lines in .trace-avatar-cache/voice\n\nSuggestions for a person to accept (the renderer never changes a trace):\n trace-avatar-render suggest <trace.json> --task captions|title|waits|narration --ai <provider> [--tone friendly|terse|formal]\n [--hints hints.json] [--out suggestions.json]\n trace-avatar-render apply <trace.json> <suggestions.json> --accept 1,3|all --out <new.trace.json>\n`;\n\nexport interface Parsed { /** --report */ report?: string; trace: string; options: Parameters<typeof render>[0]; /** --ai, made into a provider by main(). */ ai?: string; /** --ai-vision */ aiVision?: string; /** --voice, made into a Voice by main() */ voice?: string; /** --no-voice-cache */ noVoiceCache?: boolean; /** --qa strict */ strict?: boolean }\n\n/** Parse the command line. Throws a usage message (exit 2) on mistakes. Exported for tests. */\nexport function parse(argv: string[]): Parsed {\n // --poster, --title-card and --end-card take an optional value: take it here when one follows (a\n // following *.json is the trace, not the value).\n const extra: { poster?: string | true; title?: string | true; end?: string | true; qa?: string | true } = {};\n const flags: Record<string, 'poster' | 'title' | 'end' | 'qa'> = { '--poster': 'poster', '--title-card': 'title', '--end-card': 'end', '--qa': 'qa' };\n const rest: string[] = [];\n for (let k = 0; k < argv.length; k += 1) {\n const a = argv[k];\n const eq = a.indexOf('=');\n const name = eq > 0 ? a.slice(0, eq) : a;\n if (flags[name]) {\n if (eq > 0) extra[flags[name]] = a.slice(eq + 1);\n else if (argv[k + 1] !== undefined && !argv[k + 1].startsWith('-') && !/\\.json$/i.test(argv[k + 1]) && (flags[name] !== 'qa' || argv[k + 1] === 'strict')) { extra[flags[name]] = argv[k + 1]; k += 1; }\n else extra[flags[name]] = true;\n continue;\n }\n rest.push(a);\n }\n const { values, positionals } = parseArgs({\n args: rest,\n allowPositionals: true,\n options: {\n url: { type: 'string' }, out: { type: 'string', multiple: true }, mode: { type: 'string' },\n 'allow-perform': { type: 'boolean' }, width: { type: 'string' }, fps: { type: 'string' },\n viewport: { type: 'string' }, scale: { type: 'string' }, 'storage-state': { type: 'string' },\n 'max-wait': { type: 'string' }, hide: { type: 'string', multiple: true }, blur: { type: 'string', multiple: true },\n 'allow-stall': { type: 'boolean' }, navigate: { type: 'boolean' }, security: { type: 'string' }, value: { type: 'string', multiple: true }, player: { type: 'string' }, timeline: { type: 'string' },\n timeout: { type: 'string' }, headed: { type: 'boolean' }, help: { type: 'boolean', short: 'h' },\n frame: { type: 'string' }, background: { type: 'string' }, camera: { type: 'boolean' }, zoom: { type: 'string' },\n captions: { type: 'string' }, 'captions-at': { type: 'string' }, ai: { type: 'string' }, 'ai-vision': { type: 'string' }, alt: { type: 'boolean' },\n voice: { type: 'string' }, script: { type: 'string' }, 'voice-out': { type: 'string' }, 'voice-strict': { type: 'boolean' }, 'no-voice-cache': { type: 'boolean' },\n repair: { type: 'boolean' }, 'repair-vision': { type: 'boolean' }, report: { type: 'string' },\n canvas: { type: 'string' }, watermark: { type: 'string' }, 'watermark-at': { type: 'string' }, brand: { type: 'string' },\n },\n });\n if (values.help) throw new UsageError('');\n const trace = positionals[0];\n if (!trace) throw new UsageError('a trace file is needed');\n if (positionals.length > 1) throw new UsageError(`one trace at a time (got ${positionals.join(', ')})`);\n if (!values.url) throw new UsageError('--url is needed');\n if (!values.out?.length) throw new UsageError('--out is needed');\n const num = (name: string, v: string | undefined, min = 0) => {\n if (v === undefined) return undefined;\n const n = Number(v);\n if (!Number.isFinite(n) || n < min) throw new UsageError(`--${name} must be a number ≥ ${min}`);\n return n;\n };\n const mode = values.mode ?? 'overlay';\n if (mode !== 'overlay' && mode !== 'perform') throw new UsageError('--mode is overlay or perform');\n let viewport: { w: number; h: number } | undefined;\n if (values.viewport) {\n const m = /^(\\d+)x(\\d+)$/i.exec(values.viewport);\n if (!m) throw new UsageError('--viewport is WIDTHxHEIGHT, e.g. 1280x800');\n viewport = { w: Number(m[1]), h: Number(m[2]) };\n }\n if (values.frame && values.frame !== 'none' && values.frame !== 'browser') throw new UsageError('--frame is none or browser');\n const captions = values.captions;\n if (captions !== undefined && captions !== 'burn' && captions !== 'vtt' && captions !== 'both') throw new UsageError('--captions is burn, vtt or both');\n const captionsAt = values['captions-at'];\n if (captionsAt !== undefined && captionsAt !== 'top' && captionsAt !== 'bottom') throw new UsageError('--captions-at is top or bottom');\n const zoom = num('zoom', values.zoom, 1);\n if (extra.qa !== undefined && extra.qa !== true && extra.qa !== 'strict') throw new UsageError('--qa takes nothing or strict');\n if ((extra.qa !== undefined || values.alt || values['ai-vision']) && !values.ai) throw new UsageError('--qa, --alt and --ai-vision need --ai');\n if (values['repair-vision'] && !(values.repair && values.ai)) throw new UsageError('--repair-vision needs --repair and --ai');\n if ((values.script || values['voice-out'] || values['voice-strict'] || values['no-voice-cache']) && !values.voice) throw new UsageError('--script, --voice-out, --voice-strict and --no-voice-cache need --voice');\n if (values.voice && !values.out.some((f) => /\\.mp4(@.*)?$/i.test(f))) throw new UsageError('--voice needs an .mp4 output (a GIF has no sound)');\n let security: boolean | string[] | undefined;\n if (values.security !== undefined) {\n const s = values.security.trim().toLowerCase();\n const guards = s === '' || s === 'all' || s === 'true' ? true : s.split(/[\\s,]+/).filter(Boolean);\n if (Array.isArray(guards) && guards.some((g) => !['secrets', 'money', 'files'].includes(g))) throw new UsageError('--security is all, or a list of secrets, money, files');\n security = guards;\n }\n const typed: Record<string, string> = {};\n for (const v of values.value ?? []) {\n const k = v.indexOf('=');\n if (k < 1) throw new UsageError('--value is name=text, e.g. password=demo-pass');\n typed[v.slice(0, k)] = v.slice(k + 1);\n }\n if ((security !== undefined || values.value?.length) && mode !== 'perform') throw new UsageError('--security and --value are for --mode perform');\n const tryUsage = <T>(f: () => T): T => { try { return f(); } catch (e) { throw new UsageError((e as Error).message); } };\n if (values.canvas !== undefined) tryUsage(() => canvasOf(values.canvas!));\n for (const o of values.out ?? []) { const m = /^.+\\.(?:gif|mp4)@(.+)$/i.exec(o); if (m) tryUsage(() => canvasOf(m[1])); }\n const at = values['watermark-at'];\n if (at !== undefined && !CORNERS.includes(at as Corner)) throw new UsageError(`--watermark-at is ${CORNERS.join(', ')}`);\n const brand = values.brand !== undefined ? tryUsage(() => brandFile(values.brand!)) : {};\n let watermark: string | Watermark | undefined = values.watermark !== undefined ? tryUsage(() => watermarkOf(values.watermark!)) : brand.watermark;\n if (at !== undefined) {\n if (watermark === undefined) throw new UsageError('--watermark-at needs a watermark (--watermark, or one in --brand)');\n watermark = { ...(typeof watermark === 'string' ? { text: watermark } : watermark), at: at as Corner };\n }\n const width = num('width', values.width, 16);\n const fps = num('fps', values.fps, 1);\n const maxWait = num('max-wait', values['max-wait']);\n return {\n trace,\n options: {\n // The brand first: the flags below win over it.\n ...brand,\n trace,\n url: values.url,\n mode,\n allowPerform: !!values['allow-perform'],\n out: values.out.map((spec) => {\n const m = /^(.+\\.(?:gif|mp4))@(.+)$/i.exec(spec);\n const file = m ? m[1] : spec;\n return { file, ...(width ? { width } : {}), ...(fps ? { fps } : {}), ...(m ? { canvas: m[2] } : {}) };\n }),\n ...(viewport ? { viewport } : {}),\n ...(values.scale ? { scale: num('scale', values.scale, 1) } : {}),\n ...(values['storage-state'] ? { storageState: values['storage-state'] } : {}),\n ...(maxWait !== undefined ? { cuts: { maxWaitMs: maxWait } } : {}),\n ...(values.hide ? { hide: values.hide } : {}),\n ...(values.blur ? { blur: values.blur } : {}),\n allowStall: !!values['allow-stall'],\n ...(values.navigate ? { navigate: true } : {}),\n ...(security !== undefined ? { security } : {}),\n ...(values.value?.length ? { values: typed } : {}),\n ...(values.player ? { player: values.player } : {}),\n ...(values.timeline ? { timeline: values.timeline } : {}),\n ...(values.timeout ? { timeoutMs: num('timeout', values.timeout, 1) } : {}),\n headless: !values.headed,\n ...(values.frame ? { frame: values.frame as 'none' | 'browser' } : {}),\n ...(values.background ? { background: values.background } : {}),\n ...(zoom ? { camera: { zoom } } : values.camera ? { camera: true } : {}),\n ...(captions ? { captions } : {}),\n ...(captionsAt ? { captionsAt: captionsAt as 'top' | 'bottom' } : {}),\n ...(extra.poster !== undefined ? { poster: extra.poster } : {}),\n ...(extra.title !== undefined ? { titleCard: extra.title } : {}),\n ...(extra.end !== undefined ? { endCard: extra.end } : {}),\n ...(values.canvas !== undefined ? { canvas: values.canvas } : {}),\n ...(watermark !== undefined ? { watermark } : {}),\n ...(extra.qa !== undefined ? { qa: true } : {}),\n ...(values.alt ? { alt: true } : {}),\n ...(values.script ? { script: values.script } : {}),\n ...(values['voice-out'] ? { voiceOut: values['voice-out'] } : {}),\n ...(values['voice-strict'] ? { voiceStrict: true } : {}),\n ...(values.repair ? { repair: true } : {}),\n ...(values['repair-vision'] ? { repairVision: true } : {}),\n },\n ...(values.ai ? { ai: values.ai } : {}),\n ...(values['ai-vision'] ? { aiVision: values['ai-vision'] } : {}),\n ...(values.voice ? { voice: values.voice } : {}),\n ...(values['no-voice-cache'] ? { noVoiceCache: true } : {}),\n ...(extra.qa === 'strict' ? { strict: true } : {}),\n ...(values.report ? { report: values.report } : {}),\n };\n}\n\n/** What --report writes: one guide's outcome, for CI. */\nexport interface Report {\n outcome: 'passed' | 'stalled' | 'failed';\n /** The stalled step (from 0); null otherwise. */\n step: number | null;\n reason: 'not-found' | 'until-timeout' | null;\n /** The stalled step's caption, or the error. */\n message: string | null;\n /** The repair file, when --repair wrote one. */\n repair?: string;\n}\n\n/** The report for a render's outcome (exported for tests). */\nexport function reportOf(err: unknown, traceFile: string, repairFile?: string): Report {\n if (!err) return { outcome: 'passed', step: null, reason: null, message: null };\n const stall = err instanceof RenderError ? err.stall : undefined;\n if (stall && Number.isInteger(stall.index)) {\n let say: string | null = null;\n try { say = ((JSON.parse(readFileSync(traceFile, 'utf8')) as { steps?: Array<{ say?: string }> }).steps?.[stall.index]?.say) ?? null; } catch { /* the error is enough */ }\n return {\n outcome: 'stalled', step: stall.index, reason: stall.reason === 'until-timeout' ? 'until-timeout' : 'not-found',\n message: say ?? (err as Error).message, ...(repairFile && existsSync(repairFile) ? { repair: repairFile } : {}),\n };\n }\n return { outcome: 'failed', step: null, reason: null, message: (err as Error)?.message ?? String(err) };\n}\n\nexport class UsageError extends Error {}\n\nexport async function main(argv: string[], io = { log: console.log, error: console.error }): Promise<number> {\n if (argv[0] === 'suggest' || argv[0] === 'apply') {\n try { return await (argv[0] === 'suggest' ? suggestCmd(argv.slice(1), io) : applyCmd(argv.slice(1), io)); } catch (e) {\n io.error(`trace-avatar-render ${argv[0]}: ${(e as Error).message}`);\n if (e instanceof UsageError) io.error(USAGE);\n return e instanceof UsageError ? 2 : 1;\n }\n }\n let p: Parsed;\n try { p = parse(argv); } catch (e) {\n const msg = (e as Error).message;\n if (msg) io.error(`trace-avatar-render: ${msg}\\n`);\n io.error(USAGE);\n return e instanceof UsageError && !msg ? 0 : 2;\n }\n try {\n if (p.ai) p.options.ai = await providerOf(p.ai, process.env, p.aiVision ? { vision: p.aiVision } : {});\n if (p.voice) p.options.voice = await voiceOf(p.voice, process.env, p.noVoiceCache ? { cacheDir: null } : {});\n const r = await render(p.options);\n for (const o of r.outputs) io.log(`${o.file} ${o.width}×${o.height} ${o.fps} fps ${(r.durationMs / 1000).toFixed(1)} s ${(o.bytes / 1024).toFixed(0)} KB`);\n if (r.rawMs > r.durationMs + 50) io.log(`cut ${((r.rawMs - r.durationMs) / 1000).toFixed(1)} s of waiting`);\n for (const f of [r.poster, r.vtt, r.chapters, r.alt]) if (f) io.log(f);\n if (r.narration) {\n io.log(`narration: ${r.narration.lines.length} line${r.narration.lines.length === 1 ? '' : 's'}${r.narration.holdMs ? `, the video holds ${(r.narration.holdMs / 1000).toFixed(1)} s for them` : ''} ${r.narration.text}`);\n if (r.narration.wav) io.log(r.narration.wav);\n }\n for (const w of r.warnings ?? []) io.error(`warning: ${w}`);\n if (p.report) writeFileSync(p.report, `${JSON.stringify(reportOf(null, p.trace), null, 2)}\\n`);\n if (r.qa) {\n if (!r.qa.length) io.log('qa: nothing flagged');\n for (const f of r.qa) io.log(`qa: ${(f.at / 1000).toFixed(1)} s ${f.kind} ${f.note}`);\n if (p.strict && r.qa.length) { io.error(`trace-avatar-render: qa flagged ${r.qa.length} problem${r.qa.length > 1 ? 's' : ''} (--qa strict)`); return 1; }\n }\n return 0;\n } catch (e) {\n io.error(`trace-avatar-render: ${(e as Error).message}`);\n if (p.report) {\n const first = p.options.out[0];\n const base = (typeof first === 'string' ? first : first.file).replace(/\\.[^./]+$/, '');\n writeFileSync(p.report, `${JSON.stringify(reportOf(e, p.trace, `${base}.repair.json`), null, 2)}\\n`);\n }\n if (e instanceof RenderError && e.screenshot) {\n const first = p.options.out[0];\n const shot = `${(typeof first === 'string' ? first : first.file).replace(/\\.[^./]+$/, '')}.failure.png`;\n writeFileSync(shot, e.screenshot);\n io.error(`the page at that moment: ${shot}`);\n }\n return 1;\n }\n}\n\nconst readJson = (file: string): unknown => {\n try { return JSON.parse(readFileSync(file, 'utf8')); } catch (e) { throw new Error(`could not read ${file}: ${(e as Error).message}`); }\n};\n\n/** suggest <trace.json> --task … --ai …: suggestions, numbered, as JSON (stdout or --out). */\nasync function suggestCmd(argv: string[], io: { log: (m: string) => void }): Promise<number> {\n const { values, positionals } = parseArgs({ args: argv, allowPositionals: true, options: {\n task: { type: 'string' }, ai: { type: 'string' }, tone: { type: 'string' }, hints: { type: 'string' }, out: { type: 'string' }, 'send-typed': { type: 'boolean' },\n } });\n const [file] = positionals;\n if (!file) throw new UsageError('suggest needs a trace file');\n const task = values.task;\n if (task !== 'captions' && task !== 'title' && task !== 'waits' && task !== 'narration') throw new UsageError('--task is captions, title, waits or narration');\n if (!values.ai) throw new UsageError('suggest needs --ai');\n if (task === 'narration') {\n // A script file for --script: a person edits it before rendering.\n const r = await suggestScript(await providerOf(values.ai), readJson(file) as Parameters<typeof suggestScript>[1]);\n const out = JSON.stringify({ ...r.script, ...(r.dropped.length ? { dropped: r.dropped } : {}) }, null, 2);\n if (values.out) { writeFileSync(values.out, `${out}\\n`); io.log(`${r.script.lines.length} line${r.script.lines.length === 1 ? '' : 's'} in ${values.out}: edit them, then --script ${values.out}`); } else io.log(out);\n return 0;\n }\n const tone = values.tone;\n if (tone !== undefined && tone !== 'friendly' && tone !== 'terse' && tone !== 'formal') throw new UsageError('--tone is friendly, terse or formal');\n const trace = readJson(file) as Parameters<typeof suggest>[1];\n const hints = values.hints ? (readJson(values.hints) as Parameters<typeof suggest>[2]['hints']) : undefined;\n const r = await suggest(task, trace, { ai: await providerOf(values.ai), ...(hints ? { hints } : {}), ...(tone ? { tone } : {}), ...(values['send-typed'] ? { sendTyped: true } : {}) });\n const out = JSON.stringify({ task, suggestions: r.suggestions.map((sg, k) => ({ id: k + 1, ...sg })), dropped: r.dropped }, null, 2);\n if (values.out) { writeFileSync(values.out, `${out}\\n`); io.log(`${r.suggestions.length} suggestion${r.suggestions.length === 1 ? '' : 's'} in ${values.out}`); } else io.log(out);\n return 0;\n}\n\n/** apply <trace.json> <suggestions.json> --accept 1,3|all --out new.trace.json */\nasync function applyCmd(argv: string[], io: { log: (m: string) => void }): Promise<number> {\n const { values, positionals } = parseArgs({ args: argv, allowPositionals: true, options: { accept: { type: 'string' }, out: { type: 'string' } } });\n const [file, sugFile] = positionals;\n if (!file || !sugFile) throw new UsageError('apply needs a trace file and a suggestions file');\n if (!values.accept) throw new UsageError('apply needs --accept 1,3 (or all): a person picks what goes in');\n if (!values.out) throw new UsageError('apply needs --out for the new trace');\n const all = (readJson(sugFile) as { suggestions?: Array<Suggestion & { id: number }> }).suggestions ?? [];\n const ids = values.accept === 'all' ? all.map((x) => x.id) : values.accept.split(',').map((x) => Number(x.trim()));\n const missing = ids.filter((id) => !all.some((x) => x.id === id));\n if (missing.length) throw new UsageError(`no suggestion ${missing.join(', ')} in ${sugFile}`);\n const next = applySuggestions(readJson(file) as Parameters<typeof applySuggestions>[0], all.filter((x) => ids.includes(x.id)));\n writeFileSync(values.out, `${JSON.stringify(next, null, 2)}\\n`);\n io.log(`applied ${ids.length} of ${all.length} to ${values.out}`);\n return 0;\n}\n\nconst isMain = import.meta.url === `file://${process.argv[1]}` || process.argv[1]?.endsWith('/trace-avatar-render') || process.argv[1]?.endsWith('/cli.js');\nif (isMain) void main(process.argv.slice(2)).then((code) => { process.exitCode = code; });\n"],"mappings":";;;;;;;;;;;;;;AAOA,SAAS,YAAY,cAAc,qBAAqB;AACxD,SAAS,SAAS,kBAAkB,eAAe;AAKnD,SAAS,iBAAiB;AAMnB,IAAM,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA2Ed,SAAS,MAAM,MAAwB;AAG5C,QAAM,QAAoG,CAAC;AAC3G,QAAM,QAA2D,EAAE,YAAY,UAAU,gBAAgB,SAAS,cAAc,OAAO,QAAQ,KAAK;AACpJ,QAAM,OAAiB,CAAC;AACxB,WAAS,IAAI,GAAG,IAAI,KAAK,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