@nodaro/cli 1.12.0 → 1.15.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 +63 -10
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -29,7 +29,7 @@ var require_package = __commonJS({
|
|
|
29
29
|
"package.json"(exports$1, module) {
|
|
30
30
|
module.exports = {
|
|
31
31
|
name: "@nodaro/cli",
|
|
32
|
-
version: "1.
|
|
32
|
+
version: "1.15.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.
|
|
74
|
-
"@nodaro/shared": "^2.
|
|
73
|
+
"@nodaro/sdk": "^1.23.0",
|
|
74
|
+
"@nodaro/shared": "^2.13.0",
|
|
75
75
|
commander: "^12.1.0",
|
|
76
76
|
picocolors: "^1.1.1",
|
|
77
|
-
"@nodaro/prompts": "^1.
|
|
77
|
+
"@nodaro/prompts": "^1.9.0"
|
|
78
78
|
},
|
|
79
79
|
devDependencies: {
|
|
80
80
|
tsup: "^8.5.0",
|
|
@@ -398,7 +398,7 @@ function saveWorkspace(profileName, workspaceId) {
|
|
|
398
398
|
}
|
|
399
399
|
|
|
400
400
|
// src/client.ts
|
|
401
|
-
var CLI_VERSION = "1.
|
|
401
|
+
var CLI_VERSION = "1.15.0" ;
|
|
402
402
|
function buildClient(profileName) {
|
|
403
403
|
const { name, profile } = getProfile(profileName);
|
|
404
404
|
if (!profile) {
|
|
@@ -1097,6 +1097,25 @@ function rejectPositionalInputs(extras, slug) {
|
|
|
1097
1097
|
}
|
|
1098
1098
|
process.exit(1);
|
|
1099
1099
|
}
|
|
1100
|
+
function parseOverridePairs(pairs) {
|
|
1101
|
+
if (!pairs?.length) return void 0;
|
|
1102
|
+
const out = {};
|
|
1103
|
+
for (const pair of pairs) {
|
|
1104
|
+
const eq = pair.indexOf("=");
|
|
1105
|
+
const dot = pair.indexOf(".");
|
|
1106
|
+
if (eq === -1 || dot === -1 || dot > eq) throw new Error(`--override expects nodeId.field=value, got "${pair}"`);
|
|
1107
|
+
const nodeId = pair.slice(0, dot);
|
|
1108
|
+
const field = pair.slice(dot + 1, eq);
|
|
1109
|
+
const raw = pair.slice(eq + 1);
|
|
1110
|
+
let value = raw;
|
|
1111
|
+
try {
|
|
1112
|
+
value = JSON.parse(raw);
|
|
1113
|
+
} catch {
|
|
1114
|
+
}
|
|
1115
|
+
out[nodeId] = { ...out[nodeId] ?? {}, [field]: value };
|
|
1116
|
+
}
|
|
1117
|
+
return out;
|
|
1118
|
+
}
|
|
1100
1119
|
function appsCommand() {
|
|
1101
1120
|
const cmd = new Command("apps").description("browse and run published apps (workflows wrapped in a curated UI)");
|
|
1102
1121
|
cmd.command("list").description("browse published apps (paginated)").option("--search <query>", "substring match on name/description").option("--limit <n>", "page size (max 50)", (v) => parseInt(v, 10)).option("--cursor <token>", "pagination cursor from a previous page").option("--category <slug>", "filter to a single category").option("--profile <name>").option("--json").action(async (opts) => {
|
|
@@ -1136,9 +1155,10 @@ function appsCommand() {
|
|
|
1136
1155
|
handleError(err);
|
|
1137
1156
|
}
|
|
1138
1157
|
});
|
|
1139
|
-
cmd.command("run [slug] [extras...]").description("trigger an app run. Inputs go through --input k=v (repeat) or --params-file inputs.json. Omit <slug> for an interactive picker.").option("--input <pairs...>", `input value, repeat or space-separate; JSON arrays/objects supported (e.g. --input prompt="hi" --input 'tags=["a","b"]')`, collectVariadic).option("--params-file <path>", "JSON file with the full inputs object (--input flags override matching keys)").option("--watch", "follow the resulting execution until completion").option("--profile <name>").option("--json").addHelpText("after", `
|
|
1158
|
+
cmd.command("run [slug] [extras...]").description("trigger an app run. Inputs go through --input k=v (repeat) or --params-file inputs.json. Omit <slug> for an interactive picker.").option("--input <pairs...>", `input value, repeat or space-separate; JSON arrays/objects supported (e.g. --input prompt="hi" --input 'tags=["a","b"]')`, collectVariadic).option("--params-file <path>", "JSON file with the full inputs object (--input flags override matching keys)").option("--override <pairs...>", 'advanced: raw node-data override nodeId.field=value (repeat); reaches fields not exposed as inputs, e.g. --override n1.promptPrefix="Cinematic still of"', collectVariadic).option("--watch", "follow the resulting execution until completion").option("--profile <name>").option("--json").addHelpText("after", `
|
|
1140
1159
|
Examples:
|
|
1141
1160
|
$ nodaro apps run hair-styler-dd3erw --input prompt="curly red hair" --watch
|
|
1161
|
+
$ nodaro apps run hair-styler-dd3erw --input prompt="curly red hair" --override n1.promptPrefix="Studio portrait of"
|
|
1142
1162
|
$ echo '{"prompt":"hi","duration":8}' > inputs.json
|
|
1143
1163
|
$ nodaro apps run hair-styler-dd3erw --params-file inputs.json --watch
|
|
1144
1164
|
|
|
@@ -1148,7 +1168,9 @@ Tip: \`nodaro apps get <slug>\` shows the input schema for that app.`).action(as
|
|
|
1148
1168
|
const client = buildClient(opts.profile);
|
|
1149
1169
|
const resolvedSlug = slug ?? await pickAppInteractively(client);
|
|
1150
1170
|
const inputs = resolveParams(opts.input, opts.paramsFile);
|
|
1151
|
-
const result = await client.apps.run(resolvedSlug, inputs
|
|
1171
|
+
const result = await client.apps.run(resolvedSlug, inputs, {
|
|
1172
|
+
inputOverrides: parseOverridePairs(opts.override)
|
|
1173
|
+
});
|
|
1152
1174
|
if (opts.json && !opts.watch) {
|
|
1153
1175
|
emit(result, opts);
|
|
1154
1176
|
return;
|
|
@@ -2401,14 +2423,23 @@ Example:
|
|
|
2401
2423
|
cmd.command("collage <imageUrls...>").description("composite 2\u201330 images into ONE large 2K/4K collage (smart justified layout \u2014 no cropping \u2014 or uniform grid)").option(
|
|
2402
2424
|
"--sizes <list>",
|
|
2403
2425
|
"comma-separated per-image size hints aligned with the images: 0 auto (default), 1 big (~2\xD7 linear), 2 medium, 3 small (~\xBD). Relative \u2014 smart layout only"
|
|
2426
|
+
).option("--numbered", "stamp 1-based sequence numbers at each image's corner (storyboard mode)").option("--badge-position <corner>", "where the number/label badges sit: top-left (default) or top-right").option(
|
|
2427
|
+
"--label <text>",
|
|
2428
|
+
'per-image caption shown after the number; repeat once per image, in order (pass "" to skip one)',
|
|
2429
|
+
collectVariadic
|
|
2404
2430
|
).option("--layout <layout>", "smart (default \u2014 justified rows, output height floats) or grid (uniform letterboxed cells)").option("--resolution <res>", "long-edge resolution: 2K or 4K (default 4K)").option("--aspect-ratio <W:H>", 'output canvas ratio, e.g. "4:3" (exact in grid; a target shape in smart)').option("--gap <px>", "gap between images + outer margin in px (default 24)", (v) => parseInt(v, 10)).option("--background-color <hex>", "background shown in the gaps, #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", `
|
|
2405
2431
|
Examples:
|
|
2406
2432
|
$ nodaro media collage https://x/a.png https://x/b.png https://x/c.png --watch
|
|
2407
2433
|
$ nodaro media collage https://x/hero.png https://x/b.png https://x/c.png --sizes 1,3,3 --aspect-ratio 16:9 --watch
|
|
2434
|
+
$ nodaro media collage https://x/a.png https://x/b.png https://x/c.png --numbered --label Wide --label "" --label Close-up --watch
|
|
2408
2435
|
|
|
2409
2436
|
--sizes aligns by position: "1,3,3" renders the first image big and the other
|
|
2410
2437
|
two small. Hints are relative \u2014 all-equal hints change nothing, and the grid
|
|
2411
|
-
layout ignores them
|
|
2438
|
+
layout ignores them.
|
|
2439
|
+
|
|
2440
|
+
--numbered stamps 1, 2, 3\u2026 at each image's top-left corner, in the order the
|
|
2441
|
+
images are passed (--badge-position top-right moves the badges). Repeat --label once per image (in the same order) to caption it
|
|
2442
|
+
after the number ("3 \xB7 Close-up"); pass "" to skip a label for one image.`).action(
|
|
2412
2443
|
async (imageUrls, opts) => {
|
|
2413
2444
|
try {
|
|
2414
2445
|
if (imageUrls.length < 2) {
|
|
@@ -2423,6 +2454,10 @@ layout ignores them.`).action(
|
|
|
2423
2454
|
warn(`--resolution must be 2K or 4K (got "${opts.resolution}")`);
|
|
2424
2455
|
process.exit(1);
|
|
2425
2456
|
}
|
|
2457
|
+
if (opts.badgePosition && !["top-left", "top-right"].includes(opts.badgePosition)) {
|
|
2458
|
+
warn(`--badge-position must be top-left or top-right (got "${opts.badgePosition}")`);
|
|
2459
|
+
process.exit(1);
|
|
2460
|
+
}
|
|
2426
2461
|
let imageSizes;
|
|
2427
2462
|
if (opts.sizes !== void 0) {
|
|
2428
2463
|
const parsed = opts.sizes.split(",").map((s) => parseInt(s.trim(), 10));
|
|
@@ -2432,10 +2467,28 @@ layout ignores them.`).action(
|
|
|
2432
2467
|
}
|
|
2433
2468
|
imageSizes = parsed;
|
|
2434
2469
|
}
|
|
2470
|
+
let imageLabels;
|
|
2471
|
+
if (opts.label && opts.label.length > 0) {
|
|
2472
|
+
if (opts.label.length > imageUrls.length) {
|
|
2473
|
+
warn(`Too many --label values: ${opts.label.length} for ${imageUrls.length} images (one per image, in order)`);
|
|
2474
|
+
process.exit(1);
|
|
2475
|
+
}
|
|
2476
|
+
if (opts.label.some((s) => s.length > 80)) {
|
|
2477
|
+
warn("Each --label must be at most 80 characters");
|
|
2478
|
+
process.exit(1);
|
|
2479
|
+
}
|
|
2480
|
+
const mapped = opts.label.map((s) => s.trim() || null);
|
|
2481
|
+
if (mapped.some((l) => l !== null)) {
|
|
2482
|
+
imageLabels = mapped;
|
|
2483
|
+
}
|
|
2484
|
+
}
|
|
2435
2485
|
const client = buildClient(opts.profile);
|
|
2436
2486
|
const result = await client.media.imageCollage({
|
|
2437
2487
|
imageUrls,
|
|
2438
2488
|
...imageSizes ? { imageSizes } : {},
|
|
2489
|
+
...opts.numbered ? { numbered: true } : {},
|
|
2490
|
+
...imageLabels ? { imageLabels } : {},
|
|
2491
|
+
...opts.badgePosition ? { badgePosition: opts.badgePosition } : {},
|
|
2439
2492
|
...opts.layout ? { layout: opts.layout } : {},
|
|
2440
2493
|
...opts.resolution ? { resolution: opts.resolution } : {},
|
|
2441
2494
|
...opts.aspectRatio ? { aspectRatio: opts.aspectRatio } : {},
|
|
@@ -3002,8 +3055,8 @@ function buildCatalogSnapshot(projected, sidecars) {
|
|
|
3002
3055
|
const push = (opts) => {
|
|
3003
3056
|
for (const o of opts ?? []) if (!seen.has(o.id)) seen.set(o.id, o);
|
|
3004
3057
|
};
|
|
3005
|
-
|
|
3006
|
-
|
|
3058
|
+
push(projected.options);
|
|
3059
|
+
for (const d of projected.dimensions ?? []) push(d.options);
|
|
3007
3060
|
const entries = [...seen.values()].sort((a, b) => a.id.localeCompare(b.id));
|
|
3008
3061
|
return { catalogId: projected.catalogId, kind: projected.kind, entries, sidecars };
|
|
3009
3062
|
}
|