@nodaro/cli 1.20.0 → 1.23.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 +22 -13
- package/dist/index.js +454 -8
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -23,28 +23,37 @@ Requires Node.js ≥ 20.
|
|
|
23
23
|
|
|
24
24
|
### Option B — standalone binary (no Node required, ~10ms cold start)
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
CLI releases are tagged `cli-vX.Y.Z`. This repository's **"latest" release is the app's**, not the CLI's, so a `releases/latest/download/…` link never reaches a CLI binary. Resolve the newest `cli-v*` tag first, then download from it:
|
|
27
27
|
|
|
28
28
|
```bash
|
|
29
|
-
#
|
|
30
|
-
curl -
|
|
31
|
-
-o /
|
|
29
|
+
# 1. The newest CLI version (e.g. 1.20.0)
|
|
30
|
+
NODARO_CLI_VERSION=$(curl -fsSL "https://api.github.com/repos/nodaroai/app.nodaro.ai/git/matching-refs/tags/cli-v?per_page=100" \
|
|
31
|
+
| grep -o '"refs/tags/cli-v[0-9][0-9.]*"' | tr -d '"' | sed 's#refs/tags/cli-v##' \
|
|
32
|
+
| sort -t. -k1,1n -k2,2n -k3,3n | tail -n 1)
|
|
33
|
+
echo "Installing @nodaro/cli $NODARO_CLI_VERSION"
|
|
32
34
|
|
|
33
|
-
#
|
|
34
|
-
|
|
35
|
-
-o /usr/local/bin/nodaro && chmod +x /usr/local/bin/nodaro
|
|
35
|
+
# 2. Your platform: darwin-arm64 (Apple Silicon) · darwin-x64 (Intel Mac) · linux-x64 · linux-arm64
|
|
36
|
+
NODARO_CLI_PLATFORM=darwin-arm64
|
|
36
37
|
|
|
37
|
-
#
|
|
38
|
-
curl -
|
|
38
|
+
# 3. Download. -f fails on an HTTP error instead of saving the error page as the binary.
|
|
39
|
+
curl -fL "https://github.com/nodaroai/app.nodaro.ai/releases/download/cli-v$NODARO_CLI_VERSION/nodaro-$NODARO_CLI_PLATFORM" \
|
|
39
40
|
-o /usr/local/bin/nodaro && chmod +x /usr/local/bin/nodaro
|
|
41
|
+
nodaro --version
|
|
42
|
+
```
|
|
40
43
|
|
|
41
|
-
|
|
42
|
-
curl -L https://github.com/nodaroai/app.nodaro.ai/releases/latest/download/nodaro-linux-arm64 \
|
|
43
|
-
-o /usr/local/bin/nodaro && chmod +x /usr/local/bin/nodaro
|
|
44
|
+
Windows (PowerShell):
|
|
44
45
|
|
|
45
|
-
|
|
46
|
+
```powershell
|
|
47
|
+
$v = (Invoke-RestMethod "https://api.github.com/repos/nodaroai/app.nodaro.ai/git/matching-refs/tags/cli-v?per_page=100") |
|
|
48
|
+
ForEach-Object { $_.ref -replace '^refs/tags/cli-v', '' } |
|
|
49
|
+
Where-Object { $_ -match '^\d+\.\d+\.\d+$' } |
|
|
50
|
+
Sort-Object { [version]$_ } | Select-Object -Last 1
|
|
51
|
+
Invoke-WebRequest "https://github.com/nodaroai/app.nodaro.ai/releases/download/cli-v$v/nodaro-windows-x64.exe" -OutFile nodaro.exe
|
|
52
|
+
.\nodaro.exe --version
|
|
46
53
|
```
|
|
47
54
|
|
|
55
|
+
To pin a version, skip step 1 and set `NODARO_CLI_VERSION` yourself. Every CLI release and its binaries: [releases tagged `cli-v`](https://github.com/nodaroai/app.nodaro.ai/releases?q=cli-v).
|
|
56
|
+
|
|
48
57
|
Binaries are ~60 MB single-file executables compiled with [`bun build --compile`](https://bun.com/docs/bundler/executables) — no dependencies, no Node runtime needed. Cold-start is ~15× faster than the npm version.
|
|
49
58
|
|
|
50
59
|
## Authentication
|
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import { createClient, StaticTokenAuth, UnauthorizedError, NodaroError, LOCATION
|
|
|
13
13
|
import select from '@inquirer/select';
|
|
14
14
|
import checkbox from '@inquirer/checkbox';
|
|
15
15
|
import input from '@inquirer/input';
|
|
16
|
-
import { CHARACTER_STYLES, OVERLAY_ANCHORS, OVERLAY_PLATFORM_IDS } from '@nodaro/shared';
|
|
16
|
+
import { CHARACTER_STYLES, TRANSCRIBE_PROVIDERS, transcribeLaneSupportsWordTimestamps, ALL_CAPTION_STYLES, DEFAULT_CAPTION_LOOK, CAPTION_LOOK_IDS, CAPTION_MAX_WORDS_PER_LINE_MIN, CAPTION_MAX_WORDS_PER_LINE_MAX, TRANSCRIBE_LANES, SUPPORTED_FONT_NAMES, OVERLAY_ANCHORS, OVERLAY_PLATFORM_IDS, VIDEO_OVERLAY_PRESET_IDS, VIDEO_OVERLAY_CORNERS, VIDEO_OVERLAY_OUTPUT_ASPECTS, isVideoOverlayPresetId, isVideoOverlayCorner, isVideoOverlayOutputAspect, VIDEO_OVERLAY_FITS, DEFAULT_TRANSCRIBE_PROVIDER } from '@nodaro/shared';
|
|
17
17
|
|
|
18
18
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
19
19
|
var __commonJS = (cb, mod) => function __require() {
|
|
@@ -29,7 +29,7 @@ var require_package = __commonJS({
|
|
|
29
29
|
"package.json"(exports$1, module) {
|
|
30
30
|
module.exports = {
|
|
31
31
|
name: "@nodaro/cli",
|
|
32
|
-
version: "1.
|
|
32
|
+
version: "1.23.0",
|
|
33
33
|
description: "Command-line interface for Nodaro \u2014 list and run workflows, inspect jobs and executions, manage projects from the terminal.",
|
|
34
34
|
type: "module",
|
|
35
35
|
license: "Apache-2.0",
|
|
@@ -70,11 +70,11 @@ var require_package = __commonJS({
|
|
|
70
70
|
"@inquirer/confirm": "^6.0.12",
|
|
71
71
|
"@inquirer/input": "^5.0.12",
|
|
72
72
|
"@inquirer/select": "^5.1.4",
|
|
73
|
-
"@nodaro/sdk": "^2.
|
|
74
|
-
"@nodaro/shared": "^3.
|
|
73
|
+
"@nodaro/sdk": "^2.16.0",
|
|
74
|
+
"@nodaro/shared": "^3.13.0",
|
|
75
75
|
commander: "^12.1.0",
|
|
76
76
|
picocolors: "^1.1.1",
|
|
77
|
-
"@nodaro/prompts": "^1.
|
|
77
|
+
"@nodaro/prompts": "^1.26.0"
|
|
78
78
|
},
|
|
79
79
|
devDependencies: {
|
|
80
80
|
tsup: "^8.5.0",
|
|
@@ -398,7 +398,7 @@ function saveWorkspace(profileName, workspaceId) {
|
|
|
398
398
|
}
|
|
399
399
|
|
|
400
400
|
// src/client.ts
|
|
401
|
-
var CLI_VERSION = "1.
|
|
401
|
+
var CLI_VERSION = "1.23.0" ;
|
|
402
402
|
function buildClient(profileName) {
|
|
403
403
|
const { name, profile } = getProfile(profileName);
|
|
404
404
|
if (!profile) {
|
|
@@ -2283,6 +2283,26 @@ function parseSection(raw) {
|
|
|
2283
2283
|
}
|
|
2284
2284
|
return { sectionStartSec: start, sectionEndSec: end };
|
|
2285
2285
|
}
|
|
2286
|
+
function parseAt(raw) {
|
|
2287
|
+
const m = raw.match(/^([0-9]+(?:\.[0-9]+)?)(?:-([0-9]+(?:\.[0-9]+)?))?$/);
|
|
2288
|
+
const start = m ? parseFloat(m[1]) : NaN;
|
|
2289
|
+
const end = m && m[2] !== void 0 ? parseFloat(m[2]) : void 0;
|
|
2290
|
+
if (!m || end !== void 0 && !(end > start)) {
|
|
2291
|
+
warn(`--at must be "<start>" or "<start>-<end>" in seconds with start < end (got "${raw}")`);
|
|
2292
|
+
process.exit(1);
|
|
2293
|
+
}
|
|
2294
|
+
return end === void 0 ? { start } : { start, end };
|
|
2295
|
+
}
|
|
2296
|
+
function parseMaxWordsPerLine(raw) {
|
|
2297
|
+
const n = Number(raw);
|
|
2298
|
+
if (!Number.isInteger(n) || n < CAPTION_MAX_WORDS_PER_LINE_MIN || n > CAPTION_MAX_WORDS_PER_LINE_MAX) {
|
|
2299
|
+
warn(
|
|
2300
|
+
`--max-words-per-line must be a whole number ${CAPTION_MAX_WORDS_PER_LINE_MIN}-${CAPTION_MAX_WORDS_PER_LINE_MAX} (got "${raw}")`
|
|
2301
|
+
);
|
|
2302
|
+
process.exit(1);
|
|
2303
|
+
}
|
|
2304
|
+
return n;
|
|
2305
|
+
}
|
|
2286
2306
|
function parseCanvas(raw) {
|
|
2287
2307
|
const m = raw.match(/^([0-9]{2,4})x([0-9]{2,4})$/i);
|
|
2288
2308
|
if (!m) {
|
|
@@ -2291,6 +2311,20 @@ function parseCanvas(raw) {
|
|
|
2291
2311
|
}
|
|
2292
2312
|
return { width: parseInt(m[1], 10), height: parseInt(m[2], 10) };
|
|
2293
2313
|
}
|
|
2314
|
+
function readJsonArrayFile(path, flag) {
|
|
2315
|
+
let parsed;
|
|
2316
|
+
try {
|
|
2317
|
+
parsed = JSON.parse(readFileSync(path, "utf8"));
|
|
2318
|
+
} catch (err) {
|
|
2319
|
+
warn(`${flag} ${path} could not be read as JSON: ${err.message}`);
|
|
2320
|
+
process.exit(1);
|
|
2321
|
+
}
|
|
2322
|
+
if (!Array.isArray(parsed) || parsed.length === 0) {
|
|
2323
|
+
warn(`${flag} must contain a non-empty JSON array (${path})`);
|
|
2324
|
+
process.exit(1);
|
|
2325
|
+
}
|
|
2326
|
+
return parsed;
|
|
2327
|
+
}
|
|
2294
2328
|
function parseSafeArea(raw) {
|
|
2295
2329
|
const parts = raw.split(",").map((n) => parseFloat(n.trim()));
|
|
2296
2330
|
if (parts.length !== 4 || parts.some((n) => !Number.isFinite(n) || n < 0 || n > 1)) {
|
|
@@ -2302,7 +2336,7 @@ function parseSafeArea(raw) {
|
|
|
2302
2336
|
}
|
|
2303
2337
|
function mediaCommand() {
|
|
2304
2338
|
const cmd = new Command("media").description(
|
|
2305
|
-
"media ingestion + compositing \u2014 pull a social video into storage, trim video/audio, still-to-video, slideshow, collage images, overlay layers on an image, save a URL to storage, probe metadata"
|
|
2339
|
+
"media ingestion + compositing \u2014 pull a social video into storage, trim video/audio, burn captions, still-to-video, slideshow, collage images, overlay layers on an image or timed images on a video, save a URL to storage, probe metadata"
|
|
2306
2340
|
);
|
|
2307
2341
|
cmd.command("download <url>").description("download a social video (YouTube / TikTok / Instagram / X / Facebook) into your storage").option("--max-height <px>", "cap the resolution (e.g. 720); omit for best available", (v) => parseInt(v, 10)).option("--section <a-b>", 'fetch ONLY this time range in seconds (e.g. "30-90"); the cut lands on keyframes, so pad and trim after').option("--watch", "stream the download's live progress until it completes").option("--profile <name>").option("--json").addHelpText("after", `
|
|
2308
2342
|
Examples:
|
|
@@ -2486,6 +2520,113 @@ Example:
|
|
|
2486
2520
|
}
|
|
2487
2521
|
}
|
|
2488
2522
|
);
|
|
2523
|
+
cmd.command("add-captions <videoUrl>").description(
|
|
2524
|
+
"burn captions into a video \u2014 static subtitles, or a kinetic word-highlight / karaoke / tiktok-words / word-pop / bouncy render"
|
|
2525
|
+
).option("--text <text>", "the caption text \u2014 spaced evenly across the video when no word timings are given").option(
|
|
2526
|
+
"--captions-file <path>",
|
|
2527
|
+
"JSON array of word-timed entries [{ text, startMs, endMs }] \u2014 one per WORD for the kinetic styles; a transcribe job's output_data.words drops in verbatim"
|
|
2528
|
+
).option("--style <style>", `caption style: ${ALL_CAPTION_STYLES.join(" | ")} (default subtitle)`).option(
|
|
2529
|
+
"--look <look>",
|
|
2530
|
+
`kinetic look preset: ${CAPTION_LOOK_IDS.join(" | ")} \u2014 an unset look renders as ${DEFAULT_CAPTION_LOOK}; the levers below override its individual fields`
|
|
2531
|
+
).option("--position <pos>", "bottom (default) | top | center").option("--position-y <pct>", "the caption block's CENTRE as % of height (0-100) \u2014 overrides --position", parseFloat).option("--font-size <px>", "font size in px (12-200)", parseFloat).option("--font-family <name>", "font face \u2014 see the list below").option("--font-weight <n>", "CSS font weight, 100-900 in 100s", (v) => parseInt(v, 10)).option("--color <color>", "caption text colour").option("--background-color <color>", "caption background colour").option("--stroke-color <color>", "outline colour").option("--stroke-width <px>", "outline width in px, 0-40", parseFloat).option("--highlight-color <color>", "colour of the word being spoken (kinetic styles only)").option("--uppercase", "force UPPERCASE captions").option("--no-uppercase", "keep mixed case (the default outline look is UPPERCASE)").option(
|
|
2532
|
+
"--max-words-per-line <n>",
|
|
2533
|
+
`cap the words on one caption line (or tiktok-words page), ${CAPTION_MAX_WORDS_PER_LINE_MIN}-${CAPTION_MAX_WORDS_PER_LINE_MAX} \u2014 unset fits the frame width`
|
|
2534
|
+
).option("--animate", "animate per-word motion on the kinetic styles (the default)").option(
|
|
2535
|
+
"--no-animate",
|
|
2536
|
+
"freeze per-word motion on the kinetic styles \u2014 keeps grouping, line-holding and the spoken-word highlight (kinetic styles only)"
|
|
2537
|
+
).option("--no-auto-transcribe", "do NOT transcribe the video's audio when no --text / --captions-file is given").option("--transcribe-provider <name>", `engine for the auto-transcription: ${TRANSCRIBE_LANES.join(" | ")}`).option(
|
|
2538
|
+
"--segments-file <path>",
|
|
2539
|
+
"JSON array of caption SEGMENTS \u2014 non-overlapping { startMs, endMs } ranges, each with its own style/look/position overrides and optional own words"
|
|
2540
|
+
).option("--watch", "poll until the job completes").option("--poll-interval <ms>", "watch poll interval in ms", (v) => parseInt(v, 10), 2e3).option("--profile <name>").option("--json").addHelpText("after", `
|
|
2541
|
+
Fonts: ${SUPPORTED_FONT_NAMES.join(", ")}
|
|
2542
|
+
|
|
2543
|
+
The styling levers (--look, --font-family, --font-weight, --stroke-*, --uppercase,
|
|
2544
|
+
--position-y, --max-words-per-line) now apply to the static subtitle style too \u2014 a
|
|
2545
|
+
subtitle carrying any of them renders via Remotion. Only --highlight-color and
|
|
2546
|
+
--animate are kinetic-only; the subtitle style rejects them with a 400.
|
|
2547
|
+
|
|
2548
|
+
--animate is on by default; --no-animate freezes the per-word motion on the kinetic
|
|
2549
|
+
styles (the grouping, line-holding and spoken-word highlight stay).
|
|
2550
|
+
|
|
2551
|
+
--max-words-per-line caps a line (or a tiktok-words page) ON TOP of the width budget,
|
|
2552
|
+
sentence ends and pauses that already close one \u2014 1-2 gives the punchy CapCut read.
|
|
2553
|
+
It is inert on word-pop, which is always one word, and a --segments-file entry that
|
|
2554
|
+
names its own overrides it for that range.
|
|
2555
|
+
|
|
2556
|
+
Examples:
|
|
2557
|
+
$ nodaro media add-captions https://.../clip.mp4 --style word-highlight --look outline --watch
|
|
2558
|
+
$ nodaro media add-captions https://.../clip.mp4 --captions-file words.json --style karaoke \\
|
|
2559
|
+
--no-auto-transcribe --highlight-color '#FFE600' --watch`).action(
|
|
2560
|
+
async (videoUrl, opts) => {
|
|
2561
|
+
try {
|
|
2562
|
+
if (opts.style && !ALL_CAPTION_STYLES.includes(opts.style)) {
|
|
2563
|
+
warn(`--style must be one of ${ALL_CAPTION_STYLES.join(", ")} (got "${opts.style}")`);
|
|
2564
|
+
process.exit(1);
|
|
2565
|
+
}
|
|
2566
|
+
if (opts.look && !CAPTION_LOOK_IDS.includes(opts.look)) {
|
|
2567
|
+
warn(`--look must be one of ${CAPTION_LOOK_IDS.join(", ")} (got "${opts.look}")`);
|
|
2568
|
+
process.exit(1);
|
|
2569
|
+
}
|
|
2570
|
+
if (opts.position && !["bottom", "top", "center"].includes(opts.position)) {
|
|
2571
|
+
warn(`--position must be bottom, top, or center (got "${opts.position}")`);
|
|
2572
|
+
process.exit(1);
|
|
2573
|
+
}
|
|
2574
|
+
if (opts.fontFamily && !SUPPORTED_FONT_NAMES.includes(opts.fontFamily)) {
|
|
2575
|
+
warn(`--font-family must be one of ${SUPPORTED_FONT_NAMES.join(", ")} (got "${opts.fontFamily}")`);
|
|
2576
|
+
process.exit(1);
|
|
2577
|
+
}
|
|
2578
|
+
if (opts.fontWeight !== void 0 && (!Number.isInteger(opts.fontWeight) || opts.fontWeight < 100 || opts.fontWeight > 900 || opts.fontWeight % 100 !== 0)) {
|
|
2579
|
+
warn(`--font-weight must be 100-900 in steps of 100 (got "${opts.fontWeight}")`);
|
|
2580
|
+
process.exit(1);
|
|
2581
|
+
}
|
|
2582
|
+
if (opts.transcribeProvider && !TRANSCRIBE_LANES.includes(opts.transcribeProvider)) {
|
|
2583
|
+
warn(`--transcribe-provider must be one of ${TRANSCRIBE_LANES.join(", ")} (got "${opts.transcribeProvider}")`);
|
|
2584
|
+
process.exit(1);
|
|
2585
|
+
}
|
|
2586
|
+
const maxWordsPerLine = opts.maxWordsPerLine !== void 0 ? parseMaxWordsPerLine(opts.maxWordsPerLine) : void 0;
|
|
2587
|
+
const captions = opts.captionsFile ? readJsonArrayFile(opts.captionsFile, "--captions-file") : void 0;
|
|
2588
|
+
const segments = opts.segmentsFile ? readJsonArrayFile(opts.segmentsFile, "--segments-file") : void 0;
|
|
2589
|
+
const client = buildClient(opts.profile);
|
|
2590
|
+
const result = await client.media.addCaptions({
|
|
2591
|
+
videoUrl,
|
|
2592
|
+
...opts.text !== void 0 ? { text: opts.text } : {},
|
|
2593
|
+
...captions ? { captions } : {},
|
|
2594
|
+
...segments ? { segments } : {},
|
|
2595
|
+
...opts.style ? { style: opts.style } : {},
|
|
2596
|
+
...opts.look ? { look: opts.look } : {},
|
|
2597
|
+
...opts.position ? { position: opts.position } : {},
|
|
2598
|
+
...opts.positionY !== void 0 ? { positionY: opts.positionY } : {},
|
|
2599
|
+
...opts.fontSize !== void 0 ? { fontSize: opts.fontSize } : {},
|
|
2600
|
+
...opts.fontFamily ? { fontFamily: opts.fontFamily } : {},
|
|
2601
|
+
...opts.fontWeight !== void 0 ? { fontWeight: opts.fontWeight } : {},
|
|
2602
|
+
...opts.color ? { color: opts.color } : {},
|
|
2603
|
+
...opts.backgroundColor ? { backgroundColor: opts.backgroundColor } : {},
|
|
2604
|
+
...opts.strokeColor ? { strokeColor: opts.strokeColor } : {},
|
|
2605
|
+
...opts.strokeWidth !== void 0 ? { strokeWidth: opts.strokeWidth } : {},
|
|
2606
|
+
...opts.highlightColor ? { highlightColor: opts.highlightColor } : {},
|
|
2607
|
+
...maxWordsPerLine !== void 0 ? { maxWordsPerLine } : {},
|
|
2608
|
+
// Tri-state: commander leaves it undefined unless --uppercase / --no-uppercase
|
|
2609
|
+
// was passed, so an untouched flag keeps the look's own casing.
|
|
2610
|
+
...opts.uppercase !== void 0 ? { uppercase: opts.uppercase } : {},
|
|
2611
|
+
// Same tri-state as --uppercase: undefined unless --animate / --no-animate
|
|
2612
|
+
// was passed, so an untouched flag keeps the server default (animate: true).
|
|
2613
|
+
...opts.animate !== void 0 ? { animate: opts.animate } : {},
|
|
2614
|
+
// Commander defaults a lone `--no-x` flag to TRUE, so only an
|
|
2615
|
+
// explicit `--no-auto-transcribe` may reach the wire — otherwise
|
|
2616
|
+
// every call would pin auto_transcribe and the route could never
|
|
2617
|
+
// see an absent flag.
|
|
2618
|
+
...opts.autoTranscribe === false ? { autoTranscribe: false } : {},
|
|
2619
|
+
...opts.transcribeProvider ? { transcribeProvider: opts.transcribeProvider } : {}
|
|
2620
|
+
});
|
|
2621
|
+
await reportQueuedJob(result, () => client.jobs.get(result.jobId), {
|
|
2622
|
+
...opts,
|
|
2623
|
+
note: opts.style ?? "subtitle"
|
|
2624
|
+
});
|
|
2625
|
+
} catch (err) {
|
|
2626
|
+
handleError(err);
|
|
2627
|
+
}
|
|
2628
|
+
}
|
|
2629
|
+
);
|
|
2489
2630
|
cmd.command("collage <imageUrls...>").description("composite 2\u201330 images into ONE large 2K/4K collage (smart justified layout \u2014 no cropping \u2014 or uniform grid)").option(
|
|
2490
2631
|
"--sizes <list>",
|
|
2491
2632
|
"comma-separated per-image size hints aligned with the images: 0 auto (default), 1 big (~2\xD7 linear), 2 medium, 3 small (~\xBD). Relative \u2014 smart layout only"
|
|
@@ -2654,6 +2795,81 @@ vision model and answers in these same units.`).action(
|
|
|
2654
2795
|
}
|
|
2655
2796
|
}
|
|
2656
2797
|
);
|
|
2798
|
+
cmd.command("video-overlay <videoUrl> [layerUrls...]").description("place timed image layers over a video (local compositor, no AI; the audio is kept) \u2014 positional URLs are layers, one --at each").option("--at <start[-end]>", `a positional layer's window in seconds ("3" = from 3 s to the end, "1.2-2.6"); repeat once per layer, in order`, collectVariadic).option("--preset <id>", `placement for every positional layer: ${VIDEO_OVERLAY_PRESET_IDS.join(" | ")} (default: a corner badge \u2014 bottom-right, or the --corner given)`).option("--corner <corner>", `with --preset corner-badge: ${VIDEO_OVERLAY_CORNERS.join(" | ")} (default bottom-right)`).option("--layers-file <path>", "JSON file with the full layers array (custom boxes, opacity, animate, zIndex; mutually exclusive with positional layer URLs)").option("--aspect <ratio>", `render onto a ${VIDEO_OVERLAY_OUTPUT_ASPECTS.join(" | ")} canvas instead of the video's own size`).option("--base-fit <fit>", "with --aspect: how the video fills the canvas, cover (default) or contain").option("--background-color <hex>", "with --aspect: the padding colour under --base-fit contain, #RRGGBB").option("--watch", "poll until the job completes").option("--poll-interval <ms>", "watch poll interval in ms", (v) => parseInt(v, 10), 2e3).option("--profile <name>").option("--json").addHelpText("after", `
|
|
2799
|
+
Examples:
|
|
2800
|
+
$ nodaro media video-overlay https://x/clip.mp4 https://x/shot1.png https://x/shot2.png --at 1.2-2.6 --at 3-4.4 --preset card --watch
|
|
2801
|
+
$ nodaro media video-overlay https://x/clip.mp4 https://x/logo.png --at 0 --preset corner-badge --corner top-right --watch
|
|
2802
|
+
$ nodaro media video-overlay https://x/clip.mp4 --layers-file layers.json --aspect 9:16 --watch
|
|
2803
|
+
|
|
2804
|
+
A layers file holds the API's layers array, e.g.
|
|
2805
|
+
[{"imageUrl":"https://x/logo.png","start":0,"anchor":"top-left","x":4,"y":4,"width":12,"opacity":0.9}]
|
|
2806
|
+
Placement is in PERCENT of the output frame. An explicit box field overrides a
|
|
2807
|
+
preset; a layer with neither is a corner badge (bottom-right, or the corner it
|
|
2808
|
+
names).`).action(
|
|
2809
|
+
async (videoUrl, layerUrls, opts) => {
|
|
2810
|
+
try {
|
|
2811
|
+
if (opts.layersFile && layerUrls.length > 0) {
|
|
2812
|
+
warn("Pass layers EITHER as positional URLs OR with --layers-file, not both");
|
|
2813
|
+
process.exit(1);
|
|
2814
|
+
}
|
|
2815
|
+
if (!opts.layersFile && layerUrls.length === 0) {
|
|
2816
|
+
warn("Give at least one layer: a positional image URL (with its --at), or --layers-file with the layers array");
|
|
2817
|
+
process.exit(1);
|
|
2818
|
+
}
|
|
2819
|
+
if (opts.layersFile && (opts.at?.length || opts.preset || opts.corner)) {
|
|
2820
|
+
warn("--at, --preset and --corner apply to positional layers \u2014 put them inside the --layers-file entries instead");
|
|
2821
|
+
process.exit(1);
|
|
2822
|
+
}
|
|
2823
|
+
if (opts.preset && !isVideoOverlayPresetId(opts.preset)) {
|
|
2824
|
+
warn(`--preset must be one of ${VIDEO_OVERLAY_PRESET_IDS.join(", ")} (got "${opts.preset}")`);
|
|
2825
|
+
process.exit(1);
|
|
2826
|
+
}
|
|
2827
|
+
if (opts.corner && !isVideoOverlayCorner(opts.corner)) {
|
|
2828
|
+
warn(`--corner must be one of ${VIDEO_OVERLAY_CORNERS.join(", ")} (got "${opts.corner}")`);
|
|
2829
|
+
process.exit(1);
|
|
2830
|
+
}
|
|
2831
|
+
if (opts.aspect && !isVideoOverlayOutputAspect(opts.aspect)) {
|
|
2832
|
+
warn(`--aspect must be one of ${VIDEO_OVERLAY_OUTPUT_ASPECTS.join(", ")} (got "${opts.aspect}")`);
|
|
2833
|
+
process.exit(1);
|
|
2834
|
+
}
|
|
2835
|
+
if (opts.baseFit && !VIDEO_OVERLAY_FITS.includes(opts.baseFit)) {
|
|
2836
|
+
warn(`--base-fit must be cover or contain (got "${opts.baseFit}")`);
|
|
2837
|
+
process.exit(1);
|
|
2838
|
+
}
|
|
2839
|
+
if ((opts.baseFit || opts.backgroundColor) && !opts.aspect) {
|
|
2840
|
+
warn("--base-fit and --background-color need --aspect");
|
|
2841
|
+
process.exit(1);
|
|
2842
|
+
}
|
|
2843
|
+
let layers;
|
|
2844
|
+
if (opts.layersFile) {
|
|
2845
|
+
layers = readJsonArrayFile(opts.layersFile, "--layers-file");
|
|
2846
|
+
} else {
|
|
2847
|
+
const at = opts.at ?? [];
|
|
2848
|
+
if (at.length !== layerUrls.length) {
|
|
2849
|
+
warn(`Give one --at per layer URL, in order (${layerUrls.length} layer URL(s), ${at.length} --at)`);
|
|
2850
|
+
process.exit(1);
|
|
2851
|
+
}
|
|
2852
|
+
layers = layerUrls.map((imageUrl, i) => ({
|
|
2853
|
+
imageUrl,
|
|
2854
|
+
...parseAt(at[i]),
|
|
2855
|
+
...opts.preset ? { preset: opts.preset } : {},
|
|
2856
|
+
...opts.corner ? { corner: opts.corner } : {}
|
|
2857
|
+
}));
|
|
2858
|
+
}
|
|
2859
|
+
const client = buildClient(opts.profile);
|
|
2860
|
+
const result = await client.media.videoOverlay({
|
|
2861
|
+
videoUrl,
|
|
2862
|
+
layers,
|
|
2863
|
+
...opts.aspect ? { outputAspect: opts.aspect } : {},
|
|
2864
|
+
...opts.baseFit ? { baseFit: opts.baseFit } : {},
|
|
2865
|
+
...opts.backgroundColor ? { backgroundColor: opts.backgroundColor } : {}
|
|
2866
|
+
});
|
|
2867
|
+
await reportQueuedJob(result, () => client.jobs.get(result.jobId), { ...opts, note: "video overlay" });
|
|
2868
|
+
} catch (err) {
|
|
2869
|
+
handleError(err);
|
|
2870
|
+
}
|
|
2871
|
+
}
|
|
2872
|
+
);
|
|
2657
2873
|
cmd.command("overlay-placement <imageUrl>").description("ask a vision model WHERE one overlay layer should sit \u2014 answers in `media overlay`'s own percent units").option("--intent <text>", 'what the layer is, in words \u2014 "a logo", "a price badge" (default a logo)').option("--aspect <ratio>", "the layer's width / height (1 = square, the default)", parseFloat).option("--safe-area <x,y,w,h>", "always-visible region as fractions 0..1; the placement is kept inside it").option("--profile <name>").option("--json").addHelpText("after", `
|
|
2658
2874
|
Example:
|
|
2659
2875
|
$ nodaro media overlay-placement https://x/base.png --intent "a logo" --aspect 2.5
|
|
@@ -2706,6 +2922,7 @@ one image-to-text call.`).action(
|
|
|
2706
2922
|
);
|
|
2707
2923
|
return cmd;
|
|
2708
2924
|
}
|
|
2925
|
+
var WORD_TIMESTAMP_PROVIDERS = TRANSCRIBE_PROVIDERS.filter((p) => transcribeLaneSupportsWordTimestamps(p));
|
|
2709
2926
|
var FX_PRESETS2 = "room|bathroom|car|hall|concert-hall|church|cave|arena|outdoor|telephone|megaphone|echo|custom";
|
|
2710
2927
|
function parseSegment(raw) {
|
|
2711
2928
|
const at = raw.lastIndexOf("@");
|
|
@@ -2722,7 +2939,7 @@ function parseSegment(raw) {
|
|
|
2722
2939
|
}
|
|
2723
2940
|
function audioCommand() {
|
|
2724
2941
|
const cmd = new Command("audio").description(
|
|
2725
|
-
"audio primitives \u2014 the building blocks Voice Changer Pro composes: separate, isolate, fx, mix, level, combine"
|
|
2942
|
+
"audio primitives \u2014 the building blocks Voice Changer Pro composes: separate, isolate, fx, mix, level, combine, transcribe"
|
|
2726
2943
|
);
|
|
2727
2944
|
cmd.command("separate").description("separate an audio track into stems (Demucs) \u2014 voice vs music/SFX, or the full stem breakdown").requiredOption("--audio <url>", "audio URL to separate").option("--mode <mode>", "vocal_instrumental (default) or stems (drums/bass/other/\u2026)").option("--quality <q>", "separation quality: auto (default), fast, or best").option("--watch", "poll until the job completes").option("--poll-interval <ms>", "watch poll interval in ms", (v) => parseInt(v, 10), 2e3).option("--profile <name>").option("--json").action(
|
|
2728
2945
|
async (opts) => {
|
|
@@ -2850,6 +3067,51 @@ Example:
|
|
|
2850
3067
|
}
|
|
2851
3068
|
}
|
|
2852
3069
|
);
|
|
3070
|
+
cmd.command("transcribe").description("transcribe an audio (or video) track to text \u2014 elevenlabs-stt is always word-level and can diarize + tag audio events").requiredOption("--audio <url>", "audio (or video) URL to transcribe").option(
|
|
3071
|
+
"--provider <name>",
|
|
3072
|
+
`transcription engine: ${TRANSCRIBE_PROVIDERS.join(" | ")} \u2014 "${DEFAULT_TRANSCRIBE_PROVIDER}" returns NO word timings, named or reached by omitting this flag`
|
|
3073
|
+
).option("--language <code>", "language code to force (default: auto-detect)").option("--diarize", "label which speaker said each word (elevenlabs-stt)").option("--tag-audio-events", "tag laughter / applause / other non-speech events (elevenlabs-stt)").option("--word-timestamps", "ask for per-word timings \u2014 rejected up front on a lane that cannot produce them").option("--watch", "poll until the job completes").option("--poll-interval <ms>", "watch poll interval in ms", (v) => parseInt(v, 10), 2e3).option("--profile <name>").option("--json").addHelpText("after", `
|
|
3074
|
+
The completed job's output_data carries: text (the whole transcript), words
|
|
3075
|
+
(one entry per word, in MILLISECONDS) and json (the normalized transcript, also
|
|
3076
|
+
ms). A top-level segments array (SECONDS) exists only on the legacy lanes \u2014
|
|
3077
|
+
elevenlabs-stt returns none, so read words.
|
|
3078
|
+
|
|
3079
|
+
Feed the words straight into a kinetic caption render:
|
|
3080
|
+
$ nodaro audio transcribe --audio https://.../talk.mp3 --provider elevenlabs-stt --watch
|
|
3081
|
+
$ nodaro jobs get <jobId> --json | jq '.output_data.words' > words.json
|
|
3082
|
+
$ nodaro media add-captions https://.../talk.mp4 --captions-file words.json \\
|
|
3083
|
+
--style word-highlight --no-auto-transcribe --watch
|
|
3084
|
+
|
|
3085
|
+
Example:
|
|
3086
|
+
$ nodaro audio transcribe --audio https://.../interview.mp3 --provider elevenlabs-stt --diarize --watch`).action(
|
|
3087
|
+
async (opts) => {
|
|
3088
|
+
try {
|
|
3089
|
+
if (opts.provider && !TRANSCRIBE_PROVIDERS.includes(opts.provider)) {
|
|
3090
|
+
warn(`--provider must be one of ${TRANSCRIBE_PROVIDERS.join(", ")} (got "${opts.provider}")`);
|
|
3091
|
+
process.exit(1);
|
|
3092
|
+
}
|
|
3093
|
+
const resolvedLane = opts.provider ?? DEFAULT_TRANSCRIBE_PROVIDER;
|
|
3094
|
+
if (opts.wordTimestamps && !transcribeLaneSupportsWordTimestamps(resolvedLane)) {
|
|
3095
|
+
warn(
|
|
3096
|
+
`--word-timestamps is not supported by "${resolvedLane}"${opts.provider ? "" : " (the default when --provider is omitted)"} \u2014 pass --provider ${WORD_TIMESTAMP_PROVIDERS.join(" or ")}`
|
|
3097
|
+
);
|
|
3098
|
+
process.exit(1);
|
|
3099
|
+
}
|
|
3100
|
+
const client = buildClient(opts.profile);
|
|
3101
|
+
const result = await client.audio.transcribe({
|
|
3102
|
+
audioUrl: opts.audio,
|
|
3103
|
+
...opts.provider ? { provider: opts.provider } : {},
|
|
3104
|
+
...opts.language ? { language: opts.language } : {},
|
|
3105
|
+
...opts.diarize ? { diarize: true } : {},
|
|
3106
|
+
...opts.tagAudioEvents ? { tagAudioEvents: true } : {},
|
|
3107
|
+
...opts.wordTimestamps ? { wordTimestamps: true } : {}
|
|
3108
|
+
});
|
|
3109
|
+
await reportQueuedJob(result, () => client.jobs.get(result.jobId), { ...opts, note: resolvedLane });
|
|
3110
|
+
} catch (err) {
|
|
3111
|
+
handleError(err);
|
|
3112
|
+
}
|
|
3113
|
+
}
|
|
3114
|
+
);
|
|
2853
3115
|
return cmd;
|
|
2854
3116
|
}
|
|
2855
3117
|
function presetsCommand() {
|
|
@@ -4692,6 +4954,189 @@ var SOURCE_LABELS = {
|
|
|
4692
4954
|
profile: "the profile's saved workspace",
|
|
4693
4955
|
none: "nothing \u2014 the personal space"
|
|
4694
4956
|
};
|
|
4957
|
+
function readJsonFile(path) {
|
|
4958
|
+
let raw;
|
|
4959
|
+
try {
|
|
4960
|
+
raw = readFileSync(path, "utf8");
|
|
4961
|
+
} catch (err) {
|
|
4962
|
+
throw new Error(`cannot read ${path}: ${err.message}`);
|
|
4963
|
+
}
|
|
4964
|
+
try {
|
|
4965
|
+
return JSON.parse(raw);
|
|
4966
|
+
} catch (err) {
|
|
4967
|
+
throw new Error(`${path} is not valid JSON: ${err.message}`);
|
|
4968
|
+
}
|
|
4969
|
+
}
|
|
4970
|
+
function parseSourceSpec(spec, index2) {
|
|
4971
|
+
const at = spec.lastIndexOf("@");
|
|
4972
|
+
if (at > 0) {
|
|
4973
|
+
const suffix = spec.slice(at + 1);
|
|
4974
|
+
if (suffix === "audio" || suffix === "video") {
|
|
4975
|
+
return { id: `source-${index2 + 1}`, url: spec.slice(0, at), kind: suffix };
|
|
4976
|
+
}
|
|
4977
|
+
}
|
|
4978
|
+
return { id: `source-${index2 + 1}`, url: spec, kind: "video" };
|
|
4979
|
+
}
|
|
4980
|
+
function parseAudioSyncSource(spec, index2) {
|
|
4981
|
+
const named = /^([^=\s]{1,200})=(https?:\/\/.+)$/.exec(spec);
|
|
4982
|
+
return named ? { id: named[1], url: named[2] } : { id: `source-${index2 + 1}`, url: spec };
|
|
4983
|
+
}
|
|
4984
|
+
function editCommand() {
|
|
4985
|
+
const cmd = new Command("edit").description(
|
|
4986
|
+
"editorial primitives for podcast / long-form video \u2014 detect silence, sync recordings, apply an EDL, plan a cut"
|
|
4987
|
+
);
|
|
4988
|
+
cmd.command("silence-detect <audioUrl>").description("detect silence ranges in an audio or video source (ffmpeg, keyless)").option("--threshold-db <dbfs>", "dBFS threshold, \u2264 0 (write a negative as --threshold-db=-35)", (v) => Number(v)).option("--min-silence-ms <ms>", "minimum silence length to report", (v) => parseInt(v, 10)).option("--pad-ms <ms>", "padding kept around speech", (v) => parseInt(v, 10)).option("--watch", "poll the job until it finishes").option("--poll-interval <ms>", "poll interval with --watch", (v) => parseInt(v, 10)).option("--profile <name>").option("--json").action(
|
|
4989
|
+
async (audioUrl, opts) => {
|
|
4990
|
+
try {
|
|
4991
|
+
const client = buildClient(opts.profile);
|
|
4992
|
+
const result = await client.edit.silenceDetect({
|
|
4993
|
+
audioUrl,
|
|
4994
|
+
...opts.thresholdDb !== void 0 ? { thresholdDb: opts.thresholdDb } : {},
|
|
4995
|
+
...opts.minSilenceMs !== void 0 ? { minSilenceMs: opts.minSilenceMs } : {},
|
|
4996
|
+
...opts.padMs !== void 0 ? { padMs: opts.padMs } : {}
|
|
4997
|
+
});
|
|
4998
|
+
await reportQueuedJob(result, () => client.jobs.getStatus(result.jobId), {
|
|
4999
|
+
json: opts.json,
|
|
5000
|
+
watch: opts.watch,
|
|
5001
|
+
pollInterval: opts.pollInterval,
|
|
5002
|
+
note: "silence-detect"
|
|
5003
|
+
});
|
|
5004
|
+
} catch (err) {
|
|
5005
|
+
handleError(err);
|
|
5006
|
+
}
|
|
5007
|
+
}
|
|
5008
|
+
);
|
|
5009
|
+
cmd.command("audio-sync").description("measure how far apart 2-6 recordings' clocks are, from their sound (keyless)").option(
|
|
5010
|
+
"--source <[id=]url>",
|
|
5011
|
+
"a recording (audio or video) as url or id=url (repeatable, 2-6); ids are minted as source-N when omitted",
|
|
5012
|
+
collectVariadic
|
|
5013
|
+
).option("--sources-file <file>", "JSON array of { id, url } rows (overrides --source)").option("--reference <id>", "the source every offset is measured against (default: the first)").option("--watch", "poll the job until it finishes").option("--poll-interval <ms>", "poll interval with --watch", (v) => parseInt(v, 10)).option("--profile <name>").option("--json").action(
|
|
5014
|
+
async (opts) => {
|
|
5015
|
+
let sources;
|
|
5016
|
+
if (opts.sourcesFile) {
|
|
5017
|
+
const parsed = readJsonFile(opts.sourcesFile);
|
|
5018
|
+
if (!Array.isArray(parsed)) {
|
|
5019
|
+
warn(`--sources-file ${opts.sourcesFile} must contain a JSON array of { id, url } rows`);
|
|
5020
|
+
process.exit(1);
|
|
5021
|
+
}
|
|
5022
|
+
sources = parsed;
|
|
5023
|
+
} else {
|
|
5024
|
+
sources = (opts.source ?? []).map(parseAudioSyncSource);
|
|
5025
|
+
}
|
|
5026
|
+
if (sources.length < 2 || sources.length > 6) {
|
|
5027
|
+
warn(`audio-sync takes 2-6 recordings \u2014 pass --source <url> (repeatable) or --sources-file <file> (got ${sources.length})`);
|
|
5028
|
+
process.exit(1);
|
|
5029
|
+
}
|
|
5030
|
+
try {
|
|
5031
|
+
const client = buildClient(opts.profile);
|
|
5032
|
+
const result = await client.edit.audioSync({
|
|
5033
|
+
sources,
|
|
5034
|
+
...opts.reference !== void 0 ? { reference: opts.reference } : {}
|
|
5035
|
+
});
|
|
5036
|
+
await reportQueuedJob(result, () => client.jobs.getStatus(result.jobId), {
|
|
5037
|
+
json: opts.json,
|
|
5038
|
+
watch: opts.watch,
|
|
5039
|
+
pollInterval: opts.pollInterval,
|
|
5040
|
+
note: `audio-sync (${sources.length} sources)`
|
|
5041
|
+
});
|
|
5042
|
+
} catch (err) {
|
|
5043
|
+
handleError(err);
|
|
5044
|
+
}
|
|
5045
|
+
}
|
|
5046
|
+
);
|
|
5047
|
+
cmd.command("apply-edl").description("render an edit decision list into a video or audio cut").requiredOption("--edl <file>", "path to a JSON file holding the EDL").option("--transcript <file>", "optional transcript JSON to remap through the cut").option("--source <url>", "positional media-URL override for edl.sources[i] (repeatable)", collectVariadic).option("--output <kind>", "video | audio", "video").option("--quality <q>", "proxy | final", "final").option("--crossfade-ms <ms>", "default crossfade on boundaries with no transition", (v) => parseInt(v, 10)).option("--watch", "poll the job until it finishes").option("--poll-interval <ms>", "poll interval with --watch", (v) => parseInt(v, 10)).option("--profile <name>").option("--json").action(
|
|
5048
|
+
async (opts) => {
|
|
5049
|
+
if (opts.output !== "video" && opts.output !== "audio") {
|
|
5050
|
+
warn(`--output must be "video" or "audio" (got "${opts.output}")`);
|
|
5051
|
+
process.exit(1);
|
|
5052
|
+
}
|
|
5053
|
+
if (opts.quality !== "proxy" && opts.quality !== "final") {
|
|
5054
|
+
warn(`--quality must be "proxy" or "final" (got "${opts.quality}")`);
|
|
5055
|
+
process.exit(1);
|
|
5056
|
+
}
|
|
5057
|
+
try {
|
|
5058
|
+
const client = buildClient(opts.profile);
|
|
5059
|
+
const result = await client.edit.applyEdl({
|
|
5060
|
+
edl: readJsonFile(opts.edl),
|
|
5061
|
+
...opts.source && opts.source.length > 0 ? { sources: opts.source } : {},
|
|
5062
|
+
...opts.transcript ? { transcript: readJsonFile(opts.transcript) } : {},
|
|
5063
|
+
output: opts.output,
|
|
5064
|
+
quality: opts.quality,
|
|
5065
|
+
...opts.crossfadeMs !== void 0 ? { crossfadeMs: opts.crossfadeMs } : {}
|
|
5066
|
+
});
|
|
5067
|
+
await reportQueuedJob(result, () => client.jobs.getStatus(result.jobId), {
|
|
5068
|
+
json: opts.json,
|
|
5069
|
+
watch: opts.watch,
|
|
5070
|
+
pollInterval: opts.pollInterval,
|
|
5071
|
+
note: `apply-edl (${opts.output})`
|
|
5072
|
+
});
|
|
5073
|
+
} catch (err) {
|
|
5074
|
+
handleError(err);
|
|
5075
|
+
}
|
|
5076
|
+
}
|
|
5077
|
+
);
|
|
5078
|
+
cmd.command("plan").description("plan a transcript-driven cut / clips / chapters (Cloud edition)").requiredOption("--mode <mode>", "tighten | clips | chapters").requiredOption("--plan-tier <tier>", "economy | standard | premium").requiredOption("--transcript <file>", "path to a timed transcript JSON file").option("--silence <file>", "optional silence JSON \u2014 the silence-detect job's output_data.json ({ version, ranges, durationMs })").option(
|
|
5079
|
+
"--source <url>",
|
|
5080
|
+
"a media source as url or url@audio / url@video (repeatable); id + kind are minted",
|
|
5081
|
+
collectVariadic
|
|
5082
|
+
).option("--sources-file <file>", "JSON array of full EditPlanSource rows (overrides --source)").option("--instructions <text>", "free-text editing steer").option("--style-guide <text>", "style guide applied to the plan").option("--count <n>", "clips mode: how many clips to cut", (v) => parseInt(v, 10)).option("--target-duration-sec <n>", "clips mode: target duration per clip (seconds)", (v) => parseInt(v, 10)).option("--target-aspect <ratio>", "clips aspect: 16:9 | 9:16 | 1:1 | 4:5").option("--platform <name>", "target platform hint").option("--watch", "poll the job until it finishes").option("--poll-interval <ms>", "poll interval with --watch", (v) => parseInt(v, 10)).option("--profile <name>").option("--json").action(
|
|
5083
|
+
async (opts) => {
|
|
5084
|
+
if (opts.mode !== "tighten" && opts.mode !== "clips" && opts.mode !== "chapters") {
|
|
5085
|
+
warn(`--mode must be "tighten", "clips" or "chapters" (got "${opts.mode}")`);
|
|
5086
|
+
process.exit(1);
|
|
5087
|
+
}
|
|
5088
|
+
if (opts.planTier !== "economy" && opts.planTier !== "standard" && opts.planTier !== "premium") {
|
|
5089
|
+
warn(`--plan-tier must be "economy", "standard" or "premium" (got "${opts.planTier}")`);
|
|
5090
|
+
process.exit(1);
|
|
5091
|
+
}
|
|
5092
|
+
if (opts.targetAspect !== void 0 && !["16:9", "9:16", "1:1", "4:5"].includes(opts.targetAspect)) {
|
|
5093
|
+
warn(`--target-aspect must be one of 16:9, 9:16, 1:1, 4:5 (got "${opts.targetAspect}")`);
|
|
5094
|
+
process.exit(1);
|
|
5095
|
+
}
|
|
5096
|
+
let sources;
|
|
5097
|
+
if (opts.sourcesFile) {
|
|
5098
|
+
const parsed = readJsonFile(opts.sourcesFile);
|
|
5099
|
+
if (!Array.isArray(parsed)) {
|
|
5100
|
+
warn(`--sources-file ${opts.sourcesFile} must contain a JSON array of source rows`);
|
|
5101
|
+
process.exit(1);
|
|
5102
|
+
}
|
|
5103
|
+
sources = parsed;
|
|
5104
|
+
} else {
|
|
5105
|
+
sources = (opts.source ?? []).map(parseSourceSpec);
|
|
5106
|
+
}
|
|
5107
|
+
if (sources.length === 0) {
|
|
5108
|
+
warn("at least one source is required \u2014 pass --source <url> (repeatable) or --sources-file <file>");
|
|
5109
|
+
process.exit(1);
|
|
5110
|
+
}
|
|
5111
|
+
try {
|
|
5112
|
+
const client = buildClient(opts.profile);
|
|
5113
|
+
const input2 = {
|
|
5114
|
+
mode: opts.mode,
|
|
5115
|
+
planTier: opts.planTier,
|
|
5116
|
+
transcript: readJsonFile(opts.transcript),
|
|
5117
|
+
sources,
|
|
5118
|
+
...opts.silence ? { silence: readJsonFile(opts.silence) } : {},
|
|
5119
|
+
...opts.instructions !== void 0 ? { instructions: opts.instructions } : {},
|
|
5120
|
+
...opts.styleGuide !== void 0 ? { styleGuide: opts.styleGuide } : {},
|
|
5121
|
+
...opts.count !== void 0 ? { count: opts.count } : {},
|
|
5122
|
+
...opts.targetDurationSec !== void 0 ? { targetDurationSec: opts.targetDurationSec } : {},
|
|
5123
|
+
...opts.targetAspect !== void 0 ? { targetAspect: opts.targetAspect } : {},
|
|
5124
|
+
...opts.platform !== void 0 ? { platform: opts.platform } : {}
|
|
5125
|
+
};
|
|
5126
|
+
const result = await client.edit.editPlan(input2);
|
|
5127
|
+
await reportQueuedJob(result, () => client.jobs.getStatus(result.jobId), {
|
|
5128
|
+
json: opts.json,
|
|
5129
|
+
watch: opts.watch,
|
|
5130
|
+
pollInterval: opts.pollInterval,
|
|
5131
|
+
note: `edit-plan (${opts.mode})`
|
|
5132
|
+
});
|
|
5133
|
+
} catch (err) {
|
|
5134
|
+
handleError(err);
|
|
5135
|
+
}
|
|
5136
|
+
}
|
|
5137
|
+
);
|
|
5138
|
+
return cmd;
|
|
5139
|
+
}
|
|
4695
5140
|
|
|
4696
5141
|
// src/index.ts
|
|
4697
5142
|
function readVersion() {
|
|
@@ -4727,6 +5172,7 @@ program.addCommand(shotsCommand());
|
|
|
4727
5172
|
program.addCommand(recastCommand());
|
|
4728
5173
|
program.addCommand(orgCommand());
|
|
4729
5174
|
program.addCommand(workspaceCommand());
|
|
5175
|
+
program.addCommand(editCommand());
|
|
4730
5176
|
registerLocationsCommands(program);
|
|
4731
5177
|
registerObjectsCommands(program);
|
|
4732
5178
|
program.parseAsync().catch((err) => {
|