@nexusbloom/cli 0.2.11 → 0.2.12

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +31 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexusbloom/cli",
3
- "version": "0.2.11",
3
+ "version": "0.2.12",
4
4
  "description": "NexusBloom CLI — run tools and workflows from your terminal",
5
5
  "type": "module",
6
6
  "bin": {
package/src/index.js CHANGED
@@ -508,8 +508,12 @@ program
508
508
  const required = manifest.input_schema.required || [];
509
509
  for (const [name, prop] of Object.entries(props)) {
510
510
  const req = required.includes(name) ? chalk.red(" *required") : "";
511
- console.log(` ${chalk.cyan(name)} (${prop.type})${req}`);
511
+ const def = prop.default !== undefined ? chalk.dim(` [default: ${JSON.stringify(prop.default)}]`) : "";
512
+ console.log(` ${chalk.cyan(name)} (${prop.type})${req}${def}`);
512
513
  if (prop.description) console.log(` ${chalk.dim(prop.description)}`);
514
+ if (prop.enum && prop.enum.length > 0) {
515
+ console.log(` ${chalk.dim("Allowed values:")} ${chalk.cyan(prop.enum.map(v => JSON.stringify(v)).join(", "))}`);
516
+ }
513
517
  }
514
518
  }
515
519
  if (manifest.output_schema?.properties) {
@@ -525,10 +529,13 @@ program
525
529
  program
526
530
  .command("transform")
527
531
  .description("Pipe stdin through a tool and write result to stdout")
528
- .argument("<slug>", "Tool slug")
532
+ .argument("<slug>", "Tool slug or abbreviation")
529
533
  .option("-k, --key <key>", "API key (or set NEXUSBLOOM_API_KEY env var)")
530
534
  .option("--local", "Execute locally (faster for repeated use)")
531
535
  .action(async (slug, opts, cmd) => {
536
+ // Resolve abbreviation
537
+ slug = await resolveToolSlug(slug);
538
+
532
539
  const jsonMode = cmd.parent.opts().json;
533
540
  const apiKey = opts.key || process.env.NEXUSBLOOM_API_KEY || configGet("apiKey") || configGet("key");
534
541
 
@@ -748,6 +755,20 @@ program
748
755
  console.log();
749
756
  });
750
757
 
758
+ // ─── Shared abbreviation resolver ─────────────────────────────────────────────
759
+ // Extracts the abbr resolution logic so all commands that accept slugs can use it.
760
+
761
+ async function resolveToolSlug(slug) {
762
+ const allTools = await fetchToolsWithFallback();
763
+ if (!allTools) return slug;
764
+ const slugs = allTools.map((t) => t.slug);
765
+ const abbrMap = generateAbbreviations(slugs);
766
+ if (abbrMap[slug] && slugs.includes(abbrMap[slug])) {
767
+ return abbrMap[slug];
768
+ }
769
+ return slug;
770
+ }
771
+
751
772
  // ─── `nxb json` — create JSON input for tools ───────────────────────────────
752
773
 
753
774
  program
@@ -761,6 +782,9 @@ program
761
782
  const jsonMode = cmd.parent.opts().json;
762
783
 
763
784
  if (opts.template) {
785
+ // Resolve abbreviation
786
+ opts.template = await resolveToolSlug(opts.template);
787
+
764
788
  // Fetch tool schema — try API first, then Supabase
765
789
  let manifest = null;
766
790
  try {
@@ -793,8 +817,11 @@ program
793
817
  for (const [key, prop] of Object.entries(schema.properties)) {
794
818
  const required = schema.required?.includes(key);
795
819
  const hint = prop.description ? ` (${prop.description})` : "";
796
- const def = prop.default ? ` [${prop.default}]` : "";
797
- const answer = await ask(chalk.cyan(` ${key}${hint}${def}: `));
820
+ const def = prop.default !== undefined ? ` [${JSON.stringify(prop.default)}]` : "";
821
+ const enumInfo = prop.enum && prop.enum.length > 0
822
+ ? ` {${prop.enum.map(v => JSON.stringify(v)).join("|")}}`
823
+ : "";
824
+ const answer = await ask(chalk.cyan(` ${key}${hint}${enumInfo}${def}: `));
798
825
  const val = answer || prop.default;
799
826
  if (val !== undefined && val !== "") {
800
827
  result[key] = prop.type === "number" || prop.type === "integer" ? Number(val) : val;