@nodaro/cli 1.11.0 → 1.14.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 +245 -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.14.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.22.0",
|
|
74
|
+
"@nodaro/shared": "^2.12.2",
|
|
75
75
|
commander: "^12.1.0",
|
|
76
76
|
picocolors: "^1.1.1",
|
|
77
|
-
"@nodaro/prompts": "^1.
|
|
77
|
+
"@nodaro/prompts": "^1.8.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.14.0" ;
|
|
402
402
|
function buildClient(profileName) {
|
|
403
403
|
const { name, profile } = getProfile(profileName);
|
|
404
404
|
if (!profile) {
|
|
@@ -744,6 +744,110 @@ function workflowsCommand() {
|
|
|
744
744
|
handleError(err);
|
|
745
745
|
}
|
|
746
746
|
});
|
|
747
|
+
cmd.command("share <id>").description("set a workflow's visibility: workspace (everyone in its workspace) or private (creator + named collaborators)").option("--visibility <level>", "workspace | private", "workspace").option("--profile <name>").option("--json").action(async (id, opts) => {
|
|
748
|
+
try {
|
|
749
|
+
if (opts.visibility !== "workspace" && opts.visibility !== "private") {
|
|
750
|
+
throw new Error("--visibility must be `workspace` or `private`");
|
|
751
|
+
}
|
|
752
|
+
const client = buildClient(opts.profile);
|
|
753
|
+
const result = await client.workflows.setVisibility(id, opts.visibility);
|
|
754
|
+
if (opts.json) emit(result.data, opts);
|
|
755
|
+
else success(`workflow ${id} is now ${opts.visibility}`);
|
|
756
|
+
} catch (err) {
|
|
757
|
+
handleError(err);
|
|
758
|
+
}
|
|
759
|
+
});
|
|
760
|
+
cmd.command("move <id>").description("move a workflow to another project").requiredOption("--project <projectId>", "destination project id").option("--profile <name>").option("--json").action(async (id, opts) => {
|
|
761
|
+
try {
|
|
762
|
+
const client = buildClient(opts.profile);
|
|
763
|
+
const result = await client.workflows.move(id, { projectId: opts.project });
|
|
764
|
+
if (opts.json) {
|
|
765
|
+
emit(result, opts);
|
|
766
|
+
return;
|
|
767
|
+
}
|
|
768
|
+
success(`moved workflow ${id} \u2192 project ${opts.project}`);
|
|
769
|
+
if (result.droppedCollaborators.length > 0) {
|
|
770
|
+
dim(
|
|
771
|
+
`${result.droppedCollaborators.length} collaborator grant(s) were dropped \u2014 they came from the workspace this workflow just left`
|
|
772
|
+
);
|
|
773
|
+
}
|
|
774
|
+
} catch (err) {
|
|
775
|
+
handleError(err);
|
|
776
|
+
}
|
|
777
|
+
});
|
|
778
|
+
cmd.command("shared-with-me").description("list workflows other people shared with you").option("--profile <name>").option("--json").action(async (opts) => {
|
|
779
|
+
try {
|
|
780
|
+
const client = buildClient(opts.profile);
|
|
781
|
+
const result = await client.workflows.sharedWithMe();
|
|
782
|
+
if (opts.json) {
|
|
783
|
+
emit(result.data, opts);
|
|
784
|
+
return;
|
|
785
|
+
}
|
|
786
|
+
table(
|
|
787
|
+
result.data.map((w) => ({ id: w.id, name: w.name, role: w.grantedRole, updatedAt: w.updatedAt })),
|
|
788
|
+
["id", "name", "role", "updatedAt"]
|
|
789
|
+
);
|
|
790
|
+
} catch (err) {
|
|
791
|
+
handleError(err);
|
|
792
|
+
}
|
|
793
|
+
});
|
|
794
|
+
cmd.addCommand(collaboratorsCommand());
|
|
795
|
+
return cmd;
|
|
796
|
+
}
|
|
797
|
+
function collaboratorsCommand() {
|
|
798
|
+
const cmd = new Command("collaborators").description("manage who a workflow is shared with");
|
|
799
|
+
cmd.command("list <id>").description("list a workflow's collaborators").option("--profile <name>").option("--json").action(async (id, opts) => {
|
|
800
|
+
try {
|
|
801
|
+
const client = buildClient(opts.profile);
|
|
802
|
+
const result = await client.workflows.collaborators.list(id);
|
|
803
|
+
if (opts.json) emit(result.data, opts);
|
|
804
|
+
else table(result.data.map((c) => ({ userId: c.userId, name: c.name ?? "", role: c.role })), ["userId", "name", "role"]);
|
|
805
|
+
} catch (err) {
|
|
806
|
+
handleError(err);
|
|
807
|
+
}
|
|
808
|
+
});
|
|
809
|
+
cmd.command("add <id>").description("share a workflow with a person by user id or email").option("--user <userId>", "the collaborator's user id").option("--email <email>", "the collaborator's email (any address; they need not have an account yet)").requiredOption("--role <role>", "viewer | editor").option("--profile <name>").option("--json").action(async (id, opts) => {
|
|
810
|
+
try {
|
|
811
|
+
if (opts.user === void 0 === (opts.email === void 0)) {
|
|
812
|
+
throw new Error("provide exactly one of --user or --email");
|
|
813
|
+
}
|
|
814
|
+
if (opts.role !== "viewer" && opts.role !== "editor") {
|
|
815
|
+
throw new Error("--role must be `viewer` or `editor`");
|
|
816
|
+
}
|
|
817
|
+
const client = buildClient(opts.profile);
|
|
818
|
+
const result = await client.workflows.collaborators.add(id, {
|
|
819
|
+
...opts.user ? { userId: opts.user } : { email: opts.email },
|
|
820
|
+
role: opts.role
|
|
821
|
+
});
|
|
822
|
+
if (opts.json) emit(result.data, opts);
|
|
823
|
+
else success(`shared workflow ${id} with ${opts.user ?? opts.email} as ${opts.role}`);
|
|
824
|
+
} catch (err) {
|
|
825
|
+
handleError(err);
|
|
826
|
+
}
|
|
827
|
+
});
|
|
828
|
+
cmd.command("update <id> <userId>").description("change a collaborator's role").requiredOption("--role <role>", "viewer | editor").option("--profile <name>").option("--json").action(async (id, userId, opts) => {
|
|
829
|
+
try {
|
|
830
|
+
if (opts.role !== "viewer" && opts.role !== "editor") {
|
|
831
|
+
throw new Error("--role must be `viewer` or `editor`");
|
|
832
|
+
}
|
|
833
|
+
const client = buildClient(opts.profile);
|
|
834
|
+
const result = await client.workflows.collaborators.update(id, userId, { role: opts.role });
|
|
835
|
+
if (opts.json) emit(result.data, opts);
|
|
836
|
+
else success(`${userId} is now ${opts.role} on workflow ${id}`);
|
|
837
|
+
} catch (err) {
|
|
838
|
+
handleError(err);
|
|
839
|
+
}
|
|
840
|
+
});
|
|
841
|
+
cmd.command("remove <id> <userId>").description("remove a collaborator (or yourself)").option("--profile <name>").option("--json").action(async (id, userId, opts) => {
|
|
842
|
+
try {
|
|
843
|
+
const client = buildClient(opts.profile);
|
|
844
|
+
await client.workflows.collaborators.remove(id, userId);
|
|
845
|
+
if (opts.json) emit({ workflowId: id, userId, removed: true }, opts);
|
|
846
|
+
else success(`removed ${userId} from workflow ${id}`);
|
|
847
|
+
} catch (err) {
|
|
848
|
+
handleError(err);
|
|
849
|
+
}
|
|
850
|
+
});
|
|
747
851
|
return cmd;
|
|
748
852
|
}
|
|
749
853
|
async function watchExecution(client, executionId, opts) {
|
|
@@ -865,10 +969,10 @@ function parseParamPairs(pairs) {
|
|
|
865
969
|
if (eq < 0) {
|
|
866
970
|
throw new Error(`invalid param "${raw}": expected key=value`);
|
|
867
971
|
}
|
|
868
|
-
const
|
|
972
|
+
const key2 = raw.slice(0, eq).trim();
|
|
869
973
|
const value = raw.slice(eq + 1);
|
|
870
|
-
if (!
|
|
871
|
-
out[
|
|
974
|
+
if (!key2) throw new Error(`invalid param "${raw}": empty key`);
|
|
975
|
+
out[key2] = coerce(value);
|
|
872
976
|
}
|
|
873
977
|
return out;
|
|
874
978
|
}
|
|
@@ -2297,14 +2401,23 @@ Example:
|
|
|
2297
2401
|
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(
|
|
2298
2402
|
"--sizes <list>",
|
|
2299
2403
|
"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"
|
|
2404
|
+
).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(
|
|
2405
|
+
"--label <text>",
|
|
2406
|
+
'per-image caption shown after the number; repeat once per image, in order (pass "" to skip one)',
|
|
2407
|
+
collectVariadic
|
|
2300
2408
|
).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", `
|
|
2301
2409
|
Examples:
|
|
2302
2410
|
$ nodaro media collage https://x/a.png https://x/b.png https://x/c.png --watch
|
|
2303
2411
|
$ nodaro media collage https://x/hero.png https://x/b.png https://x/c.png --sizes 1,3,3 --aspect-ratio 16:9 --watch
|
|
2412
|
+
$ nodaro media collage https://x/a.png https://x/b.png https://x/c.png --numbered --label Wide --label "" --label Close-up --watch
|
|
2304
2413
|
|
|
2305
2414
|
--sizes aligns by position: "1,3,3" renders the first image big and the other
|
|
2306
2415
|
two small. Hints are relative \u2014 all-equal hints change nothing, and the grid
|
|
2307
|
-
layout ignores them
|
|
2416
|
+
layout ignores them.
|
|
2417
|
+
|
|
2418
|
+
--numbered stamps 1, 2, 3\u2026 at each image's top-left corner, in the order the
|
|
2419
|
+
images are passed (--badge-position top-right moves the badges). Repeat --label once per image (in the same order) to caption it
|
|
2420
|
+
after the number ("3 \xB7 Close-up"); pass "" to skip a label for one image.`).action(
|
|
2308
2421
|
async (imageUrls, opts) => {
|
|
2309
2422
|
try {
|
|
2310
2423
|
if (imageUrls.length < 2) {
|
|
@@ -2319,6 +2432,10 @@ layout ignores them.`).action(
|
|
|
2319
2432
|
warn(`--resolution must be 2K or 4K (got "${opts.resolution}")`);
|
|
2320
2433
|
process.exit(1);
|
|
2321
2434
|
}
|
|
2435
|
+
if (opts.badgePosition && !["top-left", "top-right"].includes(opts.badgePosition)) {
|
|
2436
|
+
warn(`--badge-position must be top-left or top-right (got "${opts.badgePosition}")`);
|
|
2437
|
+
process.exit(1);
|
|
2438
|
+
}
|
|
2322
2439
|
let imageSizes;
|
|
2323
2440
|
if (opts.sizes !== void 0) {
|
|
2324
2441
|
const parsed = opts.sizes.split(",").map((s) => parseInt(s.trim(), 10));
|
|
@@ -2328,10 +2445,28 @@ layout ignores them.`).action(
|
|
|
2328
2445
|
}
|
|
2329
2446
|
imageSizes = parsed;
|
|
2330
2447
|
}
|
|
2448
|
+
let imageLabels;
|
|
2449
|
+
if (opts.label && opts.label.length > 0) {
|
|
2450
|
+
if (opts.label.length > imageUrls.length) {
|
|
2451
|
+
warn(`Too many --label values: ${opts.label.length} for ${imageUrls.length} images (one per image, in order)`);
|
|
2452
|
+
process.exit(1);
|
|
2453
|
+
}
|
|
2454
|
+
if (opts.label.some((s) => s.length > 80)) {
|
|
2455
|
+
warn("Each --label must be at most 80 characters");
|
|
2456
|
+
process.exit(1);
|
|
2457
|
+
}
|
|
2458
|
+
const mapped = opts.label.map((s) => s.trim() || null);
|
|
2459
|
+
if (mapped.some((l) => l !== null)) {
|
|
2460
|
+
imageLabels = mapped;
|
|
2461
|
+
}
|
|
2462
|
+
}
|
|
2331
2463
|
const client = buildClient(opts.profile);
|
|
2332
2464
|
const result = await client.media.imageCollage({
|
|
2333
2465
|
imageUrls,
|
|
2334
2466
|
...imageSizes ? { imageSizes } : {},
|
|
2467
|
+
...opts.numbered ? { numbered: true } : {},
|
|
2468
|
+
...imageLabels ? { imageLabels } : {},
|
|
2469
|
+
...opts.badgePosition ? { badgePosition: opts.badgePosition } : {},
|
|
2335
2470
|
...opts.layout ? { layout: opts.layout } : {},
|
|
2336
2471
|
...opts.resolution ? { resolution: opts.resolution } : {},
|
|
2337
2472
|
...opts.aspectRatio ? { aspectRatio: opts.aspectRatio } : {},
|
|
@@ -2865,7 +3000,7 @@ Examples:
|
|
|
2865
3000
|
}
|
|
2866
3001
|
}
|
|
2867
3002
|
);
|
|
2868
|
-
cmd.command("get <nodeType>").description("show one picker's catalog of valid values").option("--full", "
|
|
3003
|
+
cmd.command("get <nodeType>").description("show one picker's catalog of valid values").option("--full", "add description + the prompt fragment each id injects (compact already carries each id's `term`)").option("--category <name>", "single-dim pickers: filter to one category").option("--field <name>", "multi-dim pickers (person/styling/framing): only this dimension").option("--profile <name>").option("--json").addHelpText(
|
|
2869
3004
|
"after",
|
|
2870
3005
|
`
|
|
2871
3006
|
Examples:
|
|
@@ -2891,6 +3026,105 @@ Examples:
|
|
|
2891
3026
|
);
|
|
2892
3027
|
return cmd;
|
|
2893
3028
|
}
|
|
3029
|
+
|
|
3030
|
+
// src/lib/catalog-snapshot.ts
|
|
3031
|
+
function buildCatalogSnapshot(projected, sidecars) {
|
|
3032
|
+
const seen = /* @__PURE__ */ new Map();
|
|
3033
|
+
const push = (opts) => {
|
|
3034
|
+
for (const o of opts ?? []) if (!seen.has(o.id)) seen.set(o.id, o);
|
|
3035
|
+
};
|
|
3036
|
+
if (projected.kind === "single") push(projected.options);
|
|
3037
|
+
else for (const d of projected.dimensions ?? []) push(d.options);
|
|
3038
|
+
const entries = [...seen.values()].sort((a, b) => a.id.localeCompare(b.id));
|
|
3039
|
+
return { catalogId: projected.catalogId, kind: projected.kind, entries, sidecars };
|
|
3040
|
+
}
|
|
3041
|
+
|
|
3042
|
+
// src/lib/catalog-diff.ts
|
|
3043
|
+
var key = (e) => JSON.stringify({ l: e.label, d: e.description, c: e.category, p: e.promptHint, t: e.term });
|
|
3044
|
+
var index = (s) => new Map(s.entries.map((e) => [e.id, e]));
|
|
3045
|
+
function threeWayMergeCatalog(baseline, upstreamNow, pack) {
|
|
3046
|
+
const B = index(baseline), U = index(upstreamNow), P = index(pack);
|
|
3047
|
+
const carried = [];
|
|
3048
|
+
const conflicts = [];
|
|
3049
|
+
const newUpstream = [];
|
|
3050
|
+
const removedUpstream = [];
|
|
3051
|
+
const sidecarsCarried = {};
|
|
3052
|
+
for (const [id, u] of U) {
|
|
3053
|
+
const b = B.get(id), p = P.get(id);
|
|
3054
|
+
if (!b) {
|
|
3055
|
+
newUpstream.push(u);
|
|
3056
|
+
continue;
|
|
3057
|
+
}
|
|
3058
|
+
if (!p) continue;
|
|
3059
|
+
const saiModified = key(p) !== key(b);
|
|
3060
|
+
const upstreamChanged = key(u) !== key(b);
|
|
3061
|
+
if (!upstreamChanged) continue;
|
|
3062
|
+
if (saiModified) {
|
|
3063
|
+
conflicts.push({ id, upstream: u, pack: p });
|
|
3064
|
+
continue;
|
|
3065
|
+
}
|
|
3066
|
+
carried.push(u);
|
|
3067
|
+
for (const [locale, map] of Object.entries(upstreamNow.sidecars)) {
|
|
3068
|
+
if (map[id]) (sidecarsCarried[locale] ??= []).push(id);
|
|
3069
|
+
}
|
|
3070
|
+
}
|
|
3071
|
+
for (const [id] of B) if (!U.has(id) && P.has(id)) removedUpstream.push(id);
|
|
3072
|
+
return { carried, conflicts, newUpstream, removedUpstream, sidecarsCarried, nextBaseline: upstreamNow };
|
|
3073
|
+
}
|
|
3074
|
+
|
|
3075
|
+
// src/lib/catalog-validate.ts
|
|
3076
|
+
function validatePackSidecars(snapshot, locales, exemptLocales) {
|
|
3077
|
+
const exempt = new Set(exemptLocales);
|
|
3078
|
+
const missing = [];
|
|
3079
|
+
const exempted = [];
|
|
3080
|
+
for (const locale of locales) {
|
|
3081
|
+
if (exempt.has(locale)) {
|
|
3082
|
+
exempted.push(locale);
|
|
3083
|
+
continue;
|
|
3084
|
+
}
|
|
3085
|
+
const map = snapshot.sidecars[locale] ?? {};
|
|
3086
|
+
for (const e of snapshot.entries) if (!map[e.id]) missing.push({ id: e.id, locale });
|
|
3087
|
+
}
|
|
3088
|
+
return { catalogId: snapshot.catalogId, missing, exempted, ok: missing.length === 0 };
|
|
3089
|
+
}
|
|
3090
|
+
|
|
3091
|
+
// src/commands/catalog.ts
|
|
3092
|
+
var LOCALES = ["es", "fr", "de", "pt-BR", "ru", "hi", "ja", "ko", "zh-CN", "he", "ar"];
|
|
3093
|
+
var read = (p) => JSON.parse(readFileSync(p, "utf8"));
|
|
3094
|
+
function catalogCommand() {
|
|
3095
|
+
const cmd = new Command("catalog").description(
|
|
3096
|
+
"vendored-pack maintenance: snapshot, diff against upstream, validate sidecars (offline, file-based)"
|
|
3097
|
+
);
|
|
3098
|
+
cmd.command("snapshot").description(
|
|
3099
|
+
"build a catalog snapshot (the diff-upstream/validate input shape) from a detail=full /v1/catalogs projection + its sidecars"
|
|
3100
|
+
).requiredOption(
|
|
3101
|
+
"--in <file>",
|
|
3102
|
+
'JSON { "projected": <detail=full /v1/catalogs catalog>, "sidecars"?: <locale -> id -> {label?,description?}> }'
|
|
3103
|
+
).action((o) => {
|
|
3104
|
+
const input2 = JSON.parse(readFileSync(o.in, "utf8"));
|
|
3105
|
+
const snapshot = buildCatalogSnapshot(input2.projected, input2.sidecars ?? {});
|
|
3106
|
+
process.stdout.write(JSON.stringify(snapshot, null, 2) + "\n");
|
|
3107
|
+
});
|
|
3108
|
+
cmd.command("diff-upstream").description(
|
|
3109
|
+
"three-way merge: carry upstream edits for entries you left unmodified; never auto-admit new upstream entries"
|
|
3110
|
+
).requiredOption("--baseline <file>", "upstream snapshot at vendoring time").requiredOption("--upstream <file>", "current upstream snapshot").requiredOption("--pack <file>", "your vendored pack snapshot").option("--write <file>", "write the merge plan + next baseline to this path").action((o) => {
|
|
3111
|
+
const plan = threeWayMergeCatalog(read(o.baseline), read(o.upstream), read(o.pack));
|
|
3112
|
+
const out = JSON.stringify(plan, null, 2);
|
|
3113
|
+
if (o.write) writeFileSync(o.write, out);
|
|
3114
|
+
else process.stdout.write(out + "\n");
|
|
3115
|
+
if (plan.conflicts.length) process.exitCode = 2;
|
|
3116
|
+
});
|
|
3117
|
+
cmd.command("validate").description("check a pack snapshot has sidecar coverage across 11 locales (or declared exemptions)").requiredOption("--pack <file>", "your vendored pack snapshot").option("--exempt <locales>", "comma-separated locales exempted from translation", "").action((o) => {
|
|
3118
|
+
const r = validatePackSidecars(
|
|
3119
|
+
read(o.pack),
|
|
3120
|
+
LOCALES,
|
|
3121
|
+
o.exempt.split(",").map((s) => s.trim()).filter(Boolean)
|
|
3122
|
+
);
|
|
3123
|
+
process.stdout.write(JSON.stringify(r, null, 2) + "\n");
|
|
3124
|
+
if (!r.ok) process.exitCode = 1;
|
|
3125
|
+
});
|
|
3126
|
+
return cmd;
|
|
3127
|
+
}
|
|
2894
3128
|
function modelsCommand() {
|
|
2895
3129
|
const cmd = new Command("models").description(
|
|
2896
3130
|
"browse the model catalog \u2014 capability sheets, per-variant credit pricing, prompt tips"
|
|
@@ -4154,6 +4388,7 @@ program.addCommand(audioCommand());
|
|
|
4154
4388
|
program.addCommand(presetsCommand());
|
|
4155
4389
|
program.addCommand(communityCommand());
|
|
4156
4390
|
program.addCommand(pickerCatalogsCommand());
|
|
4391
|
+
program.addCommand(catalogCommand());
|
|
4157
4392
|
program.addCommand(modelsCommand());
|
|
4158
4393
|
program.addCommand(shotsCommand());
|
|
4159
4394
|
program.addCommand(recastCommand());
|