@nodaro/cli 1.40.0 → 1.41.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
@@ -142,7 +142,7 @@ nodaro recast estimate --analysis-job <id> # quote credits before c
142
142
  nodaro recast create --workflow <id> --analysis-job <id> # BUYS THE PLAN
143
143
  nodaro recast start <recastId> && nodaro recast status <recastId>
144
144
 
145
- # Trends — ready-made Cast Swap recipes: put your own pictures in a trend (Cloud)
145
+ # Trends — ready-made Nodaro Motion recipes: put your own pictures in a trend (Cloud)
146
146
  nodaro trends list [--search <text>] [--favorites] # the catalog
147
147
  nodaro trends get <slug> # its slots, examples, resolutions
148
148
  nodaro trends estimate <slug> --slot person=<url>,<url> --choice person.outfit=original # free quote
package/dist/index.js CHANGED
@@ -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.40.0",
44
+ version: "1.41.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.45.0",
86
- "@nodaro/shared": "^3.42.0",
85
+ "@nodaro/sdk": "^2.46.0",
86
+ "@nodaro/shared": "^3.44.0",
87
87
  commander: "^12.1.0",
88
88
  picocolors: "^1.1.1",
89
89
  "@nodaro/prompts": "^1.42.1"
@@ -413,7 +413,7 @@ function saveWorkspace(profileName, workspaceId) {
413
413
  }
414
414
 
415
415
  // src/client.ts
416
- var CLI_VERSION = "1.40.0" ;
416
+ var CLI_VERSION = "1.41.0" ;
417
417
  function buildPublicClient(opts = {}) {
418
418
  const { profile } = getProfile(opts.profile);
419
419
  return createClient({
@@ -552,7 +552,7 @@ function sessionsCommand() {
552
552
  const cmd = new Command("sessions").description(
553
553
  "generation sessions inside projects: list, read, create, rename, archive, import, remove, delete"
554
554
  );
555
- cmd.command("list").description("your sessions, newest first").option("--project <id>", "only this project's sessions").option("--tool <tool>", "only this tool's sessions, e.g. create-image").option("--archived", "include archived sessions").option("--limit <n>", "page size (1-100)").option("--cursor <cursor>", "the previous page's next").option("--profile <name>").option("--json").action(async (opts) => {
555
+ cmd.command("list").description("your sessions, newest first").option("--project <id>", "only this project's sessions (none: the sessions with no project)").option("--tool <tool>", "only this tool's sessions, e.g. create-image").option("--archived", "include archived sessions").option("--limit <n>", "page size (1-100)").option("--cursor <cursor>", "the previous page's next").option("--profile <name>").option("--json").action(async (opts) => {
556
556
  try {
557
557
  const client = buildClient(opts.profile);
558
558
  const page = await client.sessions.list({
@@ -590,9 +590,10 @@ function sessionsCommand() {
590
590
  handleError(err);
591
591
  }
592
592
  });
593
- cmd.command("items <id>").description("a session's items, born-in and imported, newest first").option("--limit <n>", "page size (1-100)").option("--cursor <cursor>", "the previous page's next").option("--profile <name>").option("--json").action(async (id, opts) => {
593
+ cmd.command("items <id>").description("a session's items, born-in and imported, newest first").option("--removed", "the items removed from it (its Trash) instead").option("--limit <n>", "page size (1-100)").option("--cursor <cursor>", "the previous page's next").option("--profile <name>").option("--json").action(async (id, opts) => {
594
594
  try {
595
595
  const page = await buildClient(opts.profile).sessions.items(id, {
596
+ removed: opts.removed,
596
597
  limit: opts.limit ? Number(opts.limit) : void 0,
597
598
  cursor: opts.cursor
598
599
  });
@@ -605,9 +606,9 @@ function sessionsCommand() {
605
606
  jobId: i.jobId,
606
607
  status: i.job.status,
607
608
  imported: i.imported ? `from ${i.importedFrom?.title ?? i.importedFrom?.sessionId ?? "?"}` : "",
608
- addedAt: i.addedAt
609
+ ...opts.removed ? { removedAt: i.removedAt ?? "" } : { addedAt: i.addedAt }
609
610
  })),
610
- ["jobId", "status", "imported", "addedAt"]
611
+ ["jobId", "status", "imported", opts.removed ? "removedAt" : "addedAt"]
611
612
  );
612
613
  if (page.next) dim(`next: --cursor ${page.next}`);
613
614
  } catch (err) {
@@ -660,14 +661,38 @@ function sessionsCommand() {
660
661
  handleError(err);
661
662
  }
662
663
  });
663
- cmd.command("remove <id> <jobId>").description("remove one item from a session (the link only \u2014 the job stays)").option("--profile <name>").option("--json").action(async (id, jobId, opts) => {
664
+ cmd.command("move <id>").description("move items of another session into this one, all-or-nothing (the source keeps them in its Trash)").requiredOption("--from <sessionId>", "the session they are in now").requiredOption("--jobs <ids>", "job ids, comma- or space-separated (up to 100)").option("--profile <name>").option("--json").action(async (id, opts) => {
664
665
  try {
665
- await buildClient(opts.profile).sessions.removeItem(id, jobId);
666
+ const result = await buildClient(opts.profile).sessions.moveItems(id, { jobIds: idList(opts.jobs), fromSessionId: opts.from });
667
+ if (opts.json) {
668
+ emit(result.data, opts);
669
+ return;
670
+ }
671
+ success(`moved ${result.data.moved} into session ${id}`);
672
+ } catch (err) {
673
+ handleError(err);
674
+ }
675
+ });
676
+ cmd.command("remove <id> <jobId>").description("remove one item from a session: to its Trash (the job stays); --forever deletes a removed one for good").option("--forever", "delete an item already removed, for good (the job stays)").option("--profile <name>").option("--json").action(async (id, jobId, opts) => {
677
+ try {
678
+ await buildClient(opts.profile).sessions.removeItem(id, jobId, { forever: opts.forever });
666
679
  if (opts.json) {
667
680
  emit({ success: true, id, jobId }, opts);
668
681
  return;
669
682
  }
670
- success(`removed ${jobId} from session ${id}`);
683
+ success(opts.forever ? `deleted ${jobId} from session ${id} for good` : `removed ${jobId} from session ${id} (in its Trash)`);
684
+ } catch (err) {
685
+ handleError(err);
686
+ }
687
+ });
688
+ cmd.command("restore <id> <jobId>").description("bring a removed item back into its session").option("--profile <name>").option("--json").action(async (id, jobId, opts) => {
689
+ try {
690
+ await buildClient(opts.profile).sessions.restoreItem(id, jobId);
691
+ if (opts.json) {
692
+ emit({ success: true, id, jobId }, opts);
693
+ return;
694
+ }
695
+ success(`restored ${jobId} in session ${id}`);
671
696
  } catch (err) {
672
697
  handleError(err);
673
698
  }
@@ -686,6 +711,39 @@ function sessionsCommand() {
686
711
  });
687
712
  return cmd;
688
713
  }
714
+ function trashCommand() {
715
+ const cmd = new Command("trash").description("the Trash: items removed from sessions, and deleted jobs");
716
+ cmd.command("list", { isDefault: true }).description("the Trash, newest first (restore: nodaro sessions restore / nodaro jobs restore)").option("--project <id>", "one project's Trash (none: the sessions with no project, and General)").option("--tool <tool>", "what a session of this tool holds or held, e.g. create-image").option("--type <types>", "only these input_data.type values, comma-separated (e.g. generate-image)").option("--limit <n>", "page size (1-100)").option("--cursor <cursor>", "the previous page's next").option("--profile <name>").option("--json").action(async (opts) => {
717
+ try {
718
+ const page = await buildClient(opts.profile).trash.list({
719
+ projectId: opts.project,
720
+ tool: opts.tool,
721
+ type: opts.type,
722
+ limit: opts.limit ? Number(opts.limit) : void 0,
723
+ cursor: opts.cursor
724
+ });
725
+ if (opts.json) {
726
+ emit(page, opts);
727
+ return;
728
+ }
729
+ table(
730
+ page.data.map((e) => ({
731
+ kind: e.kind,
732
+ jobId: e.job.id,
733
+ type: e.job.input_data?.type ?? e.job.job_type ?? "",
734
+ from: e.kind === "removed" ? e.session.title ?? e.session.id : "",
735
+ at: e.kind === "removed" ? e.removedAt : e.deletedAt,
736
+ purgeAt: e.kind === "deleted" ? e.purgeAt : ""
737
+ })),
738
+ ["kind", "jobId", "type", "from", "at", "purgeAt"]
739
+ );
740
+ if (page.next) dim(`next: --cursor ${page.next}`);
741
+ } catch (err) {
742
+ handleError(err);
743
+ }
744
+ });
745
+ return cmd;
746
+ }
689
747
  function collectVariadic(value, previous) {
690
748
  return [...previous ?? [], value];
691
749
  }
@@ -1311,8 +1369,8 @@ function ratingArg(value) {
1311
1369
  throw new Error(`a rating is good, bad or clear (got "${value}")`);
1312
1370
  }
1313
1371
  function jobsCommand() {
1314
- const cmd = new Command("jobs").description("list, inspect, rate and cancel jobs");
1315
- cmd.command("list").description("your jobs, newest first").option("--status <statuses>", "only these statuses, comma-separated (e.g. failed,cancelled)").option("--type <types>", "only these input_data.type values, comma-separated (e.g. generate-image)").option("--origin <origin>", "only jobs this client app sent").option("--source <sources>", "only jobs these surfaces created, comma-separated (mcp, web, cli, sdk, extension, app, api, internal)").option("--favorited", "only jobs you favorited").option("--no-favorited", "only jobs you did not favorite").option("--rating <rating>", "good, bad, rated (any) or unrated").option("--limit <n>", "page size (1-100)").option("--cursor <cursor>", "the previous page's next").option("--profile <name>").option("--json").action(async (opts) => {
1372
+ const cmd = new Command("jobs").description("list, inspect, rate, cancel, delete and restore jobs");
1373
+ cmd.command("list").description("your jobs, newest first").option("--status <statuses>", "only these statuses, comma-separated (e.g. failed,cancelled)").option("--type <types>", "only these input_data.type values, comma-separated (e.g. generate-image)").option("--origin <origin>", "only jobs this client app sent").option("--source <sources>", "only jobs these surfaces created, comma-separated (mcp, web, cli, sdk, extension, app, api, internal)").option("--favorited", "only jobs you favorited").option("--no-favorited", "only jobs you did not favorite").option("--rating <rating>", "good, bad, rated (any) or unrated").option("--project <id>", "only jobs a session of this project holds now (none: a session with no project)").option("--in-session", "only jobs at least one session holds").option("--no-in-session", "only jobs no session holds (General)").option("--with-sessions", "show the sessions each job is in").option("--limit <n>", "page size (1-100)").option("--cursor <cursor>", "the previous page's next").option("--profile <name>").option("--json").action(async (opts) => {
1316
1374
  try {
1317
1375
  const rating = ratingFilter(opts.rating);
1318
1376
  const client = buildClient(opts.profile);
@@ -1323,6 +1381,9 @@ function jobsCommand() {
1323
1381
  source: list(opts.source),
1324
1382
  favorited: opts.favorited,
1325
1383
  rating,
1384
+ projectId: opts.project,
1385
+ inSession: opts.inSession,
1386
+ withSessions: opts.withSessions,
1326
1387
  limit: opts.limit ? Number(opts.limit) : void 0,
1327
1388
  cursor: opts.cursor
1328
1389
  });
@@ -1337,9 +1398,10 @@ function jobsCommand() {
1337
1398
  type: job.input_data?.type ?? job.job_type ?? "",
1338
1399
  favorited: job.favorited ? "yes" : "",
1339
1400
  rating: job.rating ?? "",
1401
+ ...opts.withSessions ? { sessions: (job.sessions ?? []).map((s) => s.title ?? s.id).join(", ") } : {},
1340
1402
  created: job.created_at
1341
1403
  })),
1342
- ["id", "status", "type", "favorited", "rating", "created"]
1404
+ ["id", "status", "type", "favorited", "rating", ...opts.withSessions ? ["sessions"] : [], "created"]
1343
1405
  );
1344
1406
  if (page.next) dim(`next: --cursor ${page.next}`);
1345
1407
  } catch (err) {
@@ -1377,6 +1439,26 @@ function jobsCommand() {
1377
1439
  handleError(err);
1378
1440
  }
1379
1441
  });
1442
+ cmd.command("delete <id>").description("delete a job: to the Trash for 30 days, then for good (--forever: a job already in the Trash, now)").option("--forever", "delete a job already in the Trash for good, now").option("--profile <name>").option("--json").action(async (id, opts) => {
1443
+ try {
1444
+ const client = buildClient(opts.profile);
1445
+ const result = await client.jobs.delete(id, { forever: opts.forever });
1446
+ if (opts.json) emit(result, opts);
1447
+ else success(opts.forever ? `deleted job ${id} for good` : `deleted job ${id} (in the Trash for 30 days)`);
1448
+ } catch (err) {
1449
+ handleError(err);
1450
+ }
1451
+ });
1452
+ cmd.command("restore <id>").description("bring a deleted job back from the Trash, into the sessions it was in").option("--profile <name>").option("--json").action(async (id, opts) => {
1453
+ try {
1454
+ const client = buildClient(opts.profile);
1455
+ const result = await client.jobs.restore(id);
1456
+ if (opts.json) emit(result, opts);
1457
+ else success(`restored job ${id}`);
1458
+ } catch (err) {
1459
+ handleError(err);
1460
+ }
1461
+ });
1380
1462
  return cmd;
1381
1463
  }
1382
1464
  var MEDIA_TYPES = ["image", "video", "audio"];
@@ -5954,6 +6036,50 @@ function recastCommand() {
5954
6036
  });
5955
6037
  return cmd;
5956
6038
  }
6039
+
6040
+ // src/quote-parts.ts
6041
+ var RENAMES = {
6042
+ motion: ["seedance", "kling"],
6043
+ motionExpected: ["seedanceExpected"],
6044
+ motionHd: ["seedanceHd"],
6045
+ privacy: ["masking"]
6046
+ };
6047
+ var OLD_KEYS = new Set(Object.values(RENAMES).flat());
6048
+ var finite = (v) => typeof v === "number" && Number.isFinite(v);
6049
+ function neutralParts(breakdown) {
6050
+ if (!breakdown || typeof breakdown !== "object" || Array.isArray(breakdown)) return {};
6051
+ const b = breakdown;
6052
+ const out = {};
6053
+ for (const [key2, value] of Object.entries(b)) if (!OLD_KEYS.has(key2) && finite(value)) out[key2] = value;
6054
+ for (const [key2, old] of Object.entries(RENAMES)) {
6055
+ if (key2 in out) continue;
6056
+ const from = old.find((k) => finite(b[k]));
6057
+ if (from !== void 0) out[key2] = b[from];
6058
+ }
6059
+ return out;
6060
+ }
6061
+ function neutralQuote(quote) {
6062
+ const { maskingCredits, privacyCredits, ...rest } = quote;
6063
+ const privacy = finite(privacyCredits) ? privacyCredits : finite(maskingCredits) ? maskingCredits : void 0;
6064
+ return {
6065
+ ...rest,
6066
+ ...quote.breakdown !== void 0 ? { breakdown: neutralParts(quote.breakdown) } : {},
6067
+ ...privacy !== void 0 ? { privacyCredits: privacy } : {}
6068
+ };
6069
+ }
6070
+ var PART_LABELS = {
6071
+ castSwap: "Nodaro Motion",
6072
+ references: "reference pictures",
6073
+ motion: "video",
6074
+ motionExpected: "video, expected",
6075
+ motionHd: "1080p render",
6076
+ privacy: "clip preparation"
6077
+ };
6078
+ function quotePartLabel(part) {
6079
+ return Object.hasOwn(PART_LABELS, part) ? PART_LABELS[part] : part;
6080
+ }
6081
+
6082
+ // src/commands/trends.ts
5957
6083
  var RESOLUTIONS = ["480p", "720p", "1080p"];
5958
6084
  var SLOT_KEY_RE = /^[a-z0-9_]{1,32}$/;
5959
6085
  var URL_SPLIT_RE = /,(?=\s*https?:\/\/)/i;
@@ -5971,8 +6097,8 @@ function addRunFlags(cmd) {
5971
6097
  "--example <n>",
5972
6098
  "1-based example 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"
5973
6099
  ).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(
5974
- new Option("--resolution <r>", "one the trend offers (`trends get`); default its first: 480p, or 720p on a Kling 4 trend").choices([...RESOLUTIONS])
5975
- ).option("--no-draft", "a full run instead of a draft (a draft is 480p only, and the default there; a Kling 4 trend has none)");
6100
+ new Option("--resolution <r>", "one the trend offers (`trends get`); default its first: 480p, or 720p on a Nodaro Motion Lite trend").choices([...RESOLUTIONS])
6101
+ ).option("--no-draft", "a full run instead of a draft (a draft is 480p only, and the default there; a Nodaro Motion Lite trend has none)");
5976
6102
  }
5977
6103
  function checkSlotKey(flag, spec, key2) {
5978
6104
  if (!SLOT_KEY_RE.test(key2) || key2 === "__proto__") {
@@ -6041,7 +6167,7 @@ function buildRequest(flags) {
6041
6167
  }
6042
6168
  function trendsCommand() {
6043
6169
  const cmd = new Command("trends").description(
6044
- "trends \u2014 ready-made Cast Swap recipes: browse, quote, run with your own pictures, favorite (Cloud edition)"
6170
+ "trends \u2014 ready-made Nodaro Motion recipes: browse, quote, run with your own pictures, favorite (Cloud edition)"
6045
6171
  );
6046
6172
  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) => {
6047
6173
  try {
@@ -6089,7 +6215,7 @@ function trendsCommand() {
6089
6215
  ).option("--profile <name>").option("--json").action(async (slug, opts) => {
6090
6216
  try {
6091
6217
  const request = buildRequest(opts);
6092
- const quote = await buildClient(opts.profile).trends.estimate(slug, request);
6218
+ const quote = neutralQuote(await buildClient(opts.profile).trends.estimate(slug, request));
6093
6219
  if (opts.json) {
6094
6220
  emit(quote, opts);
6095
6221
  return;
@@ -6097,7 +6223,7 @@ function trendsCommand() {
6097
6223
  info(
6098
6224
  `about ${quote.expectedCredits} credits` + (quote.holdCredits !== quote.expectedCredits ? ` (up to ${quote.holdCredits} held while it runs)` : "")
6099
6225
  );
6100
- for (const [part, credits] of Object.entries(quote.breakdown)) dim(` ${terminalSafe(part)}: ${credits}`);
6226
+ for (const [part, credits] of Object.entries(quote.breakdown)) dim(` ${terminalSafe(quotePartLabel(part))}: ${credits}`);
6101
6227
  } catch (err) {
6102
6228
  handleError(err);
6103
6229
  }
@@ -6181,11 +6307,11 @@ function trendsCommand() {
6181
6307
  }
6182
6308
  function fullQualityCommand() {
6183
6309
  const cmd = new Command("full-quality").description(
6184
- "finish a run (Cast Swap or trend) at Full Quality at 1080p, as a new job: a draft's same take, or a new take of a Kling 4 720p run \u2014 `estimate` quotes it (free), `run` SPENDS CREDITS"
6310
+ "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 Lite 720p run \u2014 `estimate` quotes it (free), `run` SPENDS CREDITS"
6185
6311
  );
6186
6312
  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) => {
6187
6313
  try {
6188
- const quote = await buildClient(opts.profile).castSwap.fullQualityEstimate(jobId);
6314
+ const quote = neutralQuote(await buildClient(opts.profile).castSwap.fullQualityEstimate(jobId));
6189
6315
  if (opts.json) {
6190
6316
  emit(quote, opts);
6191
6317
  return;
@@ -6194,9 +6320,9 @@ function fullQualityCommand() {
6194
6320
  if (quote.kind === "new-take") dim("a NEW take at 1080p from the same inputs (the 720p run stays)");
6195
6321
  else dim("the same take at 1080p");
6196
6322
  for (const [part, credits] of Object.entries(quote.breakdown)) {
6197
- if (typeof credits === "number") dim(` ${terminalSafe(part)}: ${credits}`);
6323
+ if (typeof credits === "number") dim(` ${terminalSafe(quotePartLabel(part))}: ${credits}`);
6198
6324
  }
6199
- if (quote.kind !== "new-take" && quote.breakdown.seedanceHd === 0) dim(" an earlier try's 1080p render is reused");
6325
+ if (quote.kind !== "new-take" && quote.breakdown.motionHd === 0) dim(" an earlier try's 1080p render is reused");
6200
6326
  dim(`available until ${terminalSafe(quote.availableUntil)}`);
6201
6327
  } catch (err) {
6202
6328
  handleError(err);
@@ -6223,7 +6349,7 @@ function fullQualityCommand() {
6223
6349
  return cmd;
6224
6350
  }
6225
6351
  function castSwapCommand() {
6226
- const cmd = new Command("cast-swap").description("Cast Swap \u2014 replace who and what is in a short video (Cloud edition)");
6352
+ const cmd = new Command("cast-swap").description("Nodaro Motion \u2014 replace who and what is in a short video (Cloud edition)");
6227
6353
  cmd.addCommand(fullQualityCommand());
6228
6354
  return cmd;
6229
6355
  }
@@ -8371,6 +8497,7 @@ program.hook("preAction", () => {
8371
8497
  program.addCommand(authCommand());
8372
8498
  program.addCommand(projectsCommand());
8373
8499
  program.addCommand(sessionsCommand());
8500
+ program.addCommand(trashCommand());
8374
8501
  program.addCommand(workflowsCommand());
8375
8502
  program.addCommand(appsCommand());
8376
8503
  program.addCommand(nodesCommand());