@karmaniverous/get-dotenv 6.3.0 → 6.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +1 -1
  2. package/dist/chunks/{AwsRestJsonProtocol-Dv5q8CFK.mjs → AwsRestJsonProtocol-D_GDWyaH.mjs} +2 -2
  3. package/dist/chunks/{createCli-BSn6Be40.mjs → createCli-Ct22WCEC.mjs} +9 -6
  4. package/dist/chunks/{externalDataInterceptor-pqHO-Qmn.mjs → externalDataInterceptor-BRIxrVUl.mjs} +2 -2
  5. package/dist/chunks/{getSSOTokenFromFile-otmZHSRV.mjs → getSSOTokenFromFile-TYPZln9_.mjs} +1 -1
  6. package/dist/chunks/{index-C4Ac6feq.mjs → index-5AyAFomx.mjs} +12 -10
  7. package/dist/chunks/{index-CXpZ0pei.mjs → index-5NxTUVel.mjs} +9 -7
  8. package/dist/chunks/{index-BNcKuiBy.mjs → index-BCVlyd0W.mjs} +12 -10
  9. package/dist/chunks/{index-CYoFYXZv.mjs → index-BMb3Lxzl.mjs} +10 -8
  10. package/dist/chunks/{index-CGg5wWCm.mjs → index-BNWgREzT.mjs} +8 -6
  11. package/dist/chunks/{index-eZMlmESW.mjs → index-BSO6unyj.mjs} +17 -15
  12. package/dist/chunks/{index-DLQEHTw4.mjs → index-Be7QY_7N.mjs} +10 -8
  13. package/dist/chunks/{index-BqZ3PB6c.mjs → index-BzOeGJbq.mjs} +115 -10
  14. package/dist/chunks/{index-B18W-ELX.mjs → index-CR4cJOVz.mjs} +7 -5
  15. package/dist/chunks/{index-C6uLiKpC.mjs → index-Dz-kRqKN.mjs} +7 -5
  16. package/dist/chunks/{index-DFNcs3pR.mjs → index-G-U0Dimh.mjs} +9 -7
  17. package/dist/chunks/{index-Bi0RIILn.mjs → index-LKToAIhZ.mjs} +7 -5
  18. package/dist/chunks/{index-DtRaL61T.mjs → index-jLjEQoIi.mjs} +7 -5
  19. package/dist/chunks/{loadSso-CJ_XUhEj.mjs → loadSso-BnjVSVhE.mjs} +9 -7
  20. package/dist/chunks/{loader-CePOf74i.mjs → loader-CE4HSRN4.mjs} +3 -0
  21. package/dist/chunks/{parseKnownFiles-B6x1cUmR.mjs → parseKnownFiles-CejYPe7q.mjs} +1 -1
  22. package/dist/chunks/readDotenvCascade-Bymjvyit.mjs +549 -0
  23. package/dist/chunks/{readMergedOptions-DLBDzpXX.mjs → readMergedOptions-DLRFU2qO.mjs} +99 -308
  24. package/dist/chunks/{resolveCliOptions-_qtsVxda.mjs → resolveCliOptions-C6oeNl9S.mjs} +4 -1
  25. package/dist/chunks/{sdk-stream-mixin-DCdC70Up.mjs → sdk-stream-mixin-BDitDomf.mjs} +1 -1
  26. package/dist/chunks/{spawnEnv-CQwFu7ZJ.mjs → spawnEnv-5kdIVv0x.mjs} +5 -2
  27. package/dist/chunks/{types-DdqcXCV1.mjs → types-BC96rfQj.mjs} +1 -1
  28. package/dist/cli.d.ts +218 -94
  29. package/dist/cli.mjs +10 -8
  30. package/dist/cliHost.d.ts +258 -97
  31. package/dist/cliHost.mjs +55 -8
  32. package/dist/config.d.ts +0 -10
  33. package/dist/config.mjs +4 -1
  34. package/dist/env-overlay.d.ts +308 -16
  35. package/dist/env-overlay.mjs +40 -1
  36. package/dist/getdotenv.cli.mjs +10 -8
  37. package/dist/index.d.ts +243 -115
  38. package/dist/index.mjs +223 -45
  39. package/dist/plugins-aws.d.ts +161 -26
  40. package/dist/plugins-aws.mjs +27 -6
  41. package/dist/plugins-batch.d.ts +150 -26
  42. package/dist/plugins-batch.mjs +6 -4
  43. package/dist/plugins-cmd.d.ts +149 -25
  44. package/dist/plugins-cmd.mjs +8 -6
  45. package/dist/plugins-init.d.ts +149 -25
  46. package/dist/plugins-init.mjs +5 -3
  47. package/dist/plugins.d.ts +161 -26
  48. package/dist/plugins.mjs +11 -9
  49. package/package.json +2 -1
  50. package/templates/config/ts/getdotenv.config.ts +5 -3
  51. package/dist/chunks/overlayEnv-Bqh_kPGA.mjs +0 -235
package/dist/cliHost.d.ts CHANGED
@@ -2,6 +2,218 @@ import { OptionValues, Command, InferCommandArguments, Option, CommandUnknownOpt
2
2
  import { z, ZodObject } from 'zod';
3
3
  export { z } from 'zod';
4
4
 
5
+ /**
6
+ * Dotenv provenance model (descriptor-only).
7
+ *
8
+ * Requirements addressed:
9
+ * - Host ctx carries a dotenv provenance mapping describing per-key origin and override history.
10
+ * - Provenance is descriptor-only (no value payloads).
11
+ * - Provenance is an ordered stack per key in ascending precedence; the last entry is effective.
12
+ * - Explicit unsets are represented as `op: 'unset'` without requiring deletion of keys from the env map.
13
+ */
14
+ /**
15
+ * Provenance kind for an entry in {@link DotenvProvenance}.
16
+ *
17
+ * @public
18
+ */
19
+ type DotenvProvenanceKind = 'file' | 'config' | 'vars' | 'dynamic';
20
+ /**
21
+ * Operation represented by a provenance entry.
22
+ *
23
+ * @public
24
+ */
25
+ type DotenvProvenanceOp = 'set' | 'unset';
26
+ /**
27
+ * Base shape for all provenance entries.
28
+ *
29
+ * @public
30
+ */
31
+ interface DotenvProvenanceEntryBase {
32
+ /**
33
+ * The kind of provenance entry.
34
+ */
35
+ kind: DotenvProvenanceKind;
36
+ /**
37
+ * The operation applied at this layer.
38
+ */
39
+ op: DotenvProvenanceOp;
40
+ }
41
+ /**
42
+ * Provenance entry representing a value sourced from a dotenv file in the cascade.
43
+ *
44
+ * @public
45
+ */
46
+ interface DotenvFileProvenanceEntry extends DotenvProvenanceEntryBase {
47
+ /** Discriminator. */
48
+ kind: 'file';
49
+ /** Global vs env-scoped file. */
50
+ scope: 'global' | 'env';
51
+ /** Public vs private file. */
52
+ privacy: 'public' | 'private';
53
+ /** Environment name (required when scope is `env`). */
54
+ env?: string;
55
+ /**
56
+ * The corresponding `paths[]` entry as provided by the caller/CLI.
57
+ * This is not an absolute path by policy.
58
+ */
59
+ path: string;
60
+ /**
61
+ * The computed dotenv filename token (e.g., `.env`, `.env.dev`, `.env.local`, `.env.dev.local`).
62
+ */
63
+ file: string;
64
+ }
65
+ /**
66
+ * Provenance entry representing a value sourced from config overlays (`vars` / `envVars`).
67
+ *
68
+ * @public
69
+ */
70
+ interface DotenvConfigProvenanceEntry extends DotenvProvenanceEntryBase {
71
+ /** Discriminator. */
72
+ kind: 'config';
73
+ /** Global vs env-scoped config slice. */
74
+ scope: 'global' | 'env';
75
+ /** Public vs private on the privacy axis (`local` config maps to `private`). */
76
+ privacy: 'public' | 'private';
77
+ /** Environment name (required when scope is `env`). */
78
+ env?: string;
79
+ /** Packaged vs project config origin. */
80
+ configScope: 'packaged' | 'project';
81
+ /** Public vs local config file. */
82
+ configPrivacy: 'public' | 'local';
83
+ }
84
+ /**
85
+ * Provenance entry representing explicit variables overrides.
86
+ *
87
+ * Notes:
88
+ * - This kind represents values injected via `vars` (CLI/programmatic), not dotenv files.
89
+ *
90
+ * @public
91
+ */
92
+ interface DotenvVarsProvenanceEntry extends DotenvProvenanceEntryBase {
93
+ /** Discriminator. */
94
+ kind: 'vars';
95
+ }
96
+ /**
97
+ * Source tier for dynamic variables.
98
+ *
99
+ * @public
100
+ */
101
+ type DotenvDynamicSource = 'config' | 'programmatic' | 'dynamicPath';
102
+ /**
103
+ * Provenance entry representing dynamic variables.
104
+ *
105
+ * @public
106
+ */
107
+ interface DotenvDynamicProvenanceEntry extends DotenvProvenanceEntryBase {
108
+ /** Discriminator. */
109
+ kind: 'dynamic';
110
+ /** Dynamic source tier. */
111
+ dynamicSource: DotenvDynamicSource;
112
+ /**
113
+ * The `dynamicPath` value as provided by the caller/CLI when `dynamicSource` is `dynamicPath`.
114
+ * This is not resolved to an absolute path by provenance policy.
115
+ */
116
+ dynamicPath?: string;
117
+ }
118
+ /**
119
+ * Union of all supported provenance entry shapes.
120
+ *
121
+ * @public
122
+ */
123
+ type DotenvProvenanceEntry = DotenvFileProvenanceEntry | DotenvConfigProvenanceEntry | DotenvVarsProvenanceEntry | DotenvDynamicProvenanceEntry;
124
+ /**
125
+ * Per-key provenance history.
126
+ *
127
+ * Each key maps to an array of entries ordered in ascending precedence (lower to higher).
128
+ *
129
+ * @public
130
+ */
131
+ type DotenvProvenance = Record<string, DotenvProvenanceEntry[]>;
132
+
133
+ /**
134
+ * Resolved CLI options schema.
135
+ * For the current step this mirrors the RAW schema; later stages may further
136
+ * narrow types post-resolution in the host pipeline.
137
+ */
138
+ /**
139
+ * CLI options schema (resolved).
140
+ *
141
+ * Today this mirrors {@link getDotenvCliOptionsSchemaRaw}, but is kept as a distinct export
142
+ * so future resolution steps can narrow or materialize defaults without breaking the API.
143
+ *
144
+ * @public
145
+ */
146
+ declare const getDotenvCliOptionsSchemaResolved: z.ZodObject<{
147
+ defaultEnv: z.ZodOptional<z.ZodString>;
148
+ dotenvToken: z.ZodOptional<z.ZodString>;
149
+ dynamicPath: z.ZodOptional<z.ZodString>;
150
+ dynamic: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
151
+ env: z.ZodOptional<z.ZodString>;
152
+ excludeDynamic: z.ZodOptional<z.ZodBoolean>;
153
+ excludeEnv: z.ZodOptional<z.ZodBoolean>;
154
+ excludeGlobal: z.ZodOptional<z.ZodBoolean>;
155
+ excludePrivate: z.ZodOptional<z.ZodBoolean>;
156
+ excludePublic: z.ZodOptional<z.ZodBoolean>;
157
+ loadProcess: z.ZodOptional<z.ZodBoolean>;
158
+ log: z.ZodOptional<z.ZodBoolean>;
159
+ logger: z.ZodDefault<z.ZodUnknown>;
160
+ outputPath: z.ZodOptional<z.ZodString>;
161
+ privateToken: z.ZodOptional<z.ZodString>;
162
+ debug: z.ZodOptional<z.ZodBoolean>;
163
+ strict: z.ZodOptional<z.ZodBoolean>;
164
+ capture: z.ZodOptional<z.ZodBoolean>;
165
+ trace: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
166
+ redact: z.ZodOptional<z.ZodBoolean>;
167
+ warnEntropy: z.ZodOptional<z.ZodBoolean>;
168
+ entropyThreshold: z.ZodOptional<z.ZodNumber>;
169
+ entropyMinLength: z.ZodOptional<z.ZodNumber>;
170
+ entropyWhitelist: z.ZodOptional<z.ZodArray<z.ZodString>>;
171
+ redactPatterns: z.ZodOptional<z.ZodArray<z.ZodString>>;
172
+ paths: z.ZodOptional<z.ZodString>;
173
+ pathsDelimiter: z.ZodOptional<z.ZodString>;
174
+ pathsDelimiterPattern: z.ZodOptional<z.ZodString>;
175
+ scripts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
176
+ shell: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>;
177
+ vars: z.ZodOptional<z.ZodString>;
178
+ varsAssignor: z.ZodOptional<z.ZodString>;
179
+ varsAssignorPattern: z.ZodOptional<z.ZodString>;
180
+ varsDelimiter: z.ZodOptional<z.ZodString>;
181
+ varsDelimiterPattern: z.ZodOptional<z.ZodString>;
182
+ }, z.core.$strip>;
183
+
184
+ /**
185
+ * Resolved programmatic options schema (post-inheritance).
186
+ * For now, this mirrors the RAW schema; future stages may materialize defaults
187
+ * and narrow shapes as resolution is wired into the host.
188
+ */
189
+ /**
190
+ * Programmatic options schema (resolved).
191
+ *
192
+ * Today this mirrors {@link getDotenvOptionsSchemaRaw}, but is kept as a distinct export
193
+ * so future resolution steps can narrow or materialize defaults without breaking the API.
194
+ *
195
+ * @public
196
+ */
197
+ declare const getDotenvOptionsSchemaResolved: z.ZodObject<{
198
+ defaultEnv: z.ZodOptional<z.ZodString>;
199
+ dotenvToken: z.ZodOptional<z.ZodString>;
200
+ dynamicPath: z.ZodOptional<z.ZodString>;
201
+ dynamic: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
202
+ env: z.ZodOptional<z.ZodString>;
203
+ excludeDynamic: z.ZodOptional<z.ZodBoolean>;
204
+ excludeEnv: z.ZodOptional<z.ZodBoolean>;
205
+ excludeGlobal: z.ZodOptional<z.ZodBoolean>;
206
+ excludePrivate: z.ZodOptional<z.ZodBoolean>;
207
+ excludePublic: z.ZodOptional<z.ZodBoolean>;
208
+ loadProcess: z.ZodOptional<z.ZodBoolean>;
209
+ log: z.ZodOptional<z.ZodBoolean>;
210
+ logger: z.ZodDefault<z.ZodUnknown>;
211
+ outputPath: z.ZodOptional<z.ZodString>;
212
+ paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
213
+ privateToken: z.ZodOptional<z.ZodString>;
214
+ vars: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>>;
215
+ }, z.core.$strip>;
216
+
5
217
  /**
6
218
  * Minimal root options shape shared by CLI and generator layers.
7
219
  * Keep keys optional to respect exactOptionalPropertyTypes semantics.
@@ -121,6 +333,12 @@ interface GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions>
121
333
  * Final composed dotenv environment for this invocation.
122
334
  */
123
335
  dotenv: ProcessEnv;
336
+ /**
337
+ * Dotenv provenance history for {@link GetDotenvCliCtx.dotenv}.
338
+ *
339
+ * Descriptor-only: does not include value payloads.
340
+ */
341
+ dotenvProvenance: DotenvProvenance;
124
342
  /**
125
343
  * Optional runtime plugin state bag. Plugins may publish non-sensitive metadata here.
126
344
  */
@@ -148,100 +366,6 @@ interface BrandOptions {
148
366
  helpHeader?: string;
149
367
  }
150
368
 
151
- /**
152
- * Resolved CLI options schema.
153
- * For the current step this mirrors the RAW schema; later stages may further
154
- * narrow types post-resolution in the host pipeline.
155
- */
156
- /**
157
- * CLI options schema (resolved).
158
- *
159
- * Today this mirrors {@link getDotenvCliOptionsSchemaRaw}, but is kept as a distinct export
160
- * so future resolution steps can narrow or materialize defaults without breaking the API.
161
- *
162
- * @public
163
- */
164
- declare const getDotenvCliOptionsSchemaResolved: z.ZodObject<{
165
- defaultEnv: z.ZodOptional<z.ZodString>;
166
- dotenvToken: z.ZodOptional<z.ZodString>;
167
- dynamicPath: z.ZodOptional<z.ZodString>;
168
- dynamic: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
169
- env: z.ZodOptional<z.ZodString>;
170
- excludeDynamic: z.ZodOptional<z.ZodBoolean>;
171
- excludeEnv: z.ZodOptional<z.ZodBoolean>;
172
- excludeGlobal: z.ZodOptional<z.ZodBoolean>;
173
- excludePrivate: z.ZodOptional<z.ZodBoolean>;
174
- excludePublic: z.ZodOptional<z.ZodBoolean>;
175
- loadProcess: z.ZodOptional<z.ZodBoolean>;
176
- log: z.ZodOptional<z.ZodBoolean>;
177
- logger: z.ZodDefault<z.ZodUnknown>;
178
- outputPath: z.ZodOptional<z.ZodString>;
179
- privateToken: z.ZodOptional<z.ZodString>;
180
- debug: z.ZodOptional<z.ZodBoolean>;
181
- strict: z.ZodOptional<z.ZodBoolean>;
182
- capture: z.ZodOptional<z.ZodBoolean>;
183
- trace: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
184
- redact: z.ZodOptional<z.ZodBoolean>;
185
- warnEntropy: z.ZodOptional<z.ZodBoolean>;
186
- entropyThreshold: z.ZodOptional<z.ZodNumber>;
187
- entropyMinLength: z.ZodOptional<z.ZodNumber>;
188
- entropyWhitelist: z.ZodOptional<z.ZodArray<z.ZodString>>;
189
- redactPatterns: z.ZodOptional<z.ZodArray<z.ZodString>>;
190
- paths: z.ZodOptional<z.ZodString>;
191
- pathsDelimiter: z.ZodOptional<z.ZodString>;
192
- pathsDelimiterPattern: z.ZodOptional<z.ZodString>;
193
- scripts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
194
- shell: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>;
195
- vars: z.ZodOptional<z.ZodString>;
196
- varsAssignor: z.ZodOptional<z.ZodString>;
197
- varsAssignorPattern: z.ZodOptional<z.ZodString>;
198
- varsDelimiter: z.ZodOptional<z.ZodString>;
199
- varsDelimiterPattern: z.ZodOptional<z.ZodString>;
200
- }, z.core.$strip>;
201
-
202
- /**
203
- * Resolved programmatic options schema (post-inheritance).
204
- * For now, this mirrors the RAW schema; future stages may materialize defaults
205
- * and narrow shapes as resolution is wired into the host.
206
- */
207
- /**
208
- * Programmatic options schema (resolved).
209
- *
210
- * Today this mirrors {@link getDotenvOptionsSchemaRaw}, but is kept as a distinct export
211
- * so future resolution steps can narrow or materialize defaults without breaking the API.
212
- *
213
- * @public
214
- */
215
- declare const getDotenvOptionsSchemaResolved: z.ZodObject<{
216
- defaultEnv: z.ZodOptional<z.ZodString>;
217
- dotenvToken: z.ZodOptional<z.ZodString>;
218
- dynamicPath: z.ZodOptional<z.ZodString>;
219
- dynamic: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
220
- env: z.ZodOptional<z.ZodString>;
221
- excludeDynamic: z.ZodOptional<z.ZodBoolean>;
222
- excludeEnv: z.ZodOptional<z.ZodBoolean>;
223
- excludeGlobal: z.ZodOptional<z.ZodBoolean>;
224
- excludePrivate: z.ZodOptional<z.ZodBoolean>;
225
- excludePublic: z.ZodOptional<z.ZodBoolean>;
226
- loadProcess: z.ZodOptional<z.ZodBoolean>;
227
- log: z.ZodOptional<z.ZodBoolean>;
228
- logger: z.ZodDefault<z.ZodUnknown>;
229
- outputPath: z.ZodOptional<z.ZodString>;
230
- paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
231
- privateToken: z.ZodOptional<z.ZodString>;
232
- vars: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>>;
233
- }, z.core.$strip>;
234
-
235
- /**
236
- * Canonical programmatic options and helpers for get-dotenv.
237
- *
238
- * Requirements addressed:
239
- * - GetDotenvOptions derives from the Zod schema output (single source of truth).
240
- * - Removed deprecated/compat flags from the public shape (e.g., useConfigLoader).
241
- * - Provide Vars-aware defineDynamic and a typed config builder defineGetDotenvConfig\<Vars, Env\>().
242
- * - Preserve existing behavior for defaults resolution and compat converters.
243
- */
244
-
245
369
  /**
246
370
  * A minimal representation of an environment key/value mapping.
247
371
  * Values may be `undefined` to represent "unset".
@@ -520,6 +644,16 @@ declare function definePlugin<TOptions extends GetDotenvOptions, Schema extends
520
644
  }): PluginWithInstanceHelpers<TOptions, z.output<Schema>>;
521
645
  declare function definePlugin<TOptions extends GetDotenvOptions>(spec: DefineSpec<TOptions>): PluginWithInstanceHelpers<TOptions, {}>;
522
646
 
647
+ /**
648
+ * Non-interactive confirm guard for destructive ops.
649
+ * Returns true when force is provided; otherwise warns and sets exitCode.
650
+ *
651
+ * @param force - The force flag value (truthy allows proceed).
652
+ * @param op - Operation name for the warning message.
653
+ * @param flag - The flag name to suggest in the warning message (default: '--force').
654
+ */
655
+ declare function ensureForce(force: unknown, op: string, flag?: string): boolean;
656
+
523
657
  /**
524
658
  * Helper to decide whether to capture child stdio.
525
659
  * Checks GETDOTENV_STDIO env var or the provided bag capture flag.
@@ -825,6 +959,33 @@ interface GroupPluginsOptions<TOptions extends GetDotenvOptions = GetDotenvOptio
825
959
  */
826
960
  declare function groupPlugins<TOptions extends GetDotenvOptions = GetDotenvOptions>(options: GroupPluginsOptions<TOptions>): PluginWithInstanceHelpers<TOptions, {}>;
827
961
 
962
+ /**
963
+ * Return type for {@link describeConfigKeyListDefaults}.
964
+ *
965
+ * @public
966
+ */
967
+ interface DescribeConfigKeyListDefaultsResult {
968
+ /** Description for the include list default. */
969
+ includeDefault: string;
970
+ /** Description for the exclude list default. */
971
+ excludeDefault: string;
972
+ }
973
+ /**
974
+ * Describe a default value for help text.
975
+ * Handles arrays (joins with space) and strings; returns 'none' if empty/undefined.
976
+ */
977
+ declare const describeDefault: (v: unknown) => string;
978
+ /**
979
+ * Describe default values for a pair of include/exclude list options.
980
+ * Returns an object with `includeDefault` and `excludeDefault` strings.
981
+ *
982
+ * If both lists are populated, returns an invalid marker for both.
983
+ */
984
+ declare const describeConfigKeyListDefaults: ({ cfgInclude, cfgExclude, }: {
985
+ cfgInclude?: string[];
986
+ cfgExclude?: string[];
987
+ }) => DescribeConfigKeyListDefaultsResult;
988
+
828
989
  /** src/cliHost/invoke.ts
829
990
  * Shared helpers for composing child env overlays and preserving argv for Node -e.
830
991
  */
@@ -837,7 +998,7 @@ declare function groupPlugins<TOptions extends GetDotenvOptions = GetDotenvOptio
837
998
  * @param dotenv - Composed dotenv variables for the current invocation.
838
999
  * @returns A string-only env overlay suitable for child process spawning.
839
1000
  */
840
- declare function composeNestedEnv(merged: GetDotenvCliOptions | Record<string, unknown>, dotenv: Record<string, string | undefined>): Record<string, string>;
1001
+ declare function composeNestedEnv(merged: GetDotenvCliOptions | Record<string, unknown>, dotenv: ProcessEnv): Record<string, string>;
841
1002
  /**
842
1003
  * Strip one layer of symmetric outer quotes (single or double) from a string.
843
1004
  *
@@ -952,7 +1113,7 @@ declare const resolveCliOptions: <T extends ResolveCliOptionsShape>(rawCliOption
952
1113
  * @param base - Base environment (usually `process.env`).
953
1114
  * @param overlay - Environment variables to overlay.
954
1115
  */
955
- declare const buildSpawnEnv: (base?: NodeJS.ProcessEnv, overlay?: Record<string, string | undefined>) => NodeJS.ProcessEnv;
1116
+ declare const buildSpawnEnv: (base?: NodeJS.ProcessEnv, overlay?: ProcessEnv) => NodeJS.ProcessEnv;
956
1117
 
957
- export { GetDotenvCli, baseGetDotenvCliOptions, buildSpawnEnv, composeNestedEnv, definePlugin, defineScripts, getRootCommand, groupPlugins, maybePreserveNodeEvalArgv, readMergedOptions, resolveCliOptions, resolveCommand, resolveShell, runCommand, runCommandResult, shouldCapture, stripOne, toHelpConfig };
1118
+ export { GetDotenvCli, baseGetDotenvCliOptions, buildSpawnEnv, composeNestedEnv, definePlugin, defineScripts, describeConfigKeyListDefaults, describeDefault, ensureForce, getRootCommand, groupPlugins, maybePreserveNodeEvalArgv, readMergedOptions, resolveCliOptions, resolveCommand, resolveShell, runCommand, runCommandResult, shouldCapture, stripOne, toHelpConfig };
958
1119
  export type { BrandOptions, DefineSpec, GetDotenvCliCtx, GetDotenvCliOptions, GetDotenvCliPlugin, GetDotenvCliPublic, GroupPluginsOptions, InferPluginConfig, PluginChildEntry, PluginFlattenedEntry, PluginNamespaceOverride, PluginWithInstanceHelpers, ResolveAndLoadOptions, ResolveCliOptionsResult, ResolvedHelpConfig, RootOptionsShape, RunCommandOptions, RunCommandResultOptions, ScriptDef, Scripts, ScriptsTable };
package/dist/cliHost.mjs CHANGED
@@ -1,25 +1,43 @@
1
- export { G as GetDotenvCli, d as definePlugin, r as readMergedOptions } from './chunks/readMergedOptions-DLBDzpXX.mjs';
2
- export { d as buildSpawnEnv, b as resolveCommand, c as resolveShell, r as runCommand, a as runCommandResult, s as shouldCapture } from './chunks/spawnEnv-CQwFu7ZJ.mjs';
3
- export { b as baseGetDotenvCliOptions, r as resolveCliOptions } from './chunks/resolveCliOptions-_qtsVxda.mjs';
4
- export { d as defineScripts, g as groupPlugins } from './chunks/types-DdqcXCV1.mjs';
1
+ export { G as GetDotenvCli, d as definePlugin, r as readMergedOptions } from './chunks/readMergedOptions-DLRFU2qO.mjs';
2
+ export { d as buildSpawnEnv, b as resolveCommand, c as resolveShell, r as runCommand, a as runCommandResult, s as shouldCapture } from './chunks/spawnEnv-5kdIVv0x.mjs';
3
+ export { b as baseGetDotenvCliOptions, r as resolveCliOptions } from './chunks/resolveCliOptions-C6oeNl9S.mjs';
4
+ export { d as defineScripts, g as groupPlugins } from './chunks/types-BC96rfQj.mjs';
5
5
  export { t as toHelpConfig } from './chunks/helpConfig-CGejgwWW.mjs';
6
6
  export { c as composeNestedEnv, m as maybePreserveNodeEvalArgv, s as stripOne } from './chunks/invoke-DuRPU1oC.mjs';
7
7
  export { z } from 'zod';
8
8
  import '@commander-js/extra-typings';
9
- import './chunks/overlayEnv-Bqh_kPGA.mjs';
9
+ import './chunks/readDotenvCascade-Bymjvyit.mjs';
10
10
  import 'fs-extra';
11
+ import 'radash';
12
+ import 'node:buffer';
11
13
  import 'node:path';
12
14
  import './chunks/loadModuleDefault-Dj8B3Stt.mjs';
13
15
  import 'crypto';
14
16
  import 'path';
15
17
  import 'url';
16
- import 'nanoid';
17
18
  import 'dotenv';
18
- import './chunks/loader-CePOf74i.mjs';
19
+ import 'nanoid';
20
+ import './chunks/loader-CE4HSRN4.mjs';
19
21
  import 'package-directory';
20
22
  import 'yaml';
21
23
  import 'execa';
22
24
 
25
+ /**
26
+ * Non-interactive confirm guard for destructive ops.
27
+ * Returns true when force is provided; otherwise warns and sets exitCode.
28
+ *
29
+ * @param force - The force flag value (truthy allows proceed).
30
+ * @param op - Operation name for the warning message.
31
+ * @param flag - The flag name to suggest in the warning message (default: '--force').
32
+ */
33
+ function ensureForce(force, op, flag = '--force') {
34
+ if (force)
35
+ return true;
36
+ console.warn(`${op} requires confirmation. Re-run with ${flag} to proceed.`);
37
+ process.exitCode = 2;
38
+ return false;
39
+ }
40
+
23
41
  /**
24
42
  * Return the top-level root command for a given mount or action's thisCommand.
25
43
  *
@@ -33,4 +51,33 @@ const getRootCommand = (cmd) => {
33
51
  return node;
34
52
  };
35
53
 
36
- export { getRootCommand };
54
+ /**
55
+ * Describe a default value for help text.
56
+ * Handles arrays (joins with space) and strings; returns 'none' if empty/undefined.
57
+ */
58
+ const describeDefault = (v) => {
59
+ if (Array.isArray(v))
60
+ return v.length ? v.join(' ') : 'none';
61
+ if (typeof v === 'string' && v.trim())
62
+ return v;
63
+ return 'none';
64
+ };
65
+ /**
66
+ * Describe default values for a pair of include/exclude list options.
67
+ * Returns an object with `includeDefault` and `excludeDefault` strings.
68
+ *
69
+ * If both lists are populated, returns an invalid marker for both.
70
+ */
71
+ const describeConfigKeyListDefaults = ({ cfgInclude, cfgExclude, }) => {
72
+ // Avoid throwing in help rendering: show an explicit invalid marker.
73
+ if (cfgInclude?.length && cfgExclude?.length) {
74
+ const msg = '(invalid: both set in config)';
75
+ return { includeDefault: msg, excludeDefault: msg };
76
+ }
77
+ return {
78
+ includeDefault: describeDefault(cfgExclude?.length ? undefined : cfgInclude),
79
+ excludeDefault: describeDefault(cfgInclude?.length ? undefined : cfgExclude),
80
+ };
81
+ };
82
+
83
+ export { describeConfigKeyListDefaults, describeDefault, ensureForce, getRootCommand };
package/dist/config.d.ts CHANGED
@@ -99,16 +99,6 @@ interface ScriptDef<TShell extends string | boolean = string | boolean> {
99
99
  */
100
100
  type ScriptsTable<TShell extends string | boolean = string | boolean> = Record<string, string | ScriptDef<TShell>>;
101
101
 
102
- /**
103
- * Canonical programmatic options and helpers for get-dotenv.
104
- *
105
- * Requirements addressed:
106
- * - GetDotenvOptions derives from the Zod schema output (single source of truth).
107
- * - Removed deprecated/compat flags from the public shape (e.g., useConfigLoader).
108
- * - Provide Vars-aware defineDynamic and a typed config builder defineGetDotenvConfig\<Vars, Env\>().
109
- * - Preserve existing behavior for defaults resolution and compat converters.
110
- */
111
-
112
102
  /**
113
103
  * A minimal representation of an environment key/value mapping.
114
104
  * Values may be `undefined` to represent "unset".
package/dist/config.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { d as discoverConfigFiles, l as loadConfigFile, r as resolveGetDotenvConfigSources, t as toFileUrl } from './chunks/loader-CePOf74i.mjs';
1
+ export { d as discoverConfigFiles, l as loadConfigFile, r as resolveGetDotenvConfigSources, t as toFileUrl } from './chunks/loader-CE4HSRN4.mjs';
2
2
  export { v as validateEnvAgainstSources } from './chunks/validate-CDl0rE6k.mjs';
3
3
  import 'fs-extra';
4
4
  import 'package-directory';
@@ -6,6 +6,9 @@ import 'path';
6
6
  import 'url';
7
7
  import 'yaml';
8
8
  import 'zod';
9
+ import 'radash';
10
+ import 'node:buffer';
9
11
  import 'node:path';
10
12
  import './chunks/loadModuleDefault-Dj8B3Stt.mjs';
11
13
  import 'crypto';
14
+ import '@commander-js/extra-typings';