@nodaro/cli 1.26.1 → 1.27.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 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.26.1",
32
+ version: "1.27.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": "^2.21.0",
74
- "@nodaro/shared": "^3.25.0",
73
+ "@nodaro/sdk": "^2.22.0",
74
+ "@nodaro/shared": "^3.27.0",
75
75
  commander: "^12.1.0",
76
76
  picocolors: "^1.1.1",
77
- "@nodaro/prompts": "^1.34.0"
77
+ "@nodaro/prompts": "^1.36.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.26.1" ;
401
+ var CLI_VERSION = "1.27.0" ;
402
402
  function buildClient(profileName) {
403
403
  const { name, profile } = getProfile(profileName);
404
404
  if (!profile) {
@@ -1520,7 +1520,7 @@ function charactersCommand() {
1520
1520
  handleError(err);
1521
1521
  }
1522
1522
  });
1523
- cmd.command("generate <id>").description("trigger portrait generation for a character").option("--seed-prompt <prompt>").option("--description <desc>").option("--provider <provider>", "image provider (defaults to nano-banana)").option("--count <n>", "1, 2, or 4 candidate portraits", "1").option("--name <name>", "override the character's display name in the prompt").option("--profile <name>").option("--json").option("--watch", "poll the first job until it completes").action(
1523
+ cmd.command("generate <id>").description("trigger portrait generation for a character").option("--seed-prompt <prompt>").option("--description <desc>").option("--provider <provider>", "image provider (defaults to gpt-image-2)").option("--count <n>", "1, 2, or 4 candidate portraits", "1").option("--name <name>", "override the character's display name in the prompt").option("--profile <name>").option("--json").option("--watch", "poll the first job until it completes").action(
1524
1524
  async (id, opts) => {
1525
1525
  try {
1526
1526
  const client = buildClient(opts.profile);
@@ -1688,7 +1688,7 @@ function promptCommand() {
1688
1688
  const cmd = new Command("prompt").description(
1689
1689
  "AI prompt wizard \u2014 analyze, generate, and enhance prompts for generation nodes"
1690
1690
  );
1691
- 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 models only: run on the provider's own API so --temperature/--max-tokens/the full reasoning range apply. Bills one credit tier up, capped at premium.").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) => {
1691
+ 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. Bills one credit rung up (a premium model moves to premium-direct).").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) => {
1692
1692
  try {
1693
1693
  if (!isInteractive()) {
1694
1694
  warn("`prompt wizard` needs an interactive terminal \u2014 use `prompt analyze` + `prompt generate`, or `prompt enhance`, in scripts.");
@@ -1738,7 +1738,7 @@ function promptCommand() {
1738
1738
  handleError(err);
1739
1739
  }
1740
1740
  });
1741
- 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 models only: run on the provider's own API so --temperature/--max-tokens/the full reasoning range apply. Bills one credit tier up, capped at premium.").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) => {
1741
+ 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. Bills one credit rung up (a premium model moves to premium-direct).").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) => {
1742
1742
  try {
1743
1743
  const client = buildClient(opts.profile);
1744
1744
  const { jobId, questions } = await client.promptHelper.analyze({
@@ -1763,7 +1763,7 @@ function promptCommand() {
1763
1763
  handleError(err);
1764
1764
  }
1765
1765
  });
1766
- 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 models only: run on the provider's own API so --temperature/--max-tokens/the full reasoning range apply. Bills one credit tier up, capped at premium.").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) => {
1766
+ 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. Bills one credit rung up (a premium model moves to premium-direct).").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) => {
1767
1767
  try {
1768
1768
  const client = buildClient(opts.profile);
1769
1769
  const selections = parseSelectionPairs(opts.selection);
@@ -1783,7 +1783,7 @@ function promptCommand() {
1783
1783
  handleError(err);
1784
1784
  }
1785
1785
  });
1786
- 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 models only: run on the provider's own API so --temperature/--max-tokens/the full reasoning range apply. Bills one credit tier up, capped at premium.").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) => {
1786
+ 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. Bills one credit rung up (a premium model moves to premium-direct).").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) => {
1787
1787
  try {
1788
1788
  const client = buildClient(opts.profile);
1789
1789
  const result = await client.promptHelper.enhance({
@@ -3374,6 +3374,16 @@ function parseFormat(raw) {
3374
3374
  if (raw !== "csv" && raw !== "json") throw new Error("--format must be csv or json");
3375
3375
  return raw;
3376
3376
  }
3377
+ function parseCount2(flag, raw) {
3378
+ if (raw === void 0) return void 0;
3379
+ if (!/^\d+$/.test(raw)) throw new Error(`${flag} must be a whole number`);
3380
+ return Number(raw);
3381
+ }
3382
+ function parseUsage(raw) {
3383
+ if (raw === void 0 || raw === "all") return void 0;
3384
+ if (raw !== "unused" && raw !== "used") throw new Error("--usage must be all, unused or used");
3385
+ return raw;
3386
+ }
3377
3387
  function shorten2(text, max) {
3378
3388
  const flat = text.replace(/\s+/g, " ").trim();
3379
3389
  return flat.length > max ? `${flat.slice(0, max - 1)}\u2026` : flat;
@@ -3449,24 +3459,56 @@ function collectionsCommand() {
3449
3459
  handleError(err);
3450
3460
  }
3451
3461
  });
3452
- cmd.command("records <id>").description("a collection's records, newest first").option("--q <words>", "words in the title, text or link").option("--since <iso>", "only records saved at or after this time (ISO)").option("--limit <n>", "page size, 1-100 (default 50)").option("--cursor <cursor>", "the next cursor printed by the previous page").option("--profile <name>").option("--json").action(async (id, opts) => {
3462
+ cmd.command("records <id>").description("a collection's records, newest first").option("--q <words>", "words in the title, text or link").option("--since <iso>", "only records saved at or after this time (ISO)").option("--until <iso>", "only records saved before this time (ISO)").option("--usage <which>", "all (default), unused (not used yet) or used").option("--order <order>", "newest (default) or oldest first").option("--status <which>", "active (default: the live records) or trash").option("--limit <n>", "page size, 1-100 (default 50)").option("--offset <n>", "skip this many records first (a numbered page); not with --cursor").option("--cursor <cursor>", "the next cursor printed by the previous page").option("--profile <name>").option("--json").action(
3463
+ async (id, opts) => {
3464
+ try {
3465
+ const usage = parseUsage(opts.usage);
3466
+ const order = opts.order === "oldest" ? "oldest" : opts.order === void 0 || opts.order === "newest" ? void 0 : null;
3467
+ if (order === null) throw new Error("--order must be newest or oldest");
3468
+ const status = opts.status === "trash" ? "trash" : opts.status === void 0 || opts.status === "active" ? void 0 : null;
3469
+ if (status === null) throw new Error("--status must be active or trash");
3470
+ const client = buildClient(opts.profile);
3471
+ const page = await client.collections.records(id, {
3472
+ q: opts.q,
3473
+ since: opts.since,
3474
+ until: opts.until,
3475
+ usage,
3476
+ status,
3477
+ order,
3478
+ limit: parseCount2("--limit", opts.limit),
3479
+ offset: parseCount2("--offset", opts.offset),
3480
+ cursor: opts.cursor
3481
+ });
3482
+ if (opts.json) {
3483
+ emit(page, opts);
3484
+ return;
3485
+ }
3486
+ table(
3487
+ page.data.map((r) => ({
3488
+ id: r.id,
3489
+ saved: r.createdAt.slice(0, 10),
3490
+ used: r.usedAt ? r.usedAt.slice(0, 10) : "",
3491
+ headline: shorten2(collectionRecordHeadline(r), 56),
3492
+ from: r.source.workflowName ?? r.source.via ?? "",
3493
+ url: r.url ?? ""
3494
+ })),
3495
+ ["id", "saved", "used", "headline", "from", "url"]
3496
+ );
3497
+ if (page.nextCursor) success(`more: --cursor "${page.nextCursor}"`);
3498
+ } catch (err) {
3499
+ handleError(err);
3500
+ }
3501
+ }
3502
+ );
3503
+ cmd.command("mark-used <id> <recordId>").description("mark a record used (--not-used marks it not used again)").option("--not-used", "undo: the record is not used").option("--profile <name>").option("--json").action(async (id, recordId, opts) => {
3453
3504
  try {
3454
3505
  const client = buildClient(opts.profile);
3455
- const page = await client.collections.records(id, {
3456
- q: opts.q,
3457
- since: opts.since,
3458
- limit: opts.limit ? Number(opts.limit) : void 0,
3459
- cursor: opts.cursor
3460
- });
3506
+ const record = await client.collections.setUsed(id, recordId, !opts.notUsed);
3461
3507
  if (opts.json) {
3462
- emit(page, opts);
3508
+ emit(record, opts);
3463
3509
  return;
3464
3510
  }
3465
- table(
3466
- page.data.map((r) => ({ id: r.id, saved: r.createdAt.slice(0, 10), headline: shorten2(collectionRecordHeadline(r), 56), url: r.url ?? "" })),
3467
- ["id", "saved", "headline", "url"]
3468
- );
3469
- if (page.nextCursor) success(`more: --cursor "${page.nextCursor}"`);
3511
+ success(record.usedAt ? `used ${record.usedAt.slice(0, 16).replace("T", " ")}: ${collectionRecordHeadline(record)}` : `not used: ${collectionRecordHeadline(record)}`);
3470
3512
  } catch (err) {
3471
3513
  handleError(err);
3472
3514
  }
@@ -3502,20 +3544,39 @@ function collectionsCommand() {
3502
3544
  }
3503
3545
  }
3504
3546
  );
3505
- cmd.command("remove <id> <recordId>").description("remove one record").option("--profile <name>").action(async (id, recordId, opts) => {
3547
+ cmd.command("remove <id> <recordId>").description("move one record to the collection's Trash (restore brings it back); --forever deletes a record already in the Trash for good").option("--forever", "delete for good \u2014 the record must already be in the Trash").option("--profile <name>").action(async (id, recordId, opts) => {
3506
3548
  try {
3507
3549
  const client = buildClient(opts.profile);
3550
+ if (opts.forever) {
3551
+ await client.collections.deleteRecordForever(id, recordId);
3552
+ success(`deleted ${recordId} for good`);
3553
+ return;
3554
+ }
3508
3555
  await client.collections.deleteRecord(id, recordId);
3509
- success(`removed ${recordId}`);
3556
+ success(`moved ${recordId} to the Trash`);
3557
+ } catch (err) {
3558
+ handleError(err);
3559
+ }
3560
+ });
3561
+ cmd.command("restore <id> <recordId>").description("bring one record back from the collection's Trash").option("--profile <name>").option("--json").action(async (id, recordId, opts) => {
3562
+ try {
3563
+ const client = buildClient(opts.profile);
3564
+ const record = await client.collections.restoreRecord(id, recordId);
3565
+ if (opts.json) {
3566
+ emit(record, opts);
3567
+ return;
3568
+ }
3569
+ success(`restored: ${collectionRecordHeadline(record)}`);
3510
3570
  } catch (err) {
3511
3571
  handleError(err);
3512
3572
  }
3513
3573
  });
3514
- cmd.command("export <id>").description("the whole collection as CSV (default) or JSON, to stdout or a file").option("--format <format>", "csv or json (default csv)").option("--since <iso>", "only records saved at or after this time (ISO)").option("--q <words>", "words in the title, text or link").option("--out <path>", "write to this file instead of stdout").option("--profile <name>").action(async (id, opts) => {
3574
+ cmd.command("export <id>").description("the whole collection as CSV (default) or JSON, to stdout or a file").option("--format <format>", "csv or json (default csv)").option("--since <iso>", "only records saved at or after this time (ISO)").option("--until <iso>", "only records saved before this time (ISO)").option("--usage <which>", "all (default), unused (not used yet) or used").option("--q <words>", "words in the title, text or link").option("--out <path>", "write to this file instead of stdout").option("--profile <name>").action(async (id, opts) => {
3515
3575
  try {
3516
3576
  const format2 = parseFormat(opts.format);
3577
+ const usage = parseUsage(opts.usage);
3517
3578
  const client = buildClient(opts.profile);
3518
- const body = await client.collections.export(id, { format: format2, since: opts.since, q: opts.q });
3579
+ const body = await client.collections.export(id, { format: format2, since: opts.since, until: opts.until, usage, q: opts.q });
3519
3580
  if (opts.out) {
3520
3581
  writeFileSync(opts.out, body, "utf8");
3521
3582
  success(`wrote ${opts.out}`);
@@ -4638,7 +4699,7 @@ function locationsCommand() {
4638
4699
  handleError(err);
4639
4700
  }
4640
4701
  });
4641
- cmd.command("generate").description("trigger main-image generation for a location").requiredOption("--name <name>", "the location's display name (used in the prompt)").option("--description <desc>").option("--user-prompt <prompt>", "additional free-text prompt").option("--category <category>").option("--style <style>").option("--provider <provider>", "image provider (defaults to nano-banana)").option("--count <n>", "1, 2, or 4 candidate main images", "1").option("--attach-to-location-id <id>", "auto-attach result to this location row (count=1 only)").option("--profile <name>").option("--json").option("--watch", "poll the first job until it completes").action(
4702
+ cmd.command("generate").description("trigger main-image generation for a location").requiredOption("--name <name>", "the location's display name (used in the prompt)").option("--description <desc>").option("--user-prompt <prompt>", "additional free-text prompt").option("--category <category>").option("--style <style>").option("--provider <provider>", "image provider (defaults to gpt-image-2)").option("--count <n>", "1, 2, or 4 candidate main images", "1").option("--attach-to-location-id <id>", "auto-attach result to this location row (count=1 only)").option("--profile <name>").option("--json").option("--watch", "poll the first job until it completes").action(
4642
4703
  async (opts) => {
4643
4704
  try {
4644
4705
  const client = buildClient(opts.profile);
@@ -4988,7 +5049,7 @@ function objectsCommand() {
4988
5049
  handleError(err);
4989
5050
  }
4990
5051
  });
4991
- cmd.command("generate").description("trigger main-image generation for an object").requiredOption("--name <name>", "the object's display name (used in the prompt)").option("--description <desc>").option("--user-prompt <prompt>", "additional free-text prompt").addOption(new Option("--category <category>", "object category").choices([...OBJECT_CATEGORIES])).addOption(new Option("--style <style>", "object visual style").choices([...OBJECT_STYLES])).option("--provider <provider>", "image provider (defaults to nano-banana)").option("--count <n>", "1, 2, or 4 candidate main images", "1").option("--attach-to-object-id <id>", "auto-attach result to this object row (count=1 only)").option("--seed-prompt-hint <hint>", "parameter-picker prompt-fragment pass-through").option("--profile <name>").option("--json").option("--watch", "poll all jobs until they complete (parallel)").action(
5052
+ cmd.command("generate").description("trigger main-image generation for an object").requiredOption("--name <name>", "the object's display name (used in the prompt)").option("--description <desc>").option("--user-prompt <prompt>", "additional free-text prompt").addOption(new Option("--category <category>", "object category").choices([...OBJECT_CATEGORIES])).addOption(new Option("--style <style>", "object visual style").choices([...OBJECT_STYLES])).option("--provider <provider>", "image provider (defaults to gpt-image-2)").option("--count <n>", "1, 2, or 4 candidate main images", "1").option("--attach-to-object-id <id>", "auto-attach result to this object row (count=1 only)").option("--seed-prompt-hint <hint>", "parameter-picker prompt-fragment pass-through").option("--profile <name>").option("--json").option("--watch", "poll all jobs until they complete (parallel)").action(
4992
5053
  async (opts) => {
4993
5054
  try {
4994
5055
  const client = buildClient(opts.profile);