@nexusbloom/cli 0.2.2 → 0.2.4
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/package.json +1 -1
- package/src/index.js +0 -39
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
* nxb run <slug> --input '{}' — Execute with inline JSON input
|
|
11
11
|
* nxb run <slug> --file input.json — Execute with file input
|
|
12
12
|
* nxb run <slug> --local — Execute coreLogic locally (cached)
|
|
13
|
-
* nxb chat <message> — Natural language routing
|
|
14
13
|
* nxb info <slug> — Show tool schema
|
|
15
14
|
* nxb transform <slug> — Pipe stdin through a tool
|
|
16
15
|
* nxb config set <key> [value] — Set config (interactive if value omitted)
|
|
@@ -437,44 +436,6 @@ async function executeLocal(slug, input, jsonMode) {
|
|
|
437
436
|
}
|
|
438
437
|
}
|
|
439
438
|
|
|
440
|
-
// ─── `nxb chat <message>` — describe what you want ───────────────────────────
|
|
441
|
-
program
|
|
442
|
-
.command("chat")
|
|
443
|
-
.description("Describe what you want and let NexusBloom route to the right tools")
|
|
444
|
-
.argument("<message>", "What you want to do")
|
|
445
|
-
.action(async (message, opts, cmd) => {
|
|
446
|
-
const jsonMode = (cmd?.parent?.opts().json) || false;
|
|
447
|
-
try {
|
|
448
|
-
if (!jsonMode) console.log(chalk.dim(" Routing your request..."));
|
|
449
|
-
const res = await fetch(`${API_BASE}/api/v1/route`, {
|
|
450
|
-
method: "POST",
|
|
451
|
-
headers: { "Content-Type": "application/json" },
|
|
452
|
-
body: JSON.stringify({ task: message }),
|
|
453
|
-
});
|
|
454
|
-
const data = await res.json();
|
|
455
|
-
if (jsonMode) return console.log(JSON.stringify(data, null, 2));
|
|
456
|
-
if (data.matched_tools?.length > 0) {
|
|
457
|
-
console.log(chalk.bold(`\n Matched ${data.matched_tools.length} tool${data.matched_tools.length > 1 ? "s" : ""}:\n`));
|
|
458
|
-
data.matched_tools.forEach((t) => {
|
|
459
|
-
console.log(` ${chalk.cyan(t.slug.padEnd(30))} ${chalk.dim(`${Math.round(t.confidence * 100)}% match`)}`);
|
|
460
|
-
});
|
|
461
|
-
console.log();
|
|
462
|
-
if (data.results) {
|
|
463
|
-
console.log(chalk.bold(" Results:\n"));
|
|
464
|
-
data.results.forEach((r) => {
|
|
465
|
-
console.log(` ${chalk.cyan(r.tool)}:`);
|
|
466
|
-
console.log(` ${JSON.stringify(r.data, null, 4)}`);
|
|
467
|
-
});
|
|
468
|
-
}
|
|
469
|
-
} else {
|
|
470
|
-
console.log(chalk.yellow(" No matching tools found."));
|
|
471
|
-
}
|
|
472
|
-
} catch (err) {
|
|
473
|
-
if (jsonMode) return console.log(JSON.stringify({ error: err.message }));
|
|
474
|
-
console.error(chalk.red("Chat failed:"), err.message);
|
|
475
|
-
}
|
|
476
|
-
});
|
|
477
|
-
|
|
478
439
|
// ─── `nxb info <slug>` — show tool schema ────────────────────────────────────
|
|
479
440
|
program
|
|
480
441
|
.command("info")
|