@crabest/envguard
v0.1.1
Published
π‘οΈ Validate .env files and manage multiple environments with auto-sync
Downloads
9
Maintainers
Readme
EnvGuard π‘οΈ
A powerful CLI tool that validates .env files against .env.example files and manages multiple environment configurations with ease.
β¨ Features
β
Environment Validation: Compare .env files against .env.example templates
π Multi-Environment Management: Manage multiple environments using .envguard/ directory
π Auto-Sync: Automatically saves .env changes to the active environment
π― Easy Switching: Quickly switch between development, staging, production, etc.
π Fast & Reliable: Built with Go for speed and reliability
π Detailed Reports: Clear summaries showing missing, extra, and valid variables
π¦ Installation
Global Installation (Recommended)
npm install -g @crabest/envguardLocal Installation
npm install @crabest/envguardπ Quick Start
# 1. Create your first environment
envguard create -e development --from-current
# 2. Create additional environments
envguard create -e staging
envguard create -e production --from-current
# 3. List all environments
envguard list
# 4. Use environments - edit .env normally!
envguard use production
# Edit .env in your editor...
envguard use development # Previous changes auto-saved!
# 5. Check current environment status
envguard status
# 6. Validate current environment
envguard
# 7. Clean up unused environments
envguard delete -e old-stagingπ Available Commands
| Command | Description | Auto-Sync | Example |
|---------|-------------|-----------|---------|
| envguard | Validate .env against .env.example | β
| envguard |
| envguard use <env> | Use environment + track | β
| envguard use production |
| envguard status | Show active environment | β
| envguard status |
| envguard create -e <env> | Create new environment | β
| envguard create -e staging |
| envguard list | List all environments | β
| envguard list |
| envguard delete -e <env> | Delete environment | β | envguard delete -e old-env |
π― Example Output
π EnvGuard - Environment File Validator
π Validation Results:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π Comparing: .env β .env.example
β
Variables found in both files (8):
β DATABASE_URL
β API_KEY
β PORT
β JWT_SECRET
β οΈ Missing variables in .env (2):
β’ EMAIL_SERVICE_KEY
β’ WEBHOOK_SECRET
π Summary:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π β
8 variables OK β’ β οΈ 2 missingπ Platform Support
EnvGuard supports the following platforms:
- macOS (Intel & Apple Silicon)
- Linux (x64)
- Windows (x64)
π How It Works
.envguard/Directory: All environment files are stored in this hidden directory- Active Environment: The root
.envfile is always your active environment - Auto-Sync: Any changes to
.envare automatically saved to the active environment - Environment Usage:
envguard usecopies the selected environment to.env - Active Tracking:
envguard usetracks the current environment in.envguard/.active - Status Checking:
envguard statusshows which environment is currently active - Validation: Always validates the active
.envagainst.env.example - Isolation: Each environment is completely isolated and independent
π οΈ Development Workflow
# Set up your project environments
envguard create -e development --from-current
envguard create -e staging
envguard create -e production --from-current
# Work with different environments - edit .env normally!
envguard use development # Switch to development
# Edit .env in your favorite editor...
envguard status # Auto-saves changes, shows current environment
envguard # Auto-saves changes, validates environment
envguard use production # Auto-saves dev changes, switches to production
envguard status # Confirm you're in production
envguard # Validate before deploymentπ Troubleshooting
Permission Issues (macOS/Linux)
# If you get permission errors, run:
chmod +x $(which envguard)Reinstallation
# If something goes wrong, try:
npm uninstall -g @crabest/envguard
npm install -g @crabest/envguardPlatform Not Supported
If you get an "Unsupported platform" error, EnvGuard currently supports:
- macOS (darwin)
- Linux
- Windows (win32)
π License
MIT License - see LICENSE file for details.
π€ Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
