@envpilot/cli 1.16.0 → 1.17.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.
|
@@ -7,7 +7,7 @@ function initSentry() {
|
|
|
7
7
|
Sentry.init({
|
|
8
8
|
dsn,
|
|
9
9
|
environment: "cli",
|
|
10
|
-
release: true ? "1.
|
|
10
|
+
release: true ? "1.17.0" : "0.0.0",
|
|
11
11
|
// All EnvPilot surfaces report to one Sentry project; the surface tag
|
|
12
12
|
// is how dashboards tell web / cli / extension events apart.
|
|
13
13
|
initialScope: { tags: { surface: "cli" } },
|
|
@@ -196,6 +196,14 @@ function extendCacheFreshness(projectId, environment, organizationId) {
|
|
|
196
196
|
} catch {
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
|
+
function deleteCache(projectId, environment, organizationId) {
|
|
200
|
+
try {
|
|
201
|
+
const key = getCacheKey(projectId, environment, organizationId);
|
|
202
|
+
const path = getCachePath(key);
|
|
203
|
+
if (existsSync(path)) unlinkSync(path);
|
|
204
|
+
} catch {
|
|
205
|
+
}
|
|
206
|
+
}
|
|
199
207
|
function clearAllCache() {
|
|
200
208
|
let count = 0;
|
|
201
209
|
try {
|
|
@@ -466,7 +474,7 @@ function isInteractiveTerminal() {
|
|
|
466
474
|
async function openTUI() {
|
|
467
475
|
const [{ render }, { CLIApp }, { PressAnyKey }] = await Promise.all([
|
|
468
476
|
import("ink"),
|
|
469
|
-
import("./app-
|
|
477
|
+
import("./app-7IL7GWIN.js"),
|
|
470
478
|
import("./press-any-key-64XFP4O2.js")
|
|
471
479
|
]);
|
|
472
480
|
while (true) {
|
|
@@ -665,7 +673,17 @@ var ErrorCodes = {
|
|
|
665
673
|
INVALID_INPUT: "INVALID_INPUT",
|
|
666
674
|
UNKNOWN_ERROR: "UNKNOWN_ERROR"
|
|
667
675
|
};
|
|
676
|
+
var ACCESS_SUSPENDED_TOKEN = "ACCESS_SUSPENDED";
|
|
677
|
+
var ACCESS_REVOKED_MESSAGE = "Your access to this organization has been revoked. Please contact your organization administrator.";
|
|
668
678
|
function formatError(error2) {
|
|
679
|
+
const data = error2?.data;
|
|
680
|
+
const raw = [
|
|
681
|
+
error2 instanceof Error ? error2.message : error2 ? String(error2) : "",
|
|
682
|
+
typeof data === "string" ? data : ""
|
|
683
|
+
].join(" ");
|
|
684
|
+
if (raw.includes(ACCESS_SUSPENDED_TOKEN)) {
|
|
685
|
+
return chalk2.red(`Error: ${ACCESS_REVOKED_MESSAGE}`);
|
|
686
|
+
}
|
|
669
687
|
if (error2 instanceof CLIError) {
|
|
670
688
|
let message = chalk2.red(`Error: ${error2.message}`);
|
|
671
689
|
if (error2.suggestion) {
|
|
@@ -731,6 +749,26 @@ function fileNotFound(path) {
|
|
|
731
749
|
function invalidInput(message) {
|
|
732
750
|
return new CLIError(message, ErrorCodes.INVALID_INPUT);
|
|
733
751
|
}
|
|
752
|
+
function isConnectivityError(error2) {
|
|
753
|
+
const code = error2?.code ?? "";
|
|
754
|
+
if ([
|
|
755
|
+
"ECONNREFUSED",
|
|
756
|
+
"ECONNRESET",
|
|
757
|
+
"ENOTFOUND",
|
|
758
|
+
"ETIMEDOUT",
|
|
759
|
+
"EAI_AGAIN",
|
|
760
|
+
"ENETUNREACH",
|
|
761
|
+
"EHOSTUNREACH",
|
|
762
|
+
"UND_ERR_CONNECT_TIMEOUT"
|
|
763
|
+
].includes(code)) {
|
|
764
|
+
return true;
|
|
765
|
+
}
|
|
766
|
+
if (error2?.status !== void 0) return false;
|
|
767
|
+
const message = error2 instanceof Error ? error2.message : String(error2);
|
|
768
|
+
return /fetch failed|network|socket hang up|getaddrinfo|connect timeout/i.test(
|
|
769
|
+
message
|
|
770
|
+
);
|
|
771
|
+
}
|
|
734
772
|
|
|
735
773
|
// src/lib/auth-flow.ts
|
|
736
774
|
import open from "open";
|
|
@@ -4781,14 +4819,19 @@ var runCommand = new Command14("run").description(
|
|
|
4781
4819
|
serverFingerprint
|
|
4782
4820
|
);
|
|
4783
4821
|
}
|
|
4784
|
-
} catch {
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4822
|
+
} catch (err) {
|
|
4823
|
+
if (isConnectivityError(err)) {
|
|
4824
|
+
variables = probe.entry.variables;
|
|
4825
|
+
cacheHit = true;
|
|
4826
|
+
cacheAge = formatAge(probe.entry.fetchedAt);
|
|
4827
|
+
if (!options.quiet) {
|
|
4828
|
+
warning(
|
|
4829
|
+
`Using offline cache (age ${cacheAge}) \u2014 could not reach the server to verify freshness.`
|
|
4830
|
+
);
|
|
4831
|
+
}
|
|
4832
|
+
} else {
|
|
4833
|
+
deleteCache(project.projectId, environment, organizationId);
|
|
4834
|
+
throw err;
|
|
4792
4835
|
}
|
|
4793
4836
|
}
|
|
4794
4837
|
} else {
|
package/dist/index.js
CHANGED
|
@@ -7,13 +7,13 @@ import {
|
|
|
7
7
|
initSentry,
|
|
8
8
|
isInteractiveTerminal,
|
|
9
9
|
openTUI
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-VEZRLJGM.js";
|
|
11
11
|
|
|
12
12
|
// src/lib/program.ts
|
|
13
13
|
import { Command } from "commander";
|
|
14
14
|
|
|
15
15
|
// src/lib/cli-version.ts
|
|
16
|
-
var CLI_VERSION = true ? "1.
|
|
16
|
+
var CLI_VERSION = true ? "1.17.0" : "0.0.0";
|
|
17
17
|
|
|
18
18
|
// src/lib/version-check.ts
|
|
19
19
|
import chalk from "chalk";
|