lacspace-dotenv

Lint, diff, sync and type your .env files — and catch committed secrets.

● Live · v0.2.0npmSource
terminal
npx lacspace-dotenv lint .env
What it does

Everything, 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.

Features

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.

How to use

Copy, paste, done

Real commands and snippets — from a one-liner to the typed library.

Run a command with env loaded
terminal
npx lacspace-dotenv run -e .env -e .env.local -- npm start

Layers both files, then spawns `npm start` with them in the environment.

Encrypt a .env for commit
terminal
npx lacspace-dotenv encrypt .env --key "$DOTENV_KEY"

AES-256-GCM; decrypt with the same key at deploy time.

Compare across environments
terminal
npx lacspace-dotenv matrix .env.development .env.staging .env.production

A side-by-side matrix that flags missing or drifted keys.

Resolve ${VAR} references
terminal
npx lacspace-dotenv lint --expand .env

Interpolates references and flags undefined or circular ones.

Good for

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

Start now

Run lacspace-dotenv today

Free, open-source, no API keys. It's a CLI and a typed library.

terminal
npx lacspace-dotenv lint .env