@lotics/cli 0.128.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 +41 -25
  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";
@@ -70380,16 +70415,13 @@ function stripAgentHeader(text) {
70380
70415
  return text.replace(/<!--\s*lotics:[\s\S]*?-->\n?/g, "").replace(/\n{3,}/g, "\n\n").trim();
70381
70416
  }
70382
70417
 
70383
- // src/app_commands.ts
70384
- async function fetchLatestNpmVersion(packageName) {
70418
+ // src/npm_registry.ts
70419
+ async function fetchLatestNpmVersion(packageName, { timeoutMs = 1500 } = {}) {
70385
70420
  try {
70386
- const controller = new AbortController();
70387
- const timeout = setTimeout(() => controller.abort(), 1500);
70388
70421
  const response = await fetch(`https://registry.npmjs.org/${packageName}/latest`, {
70389
- signal: controller.signal,
70422
+ signal: AbortSignal.timeout(timeoutMs),
70390
70423
  headers: { accept: "application/json" }
70391
70424
  });
70392
- clearTimeout(timeout);
70393
70425
  if (!response.ok) return null;
70394
70426
  const body = await response.json();
70395
70427
  return typeof body.version === "string" ? body.version : null;
@@ -70397,6 +70429,8 @@ async function fetchLatestNpmVersion(packageName) {
70397
70429
  return null;
70398
70430
  }
70399
70431
  }
70432
+
70433
+ // src/app_commands.ts
70400
70434
  function orderedLike(value2, template) {
70401
70435
  if (Array.isArray(value2)) {
70402
70436
  const t = Array.isArray(template) ? template : [];
@@ -70744,16 +70778,6 @@ function readAppMeta(projectDir) {
70744
70778
  capabilities: pkg2.lotics.capabilities
70745
70779
  };
70746
70780
  }
70747
- var APP_META_KEYS = Object.keys({
70748
- app_id: true,
70749
- workspace_id: true,
70750
- current_version_id: true,
70751
- version_number: true,
70752
- workflows: true,
70753
- queries: true,
70754
- agents: true,
70755
- capabilities: true
70756
- });
70757
70781
  function writeAppMeta(projectDir, meta3) {
70758
70782
  const pkgPath2 = path7.join(projectDir, "package.json");
70759
70783
  const pkg2 = JSON.parse(fs6.readFileSync(pkgPath2, "utf-8"));
@@ -101263,14 +101287,6 @@ ${JSON.stringify(info.input_schema, null, 2)}`);
101263
101287
  }
101264
101288
  }
101265
101289
  main().then(() => checkForUpdate(VERSION)).catch((error52) => {
101266
- const message2 = error52 instanceof Error ? error52.message : String(error52);
101267
- if (message2.includes("fetch failed") || message2.includes("ECONNREFUSED")) {
101268
- console.error("Could not connect to the Lotics API.");
101269
- } else if (message2.includes("ENOENT")) {
101270
- const pathMatch = message2.match(/open '([^']+)'/);
101271
- console.error(`File not found: ${pathMatch?.[1] ?? message2}`);
101272
- } else {
101273
- console.error(message2);
101274
- }
101290
+ console.error(describeCliError(error52));
101275
101291
  process.exit(1);
101276
101292
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lotics/cli",
3
- "version": "0.128.0",
3
+ "version": "0.130.0",
4
4
  "description": "Lotics SDK and CLI for AI agents",
5
5
  "type": "module",
6
6
  "bin": {