@karmaniverous/get-dotenv 5.0.0 → 5.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 +14 -0
- package/dist/cliHost.cjs +393 -21
- package/dist/cliHost.d.cts +132 -3
- package/dist/cliHost.d.mts +132 -3
- package/dist/cliHost.d.ts +132 -3
- package/dist/cliHost.mjs +393 -22
- package/dist/config.cjs +10 -5
- package/dist/config.d.cts +2 -0
- package/dist/config.d.mts +2 -0
- package/dist/config.d.ts +2 -0
- package/dist/config.mjs +10 -5
- package/dist/env-overlay.d.cts +2 -0
- package/dist/env-overlay.d.mts +2 -0
- package/dist/env-overlay.d.ts +2 -0
- package/dist/getdotenv.cli.mjs +678 -39
- package/dist/index.cjs +604 -245
- package/dist/index.d.cts +36 -1
- package/dist/index.d.mts +36 -1
- package/dist/index.d.ts +36 -1
- package/dist/index.mjs +604 -246
- package/dist/plugins-aws.cjs +43 -1
- package/dist/plugins-aws.d.cts +115 -0
- package/dist/plugins-aws.d.mts +115 -0
- package/dist/plugins-aws.d.ts +115 -0
- package/dist/plugins-aws.mjs +43 -1
- package/dist/plugins-batch.cjs +46 -6
- package/dist/plugins-batch.d.cts +115 -0
- package/dist/plugins-batch.d.mts +115 -0
- package/dist/plugins-batch.d.ts +115 -0
- package/dist/plugins-batch.mjs +46 -6
- package/dist/plugins-init.d.cts +115 -0
- package/dist/plugins-init.d.mts +115 -0
- package/dist/plugins-init.d.ts +115 -0
- package/package.json +25 -24
package/dist/cliHost.d.cts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
import { ZodType } from 'zod';
|
|
2
1
|
import { Command } from 'commander';
|
|
2
|
+
import { ZodType } from 'zod';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Scripts table shape (configurable shell type).
|
|
6
|
+
*/
|
|
7
|
+
type ScriptsTable<TShell extends string | boolean = string | boolean> = Record<string, string | {
|
|
8
|
+
cmd: string;
|
|
9
|
+
shell?: TShell;
|
|
10
|
+
}>;
|
|
3
11
|
|
|
4
12
|
/**
|
|
5
13
|
* A minimal representation of an environment key/value mapping.
|
|
@@ -95,6 +103,93 @@ interface GetDotenvOptions {
|
|
|
95
103
|
useConfigLoader?: boolean;
|
|
96
104
|
}
|
|
97
105
|
|
|
106
|
+
type Scripts = Record<string, string | {
|
|
107
|
+
cmd: string;
|
|
108
|
+
shell?: string | boolean;
|
|
109
|
+
}>;
|
|
110
|
+
/**
|
|
111
|
+
* Options passed programmatically to `getDotenvCli`.
|
|
112
|
+
*/
|
|
113
|
+
interface GetDotenvCliOptions extends Omit<GetDotenvOptions, 'paths' | 'vars'> {
|
|
114
|
+
/**
|
|
115
|
+
* Logs CLI internals when true.
|
|
116
|
+
*/
|
|
117
|
+
debug?: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Strict mode: fail the run when env validation issues are detected
|
|
120
|
+
* (schema or requiredKeys). Warns by default when false or unset.
|
|
121
|
+
*/
|
|
122
|
+
strict?: boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Redaction (presentation): mask secret-like values in logs/trace.
|
|
125
|
+
*/
|
|
126
|
+
redact?: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Entropy warnings (presentation): emit once-per-key warnings for high-entropy values.
|
|
129
|
+
*/
|
|
130
|
+
warnEntropy?: boolean;
|
|
131
|
+
entropyThreshold?: number;
|
|
132
|
+
entropyMinLength?: number;
|
|
133
|
+
entropyWhitelist?: string[];
|
|
134
|
+
redactPatterns?: string[];
|
|
135
|
+
/**
|
|
136
|
+
* When true, capture child stdout/stderr and re-emit after completion.
|
|
137
|
+
* Useful for tests/CI. Default behavior is streaming via stdio: 'inherit'.
|
|
138
|
+
*/
|
|
139
|
+
capture?: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* A delimited string of paths to dotenv files.
|
|
142
|
+
*/
|
|
143
|
+
paths?: string;
|
|
144
|
+
/**
|
|
145
|
+
* A delimiter string with which to split `paths`. Only used if
|
|
146
|
+
* `pathsDelimiterPattern` is not provided.
|
|
147
|
+
*/
|
|
148
|
+
pathsDelimiter?: string;
|
|
149
|
+
/**
|
|
150
|
+
* A regular expression pattern with which to split `paths`. Supersedes
|
|
151
|
+
* `pathsDelimiter`.
|
|
152
|
+
*/
|
|
153
|
+
pathsDelimiterPattern?: string;
|
|
154
|
+
/**
|
|
155
|
+
* Scripts that can be executed from the CLI, either individually or via the batch subcommand.
|
|
156
|
+
*/
|
|
157
|
+
scripts?: Scripts;
|
|
158
|
+
/**
|
|
159
|
+
* Determines how commands and scripts are executed. If `false` or
|
|
160
|
+
* `undefined`, commands are executed as plain Javascript using the default
|
|
161
|
+
* execa parser. If `true`, commands are executed using the default OS shell
|
|
162
|
+
* parser. Otherwise the user may provide a specific shell string (e.g.
|
|
163
|
+
* `/bin/bash`)
|
|
164
|
+
*/
|
|
165
|
+
shell?: string | boolean;
|
|
166
|
+
/**
|
|
167
|
+
* A delimited string of key-value pairs declaratively specifying variables &
|
|
168
|
+
* values to be loaded in addition to any dotenv files.
|
|
169
|
+
*/
|
|
170
|
+
vars?: string;
|
|
171
|
+
/**
|
|
172
|
+
* A string with which to split keys from values in `vars`. Only used if
|
|
173
|
+
* `varsDelimiterPattern` is not provided.
|
|
174
|
+
*/
|
|
175
|
+
varsAssignor?: string;
|
|
176
|
+
/**
|
|
177
|
+
* A regular expression pattern with which to split variable names from values
|
|
178
|
+
* in `vars`. Supersedes `varsAssignor`.
|
|
179
|
+
*/
|
|
180
|
+
varsAssignorPattern?: string;
|
|
181
|
+
/**
|
|
182
|
+
* A string with which to split `vars` into key-value pairs. Only used if
|
|
183
|
+
* `varsDelimiterPattern` is not provided.
|
|
184
|
+
*/
|
|
185
|
+
varsDelimiter?: string;
|
|
186
|
+
/**
|
|
187
|
+
* A regular expression pattern with which to split `vars` into key-value
|
|
188
|
+
* pairs. Supersedes `varsDelimiter`.
|
|
189
|
+
*/
|
|
190
|
+
varsDelimiterPattern?: string;
|
|
191
|
+
}
|
|
192
|
+
|
|
98
193
|
/** * Per-invocation context shared with plugins and actions. */
|
|
99
194
|
type GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> = {
|
|
100
195
|
optionsResolved: TOptions;
|
|
@@ -102,6 +197,7 @@ type GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> = {
|
|
|
102
197
|
plugins?: Record<string, unknown>;
|
|
103
198
|
pluginConfigs?: Record<string, unknown>;
|
|
104
199
|
};
|
|
200
|
+
declare const HELP_HEADER_SYMBOL: unique symbol;
|
|
105
201
|
/**
|
|
106
202
|
* Plugin-first CLI host for get-dotenv. Extends Commander.Command.
|
|
107
203
|
*
|
|
@@ -114,10 +210,13 @@ type GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> = {
|
|
|
114
210
|
* NOTE: This host is additive and does not alter the legacy CLI.
|
|
115
211
|
*/
|
|
116
212
|
declare class GetDotenvCli<TOptions extends GetDotenvOptions = GetDotenvOptions> extends Command {
|
|
213
|
+
#private;
|
|
117
214
|
/** Registered top-level plugins (composition happens via .use()) */
|
|
118
215
|
private _plugins;
|
|
119
216
|
/** One-time installation guard */
|
|
120
217
|
private _installed;
|
|
218
|
+
/** Optional header line to prepend in help output */
|
|
219
|
+
private [HELP_HEADER_SYMBOL];
|
|
121
220
|
constructor(alias?: string);
|
|
122
221
|
/**
|
|
123
222
|
* Resolve options (strict) and compute dotenv context. * Stores the context on the instance under a symbol.
|
|
@@ -127,9 +226,33 @@ declare class GetDotenvCli<TOptions extends GetDotenvOptions = GetDotenvOptions>
|
|
|
127
226
|
* Retrieve the current invocation context (if any).
|
|
128
227
|
*/
|
|
129
228
|
getCtx(): GetDotenvCliCtx<TOptions> | undefined;
|
|
229
|
+
/**
|
|
230
|
+
* Retrieve the merged root CLI options bag (if set by passOptions()).
|
|
231
|
+
* Downstream-safe: no generics required.
|
|
232
|
+
*/
|
|
233
|
+
getOptions(): GetDotenvCliOptions | undefined;
|
|
234
|
+
/** Internal: set the merged root options bag for this run. */
|
|
235
|
+
_setOptionsBag(bag: GetDotenvCliOptions): void;
|
|
130
236
|
/** * Convenience helper to create a namespaced subcommand.
|
|
131
237
|
*/
|
|
132
238
|
ns(name: string): Command;
|
|
239
|
+
/**
|
|
240
|
+
* Tag options added during the provided callback as 'app' for grouped help.
|
|
241
|
+
* Allows downstream apps to demarcate their root-level options.
|
|
242
|
+
*/
|
|
243
|
+
tagAppOptions<T>(fn: (root: Command) => T): T;
|
|
244
|
+
/**
|
|
245
|
+
* Branding helper: set CLI name/description/version and optional help header.
|
|
246
|
+
* If version is omitted and importMetaUrl is provided, attempts to read the
|
|
247
|
+
* nearest package.json version (best-effort; non-fatal on failure).
|
|
248
|
+
*/
|
|
249
|
+
brand(args: {
|
|
250
|
+
name?: string;
|
|
251
|
+
description?: string;
|
|
252
|
+
version?: string;
|
|
253
|
+
importMetaUrl?: string;
|
|
254
|
+
helpHeader?: string;
|
|
255
|
+
}): Promise<this>;
|
|
133
256
|
/**
|
|
134
257
|
* Register a plugin for installation (parent level).
|
|
135
258
|
* Installation occurs on first resolveAndLoad() (or explicit install()).
|
|
@@ -187,5 +310,11 @@ type DefineSpec = Omit<GetDotenvCliPlugin, 'children' | 'use'> & {
|
|
|
187
310
|
*/
|
|
188
311
|
declare const definePlugin: (spec: DefineSpec) => GetDotenvCliPlugin;
|
|
189
312
|
|
|
190
|
-
|
|
191
|
-
|
|
313
|
+
/**
|
|
314
|
+
* Helper to retrieve the merged root options bag from any action handler
|
|
315
|
+
* that only has access to thisCommand. Avoids structural casts.
|
|
316
|
+
*/
|
|
317
|
+
declare const readMergedOptions: (cmd: Command) => GetDotenvCliOptions | undefined;
|
|
318
|
+
|
|
319
|
+
export { GetDotenvCli, definePlugin, readMergedOptions };
|
|
320
|
+
export type { DefineSpec, GetDotenvCliCtx, GetDotenvCliOptions, GetDotenvCliPlugin, ScriptsTable };
|
package/dist/cliHost.d.mts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
import { ZodType } from 'zod';
|
|
2
1
|
import { Command } from 'commander';
|
|
2
|
+
import { ZodType } from 'zod';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Scripts table shape (configurable shell type).
|
|
6
|
+
*/
|
|
7
|
+
type ScriptsTable<TShell extends string | boolean = string | boolean> = Record<string, string | {
|
|
8
|
+
cmd: string;
|
|
9
|
+
shell?: TShell;
|
|
10
|
+
}>;
|
|
3
11
|
|
|
4
12
|
/**
|
|
5
13
|
* A minimal representation of an environment key/value mapping.
|
|
@@ -95,6 +103,93 @@ interface GetDotenvOptions {
|
|
|
95
103
|
useConfigLoader?: boolean;
|
|
96
104
|
}
|
|
97
105
|
|
|
106
|
+
type Scripts = Record<string, string | {
|
|
107
|
+
cmd: string;
|
|
108
|
+
shell?: string | boolean;
|
|
109
|
+
}>;
|
|
110
|
+
/**
|
|
111
|
+
* Options passed programmatically to `getDotenvCli`.
|
|
112
|
+
*/
|
|
113
|
+
interface GetDotenvCliOptions extends Omit<GetDotenvOptions, 'paths' | 'vars'> {
|
|
114
|
+
/**
|
|
115
|
+
* Logs CLI internals when true.
|
|
116
|
+
*/
|
|
117
|
+
debug?: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Strict mode: fail the run when env validation issues are detected
|
|
120
|
+
* (schema or requiredKeys). Warns by default when false or unset.
|
|
121
|
+
*/
|
|
122
|
+
strict?: boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Redaction (presentation): mask secret-like values in logs/trace.
|
|
125
|
+
*/
|
|
126
|
+
redact?: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Entropy warnings (presentation): emit once-per-key warnings for high-entropy values.
|
|
129
|
+
*/
|
|
130
|
+
warnEntropy?: boolean;
|
|
131
|
+
entropyThreshold?: number;
|
|
132
|
+
entropyMinLength?: number;
|
|
133
|
+
entropyWhitelist?: string[];
|
|
134
|
+
redactPatterns?: string[];
|
|
135
|
+
/**
|
|
136
|
+
* When true, capture child stdout/stderr and re-emit after completion.
|
|
137
|
+
* Useful for tests/CI. Default behavior is streaming via stdio: 'inherit'.
|
|
138
|
+
*/
|
|
139
|
+
capture?: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* A delimited string of paths to dotenv files.
|
|
142
|
+
*/
|
|
143
|
+
paths?: string;
|
|
144
|
+
/**
|
|
145
|
+
* A delimiter string with which to split `paths`. Only used if
|
|
146
|
+
* `pathsDelimiterPattern` is not provided.
|
|
147
|
+
*/
|
|
148
|
+
pathsDelimiter?: string;
|
|
149
|
+
/**
|
|
150
|
+
* A regular expression pattern with which to split `paths`. Supersedes
|
|
151
|
+
* `pathsDelimiter`.
|
|
152
|
+
*/
|
|
153
|
+
pathsDelimiterPattern?: string;
|
|
154
|
+
/**
|
|
155
|
+
* Scripts that can be executed from the CLI, either individually or via the batch subcommand.
|
|
156
|
+
*/
|
|
157
|
+
scripts?: Scripts;
|
|
158
|
+
/**
|
|
159
|
+
* Determines how commands and scripts are executed. If `false` or
|
|
160
|
+
* `undefined`, commands are executed as plain Javascript using the default
|
|
161
|
+
* execa parser. If `true`, commands are executed using the default OS shell
|
|
162
|
+
* parser. Otherwise the user may provide a specific shell string (e.g.
|
|
163
|
+
* `/bin/bash`)
|
|
164
|
+
*/
|
|
165
|
+
shell?: string | boolean;
|
|
166
|
+
/**
|
|
167
|
+
* A delimited string of key-value pairs declaratively specifying variables &
|
|
168
|
+
* values to be loaded in addition to any dotenv files.
|
|
169
|
+
*/
|
|
170
|
+
vars?: string;
|
|
171
|
+
/**
|
|
172
|
+
* A string with which to split keys from values in `vars`. Only used if
|
|
173
|
+
* `varsDelimiterPattern` is not provided.
|
|
174
|
+
*/
|
|
175
|
+
varsAssignor?: string;
|
|
176
|
+
/**
|
|
177
|
+
* A regular expression pattern with which to split variable names from values
|
|
178
|
+
* in `vars`. Supersedes `varsAssignor`.
|
|
179
|
+
*/
|
|
180
|
+
varsAssignorPattern?: string;
|
|
181
|
+
/**
|
|
182
|
+
* A string with which to split `vars` into key-value pairs. Only used if
|
|
183
|
+
* `varsDelimiterPattern` is not provided.
|
|
184
|
+
*/
|
|
185
|
+
varsDelimiter?: string;
|
|
186
|
+
/**
|
|
187
|
+
* A regular expression pattern with which to split `vars` into key-value
|
|
188
|
+
* pairs. Supersedes `varsDelimiter`.
|
|
189
|
+
*/
|
|
190
|
+
varsDelimiterPattern?: string;
|
|
191
|
+
}
|
|
192
|
+
|
|
98
193
|
/** * Per-invocation context shared with plugins and actions. */
|
|
99
194
|
type GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> = {
|
|
100
195
|
optionsResolved: TOptions;
|
|
@@ -102,6 +197,7 @@ type GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> = {
|
|
|
102
197
|
plugins?: Record<string, unknown>;
|
|
103
198
|
pluginConfigs?: Record<string, unknown>;
|
|
104
199
|
};
|
|
200
|
+
declare const HELP_HEADER_SYMBOL: unique symbol;
|
|
105
201
|
/**
|
|
106
202
|
* Plugin-first CLI host for get-dotenv. Extends Commander.Command.
|
|
107
203
|
*
|
|
@@ -114,10 +210,13 @@ type GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> = {
|
|
|
114
210
|
* NOTE: This host is additive and does not alter the legacy CLI.
|
|
115
211
|
*/
|
|
116
212
|
declare class GetDotenvCli<TOptions extends GetDotenvOptions = GetDotenvOptions> extends Command {
|
|
213
|
+
#private;
|
|
117
214
|
/** Registered top-level plugins (composition happens via .use()) */
|
|
118
215
|
private _plugins;
|
|
119
216
|
/** One-time installation guard */
|
|
120
217
|
private _installed;
|
|
218
|
+
/** Optional header line to prepend in help output */
|
|
219
|
+
private [HELP_HEADER_SYMBOL];
|
|
121
220
|
constructor(alias?: string);
|
|
122
221
|
/**
|
|
123
222
|
* Resolve options (strict) and compute dotenv context. * Stores the context on the instance under a symbol.
|
|
@@ -127,9 +226,33 @@ declare class GetDotenvCli<TOptions extends GetDotenvOptions = GetDotenvOptions>
|
|
|
127
226
|
* Retrieve the current invocation context (if any).
|
|
128
227
|
*/
|
|
129
228
|
getCtx(): GetDotenvCliCtx<TOptions> | undefined;
|
|
229
|
+
/**
|
|
230
|
+
* Retrieve the merged root CLI options bag (if set by passOptions()).
|
|
231
|
+
* Downstream-safe: no generics required.
|
|
232
|
+
*/
|
|
233
|
+
getOptions(): GetDotenvCliOptions | undefined;
|
|
234
|
+
/** Internal: set the merged root options bag for this run. */
|
|
235
|
+
_setOptionsBag(bag: GetDotenvCliOptions): void;
|
|
130
236
|
/** * Convenience helper to create a namespaced subcommand.
|
|
131
237
|
*/
|
|
132
238
|
ns(name: string): Command;
|
|
239
|
+
/**
|
|
240
|
+
* Tag options added during the provided callback as 'app' for grouped help.
|
|
241
|
+
* Allows downstream apps to demarcate their root-level options.
|
|
242
|
+
*/
|
|
243
|
+
tagAppOptions<T>(fn: (root: Command) => T): T;
|
|
244
|
+
/**
|
|
245
|
+
* Branding helper: set CLI name/description/version and optional help header.
|
|
246
|
+
* If version is omitted and importMetaUrl is provided, attempts to read the
|
|
247
|
+
* nearest package.json version (best-effort; non-fatal on failure).
|
|
248
|
+
*/
|
|
249
|
+
brand(args: {
|
|
250
|
+
name?: string;
|
|
251
|
+
description?: string;
|
|
252
|
+
version?: string;
|
|
253
|
+
importMetaUrl?: string;
|
|
254
|
+
helpHeader?: string;
|
|
255
|
+
}): Promise<this>;
|
|
133
256
|
/**
|
|
134
257
|
* Register a plugin for installation (parent level).
|
|
135
258
|
* Installation occurs on first resolveAndLoad() (or explicit install()).
|
|
@@ -187,5 +310,11 @@ type DefineSpec = Omit<GetDotenvCliPlugin, 'children' | 'use'> & {
|
|
|
187
310
|
*/
|
|
188
311
|
declare const definePlugin: (spec: DefineSpec) => GetDotenvCliPlugin;
|
|
189
312
|
|
|
190
|
-
|
|
191
|
-
|
|
313
|
+
/**
|
|
314
|
+
* Helper to retrieve the merged root options bag from any action handler
|
|
315
|
+
* that only has access to thisCommand. Avoids structural casts.
|
|
316
|
+
*/
|
|
317
|
+
declare const readMergedOptions: (cmd: Command) => GetDotenvCliOptions | undefined;
|
|
318
|
+
|
|
319
|
+
export { GetDotenvCli, definePlugin, readMergedOptions };
|
|
320
|
+
export type { DefineSpec, GetDotenvCliCtx, GetDotenvCliOptions, GetDotenvCliPlugin, ScriptsTable };
|
package/dist/cliHost.d.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
import { ZodType } from 'zod';
|
|
2
1
|
import { Command } from 'commander';
|
|
2
|
+
import { ZodType } from 'zod';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Scripts table shape (configurable shell type).
|
|
6
|
+
*/
|
|
7
|
+
type ScriptsTable<TShell extends string | boolean = string | boolean> = Record<string, string | {
|
|
8
|
+
cmd: string;
|
|
9
|
+
shell?: TShell;
|
|
10
|
+
}>;
|
|
3
11
|
|
|
4
12
|
/**
|
|
5
13
|
* A minimal representation of an environment key/value mapping.
|
|
@@ -95,6 +103,93 @@ interface GetDotenvOptions {
|
|
|
95
103
|
useConfigLoader?: boolean;
|
|
96
104
|
}
|
|
97
105
|
|
|
106
|
+
type Scripts = Record<string, string | {
|
|
107
|
+
cmd: string;
|
|
108
|
+
shell?: string | boolean;
|
|
109
|
+
}>;
|
|
110
|
+
/**
|
|
111
|
+
* Options passed programmatically to `getDotenvCli`.
|
|
112
|
+
*/
|
|
113
|
+
interface GetDotenvCliOptions extends Omit<GetDotenvOptions, 'paths' | 'vars'> {
|
|
114
|
+
/**
|
|
115
|
+
* Logs CLI internals when true.
|
|
116
|
+
*/
|
|
117
|
+
debug?: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Strict mode: fail the run when env validation issues are detected
|
|
120
|
+
* (schema or requiredKeys). Warns by default when false or unset.
|
|
121
|
+
*/
|
|
122
|
+
strict?: boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Redaction (presentation): mask secret-like values in logs/trace.
|
|
125
|
+
*/
|
|
126
|
+
redact?: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Entropy warnings (presentation): emit once-per-key warnings for high-entropy values.
|
|
129
|
+
*/
|
|
130
|
+
warnEntropy?: boolean;
|
|
131
|
+
entropyThreshold?: number;
|
|
132
|
+
entropyMinLength?: number;
|
|
133
|
+
entropyWhitelist?: string[];
|
|
134
|
+
redactPatterns?: string[];
|
|
135
|
+
/**
|
|
136
|
+
* When true, capture child stdout/stderr and re-emit after completion.
|
|
137
|
+
* Useful for tests/CI. Default behavior is streaming via stdio: 'inherit'.
|
|
138
|
+
*/
|
|
139
|
+
capture?: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* A delimited string of paths to dotenv files.
|
|
142
|
+
*/
|
|
143
|
+
paths?: string;
|
|
144
|
+
/**
|
|
145
|
+
* A delimiter string with which to split `paths`. Only used if
|
|
146
|
+
* `pathsDelimiterPattern` is not provided.
|
|
147
|
+
*/
|
|
148
|
+
pathsDelimiter?: string;
|
|
149
|
+
/**
|
|
150
|
+
* A regular expression pattern with which to split `paths`. Supersedes
|
|
151
|
+
* `pathsDelimiter`.
|
|
152
|
+
*/
|
|
153
|
+
pathsDelimiterPattern?: string;
|
|
154
|
+
/**
|
|
155
|
+
* Scripts that can be executed from the CLI, either individually or via the batch subcommand.
|
|
156
|
+
*/
|
|
157
|
+
scripts?: Scripts;
|
|
158
|
+
/**
|
|
159
|
+
* Determines how commands and scripts are executed. If `false` or
|
|
160
|
+
* `undefined`, commands are executed as plain Javascript using the default
|
|
161
|
+
* execa parser. If `true`, commands are executed using the default OS shell
|
|
162
|
+
* parser. Otherwise the user may provide a specific shell string (e.g.
|
|
163
|
+
* `/bin/bash`)
|
|
164
|
+
*/
|
|
165
|
+
shell?: string | boolean;
|
|
166
|
+
/**
|
|
167
|
+
* A delimited string of key-value pairs declaratively specifying variables &
|
|
168
|
+
* values to be loaded in addition to any dotenv files.
|
|
169
|
+
*/
|
|
170
|
+
vars?: string;
|
|
171
|
+
/**
|
|
172
|
+
* A string with which to split keys from values in `vars`. Only used if
|
|
173
|
+
* `varsDelimiterPattern` is not provided.
|
|
174
|
+
*/
|
|
175
|
+
varsAssignor?: string;
|
|
176
|
+
/**
|
|
177
|
+
* A regular expression pattern with which to split variable names from values
|
|
178
|
+
* in `vars`. Supersedes `varsAssignor`.
|
|
179
|
+
*/
|
|
180
|
+
varsAssignorPattern?: string;
|
|
181
|
+
/**
|
|
182
|
+
* A string with which to split `vars` into key-value pairs. Only used if
|
|
183
|
+
* `varsDelimiterPattern` is not provided.
|
|
184
|
+
*/
|
|
185
|
+
varsDelimiter?: string;
|
|
186
|
+
/**
|
|
187
|
+
* A regular expression pattern with which to split `vars` into key-value
|
|
188
|
+
* pairs. Supersedes `varsDelimiter`.
|
|
189
|
+
*/
|
|
190
|
+
varsDelimiterPattern?: string;
|
|
191
|
+
}
|
|
192
|
+
|
|
98
193
|
/** * Per-invocation context shared with plugins and actions. */
|
|
99
194
|
type GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> = {
|
|
100
195
|
optionsResolved: TOptions;
|
|
@@ -102,6 +197,7 @@ type GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> = {
|
|
|
102
197
|
plugins?: Record<string, unknown>;
|
|
103
198
|
pluginConfigs?: Record<string, unknown>;
|
|
104
199
|
};
|
|
200
|
+
declare const HELP_HEADER_SYMBOL: unique symbol;
|
|
105
201
|
/**
|
|
106
202
|
* Plugin-first CLI host for get-dotenv. Extends Commander.Command.
|
|
107
203
|
*
|
|
@@ -114,10 +210,13 @@ type GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> = {
|
|
|
114
210
|
* NOTE: This host is additive and does not alter the legacy CLI.
|
|
115
211
|
*/
|
|
116
212
|
declare class GetDotenvCli<TOptions extends GetDotenvOptions = GetDotenvOptions> extends Command {
|
|
213
|
+
#private;
|
|
117
214
|
/** Registered top-level plugins (composition happens via .use()) */
|
|
118
215
|
private _plugins;
|
|
119
216
|
/** One-time installation guard */
|
|
120
217
|
private _installed;
|
|
218
|
+
/** Optional header line to prepend in help output */
|
|
219
|
+
private [HELP_HEADER_SYMBOL];
|
|
121
220
|
constructor(alias?: string);
|
|
122
221
|
/**
|
|
123
222
|
* Resolve options (strict) and compute dotenv context. * Stores the context on the instance under a symbol.
|
|
@@ -127,9 +226,33 @@ declare class GetDotenvCli<TOptions extends GetDotenvOptions = GetDotenvOptions>
|
|
|
127
226
|
* Retrieve the current invocation context (if any).
|
|
128
227
|
*/
|
|
129
228
|
getCtx(): GetDotenvCliCtx<TOptions> | undefined;
|
|
229
|
+
/**
|
|
230
|
+
* Retrieve the merged root CLI options bag (if set by passOptions()).
|
|
231
|
+
* Downstream-safe: no generics required.
|
|
232
|
+
*/
|
|
233
|
+
getOptions(): GetDotenvCliOptions | undefined;
|
|
234
|
+
/** Internal: set the merged root options bag for this run. */
|
|
235
|
+
_setOptionsBag(bag: GetDotenvCliOptions): void;
|
|
130
236
|
/** * Convenience helper to create a namespaced subcommand.
|
|
131
237
|
*/
|
|
132
238
|
ns(name: string): Command;
|
|
239
|
+
/**
|
|
240
|
+
* Tag options added during the provided callback as 'app' for grouped help.
|
|
241
|
+
* Allows downstream apps to demarcate their root-level options.
|
|
242
|
+
*/
|
|
243
|
+
tagAppOptions<T>(fn: (root: Command) => T): T;
|
|
244
|
+
/**
|
|
245
|
+
* Branding helper: set CLI name/description/version and optional help header.
|
|
246
|
+
* If version is omitted and importMetaUrl is provided, attempts to read the
|
|
247
|
+
* nearest package.json version (best-effort; non-fatal on failure).
|
|
248
|
+
*/
|
|
249
|
+
brand(args: {
|
|
250
|
+
name?: string;
|
|
251
|
+
description?: string;
|
|
252
|
+
version?: string;
|
|
253
|
+
importMetaUrl?: string;
|
|
254
|
+
helpHeader?: string;
|
|
255
|
+
}): Promise<this>;
|
|
133
256
|
/**
|
|
134
257
|
* Register a plugin for installation (parent level).
|
|
135
258
|
* Installation occurs on first resolveAndLoad() (or explicit install()).
|
|
@@ -187,5 +310,11 @@ type DefineSpec = Omit<GetDotenvCliPlugin, 'children' | 'use'> & {
|
|
|
187
310
|
*/
|
|
188
311
|
declare const definePlugin: (spec: DefineSpec) => GetDotenvCliPlugin;
|
|
189
312
|
|
|
190
|
-
|
|
191
|
-
|
|
313
|
+
/**
|
|
314
|
+
* Helper to retrieve the merged root options bag from any action handler
|
|
315
|
+
* that only has access to thisCommand. Avoids structural casts.
|
|
316
|
+
*/
|
|
317
|
+
declare const readMergedOptions: (cmd: Command) => GetDotenvCliOptions | undefined;
|
|
318
|
+
|
|
319
|
+
export { GetDotenvCli, definePlugin, readMergedOptions };
|
|
320
|
+
export type { DefineSpec, GetDotenvCliCtx, GetDotenvCliOptions, GetDotenvCliPlugin, ScriptsTable };
|