@karmaniverous/get-dotenv 6.1.1 → 6.2.1
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 +149 -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 +149 -14
- package/dist/index.d.ts +220 -35
- package/dist/index.mjs +200 -15
- package/dist/plugins-aws.d.ts +89 -3
- package/dist/plugins-aws.mjs +141 -14
- package/dist/plugins-batch.d.ts +83 -2
- package/dist/plugins-batch.mjs +126 -13
- package/dist/plugins-cmd.d.ts +83 -2
- package/dist/plugins-cmd.mjs +120 -13
- package/dist/plugins-init.d.ts +83 -2
- package/dist/plugins-init.mjs +111 -13
- package/dist/plugins.d.ts +78 -2
- package/dist/plugins.mjs +149 -14
- package/package.json +2 -3
package/dist/config.mjs
CHANGED
|
@@ -16,26 +16,58 @@ import { createHash } from 'crypto';
|
|
|
16
16
|
* Minimal process env representation used by options and helpers.
|
|
17
17
|
* Values may be `undefined` to indicate "unset".
|
|
18
18
|
*/
|
|
19
|
+
/**
|
|
20
|
+
* Schema for an env-like record.
|
|
21
|
+
*
|
|
22
|
+
* Keys are environment variable names and values are either strings or `undefined`
|
|
23
|
+
* (to represent “unset”).
|
|
24
|
+
*
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
19
27
|
const processEnvSchema = z.record(z.string(), z.string().optional());
|
|
20
28
|
// RAW: all fields optional — undefined means "inherit" from lower layers.
|
|
29
|
+
/**
|
|
30
|
+
* Programmatic options schema (raw).
|
|
31
|
+
*
|
|
32
|
+
* This schema is the canonical runtime source of truth for the `getDotenv()` programmatic API.
|
|
33
|
+
* All fields are optional; `undefined` generally means “inherit default/lower layer”.
|
|
34
|
+
*
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
21
37
|
const getDotenvOptionsSchemaRaw = z.object({
|
|
38
|
+
/** Default environment name when `env` is not provided. */
|
|
22
39
|
defaultEnv: z.string().optional(),
|
|
40
|
+
/** Base dotenv filename token (default `.env`). */
|
|
23
41
|
dotenvToken: z.string().optional(),
|
|
42
|
+
/** Path to a dynamic variables module (JS/TS) to load and apply. */
|
|
24
43
|
dynamicPath: z.string().optional(),
|
|
25
|
-
|
|
44
|
+
/** Dynamic map is intentionally wide for now; refine once sources are normalized. */
|
|
26
45
|
dynamic: z.record(z.string(), z.unknown()).optional(),
|
|
46
|
+
/** Selected environment name for this invocation (for env-scoped files and overlays). */
|
|
27
47
|
env: z.string().optional(),
|
|
48
|
+
/** When true, skip applying dynamic variables. */
|
|
28
49
|
excludeDynamic: z.boolean().optional(),
|
|
50
|
+
/** When true, skip environment-scoped dotenv files. */
|
|
29
51
|
excludeEnv: z.boolean().optional(),
|
|
52
|
+
/** When true, skip global dotenv files. */
|
|
30
53
|
excludeGlobal: z.boolean().optional(),
|
|
54
|
+
/** When true, skip private dotenv files. */
|
|
31
55
|
excludePrivate: z.boolean().optional(),
|
|
56
|
+
/** When true, skip public dotenv files. */
|
|
32
57
|
excludePublic: z.boolean().optional(),
|
|
58
|
+
/** When true, merge the final composed environment into `process.env`. */
|
|
33
59
|
loadProcess: z.boolean().optional(),
|
|
60
|
+
/** When true, log the final environment map via `logger`. */
|
|
34
61
|
log: z.boolean().optional(),
|
|
62
|
+
/** Logger used when `log` is enabled (console-compatible). */
|
|
35
63
|
logger: z.unknown().default(console),
|
|
64
|
+
/** Optional output dotenv file path to write after composition. */
|
|
36
65
|
outputPath: z.string().optional(),
|
|
66
|
+
/** Dotenv search paths (ordered). */
|
|
37
67
|
paths: z.array(z.string()).optional(),
|
|
68
|
+
/** Private token suffix for private dotenv files (default `local`). */
|
|
38
69
|
privateToken: z.string().optional(),
|
|
70
|
+
/** Explicit variables to overlay onto the composed dotenv map. */
|
|
39
71
|
vars: processEnvSchema.optional(),
|
|
40
72
|
});
|
|
41
73
|
|
|
@@ -46,27 +78,55 @@ const getDotenvOptionsSchemaRaw = z.object({
|
|
|
46
78
|
* reflect normalized types (paths: string[], vars: ProcessEnv), applied in the
|
|
47
79
|
* CLI resolution pipeline.
|
|
48
80
|
*/
|
|
81
|
+
/**
|
|
82
|
+
* CLI options schema (raw).
|
|
83
|
+
*
|
|
84
|
+
* Extends the programmatic options schema with CLI-only flags and stringly inputs
|
|
85
|
+
* which are normalized later by the host resolution pipeline.
|
|
86
|
+
*
|
|
87
|
+
* @public
|
|
88
|
+
*/
|
|
49
89
|
const getDotenvCliOptionsSchemaRaw = getDotenvOptionsSchemaRaw.extend({
|
|
50
90
|
// CLI-specific fields (stringly inputs before preprocessing)
|
|
91
|
+
/** Enable verbose debug output (host-specific). */
|
|
51
92
|
debug: z.boolean().optional(),
|
|
93
|
+
/** Fail on validation errors (schema/requiredKeys). */
|
|
52
94
|
strict: z.boolean().optional(),
|
|
95
|
+
/** Capture child process stdio (useful for CI/tests). */
|
|
53
96
|
capture: z.boolean().optional(),
|
|
97
|
+
/** Emit child env diagnostics (boolean or selected keys). */
|
|
54
98
|
trace: z.union([z.boolean(), z.array(z.string())]).optional(),
|
|
99
|
+
/** Enable presentation-time redaction in trace/log output. */
|
|
55
100
|
redact: z.boolean().optional(),
|
|
101
|
+
/** Enable entropy warnings in trace/log output. */
|
|
56
102
|
warnEntropy: z.boolean().optional(),
|
|
103
|
+
/** Entropy threshold (bits/char) for warnings. */
|
|
57
104
|
entropyThreshold: z.number().optional(),
|
|
105
|
+
/** Minimum value length to consider for entropy warnings. */
|
|
58
106
|
entropyMinLength: z.number().optional(),
|
|
107
|
+
/** Regex patterns (strings) to suppress entropy warnings by key. */
|
|
59
108
|
entropyWhitelist: z.array(z.string()).optional(),
|
|
109
|
+
/** Additional key-match patterns (strings) for redaction. */
|
|
60
110
|
redactPatterns: z.array(z.string()).optional(),
|
|
111
|
+
/** Dotenv search paths provided as a single delimited string. */
|
|
61
112
|
paths: z.string().optional(),
|
|
113
|
+
/** Delimiter string used to split `paths`. */
|
|
62
114
|
pathsDelimiter: z.string().optional(),
|
|
115
|
+
/** Regex pattern used to split `paths` (takes precedence over delimiter). */
|
|
63
116
|
pathsDelimiterPattern: z.string().optional(),
|
|
117
|
+
/** Scripts table in a permissive shape at parse time (validated elsewhere). */
|
|
64
118
|
scripts: z.record(z.string(), z.unknown()).optional(),
|
|
119
|
+
/** Shell selection (`false` for shell-off, string for explicit shell). */
|
|
65
120
|
shell: z.union([z.boolean(), z.string()]).optional(),
|
|
121
|
+
/** Extra variables expressed as a single delimited string of assignments. */
|
|
66
122
|
vars: z.string().optional(),
|
|
123
|
+
/** Assignment operator used when parsing `vars`. */
|
|
67
124
|
varsAssignor: z.string().optional(),
|
|
125
|
+
/** Regex pattern used as the assignment operator for `vars` parsing. */
|
|
68
126
|
varsAssignorPattern: z.string().optional(),
|
|
127
|
+
/** Delimiter string used to split `vars`. */
|
|
69
128
|
varsDelimiter: z.string().optional(),
|
|
129
|
+
/** Regex pattern used to split `vars` (takes precedence over delimiter). */
|
|
70
130
|
varsDelimiterPattern: z.string().optional(),
|
|
71
131
|
});
|
|
72
132
|
|
|
@@ -90,17 +150,34 @@ const envStringMap = z.record(z.string(), stringMap);
|
|
|
90
150
|
* Raw configuration schema for get‑dotenv config files (JSON/YAML/JS/TS).
|
|
91
151
|
* Validates allowed top‑level keys without performing path normalization.
|
|
92
152
|
*/
|
|
153
|
+
/**
|
|
154
|
+
* Config schema for discovered get-dotenv configuration documents (raw).
|
|
155
|
+
*
|
|
156
|
+
* This schema validates the allowed top-level keys for configuration files.
|
|
157
|
+
* It does not normalize paths or coerce types beyond Zod’s parsing.
|
|
158
|
+
*
|
|
159
|
+
* @public
|
|
160
|
+
*/
|
|
93
161
|
const getDotenvConfigSchemaRaw = z.object({
|
|
162
|
+
/** Root option defaults applied by the host (CLI-like, collapsed families). */
|
|
94
163
|
rootOptionDefaults: getDotenvCliOptionsSchemaRaw.optional(),
|
|
164
|
+
/** Help-time visibility map for root flags (false hides). */
|
|
95
165
|
rootOptionVisibility: visibilityMap.optional(),
|
|
96
|
-
|
|
166
|
+
/** Scripts table used by cmd/batch resolution (validation intentionally permissive here). */
|
|
167
|
+
scripts: z.record(z.string(), z.unknown()).optional(),
|
|
168
|
+
/** Keys required to be present in the final composed environment. */
|
|
97
169
|
requiredKeys: z.array(z.string()).optional(),
|
|
170
|
+
/** Validation schema (JS/TS only; JSON/YAML loader rejects). */
|
|
98
171
|
schema: z.unknown().optional(), // JS/TS-only; loader rejects in JSON/YAML
|
|
172
|
+
/** Public global variables (string-only). */
|
|
99
173
|
vars: stringMap.optional(), // public, global
|
|
174
|
+
/** Public per-environment variables (string-only). */
|
|
100
175
|
envVars: envStringMap.optional(), // public, per-env
|
|
101
176
|
// Dynamic in config (JS/TS only). JSON/YAML loader will reject if set.
|
|
177
|
+
/** Dynamic variable definitions (JS/TS only). */
|
|
102
178
|
dynamic: z.unknown().optional(),
|
|
103
179
|
// Per-plugin config bag; validated by plugins/host when used.
|
|
180
|
+
/** Per-plugin config slices keyed by realized mount path (for example, `aws/whoami`). */
|
|
104
181
|
plugins: z.record(z.string(), z.unknown()).optional(),
|
|
105
182
|
});
|
|
106
183
|
/**
|
package/dist/env-overlay.d.ts
CHANGED
|
@@ -104,6 +104,11 @@ type ScriptsTable<TShell extends string | boolean = string | boolean> = Record<s
|
|
|
104
104
|
*/
|
|
105
105
|
type Scripts = ScriptsTable;
|
|
106
106
|
|
|
107
|
+
/**
|
|
108
|
+
* Resolved configuration object type returned by {@link getDotenvConfigSchemaResolved}.
|
|
109
|
+
*
|
|
110
|
+
* @public
|
|
111
|
+
*/
|
|
107
112
|
type GetDotenvConfigResolved = {
|
|
108
113
|
/**
|
|
109
114
|
* Help-time/runtime root defaults applied by the host (collapsed families; CLI‑like).
|
|
@@ -242,6 +247,9 @@ interface OverlayEnvOptionsBase<B extends Record<string, string | undefined> | R
|
|
|
242
247
|
* @public
|
|
243
248
|
*/
|
|
244
249
|
interface OverlayEnvOptionsWithProgrammatic<B extends Record<string, string | undefined> | Readonly<Record<string, string | undefined>>, P extends Record<string, string | undefined> | Readonly<Record<string, string | undefined>>> extends OverlayEnvOptionsBase<B> {
|
|
250
|
+
/**
|
|
251
|
+
* Explicit programmatic variables applied at the highest precedence tier.
|
|
252
|
+
*/
|
|
245
253
|
programmaticVars: P;
|
|
246
254
|
}
|
|
247
255
|
/**
|
package/dist/getdotenv.cli.mjs
CHANGED
|
@@ -39,26 +39,58 @@ import { versions, env } from 'process';
|
|
|
39
39
|
* Minimal process env representation used by options and helpers.
|
|
40
40
|
* Values may be `undefined` to indicate "unset".
|
|
41
41
|
*/
|
|
42
|
+
/**
|
|
43
|
+
* Schema for an env-like record.
|
|
44
|
+
*
|
|
45
|
+
* Keys are environment variable names and values are either strings or `undefined`
|
|
46
|
+
* (to represent “unset”).
|
|
47
|
+
*
|
|
48
|
+
* @public
|
|
49
|
+
*/
|
|
42
50
|
const processEnvSchema = z$2.record(z$2.string(), z$2.string().optional());
|
|
43
51
|
// RAW: all fields optional — undefined means "inherit" from lower layers.
|
|
52
|
+
/**
|
|
53
|
+
* Programmatic options schema (raw).
|
|
54
|
+
*
|
|
55
|
+
* This schema is the canonical runtime source of truth for the `getDotenv()` programmatic API.
|
|
56
|
+
* All fields are optional; `undefined` generally means “inherit default/lower layer”.
|
|
57
|
+
*
|
|
58
|
+
* @public
|
|
59
|
+
*/
|
|
44
60
|
const getDotenvOptionsSchemaRaw = z$2.object({
|
|
61
|
+
/** Default environment name when `env` is not provided. */
|
|
45
62
|
defaultEnv: z$2.string().optional(),
|
|
63
|
+
/** Base dotenv filename token (default `.env`). */
|
|
46
64
|
dotenvToken: z$2.string().optional(),
|
|
65
|
+
/** Path to a dynamic variables module (JS/TS) to load and apply. */
|
|
47
66
|
dynamicPath: z$2.string().optional(),
|
|
48
|
-
|
|
67
|
+
/** Dynamic map is intentionally wide for now; refine once sources are normalized. */
|
|
49
68
|
dynamic: z$2.record(z$2.string(), z$2.unknown()).optional(),
|
|
69
|
+
/** Selected environment name for this invocation (for env-scoped files and overlays). */
|
|
50
70
|
env: z$2.string().optional(),
|
|
71
|
+
/** When true, skip applying dynamic variables. */
|
|
51
72
|
excludeDynamic: z$2.boolean().optional(),
|
|
73
|
+
/** When true, skip environment-scoped dotenv files. */
|
|
52
74
|
excludeEnv: z$2.boolean().optional(),
|
|
75
|
+
/** When true, skip global dotenv files. */
|
|
53
76
|
excludeGlobal: z$2.boolean().optional(),
|
|
77
|
+
/** When true, skip private dotenv files. */
|
|
54
78
|
excludePrivate: z$2.boolean().optional(),
|
|
79
|
+
/** When true, skip public dotenv files. */
|
|
55
80
|
excludePublic: z$2.boolean().optional(),
|
|
81
|
+
/** When true, merge the final composed environment into `process.env`. */
|
|
56
82
|
loadProcess: z$2.boolean().optional(),
|
|
83
|
+
/** When true, log the final environment map via `logger`. */
|
|
57
84
|
log: z$2.boolean().optional(),
|
|
85
|
+
/** Logger used when `log` is enabled (console-compatible). */
|
|
58
86
|
logger: z$2.unknown().default(console),
|
|
87
|
+
/** Optional output dotenv file path to write after composition. */
|
|
59
88
|
outputPath: z$2.string().optional(),
|
|
89
|
+
/** Dotenv search paths (ordered). */
|
|
60
90
|
paths: z$2.array(z$2.string()).optional(),
|
|
91
|
+
/** Private token suffix for private dotenv files (default `local`). */
|
|
61
92
|
privateToken: z$2.string().optional(),
|
|
93
|
+
/** Explicit variables to overlay onto the composed dotenv map. */
|
|
62
94
|
vars: processEnvSchema.optional(),
|
|
63
95
|
});
|
|
64
96
|
/**
|
|
@@ -66,6 +98,14 @@ const getDotenvOptionsSchemaRaw = z$2.object({
|
|
|
66
98
|
* For now, this mirrors the RAW schema; future stages may materialize defaults
|
|
67
99
|
* and narrow shapes as resolution is wired into the host.
|
|
68
100
|
*/
|
|
101
|
+
/**
|
|
102
|
+
* Programmatic options schema (resolved).
|
|
103
|
+
*
|
|
104
|
+
* Today this mirrors {@link getDotenvOptionsSchemaRaw}, but is kept as a distinct export
|
|
105
|
+
* so future resolution steps can narrow or materialize defaults without breaking the API.
|
|
106
|
+
*
|
|
107
|
+
* @public
|
|
108
|
+
*/
|
|
69
109
|
const getDotenvOptionsSchemaResolved = getDotenvOptionsSchemaRaw;
|
|
70
110
|
|
|
71
111
|
/**
|
|
@@ -75,27 +115,55 @@ const getDotenvOptionsSchemaResolved = getDotenvOptionsSchemaRaw;
|
|
|
75
115
|
* reflect normalized types (paths: string[], vars: ProcessEnv), applied in the
|
|
76
116
|
* CLI resolution pipeline.
|
|
77
117
|
*/
|
|
118
|
+
/**
|
|
119
|
+
* CLI options schema (raw).
|
|
120
|
+
*
|
|
121
|
+
* Extends the programmatic options schema with CLI-only flags and stringly inputs
|
|
122
|
+
* which are normalized later by the host resolution pipeline.
|
|
123
|
+
*
|
|
124
|
+
* @public
|
|
125
|
+
*/
|
|
78
126
|
const getDotenvCliOptionsSchemaRaw = getDotenvOptionsSchemaRaw.extend({
|
|
79
127
|
// CLI-specific fields (stringly inputs before preprocessing)
|
|
128
|
+
/** Enable verbose debug output (host-specific). */
|
|
80
129
|
debug: z$2.boolean().optional(),
|
|
130
|
+
/** Fail on validation errors (schema/requiredKeys). */
|
|
81
131
|
strict: z$2.boolean().optional(),
|
|
132
|
+
/** Capture child process stdio (useful for CI/tests). */
|
|
82
133
|
capture: z$2.boolean().optional(),
|
|
134
|
+
/** Emit child env diagnostics (boolean or selected keys). */
|
|
83
135
|
trace: z$2.union([z$2.boolean(), z$2.array(z$2.string())]).optional(),
|
|
136
|
+
/** Enable presentation-time redaction in trace/log output. */
|
|
84
137
|
redact: z$2.boolean().optional(),
|
|
138
|
+
/** Enable entropy warnings in trace/log output. */
|
|
85
139
|
warnEntropy: z$2.boolean().optional(),
|
|
140
|
+
/** Entropy threshold (bits/char) for warnings. */
|
|
86
141
|
entropyThreshold: z$2.number().optional(),
|
|
142
|
+
/** Minimum value length to consider for entropy warnings. */
|
|
87
143
|
entropyMinLength: z$2.number().optional(),
|
|
144
|
+
/** Regex patterns (strings) to suppress entropy warnings by key. */
|
|
88
145
|
entropyWhitelist: z$2.array(z$2.string()).optional(),
|
|
146
|
+
/** Additional key-match patterns (strings) for redaction. */
|
|
89
147
|
redactPatterns: z$2.array(z$2.string()).optional(),
|
|
148
|
+
/** Dotenv search paths provided as a single delimited string. */
|
|
90
149
|
paths: z$2.string().optional(),
|
|
150
|
+
/** Delimiter string used to split `paths`. */
|
|
91
151
|
pathsDelimiter: z$2.string().optional(),
|
|
152
|
+
/** Regex pattern used to split `paths` (takes precedence over delimiter). */
|
|
92
153
|
pathsDelimiterPattern: z$2.string().optional(),
|
|
154
|
+
/** Scripts table in a permissive shape at parse time (validated elsewhere). */
|
|
93
155
|
scripts: z$2.record(z$2.string(), z$2.unknown()).optional(),
|
|
156
|
+
/** Shell selection (`false` for shell-off, string for explicit shell). */
|
|
94
157
|
shell: z$2.union([z$2.boolean(), z$2.string()]).optional(),
|
|
158
|
+
/** Extra variables expressed as a single delimited string of assignments. */
|
|
95
159
|
vars: z$2.string().optional(),
|
|
160
|
+
/** Assignment operator used when parsing `vars`. */
|
|
96
161
|
varsAssignor: z$2.string().optional(),
|
|
162
|
+
/** Regex pattern used as the assignment operator for `vars` parsing. */
|
|
97
163
|
varsAssignorPattern: z$2.string().optional(),
|
|
164
|
+
/** Delimiter string used to split `vars`. */
|
|
98
165
|
varsDelimiter: z$2.string().optional(),
|
|
166
|
+
/** Regex pattern used to split `vars` (takes precedence over delimiter). */
|
|
99
167
|
varsDelimiterPattern: z$2.string().optional(),
|
|
100
168
|
});
|
|
101
169
|
|
|
@@ -119,17 +187,34 @@ const envStringMap = z$2.record(z$2.string(), stringMap);
|
|
|
119
187
|
* Raw configuration schema for get‑dotenv config files (JSON/YAML/JS/TS).
|
|
120
188
|
* Validates allowed top‑level keys without performing path normalization.
|
|
121
189
|
*/
|
|
190
|
+
/**
|
|
191
|
+
* Config schema for discovered get-dotenv configuration documents (raw).
|
|
192
|
+
*
|
|
193
|
+
* This schema validates the allowed top-level keys for configuration files.
|
|
194
|
+
* It does not normalize paths or coerce types beyond Zod’s parsing.
|
|
195
|
+
*
|
|
196
|
+
* @public
|
|
197
|
+
*/
|
|
122
198
|
const getDotenvConfigSchemaRaw = z$2.object({
|
|
199
|
+
/** Root option defaults applied by the host (CLI-like, collapsed families). */
|
|
123
200
|
rootOptionDefaults: getDotenvCliOptionsSchemaRaw.optional(),
|
|
201
|
+
/** Help-time visibility map for root flags (false hides). */
|
|
124
202
|
rootOptionVisibility: visibilityMap.optional(),
|
|
125
|
-
|
|
203
|
+
/** Scripts table used by cmd/batch resolution (validation intentionally permissive here). */
|
|
204
|
+
scripts: z$2.record(z$2.string(), z$2.unknown()).optional(),
|
|
205
|
+
/** Keys required to be present in the final composed environment. */
|
|
126
206
|
requiredKeys: z$2.array(z$2.string()).optional(),
|
|
207
|
+
/** Validation schema (JS/TS only; JSON/YAML loader rejects). */
|
|
127
208
|
schema: z$2.unknown().optional(), // JS/TS-only; loader rejects in JSON/YAML
|
|
209
|
+
/** Public global variables (string-only). */
|
|
128
210
|
vars: stringMap.optional(), // public, global
|
|
211
|
+
/** Public per-environment variables (string-only). */
|
|
129
212
|
envVars: envStringMap.optional(), // public, per-env
|
|
130
213
|
// Dynamic in config (JS/TS only). JSON/YAML loader will reject if set.
|
|
214
|
+
/** Dynamic variable definitions (JS/TS only). */
|
|
131
215
|
dynamic: z$2.unknown().optional(),
|
|
132
216
|
// Per-plugin config bag; validated by plugins/host when used.
|
|
217
|
+
/** Per-plugin config slices keyed by realized mount path (for example, `aws/whoami`). */
|
|
133
218
|
plugins: z$2.record(z$2.string(), z$2.unknown()).optional(),
|
|
134
219
|
});
|
|
135
220
|
/**
|
|
@@ -1019,13 +1104,21 @@ function traceChildEnv(opts) {
|
|
|
1019
1104
|
* Base root CLI defaults (shared; kept untyped here to avoid cross-layer deps).
|
|
1020
1105
|
* Used as the bottom layer for CLI option resolution.
|
|
1021
1106
|
*/
|
|
1107
|
+
const baseScripts = {
|
|
1108
|
+
'git-status': {
|
|
1109
|
+
cmd: 'git branch --show-current && git status -s -u',
|
|
1110
|
+
shell: true,
|
|
1111
|
+
},
|
|
1112
|
+
};
|
|
1022
1113
|
/**
|
|
1023
|
-
* Default values for root CLI options used by the host and helpers as the
|
|
1024
|
-
* baseline layer during option resolution.
|
|
1114
|
+
* Default values for root CLI options used by the host and helpers as the baseline layer during option resolution.
|
|
1025
1115
|
*
|
|
1026
|
-
* These defaults correspond to the
|
|
1027
|
-
*
|
|
1028
|
-
* configuration `rootOptionDefaults`
|
|
1116
|
+
* These defaults correspond to the “stringly” root surface (see `RootOptionsShape`) and are merged by precedence with:
|
|
1117
|
+
* - create-time overrides
|
|
1118
|
+
* - any discovered configuration `rootOptionDefaults`
|
|
1119
|
+
* - and finally CLI flags at runtime
|
|
1120
|
+
*
|
|
1121
|
+
* @public
|
|
1029
1122
|
*/
|
|
1030
1123
|
const baseRootOptionDefaults = {
|
|
1031
1124
|
dotenvToken: '.env',
|
|
@@ -1039,12 +1132,7 @@ const baseRootOptionDefaults = {
|
|
|
1039
1132
|
paths: './',
|
|
1040
1133
|
pathsDelimiter: ' ',
|
|
1041
1134
|
privateToken: 'local',
|
|
1042
|
-
scripts:
|
|
1043
|
-
'git-status': {
|
|
1044
|
-
cmd: 'git branch --show-current && git status -s -u',
|
|
1045
|
-
shell: true,
|
|
1046
|
-
},
|
|
1047
|
-
},
|
|
1135
|
+
scripts: baseScripts,
|
|
1048
1136
|
shell: true,
|
|
1049
1137
|
vars: '',
|
|
1050
1138
|
varsAssignor: '=',
|
|
@@ -1591,6 +1679,14 @@ async function _execNormalized(command, shell, opts = {}) {
|
|
|
1591
1679
|
return out;
|
|
1592
1680
|
}
|
|
1593
1681
|
}
|
|
1682
|
+
/**
|
|
1683
|
+
* Execute a command and capture stdout/stderr (buffered).
|
|
1684
|
+
*
|
|
1685
|
+
* @param command - Command string (shell) or argv array (shell-off supported).
|
|
1686
|
+
* @param shell - Shell setting (false for plain execution).
|
|
1687
|
+
* @param opts - Execution options (cwd/env/timeout).
|
|
1688
|
+
* @returns A promise resolving to the captured result.
|
|
1689
|
+
*/
|
|
1594
1690
|
async function runCommandResult(command, shell, opts = {}) {
|
|
1595
1691
|
// Build opts without injecting undefined (exactOptionalPropertyTypes-safe)
|
|
1596
1692
|
const coreOpts = { stdio: 'pipe' };
|
|
@@ -1605,6 +1701,14 @@ async function runCommandResult(command, shell, opts = {}) {
|
|
|
1605
1701
|
}
|
|
1606
1702
|
return _execNormalized(command, shell, coreOpts);
|
|
1607
1703
|
}
|
|
1704
|
+
/**
|
|
1705
|
+
* Execute a command and return its exit code.
|
|
1706
|
+
*
|
|
1707
|
+
* @param command - Command string (shell) or argv array (shell-off supported).
|
|
1708
|
+
* @param shell - Shell setting (false for plain execution).
|
|
1709
|
+
* @param opts - Execution options (cwd/env/stdio).
|
|
1710
|
+
* @returns A promise resolving to the process exit code.
|
|
1711
|
+
*/
|
|
1608
1712
|
async function runCommand(command, shell, opts) {
|
|
1609
1713
|
// Build opts without injecting undefined (exactOptionalPropertyTypes-safe)
|
|
1610
1714
|
const callOpts = {};
|
|
@@ -2064,6 +2168,16 @@ function evaluateDynamicOptions(root, resolved) {
|
|
|
2064
2168
|
visit(root);
|
|
2065
2169
|
}
|
|
2066
2170
|
|
|
2171
|
+
/**
|
|
2172
|
+
* Initialize a {@link GetDotenvCli} instance with help configuration and safe defaults.
|
|
2173
|
+
*
|
|
2174
|
+
* @remarks
|
|
2175
|
+
* This is a low-level initializer used by the host constructor to keep `GetDotenvCli.ts`
|
|
2176
|
+
* small and to centralize help/output behavior.
|
|
2177
|
+
*
|
|
2178
|
+
* @param cli - The CLI instance to initialize.
|
|
2179
|
+
* @param headerGetter - Callback returning an optional help header string.
|
|
2180
|
+
*/
|
|
2067
2181
|
function initializeInstance(cli, headerGetter) {
|
|
2068
2182
|
// Configure grouped help: show only base options in default "Options";
|
|
2069
2183
|
// subcommands show all of their own options.
|
|
@@ -3507,16 +3621,29 @@ function attachAwsPreSubcommandHook(cli, plugin) {
|
|
|
3507
3621
|
}
|
|
3508
3622
|
|
|
3509
3623
|
/**
|
|
3510
|
-
*
|
|
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
|
|
3511
3630
|
*/
|
|
3512
3631
|
const awsPluginConfigSchema = z$2.object({
|
|
3632
|
+
/** Preferred AWS profile name (overrides dotenv-derived profile keys when set). */
|
|
3513
3633
|
profile: z$2.string().optional(),
|
|
3634
|
+
/** Preferred AWS region (overrides dotenv-derived region key when set). */
|
|
3514
3635
|
region: z$2.string().optional(),
|
|
3636
|
+
/** Fallback region when region cannot be resolved from config/dotenv/AWS CLI. */
|
|
3515
3637
|
defaultRegion: z$2.string().optional(),
|
|
3638
|
+
/** Dotenv/config key for local profile lookup (default `AWS_LOCAL_PROFILE`). */
|
|
3516
3639
|
profileKey: z$2.string().default('AWS_LOCAL_PROFILE').optional(),
|
|
3640
|
+
/** Dotenv/config fallback key for profile lookup (default `AWS_PROFILE`). */
|
|
3517
3641
|
profileFallbackKey: z$2.string().default('AWS_PROFILE').optional(),
|
|
3642
|
+
/** Dotenv/config key for region lookup (default `AWS_REGION`). */
|
|
3518
3643
|
regionKey: z$2.string().default('AWS_REGION').optional(),
|
|
3644
|
+
/** Credential acquisition strategy (`cli-export` to resolve via AWS CLI, or `none` to skip). */
|
|
3519
3645
|
strategy: z$2.enum(['cli-export', 'none']).default('cli-export').optional(),
|
|
3646
|
+
/** When true, attempt `aws sso login` on-demand when credential export fails for an SSO profile. */
|
|
3520
3647
|
loginOnDemand: z$2.boolean().default(false).optional(),
|
|
3521
3648
|
});
|
|
3522
3649
|
|
|
@@ -14468,7 +14595,9 @@ function attachBatchOptions(plugin, cli) {
|
|
|
14468
14595
|
const ScriptSchema = z$2.union([
|
|
14469
14596
|
z$2.string(),
|
|
14470
14597
|
z$2.object({
|
|
14598
|
+
/** Command string to execute. */
|
|
14471
14599
|
cmd: z$2.string(),
|
|
14600
|
+
/** Optional shell override for this script entry. */
|
|
14472
14601
|
shell: z$2.union([z$2.string(), z$2.boolean()]).optional(),
|
|
14473
14602
|
}),
|
|
14474
14603
|
]);
|
|
@@ -14476,10 +14605,15 @@ const ScriptSchema = z$2.union([
|
|
|
14476
14605
|
* Zod schema for batch plugin configuration.
|
|
14477
14606
|
*/
|
|
14478
14607
|
const batchPluginConfigSchema = z$2.object({
|
|
14608
|
+
/** Optional scripts table scoped to the batch plugin. */
|
|
14479
14609
|
scripts: z$2.record(z$2.string(), ScriptSchema).optional(),
|
|
14610
|
+
/** Optional default shell for batch execution (overridden by per-script shell when present). */
|
|
14480
14611
|
shell: z$2.union([z$2.string(), z$2.boolean()]).optional(),
|
|
14612
|
+
/** Root path for discovery, relative to CWD (or package root when pkgCwd is true). */
|
|
14481
14613
|
rootPath: z$2.string().optional(),
|
|
14614
|
+
/** Space-delimited glob patterns used to discover directories. */
|
|
14482
14615
|
globs: z$2.string().optional(),
|
|
14616
|
+
/** When true, resolve the batch root from the nearest package directory. */
|
|
14483
14617
|
pkgCwd: z$2.boolean().optional(),
|
|
14484
14618
|
});
|
|
14485
14619
|
|
|
@@ -14775,6 +14909,7 @@ const attachCmdParentInvoker = (cli, options, plugin) => {
|
|
|
14775
14909
|
*/
|
|
14776
14910
|
const cmdPluginConfigSchema = z$2
|
|
14777
14911
|
.object({
|
|
14912
|
+
/** When true, expand the alias value before execution (default behavior when omitted). */
|
|
14778
14913
|
expand: z$2.boolean().optional(),
|
|
14779
14914
|
})
|
|
14780
14915
|
.strict();
|