lacspace-dotenv
Lint, diff, sync and type your .env files — and catch committed secrets.
npx lacspace-dotenv lint .envEverything, in one command
lacspace-dotenv is a dev CLI for your .env files. Its robust zero-dependency parser handles quotes, export, comments and multiline values, then powers a full toolkit: lint (catch mistakes and masked secrets, now with six more detectors and an --allow list), diff/sync and matrix (align .env with .env.example, or compare values across development/staging/production), ${VAR} interpolation with undefined/circular detection (--expand), run -- cmd to load env then spawn a process, encrypt/decrypt (AES-256-GCM, commit-safe), JSON/YAML export/import, init/redact generation and a pre-commit hook installer. Secret detection is heuristic — it flags patterns and always masks the value.
What's inside
Robust parser
Quotes, export, comments, empty values, = in values, multiline — zero deps.
Lint
Duplicate keys, spacing around =, non-UPPER_SNAKE names, empty values, trailing whitespace.
Secret scanner
Flags AWS, JWT, Slack, GitHub and PEM keys committed to a .env — always masked.
Diff & sync
.env vs .env.example both ways; --write appends missing keys as placeholders only.
Typed accessor
Generate an interface Env + a fail-fast reader from your keys.
CI gate
check fails the build when process.env is missing an example key.
Interpolation
Resolve ${VAR} references with undefined/circular detection — --expand shows the final values.
run -- cmd
Load one or more env files, then spawn your command with them in the environment.
Encrypt for commits
AES-256-GCM encrypt/decrypt with a key — commit an encrypted .env safely.
Env matrix
Compare development / staging / production side by side to catch missing or drifted keys.
Copy, paste, done
Real commands and snippets — from a one-liner to the typed library.
npx lacspace-dotenv run -e .env -e .env.local -- npm startLayers both files, then spawns `npm start` with them in the environment.
npx lacspace-dotenv encrypt .env --key "$DOTENV_KEY"AES-256-GCM; decrypt with the same key at deploy time.
npx lacspace-dotenv matrix .env.development .env.staging .env.productionA side-by-side matrix that flags missing or drifted keys.
npx lacspace-dotenv lint --expand .envInterpolates references and flags undefined or circular ones.
What people build with it
✓ Catch a secret before it's committed
✓ Keep .env.example in sync on a team
✓ Type-safe environment access
✓ Gate deploys on required env in CI
Run lacspace-dotenv today
Free, open-source, no API keys. It's a CLI and a typed library.
npx lacspace-dotenv lint .env