@karmaniverous/get-dotenv 5.2.3 → 5.2.5

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 (43) hide show
  1. package/README.md +5 -5
  2. package/dist/cliHost.cjs +422 -21
  3. package/dist/cliHost.d.cts +95 -8
  4. package/dist/cliHost.d.mts +95 -8
  5. package/dist/cliHost.d.ts +95 -8
  6. package/dist/cliHost.mjs +423 -22
  7. package/dist/getdotenv.cli.mjs +10 -6
  8. package/dist/index.cjs +11 -6
  9. package/dist/index.d.cts +19 -1
  10. package/dist/index.d.mts +19 -1
  11. package/dist/index.d.ts +19 -1
  12. package/dist/index.mjs +11 -7
  13. package/dist/plugins-aws.cjs +7 -0
  14. package/dist/plugins-aws.d.cts +99 -162
  15. package/dist/plugins-aws.d.mts +99 -162
  16. package/dist/plugins-aws.d.ts +99 -162
  17. package/dist/plugins-aws.mjs +7 -0
  18. package/dist/plugins-batch.cjs +7 -0
  19. package/dist/plugins-batch.d.cts +99 -162
  20. package/dist/plugins-batch.d.mts +99 -162
  21. package/dist/plugins-batch.d.ts +99 -162
  22. package/dist/plugins-batch.mjs +7 -0
  23. package/dist/plugins-cmd.cjs +9 -5
  24. package/dist/plugins-cmd.d.cts +99 -162
  25. package/dist/plugins-cmd.d.mts +99 -162
  26. package/dist/plugins-cmd.d.ts +99 -162
  27. package/dist/plugins-cmd.mjs +9 -5
  28. package/dist/plugins-demo.cjs +7 -0
  29. package/dist/plugins-demo.d.cts +99 -162
  30. package/dist/plugins-demo.d.mts +99 -162
  31. package/dist/plugins-demo.d.ts +99 -162
  32. package/dist/plugins-demo.mjs +7 -0
  33. package/dist/plugins-init.cjs +7 -0
  34. package/dist/plugins-init.d.cts +99 -162
  35. package/dist/plugins-init.d.mts +99 -162
  36. package/dist/plugins-init.d.ts +99 -162
  37. package/dist/plugins-init.mjs +7 -0
  38. package/dist/plugins.cjs +9 -5
  39. package/dist/plugins.d.cts +99 -162
  40. package/dist/plugins.d.mts +99 -162
  41. package/dist/plugins.d.ts +99 -162
  42. package/dist/plugins.mjs +9 -5
  43. package/package.json +1 -1
@@ -1,6 +1,47 @@
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
+ };
4
45
  /**
5
46
  * Scripts table shape (configurable shell type).
6
47
  */
@@ -9,6 +50,27 @@ type ScriptsTable<TShell extends string | boolean = string | boolean> = Record<s
9
50
  shell?: TShell;
10
51
  }>;
11
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
+
12
74
  /**
13
75
  * A minimal representation of an environment key/value mapping.
14
76
  * Values may be `undefined` to represent "unset". */ type ProcessEnv = Record<string, string | undefined>;
@@ -269,17 +331,41 @@ declare class GetDotenvCli<TOptions extends GetDotenvOptions = GetDotenvOptions>
269
331
  private _runAfterResolve;
270
332
  }
271
333
 
272
- /** Public plugin contract used by the GetDotenv CLI host. */ interface GetDotenvCliPlugin {
273
- id?: string /**
274
- * Setup phase: register commands and wiring on the provided CLI instance. * Runs parent → children (pre-order).
275
- */;
276
- setup: (cli: GetDotenvCli) => void | Promise<void>;
334
+ /** src/cliHost/definePlugin.ts
335
+ * Plugin contracts for the GetDotenv CLI host.
336
+ *
337
+ * This module exposes a structural public interface for the host that plugins
338
+ * should use (GetDotenvCliPublic). Using a structural type at the seam avoids
339
+ * nominal class identity issues (private fields) in downstream consumers.
340
+ */
341
+
342
+ /**
343
+ * Structural public interface for the host exposed to plugins.
344
+ * - Extends Commander.Command so plugins can attach options/commands/hooks.
345
+ * - Adds host-specific helpers used by built-in plugins.
346
+ *
347
+ * Purpose: remove nominal class identity (private fields) from the plugin seam
348
+ * to avoid TS2379 under exactOptionalPropertyTypes in downstream consumers.
349
+ */
350
+ type GetDotenvCliPublic<TOptions extends GetDotenvOptions = GetDotenvOptions> = Command & {
351
+ ns: (name: string) => Command;
352
+ getCtx: () => GetDotenvCliCtx<TOptions> | undefined;
353
+ resolveAndLoad: (customOptions?: Partial<TOptions>) => Promise<GetDotenvCliCtx<TOptions>>;
354
+ };
355
+ /** Public plugin contract used by the GetDotenv CLI host. */
356
+ interface GetDotenvCliPlugin {
357
+ id?: string;
358
+ /**
359
+ * Setup phase: register commands and wiring on the provided CLI instance.
360
+ * Runs parent → children (pre-order).
361
+ */
362
+ setup: (cli: GetDotenvCliPublic) => void | Promise<void>;
277
363
  /**
278
364
  * After the dotenv context is resolved, initialize any clients/secrets
279
365
  * or attach per-plugin state under ctx.plugins (by convention).
280
366
  * Runs parent → children (pre-order).
281
367
  */
282
- afterResolve?: (cli: GetDotenvCli, ctx: GetDotenvCliCtx) => void | Promise<void>;
368
+ afterResolve?: (cli: GetDotenvCliPublic, ctx: GetDotenvCliCtx) => void | Promise<void>;
283
369
  /**
284
370
  * Optional Zod schema for this plugin's config slice (from config.plugins[id]).
285
371
  * When provided, the host validates the merged config under the guarded loader path.
@@ -287,7 +373,8 @@ declare class GetDotenvCli<TOptions extends GetDotenvOptions = GetDotenvOptions>
287
373
  configSchema?: ZodType;
288
374
  /**
289
375
  * Compositional children. Installed after the parent per pre-order.
290
- */ children: GetDotenvCliPlugin[];
376
+ */
377
+ children: GetDotenvCliPlugin[];
291
378
  /**
292
379
  * Compose a child plugin. Returns the parent to enable chaining.
293
380
  */
@@ -317,4 +404,4 @@ declare const definePlugin: (spec: DefineSpec) => GetDotenvCliPlugin;
317
404
  declare const readMergedOptions: (cmd: Command) => GetDotenvCliOptions | undefined;
318
405
 
319
406
  export { GetDotenvCli, definePlugin, readMergedOptions };
320
- export type { DefineSpec, GetDotenvCliCtx, GetDotenvCliOptions, GetDotenvCliPlugin, ScriptsTable };
407
+ export type { DefineSpec, GetDotenvCliCtx, GetDotenvCliOptions, GetDotenvCliPlugin, GetDotenvCliPublic, ScriptsTable };
package/dist/cliHost.d.ts CHANGED
@@ -1,6 +1,47 @@
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
+ };
4
45
  /**
5
46
  * Scripts table shape (configurable shell type).
6
47
  */
@@ -9,6 +50,27 @@ type ScriptsTable<TShell extends string | boolean = string | boolean> = Record<s
9
50
  shell?: TShell;
10
51
  }>;
11
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
+
12
74
  /**
13
75
  * A minimal representation of an environment key/value mapping.
14
76
  * Values may be `undefined` to represent "unset". */ type ProcessEnv = Record<string, string | undefined>;
@@ -269,17 +331,41 @@ declare class GetDotenvCli<TOptions extends GetDotenvOptions = GetDotenvOptions>
269
331
  private _runAfterResolve;
270
332
  }
271
333
 
272
- /** Public plugin contract used by the GetDotenv CLI host. */ interface GetDotenvCliPlugin {
273
- id?: string /**
274
- * Setup phase: register commands and wiring on the provided CLI instance. * Runs parent → children (pre-order).
275
- */;
276
- setup: (cli: GetDotenvCli) => void | Promise<void>;
334
+ /** src/cliHost/definePlugin.ts
335
+ * Plugin contracts for the GetDotenv CLI host.
336
+ *
337
+ * This module exposes a structural public interface for the host that plugins
338
+ * should use (GetDotenvCliPublic). Using a structural type at the seam avoids
339
+ * nominal class identity issues (private fields) in downstream consumers.
340
+ */
341
+
342
+ /**
343
+ * Structural public interface for the host exposed to plugins.
344
+ * - Extends Commander.Command so plugins can attach options/commands/hooks.
345
+ * - Adds host-specific helpers used by built-in plugins.
346
+ *
347
+ * Purpose: remove nominal class identity (private fields) from the plugin seam
348
+ * to avoid TS2379 under exactOptionalPropertyTypes in downstream consumers.
349
+ */
350
+ type GetDotenvCliPublic<TOptions extends GetDotenvOptions = GetDotenvOptions> = Command & {
351
+ ns: (name: string) => Command;
352
+ getCtx: () => GetDotenvCliCtx<TOptions> | undefined;
353
+ resolveAndLoad: (customOptions?: Partial<TOptions>) => Promise<GetDotenvCliCtx<TOptions>>;
354
+ };
355
+ /** Public plugin contract used by the GetDotenv CLI host. */
356
+ interface GetDotenvCliPlugin {
357
+ id?: string;
358
+ /**
359
+ * Setup phase: register commands and wiring on the provided CLI instance.
360
+ * Runs parent → children (pre-order).
361
+ */
362
+ setup: (cli: GetDotenvCliPublic) => void | Promise<void>;
277
363
  /**
278
364
  * After the dotenv context is resolved, initialize any clients/secrets
279
365
  * or attach per-plugin state under ctx.plugins (by convention).
280
366
  * Runs parent → children (pre-order).
281
367
  */
282
- afterResolve?: (cli: GetDotenvCli, ctx: GetDotenvCliCtx) => void | Promise<void>;
368
+ afterResolve?: (cli: GetDotenvCliPublic, ctx: GetDotenvCliCtx) => void | Promise<void>;
283
369
  /**
284
370
  * Optional Zod schema for this plugin's config slice (from config.plugins[id]).
285
371
  * When provided, the host validates the merged config under the guarded loader path.
@@ -287,7 +373,8 @@ declare class GetDotenvCli<TOptions extends GetDotenvOptions = GetDotenvOptions>
287
373
  configSchema?: ZodType;
288
374
  /**
289
375
  * Compositional children. Installed after the parent per pre-order.
290
- */ children: GetDotenvCliPlugin[];
376
+ */
377
+ children: GetDotenvCliPlugin[];
291
378
  /**
292
379
  * Compose a child plugin. Returns the parent to enable chaining.
293
380
  */
@@ -317,4 +404,4 @@ declare const definePlugin: (spec: DefineSpec) => GetDotenvCliPlugin;
317
404
  declare const readMergedOptions: (cmd: Command) => GetDotenvCliOptions | undefined;
318
405
 
319
406
  export { GetDotenvCli, definePlugin, readMergedOptions };
320
- export type { DefineSpec, GetDotenvCliCtx, GetDotenvCliOptions, GetDotenvCliPlugin, ScriptsTable };
407
+ export type { DefineSpec, GetDotenvCliCtx, GetDotenvCliOptions, GetDotenvCliPlugin, GetDotenvCliPublic, ScriptsTable };