@episoda/cli 0.2.171 → 0.2.173
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/daemon/daemon-process.js +854 -420
- package/dist/daemon/daemon-process.js.map +1 -1
- package/dist/index.js +34 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2931,6 +2931,23 @@ Branch: ${details.branchName}`;
|
|
|
2931
2931
|
}
|
|
2932
2932
|
});
|
|
2933
2933
|
|
|
2934
|
+
// ../core/dist/internal-env-keys.js
|
|
2935
|
+
var require_internal_env_keys = __commonJS({
|
|
2936
|
+
"../core/dist/internal-env-keys.js"(exports2) {
|
|
2937
|
+
"use strict";
|
|
2938
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2939
|
+
exports2.INTERNAL_ONLY_ENV_KEYS = void 0;
|
|
2940
|
+
exports2.isInternalOnlyEnvKey = isInternalOnlyEnvKey2;
|
|
2941
|
+
exports2.INTERNAL_ONLY_ENV_KEYS = [
|
|
2942
|
+
"AI_CREDENTIALS_ENCRYPTION_KEY"
|
|
2943
|
+
];
|
|
2944
|
+
var INTERNAL_ONLY_ENV_KEY_SET = new Set(exports2.INTERNAL_ONLY_ENV_KEYS);
|
|
2945
|
+
function isInternalOnlyEnvKey2(key) {
|
|
2946
|
+
return INTERNAL_ONLY_ENV_KEY_SET.has(key.toUpperCase());
|
|
2947
|
+
}
|
|
2948
|
+
}
|
|
2949
|
+
});
|
|
2950
|
+
|
|
2934
2951
|
// ../core/dist/index.js
|
|
2935
2952
|
var require_dist = __commonJS({
|
|
2936
2953
|
"../core/dist/index.js"(exports2) {
|
|
@@ -2966,6 +2983,7 @@ var require_dist = __commonJS({
|
|
|
2966
2983
|
__exportStar(require_errors(), exports2);
|
|
2967
2984
|
__exportStar(require_git_validator(), exports2);
|
|
2968
2985
|
__exportStar(require_git_parser(), exports2);
|
|
2986
|
+
__exportStar(require_internal_env_keys(), exports2);
|
|
2969
2987
|
var version_1 = require_version();
|
|
2970
2988
|
Object.defineProperty(exports2, "VERSION", { enumerable: true, get: function() {
|
|
2971
2989
|
return version_1.VERSION;
|
|
@@ -7279,14 +7297,15 @@ async function envListCommand(options = {}) {
|
|
|
7279
7297
|
if (!data.success || !data.env_vars) {
|
|
7280
7298
|
throw new Error("Failed to parse env vars response");
|
|
7281
7299
|
}
|
|
7282
|
-
|
|
7300
|
+
const visibleEnvVars = data.env_vars.filter((envVar) => !(0, import_core17.isInternalOnlyEnvKey)(envVar.key));
|
|
7301
|
+
if (visibleEnvVars.length === 0) {
|
|
7283
7302
|
status.info("No environment variables configured.");
|
|
7284
7303
|
status.info("Add one with: episoda env set KEY=value");
|
|
7285
7304
|
return;
|
|
7286
7305
|
}
|
|
7287
7306
|
console.log("\nEnvironment Variables:");
|
|
7288
7307
|
console.log("\u2500".repeat(60));
|
|
7289
|
-
for (const envVar of
|
|
7308
|
+
for (const envVar of visibleEnvVars) {
|
|
7290
7309
|
const envBadge = envVar.environment === "all" ? "" : ` [${envVar.environment}]`;
|
|
7291
7310
|
const sealed = envVar.is_sealed ? " (sealed)" : "";
|
|
7292
7311
|
if (options.showValues) {
|
|
@@ -7297,7 +7316,7 @@ async function envListCommand(options = {}) {
|
|
|
7297
7316
|
}
|
|
7298
7317
|
}
|
|
7299
7318
|
console.log("");
|
|
7300
|
-
console.log(`Total: ${
|
|
7319
|
+
console.log(`Total: ${visibleEnvVars.length} variable(s)`);
|
|
7301
7320
|
if (!options.showValues) {
|
|
7302
7321
|
console.log("\nTip: Use --show-values to see value previews");
|
|
7303
7322
|
}
|
|
@@ -7324,6 +7343,9 @@ async function envSetCommand(keyValue, options = {}) {
|
|
|
7324
7343
|
Keys must be uppercase with underscores (e.g., API_KEY, DATABASE_URL)`
|
|
7325
7344
|
);
|
|
7326
7345
|
}
|
|
7346
|
+
if ((0, import_core17.isInternalOnlyEnvKey)(key)) {
|
|
7347
|
+
throw new Error(`${key} is managed internally and cannot be set via episoda env`);
|
|
7348
|
+
}
|
|
7327
7349
|
const url = `${apiUrl}/api/projects/${config.project_id}/env-vars`;
|
|
7328
7350
|
const response = await fetch(url, {
|
|
7329
7351
|
method: "POST",
|
|
@@ -7383,6 +7405,9 @@ async function envRemoveCommand(key) {
|
|
|
7383
7405
|
if (!config || !config.access_token) {
|
|
7384
7406
|
throw new Error("Not authenticated. Please run `episoda auth` first.");
|
|
7385
7407
|
}
|
|
7408
|
+
if ((0, import_core17.isInternalOnlyEnvKey)(key)) {
|
|
7409
|
+
throw new Error(`${key} is managed internally and cannot be removed via episoda env`);
|
|
7410
|
+
}
|
|
7386
7411
|
const apiUrl = config.api_url || "https://episoda.dev";
|
|
7387
7412
|
const listUrl = `${apiUrl}/api/projects/${config.project_id}/env-vars`;
|
|
7388
7413
|
const listResponse = await fetch(listUrl, {
|
|
@@ -7419,7 +7444,10 @@ async function envPullCommand(options = {}) {
|
|
|
7419
7444
|
const apiUrl = config.api_url || "https://episoda.dev";
|
|
7420
7445
|
status.info("Fetching environment variables...");
|
|
7421
7446
|
const envVars = await fetchEnvVars(apiUrl, config.access_token);
|
|
7422
|
-
|
|
7447
|
+
const visibleEnvVars = Object.fromEntries(
|
|
7448
|
+
Object.entries(envVars).filter(([key]) => !(0, import_core17.isInternalOnlyEnvKey)(key))
|
|
7449
|
+
);
|
|
7450
|
+
if (Object.keys(visibleEnvVars).length === 0) {
|
|
7423
7451
|
status.warning("No environment variables found.");
|
|
7424
7452
|
return;
|
|
7425
7453
|
}
|
|
@@ -7433,7 +7461,7 @@ async function envPullCommand(options = {}) {
|
|
|
7433
7461
|
"# To refresh: episoda env pull",
|
|
7434
7462
|
""
|
|
7435
7463
|
].join("\n");
|
|
7436
|
-
const envContent = Object.entries(
|
|
7464
|
+
const envContent = Object.entries(visibleEnvVars).map(([key, value]) => {
|
|
7437
7465
|
if (/[\s'"#$`\\]/.test(value) || value.includes("\n")) {
|
|
7438
7466
|
const escaped = value.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\n/g, "\\n");
|
|
7439
7467
|
return `${key}="${escaped}"`;
|
|
@@ -7448,7 +7476,7 @@ async function envPullCommand(options = {}) {
|
|
|
7448
7476
|
const filename = options.file || ".env";
|
|
7449
7477
|
const filepath = path16.resolve(process.cwd(), filename);
|
|
7450
7478
|
fs14.writeFileSync(filepath, fullContent, { mode: 384 });
|
|
7451
|
-
status.success(`Wrote ${Object.keys(
|
|
7479
|
+
status.success(`Wrote ${Object.keys(visibleEnvVars).length} env vars to ${filename}`);
|
|
7452
7480
|
}
|
|
7453
7481
|
async function promptForValue(key) {
|
|
7454
7482
|
if (!process.stdin.isTTY) {
|