@kaiba-cloud/cli 0.2.2 → 1.0.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/cli.js +16 -4
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1297,7 +1297,7 @@ var HubClient = class {
1297
1297
  };
1298
1298
 
1299
1299
  // src/version.ts
1300
- var CLI_VERSION = true ? "0.2.2" : "0.0.0-dev";
1300
+ var CLI_VERSION = true ? "1.0.0" : "0.0.0-dev";
1301
1301
 
1302
1302
  // src/commands/auth.ts
1303
1303
  function peekNonInteractive(context) {
@@ -8916,12 +8916,24 @@ async function run3(options) {
8916
8916
  return error.exitCode;
8917
8917
  }
8918
8918
  const message2 = error instanceof Error ? error.message : String(error);
8919
- output.failure(
8920
- new CliError({ code: "internal", message: message2, exitCode: ExitCode.Error })
8921
- );
8919
+ output.failure(toCliError(error, message2));
8922
8920
  return ExitCode.Error;
8923
8921
  }
8924
8922
  }
8923
+ function toCliError(error, message2) {
8924
+ const cause = error?.cause;
8925
+ const isConnectionFailure = message2 === "fetch failed" || typeof cause?.code === "string" && ["ECONNREFUSED", "ENOTFOUND", "ETIMEDOUT", "ECONNRESET", "EAI_AGAIN", "UND_ERR_CONNECT_TIMEOUT"].includes(cause.code);
8926
+ if (!isConnectionFailure) {
8927
+ return new CliError({ code: "internal", message: message2, exitCode: ExitCode.Error });
8928
+ }
8929
+ return new CliError({
8930
+ code: "hub-unavailable",
8931
+ message: `Could not reach the hub${cause?.code ? ` (${cause.code})` : ""}.`,
8932
+ exitCode: ExitCode.Error,
8933
+ hint: "Check the hub is running and that the URL is right \u2014 `kaiba whoami` reports the one in use. Nothing was changed.",
8934
+ ...cause?.code && { details: { cause: cause.code } }
8935
+ });
8936
+ }
8925
8937
  async function maybeNotifyUpgrade(options) {
8926
8938
  const { argv, streams, env, isTty, mode, quiet, context } = options;
8927
8939
  const eligible = shouldCheck({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaiba-cloud/cli",
3
- "version": "0.2.2",
3
+ "version": "1.0.0",
4
4
  "description": "Kaiba CLI \u2014 build and deploy your apps from CI or a terminal.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",