@keynv/cli 0.1.0-rc.22 → 0.1.0-rc.24
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/README.md +72 -50
- package/dist/index.js +313 -340
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'module';
|
|
3
|
-
import
|
|
3
|
+
import * as nodePath from 'path';
|
|
4
|
+
import { relative, join, isAbsolute, resolve, dirname, sep, basename } from 'path';
|
|
5
|
+
import { createHash } from 'crypto';
|
|
4
6
|
import { readFileSync, existsSync, writeFileSync, statSync, realpathSync, readdirSync, renameSync, mkdirSync, rmSync, constants as constants$1, lstatSync } from 'fs';
|
|
5
7
|
import { homedir, hostname, platform } from 'os';
|
|
6
|
-
import * as nodePath from 'path';
|
|
7
|
-
import { relative, join, isAbsolute, resolve, sep, dirname, basename } from 'path';
|
|
8
8
|
import { mkdir, writeFile, readFile, unlink, stat, rm, access, constants, appendFile, readdir, open, rename, copyFile } from 'fs/promises';
|
|
9
9
|
import { createConnection, createServer } from 'net';
|
|
10
10
|
import { styleText, stripVTControlCharacters } from 'util';
|
|
@@ -1070,16 +1070,17 @@ var require_lib = __commonJS({
|
|
|
1070
1070
|
var VERSION, AGENT;
|
|
1071
1071
|
var init_version = __esm({
|
|
1072
1072
|
"src/version.ts"() {
|
|
1073
|
-
VERSION = "0.1.0-rc.
|
|
1073
|
+
VERSION = "0.1.0-rc.24" ;
|
|
1074
1074
|
AGENT = `keynv-cli/${VERSION}`;
|
|
1075
1075
|
}
|
|
1076
1076
|
});
|
|
1077
1077
|
|
|
1078
1078
|
// src/client/defaults.ts
|
|
1079
|
-
var DEFAULT_SERVER_URL;
|
|
1079
|
+
var DEFAULT_SERVER_URL, DEFAULT_WEB_URL;
|
|
1080
1080
|
var init_defaults = __esm({
|
|
1081
1081
|
"src/client/defaults.ts"() {
|
|
1082
1082
|
DEFAULT_SERVER_URL = "https://api.keynv.dev";
|
|
1083
|
+
DEFAULT_WEB_URL = "https://keynv.dev";
|
|
1083
1084
|
}
|
|
1084
1085
|
});
|
|
1085
1086
|
|
|
@@ -1155,7 +1156,7 @@ function findAliasesInArgv(argv2) {
|
|
|
1155
1156
|
}
|
|
1156
1157
|
return result;
|
|
1157
1158
|
}
|
|
1158
|
-
function replaceAliases(text,
|
|
1159
|
+
function replaceAliases(text, resolve6, opts = {}) {
|
|
1159
1160
|
if (typeof text !== "string" || text.length === 0)
|
|
1160
1161
|
return text;
|
|
1161
1162
|
const matches = findAliases(text, opts);
|
|
@@ -1166,7 +1167,7 @@ function replaceAliases(text, resolve4, opts = {}) {
|
|
|
1166
1167
|
const m = matches[i];
|
|
1167
1168
|
if (!m)
|
|
1168
1169
|
continue;
|
|
1169
|
-
const replacement =
|
|
1170
|
+
const replacement = resolve6(m);
|
|
1170
1171
|
if (parseAlias(replacement) !== null) {
|
|
1171
1172
|
throw new Error(`replaceAliases: resolved value for ${m.literal} is itself a valid alias (${replacement}). Circular or misconfigured resolution detected.`);
|
|
1172
1173
|
}
|
|
@@ -1227,6 +1228,14 @@ var init_types2 = __esm({
|
|
|
1227
1228
|
NONCE_BYTES = 24;
|
|
1228
1229
|
}
|
|
1229
1230
|
});
|
|
1231
|
+
function loadSodiumModule() {
|
|
1232
|
+
try {
|
|
1233
|
+
return moduleRequire("libsodium-wrappers");
|
|
1234
|
+
} catch {
|
|
1235
|
+
const runtimeRequire = createRequire(join(process.cwd(), "package.json"));
|
|
1236
|
+
return runtimeRequire("libsodium-wrappers");
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1230
1239
|
function loadSodium() {
|
|
1231
1240
|
if (!readyPromise) {
|
|
1232
1241
|
readyPromise = sodium.ready.then(() => sodium);
|
|
@@ -1240,11 +1249,11 @@ function zero(buf) {
|
|
|
1240
1249
|
}
|
|
1241
1250
|
buf.fill(0);
|
|
1242
1251
|
}
|
|
1243
|
-
var
|
|
1252
|
+
var moduleRequire, sodium, readyPromise;
|
|
1244
1253
|
var init_sodium = __esm({
|
|
1245
1254
|
"../../packages/core/dist/crypto/sodium.js"() {
|
|
1246
|
-
|
|
1247
|
-
sodium =
|
|
1255
|
+
moduleRequire = createRequire(import.meta.url);
|
|
1256
|
+
sodium = loadSodiumModule();
|
|
1248
1257
|
readyPromise = null;
|
|
1249
1258
|
}
|
|
1250
1259
|
});
|
|
@@ -5609,8 +5618,8 @@ function legacyPath() {
|
|
|
5609
5618
|
}
|
|
5610
5619
|
function loadEntryCtor() {
|
|
5611
5620
|
if (!EntryCtor) {
|
|
5612
|
-
const
|
|
5613
|
-
EntryCtor =
|
|
5621
|
+
const require2 = createRequire(import.meta.url);
|
|
5622
|
+
EntryCtor = require2("@napi-rs/keyring").Entry;
|
|
5614
5623
|
}
|
|
5615
5624
|
return EntryCtor;
|
|
5616
5625
|
}
|
|
@@ -6214,12 +6223,12 @@ async function startRpcServer(registry) {
|
|
|
6214
6223
|
socket.on("error", () => {
|
|
6215
6224
|
});
|
|
6216
6225
|
});
|
|
6217
|
-
return new Promise((
|
|
6226
|
+
return new Promise((resolve6, reject) => {
|
|
6218
6227
|
server.once("error", reject);
|
|
6219
6228
|
server.listen(path, () => {
|
|
6220
6229
|
void chmodIfExists(path, 384).catch(() => {
|
|
6221
6230
|
});
|
|
6222
|
-
|
|
6231
|
+
resolve6({
|
|
6223
6232
|
socketPath: path,
|
|
6224
6233
|
close: () => new Promise((res) => {
|
|
6225
6234
|
server.close(() => res());
|
|
@@ -6281,7 +6290,7 @@ function handleLine(line, socket, registry) {
|
|
|
6281
6290
|
async function registerValueWithWatcher(value, timeoutMs = 200) {
|
|
6282
6291
|
if (value.length === 0) return null;
|
|
6283
6292
|
const path = socketPath();
|
|
6284
|
-
return new Promise((
|
|
6293
|
+
return new Promise((resolve6) => {
|
|
6285
6294
|
const socket = createConnection(path);
|
|
6286
6295
|
let buffer = "";
|
|
6287
6296
|
let settled = false;
|
|
@@ -6289,7 +6298,7 @@ async function registerValueWithWatcher(value, timeoutMs = 200) {
|
|
|
6289
6298
|
if (settled) return;
|
|
6290
6299
|
settled = true;
|
|
6291
6300
|
socket.destroy();
|
|
6292
|
-
|
|
6301
|
+
resolve6(result);
|
|
6293
6302
|
};
|
|
6294
6303
|
const timer = setTimeout(() => settle(null), timeoutMs);
|
|
6295
6304
|
socket.once("error", () => {
|
|
@@ -6345,8 +6354,8 @@ When the user asks about secrets or env vars, follow this decision tree:
|
|
|
6345
6354
|
|---|---|
|
|
6346
6355
|
| "Add a new API key" / "set up a secret" | \`keynv secret create\` (interactive prompt picks project + env + key) |
|
|
6347
6356
|
| "I have a \`.env\`, migrate it" | Run \`keynv\` and choose **Set up this project** |
|
|
6348
|
-
| "Run the app / dev server / tests" |
|
|
6349
|
-
| "Show me the value of X" | \`keynv secret get @alias --copy\`
|
|
6357
|
+
| "Run the app / dev server / tests" | Run the project's script as usual (e.g. \`npm run dev\`) \u2014 setup already wrapped it with keynv. For a one-off command that isn't a package.json script, use \`keynv exec -- <cmd>\`. |
|
|
6358
|
+
| "Show me the value of X" | Don't reveal it. \`keynv secret get @alias --copy\` puts the value on the clipboard without printing it. Bare \`keynv secret get\` refuses to print in a non-interactive context; \`--reveal\` forces raw stdout \u2014 avoid it in agent contexts. |
|
|
6350
6359
|
| "Rotate this key" | \`keynv secret rotate @alias\` |
|
|
6351
6360
|
| "Add a new env var to the project" | Edit \`.keynv.env\` and add \`NAME=@project.env.key\` (after creating the secret with \`keynv secret create\`) |
|
|
6352
6361
|
| "Who has access?" | \`keynv member list <project>\` |
|
|
@@ -6617,20 +6626,30 @@ var init_collision = __esm({
|
|
|
6617
6626
|
KEY_RE3 = /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,63}$/;
|
|
6618
6627
|
}
|
|
6619
6628
|
});
|
|
6620
|
-
function findProjectRoot(startDir) {
|
|
6621
|
-
const
|
|
6622
|
-
|
|
6623
|
-
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
|
|
6627
|
-
if (
|
|
6628
|
-
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
}
|
|
6632
|
-
|
|
6633
|
-
|
|
6629
|
+
function findProjectRoot(startDir, boundaryDir = homedir()) {
|
|
6630
|
+
const start = resolve(startDir);
|
|
6631
|
+
const boundary = resolve(boundaryDir);
|
|
6632
|
+
let dir = start;
|
|
6633
|
+
for (let i = 0; i < 64; i++) {
|
|
6634
|
+
if (dir === boundary || isAncestorOf(dir, boundary)) break;
|
|
6635
|
+
const marker = markerAt(dir);
|
|
6636
|
+
if (marker) return buildRoot(dir, marker);
|
|
6637
|
+
const parent = dirname(dir);
|
|
6638
|
+
if (parent === dir) break;
|
|
6639
|
+
dir = parent;
|
|
6640
|
+
}
|
|
6641
|
+
return buildRoot(start, "current directory");
|
|
6642
|
+
}
|
|
6643
|
+
function markerAt(dir) {
|
|
6644
|
+
for (const marker of PROJECT_MARKERS) {
|
|
6645
|
+
if (existsSync(join(dir, marker))) return marker;
|
|
6646
|
+
}
|
|
6647
|
+
if (existsSync(join(dir, GIT_MARKER))) return GIT_MARKER;
|
|
6648
|
+
return null;
|
|
6649
|
+
}
|
|
6650
|
+
function isAncestorOf(ancestor, descendant) {
|
|
6651
|
+
const rel = relative(resolve(ancestor), resolve(descendant));
|
|
6652
|
+
return rel !== "" && !rel.startsWith("..") && !isAbsolute(rel);
|
|
6634
6653
|
}
|
|
6635
6654
|
function buildRoot(dir, marker) {
|
|
6636
6655
|
let suggestedName = basename(dir);
|
|
@@ -6662,6 +6681,7 @@ function buildRoot(dir, marker) {
|
|
|
6662
6681
|
function findEnvFilesRecursive(rootDir, opts = {}) {
|
|
6663
6682
|
const maxDepth = Math.max(1, opts.maxDepth ?? DEFAULT_MAX_DEPTH);
|
|
6664
6683
|
const ignore = opts.ignore ?? IGNORE_DIRS;
|
|
6684
|
+
const limit = Math.max(1, opts.limit ?? DEFAULT_MAX_RESULTS);
|
|
6665
6685
|
let rootReal;
|
|
6666
6686
|
try {
|
|
6667
6687
|
rootReal = realpathSync(rootDir);
|
|
@@ -6716,10 +6736,15 @@ function findEnvFilesRecursive(rootDir, opts = {}) {
|
|
|
6716
6736
|
relativeDir,
|
|
6717
6737
|
containingDir: dir
|
|
6718
6738
|
});
|
|
6739
|
+
if (hits.length >= limit) {
|
|
6740
|
+
queue.length = 0;
|
|
6741
|
+
break;
|
|
6742
|
+
}
|
|
6719
6743
|
continue;
|
|
6720
6744
|
}
|
|
6721
6745
|
if (isDir && depth + 1 < maxDepth) {
|
|
6722
6746
|
if (ignore.has(entry2.name)) continue;
|
|
6747
|
+
if (entry2.name.startsWith(".")) continue;
|
|
6723
6748
|
let realDir;
|
|
6724
6749
|
try {
|
|
6725
6750
|
realDir = realpathSync(full);
|
|
@@ -6767,10 +6792,9 @@ function suggestedEnvForSuffix(suffix) {
|
|
|
6767
6792
|
function hasExistingKeynvEnv(rootDir) {
|
|
6768
6793
|
return existsSync(join(rootDir, KEYNV_ENV_BASENAME));
|
|
6769
6794
|
}
|
|
6770
|
-
var PROJECT_MARKERS, GIT_MARKER, ENV_GLOB, ENV_EXAMPLE, KEYNV_ENV_BASENAME, KEYNV_ENV_EXCLUDE, IGNORE_DIRS, DEFAULT_MAX_DEPTH;
|
|
6795
|
+
var PROJECT_MARKERS, GIT_MARKER, ENV_GLOB, ENV_EXAMPLE, KEYNV_ENV_BASENAME, KEYNV_ENV_EXCLUDE, IGNORE_DIRS, DEFAULT_MAX_DEPTH, DEFAULT_MAX_RESULTS;
|
|
6771
6796
|
var init_detect = __esm({
|
|
6772
6797
|
"src/init/detect.ts"() {
|
|
6773
|
-
init_fs();
|
|
6774
6798
|
PROJECT_MARKERS = [
|
|
6775
6799
|
"package.json",
|
|
6776
6800
|
"pyproject.toml",
|
|
@@ -6853,6 +6877,7 @@ var init_detect = __esm({
|
|
|
6853
6877
|
".fleet"
|
|
6854
6878
|
]);
|
|
6855
6879
|
DEFAULT_MAX_DEPTH = 5;
|
|
6880
|
+
DEFAULT_MAX_RESULTS = 100;
|
|
6856
6881
|
}
|
|
6857
6882
|
});
|
|
6858
6883
|
function shannonEntropyBits(s) {
|
|
@@ -9192,6 +9217,15 @@ var init_script_wrap = __esm({
|
|
|
9192
9217
|
"forever",
|
|
9193
9218
|
"nodemon",
|
|
9194
9219
|
"concurrently",
|
|
9220
|
+
// Monorepo / task runners — wrapping the orchestrator injects secrets into
|
|
9221
|
+
// every child task it spawns, so `npm run dev` still needs no `keynv exec`.
|
|
9222
|
+
"turbo",
|
|
9223
|
+
"nx",
|
|
9224
|
+
"lerna",
|
|
9225
|
+
"make",
|
|
9226
|
+
"npm-run-all",
|
|
9227
|
+
"run-p",
|
|
9228
|
+
"run-s",
|
|
9195
9229
|
"pytest",
|
|
9196
9230
|
"python",
|
|
9197
9231
|
"python3",
|
|
@@ -9297,31 +9331,65 @@ async function runInitFlow(client, opts) {
|
|
|
9297
9331
|
if (root.packageJsonInvalid) {
|
|
9298
9332
|
R2.warn(`package.json at ${root.path} is not valid JSON \u2014 script wrapping will be skipped.`);
|
|
9299
9333
|
}
|
|
9300
|
-
const
|
|
9334
|
+
const atHome = resolve(root.path) === resolve(homedir());
|
|
9335
|
+
if (atHome) {
|
|
9336
|
+
R2.warn(
|
|
9337
|
+
"Running in your home directory \u2014 scanning only this folder, not the whole tree. cd into a project directory for a focused setup."
|
|
9338
|
+
);
|
|
9339
|
+
}
|
|
9340
|
+
const envFiles = findEnvFilesRecursive(root.path, atHome ? { maxDepth: 1 } : void 0);
|
|
9301
9341
|
const intoExisting = hasExistingKeynvEnv(root.path);
|
|
9302
9342
|
if (envFiles.length === 0 && !intoExisting) {
|
|
9303
|
-
|
|
9304
|
-
|
|
9343
|
+
Se(
|
|
9344
|
+
[
|
|
9345
|
+
`No .env files found in ${root.path} (scanned root and subdirectories),`,
|
|
9346
|
+
"so there is nothing to migrate yet. To start from scratch:",
|
|
9347
|
+
"",
|
|
9348
|
+
" 1. keynv secret create \u2014 add your first secret to the vault",
|
|
9349
|
+
" 2. add its alias to .keynv.env, e.g. OPENAI_API_KEY=@myapp.dev.openai-key",
|
|
9350
|
+
" 3. run your app normally \u2014 keynv injects the real value",
|
|
9351
|
+
"",
|
|
9352
|
+
'Or re-run `keynv` \u2192 "Set up this project" once you have a .env to import.'
|
|
9353
|
+
].join("\n"),
|
|
9354
|
+
"Nothing to migrate yet"
|
|
9305
9355
|
);
|
|
9306
|
-
ye("
|
|
9356
|
+
ye("Create your first secret with `keynv secret create`.");
|
|
9307
9357
|
return { exitCode: 0 };
|
|
9308
9358
|
}
|
|
9359
|
+
if (envFiles.length >= DEFAULT_MAX_RESULTS) {
|
|
9360
|
+
R2.warn(
|
|
9361
|
+
`Found ${envFiles.length}+ env files \u2014 that usually means keynv is running too high up the tree. Consider cd-ing into a specific project.`
|
|
9362
|
+
);
|
|
9363
|
+
}
|
|
9309
9364
|
Se(
|
|
9310
9365
|
[
|
|
9311
9366
|
`Project root: ${root.path}`,
|
|
9312
9367
|
`Marker: ${root.marker}`,
|
|
9313
|
-
envFiles.length
|
|
9314
|
-
${envFiles.map((f) => ` ${displayName(f)}`).join("\n")}` : "Found env files: (none)",
|
|
9368
|
+
envFiles.length === 0 ? "Found env files: (none)" : envFiles.length === 1 ? `Found env file: ${displayName(envFiles[0])}` : `Found ${envFiles.length} env files`,
|
|
9315
9369
|
intoExisting ? "Existing root .keynv.env detected \u2014 will merge new entries in." : ""
|
|
9316
9370
|
].filter(Boolean).join("\n"),
|
|
9317
9371
|
"Detected"
|
|
9318
9372
|
);
|
|
9373
|
+
let selectedFiles = envFiles;
|
|
9374
|
+
if (envFiles.length > 1) {
|
|
9375
|
+
const initialValues = envFiles.filter((f) => f.relativeDir === "").map((f) => f.path);
|
|
9376
|
+
const picked = unwrap(
|
|
9377
|
+
await ve({
|
|
9378
|
+
message: "Which env files do you want to import?",
|
|
9379
|
+
options: envFiles.map((f) => ({ value: f.path, label: displayName(f) })),
|
|
9380
|
+
initialValues,
|
|
9381
|
+
required: true
|
|
9382
|
+
})
|
|
9383
|
+
);
|
|
9384
|
+
const pickedSet = new Set(picked);
|
|
9385
|
+
selectedFiles = envFiles.filter((f) => pickedSet.has(f.path));
|
|
9386
|
+
}
|
|
9319
9387
|
const projectChoice = await pickOrCreateProject(client, root.suggestedName);
|
|
9320
9388
|
if (projectChoice === null) {
|
|
9321
9389
|
me("No project selected.");
|
|
9322
9390
|
return { exitCode: 130 };
|
|
9323
9391
|
}
|
|
9324
|
-
const fileMapping = await pickFileEnvMapping(
|
|
9392
|
+
const fileMapping = await pickFileEnvMapping(selectedFiles, projectChoice);
|
|
9325
9393
|
if (fileMapping === null) {
|
|
9326
9394
|
me("No env mapping selected.");
|
|
9327
9395
|
return { exitCode: 130 };
|
|
@@ -9433,7 +9501,7 @@ ${detail}`
|
|
|
9433
9501
|
for (const g of groups.values()) {
|
|
9434
9502
|
const dirs = [...new Set(g.sources.map((s) => s.source.relativeDir || "<root>"))];
|
|
9435
9503
|
if (dirs.length > 1) g.label = `${g.label} (shared by ${dirs.join(", ")})`;
|
|
9436
|
-
else if (
|
|
9504
|
+
else if (selectedFiles.some((f) => f.relativeDir !== "")) {
|
|
9437
9505
|
const only = dirs[0];
|
|
9438
9506
|
if (only && only !== "<root>") g.label = `${g.label} [${only}]`;
|
|
9439
9507
|
}
|
|
@@ -9442,7 +9510,7 @@ ${detail}`
|
|
|
9442
9510
|
const initialSecretSelection = choices.filter((c2) => c2.verdict === "secret" && !c2.isAlias).map((c2) => c2.composite);
|
|
9443
9511
|
const selectedComposites = unwrap(
|
|
9444
9512
|
await ve({
|
|
9445
|
-
message: "
|
|
9513
|
+
message: "Which keys are secrets? (pre-selected by keynv \u2014 press Enter to accept; unchecked stay as literals)",
|
|
9446
9514
|
options: choices.map((c2) => ({
|
|
9447
9515
|
value: c2.composite,
|
|
9448
9516
|
label: c2.label,
|
|
@@ -9468,19 +9536,21 @@ ${detail}`
|
|
|
9468
9536
|
const writeDirs = [...new Set(plan.resolved.map((r) => r.source.containingDir))];
|
|
9469
9537
|
const writeDirsLines = writeDirs.map((d2) => ` ${relFromRoot(root.path, d2)}`).join("\n");
|
|
9470
9538
|
const renameLine = plan.renamed.length > 0 ? `Renamed vault keys: ${plan.renamed.length} (to avoid cross-app collisions)` : "";
|
|
9539
|
+
const scriptWrapLine = scriptWrapSelection.length > 0 ? `package.json: wrap ${scriptWrapSelection.length} script(s) with \`keynv exec\` \u2014 ${scriptWrapSelection.join(", ")}` : "package.json: not modified (no wrappable scripts)";
|
|
9471
9540
|
const planSummary = [
|
|
9472
9541
|
`Project: ${projectChoice.name}${projectChoice.created ? " (will be created)" : ""}`,
|
|
9473
9542
|
`Environments: ${distinctEnvs.join(", ")}`,
|
|
9474
9543
|
"Per-env breakdown:",
|
|
9475
9544
|
perEnvCounts,
|
|
9476
|
-
|
|
9477
|
-
".keynv.env files: will be written under",
|
|
9545
|
+
".keynv.env files: written under (safe to commit \u2014 aliases, not values)",
|
|
9478
9546
|
writeDirsLines,
|
|
9479
|
-
|
|
9547
|
+
scriptWrapLine,
|
|
9548
|
+
"AGENTS.md: write/update keynv guidance for AI agents at the project root",
|
|
9549
|
+
".env files: renamed to .env.backup after their values are uploaded",
|
|
9480
9550
|
renameLine,
|
|
9481
9551
|
opts.dryRun ? "Dry-run: no changes will be made." : ""
|
|
9482
9552
|
].filter(Boolean).join("\n");
|
|
9483
|
-
Se(planSummary, "About to apply");
|
|
9553
|
+
Se(planSummary, "About to apply \u2014 one confirmation applies all of the below");
|
|
9484
9554
|
const proceed = unwrap(await ue({ message: "Proceed?", initialValue: true }));
|
|
9485
9555
|
if (!proceed) {
|
|
9486
9556
|
me("Aborted.");
|
|
@@ -9608,7 +9678,7 @@ ${detail}`
|
|
|
9608
9678
|
);
|
|
9609
9679
|
}
|
|
9610
9680
|
}
|
|
9611
|
-
for (const f of
|
|
9681
|
+
for (const f of selectedFiles) {
|
|
9612
9682
|
const relSrc = relFromRoot(root.path, f.path);
|
|
9613
9683
|
try {
|
|
9614
9684
|
const { renamedTo } = backupEnvFile(f.path);
|
|
@@ -9634,9 +9704,15 @@ ${detail}`
|
|
|
9634
9704
|
});
|
|
9635
9705
|
Se(lines.join("\n"), "Secrets in other envs");
|
|
9636
9706
|
}
|
|
9637
|
-
|
|
9638
|
-
|
|
9639
|
-
|
|
9707
|
+
let doneMsg;
|
|
9708
|
+
if (failed.length > 0) {
|
|
9709
|
+
doneMsg = `Done with ${failed.length} failure(s) \u2014 see warnings above.`;
|
|
9710
|
+
} else if (scriptWrapSelection.length > 0) {
|
|
9711
|
+
doneMsg = "Done. Your scripts are wrapped \u2014 just run them as usual (e.g. `npm run dev`). Secrets are injected automatically; you never type `keynv exec`.";
|
|
9712
|
+
} else {
|
|
9713
|
+
doneMsg = "Done. Prefix commands with `keynv exec --` to inject secrets (e.g. `keynv exec -- npm run dev`).";
|
|
9714
|
+
}
|
|
9715
|
+
ye(doneMsg);
|
|
9640
9716
|
return { exitCode: failed.length > 0 ? 1 : 0 };
|
|
9641
9717
|
}
|
|
9642
9718
|
async function pickOrCreateProject(client, suggestedName) {
|
|
@@ -9845,7 +9921,7 @@ var init_tty = __esm({
|
|
|
9845
9921
|
}
|
|
9846
9922
|
});
|
|
9847
9923
|
function sleep(ms) {
|
|
9848
|
-
return new Promise((
|
|
9924
|
+
return new Promise((resolve6) => setTimeout(resolve6, ms));
|
|
9849
9925
|
}
|
|
9850
9926
|
async function errorMessage(res, fallback) {
|
|
9851
9927
|
const text = await res.text();
|
|
@@ -10109,16 +10185,16 @@ async function runSecretMenu(client, project, alias2) {
|
|
|
10109
10185
|
async function copyToClipboard(value) {
|
|
10110
10186
|
const platform4 = process.platform;
|
|
10111
10187
|
const cmd = platform4 === "darwin" ? ["pbcopy", []] : platform4 === "win32" ? ["clip", []] : ["xclip", ["-selection", "clipboard"]];
|
|
10112
|
-
return new Promise((
|
|
10188
|
+
return new Promise((resolve6) => {
|
|
10113
10189
|
try {
|
|
10114
10190
|
const child = spawn(cmd[0], cmd[1], {
|
|
10115
10191
|
stdio: ["pipe", "ignore", "ignore"]
|
|
10116
10192
|
});
|
|
10117
|
-
child.on("error", () =>
|
|
10118
|
-
child.on("exit", (code) =>
|
|
10193
|
+
child.on("error", () => resolve6(false));
|
|
10194
|
+
child.on("exit", (code) => resolve6(code === 0));
|
|
10119
10195
|
child.stdin.end(value);
|
|
10120
10196
|
} catch {
|
|
10121
|
-
|
|
10197
|
+
resolve6(false);
|
|
10122
10198
|
}
|
|
10123
10199
|
});
|
|
10124
10200
|
}
|
|
@@ -26864,7 +26940,7 @@ var require_named_placeholders = __commonJS({
|
|
|
26864
26940
|
}
|
|
26865
26941
|
return s;
|
|
26866
26942
|
}
|
|
26867
|
-
function
|
|
26943
|
+
function join18(tree) {
|
|
26868
26944
|
if (tree.length === 1) {
|
|
26869
26945
|
return tree;
|
|
26870
26946
|
}
|
|
@@ -26890,7 +26966,7 @@ var require_named_placeholders = __commonJS({
|
|
|
26890
26966
|
if (cache2 && (tree = cache2.get(query))) {
|
|
26891
26967
|
return toArrayParams(tree, paramsObj);
|
|
26892
26968
|
}
|
|
26893
|
-
tree =
|
|
26969
|
+
tree = join18(parse(query));
|
|
26894
26970
|
if (cache2) {
|
|
26895
26971
|
cache2.set(query, tree);
|
|
26896
26972
|
}
|
|
@@ -27046,11 +27122,11 @@ var require_connection = __commonJS({
|
|
|
27046
27122
|
const config = this.config;
|
|
27047
27123
|
tracePromise(
|
|
27048
27124
|
connectChannel,
|
|
27049
|
-
() => new Promise((
|
|
27125
|
+
() => new Promise((resolve6, reject) => {
|
|
27050
27126
|
let onConnect, onError;
|
|
27051
27127
|
onConnect = (param) => {
|
|
27052
27128
|
this.removeListener("error", onError);
|
|
27053
|
-
|
|
27129
|
+
resolve6(param);
|
|
27054
27130
|
};
|
|
27055
27131
|
onError = (err) => {
|
|
27056
27132
|
this.removeListener("connect", onConnect);
|
|
@@ -27475,9 +27551,9 @@ var require_connection = __commonJS({
|
|
|
27475
27551
|
} else if (shouldTrace(queryChannel)) {
|
|
27476
27552
|
tracePromise(
|
|
27477
27553
|
queryChannel,
|
|
27478
|
-
() => new Promise((
|
|
27554
|
+
() => new Promise((resolve6, reject) => {
|
|
27479
27555
|
cmdQuery.once("error", reject);
|
|
27480
|
-
cmdQuery.once("end", () =>
|
|
27556
|
+
cmdQuery.once("end", () => resolve6());
|
|
27481
27557
|
this.addCommand(cmdQuery);
|
|
27482
27558
|
}),
|
|
27483
27559
|
() => {
|
|
@@ -27624,12 +27700,12 @@ var require_connection = __commonJS({
|
|
|
27624
27700
|
} else if (shouldTrace(executeChannel)) {
|
|
27625
27701
|
tracePromise(
|
|
27626
27702
|
executeChannel,
|
|
27627
|
-
() => new Promise((
|
|
27703
|
+
() => new Promise((resolve6, reject) => {
|
|
27628
27704
|
prepareAndExecute((err) => {
|
|
27629
27705
|
executeCommand.emit("error", err);
|
|
27630
27706
|
});
|
|
27631
27707
|
executeCommand.once("error", reject);
|
|
27632
|
-
executeCommand.once("end", () =>
|
|
27708
|
+
executeCommand.once("end", () => resolve6());
|
|
27633
27709
|
}),
|
|
27634
27710
|
() => {
|
|
27635
27711
|
const server = getServerContext(this.config);
|
|
@@ -27894,13 +27970,13 @@ var require_capture_local_err = __commonJS({
|
|
|
27894
27970
|
var require_make_done_cb = __commonJS({
|
|
27895
27971
|
"../../node_modules/.pnpm/mysql2@3.22.3_@types+node@24.12.3/node_modules/mysql2/lib/promise/make_done_cb.js"(exports, module) {
|
|
27896
27972
|
var { applyCapturedStack } = require_capture_local_err();
|
|
27897
|
-
function makeDoneCb(
|
|
27973
|
+
function makeDoneCb(resolve6, reject, stackHolder) {
|
|
27898
27974
|
return function(err, rows, fields) {
|
|
27899
27975
|
if (err) {
|
|
27900
27976
|
applyCapturedStack(err, stackHolder);
|
|
27901
27977
|
reject(err);
|
|
27902
27978
|
} else {
|
|
27903
|
-
|
|
27979
|
+
resolve6([rows, fields]);
|
|
27904
27980
|
}
|
|
27905
27981
|
};
|
|
27906
27982
|
}
|
|
@@ -27923,8 +27999,8 @@ var require_prepared_statement_info = __commonJS({
|
|
|
27923
27999
|
const stackHolder = captureStackHolder(
|
|
27924
28000
|
_PromisePreparedStatementInfo.prototype.execute
|
|
27925
28001
|
);
|
|
27926
|
-
return new this.Promise((
|
|
27927
|
-
const done = makeDoneCb(
|
|
28002
|
+
return new this.Promise((resolve6, reject) => {
|
|
28003
|
+
const done = makeDoneCb(resolve6, reject, stackHolder);
|
|
27928
28004
|
if (parameters) {
|
|
27929
28005
|
s.execute(parameters, done);
|
|
27930
28006
|
} else {
|
|
@@ -27933,9 +28009,9 @@ var require_prepared_statement_info = __commonJS({
|
|
|
27933
28009
|
});
|
|
27934
28010
|
}
|
|
27935
28011
|
close() {
|
|
27936
|
-
return new this.Promise((
|
|
28012
|
+
return new this.Promise((resolve6) => {
|
|
27937
28013
|
this.statement.close();
|
|
27938
|
-
|
|
28014
|
+
resolve6();
|
|
27939
28015
|
});
|
|
27940
28016
|
}
|
|
27941
28017
|
};
|
|
@@ -28006,8 +28082,8 @@ var require_connection2 = __commonJS({
|
|
|
28006
28082
|
"Callback function is not available with promise clients."
|
|
28007
28083
|
);
|
|
28008
28084
|
}
|
|
28009
|
-
return new this.Promise((
|
|
28010
|
-
const done = makeDoneCb(
|
|
28085
|
+
return new this.Promise((resolve6, reject) => {
|
|
28086
|
+
const done = makeDoneCb(resolve6, reject, stackHolder);
|
|
28011
28087
|
if (params !== void 0) {
|
|
28012
28088
|
c2.query(query, params, done);
|
|
28013
28089
|
} else {
|
|
@@ -28023,8 +28099,8 @@ var require_connection2 = __commonJS({
|
|
|
28023
28099
|
"Callback function is not available with promise clients."
|
|
28024
28100
|
);
|
|
28025
28101
|
}
|
|
28026
|
-
return new this.Promise((
|
|
28027
|
-
const done = makeDoneCb(
|
|
28102
|
+
return new this.Promise((resolve6, reject) => {
|
|
28103
|
+
const done = makeDoneCb(resolve6, reject, stackHolder);
|
|
28028
28104
|
if (params !== void 0) {
|
|
28029
28105
|
c2.execute(query, params, done);
|
|
28030
28106
|
} else {
|
|
@@ -28033,8 +28109,8 @@ var require_connection2 = __commonJS({
|
|
|
28033
28109
|
});
|
|
28034
28110
|
}
|
|
28035
28111
|
end() {
|
|
28036
|
-
return new this.Promise((
|
|
28037
|
-
this.connection.end(
|
|
28112
|
+
return new this.Promise((resolve6) => {
|
|
28113
|
+
this.connection.end(resolve6);
|
|
28038
28114
|
});
|
|
28039
28115
|
}
|
|
28040
28116
|
async [Symbol.asyncDispose]() {
|
|
@@ -28047,16 +28123,16 @@ var require_connection2 = __commonJS({
|
|
|
28047
28123
|
const stackHolder = captureStackHolder(
|
|
28048
28124
|
_PromiseConnection.prototype.beginTransaction
|
|
28049
28125
|
);
|
|
28050
|
-
return new this.Promise((
|
|
28051
|
-
const done = makeDoneCb(
|
|
28126
|
+
return new this.Promise((resolve6, reject) => {
|
|
28127
|
+
const done = makeDoneCb(resolve6, reject, stackHolder);
|
|
28052
28128
|
c2.beginTransaction(done);
|
|
28053
28129
|
});
|
|
28054
28130
|
}
|
|
28055
28131
|
commit() {
|
|
28056
28132
|
const c2 = this.connection;
|
|
28057
28133
|
const stackHolder = captureStackHolder(_PromiseConnection.prototype.commit);
|
|
28058
|
-
return new this.Promise((
|
|
28059
|
-
const done = makeDoneCb(
|
|
28134
|
+
return new this.Promise((resolve6, reject) => {
|
|
28135
|
+
const done = makeDoneCb(resolve6, reject, stackHolder);
|
|
28060
28136
|
c2.commit(done);
|
|
28061
28137
|
});
|
|
28062
28138
|
}
|
|
@@ -28065,21 +28141,21 @@ var require_connection2 = __commonJS({
|
|
|
28065
28141
|
const stackHolder = captureStackHolder(
|
|
28066
28142
|
_PromiseConnection.prototype.rollback
|
|
28067
28143
|
);
|
|
28068
|
-
return new this.Promise((
|
|
28069
|
-
const done = makeDoneCb(
|
|
28144
|
+
return new this.Promise((resolve6, reject) => {
|
|
28145
|
+
const done = makeDoneCb(resolve6, reject, stackHolder);
|
|
28070
28146
|
c2.rollback(done);
|
|
28071
28147
|
});
|
|
28072
28148
|
}
|
|
28073
28149
|
ping() {
|
|
28074
28150
|
const c2 = this.connection;
|
|
28075
28151
|
const stackHolder = captureStackHolder(_PromiseConnection.prototype.ping);
|
|
28076
|
-
return new this.Promise((
|
|
28152
|
+
return new this.Promise((resolve6, reject) => {
|
|
28077
28153
|
c2.ping((err) => {
|
|
28078
28154
|
if (err) {
|
|
28079
28155
|
applyCapturedStack(err, stackHolder);
|
|
28080
28156
|
reject(err);
|
|
28081
28157
|
} else {
|
|
28082
|
-
|
|
28158
|
+
resolve6(true);
|
|
28083
28159
|
}
|
|
28084
28160
|
});
|
|
28085
28161
|
});
|
|
@@ -28087,13 +28163,13 @@ var require_connection2 = __commonJS({
|
|
|
28087
28163
|
reset() {
|
|
28088
28164
|
const c2 = this.connection;
|
|
28089
28165
|
const stackHolder = captureStackHolder(_PromiseConnection.prototype.reset);
|
|
28090
|
-
return new this.Promise((
|
|
28166
|
+
return new this.Promise((resolve6, reject) => {
|
|
28091
28167
|
c2.reset((err) => {
|
|
28092
28168
|
if (err) {
|
|
28093
28169
|
applyCapturedStack(err, stackHolder);
|
|
28094
28170
|
reject(err);
|
|
28095
28171
|
} else {
|
|
28096
|
-
|
|
28172
|
+
resolve6();
|
|
28097
28173
|
}
|
|
28098
28174
|
});
|
|
28099
28175
|
});
|
|
@@ -28101,13 +28177,13 @@ var require_connection2 = __commonJS({
|
|
|
28101
28177
|
connect() {
|
|
28102
28178
|
const c2 = this.connection;
|
|
28103
28179
|
const stackHolder = captureStackHolder(_PromiseConnection.prototype.connect);
|
|
28104
|
-
return new this.Promise((
|
|
28180
|
+
return new this.Promise((resolve6, reject) => {
|
|
28105
28181
|
c2.connect((err, param) => {
|
|
28106
28182
|
if (err) {
|
|
28107
28183
|
applyCapturedStack(err, stackHolder);
|
|
28108
28184
|
reject(err);
|
|
28109
28185
|
} else {
|
|
28110
|
-
|
|
28186
|
+
resolve6(param);
|
|
28111
28187
|
}
|
|
28112
28188
|
});
|
|
28113
28189
|
});
|
|
@@ -28116,7 +28192,7 @@ var require_connection2 = __commonJS({
|
|
|
28116
28192
|
const c2 = this.connection;
|
|
28117
28193
|
const promiseImpl = this.Promise;
|
|
28118
28194
|
const stackHolder = captureStackHolder(_PromiseConnection.prototype.prepare);
|
|
28119
|
-
return new this.Promise((
|
|
28195
|
+
return new this.Promise((resolve6, reject) => {
|
|
28120
28196
|
c2.prepare(options, (err, statement) => {
|
|
28121
28197
|
if (err) {
|
|
28122
28198
|
applyCapturedStack(err, stackHolder);
|
|
@@ -28126,7 +28202,7 @@ var require_connection2 = __commonJS({
|
|
|
28126
28202
|
statement,
|
|
28127
28203
|
promiseImpl
|
|
28128
28204
|
);
|
|
28129
|
-
|
|
28205
|
+
resolve6(wrappedStatement);
|
|
28130
28206
|
}
|
|
28131
28207
|
});
|
|
28132
28208
|
});
|
|
@@ -28136,13 +28212,13 @@ var require_connection2 = __commonJS({
|
|
|
28136
28212
|
const stackHolder = captureStackHolder(
|
|
28137
28213
|
_PromiseConnection.prototype.changeUser
|
|
28138
28214
|
);
|
|
28139
|
-
return new this.Promise((
|
|
28215
|
+
return new this.Promise((resolve6, reject) => {
|
|
28140
28216
|
c2.changeUser(options, (err) => {
|
|
28141
28217
|
if (err) {
|
|
28142
28218
|
applyCapturedStack(err, stackHolder);
|
|
28143
28219
|
reject(err);
|
|
28144
28220
|
} else {
|
|
28145
|
-
|
|
28221
|
+
resolve6();
|
|
28146
28222
|
}
|
|
28147
28223
|
});
|
|
28148
28224
|
});
|
|
@@ -28604,12 +28680,12 @@ var require_pool2 = __commonJS({
|
|
|
28604
28680
|
}
|
|
28605
28681
|
getConnection() {
|
|
28606
28682
|
const corePool = this.pool;
|
|
28607
|
-
return new this.Promise((
|
|
28683
|
+
return new this.Promise((resolve6, reject) => {
|
|
28608
28684
|
corePool.getConnection((err, coreConnection) => {
|
|
28609
28685
|
if (err) {
|
|
28610
28686
|
reject(err);
|
|
28611
28687
|
} else {
|
|
28612
|
-
|
|
28688
|
+
resolve6(new PromisePoolConnection(coreConnection, this.Promise));
|
|
28613
28689
|
}
|
|
28614
28690
|
});
|
|
28615
28691
|
});
|
|
@@ -28625,8 +28701,8 @@ var require_pool2 = __commonJS({
|
|
|
28625
28701
|
"Callback function is not available with promise clients."
|
|
28626
28702
|
);
|
|
28627
28703
|
}
|
|
28628
|
-
return new this.Promise((
|
|
28629
|
-
const done = makeDoneCb(
|
|
28704
|
+
return new this.Promise((resolve6, reject) => {
|
|
28705
|
+
const done = makeDoneCb(resolve6, reject, stackHolder);
|
|
28630
28706
|
if (args !== void 0) {
|
|
28631
28707
|
corePool.query(sql, args, done);
|
|
28632
28708
|
} else {
|
|
@@ -28642,8 +28718,8 @@ var require_pool2 = __commonJS({
|
|
|
28642
28718
|
"Callback function is not available with promise clients."
|
|
28643
28719
|
);
|
|
28644
28720
|
}
|
|
28645
|
-
return new this.Promise((
|
|
28646
|
-
const done = makeDoneCb(
|
|
28721
|
+
return new this.Promise((resolve6, reject) => {
|
|
28722
|
+
const done = makeDoneCb(resolve6, reject, stackHolder);
|
|
28647
28723
|
if (args) {
|
|
28648
28724
|
corePool.execute(sql, args, done);
|
|
28649
28725
|
} else {
|
|
@@ -28654,13 +28730,13 @@ var require_pool2 = __commonJS({
|
|
|
28654
28730
|
end() {
|
|
28655
28731
|
const corePool = this.pool;
|
|
28656
28732
|
const stackHolder = captureStackHolder(_PromisePool.prototype.end);
|
|
28657
|
-
return new this.Promise((
|
|
28733
|
+
return new this.Promise((resolve6, reject) => {
|
|
28658
28734
|
corePool.end((err) => {
|
|
28659
28735
|
if (err) {
|
|
28660
28736
|
applyCapturedStack(err, stackHolder);
|
|
28661
28737
|
reject(err);
|
|
28662
28738
|
} else {
|
|
28663
|
-
|
|
28739
|
+
resolve6();
|
|
28664
28740
|
}
|
|
28665
28741
|
});
|
|
28666
28742
|
});
|
|
@@ -29085,12 +29161,12 @@ var require_pool_cluster2 = __commonJS({
|
|
|
29085
29161
|
}
|
|
29086
29162
|
getConnection() {
|
|
29087
29163
|
const corePoolNamespace = this.poolNamespace;
|
|
29088
|
-
return new this.Promise((
|
|
29164
|
+
return new this.Promise((resolve6, reject) => {
|
|
29089
29165
|
corePoolNamespace.getConnection((err, coreConnection) => {
|
|
29090
29166
|
if (err) {
|
|
29091
29167
|
reject(err);
|
|
29092
29168
|
} else {
|
|
29093
|
-
|
|
29169
|
+
resolve6(new PromisePoolConnection(coreConnection, this.Promise));
|
|
29094
29170
|
}
|
|
29095
29171
|
});
|
|
29096
29172
|
});
|
|
@@ -29105,8 +29181,8 @@ var require_pool_cluster2 = __commonJS({
|
|
|
29105
29181
|
"Callback function is not available with promise clients."
|
|
29106
29182
|
);
|
|
29107
29183
|
}
|
|
29108
|
-
return new this.Promise((
|
|
29109
|
-
const done = makeDoneCb(
|
|
29184
|
+
return new this.Promise((resolve6, reject) => {
|
|
29185
|
+
const done = makeDoneCb(resolve6, reject, stackHolder);
|
|
29110
29186
|
corePoolNamespace.query(sql, values, done);
|
|
29111
29187
|
});
|
|
29112
29188
|
}
|
|
@@ -29120,8 +29196,8 @@ var require_pool_cluster2 = __commonJS({
|
|
|
29120
29196
|
"Callback function is not available with promise clients."
|
|
29121
29197
|
);
|
|
29122
29198
|
}
|
|
29123
|
-
return new this.Promise((
|
|
29124
|
-
const done = makeDoneCb(
|
|
29199
|
+
return new this.Promise((resolve6, reject) => {
|
|
29200
|
+
const done = makeDoneCb(resolve6, reject, stackHolder);
|
|
29125
29201
|
corePoolNamespace.execute(sql, values, done);
|
|
29126
29202
|
});
|
|
29127
29203
|
}
|
|
@@ -29159,9 +29235,9 @@ var require_promise = __commonJS({
|
|
|
29159
29235
|
"no Promise implementation available.Use promise-enabled node version or pass userland Promise implementation as parameter, for example: { Promise: require('bluebird') }"
|
|
29160
29236
|
);
|
|
29161
29237
|
}
|
|
29162
|
-
return new thePromise((
|
|
29238
|
+
return new thePromise((resolve6, reject) => {
|
|
29163
29239
|
coreConnection.once("connect", () => {
|
|
29164
|
-
|
|
29240
|
+
resolve6(new PromiseConnection(coreConnection, thePromise));
|
|
29165
29241
|
});
|
|
29166
29242
|
coreConnection.once("error", (err) => {
|
|
29167
29243
|
applyCapturedStack(err, stackHolder);
|
|
@@ -29188,7 +29264,7 @@ var require_promise = __commonJS({
|
|
|
29188
29264
|
}
|
|
29189
29265
|
getConnection(pattern, selector) {
|
|
29190
29266
|
const corePoolCluster = this.poolCluster;
|
|
29191
|
-
return new this.Promise((
|
|
29267
|
+
return new this.Promise((resolve6, reject) => {
|
|
29192
29268
|
corePoolCluster.getConnection(
|
|
29193
29269
|
pattern,
|
|
29194
29270
|
selector,
|
|
@@ -29196,7 +29272,7 @@ var require_promise = __commonJS({
|
|
|
29196
29272
|
if (err) {
|
|
29197
29273
|
reject(err);
|
|
29198
29274
|
} else {
|
|
29199
|
-
|
|
29275
|
+
resolve6(new PromisePoolConnection(coreConnection, this.Promise));
|
|
29200
29276
|
}
|
|
29201
29277
|
}
|
|
29202
29278
|
);
|
|
@@ -29210,8 +29286,8 @@ var require_promise = __commonJS({
|
|
|
29210
29286
|
"Callback function is not available with promise clients."
|
|
29211
29287
|
);
|
|
29212
29288
|
}
|
|
29213
|
-
return new this.Promise((
|
|
29214
|
-
const done = makeDoneCb(
|
|
29289
|
+
return new this.Promise((resolve6, reject) => {
|
|
29290
|
+
const done = makeDoneCb(resolve6, reject, stackHolder);
|
|
29215
29291
|
corePoolCluster.query(sql, args, done);
|
|
29216
29292
|
});
|
|
29217
29293
|
}
|
|
@@ -29225,8 +29301,8 @@ var require_promise = __commonJS({
|
|
|
29225
29301
|
"Callback function is not available with promise clients."
|
|
29226
29302
|
);
|
|
29227
29303
|
}
|
|
29228
|
-
return new this.Promise((
|
|
29229
|
-
const done = makeDoneCb(
|
|
29304
|
+
return new this.Promise((resolve6, reject) => {
|
|
29305
|
+
const done = makeDoneCb(resolve6, reject, stackHolder);
|
|
29230
29306
|
corePoolCluster.execute(sql, args, done);
|
|
29231
29307
|
});
|
|
29232
29308
|
}
|
|
@@ -29239,13 +29315,13 @@ var require_promise = __commonJS({
|
|
|
29239
29315
|
end() {
|
|
29240
29316
|
const corePoolCluster = this.poolCluster;
|
|
29241
29317
|
const stackHolder = captureStackHolder(_PromisePoolCluster.prototype.end);
|
|
29242
|
-
return new this.Promise((
|
|
29318
|
+
return new this.Promise((resolve6, reject) => {
|
|
29243
29319
|
corePoolCluster.end((err) => {
|
|
29244
29320
|
if (err) {
|
|
29245
29321
|
applyCapturedStack(err, stackHolder);
|
|
29246
29322
|
reject(err);
|
|
29247
29323
|
} else {
|
|
29248
|
-
|
|
29324
|
+
resolve6();
|
|
29249
29325
|
}
|
|
29250
29326
|
});
|
|
29251
29327
|
});
|
|
@@ -30503,7 +30579,7 @@ var require_utils_webcrypto = __commonJS({
|
|
|
30503
30579
|
var nodeCrypto = __require("crypto");
|
|
30504
30580
|
module.exports = {
|
|
30505
30581
|
postgresMd5PasswordHash,
|
|
30506
|
-
randomBytes
|
|
30582
|
+
randomBytes,
|
|
30507
30583
|
deriveKey,
|
|
30508
30584
|
sha256,
|
|
30509
30585
|
hashByName,
|
|
@@ -30513,7 +30589,7 @@ var require_utils_webcrypto = __commonJS({
|
|
|
30513
30589
|
var webCrypto = nodeCrypto.webcrypto || globalThis.crypto;
|
|
30514
30590
|
var subtleCrypto = webCrypto.subtle;
|
|
30515
30591
|
var textEncoder = new TextEncoder();
|
|
30516
|
-
function
|
|
30592
|
+
function randomBytes(length) {
|
|
30517
30593
|
return webCrypto.getRandomValues(Buffer.alloc(length));
|
|
30518
30594
|
}
|
|
30519
30595
|
async function md5(string) {
|
|
@@ -32320,7 +32396,7 @@ var require_dist = __commonJS({
|
|
|
32320
32396
|
function parse(stream, callback) {
|
|
32321
32397
|
const parser = new parser_1.Parser();
|
|
32322
32398
|
stream.on("data", (buffer) => parser.parse(buffer, callback));
|
|
32323
|
-
return new Promise((
|
|
32399
|
+
return new Promise((resolve6) => stream.on("end", () => resolve6()));
|
|
32324
32400
|
}
|
|
32325
32401
|
exports.parse = parse;
|
|
32326
32402
|
}
|
|
@@ -33045,12 +33121,12 @@ var require_client2 = __commonJS({
|
|
|
33045
33121
|
this._connect(callback);
|
|
33046
33122
|
return;
|
|
33047
33123
|
}
|
|
33048
|
-
return new this._Promise((
|
|
33124
|
+
return new this._Promise((resolve6, reject) => {
|
|
33049
33125
|
this._connect((error) => {
|
|
33050
33126
|
if (error) {
|
|
33051
33127
|
reject(error);
|
|
33052
33128
|
} else {
|
|
33053
|
-
|
|
33129
|
+
resolve6(this);
|
|
33054
33130
|
}
|
|
33055
33131
|
});
|
|
33056
33132
|
});
|
|
@@ -33396,8 +33472,8 @@ var require_client2 = __commonJS({
|
|
|
33396
33472
|
readTimeout = config.query_timeout || this.connectionParameters.query_timeout;
|
|
33397
33473
|
query = new Query2(config, values, callback);
|
|
33398
33474
|
if (!query.callback) {
|
|
33399
|
-
result = new this._Promise((
|
|
33400
|
-
query.callback = (err, res) => err ? reject(err) :
|
|
33475
|
+
result = new this._Promise((resolve6, reject) => {
|
|
33476
|
+
query.callback = (err, res) => err ? reject(err) : resolve6(res);
|
|
33401
33477
|
}).catch((err) => {
|
|
33402
33478
|
Error.captureStackTrace(err);
|
|
33403
33479
|
throw err;
|
|
@@ -33474,8 +33550,8 @@ var require_client2 = __commonJS({
|
|
|
33474
33550
|
if (cb) {
|
|
33475
33551
|
this.connection.once("end", cb);
|
|
33476
33552
|
} else {
|
|
33477
|
-
return new this._Promise((
|
|
33478
|
-
this.connection.once("end",
|
|
33553
|
+
return new this._Promise((resolve6) => {
|
|
33554
|
+
this.connection.once("end", resolve6);
|
|
33479
33555
|
});
|
|
33480
33556
|
}
|
|
33481
33557
|
}
|
|
@@ -33523,8 +33599,8 @@ var require_pg_pool = __commonJS({
|
|
|
33523
33599
|
const cb = function(err, client) {
|
|
33524
33600
|
err ? rej(err) : res(client);
|
|
33525
33601
|
};
|
|
33526
|
-
const result = new Promise2(function(
|
|
33527
|
-
res =
|
|
33602
|
+
const result = new Promise2(function(resolve6, reject) {
|
|
33603
|
+
res = resolve6;
|
|
33528
33604
|
rej = reject;
|
|
33529
33605
|
}).catch((err) => {
|
|
33530
33606
|
Error.captureStackTrace(err);
|
|
@@ -33585,7 +33661,7 @@ var require_pg_pool = __commonJS({
|
|
|
33585
33661
|
if (typeof Promise2.try === "function") {
|
|
33586
33662
|
return Promise2.try(f);
|
|
33587
33663
|
}
|
|
33588
|
-
return new Promise2((
|
|
33664
|
+
return new Promise2((resolve6) => resolve6(f()));
|
|
33589
33665
|
}
|
|
33590
33666
|
_isFull() {
|
|
33591
33667
|
return this._clients.length >= this.options.max;
|
|
@@ -33977,8 +34053,8 @@ var require_query4 = __commonJS({
|
|
|
33977
34053
|
NativeQuery.prototype._getPromise = function() {
|
|
33978
34054
|
if (this._promise) return this._promise;
|
|
33979
34055
|
this._promise = new Promise(
|
|
33980
|
-
function(
|
|
33981
|
-
this._once("end",
|
|
34056
|
+
function(resolve6, reject) {
|
|
34057
|
+
this._once("end", resolve6);
|
|
33982
34058
|
this._once("error", reject);
|
|
33983
34059
|
}.bind(this)
|
|
33984
34060
|
);
|
|
@@ -34155,12 +34231,12 @@ var require_client3 = __commonJS({
|
|
|
34155
34231
|
this._connect(callback);
|
|
34156
34232
|
return;
|
|
34157
34233
|
}
|
|
34158
|
-
return new this._Promise((
|
|
34234
|
+
return new this._Promise((resolve6, reject) => {
|
|
34159
34235
|
this._connect((error) => {
|
|
34160
34236
|
if (error) {
|
|
34161
34237
|
reject(error);
|
|
34162
34238
|
} else {
|
|
34163
|
-
|
|
34239
|
+
resolve6(this);
|
|
34164
34240
|
}
|
|
34165
34241
|
});
|
|
34166
34242
|
});
|
|
@@ -34184,8 +34260,8 @@ var require_client3 = __commonJS({
|
|
|
34184
34260
|
query = new NativeQuery(config, values, callback);
|
|
34185
34261
|
if (!query.callback) {
|
|
34186
34262
|
let resolveOut, rejectOut;
|
|
34187
|
-
result = new this._Promise((
|
|
34188
|
-
resolveOut =
|
|
34263
|
+
result = new this._Promise((resolve6, reject) => {
|
|
34264
|
+
resolveOut = resolve6;
|
|
34189
34265
|
rejectOut = reject;
|
|
34190
34266
|
}).catch((err) => {
|
|
34191
34267
|
Error.captureStackTrace(err);
|
|
@@ -34245,8 +34321,8 @@ var require_client3 = __commonJS({
|
|
|
34245
34321
|
}
|
|
34246
34322
|
let result;
|
|
34247
34323
|
if (!cb) {
|
|
34248
|
-
result = new this._Promise(function(
|
|
34249
|
-
cb = (err) => err ? reject(err) :
|
|
34324
|
+
result = new this._Promise(function(resolve6, reject) {
|
|
34325
|
+
cb = (err) => err ? reject(err) : resolve6();
|
|
34250
34326
|
});
|
|
34251
34327
|
}
|
|
34252
34328
|
this.native.end(function() {
|
|
@@ -39353,7 +39429,7 @@ var require_Command = __commonJS({
|
|
|
39353
39429
|
}
|
|
39354
39430
|
}
|
|
39355
39431
|
initPromise() {
|
|
39356
|
-
const promise = new Promise((
|
|
39432
|
+
const promise = new Promise((resolve6, reject) => {
|
|
39357
39433
|
if (!this.transformed) {
|
|
39358
39434
|
this.transformed = true;
|
|
39359
39435
|
const transformer = _Command._transformer.argument[this.name];
|
|
@@ -39362,7 +39438,7 @@ var require_Command = __commonJS({
|
|
|
39362
39438
|
}
|
|
39363
39439
|
this.stringifyArguments();
|
|
39364
39440
|
}
|
|
39365
|
-
this.resolve = this._convertValue(
|
|
39441
|
+
this.resolve = this._convertValue(resolve6);
|
|
39366
39442
|
this.reject = (err) => {
|
|
39367
39443
|
this._clearTimers();
|
|
39368
39444
|
if (this.errorStack) {
|
|
@@ -39395,11 +39471,11 @@ var require_Command = __commonJS({
|
|
|
39395
39471
|
/**
|
|
39396
39472
|
* Convert the value from buffer to the target encoding.
|
|
39397
39473
|
*/
|
|
39398
|
-
_convertValue(
|
|
39474
|
+
_convertValue(resolve6) {
|
|
39399
39475
|
return (value) => {
|
|
39400
39476
|
try {
|
|
39401
39477
|
this._clearTimers();
|
|
39402
|
-
|
|
39478
|
+
resolve6(this.transformReply(value));
|
|
39403
39479
|
this.isResolved = true;
|
|
39404
39480
|
} catch (err) {
|
|
39405
39481
|
this.reject(err);
|
|
@@ -39677,13 +39753,13 @@ var require_autoPipelining = __commonJS({
|
|
|
39677
39753
|
if (client.isCluster && !client.slots.length) {
|
|
39678
39754
|
if (client.status === "wait")
|
|
39679
39755
|
client.connect().catch(lodash_1.noop);
|
|
39680
|
-
return (0, standard_as_callback_1.default)(new Promise(function(
|
|
39756
|
+
return (0, standard_as_callback_1.default)(new Promise(function(resolve6, reject) {
|
|
39681
39757
|
client.delayUntilReady((err) => {
|
|
39682
39758
|
if (err) {
|
|
39683
39759
|
reject(err);
|
|
39684
39760
|
return;
|
|
39685
39761
|
}
|
|
39686
|
-
executeWithAutoPipelining(client, functionName, commandName, args, null).then(
|
|
39762
|
+
executeWithAutoPipelining(client, functionName, commandName, args, null).then(resolve6, reject);
|
|
39687
39763
|
});
|
|
39688
39764
|
}), callback);
|
|
39689
39765
|
}
|
|
@@ -39704,13 +39780,13 @@ var require_autoPipelining = __commonJS({
|
|
|
39704
39780
|
pipeline[exports.kExec] = true;
|
|
39705
39781
|
setImmediate(executeAutoPipeline, client, slotKey);
|
|
39706
39782
|
}
|
|
39707
|
-
const autoPipelinePromise = new Promise(function(
|
|
39783
|
+
const autoPipelinePromise = new Promise(function(resolve6, reject) {
|
|
39708
39784
|
pipeline[exports.kCallbacks].push(function(err, value) {
|
|
39709
39785
|
if (err) {
|
|
39710
39786
|
reject(err);
|
|
39711
39787
|
return;
|
|
39712
39788
|
}
|
|
39713
|
-
|
|
39789
|
+
resolve6(value);
|
|
39714
39790
|
});
|
|
39715
39791
|
if (functionName === "call") {
|
|
39716
39792
|
args.unshift(commandName);
|
|
@@ -39945,8 +40021,8 @@ var require_Pipeline = __commonJS({
|
|
|
39945
40021
|
this[name] = redis[name];
|
|
39946
40022
|
this[name + "Buffer"] = redis[name + "Buffer"];
|
|
39947
40023
|
});
|
|
39948
|
-
this.promise = new Promise((
|
|
39949
|
-
this.resolve =
|
|
40024
|
+
this.promise = new Promise((resolve6, reject) => {
|
|
40025
|
+
this.resolve = resolve6;
|
|
39950
40026
|
this.reject = reject;
|
|
39951
40027
|
});
|
|
39952
40028
|
const _this = this;
|
|
@@ -40246,13 +40322,13 @@ var require_transaction = __commonJS({
|
|
|
40246
40322
|
if (this.isCluster && !this.redis.slots.length) {
|
|
40247
40323
|
if (this.redis.status === "wait")
|
|
40248
40324
|
this.redis.connect().catch(utils_1.noop);
|
|
40249
|
-
return (0, standard_as_callback_1.default)(new Promise((
|
|
40325
|
+
return (0, standard_as_callback_1.default)(new Promise((resolve6, reject) => {
|
|
40250
40326
|
this.redis.delayUntilReady((err) => {
|
|
40251
40327
|
if (err) {
|
|
40252
40328
|
reject(err);
|
|
40253
40329
|
return;
|
|
40254
40330
|
}
|
|
40255
|
-
this.exec(pipeline).then(
|
|
40331
|
+
this.exec(pipeline).then(resolve6, reject);
|
|
40256
40332
|
});
|
|
40257
40333
|
}), callback);
|
|
40258
40334
|
}
|
|
@@ -41381,7 +41457,7 @@ var require_cluster = __commonJS({
|
|
|
41381
41457
|
* Connect to a cluster
|
|
41382
41458
|
*/
|
|
41383
41459
|
connect() {
|
|
41384
|
-
return new Promise((
|
|
41460
|
+
return new Promise((resolve6, reject) => {
|
|
41385
41461
|
if (this.status === "connecting" || this.status === "connect" || this.status === "ready") {
|
|
41386
41462
|
reject(new Error("Redis is already connecting/connected"));
|
|
41387
41463
|
return;
|
|
@@ -41410,7 +41486,7 @@ var require_cluster = __commonJS({
|
|
|
41410
41486
|
this.retryAttempts = 0;
|
|
41411
41487
|
this.executeOfflineCommands();
|
|
41412
41488
|
this.resetNodesRefreshInterval();
|
|
41413
|
-
|
|
41489
|
+
resolve6();
|
|
41414
41490
|
};
|
|
41415
41491
|
let closeListener = void 0;
|
|
41416
41492
|
const refreshListener = () => {
|
|
@@ -42020,7 +42096,7 @@ var require_cluster = __commonJS({
|
|
|
42020
42096
|
});
|
|
42021
42097
|
}
|
|
42022
42098
|
resolveSrv(hostname2) {
|
|
42023
|
-
return new Promise((
|
|
42099
|
+
return new Promise((resolve6, reject) => {
|
|
42024
42100
|
this.options.resolveSrv(hostname2, (err, records) => {
|
|
42025
42101
|
if (err) {
|
|
42026
42102
|
return reject(err);
|
|
@@ -42034,7 +42110,7 @@ var require_cluster = __commonJS({
|
|
|
42034
42110
|
if (!group.records.length) {
|
|
42035
42111
|
sortedKeys.shift();
|
|
42036
42112
|
}
|
|
42037
|
-
self2.dnsLookup(record.name).then((host) =>
|
|
42113
|
+
self2.dnsLookup(record.name).then((host) => resolve6({
|
|
42038
42114
|
host,
|
|
42039
42115
|
port: record.port
|
|
42040
42116
|
}), tryFirstOne);
|
|
@@ -42044,14 +42120,14 @@ var require_cluster = __commonJS({
|
|
|
42044
42120
|
});
|
|
42045
42121
|
}
|
|
42046
42122
|
dnsLookup(hostname2) {
|
|
42047
|
-
return new Promise((
|
|
42123
|
+
return new Promise((resolve6, reject) => {
|
|
42048
42124
|
this.options.dnsLookup(hostname2, (err, address) => {
|
|
42049
42125
|
if (err) {
|
|
42050
42126
|
debug2("failed to resolve hostname %s to IP: %s", hostname2, err.message);
|
|
42051
42127
|
reject(err);
|
|
42052
42128
|
} else {
|
|
42053
42129
|
debug2("resolved hostname %s to IP %s", hostname2, address);
|
|
42054
|
-
|
|
42130
|
+
resolve6(address);
|
|
42055
42131
|
}
|
|
42056
42132
|
});
|
|
42057
42133
|
});
|
|
@@ -42206,7 +42282,7 @@ var require_StandaloneConnector = __commonJS({
|
|
|
42206
42282
|
if (options.tls) {
|
|
42207
42283
|
Object.assign(connectionOptions, options.tls);
|
|
42208
42284
|
}
|
|
42209
|
-
return new Promise((
|
|
42285
|
+
return new Promise((resolve6, reject) => {
|
|
42210
42286
|
process.nextTick(() => {
|
|
42211
42287
|
if (!this.connecting) {
|
|
42212
42288
|
reject(new Error(utils_1.CONNECTION_CLOSED_ERROR_MSG));
|
|
@@ -42225,7 +42301,7 @@ var require_StandaloneConnector = __commonJS({
|
|
|
42225
42301
|
this.stream.once("error", (err) => {
|
|
42226
42302
|
this.firstError = err;
|
|
42227
42303
|
});
|
|
42228
|
-
|
|
42304
|
+
resolve6(this.stream);
|
|
42229
42305
|
});
|
|
42230
42306
|
});
|
|
42231
42307
|
}
|
|
@@ -42381,7 +42457,7 @@ var require_SentinelConnector = __commonJS({
|
|
|
42381
42457
|
const error = new Error(errorMsg);
|
|
42382
42458
|
if (typeof retryDelay === "number") {
|
|
42383
42459
|
eventEmitter("error", error);
|
|
42384
|
-
await new Promise((
|
|
42460
|
+
await new Promise((resolve6) => setTimeout(resolve6, retryDelay));
|
|
42385
42461
|
return connectToNext();
|
|
42386
42462
|
} else {
|
|
42387
42463
|
throw error;
|
|
@@ -43698,7 +43774,7 @@ var require_Redis = __commonJS({
|
|
|
43698
43774
|
* if the connection fails, times out, or if Redis is already connecting/connected.
|
|
43699
43775
|
*/
|
|
43700
43776
|
connect(callback) {
|
|
43701
|
-
const promise = new Promise((
|
|
43777
|
+
const promise = new Promise((resolve6, reject) => {
|
|
43702
43778
|
if (this.status === "connecting" || this.status === "connect" || this.status === "ready") {
|
|
43703
43779
|
reject(new Error("Redis is already connecting/connected"));
|
|
43704
43780
|
return;
|
|
@@ -43777,7 +43853,7 @@ var require_Redis = __commonJS({
|
|
|
43777
43853
|
}
|
|
43778
43854
|
const connectionReadyHandler = function() {
|
|
43779
43855
|
_this.removeListener("close", connectionCloseHandler);
|
|
43780
|
-
|
|
43856
|
+
resolve6();
|
|
43781
43857
|
};
|
|
43782
43858
|
var connectionCloseHandler = function() {
|
|
43783
43859
|
_this.removeListener("ready", connectionReadyHandler);
|
|
@@ -43871,10 +43947,10 @@ var require_Redis = __commonJS({
|
|
|
43871
43947
|
monitor: true,
|
|
43872
43948
|
lazyConnect: false
|
|
43873
43949
|
});
|
|
43874
|
-
return (0, standard_as_callback_1.default)(new Promise(function(
|
|
43950
|
+
return (0, standard_as_callback_1.default)(new Promise(function(resolve6, reject) {
|
|
43875
43951
|
monitorInstance.once("error", reject);
|
|
43876
43952
|
monitorInstance.once("monitoring", function() {
|
|
43877
|
-
|
|
43953
|
+
resolve6(monitorInstance);
|
|
43878
43954
|
});
|
|
43879
43955
|
}), callback);
|
|
43880
43956
|
}
|
|
@@ -44730,17 +44806,20 @@ async function pickConnectionTarget() {
|
|
|
44730
44806
|
const target = await Ee({
|
|
44731
44807
|
message: "Connect to keynv",
|
|
44732
44808
|
options: [
|
|
44733
|
-
{ value: "cloud", label: "keynv.dev", hint: "hosted
|
|
44809
|
+
{ value: "cloud", label: "keynv.dev", hint: "hosted \u2014 fastest way to start" },
|
|
44734
44810
|
{
|
|
44735
44811
|
value: "self-hosted",
|
|
44736
44812
|
label: "Self-hosted server",
|
|
44737
|
-
hint: "
|
|
44813
|
+
hint: "your own deployment \u2014 enter its API URL"
|
|
44738
44814
|
},
|
|
44739
44815
|
{ value: "exit", label: "Exit" }
|
|
44740
44816
|
]
|
|
44741
44817
|
});
|
|
44742
44818
|
if (q(target) || target === "exit") return null;
|
|
44743
|
-
if (target === "cloud")
|
|
44819
|
+
if (target === "cloud") {
|
|
44820
|
+
R2.info(`New to keynv? Create a free account first: ${DEFAULT_WEB_URL}/register`);
|
|
44821
|
+
return DEFAULT_SERVER_URL;
|
|
44822
|
+
}
|
|
44744
44823
|
const server = await Re({
|
|
44745
44824
|
message: "Server API URL",
|
|
44746
44825
|
placeholder: "https://api.keynv.example.com",
|
|
@@ -47845,7 +47924,7 @@ function resolverSocketPath() {
|
|
|
47845
47924
|
}
|
|
47846
47925
|
function resolveReferenceToken(token, timeoutMs = 5e3) {
|
|
47847
47926
|
const path = resolverSocketPath();
|
|
47848
|
-
return new Promise((
|
|
47927
|
+
return new Promise((resolve6) => {
|
|
47849
47928
|
const socket = createConnection(path);
|
|
47850
47929
|
let buffer = "";
|
|
47851
47930
|
let settled = false;
|
|
@@ -47853,7 +47932,7 @@ function resolveReferenceToken(token, timeoutMs = 5e3) {
|
|
|
47853
47932
|
if (settled) return;
|
|
47854
47933
|
settled = true;
|
|
47855
47934
|
socket.destroy();
|
|
47856
|
-
|
|
47935
|
+
resolve6(result);
|
|
47857
47936
|
};
|
|
47858
47937
|
const timer = setTimeout(
|
|
47859
47938
|
() => settle({ ok: false, error: "timed out waiting for keynv-mcp resolver" }),
|
|
@@ -48056,7 +48135,7 @@ function spawnPrivileged(opts) {
|
|
|
48056
48135
|
}, opts.timeoutS * 1e3);
|
|
48057
48136
|
timer.unref();
|
|
48058
48137
|
}
|
|
48059
|
-
return new Promise((
|
|
48138
|
+
return new Promise((resolve6, reject) => {
|
|
48060
48139
|
child.on("error", (err) => {
|
|
48061
48140
|
if (timer) clearTimeout(timer);
|
|
48062
48141
|
clearSensitiveReferences(env2, literals);
|
|
@@ -48065,7 +48144,7 @@ function spawnPrivileged(opts) {
|
|
|
48065
48144
|
child.on("close", (code, signal) => {
|
|
48066
48145
|
if (timer) clearTimeout(timer);
|
|
48067
48146
|
clearSensitiveReferences(env2, literals);
|
|
48068
|
-
|
|
48147
|
+
resolve6({
|
|
48069
48148
|
exitCode: code ?? 0,
|
|
48070
48149
|
signal,
|
|
48071
48150
|
durationMs: Date.now() - startedAt
|
|
@@ -49010,7 +49089,7 @@ async function promptHidden(prompt) {
|
|
|
49010
49089
|
process.stdin.setRawMode(true);
|
|
49011
49090
|
process.stdin.resume();
|
|
49012
49091
|
process.stdin.setEncoding("utf8");
|
|
49013
|
-
return new Promise((
|
|
49092
|
+
return new Promise((resolve6) => {
|
|
49014
49093
|
let buf = "";
|
|
49015
49094
|
const onData = (chunk) => {
|
|
49016
49095
|
for (const ch of chunk) {
|
|
@@ -49019,7 +49098,7 @@ async function promptHidden(prompt) {
|
|
|
49019
49098
|
process.stdin.pause();
|
|
49020
49099
|
process.stdin.removeListener("data", onData);
|
|
49021
49100
|
process.stdout.write("\n");
|
|
49022
|
-
|
|
49101
|
+
resolve6(buf);
|
|
49023
49102
|
return;
|
|
49024
49103
|
}
|
|
49025
49104
|
if (ch === "") {
|
|
@@ -49037,10 +49116,10 @@ async function promptHidden(prompt) {
|
|
|
49037
49116
|
}
|
|
49038
49117
|
async function promptLine(prompt) {
|
|
49039
49118
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
49040
|
-
return new Promise((
|
|
49119
|
+
return new Promise((resolve6) => {
|
|
49041
49120
|
rl.question(prompt, (answer) => {
|
|
49042
49121
|
rl.close();
|
|
49043
|
-
|
|
49122
|
+
resolve6(answer.trim());
|
|
49044
49123
|
});
|
|
49045
49124
|
});
|
|
49046
49125
|
}
|
|
@@ -49435,9 +49514,9 @@ here (see the streaming-mode limitation in the redactor package).
|
|
|
49435
49514
|
`
|
|
49436
49515
|
});
|
|
49437
49516
|
async execute() {
|
|
49438
|
-
return new Promise((
|
|
49517
|
+
return new Promise((resolve6, reject) => {
|
|
49439
49518
|
const transform = createRedactStream();
|
|
49440
|
-
this.context.stdin.pipe(transform).pipe(this.context.stdout).on("error", reject).on("finish", () =>
|
|
49519
|
+
this.context.stdin.pipe(transform).pipe(this.context.stdout).on("error", reject).on("finish", () => resolve6(0));
|
|
49441
49520
|
this.context.stdin.on("error", reject);
|
|
49442
49521
|
});
|
|
49443
49522
|
}
|
|
@@ -49699,11 +49778,11 @@ async function copyToClipboard2(value) {
|
|
|
49699
49778
|
);
|
|
49700
49779
|
}
|
|
49701
49780
|
function pipeToCommand(cmd, args, input) {
|
|
49702
|
-
return new Promise((
|
|
49781
|
+
return new Promise((resolve6, reject) => {
|
|
49703
49782
|
const child = spawn(cmd, args, { stdio: ["pipe", "ignore", "ignore"] });
|
|
49704
49783
|
child.on("error", reject);
|
|
49705
49784
|
child.on("close", (code) => {
|
|
49706
|
-
if (code === 0)
|
|
49785
|
+
if (code === 0) resolve6();
|
|
49707
49786
|
else reject(new Error(`${cmd} exited with code ${code}`));
|
|
49708
49787
|
});
|
|
49709
49788
|
child.stdin.on("error", reject);
|
|
@@ -49795,12 +49874,15 @@ var SecretCreateCommand = class extends Command {
|
|
|
49795
49874
|
var SecretGetCommand = class extends Command {
|
|
49796
49875
|
static paths = [["secret", "get"]];
|
|
49797
49876
|
static usage = Command.Usage({
|
|
49798
|
-
description: "Resolve a secret.
|
|
49877
|
+
description: "Resolve a secret. By default the value is copied to the OS clipboard (never printed). Use --reveal to print it to stdout, or --json for automation."
|
|
49799
49878
|
});
|
|
49800
49879
|
alias = options_exports.String({ required: false });
|
|
49801
49880
|
json = options_exports.Boolean("--json", false);
|
|
49802
49881
|
copy = options_exports.Boolean("--copy", false, {
|
|
49803
|
-
description: "Copy the value to the OS clipboard
|
|
49882
|
+
description: "Copy the value to the OS clipboard (the default in an interactive terminal)."
|
|
49883
|
+
});
|
|
49884
|
+
reveal = options_exports.Boolean("--reveal", false, {
|
|
49885
|
+
description: "Print the raw value to stdout. Opt-in, because it can land in terminal scrollback or an AI transcript."
|
|
49804
49886
|
});
|
|
49805
49887
|
async execute() {
|
|
49806
49888
|
try {
|
|
@@ -49828,35 +49910,41 @@ var SecretGetCommand = class extends Command {
|
|
|
49828
49910
|
const data = await client.request(
|
|
49829
49911
|
`/v1/projects/${projectId3}/secrets/${parsed.environment}/${parsed.key}`
|
|
49830
49912
|
);
|
|
49831
|
-
if (this.copy) {
|
|
49832
|
-
try {
|
|
49833
|
-
await copyToClipboard2(data.value);
|
|
49834
|
-
} catch (err) {
|
|
49835
|
-
if (err instanceof ClipboardUnavailableError) {
|
|
49836
|
-
this.context.stderr.write(
|
|
49837
|
-
`keynv: ${err.message}.
|
|
49838
|
-
Install one (pbcopy/clip are built in; Linux: wl-clipboard or xclip), or omit --copy to print to stdout.
|
|
49839
|
-
`
|
|
49840
|
-
);
|
|
49841
|
-
return 1;
|
|
49842
|
-
}
|
|
49843
|
-
throw err;
|
|
49844
|
-
} finally {
|
|
49845
|
-
data.value = "";
|
|
49846
|
-
}
|
|
49847
|
-
this.context.stderr.write(`keynv: copied ${data.alias} (v${data.version}) to clipboard.
|
|
49848
|
-
`);
|
|
49849
|
-
return 0;
|
|
49850
|
-
}
|
|
49851
49913
|
if (this.json) {
|
|
49852
49914
|
this.context.stdout.write(
|
|
49853
49915
|
`${JSON.stringify({ alias: data.alias, version: data.version, value: data.value })}
|
|
49854
49916
|
`
|
|
49855
49917
|
);
|
|
49856
|
-
|
|
49918
|
+
return 0;
|
|
49919
|
+
}
|
|
49920
|
+
if (this.reveal) {
|
|
49857
49921
|
this.context.stdout.write(`${data.value}
|
|
49858
49922
|
`);
|
|
49923
|
+
return 0;
|
|
49859
49924
|
}
|
|
49925
|
+
if (!this.copy && !isInteractive()) {
|
|
49926
|
+
this.context.stderr.write(
|
|
49927
|
+
"keynv: refusing to print a secret to a non-interactive stdout.\n Pass --reveal to print it, --copy to copy it, or --json for automation.\n"
|
|
49928
|
+
);
|
|
49929
|
+
return 1;
|
|
49930
|
+
}
|
|
49931
|
+
try {
|
|
49932
|
+
await copyToClipboard2(data.value);
|
|
49933
|
+
} catch (err) {
|
|
49934
|
+
if (err instanceof ClipboardUnavailableError) {
|
|
49935
|
+
this.context.stderr.write(
|
|
49936
|
+
`keynv: ${err.message}.
|
|
49937
|
+
Install one (pbcopy/clip are built in; Linux: wl-clipboard or xclip), or pass --reveal to print to stdout / --json for automation.
|
|
49938
|
+
`
|
|
49939
|
+
);
|
|
49940
|
+
return 1;
|
|
49941
|
+
}
|
|
49942
|
+
throw err;
|
|
49943
|
+
} finally {
|
|
49944
|
+
data.value = "";
|
|
49945
|
+
}
|
|
49946
|
+
this.context.stderr.write(`keynv: copied ${data.alias} (v${data.version}) to clipboard.
|
|
49947
|
+
`);
|
|
49860
49948
|
return 0;
|
|
49861
49949
|
} catch (err) {
|
|
49862
49950
|
return handleExecError(this.context.stderr, err);
|
|
@@ -50126,140 +50214,6 @@ var SecretRotationsCommand = class extends Command {
|
|
|
50126
50214
|
}
|
|
50127
50215
|
}
|
|
50128
50216
|
};
|
|
50129
|
-
function generateSecret(bytes = 32) {
|
|
50130
|
-
return randomBytes(bytes).toString("base64");
|
|
50131
|
-
}
|
|
50132
|
-
var ServerInitCommand = class extends Command {
|
|
50133
|
-
static paths = [["server", "init"]];
|
|
50134
|
-
static usage = Command.Usage({
|
|
50135
|
-
description: "Generate secrets and deployment files for a new keynv server.",
|
|
50136
|
-
details: `
|
|
50137
|
-
Interactive onboarding wizard that generates the configuration
|
|
50138
|
-
a fresh keynv server needs: JWT signing secret, master encryption
|
|
50139
|
-
key, and deployment templates.
|
|
50140
|
-
|
|
50141
|
-
Outputs:
|
|
50142
|
-
\u2022 A .keynv-server.env file you feed into your deployment
|
|
50143
|
-
(Docker Compose, Coolify, or bare-metal).
|
|
50144
|
-
\u2022 Optionally a docker-compose.yml in the current directory.
|
|
50145
|
-
|
|
50146
|
-
Non-interactive with --yes to skip prompts.
|
|
50147
|
-
`,
|
|
50148
|
-
examples: [
|
|
50149
|
-
["Interactive wizard", "$0 server init"],
|
|
50150
|
-
["Non-interactive (CI/scripts)", "$0 server init --yes"],
|
|
50151
|
-
["Docker Compose output", "$0 server init --compose"],
|
|
50152
|
-
["Custom output path", "$0 server init --out ./config/env"]
|
|
50153
|
-
]
|
|
50154
|
-
});
|
|
50155
|
-
yes = options_exports.Boolean("--yes", false, {
|
|
50156
|
-
description: "Skip all prompts (non-interactive)."
|
|
50157
|
-
});
|
|
50158
|
-
compose = options_exports.Boolean("--compose", false, {
|
|
50159
|
-
description: "Also write a docker-compose.yml to the current directory."
|
|
50160
|
-
});
|
|
50161
|
-
out = options_exports.String("--out", {
|
|
50162
|
-
description: "Write server env file to this path (default: .keynv-server.env)."
|
|
50163
|
-
});
|
|
50164
|
-
async execute() {
|
|
50165
|
-
const jwtSecret = generateSecret(48);
|
|
50166
|
-
const masterKey = generateSecret(32);
|
|
50167
|
-
const webSessionSecret = generateSecret(48);
|
|
50168
|
-
const outPath = this.out ?? ".keynv-server.env";
|
|
50169
|
-
const contents = [
|
|
50170
|
-
"# Generated by `keynv server init`.",
|
|
50171
|
-
"# Keep this file secret \u2014 it contains cryptographic key material.",
|
|
50172
|
-
`KEYNV_JWT_SECRET=${jwtSecret}`,
|
|
50173
|
-
`KEYNV_MASTER_KEY=${masterKey}`,
|
|
50174
|
-
"",
|
|
50175
|
-
"# Web dashboard session secret (required for Next.js JWE session tokens).",
|
|
50176
|
-
`KEYNV_WEB_SESSION_SECRET=${webSessionSecret}`,
|
|
50177
|
-
"",
|
|
50178
|
-
"# Server configuration (uncomment and adjust):",
|
|
50179
|
-
"# KEYNV_PORT=8080",
|
|
50180
|
-
"# KEYNV_WEB_URL=https://keynv.example.com",
|
|
50181
|
-
"# KEYNV_PUBLIC_REGISTRATION=false",
|
|
50182
|
-
"# KEYNV_DB_PATH=./keynv.db",
|
|
50183
|
-
"# KEYNV_MASTER_KEY_FILE=./master.key",
|
|
50184
|
-
"# KEYNV_RATE_LIMIT_PER_MINUTE=120",
|
|
50185
|
-
"# KEYNV_ARGON2_MEMORY_KIB=46080",
|
|
50186
|
-
"# KEYNV_ARGON2_TIME_COST=3"
|
|
50187
|
-
].join("\n");
|
|
50188
|
-
const { writeFileSync: writeFileSync5 } = await import('fs');
|
|
50189
|
-
writeFileSync5(outPath, `${contents}
|
|
50190
|
-
`, { mode: 384 });
|
|
50191
|
-
this.context.stdout.write(`Wrote ${outPath}
|
|
50192
|
-
|
|
50193
|
-
`);
|
|
50194
|
-
this.context.stdout.write("Generated secrets:\n");
|
|
50195
|
-
this.context.stdout.write(
|
|
50196
|
-
` KEYNV_JWT_SECRET ${jwtSecret.slice(0, 8)}... (base64, 48 bytes)
|
|
50197
|
-
`
|
|
50198
|
-
);
|
|
50199
|
-
this.context.stdout.write(
|
|
50200
|
-
` KEYNV_MASTER_KEY ${masterKey.slice(0, 8)}... (base64, 32 bytes)
|
|
50201
|
-
`
|
|
50202
|
-
);
|
|
50203
|
-
this.context.stdout.write(
|
|
50204
|
-
` KEYNV_WEB_SESSION_SECRET ${webSessionSecret.slice(0, 8)}... (base64, 48 bytes)
|
|
50205
|
-
`
|
|
50206
|
-
);
|
|
50207
|
-
this.context.stdout.write("\nNext steps:\n");
|
|
50208
|
-
this.context.stdout.write(` 1. Feed ${outPath} into your deployment:
|
|
50209
|
-
`);
|
|
50210
|
-
this.context.stdout.write(" docker compose --env-file .keynv-server.env up -d\n");
|
|
50211
|
-
this.context.stdout.write(" or load it into Coolify as environment variables.\n");
|
|
50212
|
-
this.context.stdout.write(" 2. Bootstrap the first owner:\n");
|
|
50213
|
-
this.context.stdout.write(
|
|
50214
|
-
" docker exec -it <server-container> node dist/bootstrap.js \\\n"
|
|
50215
|
-
);
|
|
50216
|
-
this.context.stdout.write(" --owner-email alice@example.com \\\n");
|
|
50217
|
-
this.context.stdout.write(' --owner-password "<a long random password>" \\\n');
|
|
50218
|
-
this.context.stdout.write(' --org-name "Acme Inc"\n');
|
|
50219
|
-
this.context.stdout.write(" 3. Install the CLI and connect from the TUI:\n");
|
|
50220
|
-
this.context.stdout.write(" npm install -g @keynv/cli\n");
|
|
50221
|
-
this.context.stdout.write(" keynv\n");
|
|
50222
|
-
this.context.stdout.write(" 4. Onboard your first project from the same TUI:\n");
|
|
50223
|
-
this.context.stdout.write(" cd your-project && keynv\n");
|
|
50224
|
-
if (this.compose) {
|
|
50225
|
-
const composeContent = `# keynv server + Litestream sidecar
|
|
50226
|
-
# Generated by \`keynv server init\`.
|
|
50227
|
-
# Load with: docker compose --env-file .keynv-server.env up -d
|
|
50228
|
-
|
|
50229
|
-
services:
|
|
50230
|
-
server:
|
|
50231
|
-
image: ghcr.io/keynv-labs/keynv-server:latest
|
|
50232
|
-
restart: unless-stopped
|
|
50233
|
-
ports:
|
|
50234
|
-
- '8080:8080'
|
|
50235
|
-
env_file:
|
|
50236
|
-
- .keynv-server.env
|
|
50237
|
-
volumes:
|
|
50238
|
-
- keynv-data:/data
|
|
50239
|
-
|
|
50240
|
-
litestream:
|
|
50241
|
-
image: litestream/litestream:latest
|
|
50242
|
-
restart: unless-stopped
|
|
50243
|
-
volumes:
|
|
50244
|
-
- keynv-data:/data
|
|
50245
|
-
command: replicate
|
|
50246
|
-
environment:
|
|
50247
|
-
LITESTREAM_DB_PATH: /data/keynv.db
|
|
50248
|
-
LITESTREAM_REPLICA_URL: s3://your-bucket/keynv
|
|
50249
|
-
AWS_ACCESS_KEY_ID: \${LITESTREAM_AWS_ACCESS_KEY_ID}
|
|
50250
|
-
AWS_SECRET_ACCESS_KEY: \${LITESTREAM_AWS_SECRET_ACCESS_KEY}
|
|
50251
|
-
|
|
50252
|
-
volumes:
|
|
50253
|
-
keynv-data:
|
|
50254
|
-
`;
|
|
50255
|
-
writeFileSync5("docker-compose.yml", composeContent, { mode: 384 });
|
|
50256
|
-
this.context.stdout.write(
|
|
50257
|
-
"\nWrote docker-compose.yml (update Litestream S3 config before deploying).\n"
|
|
50258
|
-
);
|
|
50259
|
-
}
|
|
50260
|
-
return 0;
|
|
50261
|
-
}
|
|
50262
|
-
};
|
|
50263
50217
|
|
|
50264
50218
|
// src/shell/templates.ts
|
|
50265
50219
|
var SHELL_SECRET_ERE = "(AKIA|ASIA)[0-9A-Z]{16}|AIza[0-9A-Za-z_-]{35}|gh[uops]_[A-Za-z0-9]{36}|github_pat_[A-Za-z0-9_]{40,}|xox[abp]-[A-Za-z0-9-]{24,}|(sk|rk)_(live|test)_[A-Za-z0-9]{24,}|sk-ant-(api03|admin01)-[A-Za-z0-9_-]{20,}|sk-(proj-)?[A-Za-z0-9_-]{20,}|eyJ[A-Za-z0-9_-]{10,}\\.eyJ[A-Za-z0-9_-]{10,}\\.[A-Za-z0-9_-]{10,}|(postgresql|postgres|mysql|mongodb)(\\+srv)?://[^@ ]+@[^ ]+|rediss?://[^@ ]+@[^ ]+";
|
|
@@ -51052,7 +51006,7 @@ var sshTester = {
|
|
|
51052
51006
|
}
|
|
51053
51007
|
const start = Date.now();
|
|
51054
51008
|
const { Client: Client2 } = await import('ssh2');
|
|
51055
|
-
return new Promise((
|
|
51009
|
+
return new Promise((resolve6) => {
|
|
51056
51010
|
const client = new Client2();
|
|
51057
51011
|
let settled = false;
|
|
51058
51012
|
const settle = (result) => {
|
|
@@ -51063,7 +51017,7 @@ var sshTester = {
|
|
|
51063
51017
|
client.end();
|
|
51064
51018
|
} catch {
|
|
51065
51019
|
}
|
|
51066
|
-
|
|
51020
|
+
resolve6(result);
|
|
51067
51021
|
};
|
|
51068
51022
|
client.once("ready", () => {
|
|
51069
51023
|
client.exec("true", (err, stream) => {
|
|
@@ -51148,12 +51102,12 @@ function sanitizeResult(result, secret) {
|
|
|
51148
51102
|
|
|
51149
51103
|
// ../../packages/testers/dist/run.js
|
|
51150
51104
|
function withTimeout(promise, ms) {
|
|
51151
|
-
return new Promise((
|
|
51105
|
+
return new Promise((resolve6, reject) => {
|
|
51152
51106
|
const t = setTimeout(() => reject(new Error(`tester timed out after ${ms}ms`)), ms);
|
|
51153
51107
|
t.unref();
|
|
51154
51108
|
promise.then((v2) => {
|
|
51155
51109
|
clearTimeout(t);
|
|
51156
|
-
|
|
51110
|
+
resolve6(v2);
|
|
51157
51111
|
}, (err) => {
|
|
51158
51112
|
clearTimeout(t);
|
|
51159
51113
|
reject(err);
|
|
@@ -51329,6 +51283,25 @@ the error message.
|
|
|
51329
51283
|
return result.ok ? 0 : 1;
|
|
51330
51284
|
}
|
|
51331
51285
|
};
|
|
51286
|
+
|
|
51287
|
+
// src/commands/ui.ts
|
|
51288
|
+
init_tty();
|
|
51289
|
+
init_menu();
|
|
51290
|
+
var UICommand = class extends Command {
|
|
51291
|
+
static paths = [["ui"]];
|
|
51292
|
+
static usage = Command.Usage({
|
|
51293
|
+
description: "Open the interactive menu (also runs by default when no args are given)."
|
|
51294
|
+
});
|
|
51295
|
+
async execute() {
|
|
51296
|
+
if (!isInteractive()) {
|
|
51297
|
+
this.context.stdout.write(
|
|
51298
|
+
"keynv \u2014 AI-safe secrets management.\nRun `keynv --help` for the full command list, or run `keynv` in an interactive\nterminal to open the menu.\n"
|
|
51299
|
+
);
|
|
51300
|
+
return 0;
|
|
51301
|
+
}
|
|
51302
|
+
return runMenu();
|
|
51303
|
+
}
|
|
51304
|
+
};
|
|
51332
51305
|
init_format();
|
|
51333
51306
|
init_state();
|
|
51334
51307
|
init_version();
|
|
@@ -51495,8 +51468,8 @@ async function runWatcher(options = {}) {
|
|
|
51495
51468
|
awaitWriteFinish: false,
|
|
51496
51469
|
...options.usePolling ? { usePolling: true, interval: 500 } : {}
|
|
51497
51470
|
});
|
|
51498
|
-
const readyPromise2 = new Promise((
|
|
51499
|
-
watcher.once("ready", () =>
|
|
51471
|
+
const readyPromise2 = new Promise((resolve6) => {
|
|
51472
|
+
watcher.once("ready", () => resolve6());
|
|
51500
51473
|
});
|
|
51501
51474
|
watcher.on("add", (path) => {
|
|
51502
51475
|
if (matchesExt(path)) filesWatched += 1;
|
|
@@ -51837,7 +51810,7 @@ cli.register(WatchStartCommand);
|
|
|
51837
51810
|
cli.register(WatchStopCommand);
|
|
51838
51811
|
cli.register(WatchStatusCommand);
|
|
51839
51812
|
cli.register(TestCommand);
|
|
51840
|
-
cli.register(
|
|
51813
|
+
cli.register(UICommand);
|
|
51841
51814
|
var argv = process.argv.slice(2);
|
|
51842
51815
|
async function main() {
|
|
51843
51816
|
if (argv.length === 0) {
|