@lotics/cli 0.129.0 → 0.130.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.
Files changed (2) hide show
  1. package/dist/src/cli.js +36 -9
  2. package/package.json +1 -1
package/dist/src/cli.js CHANGED
@@ -45571,6 +45571,41 @@ Update available: ${current} \u2192 ${latest}`);
45571
45571
  `);
45572
45572
  }
45573
45573
 
45574
+ // src/cli_error.ts
45575
+ var CAUSE_HINT = {
45576
+ ENOTFOUND: "the hostname did not resolve (DNS)",
45577
+ EAI_AGAIN: "DNS lookup timed out \u2014 usually transient",
45578
+ ECONNREFUSED: "the host refused the connection",
45579
+ ECONNRESET: "the connection was reset mid-request",
45580
+ ETIMEDOUT: "the connection timed out",
45581
+ UND_ERR_CONNECT_TIMEOUT: "the connection timed out",
45582
+ CERT_HAS_EXPIRED: "the server's TLS certificate has expired",
45583
+ UNABLE_TO_VERIFY_LEAF_SIGNATURE: "the server's TLS certificate could not be verified"
45584
+ };
45585
+ function describeTransportFailure(cause) {
45586
+ if (typeof cause !== "object" || cause === null) return null;
45587
+ const { code, hostname: hostname3, message: message2 } = cause;
45588
+ if (typeof code !== "string") return null;
45589
+ const where = typeof hostname3 === "string" && hostname3 ? ` reaching ${hostname3}` : "";
45590
+ const hint = CAUSE_HINT[code] ?? (typeof message2 === "string" ? message2 : void 0);
45591
+ return `${code}${where}${hint ? ` \u2014 ${hint}` : ""}`;
45592
+ }
45593
+ function describeCliError(error52) {
45594
+ if (!(error52 instanceof Error)) return String(error52);
45595
+ const transport = describeTransportFailure(error52.cause);
45596
+ if (transport) {
45597
+ return error52.message === "fetch failed" ? `Network request failed: ${transport}` : `${error52.message}
45598
+ Network request failed: ${transport}`;
45599
+ }
45600
+ if (error52.message.includes("fetch failed") || error52.message.includes("ECONNREFUSED")) {
45601
+ return error52.message === "fetch failed" ? "Network request failed \u2014 check your connection." : `${error52.message}
45602
+ Network request failed \u2014 check your connection.`;
45603
+ }
45604
+ const enoent = error52.message.match(/open '([^']+)'/);
45605
+ if (error52.message.includes("ENOENT")) return `File not found: ${enoent?.[1] ?? error52.message}`;
45606
+ return error52.message;
45607
+ }
45608
+
45574
45609
  // src/version.ts
45575
45610
  import { readFileSync } from "node:fs";
45576
45611
  import { fileURLToPath } from "node:url";
@@ -101252,14 +101287,6 @@ ${JSON.stringify(info.input_schema, null, 2)}`);
101252
101287
  }
101253
101288
  }
101254
101289
  main().then(() => checkForUpdate(VERSION)).catch((error52) => {
101255
- const message2 = error52 instanceof Error ? error52.message : String(error52);
101256
- if (message2.includes("fetch failed") || message2.includes("ECONNREFUSED")) {
101257
- console.error("Could not connect to the Lotics API.");
101258
- } else if (message2.includes("ENOENT")) {
101259
- const pathMatch = message2.match(/open '([^']+)'/);
101260
- console.error(`File not found: ${pathMatch?.[1] ?? message2}`);
101261
- } else {
101262
- console.error(message2);
101263
- }
101290
+ console.error(describeCliError(error52));
101264
101291
  process.exit(1);
101265
101292
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lotics/cli",
3
- "version": "0.129.0",
3
+ "version": "0.130.0",
4
4
  "description": "Lotics SDK and CLI for AI agents",
5
5
  "type": "module",
6
6
  "bin": {