@karmaniverous/get-dotenv 6.1.1 → 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 +2 -0
- package/dist/cli.d.ts +58 -2
- package/dist/cli.mjs +155 -14
- 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 +155 -14
- package/dist/index.d.ts +220 -35
- package/dist/index.mjs +206 -15
- package/dist/plugins-aws.d.ts +90 -3
- package/dist/plugins-aws.mjs +143 -14
- package/dist/plugins-batch.d.ts +83 -2
- package/dist/plugins-batch.mjs +127 -13
- package/dist/plugins-cmd.d.ts +83 -2
- package/dist/plugins-cmd.mjs +121 -13
- package/dist/plugins-init.d.ts +83 -2
- package/dist/plugins-init.mjs +112 -13
- package/dist/plugins.d.ts +78 -2
- package/dist/plugins.mjs +155 -14
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
1
3
|
> Load, expand, and compose environment variables from a deterministic dotenv cascade, then execute commands under that context. Use get‑dotenv as a library, a CLI, or a plugin‑first host to build dotenv‑aware tooling with cross‑platform shell control, CI‑friendly capture, and clear diagnostics.
|
|
2
4
|
|
|
3
5
|
# get-dotenv
|
package/dist/cli.d.ts
CHANGED
|
@@ -107,9 +107,21 @@ type ScriptsTable<TShell extends string | boolean = string | boolean> = Record<s
|
|
|
107
107
|
* @public
|
|
108
108
|
*/
|
|
109
109
|
interface GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> {
|
|
110
|
+
/**
|
|
111
|
+
* Fully resolved option bag used to compute this context.
|
|
112
|
+
*/
|
|
110
113
|
optionsResolved: TOptions;
|
|
114
|
+
/**
|
|
115
|
+
* Final composed dotenv environment for this invocation.
|
|
116
|
+
*/
|
|
111
117
|
dotenv: ProcessEnv;
|
|
118
|
+
/**
|
|
119
|
+
* Optional runtime plugin state bag. Plugins may publish non-sensitive metadata here.
|
|
120
|
+
*/
|
|
112
121
|
plugins?: Record<string, unknown>;
|
|
122
|
+
/**
|
|
123
|
+
* Per-plugin validated configuration slices keyed by realized mount path.
|
|
124
|
+
*/
|
|
113
125
|
pluginConfigs?: Record<string, unknown>;
|
|
114
126
|
}
|
|
115
127
|
/**
|
|
@@ -135,6 +147,14 @@ interface BrandOptions {
|
|
|
135
147
|
* For the current step this mirrors the RAW schema; later stages may further
|
|
136
148
|
* narrow types post-resolution in the host pipeline.
|
|
137
149
|
*/
|
|
150
|
+
/**
|
|
151
|
+
* CLI options schema (resolved).
|
|
152
|
+
*
|
|
153
|
+
* Today this mirrors {@link getDotenvCliOptionsSchemaRaw}, but is kept as a distinct export
|
|
154
|
+
* so future resolution steps can narrow or materialize defaults without breaking the API.
|
|
155
|
+
*
|
|
156
|
+
* @public
|
|
157
|
+
*/
|
|
138
158
|
declare const getDotenvCliOptionsSchemaResolved: z.ZodObject<{
|
|
139
159
|
defaultEnv: z.ZodOptional<z.ZodString>;
|
|
140
160
|
dotenvToken: z.ZodOptional<z.ZodString>;
|
|
@@ -178,6 +198,14 @@ declare const getDotenvCliOptionsSchemaResolved: z.ZodObject<{
|
|
|
178
198
|
* For now, this mirrors the RAW schema; future stages may materialize defaults
|
|
179
199
|
* and narrow shapes as resolution is wired into the host.
|
|
180
200
|
*/
|
|
201
|
+
/**
|
|
202
|
+
* Programmatic options schema (resolved).
|
|
203
|
+
*
|
|
204
|
+
* Today this mirrors {@link getDotenvOptionsSchemaRaw}, but is kept as a distinct export
|
|
205
|
+
* so future resolution steps can narrow or materialize defaults without breaking the API.
|
|
206
|
+
*
|
|
207
|
+
* @public
|
|
208
|
+
*/
|
|
181
209
|
declare const getDotenvOptionsSchemaResolved: z.ZodObject<{
|
|
182
210
|
defaultEnv: z.ZodOptional<z.ZodString>;
|
|
183
211
|
dotenvToken: z.ZodOptional<z.ZodString>;
|
|
@@ -232,7 +260,7 @@ type Logger = Record<string, (...args: unknown[]) => void> | typeof console;
|
|
|
232
260
|
* Canonical programmatic options type (schema-derived).
|
|
233
261
|
* This type is the single source of truth for programmatic options.
|
|
234
262
|
*/
|
|
235
|
-
type GetDotenvOptions = z.output<typeof getDotenvOptionsSchemaResolved> & {
|
|
263
|
+
type GetDotenvOptions = Omit<z.output<typeof getDotenvOptionsSchemaResolved>, 'logger' | 'dynamic'> & {
|
|
236
264
|
/**
|
|
237
265
|
* Compile-time overlay: narrowed logger for DX (schema stores unknown).
|
|
238
266
|
*/
|
|
@@ -253,11 +281,15 @@ type Scripts = ScriptsTable;
|
|
|
253
281
|
* stringly paths/vars, and inherited programmatic fields (minus normalized
|
|
254
282
|
* shapes that are handled by resolution).
|
|
255
283
|
*/
|
|
256
|
-
type GetDotenvCliOptions = z.output<typeof getDotenvCliOptionsSchemaResolved> & {
|
|
284
|
+
type GetDotenvCliOptions = Omit<z.output<typeof getDotenvCliOptionsSchemaResolved>, 'logger' | 'dynamic' | 'scripts'> & {
|
|
257
285
|
/**
|
|
258
286
|
* Compile-only overlay for DX: logger narrowed from unknown.
|
|
259
287
|
*/
|
|
260
288
|
logger: Logger;
|
|
289
|
+
/**
|
|
290
|
+
* Compile-only overlay for DX: dynamic map narrowed from unknown.
|
|
291
|
+
*/
|
|
292
|
+
dynamic?: GetDotenvDynamic;
|
|
261
293
|
/**
|
|
262
294
|
* Compile-only overlay for DX: scripts narrowed from Record\<string, unknown\>.
|
|
263
295
|
*/
|
|
@@ -320,13 +352,37 @@ interface GetDotenvCliPublic<TOptions extends GetDotenvOptions = GetDotenvOption
|
|
|
320
352
|
getCtx(): GetDotenvCliCtx<TOptions>;
|
|
321
353
|
/** Check whether a context has been resolved (non-throwing). */
|
|
322
354
|
hasCtx(): boolean;
|
|
355
|
+
/**
|
|
356
|
+
* Resolve options and compute the dotenv context for this invocation.
|
|
357
|
+
*
|
|
358
|
+
* @param customOptions - Partial options to overlay for this invocation.
|
|
359
|
+
* @param opts - Optional resolver behavior switches (for example, whether to run `afterResolve`).
|
|
360
|
+
* @returns A promise resolving to the computed invocation context.
|
|
361
|
+
*/
|
|
323
362
|
resolveAndLoad(customOptions?: Partial<TOptions>, opts?: ResolveAndLoadOptions): Promise<GetDotenvCliCtx<TOptions>>;
|
|
363
|
+
/**
|
|
364
|
+
* Tag an option with a help group identifier for grouped root help rendering.
|
|
365
|
+
*
|
|
366
|
+
* @param opt - The Commander option to tag.
|
|
367
|
+
* @param group - Group identifier (for example, `base`, `app`, or `plugin:<name>`).
|
|
368
|
+
* @returns Nothing.
|
|
369
|
+
*/
|
|
324
370
|
setOptionGroup(opt: Option, group: string): void;
|
|
325
371
|
/**
|
|
326
372
|
* Create a dynamic option whose description is computed at help time
|
|
327
373
|
* from the resolved configuration.
|
|
328
374
|
*/
|
|
375
|
+
/**
|
|
376
|
+
* Create a dynamic option whose description is computed at help time from the resolved configuration.
|
|
377
|
+
*
|
|
378
|
+
* @param flags - Commander option flags usage string.
|
|
379
|
+
* @param desc - Description builder called during help rendering with the resolved help config.
|
|
380
|
+
* @param parser - Optional argument parser.
|
|
381
|
+
* @param defaultValue - Optional default value.
|
|
382
|
+
* @returns A Commander `Option` instance with a dynamic description.
|
|
383
|
+
*/
|
|
329
384
|
createDynamicOption<Usage extends string>(flags: Usage, desc: (cfg: ResolvedHelpConfig) => string, parser?: (value: string, previous?: unknown) => unknown, defaultValue?: unknown): Option<Usage>;
|
|
385
|
+
/** {@inheritDoc} */
|
|
330
386
|
createDynamicOption<Usage extends string, TValue = unknown>(flags: Usage, desc: (cfg: ResolvedHelpConfig) => string, parser: (value: string, previous?: TValue) => TValue, defaultValue?: TValue): Option<Usage>;
|
|
331
387
|
}
|
|
332
388
|
/**
|
package/dist/cli.mjs
CHANGED
|
@@ -38,26 +38,58 @@ import { versions, env } from 'process';
|
|
|
38
38
|
* Minimal process env representation used by options and helpers.
|
|
39
39
|
* Values may be `undefined` to indicate "unset".
|
|
40
40
|
*/
|
|
41
|
+
/**
|
|
42
|
+
* Schema for an env-like record.
|
|
43
|
+
*
|
|
44
|
+
* Keys are environment variable names and values are either strings or `undefined`
|
|
45
|
+
* (to represent “unset”).
|
|
46
|
+
*
|
|
47
|
+
* @public
|
|
48
|
+
*/
|
|
41
49
|
const processEnvSchema = z$2.record(z$2.string(), z$2.string().optional());
|
|
42
50
|
// RAW: all fields optional — undefined means "inherit" from lower layers.
|
|
51
|
+
/**
|
|
52
|
+
* Programmatic options schema (raw).
|
|
53
|
+
*
|
|
54
|
+
* This schema is the canonical runtime source of truth for the `getDotenv()` programmatic API.
|
|
55
|
+
* All fields are optional; `undefined` generally means “inherit default/lower layer”.
|
|
56
|
+
*
|
|
57
|
+
* @public
|
|
58
|
+
*/
|
|
43
59
|
const getDotenvOptionsSchemaRaw = z$2.object({
|
|
60
|
+
/** Default environment name when `env` is not provided. */
|
|
44
61
|
defaultEnv: z$2.string().optional(),
|
|
62
|
+
/** Base dotenv filename token (default `.env`). */
|
|
45
63
|
dotenvToken: z$2.string().optional(),
|
|
64
|
+
/** Path to a dynamic variables module (JS/TS) to load and apply. */
|
|
46
65
|
dynamicPath: z$2.string().optional(),
|
|
47
|
-
|
|
66
|
+
/** Dynamic map is intentionally wide for now; refine once sources are normalized. */
|
|
48
67
|
dynamic: z$2.record(z$2.string(), z$2.unknown()).optional(),
|
|
68
|
+
/** Selected environment name for this invocation (for env-scoped files and overlays). */
|
|
49
69
|
env: z$2.string().optional(),
|
|
70
|
+
/** When true, skip applying dynamic variables. */
|
|
50
71
|
excludeDynamic: z$2.boolean().optional(),
|
|
72
|
+
/** When true, skip environment-scoped dotenv files. */
|
|
51
73
|
excludeEnv: z$2.boolean().optional(),
|
|
74
|
+
/** When true, skip global dotenv files. */
|
|
52
75
|
excludeGlobal: z$2.boolean().optional(),
|
|
76
|
+
/** When true, skip private dotenv files. */
|
|
53
77
|
excludePrivate: z$2.boolean().optional(),
|
|
78
|
+
/** When true, skip public dotenv files. */
|
|
54
79
|
excludePublic: z$2.boolean().optional(),
|
|
80
|
+
/** When true, merge the final composed environment into `process.env`. */
|
|
55
81
|
loadProcess: z$2.boolean().optional(),
|
|
82
|
+
/** When true, log the final environment map via `logger`. */
|
|
56
83
|
log: z$2.boolean().optional(),
|
|
84
|
+
/** Logger used when `log` is enabled (console-compatible). */
|
|
57
85
|
logger: z$2.unknown().default(console),
|
|
86
|
+
/** Optional output dotenv file path to write after composition. */
|
|
58
87
|
outputPath: z$2.string().optional(),
|
|
88
|
+
/** Dotenv search paths (ordered). */
|
|
59
89
|
paths: z$2.array(z$2.string()).optional(),
|
|
90
|
+
/** Private token suffix for private dotenv files (default `local`). */
|
|
60
91
|
privateToken: z$2.string().optional(),
|
|
92
|
+
/** Explicit variables to overlay onto the composed dotenv map. */
|
|
61
93
|
vars: processEnvSchema.optional(),
|
|
62
94
|
});
|
|
63
95
|
/**
|
|
@@ -65,6 +97,14 @@ const getDotenvOptionsSchemaRaw = z$2.object({
|
|
|
65
97
|
* For now, this mirrors the RAW schema; future stages may materialize defaults
|
|
66
98
|
* and narrow shapes as resolution is wired into the host.
|
|
67
99
|
*/
|
|
100
|
+
/**
|
|
101
|
+
* Programmatic options schema (resolved).
|
|
102
|
+
*
|
|
103
|
+
* Today this mirrors {@link getDotenvOptionsSchemaRaw}, but is kept as a distinct export
|
|
104
|
+
* so future resolution steps can narrow or materialize defaults without breaking the API.
|
|
105
|
+
*
|
|
106
|
+
* @public
|
|
107
|
+
*/
|
|
68
108
|
const getDotenvOptionsSchemaResolved = getDotenvOptionsSchemaRaw;
|
|
69
109
|
|
|
70
110
|
/**
|
|
@@ -74,27 +114,55 @@ const getDotenvOptionsSchemaResolved = getDotenvOptionsSchemaRaw;
|
|
|
74
114
|
* reflect normalized types (paths: string[], vars: ProcessEnv), applied in the
|
|
75
115
|
* CLI resolution pipeline.
|
|
76
116
|
*/
|
|
117
|
+
/**
|
|
118
|
+
* CLI options schema (raw).
|
|
119
|
+
*
|
|
120
|
+
* Extends the programmatic options schema with CLI-only flags and stringly inputs
|
|
121
|
+
* which are normalized later by the host resolution pipeline.
|
|
122
|
+
*
|
|
123
|
+
* @public
|
|
124
|
+
*/
|
|
77
125
|
const getDotenvCliOptionsSchemaRaw = getDotenvOptionsSchemaRaw.extend({
|
|
78
126
|
// CLI-specific fields (stringly inputs before preprocessing)
|
|
127
|
+
/** Enable verbose debug output (host-specific). */
|
|
79
128
|
debug: z$2.boolean().optional(),
|
|
129
|
+
/** Fail on validation errors (schema/requiredKeys). */
|
|
80
130
|
strict: z$2.boolean().optional(),
|
|
131
|
+
/** Capture child process stdio (useful for CI/tests). */
|
|
81
132
|
capture: z$2.boolean().optional(),
|
|
133
|
+
/** Emit child env diagnostics (boolean or selected keys). */
|
|
82
134
|
trace: z$2.union([z$2.boolean(), z$2.array(z$2.string())]).optional(),
|
|
135
|
+
/** Enable presentation-time redaction in trace/log output. */
|
|
83
136
|
redact: z$2.boolean().optional(),
|
|
137
|
+
/** Enable entropy warnings in trace/log output. */
|
|
84
138
|
warnEntropy: z$2.boolean().optional(),
|
|
139
|
+
/** Entropy threshold (bits/char) for warnings. */
|
|
85
140
|
entropyThreshold: z$2.number().optional(),
|
|
141
|
+
/** Minimum value length to consider for entropy warnings. */
|
|
86
142
|
entropyMinLength: z$2.number().optional(),
|
|
143
|
+
/** Regex patterns (strings) to suppress entropy warnings by key. */
|
|
87
144
|
entropyWhitelist: z$2.array(z$2.string()).optional(),
|
|
145
|
+
/** Additional key-match patterns (strings) for redaction. */
|
|
88
146
|
redactPatterns: z$2.array(z$2.string()).optional(),
|
|
147
|
+
/** Dotenv search paths provided as a single delimited string. */
|
|
89
148
|
paths: z$2.string().optional(),
|
|
149
|
+
/** Delimiter string used to split `paths`. */
|
|
90
150
|
pathsDelimiter: z$2.string().optional(),
|
|
151
|
+
/** Regex pattern used to split `paths` (takes precedence over delimiter). */
|
|
91
152
|
pathsDelimiterPattern: z$2.string().optional(),
|
|
153
|
+
/** Scripts table in a permissive shape at parse time (validated elsewhere). */
|
|
92
154
|
scripts: z$2.record(z$2.string(), z$2.unknown()).optional(),
|
|
155
|
+
/** Shell selection (`false` for shell-off, string for explicit shell). */
|
|
93
156
|
shell: z$2.union([z$2.boolean(), z$2.string()]).optional(),
|
|
157
|
+
/** Extra variables expressed as a single delimited string of assignments. */
|
|
94
158
|
vars: z$2.string().optional(),
|
|
159
|
+
/** Assignment operator used when parsing `vars`. */
|
|
95
160
|
varsAssignor: z$2.string().optional(),
|
|
161
|
+
/** Regex pattern used as the assignment operator for `vars` parsing. */
|
|
96
162
|
varsAssignorPattern: z$2.string().optional(),
|
|
163
|
+
/** Delimiter string used to split `vars`. */
|
|
97
164
|
varsDelimiter: z$2.string().optional(),
|
|
165
|
+
/** Regex pattern used to split `vars` (takes precedence over delimiter). */
|
|
98
166
|
varsDelimiterPattern: z$2.string().optional(),
|
|
99
167
|
});
|
|
100
168
|
|
|
@@ -118,17 +186,34 @@ const envStringMap = z$2.record(z$2.string(), stringMap);
|
|
|
118
186
|
* Raw configuration schema for get‑dotenv config files (JSON/YAML/JS/TS).
|
|
119
187
|
* Validates allowed top‑level keys without performing path normalization.
|
|
120
188
|
*/
|
|
189
|
+
/**
|
|
190
|
+
* Config schema for discovered get-dotenv configuration documents (raw).
|
|
191
|
+
*
|
|
192
|
+
* This schema validates the allowed top-level keys for configuration files.
|
|
193
|
+
* It does not normalize paths or coerce types beyond Zod’s parsing.
|
|
194
|
+
*
|
|
195
|
+
* @public
|
|
196
|
+
*/
|
|
121
197
|
const getDotenvConfigSchemaRaw = z$2.object({
|
|
198
|
+
/** Root option defaults applied by the host (CLI-like, collapsed families). */
|
|
122
199
|
rootOptionDefaults: getDotenvCliOptionsSchemaRaw.optional(),
|
|
200
|
+
/** Help-time visibility map for root flags (false hides). */
|
|
123
201
|
rootOptionVisibility: visibilityMap.optional(),
|
|
124
|
-
|
|
202
|
+
/** Scripts table used by cmd/batch resolution (validation intentionally permissive here). */
|
|
203
|
+
scripts: z$2.record(z$2.string(), z$2.unknown()).optional(),
|
|
204
|
+
/** Keys required to be present in the final composed environment. */
|
|
125
205
|
requiredKeys: z$2.array(z$2.string()).optional(),
|
|
206
|
+
/** Validation schema (JS/TS only; JSON/YAML loader rejects). */
|
|
126
207
|
schema: z$2.unknown().optional(), // JS/TS-only; loader rejects in JSON/YAML
|
|
208
|
+
/** Public global variables (string-only). */
|
|
127
209
|
vars: stringMap.optional(), // public, global
|
|
210
|
+
/** Public per-environment variables (string-only). */
|
|
128
211
|
envVars: envStringMap.optional(), // public, per-env
|
|
129
212
|
// Dynamic in config (JS/TS only). JSON/YAML loader will reject if set.
|
|
213
|
+
/** Dynamic variable definitions (JS/TS only). */
|
|
130
214
|
dynamic: z$2.unknown().optional(),
|
|
131
215
|
// Per-plugin config bag; validated by plugins/host when used.
|
|
216
|
+
/** Per-plugin config slices keyed by realized mount path (for example, `aws/whoami`). */
|
|
132
217
|
plugins: z$2.record(z$2.string(), z$2.unknown()).optional(),
|
|
133
218
|
});
|
|
134
219
|
/**
|
|
@@ -1018,13 +1103,21 @@ function traceChildEnv(opts) {
|
|
|
1018
1103
|
* Base root CLI defaults (shared; kept untyped here to avoid cross-layer deps).
|
|
1019
1104
|
* Used as the bottom layer for CLI option resolution.
|
|
1020
1105
|
*/
|
|
1106
|
+
const baseScripts = {
|
|
1107
|
+
'git-status': {
|
|
1108
|
+
cmd: 'git branch --show-current && git status -s -u',
|
|
1109
|
+
shell: true,
|
|
1110
|
+
},
|
|
1111
|
+
};
|
|
1021
1112
|
/**
|
|
1022
|
-
* Default values for root CLI options used by the host and helpers as the
|
|
1023
|
-
* baseline layer during option resolution.
|
|
1113
|
+
* Default values for root CLI options used by the host and helpers as the baseline layer during option resolution.
|
|
1024
1114
|
*
|
|
1025
|
-
* These defaults correspond to the
|
|
1026
|
-
*
|
|
1027
|
-
* configuration `rootOptionDefaults`
|
|
1115
|
+
* These defaults correspond to the “stringly” root surface (see `RootOptionsShape`) and are merged by precedence with:
|
|
1116
|
+
* - create-time overrides
|
|
1117
|
+
* - any discovered configuration `rootOptionDefaults`
|
|
1118
|
+
* - and finally CLI flags at runtime
|
|
1119
|
+
*
|
|
1120
|
+
* @public
|
|
1028
1121
|
*/
|
|
1029
1122
|
const baseRootOptionDefaults = {
|
|
1030
1123
|
dotenvToken: '.env',
|
|
@@ -1038,12 +1131,7 @@ const baseRootOptionDefaults = {
|
|
|
1038
1131
|
paths: './',
|
|
1039
1132
|
pathsDelimiter: ' ',
|
|
1040
1133
|
privateToken: 'local',
|
|
1041
|
-
scripts:
|
|
1042
|
-
'git-status': {
|
|
1043
|
-
cmd: 'git branch --show-current && git status -s -u',
|
|
1044
|
-
shell: true,
|
|
1045
|
-
},
|
|
1046
|
-
},
|
|
1134
|
+
scripts: baseScripts,
|
|
1047
1135
|
shell: true,
|
|
1048
1136
|
vars: '',
|
|
1049
1137
|
varsAssignor: '=',
|
|
@@ -1590,6 +1678,14 @@ async function _execNormalized(command, shell, opts = {}) {
|
|
|
1590
1678
|
return out;
|
|
1591
1679
|
}
|
|
1592
1680
|
}
|
|
1681
|
+
/**
|
|
1682
|
+
* Execute a command and capture stdout/stderr (buffered).
|
|
1683
|
+
*
|
|
1684
|
+
* @param command - Command string (shell) or argv array (shell-off supported).
|
|
1685
|
+
* @param shell - Shell setting (false for plain execution).
|
|
1686
|
+
* @param opts - Execution options (cwd/env/timeout).
|
|
1687
|
+
* @returns A promise resolving to the captured result.
|
|
1688
|
+
*/
|
|
1593
1689
|
async function runCommandResult(command, shell, opts = {}) {
|
|
1594
1690
|
// Build opts without injecting undefined (exactOptionalPropertyTypes-safe)
|
|
1595
1691
|
const coreOpts = { stdio: 'pipe' };
|
|
@@ -1604,6 +1700,14 @@ async function runCommandResult(command, shell, opts = {}) {
|
|
|
1604
1700
|
}
|
|
1605
1701
|
return _execNormalized(command, shell, coreOpts);
|
|
1606
1702
|
}
|
|
1703
|
+
/**
|
|
1704
|
+
* Execute a command and return its exit code.
|
|
1705
|
+
*
|
|
1706
|
+
* @param command - Command string (shell) or argv array (shell-off supported).
|
|
1707
|
+
* @param shell - Shell setting (false for plain execution).
|
|
1708
|
+
* @param opts - Execution options (cwd/env/stdio).
|
|
1709
|
+
* @returns A promise resolving to the process exit code.
|
|
1710
|
+
*/
|
|
1607
1711
|
async function runCommand(command, shell, opts) {
|
|
1608
1712
|
// Build opts without injecting undefined (exactOptionalPropertyTypes-safe)
|
|
1609
1713
|
const callOpts = {};
|
|
@@ -2063,6 +2167,16 @@ function evaluateDynamicOptions(root, resolved) {
|
|
|
2063
2167
|
visit(root);
|
|
2064
2168
|
}
|
|
2065
2169
|
|
|
2170
|
+
/**
|
|
2171
|
+
* Initialize a {@link GetDotenvCli} instance with help configuration and safe defaults.
|
|
2172
|
+
*
|
|
2173
|
+
* @remarks
|
|
2174
|
+
* This is a low-level initializer used by the host constructor to keep `GetDotenvCli.ts`
|
|
2175
|
+
* small and to centralize help/output behavior.
|
|
2176
|
+
*
|
|
2177
|
+
* @param cli - The CLI instance to initialize.
|
|
2178
|
+
* @param headerGetter - Callback returning an optional help header string.
|
|
2179
|
+
*/
|
|
2066
2180
|
function initializeInstance(cli, headerGetter) {
|
|
2067
2181
|
// Configure grouped help: show only base options in default "Options";
|
|
2068
2182
|
// subcommands show all of their own options.
|
|
@@ -3453,6 +3567,7 @@ function attachAwsDefaultAction(cli, plugin, awsCmd) {
|
|
|
3453
3567
|
*
|
|
3454
3568
|
* @internal
|
|
3455
3569
|
*/
|
|
3570
|
+
/** @hidden */
|
|
3456
3571
|
function attachAwsOptions(cli, plugin) {
|
|
3457
3572
|
return (cli
|
|
3458
3573
|
// Description is owned by the plugin index (src/plugins/aws/index.ts).
|
|
@@ -3506,16 +3621,30 @@ function attachAwsPreSubcommandHook(cli, plugin) {
|
|
|
3506
3621
|
}
|
|
3507
3622
|
|
|
3508
3623
|
/**
|
|
3509
|
-
*
|
|
3624
|
+
* AWS plugin configuration schema.
|
|
3625
|
+
*
|
|
3626
|
+
* @remarks
|
|
3627
|
+
* This Zod schema is used by the host to validate the `plugins.aws` config slice.
|
|
3628
|
+
*
|
|
3629
|
+
* @public
|
|
3630
|
+
* @hidden
|
|
3510
3631
|
*/
|
|
3511
3632
|
const awsPluginConfigSchema = z$2.object({
|
|
3633
|
+
/** Preferred AWS profile name (overrides dotenv-derived profile keys when set). */
|
|
3512
3634
|
profile: z$2.string().optional(),
|
|
3635
|
+
/** Preferred AWS region (overrides dotenv-derived region key when set). */
|
|
3513
3636
|
region: z$2.string().optional(),
|
|
3637
|
+
/** Fallback region when region cannot be resolved from config/dotenv/AWS CLI. */
|
|
3514
3638
|
defaultRegion: z$2.string().optional(),
|
|
3639
|
+
/** Dotenv/config key for local profile lookup (default `AWS_LOCAL_PROFILE`). */
|
|
3515
3640
|
profileKey: z$2.string().default('AWS_LOCAL_PROFILE').optional(),
|
|
3641
|
+
/** Dotenv/config fallback key for profile lookup (default `AWS_PROFILE`). */
|
|
3516
3642
|
profileFallbackKey: z$2.string().default('AWS_PROFILE').optional(),
|
|
3643
|
+
/** Dotenv/config key for region lookup (default `AWS_REGION`). */
|
|
3517
3644
|
regionKey: z$2.string().default('AWS_REGION').optional(),
|
|
3645
|
+
/** Credential acquisition strategy (`cli-export` to resolve via AWS CLI, or `none` to skip). */
|
|
3518
3646
|
strategy: z$2.enum(['cli-export', 'none']).default('cli-export').optional(),
|
|
3647
|
+
/** When true, attempt `aws sso login` on-demand when credential export fails for an SSO profile. */
|
|
3519
3648
|
loginOnDemand: z$2.boolean().default(false).optional(),
|
|
3520
3649
|
});
|
|
3521
3650
|
|
|
@@ -14034,6 +14163,7 @@ function attachWhoamiDefaultAction(cli) {
|
|
|
14034
14163
|
*
|
|
14035
14164
|
* @internal
|
|
14036
14165
|
*/
|
|
14166
|
+
/** @hidden */
|
|
14037
14167
|
function attachWhoamiOptions(cli) {
|
|
14038
14168
|
return cli;
|
|
14039
14169
|
}
|
|
@@ -14434,6 +14564,7 @@ const attachBatchDefaultAction = (plugin, cli, pluginOpts, parent) => {
|
|
|
14434
14564
|
*
|
|
14435
14565
|
* @internal
|
|
14436
14566
|
*/
|
|
14567
|
+
/** @hidden */
|
|
14437
14568
|
function attachBatchOptions(plugin, cli) {
|
|
14438
14569
|
const GROUP = `plugin:${cli.name()}`;
|
|
14439
14570
|
return (cli
|
|
@@ -14467,7 +14598,9 @@ function attachBatchOptions(plugin, cli) {
|
|
|
14467
14598
|
const ScriptSchema = z$2.union([
|
|
14468
14599
|
z$2.string(),
|
|
14469
14600
|
z$2.object({
|
|
14601
|
+
/** Command string to execute. */
|
|
14470
14602
|
cmd: z$2.string(),
|
|
14603
|
+
/** Optional shell override for this script entry. */
|
|
14471
14604
|
shell: z$2.union([z$2.string(), z$2.boolean()]).optional(),
|
|
14472
14605
|
}),
|
|
14473
14606
|
]);
|
|
@@ -14475,10 +14608,15 @@ const ScriptSchema = z$2.union([
|
|
|
14475
14608
|
* Zod schema for batch plugin configuration.
|
|
14476
14609
|
*/
|
|
14477
14610
|
const batchPluginConfigSchema = z$2.object({
|
|
14611
|
+
/** Optional scripts table scoped to the batch plugin. */
|
|
14478
14612
|
scripts: z$2.record(z$2.string(), ScriptSchema).optional(),
|
|
14613
|
+
/** Optional default shell for batch execution (overridden by per-script shell when present). */
|
|
14479
14614
|
shell: z$2.union([z$2.string(), z$2.boolean()]).optional(),
|
|
14615
|
+
/** Root path for discovery, relative to CWD (or package root when pkgCwd is true). */
|
|
14480
14616
|
rootPath: z$2.string().optional(),
|
|
14617
|
+
/** Space-delimited glob patterns used to discover directories. */
|
|
14481
14618
|
globs: z$2.string().optional(),
|
|
14619
|
+
/** When true, resolve the batch root from the nearest package directory. */
|
|
14482
14620
|
pkgCwd: z$2.boolean().optional(),
|
|
14483
14621
|
});
|
|
14484
14622
|
|
|
@@ -14650,6 +14788,7 @@ const attachCmdDefaultAction = (cli, cmd, aliasKey) => {
|
|
|
14650
14788
|
*
|
|
14651
14789
|
* @internal
|
|
14652
14790
|
*/
|
|
14791
|
+
/** @hidden */
|
|
14653
14792
|
function attachCmdOptions(cli) {
|
|
14654
14793
|
return cli
|
|
14655
14794
|
.enablePositionalOptions()
|
|
@@ -14774,6 +14913,7 @@ const attachCmdParentInvoker = (cli, options, plugin) => {
|
|
|
14774
14913
|
*/
|
|
14775
14914
|
const cmdPluginConfigSchema = z$2
|
|
14776
14915
|
.object({
|
|
14916
|
+
/** When true, expand the alias value before execution (default behavior when omitted). */
|
|
14777
14917
|
expand: z$2.boolean().optional(),
|
|
14778
14918
|
})
|
|
14779
14919
|
.strict();
|
|
@@ -15141,6 +15281,7 @@ function attachInitDefaultAction(cli) {
|
|
|
15141
15281
|
*
|
|
15142
15282
|
* @internal
|
|
15143
15283
|
*/
|
|
15284
|
+
/** @hidden */
|
|
15144
15285
|
function attachInitOptions(cli) {
|
|
15145
15286
|
return (cli
|
|
15146
15287
|
// Description is owned by the plugin index (src/plugins/init/index.ts).
|