@karmaniverous/get-dotenv 5.0.0 → 5.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.
- package/dist/cliHost.cjs +172 -3
- package/dist/cliHost.d.cts +115 -3
- package/dist/cliHost.d.mts +115 -3
- package/dist/cliHost.d.ts +115 -3
- package/dist/cliHost.mjs +172 -4
- package/dist/getdotenv.cli.mjs +200 -4
- package/dist/index.cjs +25 -0
- package/dist/index.mjs +25 -0
- package/dist/plugins-aws.d.cts +98 -0
- package/dist/plugins-aws.d.mts +98 -0
- package/dist/plugins-aws.d.ts +98 -0
- package/dist/plugins-batch.d.cts +98 -0
- package/dist/plugins-batch.d.mts +98 -0
- package/dist/plugins-batch.d.ts +98 -0
- package/dist/plugins-init.d.cts +98 -0
- package/dist/plugins-init.d.mts +98 -0
- package/dist/plugins-init.d.ts +98 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -155,6 +155,28 @@ const dotenvExpandFromProcessEnv = (value) => dotenvExpand(value, process.env);
|
|
|
155
155
|
* Uses provided defaults to render help labels without coupling to generators.
|
|
156
156
|
*/
|
|
157
157
|
const attachRootOptions = (program, defaults, opts) => {
|
|
158
|
+
// Install temporary wrappers to tag all options added here as "base".
|
|
159
|
+
const GROUP = 'base';
|
|
160
|
+
const tagLatest = (cmd, group) => {
|
|
161
|
+
const optsArr = cmd.options;
|
|
162
|
+
if (Array.isArray(optsArr) && optsArr.length > 0) {
|
|
163
|
+
const last = optsArr[optsArr.length - 1];
|
|
164
|
+
last.__group = group;
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
const originalAddOption = program.addOption.bind(program);
|
|
168
|
+
const originalOption = program.option.bind(program);
|
|
169
|
+
program.addOption = function patchedAdd(opt) {
|
|
170
|
+
// Tag before adding, in case consumers inspect the Option directly.
|
|
171
|
+
opt.__group = GROUP;
|
|
172
|
+
const ret = originalAddOption(opt);
|
|
173
|
+
return ret;
|
|
174
|
+
};
|
|
175
|
+
program.option = function patchedOption(...args) {
|
|
176
|
+
const ret = originalOption(...args);
|
|
177
|
+
tagLatest(this, GROUP);
|
|
178
|
+
return ret;
|
|
179
|
+
};
|
|
158
180
|
const { defaultEnv, dotenvToken, dynamicPath, env, excludeDynamic, excludeEnv, excludeGlobal, excludePrivate, excludePublic, loadProcess, log, outputPath, paths, pathsDelimiter, pathsDelimiterPattern, privateToken, scripts, shell, varsAssignor, varsAssignorPattern, varsDelimiter, varsDelimiterPattern, } = defaults ?? {};
|
|
159
181
|
const va = typeof defaults?.varsAssignor === 'string' ? defaults.varsAssignor : '=';
|
|
160
182
|
const vd = typeof defaults?.varsDelimiter === 'string' ? defaults.varsDelimiter : ' ';
|
|
@@ -227,6 +249,9 @@ const attachRootOptions = (program, defaults, opts) => {
|
|
|
227
249
|
.hideHelp());
|
|
228
250
|
// Diagnostics: opt-in tracing; optional variadic keys after the flag.
|
|
229
251
|
p = p.option('--trace [keys...]', 'emit diagnostics for child env composition (optional keys)');
|
|
252
|
+
// Restore original methods to avoid tagging future additions outside base.
|
|
253
|
+
program.addOption = originalAddOption;
|
|
254
|
+
program.option = originalOption;
|
|
230
255
|
return p;
|
|
231
256
|
};
|
|
232
257
|
|
package/dist/index.mjs
CHANGED
|
@@ -152,6 +152,28 @@ const dotenvExpandFromProcessEnv = (value) => dotenvExpand(value, process.env);
|
|
|
152
152
|
* Uses provided defaults to render help labels without coupling to generators.
|
|
153
153
|
*/
|
|
154
154
|
const attachRootOptions = (program, defaults, opts) => {
|
|
155
|
+
// Install temporary wrappers to tag all options added here as "base".
|
|
156
|
+
const GROUP = 'base';
|
|
157
|
+
const tagLatest = (cmd, group) => {
|
|
158
|
+
const optsArr = cmd.options;
|
|
159
|
+
if (Array.isArray(optsArr) && optsArr.length > 0) {
|
|
160
|
+
const last = optsArr[optsArr.length - 1];
|
|
161
|
+
last.__group = group;
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
const originalAddOption = program.addOption.bind(program);
|
|
165
|
+
const originalOption = program.option.bind(program);
|
|
166
|
+
program.addOption = function patchedAdd(opt) {
|
|
167
|
+
// Tag before adding, in case consumers inspect the Option directly.
|
|
168
|
+
opt.__group = GROUP;
|
|
169
|
+
const ret = originalAddOption(opt);
|
|
170
|
+
return ret;
|
|
171
|
+
};
|
|
172
|
+
program.option = function patchedOption(...args) {
|
|
173
|
+
const ret = originalOption(...args);
|
|
174
|
+
tagLatest(this, GROUP);
|
|
175
|
+
return ret;
|
|
176
|
+
};
|
|
155
177
|
const { defaultEnv, dotenvToken, dynamicPath, env, excludeDynamic, excludeEnv, excludeGlobal, excludePrivate, excludePublic, loadProcess, log, outputPath, paths, pathsDelimiter, pathsDelimiterPattern, privateToken, scripts, shell, varsAssignor, varsAssignorPattern, varsDelimiter, varsDelimiterPattern, } = defaults ?? {};
|
|
156
178
|
const va = typeof defaults?.varsAssignor === 'string' ? defaults.varsAssignor : '=';
|
|
157
179
|
const vd = typeof defaults?.varsDelimiter === 'string' ? defaults.varsDelimiter : ' ';
|
|
@@ -224,6 +246,9 @@ const attachRootOptions = (program, defaults, opts) => {
|
|
|
224
246
|
.hideHelp());
|
|
225
247
|
// Diagnostics: opt-in tracing; optional variadic keys after the flag.
|
|
226
248
|
p = p.option('--trace [keys...]', 'emit diagnostics for child env composition (optional keys)');
|
|
249
|
+
// Restore original methods to avoid tagging future additions outside base.
|
|
250
|
+
program.addOption = originalAddOption;
|
|
251
|
+
program.option = originalOption;
|
|
227
252
|
return p;
|
|
228
253
|
};
|
|
229
254
|
|
package/dist/plugins-aws.d.cts
CHANGED
|
@@ -95,6 +95,76 @@ interface GetDotenvOptions {
|
|
|
95
95
|
useConfigLoader?: boolean;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
type Scripts = Record<string, string | {
|
|
99
|
+
cmd: string;
|
|
100
|
+
shell?: string | boolean;
|
|
101
|
+
}>;
|
|
102
|
+
/**
|
|
103
|
+
* Options passed programmatically to `getDotenvCli`.
|
|
104
|
+
*/
|
|
105
|
+
interface GetDotenvCliOptions extends Omit<GetDotenvOptions, 'paths' | 'vars'> {
|
|
106
|
+
/**
|
|
107
|
+
* Logs CLI internals when true.
|
|
108
|
+
*/
|
|
109
|
+
debug?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* When true, capture child stdout/stderr and re-emit after completion.
|
|
112
|
+
* Useful for tests/CI. Default behavior is streaming via stdio: 'inherit'.
|
|
113
|
+
*/
|
|
114
|
+
capture?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* A delimited string of paths to dotenv files.
|
|
117
|
+
*/
|
|
118
|
+
paths?: string;
|
|
119
|
+
/**
|
|
120
|
+
* A delimiter string with which to split `paths`. Only used if
|
|
121
|
+
* `pathsDelimiterPattern` is not provided.
|
|
122
|
+
*/
|
|
123
|
+
pathsDelimiter?: string;
|
|
124
|
+
/**
|
|
125
|
+
* A regular expression pattern with which to split `paths`. Supersedes
|
|
126
|
+
* `pathsDelimiter`.
|
|
127
|
+
*/
|
|
128
|
+
pathsDelimiterPattern?: string;
|
|
129
|
+
/**
|
|
130
|
+
* Scripts that can be executed from the CLI, either individually or via the batch subcommand.
|
|
131
|
+
*/
|
|
132
|
+
scripts?: Scripts;
|
|
133
|
+
/**
|
|
134
|
+
* Determines how commands and scripts are executed. If `false` or
|
|
135
|
+
* `undefined`, commands are executed as plain Javascript using the default
|
|
136
|
+
* execa parser. If `true`, commands are executed using the default OS shell
|
|
137
|
+
* parser. Otherwise the user may provide a specific shell string (e.g.
|
|
138
|
+
* `/bin/bash`)
|
|
139
|
+
*/
|
|
140
|
+
shell?: string | boolean;
|
|
141
|
+
/**
|
|
142
|
+
* A delimited string of key-value pairs declaratively specifying variables &
|
|
143
|
+
* values to be loaded in addition to any dotenv files.
|
|
144
|
+
*/
|
|
145
|
+
vars?: string;
|
|
146
|
+
/**
|
|
147
|
+
* A string with which to split keys from values in `vars`. Only used if
|
|
148
|
+
* `varsDelimiterPattern` is not provided.
|
|
149
|
+
*/
|
|
150
|
+
varsAssignor?: string;
|
|
151
|
+
/**
|
|
152
|
+
* A regular expression pattern with which to split variable names from values
|
|
153
|
+
* in `vars`. Supersedes `varsAssignor`.
|
|
154
|
+
*/
|
|
155
|
+
varsAssignorPattern?: string;
|
|
156
|
+
/**
|
|
157
|
+
* A string with which to split `vars` into key-value pairs. Only used if
|
|
158
|
+
* `varsDelimiterPattern` is not provided.
|
|
159
|
+
*/
|
|
160
|
+
varsDelimiter?: string;
|
|
161
|
+
/**
|
|
162
|
+
* A regular expression pattern with which to split `vars` into key-value
|
|
163
|
+
* pairs. Supersedes `varsDelimiter`.
|
|
164
|
+
*/
|
|
165
|
+
varsDelimiterPattern?: string;
|
|
166
|
+
}
|
|
167
|
+
|
|
98
168
|
/** * Per-invocation context shared with plugins and actions. */
|
|
99
169
|
type GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> = {
|
|
100
170
|
optionsResolved: TOptions;
|
|
@@ -102,6 +172,7 @@ type GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> = {
|
|
|
102
172
|
plugins?: Record<string, unknown>;
|
|
103
173
|
pluginConfigs?: Record<string, unknown>;
|
|
104
174
|
};
|
|
175
|
+
declare const HELP_HEADER_SYMBOL: unique symbol;
|
|
105
176
|
/**
|
|
106
177
|
* Plugin-first CLI host for get-dotenv. Extends Commander.Command.
|
|
107
178
|
*
|
|
@@ -114,10 +185,13 @@ type GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> = {
|
|
|
114
185
|
* NOTE: This host is additive and does not alter the legacy CLI.
|
|
115
186
|
*/
|
|
116
187
|
declare class GetDotenvCli<TOptions extends GetDotenvOptions = GetDotenvOptions> extends Command {
|
|
188
|
+
#private;
|
|
117
189
|
/** Registered top-level plugins (composition happens via .use()) */
|
|
118
190
|
private _plugins;
|
|
119
191
|
/** One-time installation guard */
|
|
120
192
|
private _installed;
|
|
193
|
+
/** Optional header line to prepend in help output */
|
|
194
|
+
private [HELP_HEADER_SYMBOL];
|
|
121
195
|
constructor(alias?: string);
|
|
122
196
|
/**
|
|
123
197
|
* Resolve options (strict) and compute dotenv context. * Stores the context on the instance under a symbol.
|
|
@@ -127,9 +201,33 @@ declare class GetDotenvCli<TOptions extends GetDotenvOptions = GetDotenvOptions>
|
|
|
127
201
|
* Retrieve the current invocation context (if any).
|
|
128
202
|
*/
|
|
129
203
|
getCtx(): GetDotenvCliCtx<TOptions> | undefined;
|
|
204
|
+
/**
|
|
205
|
+
* Retrieve the merged root CLI options bag (if set by passOptions()).
|
|
206
|
+
* Downstream-safe: no generics required.
|
|
207
|
+
*/
|
|
208
|
+
getOptions(): GetDotenvCliOptions | undefined;
|
|
209
|
+
/** Internal: set the merged root options bag for this run. */
|
|
210
|
+
_setOptionsBag(bag: GetDotenvCliOptions): void;
|
|
130
211
|
/** * Convenience helper to create a namespaced subcommand.
|
|
131
212
|
*/
|
|
132
213
|
ns(name: string): Command;
|
|
214
|
+
/**
|
|
215
|
+
* Tag options added during the provided callback as 'app' for grouped help.
|
|
216
|
+
* Allows downstream apps to demarcate their root-level options.
|
|
217
|
+
*/
|
|
218
|
+
tagAppOptions<T>(fn: (root: Command) => T): T;
|
|
219
|
+
/**
|
|
220
|
+
* Branding helper: set CLI name/description/version and optional help header.
|
|
221
|
+
* If version is omitted and importMetaUrl is provided, attempts to read the
|
|
222
|
+
* nearest package.json version (best-effort; non-fatal on failure).
|
|
223
|
+
*/
|
|
224
|
+
brand(args: {
|
|
225
|
+
name?: string;
|
|
226
|
+
description?: string;
|
|
227
|
+
version?: string;
|
|
228
|
+
importMetaUrl?: string;
|
|
229
|
+
helpHeader?: string;
|
|
230
|
+
}): Promise<this>;
|
|
133
231
|
/**
|
|
134
232
|
* Register a plugin for installation (parent level).
|
|
135
233
|
* Installation occurs on first resolveAndLoad() (or explicit install()).
|
package/dist/plugins-aws.d.mts
CHANGED
|
@@ -95,6 +95,76 @@ interface GetDotenvOptions {
|
|
|
95
95
|
useConfigLoader?: boolean;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
type Scripts = Record<string, string | {
|
|
99
|
+
cmd: string;
|
|
100
|
+
shell?: string | boolean;
|
|
101
|
+
}>;
|
|
102
|
+
/**
|
|
103
|
+
* Options passed programmatically to `getDotenvCli`.
|
|
104
|
+
*/
|
|
105
|
+
interface GetDotenvCliOptions extends Omit<GetDotenvOptions, 'paths' | 'vars'> {
|
|
106
|
+
/**
|
|
107
|
+
* Logs CLI internals when true.
|
|
108
|
+
*/
|
|
109
|
+
debug?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* When true, capture child stdout/stderr and re-emit after completion.
|
|
112
|
+
* Useful for tests/CI. Default behavior is streaming via stdio: 'inherit'.
|
|
113
|
+
*/
|
|
114
|
+
capture?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* A delimited string of paths to dotenv files.
|
|
117
|
+
*/
|
|
118
|
+
paths?: string;
|
|
119
|
+
/**
|
|
120
|
+
* A delimiter string with which to split `paths`. Only used if
|
|
121
|
+
* `pathsDelimiterPattern` is not provided.
|
|
122
|
+
*/
|
|
123
|
+
pathsDelimiter?: string;
|
|
124
|
+
/**
|
|
125
|
+
* A regular expression pattern with which to split `paths`. Supersedes
|
|
126
|
+
* `pathsDelimiter`.
|
|
127
|
+
*/
|
|
128
|
+
pathsDelimiterPattern?: string;
|
|
129
|
+
/**
|
|
130
|
+
* Scripts that can be executed from the CLI, either individually or via the batch subcommand.
|
|
131
|
+
*/
|
|
132
|
+
scripts?: Scripts;
|
|
133
|
+
/**
|
|
134
|
+
* Determines how commands and scripts are executed. If `false` or
|
|
135
|
+
* `undefined`, commands are executed as plain Javascript using the default
|
|
136
|
+
* execa parser. If `true`, commands are executed using the default OS shell
|
|
137
|
+
* parser. Otherwise the user may provide a specific shell string (e.g.
|
|
138
|
+
* `/bin/bash`)
|
|
139
|
+
*/
|
|
140
|
+
shell?: string | boolean;
|
|
141
|
+
/**
|
|
142
|
+
* A delimited string of key-value pairs declaratively specifying variables &
|
|
143
|
+
* values to be loaded in addition to any dotenv files.
|
|
144
|
+
*/
|
|
145
|
+
vars?: string;
|
|
146
|
+
/**
|
|
147
|
+
* A string with which to split keys from values in `vars`. Only used if
|
|
148
|
+
* `varsDelimiterPattern` is not provided.
|
|
149
|
+
*/
|
|
150
|
+
varsAssignor?: string;
|
|
151
|
+
/**
|
|
152
|
+
* A regular expression pattern with which to split variable names from values
|
|
153
|
+
* in `vars`. Supersedes `varsAssignor`.
|
|
154
|
+
*/
|
|
155
|
+
varsAssignorPattern?: string;
|
|
156
|
+
/**
|
|
157
|
+
* A string with which to split `vars` into key-value pairs. Only used if
|
|
158
|
+
* `varsDelimiterPattern` is not provided.
|
|
159
|
+
*/
|
|
160
|
+
varsDelimiter?: string;
|
|
161
|
+
/**
|
|
162
|
+
* A regular expression pattern with which to split `vars` into key-value
|
|
163
|
+
* pairs. Supersedes `varsDelimiter`.
|
|
164
|
+
*/
|
|
165
|
+
varsDelimiterPattern?: string;
|
|
166
|
+
}
|
|
167
|
+
|
|
98
168
|
/** * Per-invocation context shared with plugins and actions. */
|
|
99
169
|
type GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> = {
|
|
100
170
|
optionsResolved: TOptions;
|
|
@@ -102,6 +172,7 @@ type GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> = {
|
|
|
102
172
|
plugins?: Record<string, unknown>;
|
|
103
173
|
pluginConfigs?: Record<string, unknown>;
|
|
104
174
|
};
|
|
175
|
+
declare const HELP_HEADER_SYMBOL: unique symbol;
|
|
105
176
|
/**
|
|
106
177
|
* Plugin-first CLI host for get-dotenv. Extends Commander.Command.
|
|
107
178
|
*
|
|
@@ -114,10 +185,13 @@ type GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> = {
|
|
|
114
185
|
* NOTE: This host is additive and does not alter the legacy CLI.
|
|
115
186
|
*/
|
|
116
187
|
declare class GetDotenvCli<TOptions extends GetDotenvOptions = GetDotenvOptions> extends Command {
|
|
188
|
+
#private;
|
|
117
189
|
/** Registered top-level plugins (composition happens via .use()) */
|
|
118
190
|
private _plugins;
|
|
119
191
|
/** One-time installation guard */
|
|
120
192
|
private _installed;
|
|
193
|
+
/** Optional header line to prepend in help output */
|
|
194
|
+
private [HELP_HEADER_SYMBOL];
|
|
121
195
|
constructor(alias?: string);
|
|
122
196
|
/**
|
|
123
197
|
* Resolve options (strict) and compute dotenv context. * Stores the context on the instance under a symbol.
|
|
@@ -127,9 +201,33 @@ declare class GetDotenvCli<TOptions extends GetDotenvOptions = GetDotenvOptions>
|
|
|
127
201
|
* Retrieve the current invocation context (if any).
|
|
128
202
|
*/
|
|
129
203
|
getCtx(): GetDotenvCliCtx<TOptions> | undefined;
|
|
204
|
+
/**
|
|
205
|
+
* Retrieve the merged root CLI options bag (if set by passOptions()).
|
|
206
|
+
* Downstream-safe: no generics required.
|
|
207
|
+
*/
|
|
208
|
+
getOptions(): GetDotenvCliOptions | undefined;
|
|
209
|
+
/** Internal: set the merged root options bag for this run. */
|
|
210
|
+
_setOptionsBag(bag: GetDotenvCliOptions): void;
|
|
130
211
|
/** * Convenience helper to create a namespaced subcommand.
|
|
131
212
|
*/
|
|
132
213
|
ns(name: string): Command;
|
|
214
|
+
/**
|
|
215
|
+
* Tag options added during the provided callback as 'app' for grouped help.
|
|
216
|
+
* Allows downstream apps to demarcate their root-level options.
|
|
217
|
+
*/
|
|
218
|
+
tagAppOptions<T>(fn: (root: Command) => T): T;
|
|
219
|
+
/**
|
|
220
|
+
* Branding helper: set CLI name/description/version and optional help header.
|
|
221
|
+
* If version is omitted and importMetaUrl is provided, attempts to read the
|
|
222
|
+
* nearest package.json version (best-effort; non-fatal on failure).
|
|
223
|
+
*/
|
|
224
|
+
brand(args: {
|
|
225
|
+
name?: string;
|
|
226
|
+
description?: string;
|
|
227
|
+
version?: string;
|
|
228
|
+
importMetaUrl?: string;
|
|
229
|
+
helpHeader?: string;
|
|
230
|
+
}): Promise<this>;
|
|
133
231
|
/**
|
|
134
232
|
* Register a plugin for installation (parent level).
|
|
135
233
|
* Installation occurs on first resolveAndLoad() (or explicit install()).
|
package/dist/plugins-aws.d.ts
CHANGED
|
@@ -95,6 +95,76 @@ interface GetDotenvOptions {
|
|
|
95
95
|
useConfigLoader?: boolean;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
type Scripts = Record<string, string | {
|
|
99
|
+
cmd: string;
|
|
100
|
+
shell?: string | boolean;
|
|
101
|
+
}>;
|
|
102
|
+
/**
|
|
103
|
+
* Options passed programmatically to `getDotenvCli`.
|
|
104
|
+
*/
|
|
105
|
+
interface GetDotenvCliOptions extends Omit<GetDotenvOptions, 'paths' | 'vars'> {
|
|
106
|
+
/**
|
|
107
|
+
* Logs CLI internals when true.
|
|
108
|
+
*/
|
|
109
|
+
debug?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* When true, capture child stdout/stderr and re-emit after completion.
|
|
112
|
+
* Useful for tests/CI. Default behavior is streaming via stdio: 'inherit'.
|
|
113
|
+
*/
|
|
114
|
+
capture?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* A delimited string of paths to dotenv files.
|
|
117
|
+
*/
|
|
118
|
+
paths?: string;
|
|
119
|
+
/**
|
|
120
|
+
* A delimiter string with which to split `paths`. Only used if
|
|
121
|
+
* `pathsDelimiterPattern` is not provided.
|
|
122
|
+
*/
|
|
123
|
+
pathsDelimiter?: string;
|
|
124
|
+
/**
|
|
125
|
+
* A regular expression pattern with which to split `paths`. Supersedes
|
|
126
|
+
* `pathsDelimiter`.
|
|
127
|
+
*/
|
|
128
|
+
pathsDelimiterPattern?: string;
|
|
129
|
+
/**
|
|
130
|
+
* Scripts that can be executed from the CLI, either individually or via the batch subcommand.
|
|
131
|
+
*/
|
|
132
|
+
scripts?: Scripts;
|
|
133
|
+
/**
|
|
134
|
+
* Determines how commands and scripts are executed. If `false` or
|
|
135
|
+
* `undefined`, commands are executed as plain Javascript using the default
|
|
136
|
+
* execa parser. If `true`, commands are executed using the default OS shell
|
|
137
|
+
* parser. Otherwise the user may provide a specific shell string (e.g.
|
|
138
|
+
* `/bin/bash`)
|
|
139
|
+
*/
|
|
140
|
+
shell?: string | boolean;
|
|
141
|
+
/**
|
|
142
|
+
* A delimited string of key-value pairs declaratively specifying variables &
|
|
143
|
+
* values to be loaded in addition to any dotenv files.
|
|
144
|
+
*/
|
|
145
|
+
vars?: string;
|
|
146
|
+
/**
|
|
147
|
+
* A string with which to split keys from values in `vars`. Only used if
|
|
148
|
+
* `varsDelimiterPattern` is not provided.
|
|
149
|
+
*/
|
|
150
|
+
varsAssignor?: string;
|
|
151
|
+
/**
|
|
152
|
+
* A regular expression pattern with which to split variable names from values
|
|
153
|
+
* in `vars`. Supersedes `varsAssignor`.
|
|
154
|
+
*/
|
|
155
|
+
varsAssignorPattern?: string;
|
|
156
|
+
/**
|
|
157
|
+
* A string with which to split `vars` into key-value pairs. Only used if
|
|
158
|
+
* `varsDelimiterPattern` is not provided.
|
|
159
|
+
*/
|
|
160
|
+
varsDelimiter?: string;
|
|
161
|
+
/**
|
|
162
|
+
* A regular expression pattern with which to split `vars` into key-value
|
|
163
|
+
* pairs. Supersedes `varsDelimiter`.
|
|
164
|
+
*/
|
|
165
|
+
varsDelimiterPattern?: string;
|
|
166
|
+
}
|
|
167
|
+
|
|
98
168
|
/** * Per-invocation context shared with plugins and actions. */
|
|
99
169
|
type GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> = {
|
|
100
170
|
optionsResolved: TOptions;
|
|
@@ -102,6 +172,7 @@ type GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> = {
|
|
|
102
172
|
plugins?: Record<string, unknown>;
|
|
103
173
|
pluginConfigs?: Record<string, unknown>;
|
|
104
174
|
};
|
|
175
|
+
declare const HELP_HEADER_SYMBOL: unique symbol;
|
|
105
176
|
/**
|
|
106
177
|
* Plugin-first CLI host for get-dotenv. Extends Commander.Command.
|
|
107
178
|
*
|
|
@@ -114,10 +185,13 @@ type GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> = {
|
|
|
114
185
|
* NOTE: This host is additive and does not alter the legacy CLI.
|
|
115
186
|
*/
|
|
116
187
|
declare class GetDotenvCli<TOptions extends GetDotenvOptions = GetDotenvOptions> extends Command {
|
|
188
|
+
#private;
|
|
117
189
|
/** Registered top-level plugins (composition happens via .use()) */
|
|
118
190
|
private _plugins;
|
|
119
191
|
/** One-time installation guard */
|
|
120
192
|
private _installed;
|
|
193
|
+
/** Optional header line to prepend in help output */
|
|
194
|
+
private [HELP_HEADER_SYMBOL];
|
|
121
195
|
constructor(alias?: string);
|
|
122
196
|
/**
|
|
123
197
|
* Resolve options (strict) and compute dotenv context. * Stores the context on the instance under a symbol.
|
|
@@ -127,9 +201,33 @@ declare class GetDotenvCli<TOptions extends GetDotenvOptions = GetDotenvOptions>
|
|
|
127
201
|
* Retrieve the current invocation context (if any).
|
|
128
202
|
*/
|
|
129
203
|
getCtx(): GetDotenvCliCtx<TOptions> | undefined;
|
|
204
|
+
/**
|
|
205
|
+
* Retrieve the merged root CLI options bag (if set by passOptions()).
|
|
206
|
+
* Downstream-safe: no generics required.
|
|
207
|
+
*/
|
|
208
|
+
getOptions(): GetDotenvCliOptions | undefined;
|
|
209
|
+
/** Internal: set the merged root options bag for this run. */
|
|
210
|
+
_setOptionsBag(bag: GetDotenvCliOptions): void;
|
|
130
211
|
/** * Convenience helper to create a namespaced subcommand.
|
|
131
212
|
*/
|
|
132
213
|
ns(name: string): Command;
|
|
214
|
+
/**
|
|
215
|
+
* Tag options added during the provided callback as 'app' for grouped help.
|
|
216
|
+
* Allows downstream apps to demarcate their root-level options.
|
|
217
|
+
*/
|
|
218
|
+
tagAppOptions<T>(fn: (root: Command) => T): T;
|
|
219
|
+
/**
|
|
220
|
+
* Branding helper: set CLI name/description/version and optional help header.
|
|
221
|
+
* If version is omitted and importMetaUrl is provided, attempts to read the
|
|
222
|
+
* nearest package.json version (best-effort; non-fatal on failure).
|
|
223
|
+
*/
|
|
224
|
+
brand(args: {
|
|
225
|
+
name?: string;
|
|
226
|
+
description?: string;
|
|
227
|
+
version?: string;
|
|
228
|
+
importMetaUrl?: string;
|
|
229
|
+
helpHeader?: string;
|
|
230
|
+
}): Promise<this>;
|
|
133
231
|
/**
|
|
134
232
|
* Register a plugin for installation (parent level).
|
|
135
233
|
* Installation occurs on first resolveAndLoad() (or explicit install()).
|
package/dist/plugins-batch.d.cts
CHANGED
|
@@ -95,6 +95,76 @@ interface GetDotenvOptions {
|
|
|
95
95
|
useConfigLoader?: boolean;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
type Scripts$1 = Record<string, string | {
|
|
99
|
+
cmd: string;
|
|
100
|
+
shell?: string | boolean;
|
|
101
|
+
}>;
|
|
102
|
+
/**
|
|
103
|
+
* Options passed programmatically to `getDotenvCli`.
|
|
104
|
+
*/
|
|
105
|
+
interface GetDotenvCliOptions extends Omit<GetDotenvOptions, 'paths' | 'vars'> {
|
|
106
|
+
/**
|
|
107
|
+
* Logs CLI internals when true.
|
|
108
|
+
*/
|
|
109
|
+
debug?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* When true, capture child stdout/stderr and re-emit after completion.
|
|
112
|
+
* Useful for tests/CI. Default behavior is streaming via stdio: 'inherit'.
|
|
113
|
+
*/
|
|
114
|
+
capture?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* A delimited string of paths to dotenv files.
|
|
117
|
+
*/
|
|
118
|
+
paths?: string;
|
|
119
|
+
/**
|
|
120
|
+
* A delimiter string with which to split `paths`. Only used if
|
|
121
|
+
* `pathsDelimiterPattern` is not provided.
|
|
122
|
+
*/
|
|
123
|
+
pathsDelimiter?: string;
|
|
124
|
+
/**
|
|
125
|
+
* A regular expression pattern with which to split `paths`. Supersedes
|
|
126
|
+
* `pathsDelimiter`.
|
|
127
|
+
*/
|
|
128
|
+
pathsDelimiterPattern?: string;
|
|
129
|
+
/**
|
|
130
|
+
* Scripts that can be executed from the CLI, either individually or via the batch subcommand.
|
|
131
|
+
*/
|
|
132
|
+
scripts?: Scripts$1;
|
|
133
|
+
/**
|
|
134
|
+
* Determines how commands and scripts are executed. If `false` or
|
|
135
|
+
* `undefined`, commands are executed as plain Javascript using the default
|
|
136
|
+
* execa parser. If `true`, commands are executed using the default OS shell
|
|
137
|
+
* parser. Otherwise the user may provide a specific shell string (e.g.
|
|
138
|
+
* `/bin/bash`)
|
|
139
|
+
*/
|
|
140
|
+
shell?: string | boolean;
|
|
141
|
+
/**
|
|
142
|
+
* A delimited string of key-value pairs declaratively specifying variables &
|
|
143
|
+
* values to be loaded in addition to any dotenv files.
|
|
144
|
+
*/
|
|
145
|
+
vars?: string;
|
|
146
|
+
/**
|
|
147
|
+
* A string with which to split keys from values in `vars`. Only used if
|
|
148
|
+
* `varsDelimiterPattern` is not provided.
|
|
149
|
+
*/
|
|
150
|
+
varsAssignor?: string;
|
|
151
|
+
/**
|
|
152
|
+
* A regular expression pattern with which to split variable names from values
|
|
153
|
+
* in `vars`. Supersedes `varsAssignor`.
|
|
154
|
+
*/
|
|
155
|
+
varsAssignorPattern?: string;
|
|
156
|
+
/**
|
|
157
|
+
* A string with which to split `vars` into key-value pairs. Only used if
|
|
158
|
+
* `varsDelimiterPattern` is not provided.
|
|
159
|
+
*/
|
|
160
|
+
varsDelimiter?: string;
|
|
161
|
+
/**
|
|
162
|
+
* A regular expression pattern with which to split `vars` into key-value
|
|
163
|
+
* pairs. Supersedes `varsDelimiter`.
|
|
164
|
+
*/
|
|
165
|
+
varsDelimiterPattern?: string;
|
|
166
|
+
}
|
|
167
|
+
|
|
98
168
|
/** * Per-invocation context shared with plugins and actions. */
|
|
99
169
|
type GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> = {
|
|
100
170
|
optionsResolved: TOptions;
|
|
@@ -102,6 +172,7 @@ type GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> = {
|
|
|
102
172
|
plugins?: Record<string, unknown>;
|
|
103
173
|
pluginConfigs?: Record<string, unknown>;
|
|
104
174
|
};
|
|
175
|
+
declare const HELP_HEADER_SYMBOL: unique symbol;
|
|
105
176
|
/**
|
|
106
177
|
* Plugin-first CLI host for get-dotenv. Extends Commander.Command.
|
|
107
178
|
*
|
|
@@ -114,10 +185,13 @@ type GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> = {
|
|
|
114
185
|
* NOTE: This host is additive and does not alter the legacy CLI.
|
|
115
186
|
*/
|
|
116
187
|
declare class GetDotenvCli<TOptions extends GetDotenvOptions = GetDotenvOptions> extends Command {
|
|
188
|
+
#private;
|
|
117
189
|
/** Registered top-level plugins (composition happens via .use()) */
|
|
118
190
|
private _plugins;
|
|
119
191
|
/** One-time installation guard */
|
|
120
192
|
private _installed;
|
|
193
|
+
/** Optional header line to prepend in help output */
|
|
194
|
+
private [HELP_HEADER_SYMBOL];
|
|
121
195
|
constructor(alias?: string);
|
|
122
196
|
/**
|
|
123
197
|
* Resolve options (strict) and compute dotenv context. * Stores the context on the instance under a symbol.
|
|
@@ -127,9 +201,33 @@ declare class GetDotenvCli<TOptions extends GetDotenvOptions = GetDotenvOptions>
|
|
|
127
201
|
* Retrieve the current invocation context (if any).
|
|
128
202
|
*/
|
|
129
203
|
getCtx(): GetDotenvCliCtx<TOptions> | undefined;
|
|
204
|
+
/**
|
|
205
|
+
* Retrieve the merged root CLI options bag (if set by passOptions()).
|
|
206
|
+
* Downstream-safe: no generics required.
|
|
207
|
+
*/
|
|
208
|
+
getOptions(): GetDotenvCliOptions | undefined;
|
|
209
|
+
/** Internal: set the merged root options bag for this run. */
|
|
210
|
+
_setOptionsBag(bag: GetDotenvCliOptions): void;
|
|
130
211
|
/** * Convenience helper to create a namespaced subcommand.
|
|
131
212
|
*/
|
|
132
213
|
ns(name: string): Command;
|
|
214
|
+
/**
|
|
215
|
+
* Tag options added during the provided callback as 'app' for grouped help.
|
|
216
|
+
* Allows downstream apps to demarcate their root-level options.
|
|
217
|
+
*/
|
|
218
|
+
tagAppOptions<T>(fn: (root: Command) => T): T;
|
|
219
|
+
/**
|
|
220
|
+
* Branding helper: set CLI name/description/version and optional help header.
|
|
221
|
+
* If version is omitted and importMetaUrl is provided, attempts to read the
|
|
222
|
+
* nearest package.json version (best-effort; non-fatal on failure).
|
|
223
|
+
*/
|
|
224
|
+
brand(args: {
|
|
225
|
+
name?: string;
|
|
226
|
+
description?: string;
|
|
227
|
+
version?: string;
|
|
228
|
+
importMetaUrl?: string;
|
|
229
|
+
helpHeader?: string;
|
|
230
|
+
}): Promise<this>;
|
|
133
231
|
/**
|
|
134
232
|
* Register a plugin for installation (parent level).
|
|
135
233
|
* Installation occurs on first resolveAndLoad() (or explicit install()).
|