envprism 0.3.0 → 0.3.1-dev.63-d884054

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 CHANGED
@@ -10,7 +10,7 @@
10
10
  [![Bun](https://img.shields.io/badge/bun-1.3%2B-8993be?style=flat-square)](https://bun.sh/)
11
11
  [![License: MIT](https://img.shields.io/npm/l/envprism.svg?style=flat-square&color=10b981)](LICENSE)
12
12
 
13
- ![envprism TUI preview](.github/assets/envprism-tui.gif)
13
+ ![envprism TUI preview](.github/assets/demo.gif)
14
14
 
15
15
  </div>
16
16
 
@@ -20,13 +20,48 @@
20
20
  bunx envprism
21
21
  ```
22
22
 
23
- That's it. Point `envprism` at a directory containing `.env*` files and it opens a side-by-side matrix view: rows are variable keys, columns are files. Differences light up, missing keys are obvious, and you can edit cells in place — comments, blank lines, and key order survive the round trip.
23
+ That's it. Point `envprism` at a directory containing `.env*` files and it opens a side-by-side matrix: rows are variable keys, columns are files. Differences light up, missing keys are obvious, and you can edit cells in place — comments, blank lines, and key order survive the round trip.
24
+
25
+ ## 🤔 Why
26
+
27
+ Most projects accumulate a fistful of env files — `.env`, `.env.example`, `.env.staging`, `.env.production` — and no good way to see them together. You `diff` two at a time, miss the third, and ship a deploy where `REDIS_URL` was set everywhere except staging. The example file rots because nobody updates it when they add a key. Secrets get pasted into screenshots.
28
+
29
+ envprism treats the whole set as one thing: every file a column, every variable a row. The gaps jump out — this key is missing here, that value drifts there, this one is still a `CHANGEME`. Edits write back byte-exact, and secret values stay masked so the view is safe to share.
30
+
31
+ ## 📦 Install & run
24
32
 
25
33
  > [!IMPORTANT]
26
- > `envprism` runs on **[Bun](https://bun.sh/)** 1.3+. The TUI is powered by [opentui](https://opentui.com/), which links to a native Zig core via `bun:ffi`. Node has no equivalent built-in FFI, so `npx envprism` will not work — install Bun first.
34
+ > envprism runs on **[Bun](https://bun.sh/)** 1.3+, not Node. The TUI links a native core via `bun:ffi`, so `npx envprism` will **not** work — [install Bun](https://bun.sh/) first.
35
+
36
+ ```bash
37
+ bun add -g envprism # install globally
38
+ bunx envprism # …or run without installing
39
+ ```
40
+
41
+ ```bash
42
+ bunx envprism # open the TUI in the current directory
43
+ bunx envprism tui path/to/repo # scan another directory
44
+ bunx envprism diff path/to/repo # non-interactive drift report
45
+ bunx envprism diff --json | jq # structured drift report
46
+ bunx envprism diff --check # exit 1 if any file drifts from base (CI)
47
+ ```
48
+
49
+ Inside the TUI, press `?` for the full keybinding reference.
27
50
 
28
51
  ## ✨ Features
29
52
 
53
+ - **🧮 Matrix view** — every `.env*` file becomes a column, every variable a row, so n-way differences are visible at a glance.
54
+ - **🎨 Diff at a glance** — per-cell icons flag values that differ, keys that are missing or extra, and unfilled placeholders like `CHANGEME`.
55
+ - **🙈 Secret masking** — token / secret / password-like values render as `•••• (N)`, so the matrix is safe to screen-share.
56
+ - **✏️ Edit in place** — edit any cell with `e`; editing a key a file doesn't have yet creates it. Also add (`a`), delete (`d`), and sync a value to every file (`=`).
57
+ - **💾 Byte-exact write-back** — `Ctrl-S` rewrites only the keys you changed; comments, blank lines, key order, quoting, and `export` prefixes survive intact.
58
+ - **📂 Sections & filtering** — group by comment banner or key prefix (`g`), fold sections (`c`), filter keys live (`/`), or show only drifting keys (`v`).
59
+ - **↩️ Undo** — `Ctrl-Z` walks back the last edits, adds, and deletes.
60
+ - **🧪 CI-friendly diff** — `envprism diff` prints a text or JSON (`--json`) drift report, or just sets an exit code (`--check`) for pre-commit hooks and CI.
61
+
62
+ <details>
63
+ <summary>Full feature list</summary>
64
+
30
65
  ### Discovery & comparison
31
66
 
32
67
  - **🔍 Auto-discovery** — finds every `.env*` file in the current directory (or in `--paths a b c`); skips editor swap files and backups.
@@ -43,7 +78,7 @@ That's it. Point `envprism` at a directory containing `.env*` files and it opens
43
78
  ### Editing & write-back
44
79
 
45
80
  - **✏️ Edit-or-add** — `e` / `Enter` opens an edit popover on any cell; if the key isn't in that file yet, save creates it. The popover renders every file's current value as context next to the input.
46
- - **➕ Add variable** — `a` walks key + value across two prompts; the parser's `[A-Za-z_][A-Za-z0-9_]*` rule guards the key name.
81
+ - **➕ Add variable** — `a` walks key + value across two prompts; the key name is validated.
47
82
  - **➖ Delete variable** — `d` removes the focused key from the focused file.
48
83
  - **🆕 New `.env*` file** — `n` scaffolds a new file next to the base; saved with the rest on `Ctrl-S`.
49
84
  - **🔁 Sync-to-all** — `=` copies the focused cell's value into every file (create or update); `Ctrl-A` inside the edit popover applies what you're typing to every file at once.
@@ -63,48 +98,11 @@ That's it. Point `envprism` at a directory containing `.env*` files and it opens
63
98
 
64
99
  - **🧪 `envprism diff`** — non-interactive subcommand that prints a text drift table, JSON (`--json`), or just sets the exit code (`--check`). Drop it into a pre-commit hook or CI to fail builds that drift from `.env.example`.
65
100
 
66
- ## 📦 Installation
67
-
68
- Install Bun (one-time): see [bun.sh](https://bun.sh/).
69
-
70
- ```bash
71
- bun add -g envprism
72
- ```
73
-
74
- Or run without installing:
75
-
76
- ```bash
77
- bunx envprism
78
- ```
79
-
80
- Requirements: **Bun 1.3+**.
81
-
82
- ## 🚀 Quick start
83
-
84
- ```bash
85
- bunx envprism # open the TUI in the current directory
86
- bunx envprism tui path/to/repo # TUI scanning another directory
87
- bunx envprism diff path/to/repo # non-interactive drift report
88
- bunx envprism diff --json | jq # structured drift report
89
- bunx envprism diff --check; echo $? # exits 1 if any file drifts from base
90
- ```
91
-
92
- Inside the TUI, press `?` for the full keybinding reference.
101
+ </details>
93
102
 
94
103
  ## ⚙️ Configuration
95
104
 
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:
105
+ envprism runs zero-config. To tune defaults, drop an `envprism.config.{ts,js,mjs,json}` in your project — manage it with `bunx envprism config init | path | show | edit`. The file is resolved by walking **up from the current working directory** (override with `--config <path>` or `ENVPRISM_CONFIG`). For any setting, `flag > config > default`.
108
106
 
109
107
  ```ts
110
108
  // envprism.config.ts
@@ -118,6 +116,9 @@ export default defineEnvprismConfig({
118
116
 
119
117
  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
118
 
119
+ <details>
120
+ <summary>All configuration options</summary>
121
+
121
122
  ### `discovery`
122
123
 
123
124
  | Option | Default | What it does |
@@ -164,6 +165,8 @@ Base resolution order: `--base` flag → `base.name` → `base.priority` (in ord
164
165
 
165
166
  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
 
168
+ </details>
169
+
167
170
  > [!NOTE]
168
171
  > 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
172