@nexusbloom/cli 0.2.1 → 0.2.2
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 +4 -3
- package/src/index.js +18 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nexusbloom/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "NexusBloom CLI — run tools and workflows from your terminal",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -18,8 +18,9 @@
|
|
|
18
18
|
"node": ">=18"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"commander": "^12.0.0",
|
|
22
21
|
"chalk": "^5.3.0",
|
|
23
|
-
"
|
|
22
|
+
"commander": "^12.0.0",
|
|
23
|
+
"ora": "^8.0.0",
|
|
24
|
+
"qrcode": "^1.5.4"
|
|
24
25
|
}
|
|
25
26
|
}
|
package/src/index.js
CHANGED
|
@@ -25,6 +25,7 @@ import fs from "fs";
|
|
|
25
25
|
import path from "path";
|
|
26
26
|
import { fileURLToPath } from "url";
|
|
27
27
|
import readline from "readline";
|
|
28
|
+
import QRCode from "qrcode";
|
|
28
29
|
|
|
29
30
|
const require = createRequire(import.meta.url);
|
|
30
31
|
const { version } = require("../package.json");
|
|
@@ -265,6 +266,10 @@ program
|
|
|
265
266
|
if (data.success) {
|
|
266
267
|
if (jsonMode) return console.log(JSON.stringify({ success: true, data: data.data }, null, 2));
|
|
267
268
|
console.log(chalk.green("\n Result:"));
|
|
269
|
+
// Try to render QR code if the output is SVG-based
|
|
270
|
+
if (data.data && typeof data.data === "object" && data.data.svg) {
|
|
271
|
+
await renderQRCode(body.data || body.text || JSON.stringify(body), slug);
|
|
272
|
+
}
|
|
268
273
|
console.log(` ${JSON.stringify(data.data, null, 2)}`);
|
|
269
274
|
} else {
|
|
270
275
|
if (jsonMode) return console.log(JSON.stringify({ success: false, error: data.error || "Unknown error" }, null, 2));
|
|
@@ -874,4 +879,17 @@ function readStdin() {
|
|
|
874
879
|
});
|
|
875
880
|
}
|
|
876
881
|
|
|
882
|
+
// ─── QR Code Terminal Renderer ────────────────────────────────────────────
|
|
883
|
+
|
|
884
|
+
async function renderQRCode(data, slug) {
|
|
885
|
+
try {
|
|
886
|
+
const qr = await QRCode.toString(data, { type: "terminal", small: true });
|
|
887
|
+
console.log(chalk.cyan("\n QR Code:"));
|
|
888
|
+
console.log(qr);
|
|
889
|
+
console.log(chalk.dim(` Data: ${data.slice(0, 80)}${data.length > 80 ? "..." : ""}`));
|
|
890
|
+
} catch {
|
|
891
|
+
// Silently skip if QR rendering fails
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
|
|
877
895
|
program.parse(process.argv);
|