@nodaro/cli 1.3.0 → 1.5.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/index.js CHANGED
@@ -5,7 +5,7 @@ import { stdout, stdin } from 'process';
5
5
  import pc3 from 'picocolors';
6
6
  import { writeFileSync, readFileSync, existsSync, mkdirSync, chmodSync } from 'fs';
7
7
  import { hostname, platform, homedir } from 'os';
8
- import { join } from 'path';
8
+ import { extname, basename, join } from 'path';
9
9
  import { createServer } from 'http';
10
10
  import { randomBytes } from 'crypto';
11
11
  import { spawn } from 'child_process';
@@ -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.3.0",
32
+ version: "1.5.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": "^1.3.0",
74
- "@nodaro/shared": "^1.9.0",
73
+ "@nodaro/sdk": "^1.8.0",
74
+ "@nodaro/shared": "^1.14.0",
75
75
  commander: "^12.1.0",
76
76
  picocolors: "^1.1.1",
77
- "@nodaro/prompts": "^1.0.1"
77
+ "@nodaro/prompts": "^1.4.0"
78
78
  },
79
79
  devDependencies: {
80
80
  tsup: "^8.5.0",
@@ -527,11 +527,28 @@ async function watchUntilTerminal(opts) {
527
527
  if (opts.json) emit(result.data, opts);
528
528
  else if (status === "completed") success(`completed in ${elapsed(start)}s`);
529
529
  else process.exit(status === "failed" ? 2 : 130);
530
- return;
530
+ return result;
531
531
  }
532
532
  await sleep(intervalMs);
533
533
  }
534
534
  }
535
+ async function reportQueuedJob(result, fetchJob, opts) {
536
+ if (opts.json && !opts.watch) {
537
+ emit(result, opts);
538
+ return void 0;
539
+ }
540
+ success(`job ${result.jobId} queued${opts.note ? ` (${opts.note})` : ""}`);
541
+ if (!opts.watch) {
542
+ dim(`follow: nodaro jobs get ${result.jobId}`);
543
+ return void 0;
544
+ }
545
+ return watchUntilTerminal({
546
+ fetch: fetchJob,
547
+ label: result.jobId,
548
+ intervalMs: opts.pollInterval,
549
+ json: opts.json
550
+ });
551
+ }
535
552
  function elapsed(startMs) {
536
553
  return ((Date.now() - startMs) / 1e3).toFixed(1);
537
554
  }
@@ -697,7 +714,7 @@ function workflowsCommand() {
697
714
  return cmd;
698
715
  }
699
716
  async function watchExecution(client, executionId, opts) {
700
- return watchUntilTerminal({
717
+ await watchUntilTerminal({
701
718
  fetch: () => client.executions.get(executionId),
702
719
  label: executionId,
703
720
  ...opts
@@ -727,6 +744,52 @@ function jobsCommand() {
727
744
  });
728
745
  return cmd;
729
746
  }
747
+ function videoProCommand() {
748
+ const cmd = new Command("video-pro").description(
749
+ "stop / continue generate-video-pro runs (segmented long-video engine)"
750
+ );
751
+ cmd.command("stop <jobId>").description(
752
+ "gracefully stop a running job: keep + deliver the completed segments as the final video, refund the rest (the in-flight segment is billed \u2014 the provider keeps rendering it)"
753
+ ).option("--profile <name>").option("--json").action(async (jobId, opts) => {
754
+ try {
755
+ const client = buildClient(opts.profile);
756
+ const result = await client.videoPro.stop(jobId);
757
+ if (opts.json) {
758
+ emit(result, opts);
759
+ return;
760
+ }
761
+ if (result.stopping) {
762
+ success(`stop requested for ${jobId} \u2014 the engine finalizes the partial within seconds`);
763
+ dim(`follow: nodaro jobs get ${jobId}`);
764
+ } else {
765
+ success(`job ${jobId} had not started \u2014 cancelled with a full refund`);
766
+ }
767
+ } catch (err) {
768
+ handleError(err);
769
+ }
770
+ });
771
+ cmd.command("continue <jobId>").description(
772
+ "continue a stopped/failed/completed run as a NEW job \u2014 reuses the delivered segments, regenerates from --from-segment on (default: the first missing one); billed only for the regenerated segments"
773
+ ).option("--from-segment <n>", "1-based segment to regenerate from (overrides everything from that point)", (v) => parseInt(v, 10)).option("--watch", "poll the new job until it finishes").option("--poll-interval <ms>", "poll interval with --watch", (v) => parseInt(v, 10)).option("--profile <name>").option("--json").action(
774
+ async (jobId, opts) => {
775
+ try {
776
+ const client = buildClient(opts.profile);
777
+ const result = await client.videoPro.continueRun(jobId, {
778
+ ...opts.fromSegment !== void 0 ? { fromSegment: opts.fromSegment } : {}
779
+ });
780
+ await reportQueuedJob({ jobId: result.jobId }, () => client.jobs.getStatus(result.jobId), {
781
+ json: opts.json,
782
+ watch: opts.watch,
783
+ pollInterval: opts.pollInterval,
784
+ note: result.fromSegment !== void 0 ? `continues ${jobId} from segment ${result.fromSegment}` : `continues ${jobId}`
785
+ });
786
+ } catch (err) {
787
+ handleError(err);
788
+ }
789
+ }
790
+ );
791
+ return cmd;
792
+ }
730
793
  function executionsCommand() {
731
794
  const cmd = new Command("executions").description("inspect and cancel workflow executions");
732
795
  cmd.command("get <id>").description("show one execution by id (use --watch to follow until completion)").option("--profile <name>").option("--json").option("--watch", "poll until terminal status (completed/failed/cancelled)").action(async (id, opts) => {
@@ -1567,9 +1630,68 @@ function promptCommand() {
1567
1630
  });
1568
1631
  return cmd;
1569
1632
  }
1633
+ var FX_PRESETS = "room|bathroom|car|hall|concert-hall|church|cave|arena|outdoor|telephone|megaphone|echo|custom";
1634
+ var AUDIO_CONTENT_TYPES = {
1635
+ ".mp3": "audio/mpeg",
1636
+ ".wav": "audio/wav",
1637
+ ".m4a": "audio/mp4",
1638
+ ".aac": "audio/aac",
1639
+ ".ogg": "audio/ogg",
1640
+ ".flac": "audio/flac",
1641
+ ".webm": "audio/webm"
1642
+ };
1643
+ function buildVoiceFx(opts) {
1644
+ if ((opts.voiceFxMix !== void 0 || opts.voiceFxDelay !== void 0 || opts.voiceFxDecay !== void 0) && !opts.voiceFx) {
1645
+ warn("--voice-fx-mix / --voice-fx-delay / --voice-fx-decay require --voice-fx <preset>");
1646
+ process.exit(1);
1647
+ }
1648
+ return opts.voiceFx ? {
1649
+ preset: opts.voiceFx,
1650
+ ...opts.voiceFxMix !== void 0 ? { wetDryMix: opts.voiceFxMix } : {},
1651
+ ...opts.voiceFxDelay !== void 0 ? { delayMs: opts.voiceFxDelay } : {},
1652
+ ...opts.voiceFxDecay !== void 0 ? { decay: opts.voiceFxDecay } : {}
1653
+ } : void 0;
1654
+ }
1655
+ function readJsonFlag(inline, file, flagBase) {
1656
+ if (inline && file) {
1657
+ warn(`--${flagBase}-json and --${flagBase}-file are mutually exclusive \u2014 pass one`);
1658
+ process.exit(1);
1659
+ }
1660
+ const raw = file ? readFileSync(file, "utf8") : inline;
1661
+ if (raw === void 0) return void 0;
1662
+ try {
1663
+ return JSON.parse(raw);
1664
+ } catch {
1665
+ warn(`--${flagBase}-${file ? "file" : "json"} is not valid JSON`);
1666
+ process.exit(1);
1667
+ }
1668
+ }
1669
+ function renderAnalyzeOutput(outputData) {
1670
+ const out = outputData ?? {};
1671
+ if (out.suggestedTitle) info(`title: ${out.suggestedTitle}`);
1672
+ if (out.languageCode) {
1673
+ const p = out.languageProbability !== void 0 ? ` (confidence ${out.languageProbability.toFixed(2)})` : "";
1674
+ info(`language: ${out.languageCode}${p}`);
1675
+ }
1676
+ const speakers = Array.isArray(out.speakers) ? out.speakers : [];
1677
+ table(
1678
+ speakers.map((s, i) => ({
1679
+ "#": i + 1,
1680
+ id: s.id,
1681
+ "first heard": s.firstStartSec !== void 0 ? `${s.firstStartSec.toFixed(1)}s` : "",
1682
+ words: s.wordCount,
1683
+ snippet: s.snippet
1684
+ })),
1685
+ ["#", "id", "first heard", "words", "snippet"]
1686
+ );
1687
+ if (out.vocalsUrl) dim(`vocals stem: ${out.vocalsUrl}`);
1688
+ if (out.backgroundUrl) dim(`background stem: ${out.backgroundUrl}`);
1689
+ dim("next: nodaro voice recast --voices <v1,v2,...> maps entry N to speaker #N (`keep` keeps a speaker's original voice).");
1690
+ dim(" save this job's output_data as a JSON file and pass --analysis-file <path> to skip re-detection.");
1691
+ }
1570
1692
  function voiceCommand() {
1571
1693
  const cmd = new Command("voice").description("voice tools \u2014 revoice an audio track or a whole talking video");
1572
- cmd.command("changer").alias("change").description("replace the voice in an audio track (--audio) or a talking video (--video) with a different voice").requiredOption("--voice <id>", "target voice \u2014 premade name (Rachel, Aria, Roger, ...) or an ElevenLabs clone UUID").option("--audio <url>", "audio URL to revoice (audio \u2192 audio)").option("--video <url>", "video URL to revoice (returns the video + the new audio track). Wins over --audio when both are given.").option("--stability <n>", "voice stability 0..1", parseFloat).option("--similarity <n>", "similarity boost 0..1", parseFloat).option("--style <n>", "style exaggeration 0..1 \u2014 amplifies the source's delivery (default 0; higher adds latency / less stable)", parseFloat).option("--remove-background-noise", "clean, voice-only output; omit to keep the music/SFX bed under the new voice").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", `
1694
+ cmd.command("changer").alias("change").description("replace the voice in an audio track (--audio) or a talking video (--video) with a different voice").requiredOption("--voice <id>", "target voice \u2014 premade name (Rachel, Aria, Roger, ...) or an ElevenLabs clone UUID").option("--audio <url>", "audio URL to revoice (audio \u2192 audio)").option("--video <url>", "video URL to revoice (returns the video + the new audio track). Wins over --audio when both are given.").option("--model <id>", "speech-to-speech model override").option("--stability <n>", "voice stability 0..1", parseFloat).option("--similarity <n>", "similarity boost 0..1", parseFloat).option("--style <n>", "style exaggeration 0..1 \u2014 amplifies the source's delivery (default 0; higher adds latency / less stable)", parseFloat).option("--use-speaker-boost", "sharpen fidelity to the target speaker (small latency cost)").option("--seed <n>", "deterministic speech-to-speech seed for reproducible output (integer)", (v) => parseInt(v, 10)).option("--remove-background-noise", "clean, voice-only output; omit to keep the music/SFX bed under the new voice").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", `
1573
1695
  Examples:
1574
1696
  $ nodaro voice changer --audio https://.../speech.mp3 --voice Rachel --watch
1575
1697
  $ nodaro voice changer --video https://.../talking.mp4 --voice Aria --watch
@@ -1585,26 +1707,17 @@ Examples:
1585
1707
  voiceId: opts.voice,
1586
1708
  audioUrl: opts.audio,
1587
1709
  videoUrl: opts.video,
1710
+ model: opts.model,
1588
1711
  stability: opts.stability,
1589
1712
  similarityBoost: opts.similarity,
1590
1713
  style: opts.style,
1714
+ useSpeakerBoost: opts.useSpeakerBoost,
1715
+ seed: opts.seed,
1591
1716
  removeBackgroundNoise: opts.removeBackgroundNoise
1592
1717
  });
1593
- const jobId = result.jobId;
1594
- if (opts.json && !opts.watch) {
1595
- emit(result, opts);
1596
- return;
1597
- }
1598
- success(`job ${jobId} queued (${opts.video ? "video" : "audio"} mode)`);
1599
- if (!opts.watch) {
1600
- dim(`follow: nodaro jobs get ${jobId}`);
1601
- return;
1602
- }
1603
- await watchUntilTerminal({
1604
- fetch: () => client.jobs.get(jobId),
1605
- label: jobId,
1606
- intervalMs: opts.pollInterval,
1607
- ...opts
1718
+ await reportQueuedJob(result, () => client.jobs.get(result.jobId), {
1719
+ ...opts,
1720
+ note: `${opts.video ? "video" : "audio"} mode`
1608
1721
  });
1609
1722
  } catch (err) {
1610
1723
  handleError(err);
@@ -1619,13 +1732,16 @@ Examples:
1619
1732
  ).option(
1620
1733
  "--voices-json <json>",
1621
1734
  `JSON array for per-voice settings \u2014 entries are a voice id string, a {"voiceId","stability","similarityBoost","style","useSpeakerBoost","seed","volumeMode","volume"} object, or null to keep that speaker's original voice`
1622
- ).option("--model <id>", "speech-to-speech model override").option("--no-preserve-background", "drop the separated music/SFX bed for a clean voice-only result (kept by default)").option("--separation-quality <q>", "voice/music separation quality: fast (default) or best").option("--music-volume-mode <mode>", "preserved background level: match (default), normalize, or manual").option("--music-volume <n>", "background level % (0-200) when --music-volume-mode is manual", parseFloat).option("--remove-background-noise", "denoise for a cleaner voice-only result").option("--voice-fx <preset>", "reverb/echo on the combined recast voices: room|bathroom|car|hall|concert-hall|church|cave|arena|outdoor|telephone|megaphone|echo|custom").option("--voice-fx-mix <n>", "reverb wet/dry mix % (0-100) \u2014 reverb presets", parseFloat).option("--voice-fx-delay <ms>", "echo delay in ms (20-2000) \u2014 echo/custom presets", (v) => parseInt(v, 10)).option("--voice-fx-decay <n>", "echo decay (0-1) \u2014 echo/custom presets", parseFloat).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", `
1735
+ ).option("--model <id>", "speech-to-speech model override").option("--output <mode>", "output mode: video (default \u2014 merged, rendered result) or stems (dry per-track stems for an interactive mix; render later with `voice export`)").option("--analysis-json <json>", "a completed `voice analyze` job's output_data, inline \u2014 skips re-detection (the interactive-flow fast-path)").option("--analysis-file <path>", "same as --analysis-json but read from a JSON file").option("--no-preserve-background", "drop the separated music/SFX bed for a clean voice-only result (kept by default)").option("--separation-quality <q>", "voice/music separation quality: fast (default) or best").option("--music-volume-mode <mode>", "preserved background level: match (default), normalize, or manual").option("--music-volume <n>", "background level % (0-200) when --music-volume-mode is manual", parseFloat).option("--remove-background-noise", "denoise for a cleaner voice-only result").option("--voice-fx <preset>", `reverb/echo on the combined recast voices: ${FX_PRESETS}`).option("--voice-fx-mix <n>", "reverb wet/dry mix % (0-100) \u2014 reverb presets", parseFloat).option("--voice-fx-delay <ms>", "echo delay in ms (20-2000) \u2014 echo/custom presets", (v) => parseInt(v, 10)).option("--voice-fx-decay <n>", "echo decay (0-1) \u2014 echo/custom presets", parseFloat).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", `
1623
1736
  Examples:
1624
1737
  $ nodaro voice recast --audio https://.../podcast.mp3 --voices Rachel,Aria --watch
1625
1738
  $ nodaro voice recast --video https://.../panel.mp4 --voices Rachel,keep,Aria --watch
1626
1739
  # speaker 1 \u2192 Rachel, speaker 2 keeps their original voice, speaker 3 \u2192 Aria
1627
1740
  $ nodaro voice recast --audio https://.../ad.mp3 \\
1628
- --voices-json '[{"voiceId":"Rachel","stability":0.6},null,"Aria"]' --no-preserve-background`).action(
1741
+ --voices-json '[{"voiceId":"Rachel","stability":0.6},null,"Aria"]' --no-preserve-background
1742
+ $ nodaro voice recast --video https://.../panel.mp4 --voices Rachel,Aria \\
1743
+ --analysis-file analysis.json --output stems --watch
1744
+ # interactive flow: reuse a \`voice analyze\` result, get dry stems to mix, render with \`voice export\``).action(
1629
1745
  async (opts) => {
1630
1746
  try {
1631
1747
  if (!opts.audio && !opts.video) {
@@ -1640,6 +1756,10 @@ Examples:
1640
1756
  warn("Provide --voices <v1,v2,...> (use `keep` to keep a speaker's original voice) or --voices-json <json>");
1641
1757
  process.exit(1);
1642
1758
  }
1759
+ if (opts.output && opts.output !== "video" && opts.output !== "stems") {
1760
+ warn(`--output must be "video" or "stems" (got "${opts.output}")`);
1761
+ process.exit(1);
1762
+ }
1643
1763
  let orderedVoices;
1644
1764
  if (opts.voices) {
1645
1765
  const entries = opts.voices.split(",").map((s) => s.trim());
@@ -1666,22 +1786,31 @@ Examples:
1666
1786
  warn("At least one speaker must get a new voice \u2014 `keep` only marks speakers whose original voice stays");
1667
1787
  process.exit(1);
1668
1788
  }
1669
- if ((opts.voiceFxMix !== void 0 || opts.voiceFxDelay !== void 0 || opts.voiceFxDecay !== void 0) && !opts.voiceFx) {
1670
- warn("--voice-fx-mix / --voice-fx-delay / --voice-fx-decay require --voice-fx <preset>");
1671
- process.exit(1);
1789
+ const voiceFx = buildVoiceFx(opts);
1790
+ const analysisRaw = readJsonFlag(opts.analysisJson, opts.analysisFile, "analysis");
1791
+ let analysis;
1792
+ if (analysisRaw !== void 0) {
1793
+ const a = analysisRaw;
1794
+ if (!a || typeof a !== "object" || Array.isArray(a) || typeof a.vocalsUrl !== "string" || !Array.isArray(a.speakers)) {
1795
+ warn("--analysis-json/--analysis-file must be an analyze result object (vocalsUrl + speakers[]) \u2014 pass a completed `voice analyze` job's output_data");
1796
+ process.exit(1);
1797
+ }
1798
+ analysis = {
1799
+ vocalsUrl: a.vocalsUrl,
1800
+ ...a.backgroundUrl !== void 0 ? { backgroundUrl: a.backgroundUrl } : {},
1801
+ speakers: a.speakers,
1802
+ ...a.languageCode !== void 0 ? { languageCode: a.languageCode } : {},
1803
+ ...a.languageProbability !== void 0 ? { languageProbability: a.languageProbability } : {}
1804
+ };
1672
1805
  }
1673
- const voiceFx = opts.voiceFx ? {
1674
- preset: opts.voiceFx,
1675
- ...opts.voiceFxMix !== void 0 ? { wetDryMix: opts.voiceFxMix } : {},
1676
- ...opts.voiceFxDelay !== void 0 ? { delayMs: opts.voiceFxDelay } : {},
1677
- ...opts.voiceFxDecay !== void 0 ? { decay: opts.voiceFxDecay } : {}
1678
- } : void 0;
1679
1806
  const client = buildClient(opts.profile);
1680
1807
  const input2 = {
1681
1808
  orderedVoices,
1682
1809
  // Video wins when both are given (matches the route + `voice changer`).
1683
1810
  ...opts.video ? { videoUrl: opts.video } : { audioUrl: opts.audio },
1684
1811
  ...opts.model ? { model: opts.model } : {},
1812
+ ...opts.output ? { output: opts.output } : {},
1813
+ ...analysis ? { analysis } : {},
1685
1814
  // Only sent when --no-preserve-background was used; otherwise omitted
1686
1815
  // so the server default (true) applies.
1687
1816
  ...opts.preserveBackground === false ? { preserveBackground: false } : {},
@@ -1692,21 +1821,542 @@ Examples:
1692
1821
  ...voiceFx ? { voiceFx } : {}
1693
1822
  };
1694
1823
  const result = await client.voices.recast(input2);
1695
- const jobId = result.jobId;
1824
+ await reportQueuedJob(result, () => client.jobs.get(result.jobId), {
1825
+ ...opts,
1826
+ note: `${opts.video ? "video" : "audio"} mode${opts.output === "stems" ? ", stems output" : ""}`
1827
+ });
1828
+ } catch (err) {
1829
+ handleError(err);
1830
+ }
1831
+ }
1832
+ );
1833
+ cmd.command("analyze").description(
1834
+ "detect the speakers in a clip WITHOUT recasting (Voice Changer Pro, Cloud only) \u2014 the first step of the interactive flow: pick voices against the printed speaker list, then `voice recast`"
1835
+ ).option("--audio <url>", "audio URL to analyze").option("--video <url>", "video URL to analyze (its audio track is used). Wins over --audio when both are given.").option("--separation-quality <q>", "voice/music separation quality: fast (default) or best").option("--suggest-title", "also suggest a title for the clip from its transcript").option("--watch", "poll until the job completes, then print the detected speakers").option("--poll-interval <ms>", "watch poll interval in ms", (v) => parseInt(v, 10), 2e3).option("--profile <name>").option("--json").addHelpText("after", `
1836
+ Examples:
1837
+ $ nodaro voice analyze --video https://.../panel.mp4 --watch
1838
+ $ nodaro voice analyze --audio https://.../podcast.mp3 --separation-quality best --suggest-title --watch
1839
+
1840
+ The completed job's output_data carries the separated stems + the speaker list;
1841
+ save it to a file and pass it to \`voice recast --analysis-file\` to skip re-detection.`).action(
1842
+ async (opts) => {
1843
+ try {
1844
+ if (!opts.audio && !opts.video) {
1845
+ warn("Provide --audio <url> or --video <url> (one is required)");
1846
+ process.exit(1);
1847
+ }
1848
+ const client = buildClient(opts.profile);
1849
+ const result = await client.voices.analyze({
1850
+ // Video wins when both are given (matches `voice recast`).
1851
+ ...opts.video ? { videoUrl: opts.video } : { audioUrl: opts.audio },
1852
+ ...opts.separationQuality ? { separationQuality: opts.separationQuality } : {},
1853
+ ...opts.suggestTitle ? { suggestTitle: true } : {}
1854
+ });
1855
+ const terminal = await reportQueuedJob(result, () => client.jobs.get(result.jobId), {
1856
+ ...opts,
1857
+ note: "speaker detection"
1858
+ });
1859
+ if (terminal && !opts.json && terminal.data.status === "completed") {
1860
+ renderAnalyzeOutput(terminal.data.output_data);
1861
+ }
1862
+ } catch (err) {
1863
+ handleError(err);
1864
+ }
1865
+ }
1866
+ );
1867
+ cmd.command("export").description(
1868
+ "render the final video from a mixed set of stems (Voice Changer Pro, Cloud only) \u2014 the last step of the interactive flow, after `voice recast --output stems`"
1869
+ ).requiredOption("--source <url>", "the source video to remux the mixed audio onto (stream-copied, never re-encoded)").option("--tracks-json <json>", 'the mix, inline \u2014 a JSON array of { "url", "gain" (0-200), "muted", "kind"? ("voice"|"background") } lanes (max 16)').option("--tracks-file <path>", "same as --tracks-json but read from a JSON file").option("--voice-fx <preset>", `reverb/echo on the voice lanes at render time: ${FX_PRESETS}`).option("--voice-fx-mix <n>", "reverb wet/dry mix % (0-100) \u2014 reverb presets", parseFloat).option("--voice-fx-delay <ms>", "echo delay in ms (20-2000) \u2014 echo/custom presets", (v) => parseInt(v, 10)).option("--voice-fx-decay <n>", "echo decay (0-1) \u2014 echo/custom presets", parseFloat).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", `
1870
+ Examples:
1871
+ $ nodaro voice export --source https://.../panel.mp4 --tracks-file mix.json --watch
1872
+ $ nodaro voice export --source https://.../panel.mp4 --voice-fx hall --voice-fx-mix 30 \\
1873
+ --tracks-json '[{"url":"https://.../s0.mp3","gain":100,"muted":false},
1874
+ {"url":"https://.../bg.mp3","gain":80,"muted":false,"kind":"background"}]'
1875
+
1876
+ Track urls come from a \`voice recast --output stems\` job's output_data. --voice-fx
1877
+ lands on the voice lanes only (never a "background" lane).`).action(
1878
+ async (opts) => {
1879
+ try {
1880
+ const parsed = readJsonFlag(opts.tracksJson, opts.tracksFile, "tracks");
1881
+ if (parsed === void 0) {
1882
+ warn("Provide --tracks-json <json> or --tracks-file <path> \u2014 the mix's track list");
1883
+ process.exit(1);
1884
+ }
1885
+ if (!Array.isArray(parsed) || parsed.length === 0 || !parsed.every((t) => t !== null && typeof t === "object" && !Array.isArray(t) && typeof t.url === "string")) {
1886
+ warn('tracks must be a non-empty JSON array of { "url", "gain", "muted", "kind"? } objects');
1887
+ process.exit(1);
1888
+ }
1889
+ const tracks = parsed;
1890
+ if (tracks.every((t) => t.muted === true)) {
1891
+ warn("At least one track must be un-muted \u2014 an all-muted mix renders silence and the server rejects it");
1892
+ process.exit(1);
1893
+ }
1894
+ const voiceFx = buildVoiceFx(opts);
1895
+ const client = buildClient(opts.profile);
1896
+ const input2 = {
1897
+ videoUrl: opts.source,
1898
+ tracks,
1899
+ ...voiceFx ? { voiceFx } : {}
1900
+ };
1901
+ const result = await client.voices.exportMix(input2);
1902
+ await reportQueuedJob(result, () => client.jobs.get(result.jobId), {
1903
+ ...opts,
1904
+ note: `${tracks.length} track${tracks.length === 1 ? "" : "s"}`
1905
+ });
1906
+ } catch (err) {
1907
+ handleError(err);
1908
+ }
1909
+ }
1910
+ );
1911
+ cmd.command("design").description("design a brand-new synthetic voice from a text description (ElevenLabs text-to-voice)").requiredOption("--text <line>", "a preview line (100-1000 chars) spoken in the designed voice").requiredOption("--description <desc>", "natural-language description of the voice to create").option("--model <id>", "voice-design model override").option("--loudness <n>", "output loudness (-1..1)", parseFloat).option("--guidance-scale <n>", "how strongly the description steers the design (0-100)", parseFloat).option("--seed <n>", "deterministic seed for a reproducible design (integer)", (v) => parseInt(v, 10)).option("--quality <n>", "design quality knob (provider-specific)", parseFloat).option("--enhance", "enhance the generated voice").option("--user-prompt <text>", "optional extra prompt context").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", `
1912
+ Example:
1913
+ $ nodaro voice design --description "a warm, gravelly narrator in his 60s" \\
1914
+ --text "Some stories don't begin at the beginning; they begin the moment everything changes, and this one is no different." --watch`).action(
1915
+ async (opts) => {
1916
+ try {
1917
+ const client = buildClient(opts.profile);
1918
+ const result = await client.voices.design({
1919
+ text: opts.text,
1920
+ voiceDescription: opts.description,
1921
+ ...opts.model ? { model: opts.model } : {},
1922
+ ...opts.loudness !== void 0 ? { loudness: opts.loudness } : {},
1923
+ ...opts.guidanceScale !== void 0 ? { guidanceScale: opts.guidanceScale } : {},
1924
+ ...opts.seed !== void 0 ? { seed: opts.seed } : {},
1925
+ ...opts.quality !== void 0 ? { quality: opts.quality } : {},
1926
+ ...opts.enhance ? { shouldEnhance: true } : {},
1927
+ ...opts.userPrompt ? { userPrompt: opts.userPrompt } : {}
1928
+ });
1929
+ await reportQueuedJob(result, () => client.jobs.get(result.jobId), { ...opts, note: "voice design" });
1930
+ } catch (err) {
1931
+ handleError(err);
1932
+ }
1933
+ }
1934
+ );
1935
+ cmd.command("remix").description("speak a text in a voice described in natural language, without cloning (ElevenLabs voice remix)").requiredOption("--text <text>", "the text (1-5000 chars) to speak").requiredOption("--description <desc>", "natural-language description of the voice to speak in").option("--user-prompt <text>", "optional extra prompt context").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(
1936
+ async (opts) => {
1937
+ try {
1938
+ const client = buildClient(opts.profile);
1939
+ const result = await client.voices.remix({
1940
+ text: opts.text,
1941
+ voiceDescription: opts.description,
1942
+ ...opts.userPrompt ? { userPrompt: opts.userPrompt } : {}
1943
+ });
1944
+ await reportQueuedJob(result, () => client.jobs.get(result.jobId), { ...opts, note: "voice remix" });
1945
+ } catch (err) {
1946
+ handleError(err);
1947
+ }
1948
+ }
1949
+ );
1950
+ cmd.command("dub").description("dub an audio clip into another language while preserving each speaker's voice").requiredOption("--audio <url>", "audio URL to dub").requiredOption("--target-language <code>", 'target language ISO code, e.g. "es", "fr", "pt-BR"').option("--source-language <code>", "source language ISO code (auto-detected when omitted)").option("--num-speakers <n>", "expected number of speakers (1-20) \u2014 improves separation when known", (v) => parseInt(v, 10)).option("--disable-voice-cloning", "keep the original voices instead of cloning them into the target language").option("--drop-background-audio", "drop the background/music bed from the dubbed output").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", `
1951
+ Example:
1952
+ $ nodaro voice dub --audio https://.../interview.mp3 --target-language es --num-speakers 2 --watch`).action(
1953
+ async (opts) => {
1954
+ try {
1955
+ const client = buildClient(opts.profile);
1956
+ const result = await client.voices.dub({
1957
+ audioUrl: opts.audio,
1958
+ targetLanguage: opts.targetLanguage,
1959
+ ...opts.sourceLanguage ? { sourceLanguage: opts.sourceLanguage } : {},
1960
+ ...opts.numSpeakers !== void 0 ? { numSpeakers: opts.numSpeakers } : {},
1961
+ ...opts.disableVoiceCloning ? { disableVoiceCloning: true } : {},
1962
+ ...opts.dropBackgroundAudio ? { dropBackgroundAudio: true } : {}
1963
+ });
1964
+ await reportQueuedJob(result, () => client.jobs.get(result.jobId), {
1965
+ ...opts,
1966
+ note: `dub \u2192 ${opts.targetLanguage}`
1967
+ });
1968
+ } catch (err) {
1969
+ handleError(err);
1970
+ }
1971
+ }
1972
+ );
1973
+ cmd.command("list").description("list the premade voices you can pass to --voice / --voices (or your voice clones with --clones)").option("--clones", "list your voice clones instead of the premade catalog").option("--profile <name>").option("--json").action(async (opts) => {
1974
+ try {
1975
+ const client = buildClient(opts.profile);
1976
+ if (opts.clones) {
1977
+ const clones2 = await client.voices.listClones();
1978
+ if (opts.json) {
1979
+ emit(clones2, opts);
1980
+ return;
1981
+ }
1982
+ table(
1983
+ clones2.map((c) => ({ name: c.name, voice_id: c.elevenlabsVoiceId, clone_id: c.id, created: c.createdAt })),
1984
+ ["name", "voice_id", "clone_id", "created"]
1985
+ );
1986
+ dim(`${clones2.length} clone${clones2.length === 1 ? "" : "s"} \u2014 pass voice_id to --voice / --voices`);
1987
+ return;
1988
+ }
1989
+ const voices = await client.voices.list();
1990
+ if (opts.json) {
1991
+ emit(voices, opts);
1992
+ return;
1993
+ }
1994
+ table(
1995
+ voices.map((v) => ({ name: v.name, voice_id: v.voice_id, gender: v.gender, accent: v.accent, age: v.age, category: v.category })),
1996
+ ["name", "voice_id", "gender", "accent", "age", "category"]
1997
+ );
1998
+ dim(`${voices.length} premade voice${voices.length === 1 ? "" : "s"} \u2014 pass a name or voice_id to --voice / --voices`);
1999
+ } catch (err) {
2000
+ handleError(err);
2001
+ }
2002
+ });
2003
+ const clones = new Command("clones").description("manage your voice clones (list / create / delete)");
2004
+ clones.command("list").description("list your voice clones").option("--profile <name>").option("--json").action(async (opts) => {
2005
+ try {
2006
+ const client = buildClient(opts.profile);
2007
+ const rows = await client.voices.listClones();
2008
+ if (opts.json) {
2009
+ emit(rows, opts);
2010
+ return;
2011
+ }
2012
+ table(
2013
+ rows.map((c) => ({ name: c.name, voice_id: c.elevenlabsVoiceId, clone_id: c.id, created: c.createdAt })),
2014
+ ["name", "voice_id", "clone_id", "created"]
2015
+ );
2016
+ dim(`${rows.length} clone${rows.length === 1 ? "" : "s"} \u2014 pass voice_id to --voice / --voices`);
2017
+ } catch (err) {
2018
+ handleError(err);
2019
+ }
2020
+ });
2021
+ clones.command("create").description("clone a voice from a sample \u2014 an already-uploaded URL (--audio) or a local file (--file). Costs credits.").requiredOption("--name <name>", "name for the new clone").option("--audio <url>", "URL of an uploaded audio sample to clone from").option("--file <path>", "local audio file to upload and clone from (mp3/wav/m4a/aac/ogg/flac/webm)").option("--profile <name>").option("--json").addHelpText("after", `
2022
+ Examples:
2023
+ $ nodaro voice clones create --name "Narrator" --audio https://.../sample.mp3
2024
+ $ nodaro voice clones create --name "Narrator" --file ./sample.wav`).action(async (opts) => {
2025
+ try {
2026
+ if (!opts.audio && !opts.file) {
2027
+ warn("Provide --audio <url> or --file <path> (one is required)");
2028
+ process.exit(1);
2029
+ }
2030
+ if (opts.audio && opts.file) {
2031
+ warn("--audio and --file are mutually exclusive \u2014 pass one");
2032
+ process.exit(1);
2033
+ }
2034
+ const client = buildClient(opts.profile);
2035
+ const clone = opts.file ? await client.voices.createCloneFromFile({
2036
+ name: opts.name,
2037
+ file: readFileSync(opts.file),
2038
+ filename: basename(opts.file),
2039
+ contentType: AUDIO_CONTENT_TYPES[extname(opts.file).toLowerCase()] ?? "audio/mpeg"
2040
+ }) : await client.voices.createClone({ name: opts.name, audioUrl: opts.audio });
2041
+ if (opts.json) {
2042
+ emit(clone, opts);
2043
+ return;
2044
+ }
2045
+ success(`created voice clone "${clone.name}"`);
2046
+ info(`voice_id: ${clone.elevenlabsVoiceId}`);
2047
+ dim(`use it: nodaro voice changer --voice ${clone.elevenlabsVoiceId} --audio <url>`);
2048
+ } catch (err) {
2049
+ handleError(err);
2050
+ }
2051
+ });
2052
+ clones.command("delete <id>").description("delete one of your voice clones (the clone row id, not the voice_id)").option("--profile <name>").option("--json").action(async (id, opts) => {
2053
+ try {
2054
+ const client = buildClient(opts.profile);
2055
+ await client.voices.deleteClone(id);
2056
+ if (opts.json) emit({ id, deleted: true }, opts);
2057
+ else success(`deleted voice clone ${id}`);
2058
+ } catch (err) {
2059
+ handleError(err);
2060
+ }
2061
+ });
2062
+ cmd.addCommand(clones);
2063
+ return cmd;
2064
+ }
2065
+ function parseSection(raw) {
2066
+ const m = raw.match(/^([0-9]+(?:\.[0-9]+)?)-([0-9]+(?:\.[0-9]+)?)$/);
2067
+ const start = m ? parseFloat(m[1]) : NaN;
2068
+ const end = m ? parseFloat(m[2]) : NaN;
2069
+ if (!m || !(start < end)) {
2070
+ warn(`--section must be "<start>-<end>" in seconds with start < end (got "${raw}")`);
2071
+ process.exit(1);
2072
+ }
2073
+ return { sectionStartSec: start, sectionEndSec: end };
2074
+ }
2075
+ function mediaCommand() {
2076
+ const cmd = new Command("media").description(
2077
+ "media ingestion \u2014 pull a social video into storage, trim video/audio, save a URL to storage, probe metadata"
2078
+ );
2079
+ 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", `
2080
+ Examples:
2081
+ $ nodaro media download https://youtu.be/dQw4w9WgXcQ --max-height 720 --watch
2082
+ $ nodaro media download https://youtu.be/dQw4w9WgXcQ --section 30-90 --watch
2083
+
2084
+ The finished file lands in your library. Without --watch, the progress state
2085
+ expires shortly after completion \u2014 there is no job to poll later.`).action(
2086
+ async (url, opts) => {
2087
+ try {
2088
+ const section = opts.section !== void 0 ? parseSection(opts.section) : void 0;
2089
+ const client = buildClient(opts.profile);
2090
+ const result = await client.media.downloadVideo({
2091
+ url,
2092
+ ...opts.maxHeight !== void 0 ? { maxHeight: opts.maxHeight } : {},
2093
+ ...section ?? {}
2094
+ });
1696
2095
  if (opts.json && !opts.watch) {
1697
2096
  emit(result, opts);
1698
2097
  return;
1699
2098
  }
1700
- success(`job ${jobId} queued (${opts.video ? "video" : "audio"} mode)`);
2099
+ success(`download ${result.downloadId} started`);
1701
2100
  if (!opts.watch) {
1702
- dim(`follow: nodaro jobs get ${jobId}`);
2101
+ dim("re-run with --watch to stream progress (the progress state expires \u2014 start watching promptly)");
1703
2102
  return;
1704
2103
  }
1705
- await watchUntilTerminal({
1706
- fetch: () => client.jobs.get(jobId),
1707
- label: jobId,
1708
- intervalMs: opts.pollInterval,
1709
- ...opts
2104
+ const start = Date.now();
2105
+ let lastPhase = "";
2106
+ let lastLoggedPercent = -1;
2107
+ let terminal;
2108
+ for await (const ev of client.media.downloadVideoProgress(result.downloadId)) {
2109
+ terminal = ev;
2110
+ if (opts.json) continue;
2111
+ const secs = ((Date.now() - start) / 1e3).toFixed(1);
2112
+ if (ev.phase !== lastPhase) {
2113
+ info(`[${secs}s] ${result.downloadId} \u2192 ${ev.phase}`);
2114
+ lastPhase = ev.phase;
2115
+ lastLoggedPercent = -1;
2116
+ }
2117
+ if (ev.phase === "downloading" && ev.percent - lastLoggedPercent >= 25) {
2118
+ info(`[${secs}s] ${Math.floor(ev.percent)}%`);
2119
+ lastLoggedPercent = ev.percent;
2120
+ }
2121
+ }
2122
+ if (opts.json) {
2123
+ emit(terminal ?? { phase: "failed", percent: 0, error: "progress stream ended without a terminal event" }, opts);
2124
+ if (terminal?.phase !== "completed") process.exit(2);
2125
+ return;
2126
+ }
2127
+ if (terminal?.phase === "completed") {
2128
+ success(`downloaded in ${((Date.now() - start) / 1e3).toFixed(1)}s`);
2129
+ if (terminal.videoUrl) info(`video: ${terminal.videoUrl}`);
2130
+ if (terminal.thumbnailUrl) dim(`thumbnail: ${terminal.thumbnailUrl}`);
2131
+ } else {
2132
+ warn(`download failed: ${terminal?.error ?? "progress stream ended unexpectedly"}`);
2133
+ process.exit(2);
2134
+ }
2135
+ } catch (err) {
2136
+ handleError(err);
2137
+ }
2138
+ }
2139
+ );
2140
+ cmd.command("metadata <url>").description("probe a social video's metadata (duration, dimensions, title, live status) WITHOUT downloading it").option("--profile <name>").option("--json").action(async (url, opts) => {
2141
+ try {
2142
+ const client = buildClient(opts.profile);
2143
+ const meta = await client.media.videoMetadata({ url });
2144
+ if (opts.json) emit(meta, opts);
2145
+ else detail(meta);
2146
+ } catch (err) {
2147
+ handleError(err);
2148
+ }
2149
+ });
2150
+ cmd.command("trim-video").description("trim a video to a range").requiredOption("--video <url>", "video URL to trim").option("--start <sec>", "range start in seconds", parseFloat).option("--end <sec>", "range end in seconds", parseFloat).option("--keep-first <sec>", "keep only the first N seconds", parseFloat).option("--keep-last <sec>", "keep only the last N seconds", parseFloat).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", `
2151
+ Examples:
2152
+ $ nodaro media trim-video --video https://.../clip.mp4 --start 12 --end 48 --watch
2153
+ $ nodaro media trim-video --video https://.../clip.mp4 --keep-first 60 --watch`).action(
2154
+ async (opts) => {
2155
+ try {
2156
+ if (opts.start === void 0 && opts.end === void 0 && opts.keepFirst === void 0 && opts.keepLast === void 0) {
2157
+ warn("Provide a range: --start/--end, --keep-first, or --keep-last");
2158
+ process.exit(1);
2159
+ }
2160
+ const client = buildClient(opts.profile);
2161
+ const result = await client.media.trimVideo({
2162
+ videoUrl: opts.video,
2163
+ ...opts.start !== void 0 ? { startTime: opts.start } : {},
2164
+ ...opts.end !== void 0 ? { endTime: opts.end } : {},
2165
+ ...opts.keepFirst !== void 0 ? { keepFirstSeconds: opts.keepFirst } : {},
2166
+ ...opts.keepLast !== void 0 ? { keepLastSeconds: opts.keepLast } : {}
2167
+ });
2168
+ await reportQueuedJob(result, () => client.jobs.get(result.jobId), { ...opts, note: "trim video" });
2169
+ } catch (err) {
2170
+ handleError(err);
2171
+ }
2172
+ }
2173
+ );
2174
+ cmd.command("trim-audio").description("trim (and extract) audio from a video or audio source").option("--video <url>", "video URL to extract + trim audio from").option("--audio <url>", "audio URL to trim").option("--start <sec>", "range start in seconds", parseFloat).option("--end <sec>", "range end in seconds", parseFloat).option("--format <fmt>", "output format: mp3 (default), wav, or aac").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", `
2175
+ Example:
2176
+ $ nodaro media trim-audio --video https://.../clip.mp4 --start 0 --end 30 --format wav --watch`).action(
2177
+ async (opts) => {
2178
+ try {
2179
+ if (!opts.video && !opts.audio) {
2180
+ warn("Provide --video <url> or --audio <url> (one is required)");
2181
+ process.exit(1);
2182
+ }
2183
+ if (opts.format && !["mp3", "wav", "aac"].includes(opts.format)) {
2184
+ warn(`--format must be mp3, wav, or aac (got "${opts.format}")`);
2185
+ process.exit(1);
2186
+ }
2187
+ const client = buildClient(opts.profile);
2188
+ const result = await client.media.trimAudio({
2189
+ ...opts.video ? { videoUrl: opts.video } : {},
2190
+ ...opts.audio ? { audioUrl: opts.audio } : {},
2191
+ ...opts.start !== void 0 ? { startTime: opts.start } : {},
2192
+ ...opts.end !== void 0 ? { endTime: opts.end } : {},
2193
+ ...opts.format ? { audioFormat: opts.format } : {}
2194
+ });
2195
+ await reportQueuedJob(result, () => client.jobs.get(result.jobId), { ...opts, note: "trim audio" });
2196
+ } catch (err) {
2197
+ handleError(err);
2198
+ }
2199
+ }
2200
+ );
2201
+ cmd.command("save <url>").description("copy an external media URL into your Nodaro storage (server-side fetch)").option("--filename <name>", "filename to store it under").option("--type <type>", "media type hint: image, video, or audio").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(
2202
+ async (url, opts) => {
2203
+ try {
2204
+ if (opts.type && !["image", "video", "audio"].includes(opts.type)) {
2205
+ warn(`--type must be image, video, or audio (got "${opts.type}")`);
2206
+ process.exit(1);
2207
+ }
2208
+ const client = buildClient(opts.profile);
2209
+ const result = await client.media.saveToStorage({
2210
+ mediaUrl: url,
2211
+ ...opts.filename ? { filename: opts.filename } : {},
2212
+ ...opts.type ? { mediaType: opts.type } : {}
2213
+ });
2214
+ await reportQueuedJob(result, () => client.jobs.get(result.jobId), { ...opts, note: "save to storage" });
2215
+ } catch (err) {
2216
+ handleError(err);
2217
+ }
2218
+ }
2219
+ );
2220
+ return cmd;
2221
+ }
2222
+ var FX_PRESETS2 = "room|bathroom|car|hall|concert-hall|church|cave|arena|outdoor|telephone|megaphone|echo|custom";
2223
+ function parseSegment(raw) {
2224
+ const at = raw.lastIndexOf("@");
2225
+ if (at < 0) return { url: raw };
2226
+ const range = raw.slice(at + 1);
2227
+ const m = range.match(/^([0-9]+(?:\.[0-9]+)?)-([0-9]+(?:\.[0-9]+)?)$/);
2228
+ const start = m ? parseFloat(m[1]) : NaN;
2229
+ const end = m ? parseFloat(m[2]) : NaN;
2230
+ if (!m || !(start < end)) {
2231
+ warn(`--segment range must be "url@<start>-<end>" in seconds with start < end (got "${raw}")`);
2232
+ process.exit(1);
2233
+ }
2234
+ return { url: raw.slice(0, at), startTime: start, endTime: end };
2235
+ }
2236
+ function audioCommand() {
2237
+ const cmd = new Command("audio").description(
2238
+ "audio primitives \u2014 the building blocks Voice Changer Pro composes: separate, isolate, fx, mix, level, combine"
2239
+ );
2240
+ 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(
2241
+ async (opts) => {
2242
+ try {
2243
+ if (opts.mode && !["vocal_instrumental", "stems"].includes(opts.mode)) {
2244
+ warn(`--mode must be vocal_instrumental or stems (got "${opts.mode}")`);
2245
+ process.exit(1);
2246
+ }
2247
+ if (opts.quality && !["auto", "fast", "best"].includes(opts.quality)) {
2248
+ warn(`--quality must be auto, fast, or best (got "${opts.quality}")`);
2249
+ process.exit(1);
2250
+ }
2251
+ const client = buildClient(opts.profile);
2252
+ const result = await client.audio.separate({
2253
+ audioUrl: opts.audio,
2254
+ ...opts.mode ? { mode: opts.mode } : {},
2255
+ ...opts.quality ? { quality: opts.quality } : {}
2256
+ });
2257
+ await reportQueuedJob(result, () => client.jobs.get(result.jobId), { ...opts, note: opts.mode ?? "vocal_instrumental" });
2258
+ } catch (err) {
2259
+ handleError(err);
2260
+ }
2261
+ }
2262
+ );
2263
+ cmd.command("isolate").description("isolate the primary voice and strip background noise (ElevenLabs voice isolation)").requiredOption("--audio <url>", "audio URL to isolate").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(async (opts) => {
2264
+ try {
2265
+ const client = buildClient(opts.profile);
2266
+ const result = await client.audio.isolate({ audioUrl: opts.audio });
2267
+ await reportQueuedJob(result, () => client.jobs.get(result.jobId), { ...opts, note: "voice isolation" });
2268
+ } catch (err) {
2269
+ handleError(err);
2270
+ }
2271
+ });
2272
+ cmd.command("fx").description("apply a reverb / echo / telephone / megaphone effect to an audio track \u2014 the same presets VCP's voice-fx uses, standalone").requiredOption("--audio <url>", "audio URL to process").option("--preset <preset>", `effect preset: ${FX_PRESETS2} (server default when omitted)`).option("--mix <n>", "reverb wet/dry mix % (0-100) \u2014 reverb presets", parseFloat).option("--delay <ms>", "echo delay in ms (20-2000) \u2014 echo/custom presets", (v) => parseInt(v, 10)).option("--decay <n>", "echo decay (0-1) \u2014 echo/custom presets", parseFloat).option("--eq-low <db>", "low-shelf gain in dB \u2014 telephone/megaphone shaping", parseFloat).option("--eq-high <db>", "high-shelf gain in dB \u2014 telephone/megaphone shaping", parseFloat).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", `
2273
+ Example:
2274
+ $ nodaro audio fx --audio https://.../voice.mp3 --preset hall --mix 35 --watch`).action(
2275
+ async (opts) => {
2276
+ try {
2277
+ const client = buildClient(opts.profile);
2278
+ const result = await client.audio.applyFx({
2279
+ audioUrl: opts.audio,
2280
+ ...opts.preset ? { preset: opts.preset } : {},
2281
+ ...opts.mix !== void 0 ? { mix: opts.mix } : {},
2282
+ ...opts.delay !== void 0 ? { delayMs: opts.delay } : {},
2283
+ ...opts.decay !== void 0 ? { decay: opts.decay } : {},
2284
+ ...opts.eqLow !== void 0 ? { eqLow: opts.eqLow } : {},
2285
+ ...opts.eqHigh !== void 0 ? { eqHigh: opts.eqHigh } : {}
2286
+ });
2287
+ await reportQueuedJob(result, () => client.jobs.get(result.jobId), { ...opts, note: opts.preset ?? "audio fx" });
2288
+ } catch (err) {
2289
+ handleError(err);
2290
+ }
2291
+ }
2292
+ );
2293
+ cmd.command("mix").description("layer multiple audio tracks into one (tracks are summed)").option("--audio <url>", "audio track URL \u2014 repeat the flag for each track (2-20)", collectVariadic).option("--volumes <csv>", 'per-track level %, positionally (0-200 each), e.g. "100,80"').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", `
2294
+ Example:
2295
+ $ nodaro audio mix --audio https://.../voice.mp3 --audio https://.../bed.mp3 --volumes 100,60 --watch`).action(
2296
+ async (opts) => {
2297
+ try {
2298
+ const urls = opts.audio ?? [];
2299
+ if (urls.length < 2) {
2300
+ warn("Provide at least two tracks: --audio <url> --audio <url> ...");
2301
+ process.exit(1);
2302
+ }
2303
+ let trackVolumes;
2304
+ if (opts.volumes) {
2305
+ trackVolumes = opts.volumes.split(",").map((s) => parseFloat(s.trim()));
2306
+ if (trackVolumes.length !== urls.length || trackVolumes.some((v) => Number.isNaN(v))) {
2307
+ warn(`--volumes must be ${urls.length} comma-separated numbers (one per --audio, in order)`);
2308
+ process.exit(1);
2309
+ }
2310
+ }
2311
+ const client = buildClient(opts.profile);
2312
+ const result = await client.audio.mix({
2313
+ audioUrls: urls,
2314
+ ...trackVolumes ? { trackVolumes } : {}
2315
+ });
2316
+ await reportQueuedJob(result, () => client.jobs.get(result.jobId), { ...opts, note: `${urls.length} tracks` });
2317
+ } catch (err) {
2318
+ handleError(err);
2319
+ }
2320
+ }
2321
+ );
2322
+ cmd.command("adjust-volume").description("adjust an audio (or a video's audio) level \u2014 set %, loudness-normalize, fade in/out").option("--audio <url>", "audio URL to adjust").option("--video <url>", "video URL whose audio to adjust").option("--volume <n>", "level % (default 100)", parseFloat).option("--normalize", "apply loudness normalization").option("--fade-in <sec>", "fade-in duration in seconds", parseFloat).option("--fade-out <sec>", "fade-out duration in seconds", parseFloat).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(
2323
+ async (opts) => {
2324
+ try {
2325
+ if (!opts.audio && !opts.video) {
2326
+ warn("Provide --audio <url> or --video <url> (one is required)");
2327
+ process.exit(1);
2328
+ }
2329
+ const client = buildClient(opts.profile);
2330
+ const result = await client.audio.adjustVolume({
2331
+ ...opts.audio ? { audioUrl: opts.audio } : {},
2332
+ ...opts.video ? { videoUrl: opts.video } : {},
2333
+ ...opts.volume !== void 0 ? { volume: opts.volume } : {},
2334
+ ...opts.normalize ? { normalize: true } : {},
2335
+ ...opts.fadeIn !== void 0 ? { fadeIn: opts.fadeIn } : {},
2336
+ ...opts.fadeOut !== void 0 ? { fadeOut: opts.fadeOut } : {}
2337
+ });
2338
+ await reportQueuedJob(result, () => client.jobs.get(result.jobId), { ...opts, note: "adjust volume" });
2339
+ } catch (err) {
2340
+ handleError(err);
2341
+ }
2342
+ }
2343
+ );
2344
+ cmd.command("combine").description("concatenate audio segments end-to-end").option("--segment <url[@a-b]>", 'segment URL with an optional "@start-end" sub-range in seconds \u2014 repeat per segment, in order', collectVariadic).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", `
2345
+ Example:
2346
+ $ nodaro audio combine --segment https://.../intro.mp3 --segment "https://.../talk.mp3@12-95" --watch`).action(
2347
+ async (opts) => {
2348
+ try {
2349
+ const raws = opts.segment ?? [];
2350
+ if (raws.length === 0) {
2351
+ warn("Provide at least one segment: --segment <url[@start-end]> ...");
2352
+ process.exit(1);
2353
+ }
2354
+ const segments = raws.map(parseSegment);
2355
+ const client = buildClient(opts.profile);
2356
+ const result = await client.audio.combine({ segments });
2357
+ await reportQueuedJob(result, () => client.jobs.get(result.jobId), {
2358
+ ...opts,
2359
+ note: `${segments.length} segment${segments.length === 1 ? "" : "s"}`
1710
2360
  });
1711
2361
  } catch (err) {
1712
2362
  handleError(err);
@@ -2767,10 +3417,13 @@ program.addCommand(workflowsCommand());
2767
3417
  program.addCommand(appsCommand());
2768
3418
  program.addCommand(nodesCommand());
2769
3419
  program.addCommand(jobsCommand());
3420
+ program.addCommand(videoProCommand());
2770
3421
  program.addCommand(executionsCommand());
2771
3422
  program.addCommand(charactersCommand());
2772
3423
  program.addCommand(promptCommand());
2773
3424
  program.addCommand(voiceCommand());
3425
+ program.addCommand(mediaCommand());
3426
+ program.addCommand(audioCommand());
2774
3427
  program.addCommand(presetsCommand());
2775
3428
  program.addCommand(communityCommand());
2776
3429
  program.addCommand(pickerCatalogsCommand());