0.1.0 • Published 10 months ago

@crabest/envguard v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

EnvGuard šŸ›”ļø

npm version License: MIT

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/envguard

Local 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

CommandDescriptionAuto-SyncExample
envguardValidate .env against .env.exampleāœ…envguard
envguard use <env>Use environment + trackāœ…envguard use production
envguard statusShow active environmentāœ…envguard status
envguard create -e <env>Create new environmentāœ…envguard create -e staging
envguard listList 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 .env file is always your active environment
  • Auto-Sync: Any changes to .env are automatically saved to the active environment
  • Environment Usage: envguard use copies the selected environment to .env
  • Active Tracking: envguard use tracks the current environment in .envguard/.active
  • Status Checking: envguard status shows which environment is currently active
  • Validation: Always validates the active .env against .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/envguard

Platform 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.

šŸ”— Links