@nodaro/cli 1.35.0 → 1.37.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 +9 -0
- package/dist/index.js +387 -19
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -124,6 +124,7 @@ nodaro nodes run <type> --params-file body.json [--watch] [--poll-interval 1000]
|
|
|
124
124
|
|
|
125
125
|
# Models — browse the model catalog (makers, capability sheets, credit pricing, prompt tips)
|
|
126
126
|
nodaro models list [--kind video] [--mode i2v] [--family Google] [--featured]
|
|
127
|
+
nodaro models cost <id…> # credits charged per id; a metered LLM key (llm-chat:<model>) prints ~N, an estimate
|
|
127
128
|
|
|
128
129
|
# Pickers — valid values for parameter-picker nodes (setting, mood, person, …)
|
|
129
130
|
nodaro pickers list # all picker node types + option counts + pictures
|
|
@@ -141,6 +142,14 @@ nodaro recast estimate --analysis-job <id> # quote credits before c
|
|
|
141
142
|
nodaro recast create --workflow <id> --analysis-job <id> # BUYS THE PLAN
|
|
142
143
|
nodaro recast start <recastId> && nodaro recast status <recastId>
|
|
143
144
|
|
|
145
|
+
# Trends — ready-made Cast Swap recipes: put your own pictures in a trend (Cloud)
|
|
146
|
+
nodaro trends list [--search <text>] [--favorites] # the catalog
|
|
147
|
+
nodaro trends get <slug> # its slots, examples, resolutions
|
|
148
|
+
nodaro trends estimate <slug> --slot person=<url>,<url> --choice person.outfit=original # free quote
|
|
149
|
+
nodaro trends run <slug> --slot person=<url> # SPENDS CREDITS; prints the job id (--session: accepted, not yet applied)
|
|
150
|
+
nodaro trends runs [--trend <slug>]
|
|
151
|
+
nodaro trends favorite <slug> | unfavorite <slug>
|
|
152
|
+
|
|
144
153
|
nodaro executions get <id>
|
|
145
154
|
nodaro executions get <id> --watch
|
|
146
155
|
nodaro executions cancel <id> [--mode cancelled|stopping]
|
package/dist/index.js
CHANGED
|
@@ -17,7 +17,7 @@ import checkbox from '@inquirer/checkbox';
|
|
|
17
17
|
import input from '@inquirer/input';
|
|
18
18
|
import { CHARACTER_STYLES } from '@nodaro/shared/entities';
|
|
19
19
|
import { TRANSCRIBE_PROVIDERS, transcribeLaneSupportsWordTimestamps, DIALOGUE_PROVIDERS, dialogueStabilityAccepted, dialogueProviderOf, getDialogueCapabilities, TRANSCRIBE_LANES, DEFAULT_TRANSCRIBE_PROVIDER } from '@nodaro/shared/models';
|
|
20
|
-
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 } from '@nodaro/shared/media';
|
|
20
|
+
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';
|
|
21
21
|
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';
|
|
22
22
|
import { VIDEO_OVERLAY_PRESET_IDS, VIDEO_OVERLAY_CORNERS, VIDEO_OVERLAY_OUTPUT_ASPECTS, isVideoOverlayPresetId, isVideoOverlayCorner, isVideoOverlayOutputAspect, VIDEO_OVERLAY_FITS } from '@nodaro/shared/video';
|
|
23
23
|
import { SOCIAL_PLATFORMS, COMPETITOR_ACCOUNT_KEYS, isMeasurableCard, isSocialPost, COMPETITOR_ABOUT_PLATFORMS, COMPETITOR_SCHEDULES } from '@nodaro/shared/social';
|
|
@@ -41,7 +41,7 @@ var require_package = __commonJS({
|
|
|
41
41
|
"package.json"(exports$1, module) {
|
|
42
42
|
module.exports = {
|
|
43
43
|
name: "@nodaro/cli",
|
|
44
|
-
version: "1.
|
|
44
|
+
version: "1.37.0",
|
|
45
45
|
description: "Command-line interface for Nodaro \u2014 list and run workflows, inspect jobs and executions, manage projects from the terminal.",
|
|
46
46
|
type: "module",
|
|
47
47
|
license: "Apache-2.0",
|
|
@@ -82,8 +82,8 @@ var require_package = __commonJS({
|
|
|
82
82
|
"@inquirer/confirm": "^6.0.12",
|
|
83
83
|
"@inquirer/input": "^5.0.12",
|
|
84
84
|
"@inquirer/select": "^5.1.4",
|
|
85
|
-
"@nodaro/sdk": "^2.
|
|
86
|
-
"@nodaro/shared": "^3.
|
|
85
|
+
"@nodaro/sdk": "^2.37.0",
|
|
86
|
+
"@nodaro/shared": "^3.38.0",
|
|
87
87
|
commander: "^12.1.0",
|
|
88
88
|
picocolors: "^1.1.1",
|
|
89
89
|
"@nodaro/prompts": "^1.40.0"
|
|
@@ -413,7 +413,7 @@ function saveWorkspace(profileName, workspaceId) {
|
|
|
413
413
|
}
|
|
414
414
|
|
|
415
415
|
// src/client.ts
|
|
416
|
-
var CLI_VERSION = "1.
|
|
416
|
+
var CLI_VERSION = "1.37.0" ;
|
|
417
417
|
function buildPublicClient(opts = {}) {
|
|
418
418
|
const { profile } = getProfile(opts.profile);
|
|
419
419
|
return createClient({
|
|
@@ -1133,7 +1133,8 @@ function workflowsCommand() {
|
|
|
1133
1133
|
success(`Render final of ${renderNodeId} runs ${quote.nodeIds.join(", ")}`);
|
|
1134
1134
|
if (quote.estimatedCredits !== null) {
|
|
1135
1135
|
dim(
|
|
1136
|
-
|
|
1136
|
+
// `~`: an LLM node in the run is charged its actual usage, so the figure is an estimate.
|
|
1137
|
+
`estimated ${quote.estimatedCreditsIsEstimate ? "~" : ""}${quote.estimatedCredits} credits` + (quote.sufficient === false ? ` \u2014 not covered${quote.available !== null ? ` (${quote.available} available)` : ""}` : "")
|
|
1137
1138
|
);
|
|
1138
1139
|
}
|
|
1139
1140
|
return;
|
|
@@ -1835,10 +1836,14 @@ async function pickNodeInteractively(client) {
|
|
|
1835
1836
|
choices: result.data.map((n) => ({
|
|
1836
1837
|
name: `${n.label} \u2014 ${n.type}`,
|
|
1837
1838
|
value: n.type,
|
|
1838
|
-
description: `${n.category} \u2192 ${n.outputType}${n.creditCost ? ` (${n
|
|
1839
|
+
description: `${n.category} \u2192 ${n.outputType}${n.creditCost ? ` (${nodeCreditsLabel(n)})` : ""}`
|
|
1839
1840
|
}))
|
|
1840
1841
|
});
|
|
1841
1842
|
}
|
|
1843
|
+
function nodeCreditsLabel(n) {
|
|
1844
|
+
if (n.creditCost === "unpriced") return "unpriced";
|
|
1845
|
+
return `${n.estimate ? "~" : ""}${n.creditCost} cr`;
|
|
1846
|
+
}
|
|
1842
1847
|
function rejectPositionalParams(extras, example) {
|
|
1843
1848
|
if (!extras || extras.length === 0) return;
|
|
1844
1849
|
const looksLikeObject = extras[0].trim().startsWith("{");
|
|
@@ -1870,7 +1875,7 @@ function nodesCommand() {
|
|
|
1870
1875
|
label: n.label,
|
|
1871
1876
|
category: n.category,
|
|
1872
1877
|
outputType: n.outputType,
|
|
1873
|
-
credits: n.creditCost
|
|
1878
|
+
credits: n.creditCost === void 0 ? "" : n.estimate ? `~${n.creditCost}` : n.creditCost,
|
|
1874
1879
|
providers: n.providers ? n.providers.length : ""
|
|
1875
1880
|
})),
|
|
1876
1881
|
["type", "label", "category", "outputType", "credits", "providers"]
|
|
@@ -2373,7 +2378,7 @@ function promptCommand() {
|
|
|
2373
2378
|
const cmd = new Command("prompt").description(
|
|
2374
2379
|
"AI prompt wizard \u2014 analyze, generate, and enhance prompts for generation nodes"
|
|
2375
2380
|
);
|
|
2376
|
-
cmd.command("wizard").description("interactive: answer guided questions and get an optimized prompt").option("--node-type <type>", "target node type (omit for an interactive picker)").option("--prompt <text>", "your rough idea (optional)").option("--provider <name>").option("--style <name>").option("--aspect-ratio <ratio>").option("--duration <seconds>", "clip duration in seconds", (v) => parseInt(v, 10)).option("--llm-model <id>").option("--reasoning-effort <level>", "reasoning effort: none|low|medium|high|xhigh|max (model-dependent)").option("--advanced", "Gemini and Claude models: run on the provider's own API so --temperature/--max-tokens/the full reasoning range apply.
|
|
2381
|
+
cmd.command("wizard").description("interactive: answer guided questions and get an optimized prompt").option("--node-type <type>", "target node type (omit for an interactive picker)").option("--prompt <text>", "your rough idea (optional)").option("--provider <name>").option("--style <name>").option("--aspect-ratio <ratio>").option("--duration <seconds>", "clip duration in seconds", (v) => parseInt(v, 10)).option("--llm-model <id>").option("--reasoning-effort <level>", "reasoning effort: none|low|medium|high|xhigh|max (model-dependent)").option("--advanced", "Gemini and Claude models: run on the provider's own API so --temperature/--max-tokens/the full reasoning range apply. Charged per token at that lane's rate.").option("--temperature <n>", "Sampling temperature (only with --advanced)", parseFloat).option("--max-tokens <n>", "Output token cap (only with --advanced)", (v) => parseInt(v, 10)).option("--profile <name>").action(async (opts) => {
|
|
2377
2382
|
try {
|
|
2378
2383
|
if (!isInteractive()) {
|
|
2379
2384
|
warn("`prompt wizard` needs an interactive terminal \u2014 use `prompt analyze` + `prompt generate`, or `prompt enhance`, in scripts.");
|
|
@@ -2423,7 +2428,7 @@ function promptCommand() {
|
|
|
2423
2428
|
handleError(err);
|
|
2424
2429
|
}
|
|
2425
2430
|
});
|
|
2426
|
-
cmd.command("analyze").description("return guided questions for a rough prompt idea").requiredOption("--node-type <type>").option("--prompt <text>").option("--provider <name>").option("--style <name>").option("--aspect-ratio <ratio>").option("--duration <seconds>", "clip duration in seconds", (v) => parseInt(v, 10)).option("--llm-model <id>").option("--reasoning-effort <level>", "reasoning effort: none|low|medium|high|xhigh|max (model-dependent)").option("--advanced", "Gemini and Claude models: run on the provider's own API so --temperature/--max-tokens/the full reasoning range apply.
|
|
2431
|
+
cmd.command("analyze").description("return guided questions for a rough prompt idea").requiredOption("--node-type <type>").option("--prompt <text>").option("--provider <name>").option("--style <name>").option("--aspect-ratio <ratio>").option("--duration <seconds>", "clip duration in seconds", (v) => parseInt(v, 10)).option("--llm-model <id>").option("--reasoning-effort <level>", "reasoning effort: none|low|medium|high|xhigh|max (model-dependent)").option("--advanced", "Gemini and Claude models: run on the provider's own API so --temperature/--max-tokens/the full reasoning range apply. Charged per token at that lane's rate.").option("--temperature <n>", "Sampling temperature (only with --advanced)", parseFloat).option("--max-tokens <n>", "Output token cap (only with --advanced)", (v) => parseInt(v, 10)).option("--profile <name>").option("--json").action(async (opts) => {
|
|
2427
2432
|
try {
|
|
2428
2433
|
const client = buildClient(opts.profile);
|
|
2429
2434
|
const { jobId, questions } = await client.promptHelper.analyze({
|
|
@@ -2448,7 +2453,7 @@ function promptCommand() {
|
|
|
2448
2453
|
handleError(err);
|
|
2449
2454
|
}
|
|
2450
2455
|
});
|
|
2451
|
-
cmd.command("generate").description("build an optimized prompt from --selection category=value flags").requiredOption("--node-type <type>").option("--selection <pairs...>", "category=value (repeat); custom answers are wizard-only", collectVariadic).option("--original-prompt <text>").option("--provider <name>").option("--style <name>").option("--aspect-ratio <ratio>").option("--duration <seconds>", "clip duration in seconds", (v) => parseInt(v, 10)).option("--llm-model <id>").option("--reasoning-effort <level>", "reasoning effort: none|low|medium|high|xhigh|max (model-dependent)").option("--advanced", "Gemini and Claude models: run on the provider's own API so --temperature/--max-tokens/the full reasoning range apply.
|
|
2456
|
+
cmd.command("generate").description("build an optimized prompt from --selection category=value flags").requiredOption("--node-type <type>").option("--selection <pairs...>", "category=value (repeat); custom answers are wizard-only", collectVariadic).option("--original-prompt <text>").option("--provider <name>").option("--style <name>").option("--aspect-ratio <ratio>").option("--duration <seconds>", "clip duration in seconds", (v) => parseInt(v, 10)).option("--llm-model <id>").option("--reasoning-effort <level>", "reasoning effort: none|low|medium|high|xhigh|max (model-dependent)").option("--advanced", "Gemini and Claude models: run on the provider's own API so --temperature/--max-tokens/the full reasoning range apply. Charged per token at that lane's rate.").option("--temperature <n>", "Sampling temperature (only with --advanced)", parseFloat).option("--max-tokens <n>", "Output token cap (only with --advanced)", (v) => parseInt(v, 10)).option("--profile <name>").option("--json").action(async (opts) => {
|
|
2452
2457
|
try {
|
|
2453
2458
|
const client = buildClient(opts.profile);
|
|
2454
2459
|
const selections = parseSelectionPairs(opts.selection);
|
|
@@ -2468,7 +2473,7 @@ function promptCommand() {
|
|
|
2468
2473
|
handleError(err);
|
|
2469
2474
|
}
|
|
2470
2475
|
});
|
|
2471
|
-
cmd.command("enhance").description("rewrite a rough idea into one optimized prompt (no questions)").requiredOption("--node-type <type>").option("--prompt <text>").option("--provider <name>").option("--style <name>").option("--aspect-ratio <ratio>").option("--duration <seconds>", "clip duration in seconds", (v) => parseInt(v, 10)).option("--llm-model <id>").option("--reasoning-effort <level>", "reasoning effort: none|low|medium|high|xhigh|max (model-dependent)").option("--advanced", "Gemini and Claude models: run on the provider's own API so --temperature/--max-tokens/the full reasoning range apply.
|
|
2476
|
+
cmd.command("enhance").description("rewrite a rough idea into one optimized prompt (no questions)").requiredOption("--node-type <type>").option("--prompt <text>").option("--provider <name>").option("--style <name>").option("--aspect-ratio <ratio>").option("--duration <seconds>", "clip duration in seconds", (v) => parseInt(v, 10)).option("--llm-model <id>").option("--reasoning-effort <level>", "reasoning effort: none|low|medium|high|xhigh|max (model-dependent)").option("--advanced", "Gemini and Claude models: run on the provider's own API so --temperature/--max-tokens/the full reasoning range apply. Charged per token at that lane's rate.").option("--temperature <n>", "Sampling temperature (only with --advanced)", parseFloat).option("--max-tokens <n>", "Output token cap (only with --advanced)", (v) => parseInt(v, 10)).option("--profile <name>").option("--json").action(async (opts) => {
|
|
2472
2477
|
try {
|
|
2473
2478
|
const client = buildClient(opts.profile);
|
|
2474
2479
|
const result = await client.promptHelper.enhance({
|
|
@@ -3049,6 +3054,16 @@ function parseSafeArea(raw) {
|
|
|
3049
3054
|
const [x, y, w, h] = parts;
|
|
3050
3055
|
return { x, y, w, h };
|
|
3051
3056
|
}
|
|
3057
|
+
function parseVideoMaskZone(raw) {
|
|
3058
|
+
const parts = raw.split(",").map((n) => n.trim());
|
|
3059
|
+
const nums = parts.map((n) => /^(?:\d+\.?\d*|\.\d+)$/.test(n) ? Number(n) : Number.NaN);
|
|
3060
|
+
if (nums.length !== 4 || nums.some((n) => !(n >= VIDEO_MASK_LIMITS.ZONE_MARGIN_PCT_MIN && n <= VIDEO_MASK_LIMITS.ZONE_MARGIN_PCT_MAX))) {
|
|
3061
|
+
warn(`--zone must be "left,right,top,bottom", each a % of the frame from ${VIDEO_MASK_LIMITS.ZONE_MARGIN_PCT_MIN} to ${VIDEO_MASK_LIMITS.ZONE_MARGIN_PCT_MAX}, e.g. 10,10,5,5 (got "${raw}")`);
|
|
3062
|
+
process.exit(1);
|
|
3063
|
+
}
|
|
3064
|
+
const [leftPct, rightPct, topPct, bottomPct] = nums;
|
|
3065
|
+
return { leftPct, rightPct, topPct, bottomPct };
|
|
3066
|
+
}
|
|
3052
3067
|
function mediaCommand() {
|
|
3053
3068
|
const cmd = new Command("media").description(
|
|
3054
3069
|
"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"
|
|
@@ -3652,11 +3667,12 @@ image, passed through unchanged): \`nodaro jobs get <jobId>\`. Use the mask for
|
|
|
3652
3667
|
handleError(err);
|
|
3653
3668
|
}
|
|
3654
3669
|
});
|
|
3655
|
-
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("--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", `
|
|
3670
|
+
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)").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("--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", `
|
|
3656
3671
|
Examples:
|
|
3657
3672
|
$ nodaro media video-mask https://x/dance.mp4 "the dancer" --watch
|
|
3658
3673
|
$ nodaro media video-mask https://x/street.mp4 "person, dog" --threshold 0.3 --watch
|
|
3659
3674
|
$ nodaro media video-mask https://x/long-take.mp4 "the skater" --model sam-3 --watch
|
|
3675
|
+
$ nodaro media video-mask https://x/edit.mp4 "face" --per-shot --zone 10,10,5,5 --watch
|
|
3660
3676
|
|
|
3661
3677
|
Clips up to ${VIDEO_MASK_LIMITS.MAX_BILLED_SEC} s at ${VIDEO_MASK_LIMITS.FPS_BASIS} fps (a faster clip counts proportionally longer); priced by the
|
|
3662
3678
|
clip's length. Feed the mask to \`nodaro media mask-composite\`.`).action(async (videoUrl, prompt, opts) => {
|
|
@@ -3669,27 +3685,67 @@ clip's length. Feed the mask to \`nodaro media mask-composite\`.`).action(async
|
|
|
3669
3685
|
warn(`--threshold must be between ${VIDEO_MASK_LIMITS.THRESHOLD_MIN} and ${VIDEO_MASK_LIMITS.THRESHOLD_MAX}`);
|
|
3670
3686
|
process.exit(1);
|
|
3671
3687
|
}
|
|
3688
|
+
if (opts.minSubjectHeight !== void 0 && !(Number.isFinite(opts.minSubjectHeight) && opts.minSubjectHeight >= VIDEO_MASK_LIMITS.MIN_SUBJECT_HEIGHT_PCT_MIN && opts.minSubjectHeight <= VIDEO_MASK_LIMITS.MIN_SUBJECT_HEIGHT_PCT_MAX)) {
|
|
3689
|
+
warn(`--min-subject-height must be a number from ${VIDEO_MASK_LIMITS.MIN_SUBJECT_HEIGHT_PCT_MIN} to ${VIDEO_MASK_LIMITS.MIN_SUBJECT_HEIGHT_PCT_MAX}`);
|
|
3690
|
+
process.exit(1);
|
|
3691
|
+
}
|
|
3692
|
+
if (opts.maxSubjectHeight !== void 0 && !(Number.isFinite(opts.maxSubjectHeight) && opts.maxSubjectHeight >= VIDEO_MASK_LIMITS.MAX_SUBJECT_HEIGHT_PCT_MIN && opts.maxSubjectHeight <= VIDEO_MASK_LIMITS.MAX_SUBJECT_HEIGHT_PCT_MAX)) {
|
|
3693
|
+
warn(`--max-subject-height must be a number from ${VIDEO_MASK_LIMITS.MAX_SUBJECT_HEIGHT_PCT_MIN} to ${VIDEO_MASK_LIMITS.MAX_SUBJECT_HEIGHT_PCT_MAX}`);
|
|
3694
|
+
process.exit(1);
|
|
3695
|
+
}
|
|
3696
|
+
if ((opts.minSubjectHeight ?? 0) > 0 && (opts.maxSubjectHeight ?? 0) > 0 && opts.minSubjectHeight > opts.maxSubjectHeight) {
|
|
3697
|
+
warn("--min-subject-height is above --max-subject-height: no subject could be kept");
|
|
3698
|
+
process.exit(1);
|
|
3699
|
+
}
|
|
3700
|
+
const zone = opts.zone !== void 0 ? parseVideoMaskZone(opts.zone) : void 0;
|
|
3672
3701
|
const client = buildClient(opts.profile);
|
|
3673
3702
|
const result = await client.media.videoMask({
|
|
3674
3703
|
videoUrl,
|
|
3675
3704
|
prompt,
|
|
3676
3705
|
...opts.threshold !== void 0 ? { threshold: opts.threshold } : {},
|
|
3677
|
-
...opts.model ? { provider: opts.model } : {}
|
|
3706
|
+
...opts.model ? { provider: opts.model } : {},
|
|
3707
|
+
...opts.holdLastMask ? { holdLastMask: true } : {},
|
|
3708
|
+
...opts.minSubjectHeight !== void 0 ? { minSubjectHeightPct: opts.minSubjectHeight } : {},
|
|
3709
|
+
...opts.maxSubjectHeight !== void 0 ? { maxSubjectHeightPct: opts.maxSubjectHeight } : {},
|
|
3710
|
+
...zone ? { zone } : {},
|
|
3711
|
+
...opts.perShot ? { perShot: true } : {}
|
|
3678
3712
|
});
|
|
3679
3713
|
await reportQueuedJob(result, () => client.jobs.get(result.jobId), { ...opts, note: "video mask" });
|
|
3680
3714
|
} catch (err) {
|
|
3681
3715
|
handleError(err);
|
|
3682
3716
|
}
|
|
3683
3717
|
});
|
|
3684
|
-
cmd.command("mask-composite <
|
|
3718
|
+
cmd.command("mask-composite <urls...>").description("put a foreground video over a background video through a mask video (white = foreground) \u2014 local compositor, no AI. Takes <foregroundUrl> <backgroundUrl> <maskUrl>; with --fill pixelate|blur, <backgroundUrl> <maskUrl>").option("--invert", "swap which side of the mask shows the foreground").option("--feather <px>", `edge softening ${MASK_COMPOSITE_BOUNDS.FEATHER_MIN}\u2013${MASK_COMPOSITE_BOUNDS.FEATHER_MAX} px (default ${MASK_COMPOSITE_DEFAULTS.feather})`, (v) => parseInt(v, 10)).option("--grow <px>", `grow (+) or shrink (\u2212) the foreground region, ${MASK_COMPOSITE_BOUNDS.GROW_MIN}\u2013${MASK_COMPOSITE_BOUNDS.GROW_MAX} px (default 0)`, (v) => parseInt(v, 10)).option("--background-fit <fit>", `${MASK_COMPOSITE_BACKGROUND_FITS.join(" | ")} (default ${MASK_COMPOSITE_DEFAULTS.backgroundFit})`).option("--audio <source>", `${MASK_COMPOSITE_AUDIO_SOURCES.join(" | ")} (default ${MASK_COMPOSITE_DEFAULTS.audioSource})`).option("--fill <fill>", `what fills the mask: ${MASK_COMPOSITE_FILLS.join(" | ")} (default ${MASK_COMPOSITE_DEFAULTS.fill}; pixelate / blur use the background itself and take no foreground)`).option("--pixel-size-pct <pct>", `pixelate block size, % of the frame width, ${MASK_COMPOSITE_BOUNDS.PIXEL_SIZE_PCT_MIN}\u2013${MASK_COMPOSITE_BOUNDS.PIXEL_SIZE_PCT_MAX} (default ${MASK_COMPOSITE_DEFAULTS.pixelSizePct})`, (v) => Number(v)).option("--blur-strength-pct <pct>", `blur strength (sigma), % of the frame width, ${MASK_COMPOSITE_BOUNDS.BLUR_STRENGTH_PCT_MIN}\u2013${MASK_COMPOSITE_BOUNDS.BLUR_STRENGTH_PCT_MAX} (default ${MASK_COMPOSITE_DEFAULTS.blurStrengthPct})`, (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", `
|
|
3685
3719
|
Example:
|
|
3686
3720
|
$ nodaro media mask-composite https://x/dance.mp4 https://x/beach.mp4 https://x/dance-mask.mp4 --feather 4 --grow -1 --watch
|
|
3721
|
+
$ nodaro media mask-composite https://x/street.mp4 https://x/faces-mask.mp4 --fill pixelate --pixel-size-pct 2 --watch
|
|
3687
3722
|
|
|
3688
3723
|
The result follows the FOREGROUND's size, frame rate and length; the background
|
|
3689
|
-
is fitted to that frame and loops when shorter; the mask holds its last frame
|
|
3690
|
-
|
|
3724
|
+
is fitted to that frame and loops when shorter; the mask holds its last frame.
|
|
3725
|
+
With --fill pixelate or blur the masked area is the background itself,
|
|
3726
|
+
pixelated or blurred, and the result follows the background.`).action(
|
|
3727
|
+
async (urls, opts) => {
|
|
3691
3728
|
try {
|
|
3692
3729
|
const b = MASK_COMPOSITE_BOUNDS;
|
|
3730
|
+
if (opts.fill && !MASK_COMPOSITE_FILLS.includes(opts.fill)) {
|
|
3731
|
+
warn(`--fill must be one of ${MASK_COMPOSITE_FILLS.join(", ")} (got "${opts.fill}")`);
|
|
3732
|
+
process.exit(1);
|
|
3733
|
+
}
|
|
3734
|
+
const fill = opts.fill ?? MASK_COMPOSITE_DEFAULTS.fill;
|
|
3735
|
+
const withForeground = fill === "video";
|
|
3736
|
+
if (urls.length !== (withForeground ? 3 : 2)) {
|
|
3737
|
+
warn(withForeground ? "give <foregroundUrl> <backgroundUrl> <maskUrl>" : `with --fill ${fill}, give <backgroundUrl> <maskUrl> (no foreground)`);
|
|
3738
|
+
process.exit(1);
|
|
3739
|
+
}
|
|
3740
|
+
const [foregroundUrl, backgroundUrl, maskUrl] = withForeground ? urls : [void 0, ...urls];
|
|
3741
|
+
if (opts.pixelSizePct !== void 0 && !(Number.isFinite(opts.pixelSizePct) && opts.pixelSizePct >= b.PIXEL_SIZE_PCT_MIN && opts.pixelSizePct <= b.PIXEL_SIZE_PCT_MAX)) {
|
|
3742
|
+
warn(`--pixel-size-pct must be a number from ${b.PIXEL_SIZE_PCT_MIN} to ${b.PIXEL_SIZE_PCT_MAX}`);
|
|
3743
|
+
process.exit(1);
|
|
3744
|
+
}
|
|
3745
|
+
if (opts.blurStrengthPct !== void 0 && !(Number.isFinite(opts.blurStrengthPct) && opts.blurStrengthPct >= b.BLUR_STRENGTH_PCT_MIN && opts.blurStrengthPct <= b.BLUR_STRENGTH_PCT_MAX)) {
|
|
3746
|
+
warn(`--blur-strength-pct must be a number from ${b.BLUR_STRENGTH_PCT_MIN} to ${b.BLUR_STRENGTH_PCT_MAX}`);
|
|
3747
|
+
process.exit(1);
|
|
3748
|
+
}
|
|
3693
3749
|
if (opts.feather !== void 0 && !(Number.isInteger(opts.feather) && opts.feather >= b.FEATHER_MIN && opts.feather <= b.FEATHER_MAX)) {
|
|
3694
3750
|
warn(`--feather must be a whole number from ${b.FEATHER_MIN} to ${b.FEATHER_MAX}`);
|
|
3695
3751
|
process.exit(1);
|
|
@@ -3708,14 +3764,17 @@ is fitted to that frame and loops when shorter; the mask holds its last frame.`)
|
|
|
3708
3764
|
}
|
|
3709
3765
|
const client = buildClient(opts.profile);
|
|
3710
3766
|
const result = await client.media.maskComposite({
|
|
3711
|
-
foregroundUrl,
|
|
3767
|
+
...foregroundUrl ? { foregroundUrl } : {},
|
|
3712
3768
|
backgroundUrl,
|
|
3713
3769
|
maskUrl,
|
|
3714
3770
|
...opts.invert ? { invertMask: true } : {},
|
|
3715
3771
|
...opts.feather !== void 0 ? { feather: opts.feather } : {},
|
|
3716
3772
|
...opts.grow !== void 0 ? { grow: opts.grow } : {},
|
|
3717
3773
|
...opts.backgroundFit ? { backgroundFit: opts.backgroundFit } : {},
|
|
3718
|
-
...opts.audio ? { audioSource: opts.audio } : {}
|
|
3774
|
+
...opts.audio ? { audioSource: opts.audio } : {},
|
|
3775
|
+
...opts.fill ? { fill } : {},
|
|
3776
|
+
...opts.pixelSizePct !== void 0 ? { pixelSizePct: opts.pixelSizePct } : {},
|
|
3777
|
+
...opts.blurStrengthPct !== void 0 ? { blurStrengthPct: opts.blurStrengthPct } : {}
|
|
3719
3778
|
});
|
|
3720
3779
|
await reportQueuedJob(result, () => client.jobs.get(result.jobId), { ...opts, note: "mask composite" });
|
|
3721
3780
|
} catch (err) {
|
|
@@ -5615,8 +5674,50 @@ Examples:
|
|
|
5615
5674
|
}
|
|
5616
5675
|
}
|
|
5617
5676
|
);
|
|
5677
|
+
cmd.command("cost <ids...>").description(
|
|
5678
|
+
"credits each identifier is charged \u2014 a model id, a credit id, or a metered LLM price key (<feature>:<model>[:direct]); an estimate prints as ~N"
|
|
5679
|
+
).option("--profile <name>").option("--json").addHelpText(
|
|
5680
|
+
"after",
|
|
5681
|
+
`
|
|
5682
|
+
A metered LLM price key (llmPriceKey from @nodaro/shared/llm-models) is
|
|
5683
|
+
charged for the tokens the call actually uses, so its figure is an estimate of
|
|
5684
|
+
a typical call and prints as ~N. Every model's per-token rate:
|
|
5685
|
+
docs/pricing/llm-models.md.
|
|
5686
|
+
|
|
5687
|
+
Examples:
|
|
5688
|
+
$ nodaro models cost nano-banana-pro seedance-2-fast
|
|
5689
|
+
$ nodaro models cost llm-chat:gemini-3.6-flash llm-chat:claude-opus-5.5:direct
|
|
5690
|
+
$ nodaro models cost llm-chat:claude-fable-5 --json`
|
|
5691
|
+
).action(async (ids, opts) => {
|
|
5692
|
+
try {
|
|
5693
|
+
const client = buildClient(opts.profile);
|
|
5694
|
+
const result = await client.credits.modelCosts(ids);
|
|
5695
|
+
if (opts.json) {
|
|
5696
|
+
emit(result, opts);
|
|
5697
|
+
return;
|
|
5698
|
+
}
|
|
5699
|
+
table(costRows(ids, result), ["id", "credits", "note"]);
|
|
5700
|
+
} catch (err) {
|
|
5701
|
+
handleError(err);
|
|
5702
|
+
}
|
|
5703
|
+
});
|
|
5618
5704
|
return cmd;
|
|
5619
5705
|
}
|
|
5706
|
+
function costRows(ids, result) {
|
|
5707
|
+
const estimates = new Set(result.estimates ?? []);
|
|
5708
|
+
const missing = new Set(result.missing);
|
|
5709
|
+
const errors = new Set(result.errors);
|
|
5710
|
+
return [...new Set(ids)].map((id) => {
|
|
5711
|
+
const credits = result.data[id];
|
|
5712
|
+
if (typeof credits === "number") {
|
|
5713
|
+
const estimate = estimates.has(id);
|
|
5714
|
+
return { id, credits: estimate ? `~${credits}` : String(credits), note: estimate ? "estimate: charged per token used" : "" };
|
|
5715
|
+
}
|
|
5716
|
+
if (errors.has(id)) return { id, credits: "-", note: terminalSafe(result.errorCodes?.[id]?.message ?? "could not be priced") };
|
|
5717
|
+
if (missing.has(id)) return { id, credits: "-", note: "no price on this server" };
|
|
5718
|
+
return { id, credits: "-", note: "not asked (over the batch limit)" };
|
|
5719
|
+
});
|
|
5720
|
+
}
|
|
5620
5721
|
function readJsonObject2(path, flag) {
|
|
5621
5722
|
let raw;
|
|
5622
5723
|
try {
|
|
@@ -5821,6 +5922,271 @@ function recastCommand() {
|
|
|
5821
5922
|
});
|
|
5822
5923
|
return cmd;
|
|
5823
5924
|
}
|
|
5925
|
+
var RESOLUTIONS = ["480p", "720p", "1080p"];
|
|
5926
|
+
var SLOT_KEY_RE = /^[a-z0-9_]{1,32}$/;
|
|
5927
|
+
var URL_SPLIT_RE = /,(?=\s*https?:\/\/)/i;
|
|
5928
|
+
var CHIPS = ["body", "outfit", "hair", "coat", "shape", "finish"];
|
|
5929
|
+
function addRunFlags(cmd) {
|
|
5930
|
+
return cmd.option(
|
|
5931
|
+
"--slot <key=url[,url]>",
|
|
5932
|
+
"a slot's pictures, 1-3 per slot (repeat for each slot; the same key again adds pictures)",
|
|
5933
|
+
collectVariadic
|
|
5934
|
+
).option(
|
|
5935
|
+
"--choice <key.chip=new|original>",
|
|
5936
|
+
"a slot's chip: make it anew from your pictures or keep the clip's, e.g. person.outfit=original (repeatable)",
|
|
5937
|
+
collectVariadic
|
|
5938
|
+
).option("--example <n>", "1-based example whose pictures fill the optional slots you leave empty (default 1)").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(new Option("--resolution <r>", "default 480p").choices([...RESOLUTIONS])).option("--no-draft", "a full run instead of a draft (a draft is 480p only, and the default there)");
|
|
5939
|
+
}
|
|
5940
|
+
function checkSlotKey(flag, spec, key2) {
|
|
5941
|
+
if (!SLOT_KEY_RE.test(key2) || key2 === "__proto__") {
|
|
5942
|
+
throw new Error(`${flag} ${spec}: "${key2}" is not a slot key (lowercase letters, digits and _, up to 32; see \`nodaro trends get <slug>\`)`);
|
|
5943
|
+
}
|
|
5944
|
+
}
|
|
5945
|
+
function parseSlot(spec) {
|
|
5946
|
+
const eq = spec.indexOf("=");
|
|
5947
|
+
const key2 = eq === -1 ? "" : spec.slice(0, eq).trim();
|
|
5948
|
+
const images = eq === -1 ? [] : spec.slice(eq + 1).split(URL_SPLIT_RE).map((u) => u.trim()).filter(Boolean);
|
|
5949
|
+
if (!key2 || images.length === 0) {
|
|
5950
|
+
throw new Error(`--slot ${spec}: expected key=url[,url], e.g. --slot person=https://example.com/me.jpg`);
|
|
5951
|
+
}
|
|
5952
|
+
checkSlotKey("--slot", spec, key2);
|
|
5953
|
+
return { key: key2, images };
|
|
5954
|
+
}
|
|
5955
|
+
function parseChoice(spec) {
|
|
5956
|
+
const eq = spec.indexOf("=");
|
|
5957
|
+
const target = eq === -1 ? "" : spec.slice(0, eq).trim();
|
|
5958
|
+
const value = eq === -1 ? "" : spec.slice(eq + 1).trim();
|
|
5959
|
+
const dot = target.lastIndexOf(".");
|
|
5960
|
+
const key2 = dot === -1 ? "" : target.slice(0, dot);
|
|
5961
|
+
const chip = dot === -1 ? "" : target.slice(dot + 1);
|
|
5962
|
+
if (!key2 || !chip) {
|
|
5963
|
+
throw new Error(`--choice ${spec}: expected key.chip=new|original, e.g. --choice person.outfit=original`);
|
|
5964
|
+
}
|
|
5965
|
+
if (!CHIPS.includes(chip)) {
|
|
5966
|
+
throw new Error(`--choice ${spec}: the chip must be one of ${CHIPS.slice(0, -1).join(", ")} or ${CHIPS.at(-1)}`);
|
|
5967
|
+
}
|
|
5968
|
+
if (value !== "new" && value !== "original") {
|
|
5969
|
+
throw new Error(`--choice ${spec}: the value must be new or original`);
|
|
5970
|
+
}
|
|
5971
|
+
checkSlotKey("--choice", spec, key2);
|
|
5972
|
+
return { key: key2, chip, value };
|
|
5973
|
+
}
|
|
5974
|
+
function parseLimit(raw) {
|
|
5975
|
+
if (raw === void 0) return void 0;
|
|
5976
|
+
const n = Number(raw);
|
|
5977
|
+
if (!/^\d+$/.test(raw.trim()) || !Number.isInteger(n) || n < 1 || n > 60) {
|
|
5978
|
+
throw new Error(`--limit ${raw}: expected a whole number from 1 to 60`);
|
|
5979
|
+
}
|
|
5980
|
+
return n;
|
|
5981
|
+
}
|
|
5982
|
+
function buildRequest(flags) {
|
|
5983
|
+
const slots = /* @__PURE__ */ Object.create(null);
|
|
5984
|
+
for (const spec of flags.slot ?? []) {
|
|
5985
|
+
const { key: key2, images } = parseSlot(spec);
|
|
5986
|
+
const slot = slots[key2] ??= {};
|
|
5987
|
+
slot.images = [...slot.images ?? [], ...images];
|
|
5988
|
+
}
|
|
5989
|
+
for (const spec of flags.choice ?? []) {
|
|
5990
|
+
const { key: key2, chip, value } = parseChoice(spec);
|
|
5991
|
+
(slots[key2] ??= {})[chip] = value;
|
|
5992
|
+
}
|
|
5993
|
+
const request = { slots };
|
|
5994
|
+
if (flags.example !== void 0) {
|
|
5995
|
+
const n = Number(flags.example);
|
|
5996
|
+
if (!Number.isInteger(n) || n < 1) throw new Error(`--example ${flags.example}: expected a whole number from 1`);
|
|
5997
|
+
request.example = n;
|
|
5998
|
+
}
|
|
5999
|
+
if (flags.details !== void 0) request.details = flags.details;
|
|
6000
|
+
if (flags.preview) request.preview = true;
|
|
6001
|
+
if (flags.resolution) request.resolution = flags.resolution;
|
|
6002
|
+
if (flags.draft === false) request.draft = false;
|
|
6003
|
+
return request;
|
|
6004
|
+
}
|
|
6005
|
+
function trendsCommand() {
|
|
6006
|
+
const cmd = new Command("trends").description(
|
|
6007
|
+
"trends \u2014 ready-made Cast Swap recipes: browse, quote, run with your own pictures, favorite (Cloud edition)"
|
|
6008
|
+
);
|
|
6009
|
+
cmd.command("list").description("the published trend catalog, in its curated order").option("--search <text>", "search text").option("--tag <tag>", "only trends with this tag").option("--favorites", "only your favorites").option("--locale <locale>", "language of names and descriptions (default your profile's, then English)").option("--limit <n>", "page size (1-60)").option("--cursor <cursor>", "the previous page's next").option("--profile <name>").option("--json").action(async (opts) => {
|
|
6010
|
+
try {
|
|
6011
|
+
const limit = parseLimit(opts.limit);
|
|
6012
|
+
const client = buildClient(opts.profile);
|
|
6013
|
+
const page = await client.trends.list({
|
|
6014
|
+
q: opts.search,
|
|
6015
|
+
tag: opts.tag,
|
|
6016
|
+
favorites: opts.favorites,
|
|
6017
|
+
locale: opts.locale,
|
|
6018
|
+
limit,
|
|
6019
|
+
cursor: opts.cursor
|
|
6020
|
+
});
|
|
6021
|
+
if (opts.json) {
|
|
6022
|
+
emit(page, opts);
|
|
6023
|
+
return;
|
|
6024
|
+
}
|
|
6025
|
+
table(
|
|
6026
|
+
page.data.map((t) => ({
|
|
6027
|
+
slug: t.slug,
|
|
6028
|
+
name: t.name,
|
|
6029
|
+
needs: Object.entries(t.needs).filter(([, n]) => n > 0).map(([kind, n]) => `${n} ${kind}`).join(", "),
|
|
6030
|
+
seconds: t.durationSec,
|
|
6031
|
+
tags: t.tags.join(", "),
|
|
6032
|
+
favorite: t.isFavorite ? "\u2605" : ""
|
|
6033
|
+
})),
|
|
6034
|
+
["slug", "name", "needs", "seconds", "tags", "favorite"]
|
|
6035
|
+
);
|
|
6036
|
+
if (page.next) dim(`next: --cursor ${page.next}`);
|
|
6037
|
+
} catch (err) {
|
|
6038
|
+
handleError(err);
|
|
6039
|
+
}
|
|
6040
|
+
});
|
|
6041
|
+
cmd.command("get <slug>").description("a trend's page: its slots, examples, preview and resolutions").option("--locale <locale>", "language of names and descriptions").option("--profile <name>").option("--json").action(async (slug, opts) => {
|
|
6042
|
+
try {
|
|
6043
|
+
const trend = await buildClient(opts.profile).trends.get(slug, { locale: opts.locale });
|
|
6044
|
+
if (opts.json) emit(trend, opts);
|
|
6045
|
+
else detail(trend);
|
|
6046
|
+
} catch (err) {
|
|
6047
|
+
handleError(err);
|
|
6048
|
+
}
|
|
6049
|
+
});
|
|
6050
|
+
addRunFlags(
|
|
6051
|
+
cmd.command("estimate <slug>").description("quote a run before starting it (free)")
|
|
6052
|
+
).option("--profile <name>").option("--json").action(async (slug, opts) => {
|
|
6053
|
+
try {
|
|
6054
|
+
const request = buildRequest(opts);
|
|
6055
|
+
const quote = await buildClient(opts.profile).trends.estimate(slug, request);
|
|
6056
|
+
if (opts.json) {
|
|
6057
|
+
emit(quote, opts);
|
|
6058
|
+
return;
|
|
6059
|
+
}
|
|
6060
|
+
info(
|
|
6061
|
+
`about ${quote.expectedCredits} credits` + (quote.holdCredits !== quote.expectedCredits ? ` (up to ${quote.holdCredits} held while it runs)` : "")
|
|
6062
|
+
);
|
|
6063
|
+
for (const [part, credits] of Object.entries(quote.breakdown)) dim(` ${terminalSafe(part)}: ${credits}`);
|
|
6064
|
+
} catch (err) {
|
|
6065
|
+
handleError(err);
|
|
6066
|
+
}
|
|
6067
|
+
});
|
|
6068
|
+
addRunFlags(
|
|
6069
|
+
cmd.command("run <slug>").description("start a run \u2014 SPENDS CREDITS; run `estimate` first. Prints the job to follow")
|
|
6070
|
+
).option("--session <id>", "a generation session of yours (accepted; not yet applied: trend runs are not filed into sessions yet)").option("--idempotency-key <key>", "8-200 characters; a retry with the same key returns the first run's job").option("--profile <name>").option("--json").action(async (slug, opts) => {
|
|
6071
|
+
try {
|
|
6072
|
+
const request = buildRequest(opts);
|
|
6073
|
+
if (opts.session) request.sessionId = opts.session;
|
|
6074
|
+
const result = await buildClient(opts.profile).trends.run(
|
|
6075
|
+
slug,
|
|
6076
|
+
request,
|
|
6077
|
+
opts.idempotencyKey ? { idempotencyKey: opts.idempotencyKey } : {}
|
|
6078
|
+
);
|
|
6079
|
+
if (opts.json) {
|
|
6080
|
+
emit(result, opts);
|
|
6081
|
+
return;
|
|
6082
|
+
}
|
|
6083
|
+
success(`started trend run \u2014 job ${result.jobId}`);
|
|
6084
|
+
dim(`follow it: nodaro jobs get ${result.jobId}`);
|
|
6085
|
+
} catch (err) {
|
|
6086
|
+
handleError(err);
|
|
6087
|
+
}
|
|
6088
|
+
});
|
|
6089
|
+
cmd.command("runs").description("your trend runs, newest first").option("--trend <slug>", "only runs of this trend").option("--limit <n>", "page size (1-60)").option("--cursor <cursor>", "the previous page's next").option("--profile <name>").option("--json").action(async (opts) => {
|
|
6090
|
+
try {
|
|
6091
|
+
const limit = parseLimit(opts.limit);
|
|
6092
|
+
const page = await buildClient(opts.profile).trends.runs({
|
|
6093
|
+
trend: opts.trend,
|
|
6094
|
+
cursor: opts.cursor,
|
|
6095
|
+
limit
|
|
6096
|
+
});
|
|
6097
|
+
if (opts.json) {
|
|
6098
|
+
emit(page, opts);
|
|
6099
|
+
return;
|
|
6100
|
+
}
|
|
6101
|
+
table(
|
|
6102
|
+
page.data.map((r) => ({
|
|
6103
|
+
jobId: r.jobId,
|
|
6104
|
+
trend: r.trend.slug,
|
|
6105
|
+
status: r.status,
|
|
6106
|
+
resolution: r.preview ? `${r.resolution} preview` : r.resolution,
|
|
6107
|
+
draft: r.draft,
|
|
6108
|
+
credits: r.creditsCharged,
|
|
6109
|
+
createdAt: r.createdAt,
|
|
6110
|
+
video: r.videoUrl
|
|
6111
|
+
})),
|
|
6112
|
+
["jobId", "trend", "status", "resolution", "draft", "credits", "createdAt", "video"]
|
|
6113
|
+
);
|
|
6114
|
+
if (page.next) dim(`next: --cursor ${page.next}`);
|
|
6115
|
+
} catch (err) {
|
|
6116
|
+
handleError(err);
|
|
6117
|
+
}
|
|
6118
|
+
});
|
|
6119
|
+
cmd.command("favorite <slug>").description("add a trend to your favorites").option("--profile <name>").option("--json").action(async (slug, opts) => {
|
|
6120
|
+
try {
|
|
6121
|
+
await buildClient(opts.profile).trends.favorite(slug);
|
|
6122
|
+
if (opts.json) {
|
|
6123
|
+
emit({ success: true, slug }, opts);
|
|
6124
|
+
return;
|
|
6125
|
+
}
|
|
6126
|
+
success(`added ${terminalSafe(slug)} to your favorites`);
|
|
6127
|
+
} catch (err) {
|
|
6128
|
+
handleError(err);
|
|
6129
|
+
}
|
|
6130
|
+
});
|
|
6131
|
+
cmd.command("unfavorite <slug>").description("remove a trend from your favorites").option("--profile <name>").option("--json").action(async (slug, opts) => {
|
|
6132
|
+
try {
|
|
6133
|
+
await buildClient(opts.profile).trends.unfavorite(slug);
|
|
6134
|
+
if (opts.json) {
|
|
6135
|
+
emit({ success: true, slug }, opts);
|
|
6136
|
+
return;
|
|
6137
|
+
}
|
|
6138
|
+
success(`removed ${terminalSafe(slug)} from your favorites`);
|
|
6139
|
+
} catch (err) {
|
|
6140
|
+
handleError(err);
|
|
6141
|
+
}
|
|
6142
|
+
});
|
|
6143
|
+
return cmd;
|
|
6144
|
+
}
|
|
6145
|
+
function fullQualityCommand() {
|
|
6146
|
+
const cmd = new Command("full-quality").description(
|
|
6147
|
+
"finish a draft run (Cast Swap or trend) at Full Quality: the same take at 1080p, as a new job \u2014 `estimate` quotes it (free), `run` SPENDS CREDITS"
|
|
6148
|
+
);
|
|
6149
|
+
cmd.command("estimate <jobId>").description("quote finishing the draft at Full Quality (free): the credits, and until when the draft can be finished").option("--profile <name>").option("--json").action(async (jobId, opts) => {
|
|
6150
|
+
try {
|
|
6151
|
+
const quote = await buildClient(opts.profile).castSwap.fullQualityEstimate(jobId);
|
|
6152
|
+
if (opts.json) {
|
|
6153
|
+
emit(quote, opts);
|
|
6154
|
+
return;
|
|
6155
|
+
}
|
|
6156
|
+
info(`about ${quote.totalCredits} credits`);
|
|
6157
|
+
dim(` castSwap: ${quote.breakdown.castSwap}`);
|
|
6158
|
+
dim(` seedanceHd: ${quote.breakdown.seedanceHd}`);
|
|
6159
|
+
if (quote.breakdown.seedanceHd === 0) dim(" an earlier try's 1080p render is reused");
|
|
6160
|
+
dim(`available until ${terminalSafe(quote.availableUntil)}`);
|
|
6161
|
+
} catch (err) {
|
|
6162
|
+
handleError(err);
|
|
6163
|
+
}
|
|
6164
|
+
});
|
|
6165
|
+
cmd.command("run <jobId>").description("start Full Quality \u2014 SPENDS CREDITS; run `estimate` first. Prints the job to follow").option("--session <id>", "a generation session of yours to file the result in").option("--profile <name>").option("--json").action(async (jobId, opts) => {
|
|
6166
|
+
try {
|
|
6167
|
+
const result = await buildClient(opts.profile).castSwap.fullQuality(
|
|
6168
|
+
jobId,
|
|
6169
|
+
opts.session !== void 0 ? { sessionId: opts.session } : {}
|
|
6170
|
+
);
|
|
6171
|
+
if (opts.json) {
|
|
6172
|
+
emit(result, opts);
|
|
6173
|
+
return;
|
|
6174
|
+
}
|
|
6175
|
+
const id = terminalSafe(result.jobId);
|
|
6176
|
+
if (result.existing) info(`this draft's Full Quality already exists \u2014 job ${id} (nothing new was charged)`);
|
|
6177
|
+
else success(`started Full Quality \u2014 job ${id}`);
|
|
6178
|
+
dim(`follow it: nodaro jobs get ${id}`);
|
|
6179
|
+
} catch (err) {
|
|
6180
|
+
handleError(err);
|
|
6181
|
+
}
|
|
6182
|
+
});
|
|
6183
|
+
return cmd;
|
|
6184
|
+
}
|
|
6185
|
+
function castSwapCommand() {
|
|
6186
|
+
const cmd = new Command("cast-swap").description("Cast Swap \u2014 replace who and what is in a short video (Cloud edition)");
|
|
6187
|
+
cmd.addCommand(fullQualityCommand());
|
|
6188
|
+
return cmd;
|
|
6189
|
+
}
|
|
5824
6190
|
var ASSET_TYPE_TO_COLUMN = {
|
|
5825
6191
|
timeOfDay: "time_of_day",
|
|
5826
6192
|
weather: "weather",
|
|
@@ -7989,6 +8355,8 @@ program.addCommand(catalogCommand());
|
|
|
7989
8355
|
program.addCommand(modelsCommand());
|
|
7990
8356
|
program.addCommand(shotsCommand());
|
|
7991
8357
|
program.addCommand(recastCommand());
|
|
8358
|
+
program.addCommand(trendsCommand());
|
|
8359
|
+
program.addCommand(castSwapCommand());
|
|
7992
8360
|
program.addCommand(orgCommand());
|
|
7993
8361
|
program.addCommand(workspaceCommand());
|
|
7994
8362
|
program.addCommand(editCommand());
|