anho-env-helper
v1.1.3
Published
A CLI tool to manage and visualize environment variables across projects
Maintainers
Readme
anho-env-helper
A powerful CLI tool to manage and visualize environment variables across your projects. Perfect for developers working with multiple .env files in monorepos or complex project structures.
🚀 Features
- 🔍 Smart Discovery: Automatically finds all
.envfiles in your project - 📊 Beautiful Display: Clean, colored output showing all environment variables
- 🔄 Sync Checking: Compares
.envvs.env.examplefiles to find missing variables - 🔧 Auto-Fix Sync Issues: Automatically add missing variables to
.envfiles - 📝 Template Generation: Create
.env.examplefiles from existing.envfiles - 📋 Variable Listing: List all environment variables across all files
- 📦 Secure Export: Export env files to secure archives outside your project
- 🔒 Security Warnings: Identifies potential security issues with sensitive variables
- 🏗️ Context Aware: Understands frontend/backend/mobile project structures
- ⚡ Fast & Lightweight: Built with TypeScript and tested with Jest
📦 Installation
Install globally via npm:
npm install -g anho-env-helperOr use directly with npx:
npx anho-env-helper🎯 Usage
Show Available Commands
Run env-helper without arguments to see all available commands:
env-helperBasic Scan
Scan the current directory and show all environment files:
env-helper scanVerbose Output
Show detailed information including all variables:
env-helper scan --verbose
env-helper scan -vScan Specific Directory
env-helper scan --path /path/to/your/project
env-helper scan -p ./my-projectCheck Sync Status
Find missing variables between .env and .env.example files:
env-helper sync
env-helper sync --path ./backend
env-helper sync --fix # Automatically add missing variablesSecurity Scan
Check for potential security issues:
env-helper security
env-helper security -p ./my-projectCreate Template Files
Generate .env.example files from existing .env files:
env-helper template
env-helper template --overwrite # Replace existing .env.example files
env-helper template -p ./my-projectList Environment Variables
List all environment variables found across all env files:
env-helper list
env-helper list --unique # Show only unique variable names
env-helper list --values # Show variable values (sensitive masked)
env-helper list --unique --values # Combined optionsExport Environment Files
Securely export all env files to an archive outside your project:
env-helper export # Interactive prompt for output path
env-helper export -o ~/Desktop # Export to specific directory
env-helper export --format zip # Export as ZIP instead of tar.gz
env-helper export -p ./my-project -o ~/backups # Export specific projectDisable Colors
env-helper scan --no-colors📋 Example Output
Basic Scan
Environment Variables Analysis
Root:
.env - 8 vars (4 sensitive)
.env.example - 8 vars (4 sensitive)
Security Warnings:
.env:
[HIGH] DATABASE_PASSWORD: Sensitive variable contains a value and file is not in .gitignore - this could be committed to version control
[HIGH] JWT_SECRET: Sensitive variable contains a value and file is not in .gitignore - this could be committed to version control
[HIGH] API_KEY: Sensitive variable contains a value and file is not in .gitignore - this could be committed to version control
Summary:
2 files, 16 variables
3 issue(s) foundVerbose Mode
Environment Variables Analysis
Root:
.env - 8 vars (4 sensitive)
NODE_ENV=production
PORT=3000
[SENSITIVE] DATABASE_PASSWORD=••••••••
DATABASE_HOST=localhost
[SENSITIVE] JWT_SECRET=••••••••
[SENSITIVE] API_KEY=••••••••
REDIS_URL=redis://localhost:6379
[SENSITIVE] STRIPE_SECRET=••••••••
.env.example - 8 vars (4 sensitive)
NODE_ENV=development
PORT=3000
DATABASE_HOST=your_host_here
REDIS_URL=your_url_here
[SENSITIVE] DATABASE_PASSWORD=••••••••
[SENSITIVE] JWT_SECRET=••••••••
[SENSITIVE] API_KEY=••••••••
[SENSITIVE] STRIPE_SECRET=••••••••Sync Check
Sync Issues:
Missing Variables:
API_KEY (required by .env.example, missing from: .env)
DATABASE_URL (required by .env.example, missing from: .env)
Extra Variables:
OLD_CONFIG (in .env, not in .env.example)Sync Fix
Sync Fix: Adding missing variables...
✅ Added 2 variables to .env
🎉 Successfully added 2 missing variables!
Remember to fill in the actual values for these variables.Template Creation
Creating .env.example template files...
✅ Created .env.example
✅ Created client/.env.example
✅ Created server/.env.example
🎉 Successfully created 3 template file(s)!Generated Template File
# Environment Variables Template
# Generated from .env
# Fill in the actual values for your environment
# Configuration Variables
NODE_ENV=development
PORT=3000
DISCORD_CHANNEL_ID=your_id_here
REDDIT_USERNAME=your_username_here
# Sensitive Variables (keep these secret!)
API_KEY=your_key_here
DATABASE_PASSWORD=your_password_here
JWT_SECRET=your_secret_here
REDIS_URL=your_url_hereList Variables (Unique)
Environment Variables List
Found 8 unique environment variables:
Configuration Variables:
DATABASE_HOST (in 2 files)
NODE_ENV (in 2 files)
PORT (in 2 files)
REDIS_URL (in 2 files)
Sensitive Variables:
API_KEY (in 2 files)
DATABASE_PASSWORD (in 2 files)
JWT_SECRET (in 2 files)
STRIPE_SECRET (in 2 files)Export Files
🔒 For security, env files should be exported outside your project directory.
Export directory [/Users/user/Desktop]:
Exporting environment files...
✅ Exported 2 environment files
📦 Archive created: /Users/user/Desktop/my-project-env-files-2025-09-29T10-04-30.tar.gz
📏 Archive size: 2.1 KB
Files exported:
.env (4 sensitive)
.env.example (4 sensitive)
🔒 Keep this archive secure - it contains sensitive environment data!🏗️ Supported File Types
The tool automatically detects these environment file patterns:
.env- Main environment file.env.local- Local overrides.env.development- Development environment.env.production- Production environment.env.example- Template file.env.template- Template file.environment.*- Alternative naming
🎯 Context Detection
Automatically detects project contexts based on directory structure:
- Frontend:
client/,frontend/,web/,app/,ui/ - Backend:
server/,backend/,api/,service/ - Mobile:
mobile/,android/,ios/,react-native/ - Shared:
shared/,common/,lib/,packages/
🔒 Security Features
- Identifies sensitive variables (passwords, keys, tokens, secrets)
- Masks sensitive values in output
- Warns about potential security issues
- Detects secrets in unexpected places
🧪 Development
Built with Test-Driven Development (TDD) using:
- TypeScript for type safety
- Jest for comprehensive testing
- Commander.js for CLI interface
- Chalk for beautiful terminal output
Running Tests
npm test
npm run test:watch
npm run test:coverageBuilding
npm run build📜 License
MIT License - see LICENSE file for details.
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
🐛 Issues
Found a bug or have a feature request? Please create an issue on GitHub.
Made with ❤️ by Andreas Hoj
