@karmaniverous/get-dotenv 6.1.1 → 6.2.1

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/index.mjs CHANGED
@@ -39,26 +39,58 @@ import { versions, env } from 'process';
39
39
  * Minimal process env representation used by options and helpers.
40
40
  * Values may be `undefined` to indicate "unset".
41
41
  */
42
+ /**
43
+ * Schema for an env-like record.
44
+ *
45
+ * Keys are environment variable names and values are either strings or `undefined`
46
+ * (to represent “unset”).
47
+ *
48
+ * @public
49
+ */
42
50
  const processEnvSchema = z$2.record(z$2.string(), z$2.string().optional());
43
51
  // RAW: all fields optional — undefined means "inherit" from lower layers.
52
+ /**
53
+ * Programmatic options schema (raw).
54
+ *
55
+ * This schema is the canonical runtime source of truth for the `getDotenv()` programmatic API.
56
+ * All fields are optional; `undefined` generally means “inherit default/lower layer”.
57
+ *
58
+ * @public
59
+ */
44
60
  const getDotenvOptionsSchemaRaw = z$2.object({
61
+ /** Default environment name when `env` is not provided. */
45
62
  defaultEnv: z$2.string().optional(),
63
+ /** Base dotenv filename token (default `.env`). */
46
64
  dotenvToken: z$2.string().optional(),
65
+ /** Path to a dynamic variables module (JS/TS) to load and apply. */
47
66
  dynamicPath: z$2.string().optional(),
48
- // Dynamic map is intentionally wide for now; refine once sources are normalized.
67
+ /** Dynamic map is intentionally wide for now; refine once sources are normalized. */
49
68
  dynamic: z$2.record(z$2.string(), z$2.unknown()).optional(),
69
+ /** Selected environment name for this invocation (for env-scoped files and overlays). */
50
70
  env: z$2.string().optional(),
71
+ /** When true, skip applying dynamic variables. */
51
72
  excludeDynamic: z$2.boolean().optional(),
73
+ /** When true, skip environment-scoped dotenv files. */
52
74
  excludeEnv: z$2.boolean().optional(),
75
+ /** When true, skip global dotenv files. */
53
76
  excludeGlobal: z$2.boolean().optional(),
77
+ /** When true, skip private dotenv files. */
54
78
  excludePrivate: z$2.boolean().optional(),
79
+ /** When true, skip public dotenv files. */
55
80
  excludePublic: z$2.boolean().optional(),
81
+ /** When true, merge the final composed environment into `process.env`. */
56
82
  loadProcess: z$2.boolean().optional(),
83
+ /** When true, log the final environment map via `logger`. */
57
84
  log: z$2.boolean().optional(),
85
+ /** Logger used when `log` is enabled (console-compatible). */
58
86
  logger: z$2.unknown().default(console),
87
+ /** Optional output dotenv file path to write after composition. */
59
88
  outputPath: z$2.string().optional(),
89
+ /** Dotenv search paths (ordered). */
60
90
  paths: z$2.array(z$2.string()).optional(),
91
+ /** Private token suffix for private dotenv files (default `local`). */
61
92
  privateToken: z$2.string().optional(),
93
+ /** Explicit variables to overlay onto the composed dotenv map. */
62
94
  vars: processEnvSchema.optional(),
63
95
  });
64
96
  /**
@@ -66,6 +98,14 @@ const getDotenvOptionsSchemaRaw = z$2.object({
66
98
  * For now, this mirrors the RAW schema; future stages may materialize defaults
67
99
  * and narrow shapes as resolution is wired into the host.
68
100
  */
101
+ /**
102
+ * Programmatic options schema (resolved).
103
+ *
104
+ * Today this mirrors {@link getDotenvOptionsSchemaRaw}, but is kept as a distinct export
105
+ * so future resolution steps can narrow or materialize defaults without breaking the API.
106
+ *
107
+ * @public
108
+ */
69
109
  const getDotenvOptionsSchemaResolved = getDotenvOptionsSchemaRaw;
70
110
 
71
111
  /**
@@ -75,27 +115,55 @@ const getDotenvOptionsSchemaResolved = getDotenvOptionsSchemaRaw;
75
115
  * reflect normalized types (paths: string[], vars: ProcessEnv), applied in the
76
116
  * CLI resolution pipeline.
77
117
  */
118
+ /**
119
+ * CLI options schema (raw).
120
+ *
121
+ * Extends the programmatic options schema with CLI-only flags and stringly inputs
122
+ * which are normalized later by the host resolution pipeline.
123
+ *
124
+ * @public
125
+ */
78
126
  const getDotenvCliOptionsSchemaRaw = getDotenvOptionsSchemaRaw.extend({
79
127
  // CLI-specific fields (stringly inputs before preprocessing)
128
+ /** Enable verbose debug output (host-specific). */
80
129
  debug: z$2.boolean().optional(),
130
+ /** Fail on validation errors (schema/requiredKeys). */
81
131
  strict: z$2.boolean().optional(),
132
+ /** Capture child process stdio (useful for CI/tests). */
82
133
  capture: z$2.boolean().optional(),
134
+ /** Emit child env diagnostics (boolean or selected keys). */
83
135
  trace: z$2.union([z$2.boolean(), z$2.array(z$2.string())]).optional(),
136
+ /** Enable presentation-time redaction in trace/log output. */
84
137
  redact: z$2.boolean().optional(),
138
+ /** Enable entropy warnings in trace/log output. */
85
139
  warnEntropy: z$2.boolean().optional(),
140
+ /** Entropy threshold (bits/char) for warnings. */
86
141
  entropyThreshold: z$2.number().optional(),
142
+ /** Minimum value length to consider for entropy warnings. */
87
143
  entropyMinLength: z$2.number().optional(),
144
+ /** Regex patterns (strings) to suppress entropy warnings by key. */
88
145
  entropyWhitelist: z$2.array(z$2.string()).optional(),
146
+ /** Additional key-match patterns (strings) for redaction. */
89
147
  redactPatterns: z$2.array(z$2.string()).optional(),
148
+ /** Dotenv search paths provided as a single delimited string. */
90
149
  paths: z$2.string().optional(),
150
+ /** Delimiter string used to split `paths`. */
91
151
  pathsDelimiter: z$2.string().optional(),
152
+ /** Regex pattern used to split `paths` (takes precedence over delimiter). */
92
153
  pathsDelimiterPattern: z$2.string().optional(),
154
+ /** Scripts table in a permissive shape at parse time (validated elsewhere). */
93
155
  scripts: z$2.record(z$2.string(), z$2.unknown()).optional(),
156
+ /** Shell selection (`false` for shell-off, string for explicit shell). */
94
157
  shell: z$2.union([z$2.boolean(), z$2.string()]).optional(),
158
+ /** Extra variables expressed as a single delimited string of assignments. */
95
159
  vars: z$2.string().optional(),
160
+ /** Assignment operator used when parsing `vars`. */
96
161
  varsAssignor: z$2.string().optional(),
162
+ /** Regex pattern used as the assignment operator for `vars` parsing. */
97
163
  varsAssignorPattern: z$2.string().optional(),
164
+ /** Delimiter string used to split `vars`. */
98
165
  varsDelimiter: z$2.string().optional(),
166
+ /** Regex pattern used to split `vars` (takes precedence over delimiter). */
99
167
  varsDelimiterPattern: z$2.string().optional(),
100
168
  });
101
169
 
@@ -119,17 +187,34 @@ const envStringMap = z$2.record(z$2.string(), stringMap);
119
187
  * Raw configuration schema for get‑dotenv config files (JSON/YAML/JS/TS).
120
188
  * Validates allowed top‑level keys without performing path normalization.
121
189
  */
190
+ /**
191
+ * Config schema for discovered get-dotenv configuration documents (raw).
192
+ *
193
+ * This schema validates the allowed top-level keys for configuration files.
194
+ * It does not normalize paths or coerce types beyond Zod’s parsing.
195
+ *
196
+ * @public
197
+ */
122
198
  const getDotenvConfigSchemaRaw = z$2.object({
199
+ /** Root option defaults applied by the host (CLI-like, collapsed families). */
123
200
  rootOptionDefaults: getDotenvCliOptionsSchemaRaw.optional(),
201
+ /** Help-time visibility map for root flags (false hides). */
124
202
  rootOptionVisibility: visibilityMap.optional(),
125
- scripts: z$2.record(z$2.string(), z$2.unknown()).optional(), // Scripts validation left wide; generator validates elsewhere
203
+ /** Scripts table used by cmd/batch resolution (validation intentionally permissive here). */
204
+ scripts: z$2.record(z$2.string(), z$2.unknown()).optional(),
205
+ /** Keys required to be present in the final composed environment. */
126
206
  requiredKeys: z$2.array(z$2.string()).optional(),
207
+ /** Validation schema (JS/TS only; JSON/YAML loader rejects). */
127
208
  schema: z$2.unknown().optional(), // JS/TS-only; loader rejects in JSON/YAML
209
+ /** Public global variables (string-only). */
128
210
  vars: stringMap.optional(), // public, global
211
+ /** Public per-environment variables (string-only). */
129
212
  envVars: envStringMap.optional(), // public, per-env
130
213
  // Dynamic in config (JS/TS only). JSON/YAML loader will reject if set.
214
+ /** Dynamic variable definitions (JS/TS only). */
131
215
  dynamic: z$2.unknown().optional(),
132
216
  // Per-plugin config bag; validated by plugins/host when used.
217
+ /** Per-plugin config slices keyed by realized mount path (for example, `aws/whoami`). */
133
218
  plugins: z$2.record(z$2.string(), z$2.unknown()).optional(),
134
219
  });
135
220
  /**
@@ -1031,13 +1116,21 @@ function traceChildEnv(opts) {
1031
1116
  * Base root CLI defaults (shared; kept untyped here to avoid cross-layer deps).
1032
1117
  * Used as the bottom layer for CLI option resolution.
1033
1118
  */
1119
+ const baseScripts = {
1120
+ 'git-status': {
1121
+ cmd: 'git branch --show-current && git status -s -u',
1122
+ shell: true,
1123
+ },
1124
+ };
1034
1125
  /**
1035
- * Default values for root CLI options used by the host and helpers as the
1036
- * baseline layer during option resolution.
1126
+ * Default values for root CLI options used by the host and helpers as the baseline layer during option resolution.
1037
1127
  *
1038
- * These defaults correspond to the "stringly" root surface (see `RootOptionsShape`)
1039
- * and are merged by precedence with create-time overrides and any discovered
1040
- * configuration `rootOptionDefaults` before CLI flags are applied.
1128
+ * These defaults correspond to the stringly root surface (see `RootOptionsShape`) and are merged by precedence with:
1129
+ * - create-time overrides
1130
+ * - any discovered configuration `rootOptionDefaults`
1131
+ * - and finally CLI flags at runtime
1132
+ *
1133
+ * @public
1041
1134
  */
1042
1135
  const baseRootOptionDefaults = {
1043
1136
  dotenvToken: '.env',
@@ -1051,12 +1144,7 @@ const baseRootOptionDefaults = {
1051
1144
  paths: './',
1052
1145
  pathsDelimiter: ' ',
1053
1146
  privateToken: 'local',
1054
- scripts: {
1055
- 'git-status': {
1056
- cmd: 'git branch --show-current && git status -s -u',
1057
- shell: true,
1058
- },
1059
- },
1147
+ scripts: baseScripts,
1060
1148
  shell: true,
1061
1149
  vars: '',
1062
1150
  varsAssignor: '=',
@@ -1624,6 +1712,14 @@ async function _execNormalized(command, shell, opts = {}) {
1624
1712
  return out;
1625
1713
  }
1626
1714
  }
1715
+ /**
1716
+ * Execute a command and capture stdout/stderr (buffered).
1717
+ *
1718
+ * @param command - Command string (shell) or argv array (shell-off supported).
1719
+ * @param shell - Shell setting (false for plain execution).
1720
+ * @param opts - Execution options (cwd/env/timeout).
1721
+ * @returns A promise resolving to the captured result.
1722
+ */
1627
1723
  async function runCommandResult(command, shell, opts = {}) {
1628
1724
  // Build opts without injecting undefined (exactOptionalPropertyTypes-safe)
1629
1725
  const coreOpts = { stdio: 'pipe' };
@@ -1638,6 +1734,14 @@ async function runCommandResult(command, shell, opts = {}) {
1638
1734
  }
1639
1735
  return _execNormalized(command, shell, coreOpts);
1640
1736
  }
1737
+ /**
1738
+ * Execute a command and return its exit code.
1739
+ *
1740
+ * @param command - Command string (shell) or argv array (shell-off supported).
1741
+ * @param shell - Shell setting (false for plain execution).
1742
+ * @param opts - Execution options (cwd/env/stdio).
1743
+ * @returns A promise resolving to the process exit code.
1744
+ */
1641
1745
  async function runCommand(command, shell, opts) {
1642
1746
  // Build opts without injecting undefined (exactOptionalPropertyTypes-safe)
1643
1747
  const callOpts = {};
@@ -2097,6 +2201,16 @@ function evaluateDynamicOptions(root, resolved) {
2097
2201
  visit(root);
2098
2202
  }
2099
2203
 
2204
+ /**
2205
+ * Initialize a {@link GetDotenvCli} instance with help configuration and safe defaults.
2206
+ *
2207
+ * @remarks
2208
+ * This is a low-level initializer used by the host constructor to keep `GetDotenvCli.ts`
2209
+ * small and to centralize help/output behavior.
2210
+ *
2211
+ * @param cli - The CLI instance to initialize.
2212
+ * @param headerGetter - Callback returning an optional help header string.
2213
+ */
2100
2214
  function initializeInstance(cli, headerGetter) {
2101
2215
  // Configure grouped help: show only base options in default "Options";
2102
2216
  // subcommands show all of their own options.
@@ -2520,6 +2634,56 @@ class GetDotenvCli extends Command$1 {
2520
2634
  */
2521
2635
  const baseGetDotenvCliOptions = baseRootOptionDefaults;
2522
2636
 
2637
+ /**
2638
+ * Create a namespace-only parent plugin (a group command) for composing plugins
2639
+ * under a shared prefix.
2640
+ *
2641
+ * This is a convenience wrapper around {@link definePlugin} that performs no
2642
+ * action by default and exists only for command organization.
2643
+ *
2644
+ * @example
2645
+ * ```ts
2646
+ * program.use(
2647
+ * groupPlugins({
2648
+ * ns: 'getdotenv',
2649
+ * description: 'getdotenv utility functions',
2650
+ * aliases: ['gd'],
2651
+ * }).use(initPlugin()),
2652
+ * );
2653
+ * ```
2654
+ *
2655
+ * @typeParam TOptions - The host option bag type.
2656
+ * @param options - Group plugin options.
2657
+ * @returns A plugin instance that can `.use(...)` child plugins.
2658
+ *
2659
+ * @public
2660
+ */
2661
+ function groupPlugins(options) {
2662
+ const ns = typeof options.ns === 'string' && options.ns.trim().length > 0
2663
+ ? options.ns.trim()
2664
+ : '';
2665
+ if (!ns)
2666
+ throw new Error('groupPlugins: options.ns must be a non-empty string.');
2667
+ return definePlugin({
2668
+ ns,
2669
+ async setup(cli) {
2670
+ if (typeof options.description === 'string')
2671
+ cli.description(options.description);
2672
+ if (typeof options.summary === 'string')
2673
+ cli.summary(options.summary);
2674
+ if (typeof options.helpGroup === 'string')
2675
+ cli.helpGroup(options.helpGroup);
2676
+ if (Array.isArray(options.aliases) && options.aliases.length > 0) {
2677
+ cli.aliases(options.aliases);
2678
+ }
2679
+ if (typeof options.configure === 'function') {
2680
+ await options.configure(cli);
2681
+ }
2682
+ return undefined;
2683
+ },
2684
+ });
2685
+ }
2686
+
2523
2687
  /**
2524
2688
  * Build a help-time configuration bag for dynamic option descriptions.
2525
2689
  * Centralizes construction and reduces inline casts at call sites.
@@ -3546,16 +3710,29 @@ function attachAwsPreSubcommandHook(cli, plugin) {
3546
3710
  }
3547
3711
 
3548
3712
  /**
3549
- * Zod schema for AWS plugin configuration.
3713
+ * AWS plugin configuration schema.
3714
+ *
3715
+ * @remarks
3716
+ * This Zod schema is used by the host to validate the `plugins.aws` config slice.
3717
+ *
3718
+ * @public
3550
3719
  */
3551
3720
  const awsPluginConfigSchema = z$2.object({
3721
+ /** Preferred AWS profile name (overrides dotenv-derived profile keys when set). */
3552
3722
  profile: z$2.string().optional(),
3723
+ /** Preferred AWS region (overrides dotenv-derived region key when set). */
3553
3724
  region: z$2.string().optional(),
3725
+ /** Fallback region when region cannot be resolved from config/dotenv/AWS CLI. */
3554
3726
  defaultRegion: z$2.string().optional(),
3727
+ /** Dotenv/config key for local profile lookup (default `AWS_LOCAL_PROFILE`). */
3555
3728
  profileKey: z$2.string().default('AWS_LOCAL_PROFILE').optional(),
3729
+ /** Dotenv/config fallback key for profile lookup (default `AWS_PROFILE`). */
3556
3730
  profileFallbackKey: z$2.string().default('AWS_PROFILE').optional(),
3731
+ /** Dotenv/config key for region lookup (default `AWS_REGION`). */
3557
3732
  regionKey: z$2.string().default('AWS_REGION').optional(),
3733
+ /** Credential acquisition strategy (`cli-export` to resolve via AWS CLI, or `none` to skip). */
3558
3734
  strategy: z$2.enum(['cli-export', 'none']).default('cli-export').optional(),
3735
+ /** When true, attempt `aws sso login` on-demand when credential export fails for an SSO profile. */
3559
3736
  loginOnDemand: z$2.boolean().default(false).optional(),
3560
3737
  });
3561
3738
 
@@ -14507,7 +14684,9 @@ function attachBatchOptions(plugin, cli) {
14507
14684
  const ScriptSchema = z$2.union([
14508
14685
  z$2.string(),
14509
14686
  z$2.object({
14687
+ /** Command string to execute. */
14510
14688
  cmd: z$2.string(),
14689
+ /** Optional shell override for this script entry. */
14511
14690
  shell: z$2.union([z$2.string(), z$2.boolean()]).optional(),
14512
14691
  }),
14513
14692
  ]);
@@ -14515,10 +14694,15 @@ const ScriptSchema = z$2.union([
14515
14694
  * Zod schema for batch plugin configuration.
14516
14695
  */
14517
14696
  const batchPluginConfigSchema = z$2.object({
14697
+ /** Optional scripts table scoped to the batch plugin. */
14518
14698
  scripts: z$2.record(z$2.string(), ScriptSchema).optional(),
14699
+ /** Optional default shell for batch execution (overridden by per-script shell when present). */
14519
14700
  shell: z$2.union([z$2.string(), z$2.boolean()]).optional(),
14701
+ /** Root path for discovery, relative to CWD (or package root when pkgCwd is true). */
14520
14702
  rootPath: z$2.string().optional(),
14703
+ /** Space-delimited glob patterns used to discover directories. */
14521
14704
  globs: z$2.string().optional(),
14705
+ /** When true, resolve the batch root from the nearest package directory. */
14522
14706
  pkgCwd: z$2.boolean().optional(),
14523
14707
  });
14524
14708
 
@@ -14814,6 +14998,7 @@ const attachCmdParentInvoker = (cli, options, plugin) => {
14814
14998
  */
14815
14999
  const cmdPluginConfigSchema = z$2
14816
15000
  .object({
15001
+ /** When true, expand the alias value before execution (default behavior when omitted). */
14817
15002
  expand: z$2.boolean().optional(),
14818
15003
  })
14819
15004
  .strict();
@@ -19209,4 +19394,4 @@ var index = /*#__PURE__*/Object.freeze({
19209
19394
  __Client: Client
19210
19395
  });
19211
19396
 
19212
- export { GetDotenvCli, baseRootOptionDefaults, buildSpawnEnv, createCli, defineDynamic, defineGetDotenvConfig, definePlugin, defineScripts, dotenvExpand, dotenvExpandAll, dotenvExpandFromProcessEnv, getDotenv, getDotenvCliOptions2Options, interpolateDeep, maybeWarnEntropy, readMergedOptions, redactDisplay, redactObject, shouldCapture, traceChildEnv };
19397
+ export { GetDotenvCli, baseRootOptionDefaults, buildSpawnEnv, createCli, defineDynamic, defineGetDotenvConfig, definePlugin, defineScripts, dotenvExpand, dotenvExpandAll, dotenvExpandFromProcessEnv, getDotenv, getDotenvCliOptions2Options, groupPlugins, interpolateDeep, maybeWarnEntropy, readMergedOptions, redactDisplay, redactObject, shouldCapture, traceChildEnv };
@@ -20,9 +20,21 @@ type ScriptsTable<TShell extends string | boolean = string | boolean> = Record<s
20
20
  * @public
21
21
  */
22
22
  interface GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> {
23
+ /**
24
+ * Fully resolved option bag used to compute this context.
25
+ */
23
26
  optionsResolved: TOptions;
27
+ /**
28
+ * Final composed dotenv environment for this invocation.
29
+ */
24
30
  dotenv: ProcessEnv;
31
+ /**
32
+ * Optional runtime plugin state bag. Plugins may publish non-sensitive metadata here.
33
+ */
25
34
  plugins?: Record<string, unknown>;
35
+ /**
36
+ * Per-plugin validated configuration slices keyed by realized mount path.
37
+ */
26
38
  pluginConfigs?: Record<string, unknown>;
27
39
  }
28
40
 
@@ -31,6 +43,14 @@ interface GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions>
31
43
  * For the current step this mirrors the RAW schema; later stages may further
32
44
  * narrow types post-resolution in the host pipeline.
33
45
  */
46
+ /**
47
+ * CLI options schema (resolved).
48
+ *
49
+ * Today this mirrors {@link getDotenvCliOptionsSchemaRaw}, but is kept as a distinct export
50
+ * so future resolution steps can narrow or materialize defaults without breaking the API.
51
+ *
52
+ * @public
53
+ */
34
54
  declare const getDotenvCliOptionsSchemaResolved: z.ZodObject<{
35
55
  defaultEnv: z.ZodOptional<z.ZodString>;
36
56
  dotenvToken: z.ZodOptional<z.ZodString>;
@@ -74,6 +94,14 @@ declare const getDotenvCliOptionsSchemaResolved: z.ZodObject<{
74
94
  * For now, this mirrors the RAW schema; future stages may materialize defaults
75
95
  * and narrow shapes as resolution is wired into the host.
76
96
  */
97
+ /**
98
+ * Programmatic options schema (resolved).
99
+ *
100
+ * Today this mirrors {@link getDotenvOptionsSchemaRaw}, but is kept as a distinct export
101
+ * so future resolution steps can narrow or materialize defaults without breaking the API.
102
+ *
103
+ * @public
104
+ */
77
105
  declare const getDotenvOptionsSchemaResolved: z.ZodObject<{
78
106
  defaultEnv: z.ZodOptional<z.ZodString>;
79
107
  dotenvToken: z.ZodOptional<z.ZodString>;
@@ -128,7 +156,7 @@ type Logger = Record<string, (...args: unknown[]) => void> | typeof console;
128
156
  * Canonical programmatic options type (schema-derived).
129
157
  * This type is the single source of truth for programmatic options.
130
158
  */
131
- type GetDotenvOptions = z.output<typeof getDotenvOptionsSchemaResolved> & {
159
+ type GetDotenvOptions = Omit<z.output<typeof getDotenvOptionsSchemaResolved>, 'logger' | 'dynamic'> & {
132
160
  /**
133
161
  * Compile-time overlay: narrowed logger for DX (schema stores unknown).
134
162
  */
@@ -149,11 +177,15 @@ type Scripts = ScriptsTable;
149
177
  * stringly paths/vars, and inherited programmatic fields (minus normalized
150
178
  * shapes that are handled by resolution).
151
179
  */
152
- type GetDotenvCliOptions = z.output<typeof getDotenvCliOptionsSchemaResolved> & {
180
+ type GetDotenvCliOptions = Omit<z.output<typeof getDotenvCliOptionsSchemaResolved>, 'logger' | 'dynamic' | 'scripts'> & {
153
181
  /**
154
182
  * Compile-only overlay for DX: logger narrowed from unknown.
155
183
  */
156
184
  logger: Logger;
185
+ /**
186
+ * Compile-only overlay for DX: dynamic map narrowed from unknown.
187
+ */
188
+ dynamic?: GetDotenvDynamic;
157
189
  /**
158
190
  * Compile-only overlay for DX: scripts narrowed from Record\<string, unknown\>.
159
191
  */
@@ -216,13 +248,37 @@ interface GetDotenvCliPublic<TOptions extends GetDotenvOptions = GetDotenvOption
216
248
  getCtx(): GetDotenvCliCtx<TOptions>;
217
249
  /** Check whether a context has been resolved (non-throwing). */
218
250
  hasCtx(): boolean;
251
+ /**
252
+ * Resolve options and compute the dotenv context for this invocation.
253
+ *
254
+ * @param customOptions - Partial options to overlay for this invocation.
255
+ * @param opts - Optional resolver behavior switches (for example, whether to run `afterResolve`).
256
+ * @returns A promise resolving to the computed invocation context.
257
+ */
219
258
  resolveAndLoad(customOptions?: Partial<TOptions>, opts?: ResolveAndLoadOptions): Promise<GetDotenvCliCtx<TOptions>>;
259
+ /**
260
+ * Tag an option with a help group identifier for grouped root help rendering.
261
+ *
262
+ * @param opt - The Commander option to tag.
263
+ * @param group - Group identifier (for example, `base`, `app`, or `plugin:<name>`).
264
+ * @returns Nothing.
265
+ */
220
266
  setOptionGroup(opt: Option, group: string): void;
221
267
  /**
222
268
  * Create a dynamic option whose description is computed at help time
223
269
  * from the resolved configuration.
224
270
  */
271
+ /**
272
+ * Create a dynamic option whose description is computed at help time from the resolved configuration.
273
+ *
274
+ * @param flags - Commander option flags usage string.
275
+ * @param desc - Description builder called during help rendering with the resolved help config.
276
+ * @param parser - Optional argument parser.
277
+ * @param defaultValue - Optional default value.
278
+ * @returns A Commander `Option` instance with a dynamic description.
279
+ */
225
280
  createDynamicOption<Usage extends string>(flags: Usage, desc: (cfg: ResolvedHelpConfig) => string, parser?: (value: string, previous?: unknown) => unknown, defaultValue?: unknown): Option<Usage>;
281
+ /** {@inheritDoc} */
226
282
  createDynamicOption<Usage extends string, TValue = unknown>(flags: Usage, desc: (cfg: ResolvedHelpConfig) => string, parser: (value: string, previous?: TValue) => TValue, defaultValue?: TValue): Option<Usage>;
227
283
  }
228
284
  /**
@@ -285,12 +341,37 @@ interface GetDotenvCliPlugin<TOptions extends GetDotenvOptions = GetDotenvOption
285
341
  * return types from definePlugin provide stronger DX for shipped/typed plugins.
286
342
  */
287
343
  interface PluginWithInstanceHelpers<TOptions extends GetDotenvOptions = GetDotenvOptions, TConfig = unknown, TArgs extends unknown[] = [], TOpts extends OptionValues = {}, TGlobal extends OptionValues = {}> extends GetDotenvCliPlugin<TOptions, TArgs, TOpts, TGlobal> {
344
+ /**
345
+ * Read the validated (and interpolated) configuration slice for this plugin instance.
346
+ *
347
+ * @param cli - The plugin mount (or any command under this mount) used to resolve the invocation context.
348
+ * @returns The plugin configuration slice, typed as `TCfg`.
349
+ * @throws Error when called before the host has resolved the invocation context.
350
+ */
288
351
  readConfig<TCfg = TConfig>(cli: GetDotenvCliPublic<TOptions, unknown[], OptionValues, OptionValues>): Readonly<TCfg>;
352
+ /**
353
+ * Create a Commander option whose help-time description receives the resolved root help config
354
+ * and this plugin instance’s validated configuration slice.
355
+ *
356
+ * @typeParam TCfg - The plugin configuration slice type.
357
+ * @typeParam Usage - The Commander usage string for the option flags.
358
+ * @param cli - The plugin mount used to associate the option with a realized mount path.
359
+ * @param flags - Commander option flags usage string.
360
+ * @param desc - Description builder receiving the resolved help config and the plugin config slice.
361
+ * @param parser - Optional argument parser.
362
+ * @param defaultValue - Optional default value.
363
+ * @returns A Commander `Option` instance with a dynamic description.
364
+ */
289
365
  createPluginDynamicOption<TCfg = TConfig, Usage extends string = string>(cli: GetDotenvCliPublic<TOptions, unknown[], OptionValues, OptionValues>, flags: Usage, desc: (cfg: ResolvedHelpConfig, pluginCfg: Readonly<TCfg>) => string, parser?: (value: string, previous?: unknown) => unknown, defaultValue?: unknown): Option<Usage>;
290
366
  }
291
367
 
292
368
  /**
293
- * Zod schema for AWS plugin configuration.
369
+ * AWS plugin configuration schema.
370
+ *
371
+ * @remarks
372
+ * This Zod schema is used by the host to validate the `plugins.aws` config slice.
373
+ *
374
+ * @public
294
375
  */
295
376
  declare const awsPluginConfigSchema: z.ZodObject<{
296
377
  profile: z.ZodOptional<z.ZodString>;
@@ -338,6 +419,11 @@ declare const awsPlugin: () => PluginWithInstanceHelpers<GetDotenvOptions, {
338
419
  strategy?: "cli-export" | "none" | undefined;
339
420
  loginOnDemand?: boolean | undefined;
340
421
  }, [], {}, {}>;
422
+ /**
423
+ * AWS plugin instance type returned by {@link awsPlugin}.
424
+ *
425
+ * @public
426
+ */
341
427
  type AwsPlugin = ReturnType<typeof awsPlugin>;
342
428
 
343
429
  export { awsPlugin };