@nodaro/cli 1.21.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/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, 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, DEFAULT_TRANSCRIBE_PROVIDER } 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.21.0",
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.13.0",
74
- "@nodaro/shared": "^3.12.0",
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.22.0"
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.21.0" ;
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,16 @@ 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
+ }
2286
2296
  function parseMaxWordsPerLine(raw) {
2287
2297
  const n = Number(raw);
2288
2298
  if (!Number.isInteger(n) || n < CAPTION_MAX_WORDS_PER_LINE_MIN || n > CAPTION_MAX_WORDS_PER_LINE_MAX) {
@@ -2326,7 +2336,7 @@ function parseSafeArea(raw) {
2326
2336
  }
2327
2337
  function mediaCommand() {
2328
2338
  const cmd = new Command("media").description(
2329
- "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, 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"
2330
2340
  );
2331
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", `
2332
2342
  Examples:
@@ -2785,6 +2795,81 @@ vision model and answers in these same units.`).action(
2785
2795
  }
2786
2796
  }
2787
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
+ );
2788
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", `
2789
2874
  Example:
2790
2875
  $ nodaro media overlay-placement https://x/base.png --intent "a logo" --aspect 2.5
@@ -4892,9 +4977,13 @@ function parseSourceSpec(spec, index2) {
4892
4977
  }
4893
4978
  return { id: `source-${index2 + 1}`, url: spec, kind: "video" };
4894
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
+ }
4895
4984
  function editCommand() {
4896
4985
  const cmd = new Command("edit").description(
4897
- "editorial primitives for podcast / long-form video \u2014 detect silence, apply an EDL, plan a cut"
4986
+ "editorial primitives for podcast / long-form video \u2014 detect silence, sync recordings, apply an EDL, plan a cut"
4898
4987
  );
4899
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(
4900
4989
  async (audioUrl, opts) => {
@@ -4917,6 +5006,44 @@ function editCommand() {
4917
5006
  }
4918
5007
  }
4919
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
+ );
4920
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(
4921
5048
  async (opts) => {
4922
5049
  if (opts.output !== "video" && opts.output !== "audio") {