@nodaro/cli 1.47.0 → 1.49.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -63,7 +63,7 @@ Generate an API token at `https://app.nodaro.ai/settings/api`, then save it:
63
63
  ```bash
64
64
  nodaro auth login # interactive prompt
65
65
  nodaro auth login --token "$NODARO_TOKEN" # non-interactive
66
- nodaro auth login --profile staging --base-url https://next.nodaro.ai
66
+ nodaro auth login --profile staging --base-url https://next.app.nodaro.ai
67
67
  ```
68
68
 
69
69
  The token is stored at `~/.config/nodaro/config.json` with `chmod 0600`. Override the location with `NODARO_CONFIG_DIR`.
@@ -79,7 +79,7 @@ Switch between staging / prod / local instances with `--profile`:
79
79
 
80
80
  ```bash
81
81
  nodaro auth login --profile prod --base-url https://app.nodaro.ai
82
- nodaro auth login --profile staging --base-url https://next.nodaro.ai
82
+ nodaro auth login --profile staging --base-url https://next.app.nodaro.ai
83
83
  nodaro auth login --profile local --base-url http://localhost:8000
84
84
 
85
85
  nodaro projects list --profile staging
package/dist/index.js CHANGED
@@ -20,7 +20,7 @@ import { TRANSCRIBE_PROVIDERS, transcribeLaneSupportsWordTimestamps, DIALOGUE_PR
20
20
  import { VOICE_FAVORITE_TYPES } from '@nodaro/shared/pipeline';
21
21
  import { OVERLAY_ANCHORS, OVERLAY_PLATFORM_IDS, GENERATE_MASK_LIMITS, DEFAULT_VIDEO_MASK_PROVIDER, VIDEO_MASK_PROVIDERS, VIDEO_MASK_LIMITS, MASK_COMPOSITE_BOUNDS, MASK_COMPOSITE_DEFAULTS, MASK_COMPOSITE_BACKGROUND_FITS, MASK_COMPOSITE_AUDIO_SOURCES, MASK_COMPOSITE_FILLS } from '@nodaro/shared/media';
22
22
  import { ALL_CAPTION_STYLES, DEFAULT_CAPTION_LOOK, CAPTION_LOOK_IDS, CAPTION_MAX_WORDS_PER_LINE_MIN, CAPTION_MAX_WORDS_PER_LINE_MAX, SUPPORTED_FONT_NAMES } from '@nodaro/shared/captions';
23
- import { VIDEO_OVERLAY_PRESET_IDS, VIDEO_OVERLAY_CORNERS, VIDEO_OVERLAY_OUTPUT_ASPECTS, isVideoOverlayPresetId, isVideoOverlayCorner, isVideoOverlayOutputAspect, VIDEO_OVERLAY_FITS } from '@nodaro/shared/video';
23
+ import { VIDEO_OVERLAY_PRESET_IDS, VIDEO_OVERLAY_CORNERS, VIDEO_OVERLAY_OUTPUT_ASPECTS, VIDEO_OVERLAY_LAYOUT_IDS, isVideoOverlayPresetId, isVideoOverlayCorner, isVideoOverlayOutputAspect, VIDEO_OVERLAY_FITS, isVideoOverlayLayoutId } from '@nodaro/shared/video';
24
24
  import { SOCIAL_PLATFORMS, COMPETITOR_ACCOUNT_KEYS, isMeasurableCard, isSocialPost, COMPETITOR_ABOUT_PLATFORMS, COMPETITOR_SCHEDULES } from '@nodaro/shared/social';
25
25
  import { RECAST_SEGMENT_PACKS } from '@nodaro/shared/apps';
26
26
  import { LOCATION_ASSET_TYPES, LOCATION_ATTACH_COLUMNS } from '@nodaro/sdk/locations';
@@ -42,7 +42,7 @@ var require_package = __commonJS({
42
42
  "package.json"(exports$1, module) {
43
43
  module.exports = {
44
44
  name: "@nodaro/cli",
45
- version: "1.47.0",
45
+ version: "1.49.0",
46
46
  description: "Command-line interface for Nodaro \u2014 list and run workflows, inspect jobs and executions, manage projects from the terminal.",
47
47
  type: "module",
48
48
  license: "Apache-2.0",
@@ -83,11 +83,11 @@ var require_package = __commonJS({
83
83
  "@inquirer/confirm": "^6.0.12",
84
84
  "@inquirer/input": "^5.0.12",
85
85
  "@inquirer/select": "^5.1.4",
86
- "@nodaro/sdk": "^2.67.0",
87
- "@nodaro/shared": "^3.59.0",
86
+ "@nodaro/sdk": "^2.69.0",
87
+ "@nodaro/shared": "^3.62.0",
88
88
  commander: "^12.1.0",
89
89
  picocolors: "^1.1.1",
90
- "@nodaro/prompts": "^1.53.1"
90
+ "@nodaro/prompts": "^1.54.0"
91
91
  },
92
92
  devDependencies: {
93
93
  tsup: "^8.5.0",
@@ -414,7 +414,7 @@ function saveWorkspace(profileName, workspaceId) {
414
414
  }
415
415
 
416
416
  // src/client.ts
417
- var CLI_VERSION = "1.47.0" ;
417
+ var CLI_VERSION = "1.49.0" ;
418
418
  function buildPublicClient(opts = {}) {
419
419
  const { profile } = getProfile(opts.profile);
420
420
  return createClient({
@@ -3163,6 +3163,9 @@ Examples:
3163
3163
  cmd.addCommand(clones);
3164
3164
  return cmd;
3165
3165
  }
3166
+ var SPLIT_LAYERS_SIZES = ["1K", "1.5K", "2K", "auto"];
3167
+ var SPLIT_LAYERS_MAX_LAYERS = { min: 1, max: 99, default: 9 };
3168
+ var SPLIT_LAYERS_PROMPT_MAX = 2e3;
3166
3169
  function parseSection(raw) {
3167
3170
  const m = raw.match(/^([0-9]+(?:\.[0-9]+)?)-([0-9]+(?:\.[0-9]+)?)$/);
3168
3171
  const start = m ? parseFloat(m[1]) : NaN;
@@ -3215,6 +3218,20 @@ function readJsonArrayFile(path, flag) {
3215
3218
  }
3216
3219
  return parsed;
3217
3220
  }
3221
+ function parseJsonObjectFlag(raw, flag) {
3222
+ let parsed;
3223
+ try {
3224
+ parsed = JSON.parse(raw);
3225
+ } catch (err) {
3226
+ warn(`${flag} must be a JSON object, e.g. '{"anchor":"bottom","width":100}': ${err.message}`);
3227
+ process.exit(1);
3228
+ }
3229
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
3230
+ warn(`${flag} must be a JSON object, e.g. '{"anchor":"bottom","width":100}' (got ${raw})`);
3231
+ process.exit(1);
3232
+ }
3233
+ return parsed;
3234
+ }
3218
3235
  function parseSafeArea(raw) {
3219
3236
  const parts = raw.split(",").map((n) => parseFloat(n.trim()));
3220
3237
  if (parts.length !== 4 || parts.some((n) => !Number.isFinite(n) || n < 0 || n > 1)) {
@@ -3236,7 +3253,7 @@ function parseVideoMaskZone(raw) {
3236
3253
  }
3237
3254
  function mediaCommand() {
3238
3255
  const cmd = new Command("media").description(
3239
- "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"
3256
+ "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 and videos on a video, save a URL to storage, probe metadata"
3240
3257
  );
3241
3258
  cmd.command("download <url>").description("download the video behind a link (the video's page, or a direct video file link) 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", `
3242
3259
  Examples:
@@ -3739,17 +3756,24 @@ vision model and answers in these same units.`).action(
3739
3756
  }
3740
3757
  }
3741
3758
  );
3742
- 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", `
3759
+ cmd.command("video-overlay <videoUrl> [layerUrls...]").description("place timed image or video layers over a video (local compositor, no AI) \u2014 positional URLs are image layers, one --at each; video layers come from --layers-file").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 \u2014 image or video layers, custom boxes, opacity, animate, zIndex, a video layer's sound (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("--layout <id>", `a named layout that places the base, the first video layer or both: ${VIDEO_OVERLAY_LAYOUT_IDS.join(" | ")} (all but pip need --aspect)`).option("--base-box <json>", `with --aspect: where the base video sits, as a layer box, e.g. '{"anchor":"bottom","width":100}'`).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", `
3743
3760
  Examples:
3744
3761
  $ 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
3745
3762
  $ nodaro media video-overlay https://x/clip.mp4 https://x/logo.png --at 0 --preset corner-badge --corner top-right --watch
3746
3763
  $ nodaro media video-overlay https://x/clip.mp4 --layers-file layers.json --aspect 9:16 --watch
3764
+ $ nodaro media video-overlay https://x/talk.mp4 https://x/card.png --at 0 --aspect 9:16 --layout video-bottom --watch
3765
+ $ nodaro media video-overlay https://x/main.mp4 --layers-file guest.json --layout pip --watch
3747
3766
 
3748
3767
  A layers file holds the API's layers array, e.g.
3749
3768
  [{"imageUrl":"https://x/logo.png","start":0,"anchor":"top-left","x":4,"y":4,"width":12,"opacity":0.9}]
3769
+ A video layer takes "videoUrl" instead of "imageUrl" (at most 2 per run); its
3770
+ sound is off unless it sets "sound", e.g. guest.json:
3771
+ [{"videoUrl":"https://x/guest.mp4","start":0,"corner":"top-right","sound":{"volume":0.8}}]
3750
3772
  Placement is in PERCENT of the output frame. An explicit box field overrides a
3751
3773
  preset; a layer with neither is a corner badge (bottom-right, or the corner it
3752
- names).`).action(
3774
+ names). Layouts: video-bottom / video-top put the base video whole against that
3775
+ edge; stack-whole / stack-filled put it above the first video layer (whole, or
3776
+ each cropped to half the frame); pip puts the first video layer in its corner.`).action(
3753
3777
  async (videoUrl, layerUrls, opts) => {
3754
3778
  try {
3755
3779
  if (opts.layersFile && layerUrls.length > 0) {
@@ -3784,6 +3808,15 @@ names).`).action(
3784
3808
  warn("--base-fit and --background-color need --aspect");
3785
3809
  process.exit(1);
3786
3810
  }
3811
+ if (opts.layout && !isVideoOverlayLayoutId(opts.layout)) {
3812
+ warn(`--layout must be one of ${VIDEO_OVERLAY_LAYOUT_IDS.join(", ")} (got "${opts.layout}")`);
3813
+ process.exit(1);
3814
+ }
3815
+ const baseBox = opts.baseBox !== void 0 ? parseJsonObjectFlag(opts.baseBox, "--base-box") : void 0;
3816
+ if (baseBox && !opts.aspect) {
3817
+ warn("--base-box needs --aspect");
3818
+ process.exit(1);
3819
+ }
3787
3820
  let layers;
3788
3821
  if (opts.layersFile) {
3789
3822
  layers = readJsonArrayFile(opts.layersFile, "--layers-file");
@@ -3806,7 +3839,10 @@ names).`).action(
3806
3839
  layers,
3807
3840
  ...opts.aspect ? { outputAspect: opts.aspect } : {},
3808
3841
  ...opts.baseFit ? { baseFit: opts.baseFit } : {},
3809
- ...opts.backgroundColor ? { backgroundColor: opts.backgroundColor } : {}
3842
+ ...opts.backgroundColor ? { backgroundColor: opts.backgroundColor } : {},
3843
+ ...opts.layout ? { layout: opts.layout } : {},
3844
+ // The box's fields go as given; the route fills x, y and fit and refuses a partial or out-of-range box.
3845
+ ...baseBox ? { baseBox } : {}
3810
3846
  });
3811
3847
  await reportQueuedJob(result, () => client.jobs.get(result.jobId), { ...opts, note: "video overlay" });
3812
3848
  } catch (err) {
@@ -3837,6 +3873,42 @@ image, passed through unchanged): \`nodaro jobs get <jobId>\`. Use the mask for
3837
3873
  handleError(err);
3838
3874
  }
3839
3875
  });
3876
+ cmd.command("split-layers <imageUrl>").description("split one image into a base picture and separate layers \u2014 each element on its own transparent PNG, with its name, stacking order and the box it sits in on the base").option("--max-layers <n>", `the most layers to make, ${SPLIT_LAYERS_MAX_LAYERS.min}\u2013${SPLIT_LAYERS_MAX_LAYERS.max} (default ${SPLIT_LAYERS_MAX_LAYERS.default}); more elements than that merge into fewer layers`, (v) => Number(v)).option("--size <size>", `each image's pixel budget: ${SPLIT_LAYERS_SIZES.join(" | ")} (default 1K; auto keeps the picture's own size, between 1K and 2K)`).option("--prompt <text>", `what to separate, up to ${SPLIT_LAYERS_PROMPT_MAX.toLocaleString("en-US")} characters (default: the main elements are found automatically)`).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", `
3877
+ Examples:
3878
+ $ nodaro media split-layers https://x/poster.png --watch
3879
+ $ nodaro media split-layers https://x/poster.png --max-layers 4 --size 2K --prompt "the title, the car, the sky" --watch --json
3880
+
3881
+ The finished job's output carries \`imageUrl\` (the base picture), \`layers\` (each
3882
+ layer's transparent PNG, bottom to top) and \`layerData\` (per layer: name,
3883
+ zIndex, the file's own width/height, \`box\` \u2014 where it sits on the base, in
3884
+ the base's pixels \u2014 and \`baseUrl\`, the base it was cut from). A layer is
3885
+ cropped to its element: scale it to its box to put it back in place. A run holds the price of --max-layers + 1 images and is
3886
+ charged only for the images it returns.`).action(async (imageUrl, opts) => {
3887
+ try {
3888
+ if (opts.maxLayers !== void 0 && !(Number.isInteger(opts.maxLayers) && opts.maxLayers >= SPLIT_LAYERS_MAX_LAYERS.min && opts.maxLayers <= SPLIT_LAYERS_MAX_LAYERS.max)) {
3889
+ warn(`--max-layers must be a whole number from ${SPLIT_LAYERS_MAX_LAYERS.min} to ${SPLIT_LAYERS_MAX_LAYERS.max}`);
3890
+ process.exit(1);
3891
+ }
3892
+ if (opts.size !== void 0 && !SPLIT_LAYERS_SIZES.includes(opts.size)) {
3893
+ warn(`--size must be one of ${SPLIT_LAYERS_SIZES.join(", ")} (got "${opts.size}")`);
3894
+ process.exit(1);
3895
+ }
3896
+ if (opts.prompt !== void 0 && opts.prompt.length > SPLIT_LAYERS_PROMPT_MAX) {
3897
+ warn(`--prompt must be at most ${SPLIT_LAYERS_PROMPT_MAX.toLocaleString("en-US")} characters`);
3898
+ process.exit(1);
3899
+ }
3900
+ const client = buildClient(opts.profile);
3901
+ const result = await client.media.splitIntoLayers({
3902
+ imageUrl,
3903
+ ...opts.maxLayers !== void 0 ? { maxLayers: opts.maxLayers } : {},
3904
+ ...opts.size !== void 0 ? { size: opts.size } : {},
3905
+ ...opts.prompt ? { prompt: opts.prompt } : {}
3906
+ });
3907
+ await reportQueuedJob(result, () => client.jobs.get(result.jobId), { ...opts, note: "split into layers" });
3908
+ } catch (err) {
3909
+ handleError(err);
3910
+ }
3911
+ });
3840
3912
  cmd.command("video-mask <videoUrl> <prompt>").description("track a subject described in text through a video (SAM 3.1, or --model sam-3 at half the price) and get a black-and-white mask video back (white = the subject)").option("--model <model>", `${VIDEO_MASK_PROVIDERS.join(" | ")} (default ${DEFAULT_VIDEO_MASK_PROVIDER})`).option("--threshold <n>", `detection confidence ${VIDEO_MASK_LIMITS.THRESHOLD_MIN}\u2013${VIDEO_MASK_LIMITS.THRESHOLD_MAX} (default ${VIDEO_MASK_LIMITS.THRESHOLD_DEFAULT}; lower finds more)`, parseFloat).option("--hold-last-mask", "keep the last mask on frames where the subject is lost (e.g. hidden behind a hand), for up to 1 s").option("--min-subject-height <pct>", `ignore subjects smaller than this % of the frame height, ${VIDEO_MASK_LIMITS.MIN_SUBJECT_HEIGHT_PCT_MIN}\u2013${VIDEO_MASK_LIMITS.MIN_SUBJECT_HEIGHT_PCT_MAX} (default 0 = off)`, (v) => Number(v)).option("--max-subject-height <pct>", `ignore subjects larger than this % of the frame height, ${VIDEO_MASK_LIMITS.MAX_SUBJECT_HEIGHT_PCT_MIN}\u2013${VIDEO_MASK_LIMITS.MAX_SUBJECT_HEIGHT_PCT_MAX} (default 0 = off)`, (v) => Number(v)).option("--zone <L,R,T,B>", `keep only subjects whose centre is inside these left,right,top,bottom margins, each ${VIDEO_MASK_LIMITS.ZONE_MARGIN_PCT_MIN}\u2013${VIDEO_MASK_LIMITS.ZONE_MARGIN_PCT_MAX} % of the frame (default off)`).option("--per-shot", "detect the subject again in every shot after a scene cut").option("--redetect-every <sec>", `also detect the subject again every <sec> seconds, ${VIDEO_MASK_LIMITS.REDETECT_EVERY_SEC_MIN}\u2013${VIDEO_MASK_LIMITS.REDETECT_EVERY_SEC_MAX} (default 0 = off) \u2014 catches someone who enters or turns to camera mid-shot; slower, same price`, (v) => Number(v)).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", `
3841
3913
  Examples:
3842
3914
  $ nodaro media video-mask https://x/dance.mp4 "the dancer" --watch
@@ -6161,7 +6233,7 @@ function addRunFlags(cmd) {
6161
6233
  "1-based example, as `trends get` lists its examples, whose pictures fill the optional slots you leave empty (default 1); leave it out on a trend with no example, whose empty optional slots stay as in the original; a Full depth trend uses its default image for the role if one is set, otherwise the original's look"
6162
6234
  ).option("--details <text>", "your own words (at most 1,000 characters); mention a slot as {slot:<key>}").option("--preview", "a 4-second preview run (only when the trend offers one)").addOption(
6163
6235
  new Option("--resolution <r>", "one the trend offers (`trends get`); default its first: 480p, or 720p on a Nodaro Motion Pulse trend").choices([...RESOLUTIONS])
6164
- ).option("--no-draft", "a full run instead of a draft (a draft is 480p only, and the default there; a Nodaro Motion Pulse trend has none)");
6236
+ ).option("--draft", "make a 480p draft that Full Quality can finish at 1080p (Nodaro Motion Prism only; without it a run is plain)").option("--no-draft", "a plain run, the default (still accepted)");
6165
6237
  }
6166
6238
  function checkSlotKey(flag, spec, key2) {
6167
6239
  if (!SLOT_KEY_RE.test(key2) || key2 === "__proto__") {
@@ -6225,7 +6297,7 @@ function buildRequest(flags) {
6225
6297
  if (flags.details !== void 0) request.details = flags.details;
6226
6298
  if (flags.preview) request.preview = true;
6227
6299
  if (flags.resolution) request.resolution = flags.resolution;
6228
- if (flags.draft === false) request.draft = false;
6300
+ if (flags.draft !== void 0) request.draft = flags.draft;
6229
6301
  return request;
6230
6302
  }
6231
6303
  function trendsCommand() {
@@ -6370,9 +6442,9 @@ function trendsCommand() {
6370
6442
  }
6371
6443
  function fullQualityCommand() {
6372
6444
  const cmd = new Command("full-quality").description(
6373
- "finish a run (Nodaro Motion or trend) at Full Quality at 1080p, as a new job: a draft's same take, or a new take of a Nodaro Motion Pulse 720p run \u2014 `estimate` quotes it (free), `run` SPENDS CREDITS"
6445
+ "finish a Nodaro Motion Prism draft (a Nodaro Motion or trend run made with draft: true) at Full Quality: its same take at 1080p, as a new job; Nodaro Motion Pulse has none \u2014 `estimate` quotes it (free), `run` SPENDS CREDITS"
6374
6446
  );
6375
- cmd.command("estimate <jobId>").description("quote finishing the run at Full Quality (free): same or new take, the credits, and until when it can be finished").option("--profile <name>").option("--json").action(async (jobId, opts) => {
6447
+ cmd.command("estimate <jobId>").description("quote finishing the draft at Full Quality (free): the credits, and until when it can be finished").option("--profile <name>").option("--json").action(async (jobId, opts) => {
6376
6448
  try {
6377
6449
  const quote = neutralQuote(await buildClient(opts.profile).castSwap.fullQualityEstimate(jobId));
6378
6450
  if (opts.json) {