@karmaniverous/get-dotenv 6.3.0 → 6.5.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 +1 -1
- package/dist/chunks/{AwsRestJsonProtocol-Dv5q8CFK.mjs → AwsRestJsonProtocol-D_GDWyaH.mjs} +2 -2
- package/dist/chunks/{createCli-BSn6Be40.mjs → createCli-Ct22WCEC.mjs} +9 -6
- package/dist/chunks/{externalDataInterceptor-pqHO-Qmn.mjs → externalDataInterceptor-BRIxrVUl.mjs} +2 -2
- package/dist/chunks/{getSSOTokenFromFile-otmZHSRV.mjs → getSSOTokenFromFile-TYPZln9_.mjs} +1 -1
- package/dist/chunks/{index-C4Ac6feq.mjs → index-5AyAFomx.mjs} +12 -10
- package/dist/chunks/{index-CXpZ0pei.mjs → index-5NxTUVel.mjs} +9 -7
- package/dist/chunks/{index-BNcKuiBy.mjs → index-BCVlyd0W.mjs} +12 -10
- package/dist/chunks/{index-CYoFYXZv.mjs → index-BMb3Lxzl.mjs} +10 -8
- package/dist/chunks/{index-CGg5wWCm.mjs → index-BNWgREzT.mjs} +8 -6
- package/dist/chunks/{index-eZMlmESW.mjs → index-BSO6unyj.mjs} +17 -15
- package/dist/chunks/{index-DLQEHTw4.mjs → index-Be7QY_7N.mjs} +10 -8
- package/dist/chunks/{index-BqZ3PB6c.mjs → index-BzOeGJbq.mjs} +115 -10
- package/dist/chunks/{index-B18W-ELX.mjs → index-CR4cJOVz.mjs} +7 -5
- package/dist/chunks/{index-C6uLiKpC.mjs → index-Dz-kRqKN.mjs} +7 -5
- package/dist/chunks/{index-DFNcs3pR.mjs → index-G-U0Dimh.mjs} +9 -7
- package/dist/chunks/{index-Bi0RIILn.mjs → index-LKToAIhZ.mjs} +7 -5
- package/dist/chunks/{index-DtRaL61T.mjs → index-jLjEQoIi.mjs} +7 -5
- package/dist/chunks/{loadSso-CJ_XUhEj.mjs → loadSso-BnjVSVhE.mjs} +9 -7
- package/dist/chunks/{loader-CePOf74i.mjs → loader-CE4HSRN4.mjs} +3 -0
- package/dist/chunks/{parseKnownFiles-B6x1cUmR.mjs → parseKnownFiles-CejYPe7q.mjs} +1 -1
- package/dist/chunks/readDotenvCascade-Bymjvyit.mjs +549 -0
- package/dist/chunks/{readMergedOptions-DLBDzpXX.mjs → readMergedOptions-DLRFU2qO.mjs} +99 -308
- package/dist/chunks/{resolveCliOptions-_qtsVxda.mjs → resolveCliOptions-C6oeNl9S.mjs} +4 -1
- package/dist/chunks/{sdk-stream-mixin-DCdC70Up.mjs → sdk-stream-mixin-BDitDomf.mjs} +1 -1
- package/dist/chunks/{spawnEnv-CQwFu7ZJ.mjs → spawnEnv-5kdIVv0x.mjs} +5 -2
- package/dist/chunks/{types-DdqcXCV1.mjs → types-BC96rfQj.mjs} +1 -1
- package/dist/cli.d.ts +218 -94
- package/dist/cli.mjs +10 -8
- package/dist/cliHost.d.ts +258 -97
- package/dist/cliHost.mjs +55 -8
- package/dist/config.d.ts +0 -10
- package/dist/config.mjs +4 -1
- package/dist/env-overlay.d.ts +308 -16
- package/dist/env-overlay.mjs +40 -1
- package/dist/getdotenv.cli.mjs +10 -8
- package/dist/index.d.ts +243 -115
- package/dist/index.mjs +223 -45
- package/dist/plugins-aws.d.ts +161 -26
- package/dist/plugins-aws.mjs +27 -6
- package/dist/plugins-batch.d.ts +150 -26
- package/dist/plugins-batch.mjs +6 -4
- package/dist/plugins-cmd.d.ts +149 -25
- package/dist/plugins-cmd.mjs +8 -6
- package/dist/plugins-init.d.ts +149 -25
- package/dist/plugins-init.mjs +5 -3
- package/dist/plugins.d.ts +161 -26
- package/dist/plugins.mjs +11 -9
- package/package.json +2 -1
- package/templates/config/ts/getdotenv.config.ts +5 -3
- package/dist/chunks/overlayEnv-Bqh_kPGA.mjs +0 -235
package/dist/plugins-batch.d.ts
CHANGED
|
@@ -2,41 +2,132 @@ import { OptionValues, Command, InferCommandArguments, Option } from '@commander
|
|
|
2
2
|
import { z, ZodObject } from 'zod';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Dotenv provenance model (descriptor-only).
|
|
6
|
+
*
|
|
7
|
+
* Requirements addressed:
|
|
8
|
+
* - Host ctx carries a dotenv provenance mapping describing per-key origin and override history.
|
|
9
|
+
* - Provenance is descriptor-only (no value payloads).
|
|
10
|
+
* - Provenance is an ordered stack per key in ascending precedence; the last entry is effective.
|
|
11
|
+
* - Explicit unsets are represented as `op: 'unset'` without requiring deletion of keys from the env map.
|
|
6
12
|
*/
|
|
7
|
-
interface ScriptDef<TShell extends string | boolean = string | boolean> {
|
|
8
|
-
/** The command string to execute. */
|
|
9
|
-
cmd: string;
|
|
10
|
-
/** Shell override for this script. */
|
|
11
|
-
shell?: TShell | undefined;
|
|
12
|
-
}
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Provenance kind for an entry in {@link DotenvProvenance}.
|
|
15
|
+
*
|
|
16
|
+
* @public
|
|
15
17
|
*/
|
|
16
|
-
type
|
|
18
|
+
type DotenvProvenanceKind = 'file' | 'config' | 'vars' | 'dynamic';
|
|
17
19
|
/**
|
|
18
|
-
*
|
|
20
|
+
* Operation represented by a provenance entry.
|
|
19
21
|
*
|
|
20
22
|
* @public
|
|
21
23
|
*/
|
|
22
|
-
|
|
24
|
+
type DotenvProvenanceOp = 'set' | 'unset';
|
|
25
|
+
/**
|
|
26
|
+
* Base shape for all provenance entries.
|
|
27
|
+
*
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
interface DotenvProvenanceEntryBase {
|
|
23
31
|
/**
|
|
24
|
-
*
|
|
32
|
+
* The kind of provenance entry.
|
|
25
33
|
*/
|
|
26
|
-
|
|
34
|
+
kind: DotenvProvenanceKind;
|
|
27
35
|
/**
|
|
28
|
-
*
|
|
36
|
+
* The operation applied at this layer.
|
|
29
37
|
*/
|
|
30
|
-
|
|
38
|
+
op: DotenvProvenanceOp;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Provenance entry representing a value sourced from a dotenv file in the cascade.
|
|
42
|
+
*
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
45
|
+
interface DotenvFileProvenanceEntry extends DotenvProvenanceEntryBase {
|
|
46
|
+
/** Discriminator. */
|
|
47
|
+
kind: 'file';
|
|
48
|
+
/** Global vs env-scoped file. */
|
|
49
|
+
scope: 'global' | 'env';
|
|
50
|
+
/** Public vs private file. */
|
|
51
|
+
privacy: 'public' | 'private';
|
|
52
|
+
/** Environment name (required when scope is `env`). */
|
|
53
|
+
env?: string;
|
|
31
54
|
/**
|
|
32
|
-
*
|
|
55
|
+
* The corresponding `paths[]` entry as provided by the caller/CLI.
|
|
56
|
+
* This is not an absolute path by policy.
|
|
33
57
|
*/
|
|
34
|
-
|
|
58
|
+
path: string;
|
|
35
59
|
/**
|
|
36
|
-
*
|
|
60
|
+
* The computed dotenv filename token (e.g., `.env`, `.env.dev`, `.env.local`, `.env.dev.local`).
|
|
37
61
|
*/
|
|
38
|
-
|
|
62
|
+
file: string;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Provenance entry representing a value sourced from config overlays (`vars` / `envVars`).
|
|
66
|
+
*
|
|
67
|
+
* @public
|
|
68
|
+
*/
|
|
69
|
+
interface DotenvConfigProvenanceEntry extends DotenvProvenanceEntryBase {
|
|
70
|
+
/** Discriminator. */
|
|
71
|
+
kind: 'config';
|
|
72
|
+
/** Global vs env-scoped config slice. */
|
|
73
|
+
scope: 'global' | 'env';
|
|
74
|
+
/** Public vs private on the privacy axis (`local` config maps to `private`). */
|
|
75
|
+
privacy: 'public' | 'private';
|
|
76
|
+
/** Environment name (required when scope is `env`). */
|
|
77
|
+
env?: string;
|
|
78
|
+
/** Packaged vs project config origin. */
|
|
79
|
+
configScope: 'packaged' | 'project';
|
|
80
|
+
/** Public vs local config file. */
|
|
81
|
+
configPrivacy: 'public' | 'local';
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Provenance entry representing explicit variables overrides.
|
|
85
|
+
*
|
|
86
|
+
* Notes:
|
|
87
|
+
* - This kind represents values injected via `vars` (CLI/programmatic), not dotenv files.
|
|
88
|
+
*
|
|
89
|
+
* @public
|
|
90
|
+
*/
|
|
91
|
+
interface DotenvVarsProvenanceEntry extends DotenvProvenanceEntryBase {
|
|
92
|
+
/** Discriminator. */
|
|
93
|
+
kind: 'vars';
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Source tier for dynamic variables.
|
|
97
|
+
*
|
|
98
|
+
* @public
|
|
99
|
+
*/
|
|
100
|
+
type DotenvDynamicSource = 'config' | 'programmatic' | 'dynamicPath';
|
|
101
|
+
/**
|
|
102
|
+
* Provenance entry representing dynamic variables.
|
|
103
|
+
*
|
|
104
|
+
* @public
|
|
105
|
+
*/
|
|
106
|
+
interface DotenvDynamicProvenanceEntry extends DotenvProvenanceEntryBase {
|
|
107
|
+
/** Discriminator. */
|
|
108
|
+
kind: 'dynamic';
|
|
109
|
+
/** Dynamic source tier. */
|
|
110
|
+
dynamicSource: DotenvDynamicSource;
|
|
111
|
+
/**
|
|
112
|
+
* The `dynamicPath` value as provided by the caller/CLI when `dynamicSource` is `dynamicPath`.
|
|
113
|
+
* This is not resolved to an absolute path by provenance policy.
|
|
114
|
+
*/
|
|
115
|
+
dynamicPath?: string;
|
|
39
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* Union of all supported provenance entry shapes.
|
|
119
|
+
*
|
|
120
|
+
* @public
|
|
121
|
+
*/
|
|
122
|
+
type DotenvProvenanceEntry = DotenvFileProvenanceEntry | DotenvConfigProvenanceEntry | DotenvVarsProvenanceEntry | DotenvDynamicProvenanceEntry;
|
|
123
|
+
/**
|
|
124
|
+
* Per-key provenance history.
|
|
125
|
+
*
|
|
126
|
+
* Each key maps to an array of entries ordered in ascending precedence (lower to higher).
|
|
127
|
+
*
|
|
128
|
+
* @public
|
|
129
|
+
*/
|
|
130
|
+
type DotenvProvenance = Record<string, DotenvProvenanceEntry[]>;
|
|
40
131
|
|
|
41
132
|
/**
|
|
42
133
|
* Resolved CLI options schema.
|
|
@@ -123,14 +214,47 @@ declare const getDotenvOptionsSchemaResolved: z.ZodObject<{
|
|
|
123
214
|
}, z.core.$strip>;
|
|
124
215
|
|
|
125
216
|
/**
|
|
126
|
-
*
|
|
217
|
+
* Definition for a single script entry.
|
|
218
|
+
*/
|
|
219
|
+
interface ScriptDef<TShell extends string | boolean = string | boolean> {
|
|
220
|
+
/** The command string to execute. */
|
|
221
|
+
cmd: string;
|
|
222
|
+
/** Shell override for this script. */
|
|
223
|
+
shell?: TShell | undefined;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Scripts table shape.
|
|
227
|
+
*/
|
|
228
|
+
type ScriptsTable<TShell extends string | boolean = string | boolean> = Record<string, string | ScriptDef<TShell>>;
|
|
229
|
+
/**
|
|
230
|
+
* Per-invocation context shared with plugins and actions.
|
|
127
231
|
*
|
|
128
|
-
*
|
|
129
|
-
* - GetDotenvOptions derives from the Zod schema output (single source of truth).
|
|
130
|
-
* - Removed deprecated/compat flags from the public shape (e.g., useConfigLoader).
|
|
131
|
-
* - Provide Vars-aware defineDynamic and a typed config builder defineGetDotenvConfig\<Vars, Env\>().
|
|
132
|
-
* - Preserve existing behavior for defaults resolution and compat converters.
|
|
232
|
+
* @public
|
|
133
233
|
*/
|
|
234
|
+
interface GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> {
|
|
235
|
+
/**
|
|
236
|
+
* Fully resolved option bag used to compute this context.
|
|
237
|
+
*/
|
|
238
|
+
optionsResolved: TOptions;
|
|
239
|
+
/**
|
|
240
|
+
* Final composed dotenv environment for this invocation.
|
|
241
|
+
*/
|
|
242
|
+
dotenv: ProcessEnv;
|
|
243
|
+
/**
|
|
244
|
+
* Dotenv provenance history for {@link GetDotenvCliCtx.dotenv}.
|
|
245
|
+
*
|
|
246
|
+
* Descriptor-only: does not include value payloads.
|
|
247
|
+
*/
|
|
248
|
+
dotenvProvenance: DotenvProvenance;
|
|
249
|
+
/**
|
|
250
|
+
* Optional runtime plugin state bag. Plugins may publish non-sensitive metadata here.
|
|
251
|
+
*/
|
|
252
|
+
plugins?: Record<string, unknown>;
|
|
253
|
+
/**
|
|
254
|
+
* Per-plugin validated configuration slices keyed by realized mount path.
|
|
255
|
+
*/
|
|
256
|
+
pluginConfigs?: Record<string, unknown>;
|
|
257
|
+
}
|
|
134
258
|
|
|
135
259
|
/**
|
|
136
260
|
* A minimal representation of an environment key/value mapping.
|
|
@@ -426,7 +550,7 @@ interface ExecShellCommandBatchOptions {
|
|
|
426
550
|
/**
|
|
427
551
|
* Composed dotenv environment (string | undefined values) to inject into each child.
|
|
428
552
|
*/
|
|
429
|
-
dotenvEnv?:
|
|
553
|
+
dotenvEnv?: ProcessEnv;
|
|
430
554
|
/**
|
|
431
555
|
* Space‑delimited patterns used to discover target working directories.
|
|
432
556
|
*/
|
package/dist/plugins-batch.mjs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { r as readMergedOptions, d as definePlugin } from './chunks/readMergedOptions-
|
|
1
|
+
import { r as readMergedOptions, d as definePlugin } from './chunks/readMergedOptions-DLRFU2qO.mjs';
|
|
2
2
|
import 'execa';
|
|
3
|
+
import 'radash';
|
|
4
|
+
import 'node:buffer';
|
|
3
5
|
import 'fs-extra';
|
|
4
6
|
import 'node:path';
|
|
5
7
|
import 'crypto';
|
|
@@ -8,14 +10,14 @@ import 'url';
|
|
|
8
10
|
import { Command } from '@commander-js/extra-typings';
|
|
9
11
|
import 'nanoid';
|
|
10
12
|
import 'dotenv';
|
|
11
|
-
import './chunks/loader-
|
|
13
|
+
import './chunks/loader-CE4HSRN4.mjs';
|
|
12
14
|
import { packageDirectory } from 'package-directory';
|
|
13
15
|
import 'yaml';
|
|
14
16
|
import { z } from 'zod';
|
|
15
17
|
import { c as composeNestedEnv, m as maybePreserveNodeEvalArgv } from './chunks/invoke-DuRPU1oC.mjs';
|
|
16
|
-
import { r as runCommand, d as buildSpawnEnv, c as resolveShell, b as resolveCommand } from './chunks/spawnEnv-
|
|
18
|
+
import { r as runCommand, d as buildSpawnEnv, c as resolveShell, b as resolveCommand } from './chunks/spawnEnv-5kdIVv0x.mjs';
|
|
17
19
|
import { globby } from 'globby';
|
|
18
|
-
import './chunks/
|
|
20
|
+
import './chunks/readDotenvCascade-Bymjvyit.mjs';
|
|
19
21
|
import './chunks/loadModuleDefault-Dj8B3Stt.mjs';
|
|
20
22
|
|
|
21
23
|
const globPaths = async ({ globs, logger, pkgCwd, rootPath, }) => {
|
package/dist/plugins-cmd.d.ts
CHANGED
|
@@ -2,41 +2,132 @@ import { OptionValues, Command, InferCommandArguments, Option } from '@commander
|
|
|
2
2
|
import { z, ZodObject } from 'zod';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Dotenv provenance model (descriptor-only).
|
|
6
|
+
*
|
|
7
|
+
* Requirements addressed:
|
|
8
|
+
* - Host ctx carries a dotenv provenance mapping describing per-key origin and override history.
|
|
9
|
+
* - Provenance is descriptor-only (no value payloads).
|
|
10
|
+
* - Provenance is an ordered stack per key in ascending precedence; the last entry is effective.
|
|
11
|
+
* - Explicit unsets are represented as `op: 'unset'` without requiring deletion of keys from the env map.
|
|
6
12
|
*/
|
|
7
|
-
interface ScriptDef<TShell extends string | boolean = string | boolean> {
|
|
8
|
-
/** The command string to execute. */
|
|
9
|
-
cmd: string;
|
|
10
|
-
/** Shell override for this script. */
|
|
11
|
-
shell?: TShell | undefined;
|
|
12
|
-
}
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Provenance kind for an entry in {@link DotenvProvenance}.
|
|
15
|
+
*
|
|
16
|
+
* @public
|
|
15
17
|
*/
|
|
16
|
-
type
|
|
18
|
+
type DotenvProvenanceKind = 'file' | 'config' | 'vars' | 'dynamic';
|
|
17
19
|
/**
|
|
18
|
-
*
|
|
20
|
+
* Operation represented by a provenance entry.
|
|
19
21
|
*
|
|
20
22
|
* @public
|
|
21
23
|
*/
|
|
22
|
-
|
|
24
|
+
type DotenvProvenanceOp = 'set' | 'unset';
|
|
25
|
+
/**
|
|
26
|
+
* Base shape for all provenance entries.
|
|
27
|
+
*
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
interface DotenvProvenanceEntryBase {
|
|
23
31
|
/**
|
|
24
|
-
*
|
|
32
|
+
* The kind of provenance entry.
|
|
25
33
|
*/
|
|
26
|
-
|
|
34
|
+
kind: DotenvProvenanceKind;
|
|
27
35
|
/**
|
|
28
|
-
*
|
|
36
|
+
* The operation applied at this layer.
|
|
29
37
|
*/
|
|
30
|
-
|
|
38
|
+
op: DotenvProvenanceOp;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Provenance entry representing a value sourced from a dotenv file in the cascade.
|
|
42
|
+
*
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
45
|
+
interface DotenvFileProvenanceEntry extends DotenvProvenanceEntryBase {
|
|
46
|
+
/** Discriminator. */
|
|
47
|
+
kind: 'file';
|
|
48
|
+
/** Global vs env-scoped file. */
|
|
49
|
+
scope: 'global' | 'env';
|
|
50
|
+
/** Public vs private file. */
|
|
51
|
+
privacy: 'public' | 'private';
|
|
52
|
+
/** Environment name (required when scope is `env`). */
|
|
53
|
+
env?: string;
|
|
31
54
|
/**
|
|
32
|
-
*
|
|
55
|
+
* The corresponding `paths[]` entry as provided by the caller/CLI.
|
|
56
|
+
* This is not an absolute path by policy.
|
|
33
57
|
*/
|
|
34
|
-
|
|
58
|
+
path: string;
|
|
35
59
|
/**
|
|
36
|
-
*
|
|
60
|
+
* The computed dotenv filename token (e.g., `.env`, `.env.dev`, `.env.local`, `.env.dev.local`).
|
|
37
61
|
*/
|
|
38
|
-
|
|
62
|
+
file: string;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Provenance entry representing a value sourced from config overlays (`vars` / `envVars`).
|
|
66
|
+
*
|
|
67
|
+
* @public
|
|
68
|
+
*/
|
|
69
|
+
interface DotenvConfigProvenanceEntry extends DotenvProvenanceEntryBase {
|
|
70
|
+
/** Discriminator. */
|
|
71
|
+
kind: 'config';
|
|
72
|
+
/** Global vs env-scoped config slice. */
|
|
73
|
+
scope: 'global' | 'env';
|
|
74
|
+
/** Public vs private on the privacy axis (`local` config maps to `private`). */
|
|
75
|
+
privacy: 'public' | 'private';
|
|
76
|
+
/** Environment name (required when scope is `env`). */
|
|
77
|
+
env?: string;
|
|
78
|
+
/** Packaged vs project config origin. */
|
|
79
|
+
configScope: 'packaged' | 'project';
|
|
80
|
+
/** Public vs local config file. */
|
|
81
|
+
configPrivacy: 'public' | 'local';
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Provenance entry representing explicit variables overrides.
|
|
85
|
+
*
|
|
86
|
+
* Notes:
|
|
87
|
+
* - This kind represents values injected via `vars` (CLI/programmatic), not dotenv files.
|
|
88
|
+
*
|
|
89
|
+
* @public
|
|
90
|
+
*/
|
|
91
|
+
interface DotenvVarsProvenanceEntry extends DotenvProvenanceEntryBase {
|
|
92
|
+
/** Discriminator. */
|
|
93
|
+
kind: 'vars';
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Source tier for dynamic variables.
|
|
97
|
+
*
|
|
98
|
+
* @public
|
|
99
|
+
*/
|
|
100
|
+
type DotenvDynamicSource = 'config' | 'programmatic' | 'dynamicPath';
|
|
101
|
+
/**
|
|
102
|
+
* Provenance entry representing dynamic variables.
|
|
103
|
+
*
|
|
104
|
+
* @public
|
|
105
|
+
*/
|
|
106
|
+
interface DotenvDynamicProvenanceEntry extends DotenvProvenanceEntryBase {
|
|
107
|
+
/** Discriminator. */
|
|
108
|
+
kind: 'dynamic';
|
|
109
|
+
/** Dynamic source tier. */
|
|
110
|
+
dynamicSource: DotenvDynamicSource;
|
|
111
|
+
/**
|
|
112
|
+
* The `dynamicPath` value as provided by the caller/CLI when `dynamicSource` is `dynamicPath`.
|
|
113
|
+
* This is not resolved to an absolute path by provenance policy.
|
|
114
|
+
*/
|
|
115
|
+
dynamicPath?: string;
|
|
39
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* Union of all supported provenance entry shapes.
|
|
119
|
+
*
|
|
120
|
+
* @public
|
|
121
|
+
*/
|
|
122
|
+
type DotenvProvenanceEntry = DotenvFileProvenanceEntry | DotenvConfigProvenanceEntry | DotenvVarsProvenanceEntry | DotenvDynamicProvenanceEntry;
|
|
123
|
+
/**
|
|
124
|
+
* Per-key provenance history.
|
|
125
|
+
*
|
|
126
|
+
* Each key maps to an array of entries ordered in ascending precedence (lower to higher).
|
|
127
|
+
*
|
|
128
|
+
* @public
|
|
129
|
+
*/
|
|
130
|
+
type DotenvProvenance = Record<string, DotenvProvenanceEntry[]>;
|
|
40
131
|
|
|
41
132
|
/**
|
|
42
133
|
* Resolved CLI options schema.
|
|
@@ -123,14 +214,47 @@ declare const getDotenvOptionsSchemaResolved: z.ZodObject<{
|
|
|
123
214
|
}, z.core.$strip>;
|
|
124
215
|
|
|
125
216
|
/**
|
|
126
|
-
*
|
|
217
|
+
* Definition for a single script entry.
|
|
218
|
+
*/
|
|
219
|
+
interface ScriptDef<TShell extends string | boolean = string | boolean> {
|
|
220
|
+
/** The command string to execute. */
|
|
221
|
+
cmd: string;
|
|
222
|
+
/** Shell override for this script. */
|
|
223
|
+
shell?: TShell | undefined;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Scripts table shape.
|
|
227
|
+
*/
|
|
228
|
+
type ScriptsTable<TShell extends string | boolean = string | boolean> = Record<string, string | ScriptDef<TShell>>;
|
|
229
|
+
/**
|
|
230
|
+
* Per-invocation context shared with plugins and actions.
|
|
127
231
|
*
|
|
128
|
-
*
|
|
129
|
-
* - GetDotenvOptions derives from the Zod schema output (single source of truth).
|
|
130
|
-
* - Removed deprecated/compat flags from the public shape (e.g., useConfigLoader).
|
|
131
|
-
* - Provide Vars-aware defineDynamic and a typed config builder defineGetDotenvConfig\<Vars, Env\>().
|
|
132
|
-
* - Preserve existing behavior for defaults resolution and compat converters.
|
|
232
|
+
* @public
|
|
133
233
|
*/
|
|
234
|
+
interface GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> {
|
|
235
|
+
/**
|
|
236
|
+
* Fully resolved option bag used to compute this context.
|
|
237
|
+
*/
|
|
238
|
+
optionsResolved: TOptions;
|
|
239
|
+
/**
|
|
240
|
+
* Final composed dotenv environment for this invocation.
|
|
241
|
+
*/
|
|
242
|
+
dotenv: ProcessEnv;
|
|
243
|
+
/**
|
|
244
|
+
* Dotenv provenance history for {@link GetDotenvCliCtx.dotenv}.
|
|
245
|
+
*
|
|
246
|
+
* Descriptor-only: does not include value payloads.
|
|
247
|
+
*/
|
|
248
|
+
dotenvProvenance: DotenvProvenance;
|
|
249
|
+
/**
|
|
250
|
+
* Optional runtime plugin state bag. Plugins may publish non-sensitive metadata here.
|
|
251
|
+
*/
|
|
252
|
+
plugins?: Record<string, unknown>;
|
|
253
|
+
/**
|
|
254
|
+
* Per-plugin validated configuration slices keyed by realized mount path.
|
|
255
|
+
*/
|
|
256
|
+
pluginConfigs?: Record<string, unknown>;
|
|
257
|
+
}
|
|
134
258
|
|
|
135
259
|
/**
|
|
136
260
|
* A minimal representation of an environment key/value mapping.
|
package/dist/plugins-cmd.mjs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import '
|
|
1
|
+
import 'radash';
|
|
2
|
+
import './chunks/readMergedOptions-DLRFU2qO.mjs';
|
|
2
3
|
import 'execa';
|
|
4
|
+
import 'node:buffer';
|
|
3
5
|
import 'fs-extra';
|
|
4
6
|
import 'node:path';
|
|
5
7
|
import 'crypto';
|
|
@@ -8,13 +10,13 @@ import 'url';
|
|
|
8
10
|
import '@commander-js/extra-typings';
|
|
9
11
|
import 'nanoid';
|
|
10
12
|
import 'dotenv';
|
|
11
|
-
import './chunks/loader-
|
|
13
|
+
import './chunks/loader-CE4HSRN4.mjs';
|
|
12
14
|
import 'package-directory';
|
|
13
15
|
import 'yaml';
|
|
14
16
|
import 'zod';
|
|
15
|
-
export { c as cmdPlugin } from './chunks/index-
|
|
16
|
-
import './chunks/
|
|
17
|
+
export { c as cmdPlugin } from './chunks/index-BzOeGJbq.mjs';
|
|
18
|
+
import './chunks/readDotenvCascade-Bymjvyit.mjs';
|
|
17
19
|
import './chunks/loadModuleDefault-Dj8B3Stt.mjs';
|
|
18
|
-
import './chunks/spawnEnv-
|
|
20
|
+
import './chunks/spawnEnv-5kdIVv0x.mjs';
|
|
19
21
|
import './chunks/invoke-DuRPU1oC.mjs';
|
|
20
|
-
import './chunks/resolveCliOptions-
|
|
22
|
+
import './chunks/resolveCliOptions-C6oeNl9S.mjs';
|
package/dist/plugins-init.d.ts
CHANGED
|
@@ -2,41 +2,132 @@ import { OptionValues, Command, InferCommandArguments, Option } from '@commander
|
|
|
2
2
|
import { z, ZodObject } from 'zod';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Dotenv provenance model (descriptor-only).
|
|
6
|
+
*
|
|
7
|
+
* Requirements addressed:
|
|
8
|
+
* - Host ctx carries a dotenv provenance mapping describing per-key origin and override history.
|
|
9
|
+
* - Provenance is descriptor-only (no value payloads).
|
|
10
|
+
* - Provenance is an ordered stack per key in ascending precedence; the last entry is effective.
|
|
11
|
+
* - Explicit unsets are represented as `op: 'unset'` without requiring deletion of keys from the env map.
|
|
6
12
|
*/
|
|
7
|
-
interface ScriptDef<TShell extends string | boolean = string | boolean> {
|
|
8
|
-
/** The command string to execute. */
|
|
9
|
-
cmd: string;
|
|
10
|
-
/** Shell override for this script. */
|
|
11
|
-
shell?: TShell | undefined;
|
|
12
|
-
}
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Provenance kind for an entry in {@link DotenvProvenance}.
|
|
15
|
+
*
|
|
16
|
+
* @public
|
|
15
17
|
*/
|
|
16
|
-
type
|
|
18
|
+
type DotenvProvenanceKind = 'file' | 'config' | 'vars' | 'dynamic';
|
|
17
19
|
/**
|
|
18
|
-
*
|
|
20
|
+
* Operation represented by a provenance entry.
|
|
19
21
|
*
|
|
20
22
|
* @public
|
|
21
23
|
*/
|
|
22
|
-
|
|
24
|
+
type DotenvProvenanceOp = 'set' | 'unset';
|
|
25
|
+
/**
|
|
26
|
+
* Base shape for all provenance entries.
|
|
27
|
+
*
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
interface DotenvProvenanceEntryBase {
|
|
23
31
|
/**
|
|
24
|
-
*
|
|
32
|
+
* The kind of provenance entry.
|
|
25
33
|
*/
|
|
26
|
-
|
|
34
|
+
kind: DotenvProvenanceKind;
|
|
27
35
|
/**
|
|
28
|
-
*
|
|
36
|
+
* The operation applied at this layer.
|
|
29
37
|
*/
|
|
30
|
-
|
|
38
|
+
op: DotenvProvenanceOp;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Provenance entry representing a value sourced from a dotenv file in the cascade.
|
|
42
|
+
*
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
45
|
+
interface DotenvFileProvenanceEntry extends DotenvProvenanceEntryBase {
|
|
46
|
+
/** Discriminator. */
|
|
47
|
+
kind: 'file';
|
|
48
|
+
/** Global vs env-scoped file. */
|
|
49
|
+
scope: 'global' | 'env';
|
|
50
|
+
/** Public vs private file. */
|
|
51
|
+
privacy: 'public' | 'private';
|
|
52
|
+
/** Environment name (required when scope is `env`). */
|
|
53
|
+
env?: string;
|
|
31
54
|
/**
|
|
32
|
-
*
|
|
55
|
+
* The corresponding `paths[]` entry as provided by the caller/CLI.
|
|
56
|
+
* This is not an absolute path by policy.
|
|
33
57
|
*/
|
|
34
|
-
|
|
58
|
+
path: string;
|
|
35
59
|
/**
|
|
36
|
-
*
|
|
60
|
+
* The computed dotenv filename token (e.g., `.env`, `.env.dev`, `.env.local`, `.env.dev.local`).
|
|
37
61
|
*/
|
|
38
|
-
|
|
62
|
+
file: string;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Provenance entry representing a value sourced from config overlays (`vars` / `envVars`).
|
|
66
|
+
*
|
|
67
|
+
* @public
|
|
68
|
+
*/
|
|
69
|
+
interface DotenvConfigProvenanceEntry extends DotenvProvenanceEntryBase {
|
|
70
|
+
/** Discriminator. */
|
|
71
|
+
kind: 'config';
|
|
72
|
+
/** Global vs env-scoped config slice. */
|
|
73
|
+
scope: 'global' | 'env';
|
|
74
|
+
/** Public vs private on the privacy axis (`local` config maps to `private`). */
|
|
75
|
+
privacy: 'public' | 'private';
|
|
76
|
+
/** Environment name (required when scope is `env`). */
|
|
77
|
+
env?: string;
|
|
78
|
+
/** Packaged vs project config origin. */
|
|
79
|
+
configScope: 'packaged' | 'project';
|
|
80
|
+
/** Public vs local config file. */
|
|
81
|
+
configPrivacy: 'public' | 'local';
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Provenance entry representing explicit variables overrides.
|
|
85
|
+
*
|
|
86
|
+
* Notes:
|
|
87
|
+
* - This kind represents values injected via `vars` (CLI/programmatic), not dotenv files.
|
|
88
|
+
*
|
|
89
|
+
* @public
|
|
90
|
+
*/
|
|
91
|
+
interface DotenvVarsProvenanceEntry extends DotenvProvenanceEntryBase {
|
|
92
|
+
/** Discriminator. */
|
|
93
|
+
kind: 'vars';
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Source tier for dynamic variables.
|
|
97
|
+
*
|
|
98
|
+
* @public
|
|
99
|
+
*/
|
|
100
|
+
type DotenvDynamicSource = 'config' | 'programmatic' | 'dynamicPath';
|
|
101
|
+
/**
|
|
102
|
+
* Provenance entry representing dynamic variables.
|
|
103
|
+
*
|
|
104
|
+
* @public
|
|
105
|
+
*/
|
|
106
|
+
interface DotenvDynamicProvenanceEntry extends DotenvProvenanceEntryBase {
|
|
107
|
+
/** Discriminator. */
|
|
108
|
+
kind: 'dynamic';
|
|
109
|
+
/** Dynamic source tier. */
|
|
110
|
+
dynamicSource: DotenvDynamicSource;
|
|
111
|
+
/**
|
|
112
|
+
* The `dynamicPath` value as provided by the caller/CLI when `dynamicSource` is `dynamicPath`.
|
|
113
|
+
* This is not resolved to an absolute path by provenance policy.
|
|
114
|
+
*/
|
|
115
|
+
dynamicPath?: string;
|
|
39
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* Union of all supported provenance entry shapes.
|
|
119
|
+
*
|
|
120
|
+
* @public
|
|
121
|
+
*/
|
|
122
|
+
type DotenvProvenanceEntry = DotenvFileProvenanceEntry | DotenvConfigProvenanceEntry | DotenvVarsProvenanceEntry | DotenvDynamicProvenanceEntry;
|
|
123
|
+
/**
|
|
124
|
+
* Per-key provenance history.
|
|
125
|
+
*
|
|
126
|
+
* Each key maps to an array of entries ordered in ascending precedence (lower to higher).
|
|
127
|
+
*
|
|
128
|
+
* @public
|
|
129
|
+
*/
|
|
130
|
+
type DotenvProvenance = Record<string, DotenvProvenanceEntry[]>;
|
|
40
131
|
|
|
41
132
|
/**
|
|
42
133
|
* Resolved CLI options schema.
|
|
@@ -123,14 +214,47 @@ declare const getDotenvOptionsSchemaResolved: z.ZodObject<{
|
|
|
123
214
|
}, z.core.$strip>;
|
|
124
215
|
|
|
125
216
|
/**
|
|
126
|
-
*
|
|
217
|
+
* Definition for a single script entry.
|
|
218
|
+
*/
|
|
219
|
+
interface ScriptDef<TShell extends string | boolean = string | boolean> {
|
|
220
|
+
/** The command string to execute. */
|
|
221
|
+
cmd: string;
|
|
222
|
+
/** Shell override for this script. */
|
|
223
|
+
shell?: TShell | undefined;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Scripts table shape.
|
|
227
|
+
*/
|
|
228
|
+
type ScriptsTable<TShell extends string | boolean = string | boolean> = Record<string, string | ScriptDef<TShell>>;
|
|
229
|
+
/**
|
|
230
|
+
* Per-invocation context shared with plugins and actions.
|
|
127
231
|
*
|
|
128
|
-
*
|
|
129
|
-
* - GetDotenvOptions derives from the Zod schema output (single source of truth).
|
|
130
|
-
* - Removed deprecated/compat flags from the public shape (e.g., useConfigLoader).
|
|
131
|
-
* - Provide Vars-aware defineDynamic and a typed config builder defineGetDotenvConfig\<Vars, Env\>().
|
|
132
|
-
* - Preserve existing behavior for defaults resolution and compat converters.
|
|
232
|
+
* @public
|
|
133
233
|
*/
|
|
234
|
+
interface GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> {
|
|
235
|
+
/**
|
|
236
|
+
* Fully resolved option bag used to compute this context.
|
|
237
|
+
*/
|
|
238
|
+
optionsResolved: TOptions;
|
|
239
|
+
/**
|
|
240
|
+
* Final composed dotenv environment for this invocation.
|
|
241
|
+
*/
|
|
242
|
+
dotenv: ProcessEnv;
|
|
243
|
+
/**
|
|
244
|
+
* Dotenv provenance history for {@link GetDotenvCliCtx.dotenv}.
|
|
245
|
+
*
|
|
246
|
+
* Descriptor-only: does not include value payloads.
|
|
247
|
+
*/
|
|
248
|
+
dotenvProvenance: DotenvProvenance;
|
|
249
|
+
/**
|
|
250
|
+
* Optional runtime plugin state bag. Plugins may publish non-sensitive metadata here.
|
|
251
|
+
*/
|
|
252
|
+
plugins?: Record<string, unknown>;
|
|
253
|
+
/**
|
|
254
|
+
* Per-plugin validated configuration slices keyed by realized mount path.
|
|
255
|
+
*/
|
|
256
|
+
pluginConfigs?: Record<string, unknown>;
|
|
257
|
+
}
|
|
134
258
|
|
|
135
259
|
/**
|
|
136
260
|
* A minimal representation of an environment key/value mapping.
|