@nexusbloom/cli 0.3.1 → 0.3.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.
Files changed (2) hide show
  1. package/package.json +1 -2
  2. package/src/run.js +8 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexusbloom/cli",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "NexusBloom CLI — run tools and workflows from your terminal",
5
5
  "type": "module",
6
6
  "bin": {
@@ -21,7 +21,6 @@
21
21
  "@inquirer/prompts": "^8.7.2",
22
22
  "chalk": "^5.3.0",
23
23
  "commander": "^12.0.0",
24
- "ora": "^8.0.0",
25
24
  "qrcode": "^1.5.4"
26
25
  }
27
26
  }
package/src/run.js CHANGED
@@ -12,7 +12,6 @@
12
12
  import fs from "fs";
13
13
  import path from "path";
14
14
  import chalk from "chalk";
15
- import ora from "ora";
16
15
  import QRCode from "qrcode";
17
16
 
18
17
  import {
@@ -42,7 +41,7 @@ export async function runRemote(slug, body, { apiKey, jsonMode, slugResolved })
42
41
  return runLocal(slug, body, { jsonMode, slugResolved });
43
42
  }
44
43
 
45
- const spinner = !jsonMode ? ora(chalk.gray(` Running ${slug}...`))`.start()` : null;
44
+ if (!jsonMode) console.log(chalk.dim(` Running ${slug}...`));
46
45
 
47
46
  try {
48
47
  const res = await fetch(`${API_BASE}/api/run/${slug}`, {
@@ -52,17 +51,14 @@ export async function runRemote(slug, body, { apiKey, jsonMode, slugResolved })
52
51
  });
53
52
 
54
53
  if (!res.ok && !res.headers.get("content-type")?.includes("json")) {
55
- if (spinner) spinner.succeed(chalk.dim(" API not deployed — falling back to local"));
54
+ if (!jsonMode) console.log(chalk.dim(" API not deployed — falling back to local"));
56
55
  return runLocal(slug, body, { jsonMode, slugResolved });
57
56
  }
58
57
 
59
58
  const data = await res.json();
60
- if (spinner) {
61
- if (data.success) spinner.succeed(chalk.green(` ${slug} completed`));
62
- else spinner.fail(chalk.red(` ${slug} failed`));
63
- }
64
59
 
65
60
  if (data.success) {
61
+ if (!jsonMode) console.log(chalk.green(` ✓ ${slug} completed`));
66
62
  if (data.data && typeof data.data === "object" && data.data.svg) {
67
63
  await renderQRCode(body.data || body.text || JSON.stringify(body), slug);
68
64
  }
@@ -72,11 +68,12 @@ export async function runRemote(slug, body, { apiKey, jsonMode, slugResolved })
72
68
  return;
73
69
  }
74
70
 
71
+ if (!jsonMode) console.log(chalk.red(` ✗ ${slug} failed`));
75
72
  if (jsonMode) return console.log(JSON.stringify({ success: false, error: data.error || "Unknown error" }, null, 2));
76
73
  console.error(chalk.red(`\n Error: ${data.error || "Unknown error"}`));
77
74
  process.exitCode = 1;
78
75
  } catch (err) {
79
- if (spinner) spinner.fail(chalk.dim(" API unreachable — falling back to local"));
76
+ if (!jsonMode) console.log(chalk.dim(" API unreachable — falling back to local"));
80
77
  return runLocal(slug, body, { jsonMode, slugResolved });
81
78
  }
82
79
  }
@@ -131,10 +128,10 @@ export async function runLocal(slug, input, { jsonMode, slugResolved, source: sr
131
128
  }
132
129
 
133
130
  const timeoutMs = manifest.timeout_ms || 5000;
134
- const spinner = !jsonMode ? ora(chalk.gray(` Executing ${slug} (local)`)).start() : null;
135
131
  let result;
136
132
 
137
133
  try {
134
+ if (!jsonMode) console.log(chalk.dim(` Executing ${slug} (local)...`));
138
135
  if (isAsync) {
139
136
  result = await Promise.race([
140
137
  coreLogicFn(input),
@@ -143,7 +140,7 @@ export async function runLocal(slug, input, { jsonMode, slugResolved, source: sr
143
140
  } else {
144
141
  result = coreLogicFn(input);
145
142
  }
146
- if (spinner) spinner.succeed(chalk.green(` ${slug} completed`));
143
+ if (!jsonMode) console.log(chalk.green(` ✓ ${slug} completed`));
147
144
 
148
145
  // Fire-and-forget telemetry
149
146
  const apiKey = process.env.NEXUSBLOOM_API_KEY || configGet("apiKey") || configGet("key");
@@ -155,7 +152,7 @@ export async function runLocal(slug, input, { jsonMode, slugResolved, source: sr
155
152
  console.log(chalk.green("\n Result (local):"));
156
153
  console.log(` ${JSON.stringify(result, null, 2)}`);
157
154
  } catch (err) {
158
- if (spinner) spinner.fail(chalk.red(` Execution error`));
155
+ if (!jsonMode) console.log(chalk.red(` ✗ Execution error`));
159
156
  if (jsonMode) return console.log(JSON.stringify({ error: err.message }));
160
157
  console.error(chalk.red(`\n Local execution error: ${err.message}`));
161
158
  process.exitCode = 1;