@e-n-v/env 0.0.7 → 0.0.9
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/{BooleanMap-B7MeMkJC.d.ts → BooleanMap-BPQuO3Ae.d.ts} +1 -3
- package/dist/{BooleanMap-D93UJnv5.d.cts → BooleanMap-CX_YrPCf.d.cts} +1 -3
- package/dist/EnvChannelOptions-BbKeuO-o.d.cts +366 -0
- package/dist/EnvChannelOptions-BbKeuO-o.d.ts +366 -0
- package/dist/{EnvSource-DA3ZGlES.js → EnvSource-WAGWqRVM.js} +6 -10
- package/dist/{EnvSource-BVnmdHku.cjs → EnvSource-s8F_M_6O.cjs} +21 -28
- package/dist/EnvVarSchema-CDZGmnex.cjs +15 -0
- package/dist/EnvVarSchema-Dr6q7jf6.js +10 -0
- package/dist/{ProcessEnvChannel-Do4-yiLI.d.ts → ProcessEnvChannel-CwhV7_EB.d.ts} +2 -4
- package/dist/{ProcessEnvChannel-D465c-dp.d.cts → ProcessEnvChannel-DWHPZePe.d.cts} +2 -4
- package/dist/channels.cjs +3 -4
- package/dist/channels.d.cts +3 -4
- package/dist/channels.d.ts +3 -4
- package/dist/channels.js +2 -4
- package/dist/cli.cjs +10 -23
- package/dist/cli.d.cts +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +7 -13
- package/dist/core.cjs +13 -14
- package/dist/core.d.cts +147 -6
- package/dist/core.d.ts +147 -6
- package/dist/core.js +9 -11
- package/dist/{custom-Bt_wnxIu.js → custom-Bd-jLg80.js} +3 -12
- package/dist/{custom-D_Rqjm09.cjs → custom-Dyb9TnER.cjs} +48 -58
- package/dist/files.cjs +6 -6
- package/dist/files.d.cts +2 -2
- package/dist/files.d.ts +2 -2
- package/dist/files.js +2 -5
- package/dist/{parse-awxwtQ1N.d.ts → index-B2eNij2x.d.cts} +1 -2
- package/dist/{parse-5fpTbjTr.d.cts → index-BHTM8nxS.d.ts} +1 -2
- package/dist/{prompt-DG8haZjn.d.ts → index-BKBW9Dxs.d.cts} +3 -4
- package/dist/{prompt-lmZdPaBh.d.cts → index-CEyOIRdj.d.ts} +3 -4
- package/dist/{EnvModel-BiT0OiDZ.d.ts → index-Cb0abjLf.d.ts} +59 -7
- package/dist/{EnvModel-I0fWZZ_n.d.cts → index-Cz3frUwZ.d.cts} +58 -6
- package/dist/index.cjs +27 -30
- package/dist/index.d.cts +11 -13
- package/dist/index.d.ts +11 -13
- package/dist/index.js +8 -14
- package/dist/model.cjs +10 -11
- package/dist/model.d.cts +2 -35
- package/dist/model.d.ts +2 -35
- package/dist/model.js +2 -6
- package/dist/parse.cjs +14 -14
- package/dist/parse.d.cts +5 -8
- package/dist/parse.d.ts +5 -8
- package/dist/parse.js +4 -7
- package/dist/preprocessors-BKuIcZa1.d.ts +83 -0
- package/dist/preprocessors-DFVyF0c7.d.cts +83 -0
- package/dist/prompt.cjs +12 -15
- package/dist/prompt.d.cts +5 -10
- package/dist/prompt.d.ts +5 -10
- package/dist/prompt.js +3 -9
- package/dist/{redis-Cazgs3_J.cjs → redis-CyTF0SYT.cjs} +260 -268
- package/dist/{redis-DXhlNtvD.js → redis-D18f4ztf.js} +15 -22
- package/dist/{index-UQm0jdkG.d.cts → redis-DsW-Vkwq.d.cts} +2 -6
- package/dist/{index-ClKndmJv.d.ts → redis-tRD4nAy_.d.ts} +2 -6
- package/dist/{resolveChannel-v9BDsw-M.js → resolveChannel-D1Fzl4TL.js} +59 -63
- package/dist/{resolveChannel-CjAuxy3p.cjs → resolveChannel-DxZNYdDe.cjs} +84 -92
- package/dist/{chunk-pbleEpgJ.cjs → rolldown-runtime-C0BPl7ul.cjs} +15 -16
- package/dist/{chunk-Bp6m_JJh.js → rolldown-runtime-D7D4PA-g.js} +4 -4
- package/dist/{schema-DdDa3Qjy.d.cts → schema-B-JLVS42.d.ts} +1 -3
- package/dist/{schema-CHypJTDK.d.ts → schema-B1i83alz.d.cts} +1 -3
- package/dist/schema-CtP5lpU1.js +11 -0
- package/dist/schema-D9nJKipf.cjs +22 -0
- package/dist/schemas/zod.cjs +42 -340
- package/dist/schemas/zod.d.cts +112 -114
- package/dist/schemas/zod.d.ts +112 -114
- package/dist/schemas/zod.js +111 -401
- package/dist/schemas.cjs +152 -155
- package/dist/schemas.d.cts +1 -2
- package/dist/schemas.d.ts +1 -2
- package/dist/schemas.js +2 -6
- package/dist/{src-CdqOYilA.cjs → src-5GYFbR9n.cjs} +21 -24
- package/dist/{src-BrNrE0hX.js → src-8rEOvFG5.js} +11 -14
- package/dist/{src-DI-VW4dW.js → src-CdzAzdq-.js} +77 -110
- package/dist/{src-B5Qu-M-r.js → src-Cg49gGJb.js} +9 -43
- package/dist/{src-dO72HN6e.cjs → src-CttkcdpE.cjs} +90 -130
- package/dist/{src-PHSSk-t3.cjs → src-D5KzIEH_.cjs} +130 -110
- package/dist/{src-DVdOONrX.cjs → src-DB0Har0j.cjs} +911 -932
- package/dist/{src-DQaQ28lz.js → src-DWc-WWjX.js} +107 -89
- package/dist/{src-vBXlFkSP.js → src-DvUBRBe3.js} +115 -136
- package/dist/{src-DywfI0fM.cjs → src-TZx_e95f.cjs} +78 -131
- package/dist/{vars-DF9DoAF4.d.ts → vars-DtzGL5Nc.d.cts} +1 -4
- package/dist/{vars-KUgv2rti.d.cts → vars-obKYxaSu.d.ts} +1 -4
- package/dist/vars.cjs +175 -160
- package/dist/vars.d.cts +2 -6
- package/dist/vars.d.ts +2 -6
- package/dist/vars.js +21 -9
- package/package.json +3 -2
- package/dist/EnvChannelOptions-BPkWDrmr.d.cts +0 -108
- package/dist/EnvChannelOptions-CRwDLWjd.d.ts +0 -108
- package/dist/coerce-DNIuYAx4.js +0 -11028
- package/dist/coerce-b7UVodS9.cjs +0 -12365
- package/dist/model-BNDYMM9l.d.ts +0 -29
- package/dist/model-CJMnbGuS.d.cts +0 -29
- package/dist/validate-8HbVniNt.d.cts +0 -204
- package/dist/validate-CE8hQ5JG.d.ts +0 -204
- package/dist/vars-BHXXBiY1.cjs +0 -27
- package/dist/vars-FOuH_HuL.js +0 -22
- /package/dist/{EnvChannel-LMIRYvT1.d.cts → EnvChannel-CfSwa_25.d.cts} +0 -0
- /package/dist/{EnvChannel-w27PEm7x.d.ts → EnvChannel-CfSwa_25.d.ts} +0 -0
- /package/dist/{StringEnvVarSchema-BwSGgmeG.d.ts → StringEnvVarSchema-D9Jr1Aws.d.cts} +0 -0
- /package/dist/{StringEnvVarSchema-DnsZTIS0.d.cts → StringEnvVarSchema-D9Jr1Aws.d.ts} +0 -0
|
@@ -1,29 +1,27 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import { t as
|
|
3
|
-
import { i as
|
|
4
|
-
import {
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
+
import { n as preprocessors, t as resolvePreprocessor } from "./src-Cg49gGJb.js";
|
|
3
|
+
import { i as resolveSchemas, n as EnvModel } from "./src-DWc-WWjX.js";
|
|
4
|
+
import { t as resolveChannel } from "./resolveChannel-D1Fzl4TL.js";
|
|
5
5
|
import { dirname, relative, resolve } from "node:path";
|
|
6
|
-
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
7
|
-
import { platform } from "node:os";
|
|
8
6
|
import { stdin, stdout } from "node:process";
|
|
9
7
|
import { Prompt, isCancel } from "@clack/core";
|
|
8
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
10
9
|
import color from "picocolors";
|
|
11
|
-
import {
|
|
10
|
+
import { execFile } from "node:child_process";
|
|
11
|
+
import { platform } from "node:os";
|
|
12
12
|
import { clearLine, cursorTo, moveCursor } from "node:readline";
|
|
13
|
-
|
|
14
13
|
//#region ../prompt/src/options/defaults.ts
|
|
15
|
-
var defaults_exports = /* @__PURE__ */
|
|
14
|
+
var defaults_exports = /* @__PURE__ */ __exportAll({
|
|
16
15
|
ENV_PATH: () => ENV_PATH,
|
|
17
16
|
SECRET_PATTERNS: () => SECRET_PATTERNS,
|
|
18
|
-
TRUNCATE_LENGTH: () =>
|
|
17
|
+
TRUNCATE_LENGTH: () => 40
|
|
19
18
|
});
|
|
20
19
|
const ENV_PATH = ".env";
|
|
21
|
-
const TRUNCATE_LENGTH = 40;
|
|
22
20
|
const SECRET_PATTERNS = Object.freeze([
|
|
23
21
|
/password/i,
|
|
24
22
|
/passphrase/i,
|
|
25
23
|
/secret/i,
|
|
26
|
-
/(?<!expires[_-]?in[_-]?)token(?![_-]
|
|
24
|
+
/(?<!(?:^|[_-])(?:expires[_-]?in|expiry|expiration|ttl|lifetime|duration|age|max[_-]?age|validity)[_-])token(?(?:$|[_-]))/i,
|
|
27
25
|
/api[_-]?key/i,
|
|
28
26
|
/client[_-]?secret/i,
|
|
29
27
|
/private[_-]?key/i,
|
|
@@ -32,7 +30,6 @@ const SECRET_PATTERNS = Object.freeze([
|
|
|
32
30
|
/access[_-]?key/i,
|
|
33
31
|
/credential/i
|
|
34
32
|
]);
|
|
35
|
-
|
|
36
33
|
//#endregion
|
|
37
34
|
//#region ../prompt/src/visuals/Theme.ts
|
|
38
35
|
var Theme = class Theme {
|
|
@@ -75,25 +72,6 @@ var Theme = class Theme {
|
|
|
75
72
|
return color.bgBlack;
|
|
76
73
|
}
|
|
77
74
|
};
|
|
78
|
-
|
|
79
|
-
//#endregion
|
|
80
|
-
//#region ../prompt/src/visuals/symbols.ts
|
|
81
|
-
const S_BAR = "│";
|
|
82
|
-
const S_BAR_END = "└";
|
|
83
|
-
const S_BAR_START = "┌";
|
|
84
|
-
const S_STEP_ACTIVE = "◆";
|
|
85
|
-
const S_STEP_SUBMIT = "✔";
|
|
86
|
-
const S_STEP_SKIP = "⏭";
|
|
87
|
-
const S_STEP_CANCEL = "✕";
|
|
88
|
-
const S_STEP_ERROR = "▲";
|
|
89
|
-
const S_STEP_PREVIOUS = "⏮";
|
|
90
|
-
const S_TOOL_ACTIVE = "■";
|
|
91
|
-
const S_TOOL_INACTIVE = "□";
|
|
92
|
-
const S_RADIO_ACTIVE = "●";
|
|
93
|
-
const S_RADIO_INACTIVE = "○";
|
|
94
|
-
const S_CURSOR = "█";
|
|
95
|
-
const SECRET_MASK = "•";
|
|
96
|
-
|
|
97
75
|
//#endregion
|
|
98
76
|
//#region ../prompt/src/prompts/ThemedPrompt.ts
|
|
99
77
|
var ThemedPrompt = class extends Prompt {
|
|
@@ -108,11 +86,11 @@ var ThemedPrompt = class extends Prompt {
|
|
|
108
86
|
getSymbol() {
|
|
109
87
|
switch (this.state) {
|
|
110
88
|
case "initial":
|
|
111
|
-
case "active": return this.theme.primary(
|
|
112
|
-
case "error": return this.theme.warn(
|
|
113
|
-
case "submit": return this.theme.primary(
|
|
114
|
-
case "cancel": return this.theme.error(
|
|
115
|
-
default: return this.theme.primary(
|
|
89
|
+
case "active": return this.theme.primary("◆");
|
|
90
|
+
case "error": return this.theme.warn("▲");
|
|
91
|
+
case "submit": return this.theme.primary("✔");
|
|
92
|
+
case "cancel": return this.theme.error("✕");
|
|
93
|
+
default: return this.theme.primary("◆");
|
|
116
94
|
}
|
|
117
95
|
}
|
|
118
96
|
/**
|
|
@@ -125,10 +103,10 @@ var ThemedPrompt = class extends Prompt {
|
|
|
125
103
|
* Get bar symbols with appropriate coloring
|
|
126
104
|
*/
|
|
127
105
|
getBar() {
|
|
128
|
-
return this.getBarColor(
|
|
106
|
+
return this.getBarColor("│");
|
|
129
107
|
}
|
|
130
108
|
getBarEnd() {
|
|
131
|
-
return this.getBarColor(
|
|
109
|
+
return this.getBarColor("└");
|
|
132
110
|
}
|
|
133
111
|
/**
|
|
134
112
|
* Color utilities for consistent theming
|
|
@@ -147,14 +125,13 @@ var ThemedPrompt = class extends Prompt {
|
|
|
147
125
|
};
|
|
148
126
|
}
|
|
149
127
|
};
|
|
150
|
-
|
|
151
128
|
//#endregion
|
|
152
129
|
//#region ../prompt/src/prompts/utils/ClackPromptInternals.ts
|
|
153
130
|
/** Hacks to access private members of Clack prompts */
|
|
154
131
|
var ClackPromptInternals = class {
|
|
155
132
|
prompt;
|
|
156
|
-
constructor(prompt
|
|
157
|
-
this.prompt = prompt
|
|
133
|
+
constructor(prompt) {
|
|
134
|
+
this.prompt = prompt;
|
|
158
135
|
}
|
|
159
136
|
set track(enabled) {
|
|
160
137
|
this.prompt._track = enabled;
|
|
@@ -163,7 +140,6 @@ var ClackPromptInternals = class {
|
|
|
163
140
|
return this.prompt._track;
|
|
164
141
|
}
|
|
165
142
|
};
|
|
166
|
-
|
|
167
143
|
//#endregion
|
|
168
144
|
//#region ../prompt/src/prompts/utils/padActiveRender.ts
|
|
169
145
|
/**
|
|
@@ -181,7 +157,6 @@ function padActiveRender(render) {
|
|
|
181
157
|
return result + "\n";
|
|
182
158
|
};
|
|
183
159
|
}
|
|
184
|
-
|
|
185
160
|
//#endregion
|
|
186
161
|
//#region ../prompt/src/prompts/toolbar/Toolbar.ts
|
|
187
162
|
var Toolbar = class {
|
|
@@ -246,7 +221,7 @@ var Toolbar = class {
|
|
|
246
221
|
const separator = this.theme.subtle(" / ");
|
|
247
222
|
return `${options.map((option, index) => {
|
|
248
223
|
const isFocused = index === this.cursor;
|
|
249
|
-
const label = `${isFocused ?
|
|
224
|
+
const label = `${isFocused ? "■" : "□"} ${option.label}`;
|
|
250
225
|
return isFocused ? this.theme.primary(label) : this.theme.subtle(label);
|
|
251
226
|
}).join(separator)}${separator}${this.theme.subtle("Tab to return")}`;
|
|
252
227
|
}
|
|
@@ -300,7 +275,6 @@ var Toolbar = class {
|
|
|
300
275
|
return options;
|
|
301
276
|
}
|
|
302
277
|
};
|
|
303
|
-
|
|
304
278
|
//#endregion
|
|
305
279
|
//#region ../prompt/src/prompts/state/EnvPromptModeDetails.ts
|
|
306
280
|
/**
|
|
@@ -339,7 +313,6 @@ function createState(modeDetails) {
|
|
|
339
313
|
...computeState(modeDetails)
|
|
340
314
|
};
|
|
341
315
|
}
|
|
342
|
-
|
|
343
316
|
//#endregion
|
|
344
317
|
//#region ../prompt/src/prompts/state/EnvPromptMode.ts
|
|
345
318
|
/**
|
|
@@ -502,7 +475,6 @@ var EnvPromptMode = class {
|
|
|
502
475
|
return this.intention;
|
|
503
476
|
}
|
|
504
477
|
};
|
|
505
|
-
|
|
506
478
|
//#endregion
|
|
507
479
|
//#region ../prompt/src/prompts/processing/processValue.ts
|
|
508
480
|
/**
|
|
@@ -527,6 +499,7 @@ function processValue(envKey, value, schema, preprocess) {
|
|
|
527
499
|
} catch {
|
|
528
500
|
processedValue = value;
|
|
529
501
|
}
|
|
502
|
+
if (!schema.process) throw new Error(`No processor configured for ${envKey}`);
|
|
530
503
|
return {
|
|
531
504
|
value: schema.process(processedValue),
|
|
532
505
|
rawValue: value,
|
|
@@ -541,7 +514,6 @@ function processValue(envKey, value, schema, preprocess) {
|
|
|
541
514
|
};
|
|
542
515
|
}
|
|
543
516
|
}
|
|
544
|
-
|
|
545
517
|
//#endregion
|
|
546
518
|
//#region ../prompt/src/prompts/EnvPrompt.ts
|
|
547
519
|
var EnvPrompt = class extends ThemedPrompt {
|
|
@@ -576,7 +548,7 @@ var EnvPrompt = class extends ThemedPrompt {
|
|
|
576
548
|
/** State machine managing prompt interaction modes. */
|
|
577
549
|
mode;
|
|
578
550
|
constructor(schema, opts) {
|
|
579
|
-
const { pad = true
|
|
551
|
+
const { pad = true, ...promptOpts } = opts;
|
|
580
552
|
const promptOptions = {
|
|
581
553
|
...promptOpts,
|
|
582
554
|
default: schema.default,
|
|
@@ -725,10 +697,10 @@ var EnvPrompt = class extends ThemedPrompt {
|
|
|
725
697
|
return `${value.substring(0, this.truncate)}...`;
|
|
726
698
|
}
|
|
727
699
|
renderSkipped() {
|
|
728
|
-
return `${this.colors.dim(this.theme.primary(
|
|
700
|
+
return `${this.colors.dim(this.theme.primary("⏭"))} ${this.colors.subtle(this.colors.bold(this.key))}`;
|
|
729
701
|
}
|
|
730
702
|
renderPrevious() {
|
|
731
|
-
return `${this.colors.dim(this.theme.primary(
|
|
703
|
+
return `${this.colors.dim(this.theme.primary("⏮"))} ${this.colors.subtle(this.colors.bold(this.key))}`;
|
|
732
704
|
}
|
|
733
705
|
renderOutcomeResult() {
|
|
734
706
|
const intention = this.mode.intention;
|
|
@@ -736,7 +708,7 @@ var EnvPrompt = class extends ThemedPrompt {
|
|
|
736
708
|
if (intention === "previous") return this.renderPrevious();
|
|
737
709
|
}
|
|
738
710
|
renderCancelled() {
|
|
739
|
-
return `${this.theme.error(
|
|
711
|
+
return `${this.theme.error("✕")} ${this.colors.subtle(this.colors.bold(this.key))}`;
|
|
740
712
|
}
|
|
741
713
|
toggleSecretReveal() {
|
|
742
714
|
if (!this.mode.hasSecret()) return;
|
|
@@ -766,9 +738,21 @@ var EnvPrompt = class extends ThemedPrompt {
|
|
|
766
738
|
handleOpenLink() {
|
|
767
739
|
const link = this.schema.link;
|
|
768
740
|
if (!link) return;
|
|
741
|
+
let url;
|
|
742
|
+
try {
|
|
743
|
+
url = new URL(link);
|
|
744
|
+
} catch {
|
|
745
|
+
console.error("Failed to open link");
|
|
746
|
+
return;
|
|
747
|
+
}
|
|
748
|
+
if (url.protocol !== "http:" && url.protocol !== "https:") {
|
|
749
|
+
console.error("Failed to open link");
|
|
750
|
+
return;
|
|
751
|
+
}
|
|
769
752
|
this.mode.suppressValidation();
|
|
770
|
-
|
|
771
|
-
|
|
753
|
+
const [executable, args] = platform() === "win32" ? ["rundll32.exe", ["url.dll,FileProtocolHandler", url.href]] : platform() === "darwin" ? ["open", [url.href]] : ["xdg-open", [url.href]];
|
|
754
|
+
execFile(executable, args, (error) => {
|
|
755
|
+
if (error) console.error("Failed to open link");
|
|
772
756
|
});
|
|
773
757
|
}
|
|
774
758
|
consumeSkipValidation() {
|
|
@@ -805,7 +789,6 @@ var EnvPrompt = class extends ThemedPrompt {
|
|
|
805
789
|
return labels.length > 0 ? labels.join(", ") : void 0;
|
|
806
790
|
}
|
|
807
791
|
};
|
|
808
|
-
|
|
809
792
|
//#endregion
|
|
810
793
|
//#region ../prompt/src/prompts/utils/selectableOptions.ts
|
|
811
794
|
function buildSelectableOptions(params) {
|
|
@@ -849,7 +832,6 @@ function getOptionAtCursor(options, cursor) {
|
|
|
849
832
|
index
|
|
850
833
|
};
|
|
851
834
|
}
|
|
852
|
-
|
|
853
835
|
//#endregion
|
|
854
836
|
//#region ../prompt/src/prompts/typed/EnvBooleanPrompt.ts
|
|
855
837
|
var EnvBooleanPrompt = class extends EnvPrompt {
|
|
@@ -869,11 +851,11 @@ var EnvBooleanPrompt = class extends EnvPrompt {
|
|
|
869
851
|
output += `${this.getSymbol()} ${this.colors.bold(this.colors.white(this.key))}`;
|
|
870
852
|
if (this.schema.description) output += ` ${this.colors.subtle(this.schema.description)}`;
|
|
871
853
|
output += "\n";
|
|
872
|
-
const options
|
|
854
|
+
const options = this.buildOptions();
|
|
873
855
|
const dimInputs = !this.error && this.mode.isToolbarOpen();
|
|
874
|
-
options
|
|
856
|
+
options.forEach((option, index) => {
|
|
875
857
|
const isSelected = index === this.cursor;
|
|
876
|
-
const circle = dimInputs ? this.colors.dim(isSelected ?
|
|
858
|
+
const circle = dimInputs ? this.colors.dim(isSelected ? "●" : "○") : isSelected ? this.theme.primary("●") : this.colors.dim("○");
|
|
877
859
|
const formatText = (value) => {
|
|
878
860
|
if (dimInputs) return this.colors.dim(value);
|
|
879
861
|
if (isSelected) return this.colors.white(value);
|
|
@@ -905,9 +887,9 @@ var EnvBooleanPrompt = class extends EnvPrompt {
|
|
|
905
887
|
this.on("cursor", (action) => {
|
|
906
888
|
this.clearErrorState();
|
|
907
889
|
if (!this.error && this.mode.isToolbarOpen()) return;
|
|
908
|
-
const options
|
|
909
|
-
if (!options
|
|
910
|
-
const lastIndex = options
|
|
890
|
+
const options = this.buildOptions();
|
|
891
|
+
if (!options.length) return;
|
|
892
|
+
const lastIndex = options.length - 1;
|
|
911
893
|
switch (action) {
|
|
912
894
|
case "up":
|
|
913
895
|
this.cursor = this.cursor === 0 ? lastIndex : this.cursor - 1;
|
|
@@ -918,7 +900,6 @@ var EnvBooleanPrompt = class extends EnvPrompt {
|
|
|
918
900
|
default:
|
|
919
901
|
if (this.cursor > lastIndex) this.cursor = lastIndex;
|
|
920
902
|
if (this.cursor < 0) this.cursor = 0;
|
|
921
|
-
break;
|
|
922
903
|
}
|
|
923
904
|
this.updateValue();
|
|
924
905
|
});
|
|
@@ -967,7 +948,6 @@ var EnvBooleanPrompt = class extends EnvPrompt {
|
|
|
967
948
|
return option;
|
|
968
949
|
}
|
|
969
950
|
};
|
|
970
|
-
|
|
971
951
|
//#endregion
|
|
972
952
|
//#region ../prompt/src/prompts/typed/EnvEnumPrompt.ts
|
|
973
953
|
var EnvEnumPrompt = class extends EnvPrompt {
|
|
@@ -988,11 +968,11 @@ var EnvEnumPrompt = class extends EnvPrompt {
|
|
|
988
968
|
output += `${this.getSymbol()} ${this.colors.bold(this.colors.white(this.key))}`;
|
|
989
969
|
if (this.schema.description) output += ` ${this.colors.subtle(this.schema.description)}`;
|
|
990
970
|
output += "\n";
|
|
991
|
-
const options
|
|
971
|
+
const options = this.buildOptions();
|
|
992
972
|
const dimInputs = !this.error && this.mode.isToolbarOpen();
|
|
993
|
-
options
|
|
973
|
+
options.forEach((option, index) => {
|
|
994
974
|
const isSelected = index === this.cursor;
|
|
995
|
-
const circle = dimInputs ? this.colors.dim(isSelected ?
|
|
975
|
+
const circle = dimInputs ? this.colors.dim(isSelected ? "●" : "○") : isSelected ? this.theme.primary("●") : this.colors.dim("○");
|
|
996
976
|
const formatText = (value) => {
|
|
997
977
|
if (dimInputs) return this.colors.dim(value);
|
|
998
978
|
if (isSelected) return this.colors.white(value);
|
|
@@ -1028,9 +1008,9 @@ var EnvEnumPrompt = class extends EnvPrompt {
|
|
|
1028
1008
|
this.on("cursor", (action) => {
|
|
1029
1009
|
this.clearErrorState();
|
|
1030
1010
|
if (!this.error && this.mode.isToolbarOpen()) return;
|
|
1031
|
-
const options
|
|
1032
|
-
if (!options
|
|
1033
|
-
const lastIndex = options
|
|
1011
|
+
const options = this.buildOptions();
|
|
1012
|
+
if (!options.length) return;
|
|
1013
|
+
const lastIndex = options.length - 1;
|
|
1034
1014
|
switch (action) {
|
|
1035
1015
|
case "up":
|
|
1036
1016
|
this.cursor = this.cursor === 0 ? lastIndex : this.cursor - 1;
|
|
@@ -1041,7 +1021,6 @@ var EnvEnumPrompt = class extends EnvPrompt {
|
|
|
1041
1021
|
default:
|
|
1042
1022
|
if (this.cursor > lastIndex) this.cursor = lastIndex;
|
|
1043
1023
|
if (this.cursor < 0) this.cursor = 0;
|
|
1044
|
-
break;
|
|
1045
1024
|
}
|
|
1046
1025
|
this.updateValue();
|
|
1047
1026
|
});
|
|
@@ -1059,8 +1038,8 @@ var EnvEnumPrompt = class extends EnvPrompt {
|
|
|
1059
1038
|
return;
|
|
1060
1039
|
}
|
|
1061
1040
|
if (selected.invalid) {
|
|
1062
|
-
const fallback
|
|
1063
|
-
this.setCommittedValue(fallback
|
|
1041
|
+
const fallback = this.default ?? this.values[0];
|
|
1042
|
+
this.setCommittedValue(fallback);
|
|
1064
1043
|
return;
|
|
1065
1044
|
}
|
|
1066
1045
|
const fallback = this.default ?? this.values[0];
|
|
@@ -1091,7 +1070,6 @@ var EnvEnumPrompt = class extends EnvPrompt {
|
|
|
1091
1070
|
return option;
|
|
1092
1071
|
}
|
|
1093
1072
|
};
|
|
1094
|
-
|
|
1095
1073
|
//#endregion
|
|
1096
1074
|
//#region ../prompt/src/prompts/typed/EnvNumberPrompt.ts
|
|
1097
1075
|
var EnvNumberPrompt = class extends EnvPrompt {
|
|
@@ -1127,7 +1105,7 @@ var EnvNumberPrompt = class extends EnvPrompt {
|
|
|
1127
1105
|
}
|
|
1128
1106
|
this.buildSelectionOptions().forEach((option, index) => {
|
|
1129
1107
|
const isSelected = index === this.mode.getCursor();
|
|
1130
|
-
const circle = dimInputs ? this.colors.dim(isSelected ?
|
|
1108
|
+
const circle = dimInputs ? this.colors.dim(isSelected ? "●" : "○") : isSelected ? this.theme.primary("●") : this.colors.dim("○");
|
|
1131
1109
|
if (option.type === "other") {
|
|
1132
1110
|
if (this.mode.isInInteraction("typing")) {
|
|
1133
1111
|
const displayText = dimInputs ? this.colors.dim(this.getInputDisplay(false)) : this.colors.white(this.getInputDisplay(true));
|
|
@@ -1135,8 +1113,8 @@ var EnvNumberPrompt = class extends EnvPrompt {
|
|
|
1135
1113
|
} else if (isSelected) if (dimInputs) output += `${this.getBar()} ${circle} ${this.colors.dim(option.label)}\n`;
|
|
1136
1114
|
else output += `${this.getBar()} ${circle} ${this.colors.white(this.getInputDisplay(true))}\n`;
|
|
1137
1115
|
else {
|
|
1138
|
-
const text
|
|
1139
|
-
output += `${this.getBar()} ${circle} ${text
|
|
1116
|
+
const text = dimInputs ? this.colors.dim(option.label) : this.colors.subtle(option.label);
|
|
1117
|
+
output += `${this.getBar()} ${circle} ${text}\n`;
|
|
1140
1118
|
}
|
|
1141
1119
|
return;
|
|
1142
1120
|
}
|
|
@@ -1241,7 +1219,6 @@ var EnvNumberPrompt = class extends EnvPrompt {
|
|
|
1241
1219
|
this.otherInputCache = "";
|
|
1242
1220
|
}
|
|
1243
1221
|
this.mode.moveCursor("down", maxIndexDown);
|
|
1244
|
-
break;
|
|
1245
1222
|
}
|
|
1246
1223
|
this.updateValue();
|
|
1247
1224
|
});
|
|
@@ -1299,8 +1276,8 @@ var EnvNumberPrompt = class extends EnvPrompt {
|
|
|
1299
1276
|
"tab"
|
|
1300
1277
|
].includes(info.name || "");
|
|
1301
1278
|
if (!isArrowKey && !isControlKey) {
|
|
1302
|
-
const textInputIndex
|
|
1303
|
-
this.mode.setCursor(textInputIndex
|
|
1279
|
+
const textInputIndex = this.getTextInputIndex();
|
|
1280
|
+
this.mode.setCursor(textInputIndex);
|
|
1304
1281
|
const existingInput = this.mode.getInputValue() || this.userInput || this.otherInputCache || "";
|
|
1305
1282
|
this.mode.enterTyping(existingInput);
|
|
1306
1283
|
const nextInput = `${existingInput}${char}`;
|
|
@@ -1330,7 +1307,7 @@ var EnvNumberPrompt = class extends EnvPrompt {
|
|
|
1330
1307
|
if (!includeCursor) return inputValue;
|
|
1331
1308
|
const rawCursor = this.mode.isInInteraction("typing") ? Math.max(0, this._cursor ?? inputValue.length) : 0;
|
|
1332
1309
|
const cursorIndex = Math.min(rawCursor, inputValue.length);
|
|
1333
|
-
if (cursorIndex >= inputValue.length) return `${inputValue}
|
|
1310
|
+
if (cursorIndex >= inputValue.length) return `${inputValue}█`;
|
|
1334
1311
|
const before = inputValue.slice(0, cursorIndex);
|
|
1335
1312
|
const cursorChar = inputValue.charAt(cursorIndex) || " ";
|
|
1336
1313
|
const after = inputValue.slice(cursorIndex + 1);
|
|
@@ -1476,7 +1453,6 @@ var EnvNumberPrompt = class extends EnvPrompt {
|
|
|
1476
1453
|
return index === -1 ? options.length - 1 : index;
|
|
1477
1454
|
}
|
|
1478
1455
|
};
|
|
1479
|
-
|
|
1480
1456
|
//#endregion
|
|
1481
1457
|
//#region ../prompt/src/utils/secrets.ts
|
|
1482
1458
|
function isSecretMatch(value, pattern) {
|
|
@@ -1496,7 +1472,7 @@ function isSecretKey(key, description, patterns) {
|
|
|
1496
1472
|
for (const pattern of patterns) if (isSecretMatch(key, pattern) || isSecretMatch(description, pattern)) return true;
|
|
1497
1473
|
return false;
|
|
1498
1474
|
}
|
|
1499
|
-
function maskSecretValue(value, maskChar =
|
|
1475
|
+
function maskSecretValue(value, maskChar = "•") {
|
|
1500
1476
|
if (!value) return value;
|
|
1501
1477
|
return value.replace(/./g, maskChar);
|
|
1502
1478
|
}
|
|
@@ -1505,7 +1481,6 @@ function resolveShouldMask(key, schema, patterns) {
|
|
|
1505
1481
|
if ("secret" in schema && schema.secret !== void 0) return schema.secret;
|
|
1506
1482
|
return isSecretKey(key, schema.description, patterns);
|
|
1507
1483
|
}
|
|
1508
|
-
|
|
1509
1484
|
//#endregion
|
|
1510
1485
|
//#region ../prompt/src/prompts/typed/EnvStringPrompt.ts
|
|
1511
1486
|
var EnvStringPrompt = class extends EnvPrompt {
|
|
@@ -1538,7 +1513,7 @@ var EnvStringPrompt = class extends EnvPrompt {
|
|
|
1538
1513
|
}
|
|
1539
1514
|
this.buildSelectionOptions().forEach((option, index) => {
|
|
1540
1515
|
const isSelected = index === this.mode.getCursor();
|
|
1541
|
-
const circle = dimInputs ? this.colors.dim(isSelected ?
|
|
1516
|
+
const circle = dimInputs ? this.colors.dim(isSelected ? "●" : "○") : isSelected ? this.theme.primary("●") : this.colors.dim("○");
|
|
1542
1517
|
if (option.type === "other") {
|
|
1543
1518
|
if (this.mode.isInInteraction("typing")) {
|
|
1544
1519
|
const displayText = dimInputs ? this.colors.dim(this.getInputDisplay(false)) : this.colors.white(this.getInputDisplay(true));
|
|
@@ -1546,8 +1521,8 @@ var EnvStringPrompt = class extends EnvPrompt {
|
|
|
1546
1521
|
} else if (isSelected) if (dimInputs) output += `${this.getBar()} ${circle} ${this.colors.dim(option.label)}\n`;
|
|
1547
1522
|
else output += `${this.getBar()} ${circle} ${this.colors.white(this.getInputDisplay(true))}\n`;
|
|
1548
1523
|
else {
|
|
1549
|
-
const text
|
|
1550
|
-
output += `${this.getBar()} ${circle} ${text
|
|
1524
|
+
const text = dimInputs ? this.colors.dim(option.label) : this.colors.subtle(option.label);
|
|
1525
|
+
output += `${this.getBar()} ${circle} ${text}\n`;
|
|
1551
1526
|
}
|
|
1552
1527
|
return;
|
|
1553
1528
|
}
|
|
@@ -1721,8 +1696,8 @@ var EnvStringPrompt = class extends EnvPrompt {
|
|
|
1721
1696
|
"tab"
|
|
1722
1697
|
].includes(info.name || "");
|
|
1723
1698
|
if (!isArrowKey && !isControlKey) {
|
|
1724
|
-
const textInputIndex
|
|
1725
|
-
this.mode.setCursor(textInputIndex
|
|
1699
|
+
const textInputIndex = this.getTextInputIndex();
|
|
1700
|
+
this.mode.setCursor(textInputIndex);
|
|
1726
1701
|
const existingInput = this.mode.getInputValue() || this.userInput || this.otherInputCache || "";
|
|
1727
1702
|
this.mode.enterTyping(existingInput);
|
|
1728
1703
|
const nextInput = `${existingInput}${char}`;
|
|
@@ -1864,7 +1839,7 @@ var EnvStringPrompt = class extends EnvPrompt {
|
|
|
1864
1839
|
return this.truncateValue(display);
|
|
1865
1840
|
}
|
|
1866
1841
|
maskValue(value) {
|
|
1867
|
-
return maskSecretValue(value,
|
|
1842
|
+
return maskSecretValue(value, "•");
|
|
1868
1843
|
}
|
|
1869
1844
|
getTextInputIndex() {
|
|
1870
1845
|
if (!this.hasPresetOptions()) return 0;
|
|
@@ -1878,9 +1853,9 @@ var EnvStringPrompt = class extends EnvPrompt {
|
|
|
1878
1853
|
const base = isMasked ? this.maskValue(inputValue) : inputValue;
|
|
1879
1854
|
if (!includeCursor) return base;
|
|
1880
1855
|
const rawCursor = this.mode.isInInteraction("typing") ? Math.max(0, this._cursor ?? inputValue.length) : 0;
|
|
1881
|
-
const maskLength = isMasked ? Math.max(1,
|
|
1856
|
+
const maskLength = isMasked ? Math.max(1, 1) : 1;
|
|
1882
1857
|
const cursorIndex = Math.min(rawCursor * maskLength, base.length);
|
|
1883
|
-
if (cursorIndex >= base.length) return `${base}
|
|
1858
|
+
if (cursorIndex >= base.length) return `${base}█`;
|
|
1884
1859
|
const segmentLength = maskLength;
|
|
1885
1860
|
const before = base.slice(0, cursorIndex);
|
|
1886
1861
|
const cursorSegment = base.slice(cursorIndex, cursorIndex + segmentLength) || " ";
|
|
@@ -1913,7 +1888,6 @@ var EnvStringPrompt = class extends EnvPrompt {
|
|
|
1913
1888
|
});
|
|
1914
1889
|
}
|
|
1915
1890
|
};
|
|
1916
|
-
|
|
1917
1891
|
//#endregion
|
|
1918
1892
|
//#region ../prompt/src/prompts/create/createPrompt.ts
|
|
1919
1893
|
function createPrompt({ key, schema, currentValue, theme, truncate, shouldMask, index, total, input, output, preprocessors: preprocessors$1 }) {
|
|
@@ -1958,7 +1932,6 @@ function createPrompt({ key, schema, currentValue, theme, truncate, shouldMask,
|
|
|
1958
1932
|
});
|
|
1959
1933
|
}
|
|
1960
1934
|
}
|
|
1961
|
-
|
|
1962
1935
|
//#endregion
|
|
1963
1936
|
//#region ../prompt/src/utils/clearConsoleLines.ts
|
|
1964
1937
|
function clearConsoleLines(lineCount) {
|
|
@@ -1973,7 +1946,6 @@ function clearConsoleLines(lineCount) {
|
|
|
1973
1946
|
cursorTo(output, 0);
|
|
1974
1947
|
} catch {}
|
|
1975
1948
|
}
|
|
1976
|
-
|
|
1977
1949
|
//#endregion
|
|
1978
1950
|
//#region ../prompt/src/utils/getDisplayEnvPath.ts
|
|
1979
1951
|
function getDisplayEnvPath(envPath, cwd = process.cwd()) {
|
|
@@ -1982,7 +1954,6 @@ function getDisplayEnvPath(envPath, cwd = process.cwd()) {
|
|
|
1982
1954
|
if (relativeEnvPath.startsWith(".")) return relativeEnvPath;
|
|
1983
1955
|
return `./${relativeEnvPath}`;
|
|
1984
1956
|
}
|
|
1985
|
-
|
|
1986
1957
|
//#endregion
|
|
1987
1958
|
//#region ../prompt/src/session/Session.ts
|
|
1988
1959
|
var Session = class Session {
|
|
@@ -2029,7 +2000,7 @@ var Session = class Session {
|
|
|
2029
2000
|
}
|
|
2030
2001
|
const shouldMask = resolveShouldMask(key, envVarSchema, this.secrets);
|
|
2031
2002
|
const storedValue = this.newValues[key] ?? currentValues[key];
|
|
2032
|
-
const prompt
|
|
2003
|
+
const prompt = createPrompt({
|
|
2033
2004
|
key,
|
|
2034
2005
|
schema: envVarSchema,
|
|
2035
2006
|
currentValue: storedValue && storedValue.trim() !== "" ? storedValue : void 0,
|
|
@@ -2042,9 +2013,9 @@ var Session = class Session {
|
|
|
2042
2013
|
output: this.output,
|
|
2043
2014
|
preprocessors: this.preprocessors
|
|
2044
2015
|
});
|
|
2045
|
-
const value = await prompt
|
|
2016
|
+
const value = await prompt.prompt();
|
|
2046
2017
|
addedLines++;
|
|
2047
|
-
const outcome = prompt
|
|
2018
|
+
const outcome = prompt.getOutcome();
|
|
2048
2019
|
if (isCancel(value) || typeof value === "symbol" && value?.description === "clack:cancel") {
|
|
2049
2020
|
this.output.write(`${color.red("│")} \n`);
|
|
2050
2021
|
this.output.write(`${color.red("└")} ${color.red("Setup cancelled.")}\n\n`);
|
|
@@ -2068,12 +2039,12 @@ var Session = class Session {
|
|
|
2068
2039
|
currentValues = await this.channel.get();
|
|
2069
2040
|
this.newValues[key] = stringValue;
|
|
2070
2041
|
} catch (error) {
|
|
2071
|
-
this.output.write(`${color.gray(
|
|
2042
|
+
this.output.write(`${color.gray("└")} ${color.red(`Failed to save ${key}: ${error}`)}\n\n`);
|
|
2072
2043
|
return "error";
|
|
2073
2044
|
}
|
|
2074
2045
|
index++;
|
|
2075
2046
|
}
|
|
2076
|
-
this.output.write(`${color.gray(
|
|
2047
|
+
this.output.write(`${color.gray("│")}\n${color.gray("└")} ${this.theme.primary("Setup complete!")}\n\n`);
|
|
2077
2048
|
return "success";
|
|
2078
2049
|
}
|
|
2079
2050
|
renderSetupHeader() {
|
|
@@ -2086,7 +2057,7 @@ var Session = class Session {
|
|
|
2086
2057
|
`${color.gray("│")} ${clickableEnvPath}${color.gray(` · ${variableLabel}`)}`,
|
|
2087
2058
|
`${color.gray("│")} `
|
|
2088
2059
|
].join("\n");
|
|
2089
|
-
this.output.write(`\n${color.gray(
|
|
2060
|
+
this.output.write(`\n${color.gray("┌")} ${headerBody}\n`);
|
|
2090
2061
|
}
|
|
2091
2062
|
toHyperlink(text, url) {
|
|
2092
2063
|
const escapeCode = "\x1B";
|
|
@@ -2095,7 +2066,6 @@ var Session = class Session {
|
|
|
2095
2066
|
return `${oscSequence}${url}${stringTerminator}${text}${oscSequence}${stringTerminator}`;
|
|
2096
2067
|
}
|
|
2097
2068
|
};
|
|
2098
|
-
|
|
2099
2069
|
//#endregion
|
|
2100
2070
|
//#region ../prompt/src/options/resolve.ts
|
|
2101
2071
|
function resolveTheme(themeOption) {
|
|
@@ -2110,7 +2080,6 @@ function resolveEnvFilePath(pathOption, rootDir) {
|
|
|
2110
2080
|
if (!rootDir) return pathOption;
|
|
2111
2081
|
return resolve(rootDir, pathOption);
|
|
2112
2082
|
}
|
|
2113
|
-
|
|
2114
2083
|
//#endregion
|
|
2115
2084
|
//#region ../prompt/src/utils/isEnvChannel.ts
|
|
2116
2085
|
/**
|
|
@@ -2119,7 +2088,6 @@ function resolveEnvFilePath(pathOption, rootDir) {
|
|
|
2119
2088
|
function isEnvChannel(value) {
|
|
2120
2089
|
return typeof value === "object" && value !== null && "get" in value && "set" in value && typeof value.get === "function" && typeof value.set === "function";
|
|
2121
2090
|
}
|
|
2122
|
-
|
|
2123
2091
|
//#endregion
|
|
2124
2092
|
//#region ../prompt/src/prompt.ts
|
|
2125
2093
|
/**
|
|
@@ -2143,8 +2111,8 @@ async function prompt(modelOrOptions, interactiveOptions) {
|
|
|
2143
2111
|
} else throw new Error("Either provide a model or schemas in options");
|
|
2144
2112
|
}
|
|
2145
2113
|
const rootDirectory = resolveRootDirectory(finalOptions.root);
|
|
2146
|
-
const path = resolveEnvFilePath(finalOptions.path ??
|
|
2147
|
-
const truncate = finalOptions.truncate ??
|
|
2114
|
+
const path = resolveEnvFilePath(finalOptions.path ?? ".env", rootDirectory);
|
|
2115
|
+
const truncate = finalOptions.truncate ?? 40;
|
|
2148
2116
|
const secrets = finalOptions.secrets ?? SECRET_PATTERNS;
|
|
2149
2117
|
const input = stdin;
|
|
2150
2118
|
const output = stdout;
|
|
@@ -2162,6 +2130,5 @@ async function prompt(modelOrOptions, interactiveOptions) {
|
|
|
2162
2130
|
preprocess: preprocessConfig
|
|
2163
2131
|
}).run();
|
|
2164
2132
|
}
|
|
2165
|
-
|
|
2166
2133
|
//#endregion
|
|
2167
|
-
export { defaults_exports as n, prompt as t };
|
|
2134
|
+
export { defaults_exports as n, prompt as t };
|