@writepanda/cli 1.339.0 → 1.344.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/README.md CHANGED
@@ -119,6 +119,12 @@ English, Parakeet's European set and the Whisper languages. Provider is
119
119
  Cloud needs a connected key and user consent to upload audio. Surface job `warnings`
120
120
  when a network/provider failure caused a local fallback.
121
121
 
122
+ ### Tidy cuts a few frames apart
123
+
124
+ `pandastudio project.tidy-cuts --id=PROJECT [--dryRun=true] [--windowMs=400] [--regions=false] --json`
125
+
126
+ Resolves the stutters editing verbs warn about ("Two picture changes N frames apart"). Two cuts closer than `windowMs` (default 400) with nothing heard between them become one cut; with a word heard between them, the cuts give back just enough pause for the word to play as its own shot (cut words never come back), else the pair is listed in `unresolved`. With `regions` (default true), zoom / camera-move / layout / overlay edges a few frames off a cut move onto it. `--dryRun=true` reports without writing. Returns `{ merged, widened, regionsSnapped, changes, regionSnaps, unresolved, stuttersBefore, stuttersAfter, remaining, revision }`. One revision; `expectedRevision` is supported. MCP: `project_tidy_cuts`.
127
+
122
128
  ### Close a timeline gap
123
129
 
124
130
  `pandastudio project.close-gap --id=PROJECT --startMs=2500 --endMs=4000 --lane=media:0 --json`
@@ -40,7 +40,7 @@ for (const stream of [process.stdout, process.stderr]) {
40
40
  });
41
41
  }
42
42
 
43
- const VERSION = "1.339.0";
43
+ const VERSION = "1.344.0";
44
44
 
45
45
  function configDir() {
46
46
  // PANDASTUDIO_CONFIG_DIR mirrors the override the main process
@@ -80,6 +80,8 @@ USAGE
80
80
  pandastudio motion.save-preset --source=@generatedFrom.json --name="Client A lower third" --variables=@values.json
81
81
  pandastudio motion.list-presets --templateId=creator-card
82
82
  pandastudio motion.delete-preset --templateId=creator-card --name="Client A lower third"
83
+ pandastudio motion.place-scene --id=ID --scenePath=/abs/room.scene.json --atMs=0 3D scene live on the timeline, no render
84
+ pandastudio motion.render-scene-graphic --id=ID --overlayId=OVERLAY --mode=final --estimate=true
83
85
  pandastudio commands List every available verb.noun
84
86
 
85
87
  OPTIONS
@@ -110,7 +112,16 @@ DOCS
110
112
  }
111
113
 
112
114
  function parseArgv(argv) {
113
- const args = { _: [], flags: {}, rawFlags: {}, json: false, noLaunch: false, timeoutSeconds: 60 };
115
+ const args = {
116
+ _: [],
117
+ flags: {},
118
+ rawFlags: {},
119
+ /** Flags given more than once: their values became a list. */
120
+ repeated: new Set(),
121
+ json: false,
122
+ noLaunch: false,
123
+ timeoutSeconds: 60,
124
+ };
114
125
  for (let i = 0; i < argv.length; i++) {
115
126
  const raw = argv[i];
116
127
  if (raw === "--help" || raw === "-h") {
@@ -150,8 +161,22 @@ function parseArgv(argv) {
150
161
  } else {
151
162
  const key = raw.slice(2, eq);
152
163
  const value = raw.slice(eq + 1);
153
- args.rawFlags[key] = value;
154
- args.flags[key] = parseScalar(value);
164
+ if (Object.hasOwn(args.rawFlags, key)) {
165
+ // The same flag again builds a list: --withMedia=a.mp4
166
+ // --withMedia=b.mp4 sends withMedia: ["a.mp4", "b.mp4"]. The
167
+ // shell-proof way to pass an array (PowerShell strips the
168
+ // quotes out of inline JSON like --withMedia=["a","b"]).
169
+ if (!args.repeated.has(key)) {
170
+ args.repeated.add(key);
171
+ args.rawFlags[key] = [args.rawFlags[key]];
172
+ args.flags[key] = [args.flags[key]];
173
+ }
174
+ args.rawFlags[key].push(value);
175
+ args.flags[key].push(parseScalar(value));
176
+ } else {
177
+ args.rawFlags[key] = value;
178
+ args.flags[key] = parseScalar(value);
179
+ }
155
180
  }
156
181
  } else if (
157
182
  args._.length > 0 &&
@@ -242,6 +267,8 @@ Inline, if you must:
242
267
  cmd.exe: "--keyframes=[{\\"timeMs\\":0}]"
243
268
  Windows PowerShell 5.1: '--keyframes=[{\\"timeMs\\":0}]'
244
269
  PowerShell 7.3+: '--keyframes=[{"timeMs":0}]'
270
+ A list can also be given one item per flag, with no JSON at all:
271
+ --withMedia=C:\\clips\\a.mp4 --withMedia=C:\\clips\\b.mp4 sends withMedia: [a, b]
245
272
  Add --dry-run to print the exact arguments that would be sent, without calling the app.
246
273
  A literal value starting with @ is written @@ (--text=@@handle sends "@handle").`;
247
274
 
@@ -291,11 +318,11 @@ export async function resolveArgs(opts, { readStdin, cwd = process.cwd() } = {})
291
318
  if (opts.argsStdin) {
292
319
  Object.assign(out, readJsonObject(await readStdinText(), "--args-stdin input"));
293
320
  }
294
- for (const [key, value] of Object.entries(opts.flags)) {
295
- const raw = opts.rawFlags?.[key];
296
- if (typeof raw === "string" && raw.startsWith("@@")) {
297
- out[key] = raw.slice(1);
298
- } else if (typeof raw === "string" && raw.length > 1 && raw.startsWith("@")) {
321
+ // One flag's value: `@path` read from a file, `@@x` the literal "@x",
322
+ // JSON a Windows shell mangled refused, anything else as parsed.
323
+ const resolveFlag = async (key, raw, value) => {
324
+ if (typeof raw === "string" && raw.startsWith("@@")) return raw.slice(1);
325
+ if (typeof raw === "string" && raw.length > 1 && raw.startsWith("@")) {
299
326
  const p = path.resolve(cwd, raw.slice(1));
300
327
  let text;
301
328
  try {
@@ -307,19 +334,29 @@ export async function resolveArgs(opts, { readStdin, cwd = process.cwd() } = {})
307
334
  }
308
335
  const trimmed = text.replace(/^/, "").replace(/\r?\n$/, "");
309
336
  try {
310
- out[key] = JSON.parse(trimmed);
337
+ return JSON.parse(trimmed);
311
338
  } catch {
312
339
  const why = detectMangledJson(trimmed);
313
340
  if (why)
314
341
  throw new Error(`--${key}=@${raw.slice(1)}: the file is not valid JSON (${why}).`);
315
- out[key] = trimmed;
342
+ return trimmed;
316
343
  }
317
- } else if (typeof raw === "string" && detectMangledJson(raw)) {
344
+ }
345
+ if (typeof raw === "string" && detectMangledJson(raw)) {
318
346
  throw new Error(
319
347
  `--${key}=${raw} looks like JSON that the shell changed: ${detectMangledJson(raw)}. Nothing was sent.\n\n${WINDOWS_QUOTING_HELP}`,
320
348
  );
349
+ }
350
+ return value;
351
+ };
352
+ for (const [key, value] of Object.entries(opts.flags)) {
353
+ const raw = opts.rawFlags?.[key];
354
+ if (opts.repeated?.has(key) && Array.isArray(raw) && Array.isArray(value)) {
355
+ const list = [];
356
+ for (let i = 0; i < raw.length; i++) list.push(await resolveFlag(key, raw[i], value[i]));
357
+ out[key] = list;
321
358
  } else {
322
- out[key] = value;
359
+ out[key] = await resolveFlag(key, raw, value);
323
360
  }
324
361
  }
325
362
  } catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@writepanda/cli",
3
- "version": "1.339.0",
3
+ "version": "1.344.0",
4
4
  "description": "Drive PandaStudio (a desktop video editor for YouTube creators) from the command line. Talks to a localhost HTTP API the desktop app exposes.",
5
5
  "keywords": [
6
6
  "pandastudio",