@writepanda/cli 1.338.0 → 1.343.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 +6 -0
- package/bin/pandastudio.mjs +48 -13
- package/package.json +1 -1
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`
|
package/bin/pandastudio.mjs
CHANGED
|
@@ -40,7 +40,7 @@ for (const stream of [process.stdout, process.stderr]) {
|
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
const VERSION = "1.
|
|
43
|
+
const VERSION = "1.343.0";
|
|
44
44
|
|
|
45
45
|
function configDir() {
|
|
46
46
|
// PANDASTUDIO_CONFIG_DIR mirrors the override the main process
|
|
@@ -110,7 +110,16 @@ DOCS
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
function parseArgv(argv) {
|
|
113
|
-
const args = {
|
|
113
|
+
const args = {
|
|
114
|
+
_: [],
|
|
115
|
+
flags: {},
|
|
116
|
+
rawFlags: {},
|
|
117
|
+
/** Flags given more than once: their values became a list. */
|
|
118
|
+
repeated: new Set(),
|
|
119
|
+
json: false,
|
|
120
|
+
noLaunch: false,
|
|
121
|
+
timeoutSeconds: 60,
|
|
122
|
+
};
|
|
114
123
|
for (let i = 0; i < argv.length; i++) {
|
|
115
124
|
const raw = argv[i];
|
|
116
125
|
if (raw === "--help" || raw === "-h") {
|
|
@@ -150,8 +159,22 @@ function parseArgv(argv) {
|
|
|
150
159
|
} else {
|
|
151
160
|
const key = raw.slice(2, eq);
|
|
152
161
|
const value = raw.slice(eq + 1);
|
|
153
|
-
args.rawFlags
|
|
154
|
-
|
|
162
|
+
if (Object.hasOwn(args.rawFlags, key)) {
|
|
163
|
+
// The same flag again builds a list: --withMedia=a.mp4
|
|
164
|
+
// --withMedia=b.mp4 sends withMedia: ["a.mp4", "b.mp4"]. The
|
|
165
|
+
// shell-proof way to pass an array (PowerShell strips the
|
|
166
|
+
// quotes out of inline JSON like --withMedia=["a","b"]).
|
|
167
|
+
if (!args.repeated.has(key)) {
|
|
168
|
+
args.repeated.add(key);
|
|
169
|
+
args.rawFlags[key] = [args.rawFlags[key]];
|
|
170
|
+
args.flags[key] = [args.flags[key]];
|
|
171
|
+
}
|
|
172
|
+
args.rawFlags[key].push(value);
|
|
173
|
+
args.flags[key].push(parseScalar(value));
|
|
174
|
+
} else {
|
|
175
|
+
args.rawFlags[key] = value;
|
|
176
|
+
args.flags[key] = parseScalar(value);
|
|
177
|
+
}
|
|
155
178
|
}
|
|
156
179
|
} else if (
|
|
157
180
|
args._.length > 0 &&
|
|
@@ -242,6 +265,8 @@ Inline, if you must:
|
|
|
242
265
|
cmd.exe: "--keyframes=[{\\"timeMs\\":0}]"
|
|
243
266
|
Windows PowerShell 5.1: '--keyframes=[{\\"timeMs\\":0}]'
|
|
244
267
|
PowerShell 7.3+: '--keyframes=[{"timeMs":0}]'
|
|
268
|
+
A list can also be given one item per flag, with no JSON at all:
|
|
269
|
+
--withMedia=C:\\clips\\a.mp4 --withMedia=C:\\clips\\b.mp4 sends withMedia: [a, b]
|
|
245
270
|
Add --dry-run to print the exact arguments that would be sent, without calling the app.
|
|
246
271
|
A literal value starting with @ is written @@ (--text=@@handle sends "@handle").`;
|
|
247
272
|
|
|
@@ -291,11 +316,11 @@ export async function resolveArgs(opts, { readStdin, cwd = process.cwd() } = {})
|
|
|
291
316
|
if (opts.argsStdin) {
|
|
292
317
|
Object.assign(out, readJsonObject(await readStdinText(), "--args-stdin input"));
|
|
293
318
|
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
319
|
+
// One flag's value: `@path` read from a file, `@@x` the literal "@x",
|
|
320
|
+
// JSON a Windows shell mangled refused, anything else as parsed.
|
|
321
|
+
const resolveFlag = async (key, raw, value) => {
|
|
322
|
+
if (typeof raw === "string" && raw.startsWith("@@")) return raw.slice(1);
|
|
323
|
+
if (typeof raw === "string" && raw.length > 1 && raw.startsWith("@")) {
|
|
299
324
|
const p = path.resolve(cwd, raw.slice(1));
|
|
300
325
|
let text;
|
|
301
326
|
try {
|
|
@@ -307,19 +332,29 @@ export async function resolveArgs(opts, { readStdin, cwd = process.cwd() } = {})
|
|
|
307
332
|
}
|
|
308
333
|
const trimmed = text.replace(/^/, "").replace(/\r?\n$/, "");
|
|
309
334
|
try {
|
|
310
|
-
|
|
335
|
+
return JSON.parse(trimmed);
|
|
311
336
|
} catch {
|
|
312
337
|
const why = detectMangledJson(trimmed);
|
|
313
338
|
if (why)
|
|
314
339
|
throw new Error(`--${key}=@${raw.slice(1)}: the file is not valid JSON (${why}).`);
|
|
315
|
-
|
|
340
|
+
return trimmed;
|
|
316
341
|
}
|
|
317
|
-
}
|
|
342
|
+
}
|
|
343
|
+
if (typeof raw === "string" && detectMangledJson(raw)) {
|
|
318
344
|
throw new Error(
|
|
319
345
|
`--${key}=${raw} looks like JSON that the shell changed: ${detectMangledJson(raw)}. Nothing was sent.\n\n${WINDOWS_QUOTING_HELP}`,
|
|
320
346
|
);
|
|
347
|
+
}
|
|
348
|
+
return value;
|
|
349
|
+
};
|
|
350
|
+
for (const [key, value] of Object.entries(opts.flags)) {
|
|
351
|
+
const raw = opts.rawFlags?.[key];
|
|
352
|
+
if (opts.repeated?.has(key) && Array.isArray(raw) && Array.isArray(value)) {
|
|
353
|
+
const list = [];
|
|
354
|
+
for (let i = 0; i < raw.length; i++) list.push(await resolveFlag(key, raw[i], value[i]));
|
|
355
|
+
out[key] = list;
|
|
321
356
|
} else {
|
|
322
|
-
out[key] = value;
|
|
357
|
+
out[key] = await resolveFlag(key, raw, value);
|
|
323
358
|
}
|
|
324
359
|
}
|
|
325
360
|
} catch (err) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@writepanda/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.343.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",
|