@karmaniverous/get-dotenv 6.1.0 → 6.2.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.
- package/README.md +20 -14
- package/dist/cli.d.ts +58 -2
- package/dist/cli.mjs +800 -364
- package/dist/cliHost.d.ts +216 -17
- package/dist/cliHost.mjs +178 -14
- package/dist/config.d.ts +12 -0
- package/dist/config.mjs +79 -2
- package/dist/env-overlay.d.ts +8 -0
- package/dist/getdotenv.cli.mjs +800 -364
- package/dist/index.d.ts +220 -35
- package/dist/index.mjs +851 -365
- package/dist/plugins-aws.d.ts +94 -6
- package/dist/plugins-aws.mjs +462 -184
- package/dist/plugins-batch.d.ts +85 -3
- package/dist/plugins-batch.mjs +203 -54
- package/dist/plugins-cmd.d.ts +85 -3
- package/dist/plugins-cmd.mjs +150 -28
- package/dist/plugins-init.d.ts +85 -3
- package/dist/plugins-init.mjs +270 -131
- package/dist/plugins.d.ts +85 -4
- package/dist/plugins.mjs +800 -364
- package/dist/templates/cli/plugins/hello/defaultAction.ts +27 -0
- package/dist/templates/cli/plugins/hello/index.ts +26 -0
- package/dist/templates/cli/plugins/hello/options.ts +31 -0
- package/dist/templates/cli/plugins/hello/strangerAction.ts +20 -0
- package/dist/templates/cli/plugins/hello/types.ts +13 -0
- package/dist/templates/defaultAction.ts +27 -0
- package/dist/templates/hello/defaultAction.ts +27 -0
- package/dist/templates/hello/index.ts +26 -0
- package/dist/templates/hello/options.ts +31 -0
- package/dist/templates/hello/strangerAction.ts +20 -0
- package/dist/templates/hello/types.ts +13 -0
- package/dist/templates/index.ts +23 -22
- package/dist/templates/options.ts +31 -0
- package/dist/templates/plugins/hello/defaultAction.ts +27 -0
- package/dist/templates/plugins/hello/index.ts +26 -0
- package/dist/templates/plugins/hello/options.ts +31 -0
- package/dist/templates/plugins/hello/strangerAction.ts +20 -0
- package/dist/templates/plugins/hello/types.ts +13 -0
- package/dist/templates/strangerAction.ts +20 -0
- package/dist/templates/types.ts +13 -0
- package/package.json +3 -4
- package/templates/cli/plugins/hello/defaultAction.ts +27 -0
- package/templates/cli/plugins/hello/index.ts +26 -0
- package/templates/cli/plugins/hello/options.ts +31 -0
- package/templates/cli/plugins/hello/strangerAction.ts +20 -0
- package/templates/cli/plugins/hello/types.ts +13 -0
- package/dist/templates/cli/plugins/hello.ts +0 -42
- package/dist/templates/hello.ts +0 -42
- package/dist/templates/plugins/hello.ts +0 -42
- package/templates/cli/plugins/hello.ts +0 -42
package/dist/plugins-aws.d.ts
CHANGED
|
@@ -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,14 +341,40 @@ 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
|
-
*
|
|
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
|
|
375
|
+
* @hidden
|
|
294
376
|
*/
|
|
295
|
-
declare const
|
|
377
|
+
declare const awsPluginConfigSchema: z.ZodObject<{
|
|
296
378
|
profile: z.ZodOptional<z.ZodString>;
|
|
297
379
|
region: z.ZodOptional<z.ZodString>;
|
|
298
380
|
defaultRegion: z.ZodOptional<z.ZodString>;
|
|
@@ -308,7 +390,7 @@ declare const AwsPluginConfigSchema: z.ZodObject<{
|
|
|
308
390
|
/**
|
|
309
391
|
* AWS plugin configuration object.
|
|
310
392
|
*/
|
|
311
|
-
type AwsPluginConfig = z.infer<typeof
|
|
393
|
+
type AwsPluginConfig = z.infer<typeof awsPluginConfigSchema>;
|
|
312
394
|
/**
|
|
313
395
|
* Arguments for resolving AWS context (profile/region/credentials).
|
|
314
396
|
*
|
|
@@ -338,6 +420,12 @@ declare const awsPlugin: () => PluginWithInstanceHelpers<GetDotenvOptions, {
|
|
|
338
420
|
strategy?: "cli-export" | "none" | undefined;
|
|
339
421
|
loginOnDemand?: boolean | undefined;
|
|
340
422
|
}, [], {}, {}>;
|
|
423
|
+
/**
|
|
424
|
+
* AWS plugin instance type returned by {@link awsPlugin}.
|
|
425
|
+
*
|
|
426
|
+
* @public
|
|
427
|
+
*/
|
|
428
|
+
type AwsPlugin = ReturnType<typeof awsPlugin>;
|
|
341
429
|
|
|
342
430
|
export { awsPlugin };
|
|
343
|
-
export type { ResolveAwsContextOptions };
|
|
431
|
+
export type { AwsPlugin, ResolveAwsContextOptions };
|