envprism 0.1.0 → 0.2.0-dev-main.19-260dbd1
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 +82 -0
- package/dist/bin/envprism.mjs +219 -19
- package/dist/bin/envprism.mjs.map +1 -1
- package/dist/chunks/app-DgjyG_HE.mjs +1800 -0
- package/dist/chunks/app-DgjyG_HE.mjs.map +1 -0
- package/dist/chunks/{matrix-nBq_GY2v.mjs → matrix-C1pErf9Z.mjs} +271 -16
- package/dist/chunks/matrix-C1pErf9Z.mjs.map +1 -0
- package/dist/chunks/{mask-Bv9W6Ei8.mjs → serialize-D_ZNIgRa.mjs} +1 -31
- package/dist/chunks/serialize-D_ZNIgRa.mjs.map +1 -0
- package/dist/config/define.mjs +7 -0
- package/dist/config/define.mjs.map +1 -0
- package/dist/index.mjs +8 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -1
- package/dist/chunks/app-d_wGTwvJ.mjs +0 -1701
- package/dist/chunks/app-d_wGTwvJ.mjs.map +0 -1
- package/dist/chunks/mask-Bv9W6Ei8.mjs.map +0 -1
- package/dist/chunks/matrix-nBq_GY2v.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -4,6 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
**One set of variables, refracted into many environment views — a TUI for managing `.env*` files side by side**
|
|
6
6
|
|
|
7
|
+
[](https://www.npmjs.com/package/envprism)
|
|
8
|
+
[](https://www.npmjs.com/package/envprism)
|
|
9
|
+
[](https://github.com/TitusKirch/envprism/actions/workflows/ci.yml)
|
|
10
|
+
[](https://bun.sh/)
|
|
11
|
+
[](LICENSE)
|
|
12
|
+
|
|
7
13
|

|
|
8
14
|
|
|
9
15
|
</div>
|
|
@@ -85,6 +91,82 @@ bunx envprism diff --check; echo $? # exits 1 if any file drifts from base
|
|
|
85
91
|
|
|
86
92
|
Inside the TUI, press `?` for the full keybinding reference.
|
|
87
93
|
|
|
94
|
+
## ⚙️ Configuration
|
|
95
|
+
|
|
96
|
+
envprism runs zero-config. To tune defaults, drop an `envprism.config.{ts,js,mjs,json}` in your project — manage it with the `config` commands:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
bunx envprism config init # scaffold envprism.config.ts (--force to overwrite)
|
|
100
|
+
bunx envprism config path # print the resolved config file (or note defaults)
|
|
101
|
+
bunx envprism config show # print the effective merged config as JSON
|
|
102
|
+
bunx envprism config edit # open it in $EDITOR (creates one in cwd if absent)
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**Discovery & precedence.** The config file is resolved by walking **up from the current working directory** (not from the scanned `--paths` directory). Override the location with the `--config <path>` flag or the `ENVPRISM_CONFIG` env var. For any individual setting, a CLI flag beats the config file, which beats the built-in default (`flag > config > default`).
|
|
106
|
+
|
|
107
|
+
For type-safe authoring:
|
|
108
|
+
|
|
109
|
+
```ts
|
|
110
|
+
// envprism.config.ts
|
|
111
|
+
import { defineEnvprismConfig } from 'envprism/config';
|
|
112
|
+
|
|
113
|
+
export default defineEnvprismConfig({
|
|
114
|
+
heuristics: { secretTokensExtra: ['WEBHOOK'], grouping: 'banner' },
|
|
115
|
+
tui: { theme: { fgSection: '#5fd7d7' } }
|
|
116
|
+
});
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
List fields come in two flavours: the base field (e.g. `secretTokens`) **replaces** the built-in list, while the `…Extra` variant (e.g. `secretTokensExtra`) **appends** to it.
|
|
120
|
+
|
|
121
|
+
### `discovery`
|
|
122
|
+
|
|
123
|
+
| Option | Default | What it does |
|
|
124
|
+
| :------------------ | :--------------------- | :------------------------------------------------------ |
|
|
125
|
+
| `paths` | `['.']` | Directories scanned when none are passed on the CLI. |
|
|
126
|
+
| `skipSuffixes` | `['.swp', '~', '.bak']`| Filename suffixes to skip (replaces the default list). |
|
|
127
|
+
| `skipSuffixesExtra` | `[]` | Suffixes appended to `skipSuffixes`. |
|
|
128
|
+
| `exampleFirst` | `true` | Sort `.env.example` first in the discovered file order. |
|
|
129
|
+
|
|
130
|
+
### `base`
|
|
131
|
+
|
|
132
|
+
| Option | Default | What it does |
|
|
133
|
+
| :--------- | :--------------- | :----------------------------------------------------------------- |
|
|
134
|
+
| `name` | `'.env.example'` | Filename used as the diff base when present (overridden by `--base`). |
|
|
135
|
+
| `priority` | `[]` | Ordered basenames tried as base before falling back to the first file. |
|
|
136
|
+
|
|
137
|
+
Base resolution order: `--base` flag → `base.name` → `base.priority` (in order) → first discovered file.
|
|
138
|
+
|
|
139
|
+
### `heuristics`
|
|
140
|
+
|
|
141
|
+
| Option | Default | What it does |
|
|
142
|
+
| :------------------ | :------------------------------- | :-------------------------------------------------------- |
|
|
143
|
+
| `secretTokens` | `SECRET, TOKEN, PASSWORD, …` | Key segments that mark a value as a secret (replaces). |
|
|
144
|
+
| `secretTokensExtra` | `[]` | Secret tokens appended to the defaults. |
|
|
145
|
+
| `placeholders` | `todo, fixme, changeme, …` | Regex atoms flagging placeholder values (replaces). |
|
|
146
|
+
| `placeholdersExtra` | `[]` | Placeholder atoms appended to the defaults. |
|
|
147
|
+
| `grouping` | `'auto'` | TUI grouping: `auto` (banner if present, else prefix), `banner`, or `prefix`. |
|
|
148
|
+
|
|
149
|
+
### `diff`
|
|
150
|
+
|
|
151
|
+
| Option | Default | What it does |
|
|
152
|
+
| :-------------- | :------ | :---------------------------------------------------- |
|
|
153
|
+
| `json` | `false` | Emit JSON instead of the text table by default. |
|
|
154
|
+
| `checkExitCode` | `1` | Exit code used by `diff --check` when files drift. |
|
|
155
|
+
|
|
156
|
+
### `tui`
|
|
157
|
+
|
|
158
|
+
| Option | Default | What it does |
|
|
159
|
+
| :------------ | :------ | :-------------------------------------------------------------- |
|
|
160
|
+
| `theme` | `{}` | Partial `#rrggbb` overrides for the palette (see keys below). |
|
|
161
|
+
| `layout` | — | Column/sidebar widths: `keyColWidth` (22), `valueColMin` (18), `sidebarWidth` (30), `rowGap` (0), `cellPadX` (1). |
|
|
162
|
+
| `undoLimit` | `50` | Max entries in the undo stack. |
|
|
163
|
+
| `maskSecrets` | `true` | Start with secret-suspect values masked (toggle in-app with `Ctrl-T`). |
|
|
164
|
+
|
|
165
|
+
Theme keys (all optional hex strings): `fg`, `fgDim`, `fgHeader`, `fgBase`, `fgSection`, `differs`, `extra`, `placeholder`, `modified`, `fgDirty`, `missing`, `focusBg`. Invalid hex values are ignored with a warning and fall back to the default.
|
|
166
|
+
|
|
167
|
+
> [!NOTE]
|
|
168
|
+
> The TypeScript types exported from `envprism/config` (`EnvprismUserConfig` and friends) are the canonical, always-current reference. A worked example lives in [`examples/envprism.config.ts`](examples/envprism.config.ts).
|
|
169
|
+
|
|
88
170
|
## 🤝 Contributing
|
|
89
171
|
|
|
90
172
|
PRs welcome. Conventional Commits required (enforced via commitlint). Husky runs the project's linters/formatters on `git commit`.
|
package/dist/bin/envprism.mjs
CHANGED
|
@@ -1,8 +1,178 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
import { defineCommand, runMain } from "citty";
|
|
3
|
+
import { spawn } from "node:child_process";
|
|
4
|
+
import { writeFile } from "node:fs/promises";
|
|
3
5
|
import consola from "consola";
|
|
4
|
-
import { resolve } from "pathe";
|
|
5
|
-
import {
|
|
6
|
+
import { resolve, join } from "pathe";
|
|
7
|
+
import { l as loadEnvprismConfig, e as discoverEnvFiles, r as resolveBase, b as buildMatrix, c as computeDiff, g as formatDiffText } from "../chunks/matrix-C1pErf9Z.mjs";
|
|
8
|
+
const CONFIG_TEMPLATE = `/**
|
|
9
|
+
* envprism configuration.
|
|
10
|
+
*
|
|
11
|
+
* For type-safe authoring, install envprism and switch to:
|
|
12
|
+
* import { defineEnvprismConfig } from 'envprism/config';
|
|
13
|
+
* export default defineEnvprismConfig({ ... });
|
|
14
|
+
*
|
|
15
|
+
* @type {import('envprism/config').EnvprismUserConfig}
|
|
16
|
+
*/
|
|
17
|
+
export default {
|
|
18
|
+
discovery: {
|
|
19
|
+
// paths: ['.'],
|
|
20
|
+
// skipSuffixesExtra: ['.tmp'],
|
|
21
|
+
// exampleFirst: true
|
|
22
|
+
},
|
|
23
|
+
base: {
|
|
24
|
+
name: '.env.example'
|
|
25
|
+
// priority: ['.env.shared']
|
|
26
|
+
},
|
|
27
|
+
heuristics: {
|
|
28
|
+
// secretTokensExtra: ['JWT'],
|
|
29
|
+
// placeholdersExtra: ['set[_-]?me'],
|
|
30
|
+
grouping: 'auto'
|
|
31
|
+
},
|
|
32
|
+
diff: {
|
|
33
|
+
json: false,
|
|
34
|
+
checkExitCode: 1
|
|
35
|
+
},
|
|
36
|
+
tui: {
|
|
37
|
+
theme: {
|
|
38
|
+
// fgBase: '#82aaff'
|
|
39
|
+
},
|
|
40
|
+
layout: {
|
|
41
|
+
keyColWidth: 22,
|
|
42
|
+
valueColMin: 18,
|
|
43
|
+
sidebarWidth: 30,
|
|
44
|
+
rowGap: 0,
|
|
45
|
+
cellPadX: 1
|
|
46
|
+
},
|
|
47
|
+
undoLimit: 50,
|
|
48
|
+
maskSecrets: true
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
`;
|
|
52
|
+
const initCommand = defineCommand({
|
|
53
|
+
meta: {
|
|
54
|
+
name: "init",
|
|
55
|
+
description: "Scaffold an envprism.config.ts with documented defaults."
|
|
56
|
+
},
|
|
57
|
+
args: {
|
|
58
|
+
out: {
|
|
59
|
+
type: "positional",
|
|
60
|
+
required: false,
|
|
61
|
+
description: "Directory to write envprism.config.ts into (default: cwd)."
|
|
62
|
+
},
|
|
63
|
+
force: {
|
|
64
|
+
type: "boolean",
|
|
65
|
+
description: "Overwrite an existing config file."
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
async run({ args }) {
|
|
69
|
+
const dir = resolve(typeof args.out === "string" ? args.out : ".");
|
|
70
|
+
const target = join(dir, "envprism.config.ts");
|
|
71
|
+
try {
|
|
72
|
+
await writeFile(target, CONFIG_TEMPLATE, {
|
|
73
|
+
encoding: "utf8",
|
|
74
|
+
flag: args.force ? "w" : "wx"
|
|
75
|
+
});
|
|
76
|
+
} catch (err) {
|
|
77
|
+
if (err.code === "EEXIST") {
|
|
78
|
+
consola.error(`${target} already exists. Use --force to overwrite.`);
|
|
79
|
+
process.exitCode = 1;
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
throw err;
|
|
83
|
+
}
|
|
84
|
+
consola.success(`Wrote ${target}`);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
const editCommand = defineCommand({
|
|
88
|
+
meta: {
|
|
89
|
+
name: "edit",
|
|
90
|
+
description: "Open the config in $EDITOR (creates it in cwd if none exists)."
|
|
91
|
+
},
|
|
92
|
+
args: {
|
|
93
|
+
config: {
|
|
94
|
+
type: "string",
|
|
95
|
+
description: "Path to an envprism.config file (default: walk up from cwd)."
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
async run({ args }) {
|
|
99
|
+
let { configFile } = await loadEnvprismConfig({ configFile: args.config });
|
|
100
|
+
if (!configFile) {
|
|
101
|
+
configFile = resolve("envprism.config.ts");
|
|
102
|
+
try {
|
|
103
|
+
await writeFile(configFile, CONFIG_TEMPLATE, {
|
|
104
|
+
encoding: "utf8",
|
|
105
|
+
flag: "wx"
|
|
106
|
+
});
|
|
107
|
+
consola.info(`Created ${configFile}`);
|
|
108
|
+
} catch {
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
const editor = process.env.VISUAL || process.env.EDITOR || "nano";
|
|
112
|
+
await new Promise((res, rej) => {
|
|
113
|
+
const child = spawn(editor, [configFile], { stdio: "inherit" });
|
|
114
|
+
child.on("error", rej);
|
|
115
|
+
child.on("exit", (code) => {
|
|
116
|
+
if (code && code !== 0) {
|
|
117
|
+
consola.warn(`${editor} exited with code ${code}.`);
|
|
118
|
+
}
|
|
119
|
+
res();
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
const pathCommand = defineCommand({
|
|
125
|
+
meta: {
|
|
126
|
+
name: "path",
|
|
127
|
+
description: "Print the resolved config file path (or note that defaults are used)."
|
|
128
|
+
},
|
|
129
|
+
args: {
|
|
130
|
+
config: {
|
|
131
|
+
type: "string",
|
|
132
|
+
description: "Path to an envprism.config file (default: walk up from cwd)."
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
async run({ args }) {
|
|
136
|
+
const { configFile, cwd } = await loadEnvprismConfig({
|
|
137
|
+
configFile: args.config
|
|
138
|
+
});
|
|
139
|
+
if (configFile) {
|
|
140
|
+
process.stdout.write(configFile + "\n");
|
|
141
|
+
} else {
|
|
142
|
+
consola.info(
|
|
143
|
+
`No envprism.config found (searched up from ${cwd}); using built-in defaults.`
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
const showCommand = defineCommand({
|
|
149
|
+
meta: {
|
|
150
|
+
name: "show",
|
|
151
|
+
description: "Print the effective (merged) config as JSON."
|
|
152
|
+
},
|
|
153
|
+
args: {
|
|
154
|
+
config: {
|
|
155
|
+
type: "string",
|
|
156
|
+
description: "Path to an envprism.config file (default: walk up from cwd)."
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
async run({ args }) {
|
|
160
|
+
const { config } = await loadEnvprismConfig({ configFile: args.config });
|
|
161
|
+
process.stdout.write(JSON.stringify(config, null, 2) + "\n");
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
const configCommand = defineCommand({
|
|
165
|
+
meta: {
|
|
166
|
+
name: "config",
|
|
167
|
+
description: "Inspect and manage the envprism config."
|
|
168
|
+
},
|
|
169
|
+
subCommands: {
|
|
170
|
+
init: initCommand,
|
|
171
|
+
path: pathCommand,
|
|
172
|
+
show: showCommand,
|
|
173
|
+
edit: editCommand
|
|
174
|
+
}
|
|
175
|
+
});
|
|
6
176
|
const diffCommand = defineCommand({
|
|
7
177
|
meta: {
|
|
8
178
|
name: "diff",
|
|
@@ -25,16 +195,30 @@ const diffCommand = defineCommand({
|
|
|
25
195
|
check: {
|
|
26
196
|
type: "boolean",
|
|
27
197
|
description: "Suppress output and exit 1 when any file drifts from the base."
|
|
198
|
+
},
|
|
199
|
+
config: {
|
|
200
|
+
type: "string",
|
|
201
|
+
description: "Path to an envprism.config file (default: walk up from cwd)."
|
|
28
202
|
}
|
|
29
203
|
},
|
|
30
204
|
async run({ args }) {
|
|
31
|
-
const
|
|
32
|
-
const
|
|
205
|
+
const { config } = await loadEnvprismConfig({ configFile: args.config });
|
|
206
|
+
const inputs = collectPaths$1(args.paths, config.discovery.paths);
|
|
207
|
+
const files = await discoverEnvFiles(
|
|
208
|
+
inputs.map((p) => resolve(p)),
|
|
209
|
+
{
|
|
210
|
+
skipSuffixes: config.discovery.skipSuffixes,
|
|
211
|
+
exampleFirst: config.discovery.exampleFirst
|
|
212
|
+
}
|
|
213
|
+
);
|
|
33
214
|
if (files.length === 0) {
|
|
34
215
|
if (!args.check) consola.warn("No .env* files found.");
|
|
35
216
|
process.exit(args.check ? 0 : 1);
|
|
36
217
|
}
|
|
37
|
-
const base = resolveBase(files, args.base
|
|
218
|
+
const base = resolveBase(files, args.base, {
|
|
219
|
+
name: config.base.name,
|
|
220
|
+
priority: config.base.priority
|
|
221
|
+
});
|
|
38
222
|
if (!base) {
|
|
39
223
|
consola.error("Could not resolve a base file.");
|
|
40
224
|
process.exit(1);
|
|
@@ -42,35 +226,46 @@ const diffCommand = defineCommand({
|
|
|
42
226
|
const matrix = buildMatrix(files, base);
|
|
43
227
|
const report = computeDiff(matrix);
|
|
44
228
|
if (args.check) {
|
|
45
|
-
process.exit(report.inSync ? 0 :
|
|
229
|
+
process.exit(report.inSync ? 0 : config.diff.checkExitCode);
|
|
46
230
|
}
|
|
47
|
-
|
|
231
|
+
const json = args.json ?? config.diff.json;
|
|
232
|
+
if (json) {
|
|
48
233
|
process.stdout.write(JSON.stringify(report, null, 2) + "\n");
|
|
49
234
|
return;
|
|
50
235
|
}
|
|
51
236
|
process.stdout.write(formatDiffText(report));
|
|
52
237
|
}
|
|
53
238
|
});
|
|
54
|
-
function collectPaths$1(arg) {
|
|
239
|
+
function collectPaths$1(arg, fallback) {
|
|
55
240
|
if (Array.isArray(arg)) return arg.map(String);
|
|
56
241
|
if (typeof arg === "string" && arg.length > 0) return [arg];
|
|
57
|
-
return
|
|
242
|
+
return fallback;
|
|
58
243
|
}
|
|
59
244
|
async function runTui(args) {
|
|
60
|
-
const
|
|
61
|
-
const
|
|
245
|
+
const { config } = await loadEnvprismConfig({ configFile: args.config });
|
|
246
|
+
const inputs = collectPaths(args.paths, config.discovery.paths);
|
|
247
|
+
const files = await discoverEnvFiles(
|
|
248
|
+
inputs.map((p) => resolve(p)),
|
|
249
|
+
{
|
|
250
|
+
skipSuffixes: config.discovery.skipSuffixes,
|
|
251
|
+
exampleFirst: config.discovery.exampleFirst
|
|
252
|
+
}
|
|
253
|
+
);
|
|
62
254
|
if (files.length === 0) {
|
|
63
255
|
consola.warn("No .env* files found.");
|
|
64
256
|
process.exit(1);
|
|
65
257
|
}
|
|
66
|
-
const base = resolveBase(files, args.base
|
|
258
|
+
const base = resolveBase(files, args.base, {
|
|
259
|
+
name: config.base.name,
|
|
260
|
+
priority: config.base.priority
|
|
261
|
+
});
|
|
67
262
|
if (!base) {
|
|
68
263
|
consola.error("Could not resolve a base file.");
|
|
69
264
|
process.exit(1);
|
|
70
265
|
}
|
|
71
266
|
const matrix = buildMatrix(files, base);
|
|
72
|
-
const { runMatrixTui } = await import("../chunks/app-
|
|
73
|
-
await runMatrixTui(matrix);
|
|
267
|
+
const { runMatrixTui } = await import("../chunks/app-DgjyG_HE.mjs");
|
|
268
|
+
await runMatrixTui(matrix, config);
|
|
74
269
|
}
|
|
75
270
|
const tuiCommand = defineCommand({
|
|
76
271
|
meta: {
|
|
@@ -86,18 +281,22 @@ const tuiCommand = defineCommand({
|
|
|
86
281
|
base: {
|
|
87
282
|
type: "string",
|
|
88
283
|
description: "Base file to diff against (defaults to .env.example)."
|
|
284
|
+
},
|
|
285
|
+
config: {
|
|
286
|
+
type: "string",
|
|
287
|
+
description: "Path to an envprism.config file (default: walk up from cwd)."
|
|
89
288
|
}
|
|
90
289
|
},
|
|
91
290
|
async run({ args }) {
|
|
92
|
-
await runTui({ paths: args.paths, base: args.base });
|
|
291
|
+
await runTui({ paths: args.paths, base: args.base, config: args.config });
|
|
93
292
|
}
|
|
94
293
|
});
|
|
95
|
-
function collectPaths(arg) {
|
|
294
|
+
function collectPaths(arg, fallback) {
|
|
96
295
|
if (Array.isArray(arg)) return arg.map(String);
|
|
97
296
|
if (typeof arg === "string" && arg.length > 0) return [arg];
|
|
98
|
-
return
|
|
297
|
+
return fallback;
|
|
99
298
|
}
|
|
100
|
-
const SUBCOMMANDS = /* @__PURE__ */ new Set(["tui", "diff"]);
|
|
299
|
+
const SUBCOMMANDS = /* @__PURE__ */ new Set(["tui", "diff", "config"]);
|
|
101
300
|
const rootCommand = defineCommand({
|
|
102
301
|
meta: {
|
|
103
302
|
name: "envprism",
|
|
@@ -105,7 +304,8 @@ const rootCommand = defineCommand({
|
|
|
105
304
|
},
|
|
106
305
|
subCommands: {
|
|
107
306
|
tui: tuiCommand,
|
|
108
|
-
diff: diffCommand
|
|
307
|
+
diff: diffCommand,
|
|
308
|
+
config: configCommand
|
|
109
309
|
},
|
|
110
310
|
// citty 0.1.6 invokes the root `run` after a matched subcommand returns,
|
|
111
311
|
// so guard against double-execution by bailing when the first positional
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"envprism.mjs","sources":["../../src/commands/diff.ts","../../src/commands/tui.ts","../../src/cli.ts","../../src/bin/envprism.ts"],"sourcesContent":["import { defineCommand } from 'citty';\nimport consola from 'consola';\nimport { resolve } from 'pathe';\nimport { resolveBase } from '../core/base.ts';\nimport { computeDiff, formatDiffText } from '../core/diff.ts';\nimport { discoverEnvFiles } from '../core/discover.ts';\nimport { buildMatrix } from '../core/matrix.ts';\n\nexport const diffCommand = defineCommand({\n meta: {\n name: 'diff',\n description: 'Print the drift between .env* files compared to a base.'\n },\n args: {\n paths: {\n type: 'positional',\n required: false,\n description: 'Directory or files to scan (defaults to cwd).'\n },\n base: {\n type: 'string',\n description: 'Base file to diff against (defaults to .env.example).'\n },\n json: {\n type: 'boolean',\n description: 'Emit JSON instead of a text table.'\n },\n check: {\n type: 'boolean',\n description:\n 'Suppress output and exit 1 when any file drifts from the base.'\n }\n },\n async run({ args }) {\n const inputs = collectPaths(args.paths);\n const files = await discoverEnvFiles(inputs.map((p) => resolve(p)));\n\n if (files.length === 0) {\n if (!args.check) consola.warn('No .env* files found.');\n process.exit(args.check ? 0 : 1);\n }\n\n const base = resolveBase(files, args.base);\n if (!base) {\n consola.error('Could not resolve a base file.');\n process.exit(1);\n }\n\n const matrix = buildMatrix(files, base);\n const report = computeDiff(matrix);\n\n if (args.check) {\n process.exit(report.inSync ? 0 : 1);\n }\n\n if (args.json) {\n process.stdout.write(JSON.stringify(report, null, 2) + '\\n');\n return;\n }\n\n process.stdout.write(formatDiffText(report));\n }\n});\n\nfunction collectPaths(arg: unknown): string[] {\n if (Array.isArray(arg)) return arg.map(String);\n if (typeof arg === 'string' && arg.length > 0) return [arg];\n return ['.'];\n}\n","import { defineCommand } from 'citty';\nimport consola from 'consola';\nimport { resolve } from 'pathe';\nimport { resolveBase } from '../core/base.ts';\nimport { discoverEnvFiles } from '../core/discover.ts';\nimport { buildMatrix } from '../core/matrix.ts';\n\ninterface TuiInvocation {\n paths?: string | string[];\n base?: string;\n}\n\n/**\n * Resolve the matrix and boot the TUI. Shared between the explicit `tui`\n * subcommand and the default-no-subcommand path in `rootCommand`.\n */\nexport async function runTui(args: TuiInvocation): Promise<void> {\n const inputs = collectPaths(args.paths);\n const files = await discoverEnvFiles(inputs.map((p) => resolve(p)));\n\n if (files.length === 0) {\n consola.warn('No .env* files found.');\n process.exit(1);\n }\n\n const base = resolveBase(files, args.base);\n if (!base) {\n consola.error('Could not resolve a base file.');\n process.exit(1);\n }\n\n const matrix = buildMatrix(files, base);\n\n // Dynamic import keeps @opentui/core out of the bundle path used by the\n // `diff` subcommand, so users running diff on Node never hit Bun-only code.\n const { runMatrixTui } = await import('../tui/app.ts');\n await runMatrixTui(matrix);\n}\n\nexport const tuiCommand = defineCommand({\n meta: {\n name: 'tui',\n description: 'Open the interactive matrix view (default command).'\n },\n args: {\n paths: {\n type: 'positional',\n required: false,\n description: 'Directory or files to scan (defaults to cwd).'\n },\n base: {\n type: 'string',\n description: 'Base file to diff against (defaults to .env.example).'\n }\n },\n async run({ args }) {\n await runTui({ paths: args.paths, base: args.base });\n }\n});\n\nfunction collectPaths(arg: unknown): string[] {\n if (Array.isArray(arg)) return arg.map(String);\n if (typeof arg === 'string' && arg.length > 0) return [arg];\n return ['.'];\n}\n","import { defineCommand } from 'citty';\nimport { diffCommand } from './commands/diff.ts';\nimport { runTui, tuiCommand } from './commands/tui.ts';\n\nconst SUBCOMMANDS = new Set(['tui', 'diff']);\n\nexport const rootCommand = defineCommand({\n meta: {\n name: 'envprism',\n description:\n 'TUI-based env file manager — refract one set of variables into many environment views.'\n },\n subCommands: {\n tui: tuiCommand,\n diff: diffCommand\n },\n // citty 0.1.6 invokes the root `run` after a matched subcommand returns,\n // so guard against double-execution by bailing when the first positional\n // arg names a known subcommand. With no args at all we launch the TUI in\n // the cwd, which is the documented default.\n async run({ rawArgs }) {\n const firstPositional = rawArgs.find((a) => !a.startsWith('-'));\n if (firstPositional && SUBCOMMANDS.has(firstPositional)) return;\n await runTui({});\n }\n});\n","import { runMain } from 'citty';\nimport { rootCommand } from '../cli.ts';\n\nrunMain(rootCommand);\n"],"names":["collectPaths"],"mappings":";;;;;AAQO,MAAM,cAAc,cAAc;AAAA,EACvC,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,aAAa;AAAA,EAAA;AAAA,EAEf,MAAM;AAAA,IACJ,OAAO;AAAA,MACL,MAAM;AAAA,MACN,UAAU;AAAA,MACV,aAAa;AAAA,IAAA;AAAA,IAEf,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,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AAM,CAAC,EAAE,WAAW,GAAG,CAAC;AAC9D,QAAI,mBAAmB,YAAY,IAAI,eAAe,EAAG;AACzD,UAAM,OAAO,CAAA,CAAE;AAAA,EACjB;AACF,CAAC;ACtBD,QAAQ,WAAW;"}
|
|
1
|
+
{"version":3,"file":"envprism.mjs","sources":["../../src/commands/config/init.ts","../../src/commands/config/edit.ts","../../src/commands/config/path.ts","../../src/commands/config/show.ts","../../src/commands/config/index.ts","../../src/commands/diff.ts","../../src/commands/tui.ts","../../src/cli.ts","../../src/bin/envprism.ts"],"sourcesContent":["import { writeFile } from 'node:fs/promises';\nimport { defineCommand } from 'citty';\nimport consola from 'consola';\nimport { join, resolve } from 'pathe';\n\n/** Scaffold template, shared with `config edit` for first-time creation. */\nexport const CONFIG_TEMPLATE = `/**\n * envprism configuration.\n *\n * For type-safe authoring, install envprism and switch to:\n * import { defineEnvprismConfig } from 'envprism/config';\n * export default defineEnvprismConfig({ ... });\n *\n * @type {import('envprism/config').EnvprismUserConfig}\n */\nexport default {\n discovery: {\n // paths: ['.'],\n // skipSuffixesExtra: ['.tmp'],\n // exampleFirst: true\n },\n base: {\n name: '.env.example'\n // priority: ['.env.shared']\n },\n heuristics: {\n // secretTokensExtra: ['JWT'],\n // placeholdersExtra: ['set[_-]?me'],\n grouping: 'auto'\n },\n diff: {\n json: false,\n checkExitCode: 1\n },\n tui: {\n theme: {\n // fgBase: '#82aaff'\n },\n layout: {\n keyColWidth: 22,\n valueColMin: 18,\n sidebarWidth: 30,\n rowGap: 0,\n cellPadX: 1\n },\n undoLimit: 50,\n maskSecrets: true\n }\n};\n`;\n\nexport const initCommand = defineCommand({\n meta: {\n name: 'init',\n description: 'Scaffold an envprism.config.ts with documented defaults.'\n },\n args: {\n out: {\n type: 'positional',\n required: false,\n description: 'Directory to write envprism.config.ts into (default: cwd).'\n },\n force: {\n type: 'boolean',\n description: 'Overwrite an existing config file.'\n }\n },\n async run({ args }) {\n const dir = resolve(typeof args.out === 'string' ? args.out : '.');\n const target = join(dir, 'envprism.config.ts');\n try {\n await writeFile(target, CONFIG_TEMPLATE, {\n encoding: 'utf8',\n flag: args.force ? 'w' : 'wx'\n });\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === 'EEXIST') {\n consola.error(`${target} already exists. Use --force to overwrite.`);\n process.exitCode = 1;\n return;\n }\n throw err;\n }\n consola.success(`Wrote ${target}`);\n }\n});\n","import { spawn } from 'node:child_process';\nimport { writeFile } from 'node:fs/promises';\nimport { defineCommand } from 'citty';\nimport consola from 'consola';\nimport { resolve } from 'pathe';\nimport { CONFIG_TEMPLATE } from '@/commands/config/init.ts';\nimport { loadEnvprismConfig } from '@/config/load.ts';\n\nexport const editCommand = defineCommand({\n meta: {\n name: 'edit',\n description:\n 'Open the config in $EDITOR (creates it in cwd if none exists).'\n },\n args: {\n config: {\n type: 'string',\n description:\n 'Path to an envprism.config file (default: walk up from cwd).'\n }\n },\n async run({ args }) {\n let { configFile } = await loadEnvprismConfig({ configFile: args.config });\n\n if (!configFile) {\n configFile = resolve('envprism.config.ts');\n try {\n await writeFile(configFile, CONFIG_TEMPLATE, {\n encoding: 'utf8',\n flag: 'wx'\n });\n consola.info(`Created ${configFile}`);\n } catch {\n // Created concurrently or already present — open whatever is there.\n }\n }\n\n const editor = process.env.VISUAL || process.env.EDITOR || 'nano';\n await new Promise<void>((res, rej) => {\n const child = spawn(editor, [configFile!], { stdio: 'inherit' });\n child.on('error', rej);\n child.on('exit', (code) => {\n if (code && code !== 0) {\n consola.warn(`${editor} exited with code ${code}.`);\n }\n res();\n });\n });\n }\n});\n","import { defineCommand } from 'citty';\nimport consola from 'consola';\nimport { loadEnvprismConfig } from '@/config/load.ts';\n\nexport const pathCommand = defineCommand({\n meta: {\n name: 'path',\n description:\n 'Print the resolved config file path (or note that defaults are used).'\n },\n args: {\n config: {\n type: 'string',\n description:\n 'Path to an envprism.config file (default: walk up from cwd).'\n }\n },\n async run({ args }) {\n const { configFile, cwd } = await loadEnvprismConfig({\n configFile: args.config\n });\n if (configFile) {\n // Path goes to stdout so it can be piped; the not-found note is on stderr.\n process.stdout.write(configFile + '\\n');\n } else {\n consola.info(\n `No envprism.config found (searched up from ${cwd}); using built-in defaults.`\n );\n }\n }\n});\n","import { defineCommand } from 'citty';\nimport { loadEnvprismConfig } from '@/config/load.ts';\n\nexport const showCommand = defineCommand({\n meta: {\n name: 'show',\n description: 'Print the effective (merged) config as JSON.'\n },\n args: {\n config: {\n type: 'string',\n description:\n 'Path to an envprism.config file (default: walk up from cwd).'\n }\n },\n async run({ args }) {\n const { config } = await loadEnvprismConfig({ configFile: args.config });\n process.stdout.write(JSON.stringify(config, null, 2) + '\\n');\n }\n});\n","import { defineCommand } from 'citty';\nimport { editCommand } from '@/commands/config/edit.ts';\nimport { initCommand } from '@/commands/config/init.ts';\nimport { pathCommand } from '@/commands/config/path.ts';\nimport { showCommand } from '@/commands/config/show.ts';\n\nexport const configCommand = defineCommand({\n meta: {\n name: 'config',\n description: 'Inspect and manage the envprism config.'\n },\n subCommands: {\n init: initCommand,\n path: pathCommand,\n show: showCommand,\n edit: editCommand\n }\n});\n","import { defineCommand } from 'citty';\nimport consola from 'consola';\nimport { resolve } from 'pathe';\nimport { loadEnvprismConfig } from '@/config/load.ts';\nimport { resolveBase } from '@/core/base.ts';\nimport { computeDiff, formatDiffText } from '@/core/diff.ts';\nimport { discoverEnvFiles } from '@/core/discover.ts';\nimport { buildMatrix } from '@/core/matrix.ts';\n\nexport const diffCommand = defineCommand({\n meta: {\n name: 'diff',\n description: 'Print the drift between .env* files compared to a base.'\n },\n args: {\n paths: {\n type: 'positional',\n required: false,\n description: 'Directory or files to scan (defaults to cwd).'\n },\n base: {\n type: 'string',\n description: 'Base file to diff against (defaults to .env.example).'\n },\n json: {\n type: 'boolean',\n description: 'Emit JSON instead of a text table.'\n },\n check: {\n type: 'boolean',\n description:\n 'Suppress output and exit 1 when any file drifts from the base.'\n },\n config: {\n type: 'string',\n description:\n 'Path to an envprism.config file (default: walk up from cwd).'\n }\n },\n async run({ args }) {\n const { config } = await loadEnvprismConfig({ configFile: args.config });\n const inputs = collectPaths(args.paths, config.discovery.paths);\n const files = await discoverEnvFiles(\n inputs.map((p) => resolve(p)),\n {\n skipSuffixes: config.discovery.skipSuffixes,\n exampleFirst: config.discovery.exampleFirst\n }\n );\n\n if (files.length === 0) {\n if (!args.check) consola.warn('No .env* files found.');\n process.exit(args.check ? 0 : 1);\n }\n\n const base = resolveBase(files, args.base, {\n name: config.base.name,\n priority: config.base.priority\n });\n if (!base) {\n consola.error('Could not resolve a base file.');\n process.exit(1);\n }\n\n const matrix = buildMatrix(files, base);\n const report = computeDiff(matrix);\n\n if (args.check) {\n process.exit(report.inSync ? 0 : config.diff.checkExitCode);\n }\n\n const json = args.json ?? config.diff.json;\n if (json) {\n process.stdout.write(JSON.stringify(report, null, 2) + '\\n');\n return;\n }\n\n process.stdout.write(formatDiffText(report));\n }\n});\n\nfunction collectPaths(arg: unknown, fallback: string[]): string[] {\n if (Array.isArray(arg)) return arg.map(String);\n if (typeof arg === 'string' && arg.length > 0) return [arg];\n return fallback;\n}\n","import { defineCommand } from 'citty';\nimport consola from 'consola';\nimport { resolve } from 'pathe';\nimport { loadEnvprismConfig } from '@/config/load.ts';\nimport { resolveBase } from '@/core/base.ts';\nimport { discoverEnvFiles } from '@/core/discover.ts';\nimport { buildMatrix } from '@/core/matrix.ts';\n\ninterface TuiInvocation {\n paths?: string | string[];\n base?: string;\n config?: string;\n}\n\n/**\n * Resolve the matrix and boot the TUI. Shared between the explicit `tui`\n * subcommand and the default-no-subcommand path in `rootCommand`.\n */\nexport async function runTui(args: TuiInvocation): Promise<void> {\n const { config } = await loadEnvprismConfig({ configFile: args.config });\n const inputs = collectPaths(args.paths, config.discovery.paths);\n const files = await discoverEnvFiles(\n inputs.map((p) => resolve(p)),\n {\n skipSuffixes: config.discovery.skipSuffixes,\n exampleFirst: config.discovery.exampleFirst\n }\n );\n\n if (files.length === 0) {\n consola.warn('No .env* files found.');\n process.exit(1);\n }\n\n const base = resolveBase(files, args.base, {\n name: config.base.name,\n priority: config.base.priority\n });\n if (!base) {\n consola.error('Could not resolve a base file.');\n process.exit(1);\n }\n\n const matrix = buildMatrix(files, base);\n\n // Dynamic import keeps @opentui/core out of the bundle path used by the\n // `diff` subcommand, so users running diff on Node never hit Bun-only code.\n const { runMatrixTui } = await import('../tui/app.ts');\n await runMatrixTui(matrix, config);\n}\n\nexport const tuiCommand = defineCommand({\n meta: {\n name: 'tui',\n description: 'Open the interactive matrix view (default command).'\n },\n args: {\n paths: {\n type: 'positional',\n required: false,\n description: 'Directory or files to scan (defaults to cwd).'\n },\n base: {\n type: 'string',\n description: 'Base file to diff against (defaults to .env.example).'\n },\n config: {\n type: 'string',\n description:\n 'Path to an envprism.config file (default: walk up from cwd).'\n }\n },\n async run({ args }) {\n await runTui({ paths: args.paths, base: args.base, config: args.config });\n }\n});\n\nfunction collectPaths(arg: unknown, fallback: string[]): string[] {\n if (Array.isArray(arg)) return arg.map(String);\n if (typeof arg === 'string' && arg.length > 0) return [arg];\n return fallback;\n}\n","import { defineCommand } from 'citty';\nimport { configCommand } from '@/commands/config/index.ts';\nimport { diffCommand } from '@/commands/diff.ts';\nimport { runTui, tuiCommand } from '@/commands/tui.ts';\n\nconst SUBCOMMANDS = new Set(['tui', 'diff', 'config']);\n\nexport const rootCommand = defineCommand({\n meta: {\n name: 'envprism',\n description:\n 'TUI-based env file manager — refract one set of variables into many environment views.'\n },\n subCommands: {\n tui: tuiCommand,\n diff: diffCommand,\n config: configCommand\n },\n // citty 0.1.6 invokes the root `run` after a matched subcommand returns,\n // so guard against double-execution by bailing when the first positional\n // arg names a known subcommand. With no args at all we launch the TUI in\n // the cwd, which is the documented default.\n async run({ rawArgs }) {\n const firstPositional = rawArgs.find((a) => !a.startsWith('-'));\n if (firstPositional && SUBCOMMANDS.has(firstPositional)) return;\n await runTui({});\n }\n});\n","import { runMain } from 'citty';\nimport { rootCommand } from '@/cli.ts';\n\nr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