@keywaysh/cli 0.0.12 → 0.0.13
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/dist/cli.js +23 -5
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -69,7 +69,7 @@ var INTERNAL_POSTHOG_HOST = "https://eu.i.posthog.com";
|
|
|
69
69
|
// package.json with { type: 'json' }
|
|
70
70
|
var package_default = {
|
|
71
71
|
name: "@keywaysh/cli",
|
|
72
|
-
version: "0.0.
|
|
72
|
+
version: "0.0.13",
|
|
73
73
|
description: "One link to all your secrets",
|
|
74
74
|
type: "module",
|
|
75
75
|
bin: {
|
|
@@ -133,10 +133,11 @@ var package_default = {
|
|
|
133
133
|
var API_BASE_URL = process.env.KEYWAY_API_URL || INTERNAL_API_URL;
|
|
134
134
|
var USER_AGENT = `keyway-cli/${package_default.version}`;
|
|
135
135
|
var APIError = class extends Error {
|
|
136
|
-
constructor(statusCode, error, message) {
|
|
136
|
+
constructor(statusCode, error, message, upgradeUrl) {
|
|
137
137
|
super(message);
|
|
138
138
|
this.statusCode = statusCode;
|
|
139
139
|
this.error = error;
|
|
140
|
+
this.upgradeUrl = upgradeUrl;
|
|
140
141
|
this.name = "APIError";
|
|
141
142
|
}
|
|
142
143
|
};
|
|
@@ -147,8 +148,9 @@ async function handleResponse(response) {
|
|
|
147
148
|
if (contentType.includes("application/json")) {
|
|
148
149
|
try {
|
|
149
150
|
const error = JSON.parse(text);
|
|
150
|
-
throw new APIError(response.status, error.error, error.message);
|
|
151
|
-
} catch {
|
|
151
|
+
throw new APIError(response.status, error.error, error.message, error.upgrade_url);
|
|
152
|
+
} catch (e) {
|
|
153
|
+
if (e instanceof APIError) throw e;
|
|
152
154
|
throw new APIError(response.status, "http_error", text || `HTTP ${response.status}`);
|
|
153
155
|
}
|
|
154
156
|
}
|
|
@@ -281,7 +283,7 @@ import fs from "fs";
|
|
|
281
283
|
// package.json
|
|
282
284
|
var package_default2 = {
|
|
283
285
|
name: "@keywaysh/cli",
|
|
284
|
-
version: "0.0.
|
|
286
|
+
version: "0.0.13",
|
|
285
287
|
description: "One link to all your secrets",
|
|
286
288
|
type: "module",
|
|
287
289
|
bin: {
|
|
@@ -994,6 +996,22 @@ async function initCommand(options = {}) {
|
|
|
994
996
|
await shutdownAnalytics();
|
|
995
997
|
return;
|
|
996
998
|
}
|
|
999
|
+
if (error.error === "PLAN_LIMIT_REACHED") {
|
|
1000
|
+
console.log("");
|
|
1001
|
+
console.log(chalk4.dim("\u2500".repeat(50)));
|
|
1002
|
+
console.log("");
|
|
1003
|
+
console.log(` ${chalk4.yellow("\u26A1")} ${chalk4.bold("Upgrade to Pro")}`);
|
|
1004
|
+
console.log("");
|
|
1005
|
+
console.log(chalk4.gray(" You've reached the limit of your free plan."));
|
|
1006
|
+
console.log(chalk4.gray(" Upgrade to Pro for unlimited private repositories."));
|
|
1007
|
+
console.log("");
|
|
1008
|
+
console.log(` ${chalk4.cyan("\u2192")} ${chalk4.underline(error.upgradeUrl || "https://keyway.sh/upgrade")}`);
|
|
1009
|
+
console.log("");
|
|
1010
|
+
console.log(chalk4.dim("\u2500".repeat(50)));
|
|
1011
|
+
console.log("");
|
|
1012
|
+
await shutdownAnalytics();
|
|
1013
|
+
process.exit(1);
|
|
1014
|
+
}
|
|
997
1015
|
}
|
|
998
1016
|
const message = error instanceof APIError ? error.message : error instanceof Error ? error.message.slice(0, 200) : "Unknown error";
|
|
999
1017
|
trackEvent(AnalyticsEvents.CLI_ERROR, {
|