@long260398/envguard
v0.1.0
Published
CLI tool to validate, diff, and sync .env files against .env.example
Maintainers
Readme
envguard
Never deploy with a broken
.envagain — validate, diff, and sync environment files in one command.
Demo
$ envguard check
✗ Missing keys (2):
- DATABASE_URL
- REDIS_URL
⚠ Empty values (1):
~ APP_KEY
3 issues found
$ envguard sync
Added 2 keys to .env:
+ DATABASE_URL=
+ REDIS_URL=
$ envguard check
✓ .env is validFeatures
- Catch broken deploys early — spot missing keys before they cause production errors
- Visual diff — see exactly what's different between
.envand.env.exampleat a glance - One-command sync — copy missing keys from
.env.exampleto.envautomatically - Safe by default —
--dry-runpreviews all changes before writing anything - Custom paths — works with any naming convention (
--env,--exampleflags) - Zero config — drop it into any project, no setup required
Getting Started
Prerequisites
- Node.js 18+
Install globally
npm install -g @long260398/envguardOr run without installing
npx @long260398/envguard checkUsage
# Check for missing or empty keys
envguard check
# Show a visual diff
envguard diff
# Add missing keys from .env.example to .env
envguard sync
# Preview sync without writing
envguard sync --dry-run
# Use custom file paths
envguard check --env .env.staging --example .env.example
envguard diff --env .env.staging --example .env.staging.exampleIn CI pipelines
# GitHub Actions — fail the build if .env is out of sync
- run: npx @long260398/envguard checkIn package.json scripts
{
"scripts": {
"env:check": "envguard check",
"env:sync": "envguard sync --dry-run",
"predev": "envguard check"
}
}Stack
| | | |---|---| | Language | TypeScript 5 | | Runtime | Node.js 18+ | | CLI framework | Commander | | Output | Chalk |
Contributing
Pull requests are welcome. For major changes, open an issue first to discuss what you'd like to change.
License
Support
If envguard saves you from a broken deploy, consider sponsoring on GitHub.
