@karmaniverous/get-dotenv 6.0.0-1 → 6.1.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 (62) hide show
  1. package/README.md +91 -379
  2. package/dist/cli.d.ts +569 -0
  3. package/dist/cli.mjs +18877 -0
  4. package/dist/cliHost.d.ts +528 -184
  5. package/dist/cliHost.mjs +1977 -1428
  6. package/dist/config.d.ts +191 -14
  7. package/dist/config.mjs +266 -81
  8. package/dist/env-overlay.d.ts +223 -16
  9. package/dist/env-overlay.mjs +185 -4
  10. package/dist/getdotenv.cli.mjs +18025 -3196
  11. package/dist/index.d.ts +623 -256
  12. package/dist/index.mjs +18045 -3206
  13. package/dist/plugins-aws.d.ts +221 -91
  14. package/dist/plugins-aws.mjs +2411 -369
  15. package/dist/plugins-batch.d.ts +300 -103
  16. package/dist/plugins-batch.mjs +2560 -484
  17. package/dist/plugins-cmd.d.ts +229 -106
  18. package/dist/plugins-cmd.mjs +2518 -790
  19. package/dist/plugins-init.d.ts +221 -95
  20. package/dist/plugins-init.mjs +2170 -105
  21. package/dist/plugins.d.ts +246 -125
  22. package/dist/plugins.mjs +17941 -1968
  23. package/dist/templates/cli/index.ts +25 -0
  24. package/{templates/cli/ts → dist/templates/cli}/plugins/hello.ts +13 -9
  25. package/dist/templates/config/js/getdotenv.config.js +20 -0
  26. package/dist/templates/config/json/local/getdotenv.config.local.json +7 -0
  27. package/dist/templates/config/json/public/getdotenv.config.json +9 -0
  28. package/dist/templates/config/public/getdotenv.config.json +8 -0
  29. package/dist/templates/config/ts/getdotenv.config.ts +28 -0
  30. package/dist/templates/config/yaml/local/getdotenv.config.local.yaml +7 -0
  31. package/dist/templates/config/yaml/public/getdotenv.config.yaml +7 -0
  32. package/dist/templates/getdotenv.config.js +20 -0
  33. package/dist/templates/getdotenv.config.json +9 -0
  34. package/dist/templates/getdotenv.config.local.json +7 -0
  35. package/dist/templates/getdotenv.config.local.yaml +7 -0
  36. package/dist/templates/getdotenv.config.ts +28 -0
  37. package/dist/templates/getdotenv.config.yaml +7 -0
  38. package/dist/templates/hello.ts +42 -0
  39. package/dist/templates/index.ts +25 -0
  40. package/dist/templates/js/getdotenv.config.js +20 -0
  41. package/dist/templates/json/local/getdotenv.config.local.json +7 -0
  42. package/dist/templates/json/public/getdotenv.config.json +9 -0
  43. package/dist/templates/local/getdotenv.config.local.json +7 -0
  44. package/dist/templates/local/getdotenv.config.local.yaml +7 -0
  45. package/dist/templates/plugins/hello.ts +42 -0
  46. package/dist/templates/public/getdotenv.config.json +9 -0
  47. package/dist/templates/public/getdotenv.config.yaml +7 -0
  48. package/dist/templates/ts/getdotenv.config.ts +28 -0
  49. package/dist/templates/yaml/local/getdotenv.config.local.yaml +7 -0
  50. package/dist/templates/yaml/public/getdotenv.config.yaml +7 -0
  51. package/getdotenv.config.json +1 -19
  52. package/package.json +42 -39
  53. package/templates/cli/index.ts +25 -0
  54. package/templates/cli/plugins/hello.ts +42 -0
  55. package/templates/config/js/getdotenv.config.js +8 -3
  56. package/templates/config/json/public/getdotenv.config.json +0 -3
  57. package/templates/config/public/getdotenv.config.json +0 -5
  58. package/templates/config/ts/getdotenv.config.ts +8 -3
  59. package/templates/config/yaml/public/getdotenv.config.yaml +0 -3
  60. package/dist/plugins-demo.d.ts +0 -204
  61. package/dist/plugins-demo.mjs +0 -496
  62. package/templates/cli/ts/index.ts +0 -9
@@ -1,14 +1,79 @@
1
+ import { OptionValues, Command, InferCommandArguments, Option } from '@commander-js/extra-typings';
1
2
  import { z, ZodObject } from 'zod';
2
- import { Command, Option } from 'commander';
3
3
 
4
4
  /**
5
- * Scripts table shape (configurable shell type).
5
+ * Definition for a single script entry.
6
6
  */
7
- type ScriptsTable<TShell extends string | boolean = string | boolean> = Record<string, string | {
7
+ interface ScriptDef<TShell extends string | boolean = string | boolean> {
8
+ /** The command string to execute. */
8
9
  cmd: string;
10
+ /** Shell override for this script. */
9
11
  shell?: TShell | undefined;
10
- }>;
12
+ }
13
+ /**
14
+ * Scripts table shape.
15
+ */
16
+ type ScriptsTable<TShell extends string | boolean = string | boolean> = Record<string, string | ScriptDef<TShell>>;
17
+ /**
18
+ * Per-invocation context shared with plugins and actions.
19
+ *
20
+ * @public
21
+ */
22
+ interface GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> {
23
+ optionsResolved: TOptions;
24
+ dotenv: ProcessEnv;
25
+ plugins?: Record<string, unknown>;
26
+ pluginConfigs?: Record<string, unknown>;
27
+ }
11
28
 
29
+ /**
30
+ * Resolved CLI options schema.
31
+ * For the current step this mirrors the RAW schema; later stages may further
32
+ * narrow types post-resolution in the host pipeline.
33
+ */
34
+ declare const getDotenvCliOptionsSchemaResolved: z.ZodObject<{
35
+ defaultEnv: z.ZodOptional<z.ZodString>;
36
+ dotenvToken: z.ZodOptional<z.ZodString>;
37
+ dynamicPath: z.ZodOptional<z.ZodString>;
38
+ dynamic: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
39
+ env: z.ZodOptional<z.ZodString>;
40
+ excludeDynamic: z.ZodOptional<z.ZodBoolean>;
41
+ excludeEnv: z.ZodOptional<z.ZodBoolean>;
42
+ excludeGlobal: z.ZodOptional<z.ZodBoolean>;
43
+ excludePrivate: z.ZodOptional<z.ZodBoolean>;
44
+ excludePublic: z.ZodOptional<z.ZodBoolean>;
45
+ loadProcess: z.ZodOptional<z.ZodBoolean>;
46
+ log: z.ZodOptional<z.ZodBoolean>;
47
+ logger: z.ZodDefault<z.ZodUnknown>;
48
+ outputPath: z.ZodOptional<z.ZodString>;
49
+ privateToken: z.ZodOptional<z.ZodString>;
50
+ debug: z.ZodOptional<z.ZodBoolean>;
51
+ strict: z.ZodOptional<z.ZodBoolean>;
52
+ capture: z.ZodOptional<z.ZodBoolean>;
53
+ trace: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
54
+ redact: z.ZodOptional<z.ZodBoolean>;
55
+ warnEntropy: z.ZodOptional<z.ZodBoolean>;
56
+ entropyThreshold: z.ZodOptional<z.ZodNumber>;
57
+ entropyMinLength: z.ZodOptional<z.ZodNumber>;
58
+ entropyWhitelist: z.ZodOptional<z.ZodArray<z.ZodString>>;
59
+ redactPatterns: z.ZodOptional<z.ZodArray<z.ZodString>>;
60
+ paths: z.ZodOptional<z.ZodString>;
61
+ pathsDelimiter: z.ZodOptional<z.ZodString>;
62
+ pathsDelimiterPattern: z.ZodOptional<z.ZodString>;
63
+ scripts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
64
+ shell: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>;
65
+ vars: z.ZodOptional<z.ZodString>;
66
+ varsAssignor: z.ZodOptional<z.ZodString>;
67
+ varsAssignorPattern: z.ZodOptional<z.ZodString>;
68
+ varsDelimiter: z.ZodOptional<z.ZodString>;
69
+ varsDelimiterPattern: z.ZodOptional<z.ZodString>;
70
+ }, z.core.$strip>;
71
+
72
+ /**
73
+ * Resolved programmatic options schema (post-inheritance).
74
+ * For now, this mirrors the RAW schema; future stages may materialize defaults
75
+ * and narrow shapes as resolution is wired into the host.
76
+ */
12
77
  declare const getDotenvOptionsSchemaResolved: z.ZodObject<{
13
78
  defaultEnv: z.ZodOptional<z.ZodString>;
14
79
  dotenvToken: z.ZodOptional<z.ZodString>;
@@ -22,13 +87,23 @@ declare const getDotenvOptionsSchemaResolved: z.ZodObject<{
22
87
  excludePublic: z.ZodOptional<z.ZodBoolean>;
23
88
  loadProcess: z.ZodOptional<z.ZodBoolean>;
24
89
  log: z.ZodOptional<z.ZodBoolean>;
25
- logger: z.ZodOptional<z.ZodUnknown>;
90
+ logger: z.ZodDefault<z.ZodUnknown>;
26
91
  outputPath: z.ZodOptional<z.ZodString>;
27
92
  paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
28
93
  privateToken: z.ZodOptional<z.ZodString>;
29
94
  vars: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>>;
30
95
  }, z.core.$strip>;
31
96
 
97
+ /**
98
+ * Canonical programmatic options and helpers for get-dotenv.
99
+ *
100
+ * Requirements addressed:
101
+ * - GetDotenvOptions derives from the Zod schema output (single source of truth).
102
+ * - Removed deprecated/compat flags from the public shape (e.g., useConfigLoader).
103
+ * - Provide Vars-aware defineDynamic and a typed config builder defineGetDotenvConfig\<Vars, Env\>().
104
+ * - Preserve existing behavior for defaults resolution and compat converters.
105
+ */
106
+
32
107
  /**
33
108
  * A minimal representation of an environment key/value mapping.
34
109
  * Values may be `undefined` to represent "unset".
@@ -40,7 +115,14 @@ type ProcessEnv = Record<string, string | undefined>;
40
115
  * or `undefined` to unset/skip the variable.
41
116
  */
42
117
  type GetDotenvDynamicFunction = (vars: ProcessEnv, env: string | undefined) => string | undefined;
118
+ /**
119
+ * A map of dynamic variable definitions.
120
+ * Keys are variable names; values are either literal strings or functions.
121
+ */
43
122
  type GetDotenvDynamic = Record<string, GetDotenvDynamicFunction | ReturnType<GetDotenvDynamicFunction>>;
123
+ /**
124
+ * Logger interface compatible with `console` or a subset thereof.
125
+ */
44
126
  type Logger = Record<string, (...args: unknown[]) => void> | typeof console;
45
127
  /**
46
128
  * Canonical programmatic options type (schema-derived).
@@ -50,51 +132,16 @@ type GetDotenvOptions = z.output<typeof getDotenvOptionsSchemaResolved> & {
50
132
  /**
51
133
  * Compile-time overlay: narrowed logger for DX (schema stores unknown).
52
134
  */
53
- logger?: Logger;
135
+ logger: Logger;
54
136
  /**
55
137
  * Compile-time overlay: narrowed dynamic map for DX (schema stores unknown).
56
138
  */
57
139
  dynamic?: GetDotenvDynamic;
58
140
  };
59
141
 
60
- declare const getDotenvCliOptionsSchemaResolved: z.ZodObject<{
61
- defaultEnv: z.ZodOptional<z.ZodString>;
62
- dotenvToken: z.ZodOptional<z.ZodString>;
63
- dynamicPath: z.ZodOptional<z.ZodString>;
64
- dynamic: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
65
- env: z.ZodOptional<z.ZodString>;
66
- excludeDynamic: z.ZodOptional<z.ZodBoolean>;
67
- excludeEnv: z.ZodOptional<z.ZodBoolean>;
68
- excludeGlobal: z.ZodOptional<z.ZodBoolean>;
69
- excludePrivate: z.ZodOptional<z.ZodBoolean>;
70
- excludePublic: z.ZodOptional<z.ZodBoolean>;
71
- loadProcess: z.ZodOptional<z.ZodBoolean>;
72
- log: z.ZodOptional<z.ZodBoolean>;
73
- logger: z.ZodOptional<z.ZodUnknown>;
74
- outputPath: z.ZodOptional<z.ZodString>;
75
- privateToken: z.ZodOptional<z.ZodString>;
76
- debug: z.ZodOptional<z.ZodBoolean>;
77
- strict: z.ZodOptional<z.ZodBoolean>;
78
- capture: z.ZodOptional<z.ZodBoolean>;
79
- trace: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
80
- redact: z.ZodOptional<z.ZodBoolean>;
81
- warnEntropy: z.ZodOptional<z.ZodBoolean>;
82
- entropyThreshold: z.ZodOptional<z.ZodNumber>;
83
- entropyMinLength: z.ZodOptional<z.ZodNumber>;
84
- entropyWhitelist: z.ZodOptional<z.ZodArray<z.ZodString>>;
85
- redactPatterns: z.ZodOptional<z.ZodArray<z.ZodString>>;
86
- paths: z.ZodOptional<z.ZodString>;
87
- pathsDelimiter: z.ZodOptional<z.ZodString>;
88
- pathsDelimiterPattern: z.ZodOptional<z.ZodString>;
89
- scripts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
90
- shell: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>;
91
- vars: z.ZodOptional<z.ZodString>;
92
- varsAssignor: z.ZodOptional<z.ZodString>;
93
- varsAssignorPattern: z.ZodOptional<z.ZodString>;
94
- varsDelimiter: z.ZodOptional<z.ZodString>;
95
- varsDelimiterPattern: z.ZodOptional<z.ZodString>;
96
- }, z.core.$strip>;
97
-
142
+ /**
143
+ * Unify Scripts via the generic ScriptsTable<TShell> so shell types propagate.
144
+ */
98
145
  type Scripts = ScriptsTable;
99
146
  /**
100
147
  * Canonical CLI options type derived from the Zod schema output.
@@ -106,32 +153,48 @@ type GetDotenvCliOptions = z.output<typeof getDotenvCliOptionsSchemaResolved> &
106
153
  /**
107
154
  * Compile-only overlay for DX: logger narrowed from unknown.
108
155
  */
109
- logger?: Logger;
156
+ logger: Logger;
110
157
  /**
111
158
  * Compile-only overlay for DX: scripts narrowed from Record\<string, unknown\>.
112
159
  */
113
160
  scripts?: Scripts;
114
161
  };
115
162
 
163
+ /**
164
+ * Configuration context used for generating dynamic help descriptions.
165
+ * Contains merged CLI options and plugin configuration slices.
166
+ *
167
+ * @public
168
+ */
116
169
  type ResolvedHelpConfig = Partial<GetDotenvCliOptions> & {
170
+ /**
171
+ * Per‑plugin configuration slices keyed by realized mount path
172
+ * (e.g., `"aws"` or `"aws/whoami"`), used for dynamic help text.
173
+ */
117
174
  plugins: Record<string, unknown>;
118
175
  };
119
- /** Per-invocation context shared with plugins and actions. */
120
- type GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> = {
121
- optionsResolved: TOptions;
122
- dotenv: ProcessEnv;
123
- plugins?: Record<string, unknown>;
124
- pluginConfigs?: Record<string, unknown>;
125
- };
126
176
 
127
- /** src/cliHost/definePlugin.ts
128
- * Plugin contracts for the GetDotenv CLI host.
129
- *
130
- * This module exposes a structural public interface for the host that plugins
131
- * should use (GetDotenvCliPublic). Using a structural type at the seam avoids
132
- * nominal class identity issues (private fields) in downstream consumers.
177
+ /** src/cliHost/definePlugin/contracts.ts
178
+ * Public contracts for plugin authoring (types only).
179
+ * - No runtime logic or state.
180
+ * - Safe to import broadly without introducing cycles.
133
181
  */
134
182
 
183
+ /**
184
+ * Options for resolving and loading the configuration.
185
+ *
186
+ * @public
187
+ */
188
+ interface ResolveAndLoadOptions {
189
+ /**
190
+ * When false, skips running plugin afterResolve hooks.
191
+ * Useful for top-level help rendering to avoid long-running side-effects
192
+ * while still evaluating dynamic help text.
193
+ *
194
+ * @default true
195
+ */
196
+ runAfterResolve?: boolean;
197
+ }
135
198
  /**
136
199
  * Structural public interface for the host exposed to plugins.
137
200
  * - Extends Commander.Command so plugins can attach options/commands/hooks.
@@ -140,51 +203,80 @@ type GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> = {
140
203
  * Purpose: remove nominal class identity (private fields) from the plugin seam
141
204
  * to avoid TS2379 under exactOptionalPropertyTypes in downstream consumers.
142
205
  */
143
- interface GetDotenvCliPublic<TOptions extends GetDotenvOptions = GetDotenvOptions> extends Command {
144
- ns(name: string): Command;
145
- getCtx(): GetDotenvCliCtx<TOptions> | undefined;
146
- resolveAndLoad(customOptions?: Partial<TOptions>, opts?: {
147
- runAfterResolve?: boolean;
148
- }): Promise<GetDotenvCliCtx<TOptions>>;
206
+ interface GetDotenvCliPublic<TOptions extends GetDotenvOptions = GetDotenvOptions, TArgs extends unknown[] = [], TOpts extends OptionValues = {}, TGlobal extends OptionValues = {}> extends Command<TArgs, TOpts, TGlobal> {
207
+ /**
208
+ * Create a namespaced child command with argument inference.
209
+ * Mirrors Commander generics so downstream chaining remains fully typed.
210
+ */
211
+ ns<Usage extends string>(name: Usage): GetDotenvCliPublic<TOptions, [
212
+ ...TArgs,
213
+ ...InferCommandArguments<Usage>
214
+ ], {}, TOpts & TGlobal>;
215
+ /** Return the current context; throws if not yet resolved. */
216
+ getCtx(): GetDotenvCliCtx<TOptions>;
217
+ /** Check whether a context has been resolved (non-throwing). */
218
+ hasCtx(): boolean;
219
+ resolveAndLoad(customOptions?: Partial<TOptions>, opts?: ResolveAndLoadOptions): Promise<GetDotenvCliCtx<TOptions>>;
149
220
  setOptionGroup(opt: Option, group: string): void;
150
221
  /**
151
222
  * Create a dynamic option whose description is computed at help time
152
223
  * from the resolved configuration.
153
224
  */
154
- createDynamicOption(flags: string, desc: (cfg: ResolvedHelpConfig & {
155
- plugins: Record<string, unknown>;
156
- }) => string, parser?: (value: string, previous?: unknown) => unknown, defaultValue?: unknown): Option;
157
- createDynamicOption<TValue = unknown>(flags: string, desc: (cfg: ResolvedHelpConfig & {
158
- plugins: Record<string, unknown>;
159
- }) => string, parser: (value: string, previous?: TValue) => TValue, defaultValue?: TValue): Option;
225
+ createDynamicOption<Usage extends string>(flags: Usage, desc: (cfg: ResolvedHelpConfig) => string, parser?: (value: string, previous?: unknown) => unknown, defaultValue?: unknown): Option<Usage>;
226
+ createDynamicOption<Usage extends string, TValue = unknown>(flags: Usage, desc: (cfg: ResolvedHelpConfig) => string, parser: (value: string, previous?: TValue) => TValue, defaultValue?: TValue): Option<Usage>;
227
+ }
228
+ /**
229
+ * Optional overrides for plugin composition.
230
+ *
231
+ * @public
232
+ */
233
+ interface PluginNamespaceOverride {
234
+ /**
235
+ * Override the default namespace for this plugin instance.
236
+ */
237
+ ns?: string;
238
+ }
239
+ /**
240
+ * An entry in the plugin children array.
241
+ *
242
+ * @public
243
+ */
244
+ interface PluginChildEntry<TOptions extends GetDotenvOptions = GetDotenvOptions, TArgs extends unknown[] = [], TOpts extends OptionValues = {}, TGlobal extends OptionValues = {}> {
245
+ /** The child plugin instance to mount under this parent. */
246
+ plugin: GetDotenvCliPlugin<TOptions, TArgs, TOpts, TGlobal>;
247
+ /**
248
+ * Optional namespace override for the child when mounted under the parent.
249
+ * When provided, this name is used instead of the child's default `ns`.
250
+ */
251
+ override: PluginNamespaceOverride | undefined;
160
252
  }
161
253
  /** Public plugin contract used by the GetDotenv CLI host. */
162
- interface GetDotenvCliPlugin<TOptions extends GetDotenvOptions = GetDotenvOptions> {
163
- id?: string;
254
+ interface GetDotenvCliPlugin<TOptions extends GetDotenvOptions = GetDotenvOptions, TArgs extends unknown[] = [], TOpts extends OptionValues = {}, TGlobal extends OptionValues = {}> {
255
+ /** Namespace (required): the command name where this plugin is mounted. */
256
+ ns: string;
164
257
  /**
165
- * Setup phase: register commands and wiring on the provided CLI instance.
166
- * Runs parent → children (pre-order).
258
+ * Setup phase: register commands and wiring on the provided mount.
259
+ * Runs parent → children (pre-order). Return nothing (void).
167
260
  */
168
- setup: (cli: GetDotenvCliPublic<TOptions>) => void | Promise<void>;
261
+ setup: (cli: GetDotenvCliPublic<TOptions, TArgs, TOpts, TGlobal>) => void | Promise<void>;
169
262
  /**
170
263
  * After the dotenv context is resolved, initialize any clients/secrets
171
264
  * or attach per-plugin state under ctx.plugins (by convention).
172
265
  * Runs parent → children (pre-order).
173
266
  */
174
- afterResolve?: (cli: GetDotenvCliPublic<TOptions>, ctx: GetDotenvCliCtx<TOptions>) => void | Promise<void>;
175
- /**
176
- * Zod schema for this plugin's config slice (from config.plugins[id]).
177
- * Enforced object-like (ZodObject) to simplify code paths and inference.
178
- */
267
+ afterResolve?: (cli: GetDotenvCliPublic<TOptions, TArgs, TOpts, TGlobal>, ctx: GetDotenvCliCtx<TOptions>) => void | Promise<void>;
268
+ /** Zod schema for this plugin's config slice (from config.plugins[…]). */
179
269
  configSchema?: ZodObject;
180
270
  /**
181
- * Compositional children. Installed after the parent per pre-order.
271
+ * Compositional children, with optional per-child overrides (e.g., ns).
272
+ * Installed after the parent per pre-order.
182
273
  */
183
- children: GetDotenvCliPlugin<TOptions>[];
274
+ children: Array<PluginChildEntry<TOptions, TArgs, TOpts, TGlobal>>;
184
275
  /**
185
- * Compose a child plugin. Returns the parent to enable chaining.
276
+ * Compose a child plugin with optional override (ns). Returns the parent
277
+ * to enable chaining.
186
278
  */
187
- use: (child: GetDotenvCliPlugin<TOptions>) => GetDotenvCliPlugin<TOptions>;
279
+ use: (child: GetDotenvCliPlugin<TOptions, TArgs, TOpts, TGlobal>, override?: PluginNamespaceOverride) => GetDotenvCliPlugin<TOptions, TArgs, TOpts, TGlobal>;
188
280
  }
189
281
  /**
190
282
  * Compile-time helper type: the plugin object returned by definePlugin always
@@ -192,13 +284,50 @@ interface GetDotenvCliPlugin<TOptions extends GetDotenvOptions = GetDotenvOption
192
284
  * interface optional preserves compatibility for ad-hoc/test plugins, while
193
285
  * return types from definePlugin provide stronger DX for shipped/typed plugins.
194
286
  */
195
- type PluginWithInstanceHelpers<TOptions extends GetDotenvOptions = GetDotenvOptions, TConfig = unknown> = GetDotenvCliPlugin<TOptions> & {
196
- readConfig<TCfg = TConfig>(cli: GetDotenvCliPublic<TOptions>): Readonly<TCfg>;
197
- createPluginDynamicOption<TCfg = TConfig>(cli: GetDotenvCliPublic<TOptions>, flags: string, desc: (cfg: ResolvedHelpConfig & {
198
- plugins: Record<string, unknown>;
199
- }, pluginCfg: Readonly<TCfg>) => string, parser?: (value: string, previous?: unknown) => unknown, defaultValue?: unknown): Option;
200
- };
287
+ interface PluginWithInstanceHelpers<TOptions extends GetDotenvOptions = GetDotenvOptions, TConfig = unknown, TArgs extends unknown[] = [], TOpts extends OptionValues = {}, TGlobal extends OptionValues = {}> extends GetDotenvCliPlugin<TOptions, TArgs, TOpts, TGlobal> {
288
+ readConfig<TCfg = TConfig>(cli: GetDotenvCliPublic<TOptions, unknown[], OptionValues, OptionValues>): Readonly<TCfg>;
289
+ 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
+ }
291
+
292
+ /**
293
+ * Zod schema for AWS plugin configuration.
294
+ */
295
+ declare const AwsPluginConfigSchema: z.ZodObject<{
296
+ profile: z.ZodOptional<z.ZodString>;
297
+ region: z.ZodOptional<z.ZodString>;
298
+ defaultRegion: z.ZodOptional<z.ZodString>;
299
+ profileKey: z.ZodOptional<z.ZodDefault<z.ZodString>>;
300
+ profileFallbackKey: z.ZodOptional<z.ZodDefault<z.ZodString>>;
301
+ regionKey: z.ZodOptional<z.ZodDefault<z.ZodString>>;
302
+ strategy: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
303
+ "cli-export": "cli-export";
304
+ none: "none";
305
+ }>>>;
306
+ loginOnDemand: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
307
+ }, z.core.$strip>;
308
+ /**
309
+ * AWS plugin configuration object.
310
+ */
311
+ type AwsPluginConfig = z.infer<typeof AwsPluginConfigSchema>;
312
+ /**
313
+ * Arguments for resolving AWS context (profile/region/credentials).
314
+ *
315
+ * @public
316
+ */
317
+ interface ResolveAwsContextOptions {
318
+ /**
319
+ * The current composed dotenv variables.
320
+ */
321
+ dotenv: ProcessEnv;
322
+ /** Plugin configuration. */
323
+ cfg: AwsPluginConfig;
324
+ }
201
325
 
326
+ /**
327
+ * AWS plugin: establishes an AWS session (credentials/region) based on dotenv configuration.
328
+ * Supports SSO login-on-demand and credential exporting.
329
+ * Can be used as a parent command to wrap `aws` CLI invocations.
330
+ */
202
331
  declare const awsPlugin: () => PluginWithInstanceHelpers<GetDotenvOptions, {
203
332
  profile?: string | undefined;
204
333
  region?: string | undefined;
@@ -208,6 +337,7 @@ declare const awsPlugin: () => PluginWithInstanceHelpers<GetDotenvOptions, {
208
337
  regionKey?: string | undefined;
209
338
  strategy?: "cli-export" | "none" | undefined;
210
339
  loginOnDemand?: boolean | undefined;
211
- }>;
340
+ }, [], {}, {}>;
212
341
 
213
342
  export { awsPlugin };
343
+ export type { ResolveAwsContextOptions };