@karmaniverous/get-dotenv 5.2.5 → 6.0.0-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 (41) hide show
  1. package/README.md +63 -67
  2. package/dist/cliHost.cjs +765 -549
  3. package/dist/cliHost.d.cts +128 -84
  4. package/dist/cliHost.d.mts +128 -84
  5. package/dist/cliHost.d.ts +128 -84
  6. package/dist/cliHost.mjs +765 -549
  7. package/dist/getdotenv.cli.mjs +915 -685
  8. package/dist/index.cjs +959 -1006
  9. package/dist/index.d.cts +18 -178
  10. package/dist/index.d.mts +18 -178
  11. package/dist/index.d.ts +18 -178
  12. package/dist/index.mjs +960 -1006
  13. package/dist/plugins-aws.cjs +0 -1
  14. package/dist/plugins-aws.d.cts +8 -78
  15. package/dist/plugins-aws.d.mts +8 -78
  16. package/dist/plugins-aws.d.ts +8 -78
  17. package/dist/plugins-aws.mjs +0 -1
  18. package/dist/plugins-batch.cjs +53 -11
  19. package/dist/plugins-batch.d.cts +10 -79
  20. package/dist/plugins-batch.d.mts +10 -79
  21. package/dist/plugins-batch.d.ts +10 -79
  22. package/dist/plugins-batch.mjs +53 -11
  23. package/dist/plugins-cmd.cjs +162 -1555
  24. package/dist/plugins-cmd.d.cts +8 -78
  25. package/dist/plugins-cmd.d.mts +8 -78
  26. package/dist/plugins-cmd.d.ts +8 -78
  27. package/dist/plugins-cmd.mjs +162 -1554
  28. package/dist/plugins-demo.cjs +52 -7
  29. package/dist/plugins-demo.d.cts +8 -78
  30. package/dist/plugins-demo.d.mts +8 -78
  31. package/dist/plugins-demo.d.ts +8 -78
  32. package/dist/plugins-demo.mjs +52 -7
  33. package/dist/plugins-init.d.cts +8 -78
  34. package/dist/plugins-init.d.mts +8 -78
  35. package/dist/plugins-init.d.ts +8 -78
  36. package/dist/plugins.cjs +283 -1630
  37. package/dist/plugins.d.cts +10 -79
  38. package/dist/plugins.d.mts +10 -79
  39. package/dist/plugins.d.ts +10 -79
  40. package/dist/plugins.mjs +285 -1631
  41. package/package.json +4 -2
@@ -139,6 +139,48 @@ const runCommand = async (command, shell, opts) => {
139
139
  }
140
140
  };
141
141
 
142
+ const dropUndefined = (bag) => Object.fromEntries(Object.entries(bag).filter((e) => typeof e[1] === 'string'));
143
+ /** Build a sanitized env for child processes from base + overlay. */
144
+ const buildSpawnEnv = (base, overlay) => {
145
+ const raw = {
146
+ ...(base ?? {}),
147
+ ...(overlay ?? {}),
148
+ };
149
+ // Drop undefined first
150
+ const entries = Object.entries(dropUndefined(raw));
151
+ if (process.platform === 'win32') {
152
+ // Windows: keys are case-insensitive; collapse duplicates
153
+ const byLower = new Map();
154
+ for (const [k, v] of entries) {
155
+ byLower.set(k.toLowerCase(), [k, v]); // last wins; preserve latest casing
156
+ }
157
+ const out = {};
158
+ for (const [, [k, v]] of byLower)
159
+ out[k] = v;
160
+ // HOME fallback from USERPROFILE (common expectation)
161
+ if (!Object.prototype.hasOwnProperty.call(out, 'HOME')) {
162
+ const up = out['USERPROFILE'];
163
+ if (typeof up === 'string' && up.length > 0)
164
+ out['HOME'] = up;
165
+ }
166
+ // Normalize TMP/TEMP coherence (pick any present; reflect to both)
167
+ const tmp = out['TMP'] ?? out['TEMP'];
168
+ if (typeof tmp === 'string' && tmp.length > 0) {
169
+ out['TMP'] = tmp;
170
+ out['TEMP'] = tmp;
171
+ }
172
+ return out;
173
+ }
174
+ // POSIX: keep keys as-is
175
+ const out = Object.fromEntries(entries);
176
+ // Ensure TMPDIR exists when any temp key is present (best-effort)
177
+ const tmpdir = out['TMPDIR'] ?? out['TMP'] ?? out['TEMP'];
178
+ if (typeof tmpdir === 'string' && tmpdir.length > 0) {
179
+ out['TMPDIR'] = tmpdir;
180
+ }
181
+ return out;
182
+ };
183
+
142
184
  /** src/cliHost/definePlugin.ts
143
185
  * Plugin contracts for the GetDotenv CLI host.
144
186
  *
@@ -249,7 +291,7 @@ const demoPlugin = () => definePlugin({
249
291
  const dotenv = (ctx?.dotenv ?? {});
250
292
  // Inherit stdio for an interactive demo. Use --capture for CI.
251
293
  await runCommand(['node', '-e', code], false, {
252
- env: { ...process.env, ...dotenv },
294
+ env: buildSpawnEnv(process.env, dotenv),
253
295
  stdio: 'inherit',
254
296
  });
255
297
  });
@@ -286,20 +328,23 @@ const demoPlugin = () => definePlugin({
286
328
  const ctx = cli.getCtx();
287
329
  const dotenv = (ctx?.dotenv ?? {});
288
330
  await runCommand(resolved, shell, {
289
- env: { ...process.env, ...dotenv },
331
+ env: buildSpawnEnv(process.env, dotenv),
290
332
  stdio: 'inherit',
291
333
  });
292
334
  });
293
335
  },
294
336
  /**
295
337
  * Optional: afterResolve can initialize per-plugin state using ctx.dotenv.
296
- * For the demo we just log once to hint where such logic would live.
338
+ * For the demo we emit a single breadcrumb only when GETDOTENV_DEBUG is set,
339
+ * keeping default runs (tests/CI/smoke) quiet.
297
340
  */
298
341
  afterResolve(_cli, ctx) {
299
- const keys = Object.keys(ctx.dotenv);
300
- if (keys.length > 0) {
301
- // Keep noise low; a single-line breadcrumb is sufficient for the demo.
302
- console.error('[demo] afterResolve: dotenv keys loaded:', keys.length);
342
+ if (process.env.GETDOTENV_DEBUG) {
343
+ const keys = Object.keys(ctx.dotenv);
344
+ if (keys.length > 0) {
345
+ // Keep noise low; a single-line breadcrumb is sufficient for the demo.
346
+ console.error('[demo] afterResolve: dotenv keys loaded:', keys.length);
347
+ }
303
348
  }
304
349
  },
305
350
  });
@@ -1,76 +1,6 @@
1
1
  import { Command } from 'commander';
2
2
  import { ZodType } from 'zod';
3
3
 
4
- /**
5
- * Minimal root options shape shared by CLI and generator layers.
6
- * Keep keys optional to respect exactOptionalPropertyTypes semantics.
7
- */
8
- type RootOptionsShape = {
9
- env?: string;
10
- vars?: string;
11
- command?: string;
12
- outputPath?: string;
13
- shell?: string | boolean;
14
- loadProcess?: boolean;
15
- excludeAll?: boolean;
16
- excludeDynamic?: boolean;
17
- excludeEnv?: boolean;
18
- excludeGlobal?: boolean;
19
- excludePrivate?: boolean;
20
- excludePublic?: boolean;
21
- log?: boolean;
22
- debug?: boolean;
23
- capture?: boolean;
24
- strict?: boolean;
25
- redact?: boolean;
26
- warnEntropy?: boolean;
27
- entropyThreshold?: number;
28
- entropyMinLength?: number;
29
- entropyWhitelist?: string[];
30
- redactPatterns?: string[];
31
- defaultEnv?: string;
32
- dotenvToken?: string;
33
- dynamicPath?: string;
34
- trace?: boolean | string[];
35
- paths?: string;
36
- pathsDelimiter?: string;
37
- pathsDelimiterPattern?: string;
38
- privateToken?: string;
39
- varsDelimiter?: string;
40
- varsDelimiterPattern?: string;
41
- varsAssignor?: string;
42
- varsAssignorPattern?: string;
43
- scripts?: ScriptsTable;
44
- };
45
- /**
46
- * Scripts table shape (configurable shell type).
47
- */
48
- type ScriptsTable<TShell extends string | boolean = string | boolean> = Record<string, string | {
49
- cmd: string;
50
- shell?: TShell;
51
- }>;
52
-
53
- /**
54
- * Adapter-layer augmentation: add chainable helpers to GetDotenvCli without
55
- * coupling the core host to cliCore. Importing this module has side effects:
56
- * it extends the prototype and merges types for consumers.
57
- */
58
- declare module '../cliHost/GetDotenvCli' {
59
- interface GetDotenvCli {
60
- /**
61
- * Attach legacy root flags to this CLI instance. Defaults come from
62
- * baseRootOptionDefaults when none are provided. */
63
- attachRootOptions(defaults?: Partial<RootOptionsShape>, opts?: {
64
- includeCommandOption?: boolean;
65
- }): this;
66
- /**
67
- * Install a preSubcommand hook that merges CLI flags (including parent
68
- * round-trip) and resolves the dotenv context before executing actions.
69
- * Defaults come from baseRootOptionDefaults when none are provided.
70
- */ passOptions(defaults?: Partial<RootOptionsShape>): this;
71
- }
72
- }
73
-
74
4
  /**
75
5
  * A minimal representation of an environment key/value mapping.
76
6
  * Values may be `undefined` to represent "unset". */ type ProcessEnv = Record<string, string | undefined>;
@@ -165,14 +95,6 @@ interface GetDotenvOptions {
165
95
  useConfigLoader?: boolean;
166
96
  }
167
97
 
168
- /** * Per-invocation context shared with plugins and actions. */
169
- type GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> = {
170
- optionsResolved: TOptions;
171
- dotenv: ProcessEnv;
172
- plugins?: Record<string, unknown>;
173
- pluginConfigs?: Record<string, unknown>;
174
- };
175
-
176
98
  /** src/cliHost/definePlugin.ts
177
99
  * Plugin contracts for the GetDotenv CLI host.
178
100
  *
@@ -223,6 +145,14 @@ interface GetDotenvCliPlugin {
223
145
  use: (child: GetDotenvCliPlugin) => GetDotenvCliPlugin;
224
146
  }
225
147
 
148
+ /** * Per-invocation context shared with plugins and actions. */
149
+ type GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> = {
150
+ optionsResolved: TOptions;
151
+ dotenv: ProcessEnv;
152
+ plugins?: Record<string, unknown>;
153
+ pluginConfigs?: Record<string, unknown>;
154
+ };
155
+
226
156
  declare const demoPlugin: () => GetDotenvCliPlugin;
227
157
 
228
158
  export { demoPlugin };
@@ -1,76 +1,6 @@
1
1
  import { Command } from 'commander';
2
2
  import { ZodType } from 'zod';
3
3
 
4
- /**
5
- * Minimal root options shape shared by CLI and generator layers.
6
- * Keep keys optional to respect exactOptionalPropertyTypes semantics.
7
- */
8
- type RootOptionsShape = {
9
- env?: string;
10
- vars?: string;
11
- command?: string;
12
- outputPath?: string;
13
- shell?: string | boolean;
14
- loadProcess?: boolean;
15
- excludeAll?: boolean;
16
- excludeDynamic?: boolean;
17
- excludeEnv?: boolean;
18
- excludeGlobal?: boolean;
19
- excludePrivate?: boolean;
20
- excludePublic?: boolean;
21
- log?: boolean;
22
- debug?: boolean;
23
- capture?: boolean;
24
- strict?: boolean;
25
- redact?: boolean;
26
- warnEntropy?: boolean;
27
- entropyThreshold?: number;
28
- entropyMinLength?: number;
29
- entropyWhitelist?: string[];
30
- redactPatterns?: string[];
31
- defaultEnv?: string;
32
- dotenvToken?: string;
33
- dynamicPath?: string;
34
- trace?: boolean | string[];
35
- paths?: string;
36
- pathsDelimiter?: string;
37
- pathsDelimiterPattern?: string;
38
- privateToken?: string;
39
- varsDelimiter?: string;
40
- varsDelimiterPattern?: string;
41
- varsAssignor?: string;
42
- varsAssignorPattern?: string;
43
- scripts?: ScriptsTable;
44
- };
45
- /**
46
- * Scripts table shape (configurable shell type).
47
- */
48
- type ScriptsTable<TShell extends string | boolean = string | boolean> = Record<string, string | {
49
- cmd: string;
50
- shell?: TShell;
51
- }>;
52
-
53
- /**
54
- * Adapter-layer augmentation: add chainable helpers to GetDotenvCli without
55
- * coupling the core host to cliCore. Importing this module has side effects:
56
- * it extends the prototype and merges types for consumers.
57
- */
58
- declare module '../cliHost/GetDotenvCli' {
59
- interface GetDotenvCli {
60
- /**
61
- * Attach legacy root flags to this CLI instance. Defaults come from
62
- * baseRootOptionDefaults when none are provided. */
63
- attachRootOptions(defaults?: Partial<RootOptionsShape>, opts?: {
64
- includeCommandOption?: boolean;
65
- }): this;
66
- /**
67
- * Install a preSubcommand hook that merges CLI flags (including parent
68
- * round-trip) and resolves the dotenv context before executing actions.
69
- * Defaults come from baseRootOptionDefaults when none are provided.
70
- */ passOptions(defaults?: Partial<RootOptionsShape>): this;
71
- }
72
- }
73
-
74
4
  /**
75
5
  * A minimal representation of an environment key/value mapping.
76
6
  * Values may be `undefined` to represent "unset". */ type ProcessEnv = Record<string, string | undefined>;
@@ -165,14 +95,6 @@ interface GetDotenvOptions {
165
95
  useConfigLoader?: boolean;
166
96
  }
167
97
 
168
- /** * Per-invocation context shared with plugins and actions. */
169
- type GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> = {
170
- optionsResolved: TOptions;
171
- dotenv: ProcessEnv;
172
- plugins?: Record<string, unknown>;
173
- pluginConfigs?: Record<string, unknown>;
174
- };
175
-
176
98
  /** src/cliHost/definePlugin.ts
177
99
  * Plugin contracts for the GetDotenv CLI host.
178
100
  *
@@ -223,6 +145,14 @@ interface GetDotenvCliPlugin {
223
145
  use: (child: GetDotenvCliPlugin) => GetDotenvCliPlugin;
224
146
  }
225
147
 
148
+ /** * Per-invocation context shared with plugins and actions. */
149
+ type GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> = {
150
+ optionsResolved: TOptions;
151
+ dotenv: ProcessEnv;
152
+ plugins?: Record<string, unknown>;
153
+ pluginConfigs?: Record<string, unknown>;
154
+ };
155
+
226
156
  declare const demoPlugin: () => GetDotenvCliPlugin;
227
157
 
228
158
  export { demoPlugin };
@@ -1,76 +1,6 @@
1
1
  import { Command } from 'commander';
2
2
  import { ZodType } from 'zod';
3
3
 
4
- /**
5
- * Minimal root options shape shared by CLI and generator layers.
6
- * Keep keys optional to respect exactOptionalPropertyTypes semantics.
7
- */
8
- type RootOptionsShape = {
9
- env?: string;
10
- vars?: string;
11
- command?: string;
12
- outputPath?: string;
13
- shell?: string | boolean;
14
- loadProcess?: boolean;
15
- excludeAll?: boolean;
16
- excludeDynamic?: boolean;
17
- excludeEnv?: boolean;
18
- excludeGlobal?: boolean;
19
- excludePrivate?: boolean;
20
- excludePublic?: boolean;
21
- log?: boolean;
22
- debug?: boolean;
23
- capture?: boolean;
24
- strict?: boolean;
25
- redact?: boolean;
26
- warnEntropy?: boolean;
27
- entropyThreshold?: number;
28
- entropyMinLength?: number;
29
- entropyWhitelist?: string[];
30
- redactPatterns?: string[];
31
- defaultEnv?: string;
32
- dotenvToken?: string;
33
- dynamicPath?: string;
34
- trace?: boolean | string[];
35
- paths?: string;
36
- pathsDelimiter?: string;
37
- pathsDelimiterPattern?: string;
38
- privateToken?: string;
39
- varsDelimiter?: string;
40
- varsDelimiterPattern?: string;
41
- varsAssignor?: string;
42
- varsAssignorPattern?: string;
43
- scripts?: ScriptsTable;
44
- };
45
- /**
46
- * Scripts table shape (configurable shell type).
47
- */
48
- type ScriptsTable<TShell extends string | boolean = string | boolean> = Record<string, string | {
49
- cmd: string;
50
- shell?: TShell;
51
- }>;
52
-
53
- /**
54
- * Adapter-layer augmentation: add chainable helpers to GetDotenvCli without
55
- * coupling the core host to cliCore. Importing this module has side effects:
56
- * it extends the prototype and merges types for consumers.
57
- */
58
- declare module '../cliHost/GetDotenvCli' {
59
- interface GetDotenvCli {
60
- /**
61
- * Attach legacy root flags to this CLI instance. Defaults come from
62
- * baseRootOptionDefaults when none are provided. */
63
- attachRootOptions(defaults?: Partial<RootOptionsShape>, opts?: {
64
- includeCommandOption?: boolean;
65
- }): this;
66
- /**
67
- * Install a preSubcommand hook that merges CLI flags (including parent
68
- * round-trip) and resolves the dotenv context before executing actions.
69
- * Defaults come from baseRootOptionDefaults when none are provided.
70
- */ passOptions(defaults?: Partial<RootOptionsShape>): this;
71
- }
72
- }
73
-
74
4
  /**
75
5
  * A minimal representation of an environment key/value mapping.
76
6
  * Values may be `undefined` to represent "unset". */ type ProcessEnv = Record<string, string | undefined>;
@@ -165,14 +95,6 @@ interface GetDotenvOptions {
165
95
  useConfigLoader?: boolean;
166
96
  }
167
97
 
168
- /** * Per-invocation context shared with plugins and actions. */
169
- type GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> = {
170
- optionsResolved: TOptions;
171
- dotenv: ProcessEnv;
172
- plugins?: Record<string, unknown>;
173
- pluginConfigs?: Record<string, unknown>;
174
- };
175
-
176
98
  /** src/cliHost/definePlugin.ts
177
99
  * Plugin contracts for the GetDotenv CLI host.
178
100
  *
@@ -223,6 +145,14 @@ interface GetDotenvCliPlugin {
223
145
  use: (child: GetDotenvCliPlugin) => GetDotenvCliPlugin;
224
146
  }
225
147
 
148
+ /** * Per-invocation context shared with plugins and actions. */
149
+ type GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> = {
150
+ optionsResolved: TOptions;
151
+ dotenv: ProcessEnv;
152
+ plugins?: Record<string, unknown>;
153
+ pluginConfigs?: Record<string, unknown>;
154
+ };
155
+
226
156
  declare const demoPlugin: () => GetDotenvCliPlugin;
227
157
 
228
158
  export { demoPlugin };
@@ -137,6 +137,48 @@ const runCommand = async (command, shell, opts) => {
137
137
  }
138
138
  };
139
139
 
140
+ const dropUndefined = (bag) => Object.fromEntries(Object.entries(bag).filter((e) => typeof e[1] === 'string'));
141
+ /** Build a sanitized env for child processes from base + overlay. */
142
+ const buildSpawnEnv = (base, overlay) => {
143
+ const raw = {
144
+ ...(base ?? {}),
145
+ ...(overlay ?? {}),
146
+ };
147
+ // Drop undefined first
148
+ const entries = Object.entries(dropUndefined(raw));
149
+ if (process.platform === 'win32') {
150
+ // Windows: keys are case-insensitive; collapse duplicates
151
+ const byLower = new Map();
152
+ for (const [k, v] of entries) {
153
+ byLower.set(k.toLowerCase(), [k, v]); // last wins; preserve latest casing
154
+ }
155
+ const out = {};
156
+ for (const [, [k, v]] of byLower)
157
+ out[k] = v;
158
+ // HOME fallback from USERPROFILE (common expectation)
159
+ if (!Object.prototype.hasOwnProperty.call(out, 'HOME')) {
160
+ const up = out['USERPROFILE'];
161
+ if (typeof up === 'string' && up.length > 0)
162
+ out['HOME'] = up;
163
+ }
164
+ // Normalize TMP/TEMP coherence (pick any present; reflect to both)
165
+ const tmp = out['TMP'] ?? out['TEMP'];
166
+ if (typeof tmp === 'string' && tmp.length > 0) {
167
+ out['TMP'] = tmp;
168
+ out['TEMP'] = tmp;
169
+ }
170
+ return out;
171
+ }
172
+ // POSIX: keep keys as-is
173
+ const out = Object.fromEntries(entries);
174
+ // Ensure TMPDIR exists when any temp key is present (best-effort)
175
+ const tmpdir = out['TMPDIR'] ?? out['TMP'] ?? out['TEMP'];
176
+ if (typeof tmpdir === 'string' && tmpdir.length > 0) {
177
+ out['TMPDIR'] = tmpdir;
178
+ }
179
+ return out;
180
+ };
181
+
140
182
  /** src/cliHost/definePlugin.ts
141
183
  * Plugin contracts for the GetDotenv CLI host.
142
184
  *
@@ -247,7 +289,7 @@ const demoPlugin = () => definePlugin({
247
289
  const dotenv = (ctx?.dotenv ?? {});
248
290
  // Inherit stdio for an interactive demo. Use --capture for CI.
249
291
  await runCommand(['node', '-e', code], false, {
250
- env: { ...process.env, ...dotenv },
292
+ env: buildSpawnEnv(process.env, dotenv),
251
293
  stdio: 'inherit',
252
294
  });
253
295
  });
@@ -284,20 +326,23 @@ const demoPlugin = () => definePlugin({
284
326
  const ctx = cli.getCtx();
285
327
  const dotenv = (ctx?.dotenv ?? {});
286
328
  await runCommand(resolved, shell, {
287
- env: { ...process.env, ...dotenv },
329
+ env: buildSpawnEnv(process.env, dotenv),
288
330
  stdio: 'inherit',
289
331
  });
290
332
  });
291
333
  },
292
334
  /**
293
335
  * Optional: afterResolve can initialize per-plugin state using ctx.dotenv.
294
- * For the demo we just log once to hint where such logic would live.
336
+ * For the demo we emit a single breadcrumb only when GETDOTENV_DEBUG is set,
337
+ * keeping default runs (tests/CI/smoke) quiet.
295
338
  */
296
339
  afterResolve(_cli, ctx) {
297
- const keys = Object.keys(ctx.dotenv);
298
- if (keys.length > 0) {
299
- // Keep noise low; a single-line breadcrumb is sufficient for the demo.
300
- console.error('[demo] afterResolve: dotenv keys loaded:', keys.length);
340
+ if (process.env.GETDOTENV_DEBUG) {
341
+ const keys = Object.keys(ctx.dotenv);
342
+ if (keys.length > 0) {
343
+ // Keep noise low; a single-line breadcrumb is sufficient for the demo.
344
+ console.error('[demo] afterResolve: dotenv keys loaded:', keys.length);
345
+ }
301
346
  }
302
347
  },
303
348
  });
@@ -1,76 +1,6 @@
1
1
  import { Command } from 'commander';
2
2
  import { ZodType } from 'zod';
3
3
 
4
- /**
5
- * Minimal root options shape shared by CLI and generator layers.
6
- * Keep keys optional to respect exactOptionalPropertyTypes semantics.
7
- */
8
- type RootOptionsShape = {
9
- env?: string;
10
- vars?: string;
11
- command?: string;
12
- outputPath?: string;
13
- shell?: string | boolean;
14
- loadProcess?: boolean;
15
- excludeAll?: boolean;
16
- excludeDynamic?: boolean;
17
- excludeEnv?: boolean;
18
- excludeGlobal?: boolean;
19
- excludePrivate?: boolean;
20
- excludePublic?: boolean;
21
- log?: boolean;
22
- debug?: boolean;
23
- capture?: boolean;
24
- strict?: boolean;
25
- redact?: boolean;
26
- warnEntropy?: boolean;
27
- entropyThreshold?: number;
28
- entropyMinLength?: number;
29
- entropyWhitelist?: string[];
30
- redactPatterns?: string[];
31
- defaultEnv?: string;
32
- dotenvToken?: string;
33
- dynamicPath?: string;
34
- trace?: boolean | string[];
35
- paths?: string;
36
- pathsDelimiter?: string;
37
- pathsDelimiterPattern?: string;
38
- privateToken?: string;
39
- varsDelimiter?: string;
40
- varsDelimiterPattern?: string;
41
- varsAssignor?: string;
42
- varsAssignorPattern?: string;
43
- scripts?: ScriptsTable;
44
- };
45
- /**
46
- * Scripts table shape (configurable shell type).
47
- */
48
- type ScriptsTable<TShell extends string | boolean = string | boolean> = Record<string, string | {
49
- cmd: string;
50
- shell?: TShell;
51
- }>;
52
-
53
- /**
54
- * Adapter-layer augmentation: add chainable helpers to GetDotenvCli without
55
- * coupling the core host to cliCore. Importing this module has side effects:
56
- * it extends the prototype and merges types for consumers.
57
- */
58
- declare module '../cliHost/GetDotenvCli' {
59
- interface GetDotenvCli {
60
- /**
61
- * Attach legacy root flags to this CLI instance. Defaults come from
62
- * baseRootOptionDefaults when none are provided. */
63
- attachRootOptions(defaults?: Partial<RootOptionsShape>, opts?: {
64
- includeCommandOption?: boolean;
65
- }): this;
66
- /**
67
- * Install a preSubcommand hook that merges CLI flags (including parent
68
- * round-trip) and resolves the dotenv context before executing actions.
69
- * Defaults come from baseRootOptionDefaults when none are provided.
70
- */ passOptions(defaults?: Partial<RootOptionsShape>): this;
71
- }
72
- }
73
-
74
4
  /**
75
5
  * A minimal representation of an environment key/value mapping.
76
6
  * Values may be `undefined` to represent "unset". */ type ProcessEnv = Record<string, string | undefined>;
@@ -165,14 +95,6 @@ interface GetDotenvOptions {
165
95
  useConfigLoader?: boolean;
166
96
  }
167
97
 
168
- /** * Per-invocation context shared with plugins and actions. */
169
- type GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> = {
170
- optionsResolved: TOptions;
171
- dotenv: ProcessEnv;
172
- plugins?: Record<string, unknown>;
173
- pluginConfigs?: Record<string, unknown>;
174
- };
175
-
176
98
  /** src/cliHost/definePlugin.ts
177
99
  * Plugin contracts for the GetDotenv CLI host.
178
100
  *
@@ -223,6 +145,14 @@ interface GetDotenvCliPlugin {
223
145
  use: (child: GetDotenvCliPlugin) => GetDotenvCliPlugin;
224
146
  }
225
147
 
148
+ /** * Per-invocation context shared with plugins and actions. */
149
+ type GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> = {
150
+ optionsResolved: TOptions;
151
+ dotenv: ProcessEnv;
152
+ plugins?: Record<string, unknown>;
153
+ pluginConfigs?: Record<string, unknown>;
154
+ };
155
+
226
156
  type InitPluginOptions = {
227
157
  logger?: Logger;
228
158
  };