Interactive CLI tool for managing local environment variables across your projects.
- 🔍 Discoverability: Automatically discover environment files across your projects
- 📁 Project-aware: Works with git repositories to logically group environments
- 🌱 Multi-environment: Supports various .env file patterns (.env, .env.development, .env.production, etc.)
- 🎯 Interactive: Beautiful CLI interface with project selection
- 🔒 Secure: Masks sensitive values by default
You can always run henv help for a comprehensive overview:
Usage: henv <command> [options]
Commands:
list [options] List environment variables for the current project or discover projects
search <term> [options] Search for environment variables by name across projects
help Show this help message
Options for "list":
-d, --dir <directory> Target directory to scan (defaults to current directory)
-s, --depth <number> Maximum depth to search for environment files (default: 7)
-m, --mask-env-variables Mask environment variable values
Options for "search":
-d, --dir <directory> Target directory to scan (defaults to current directory)
-s, --depth <number> Maximum depth to search for environment files (default: 7)
-p, --pattern Use regex pattern matching instead of text search
-c, --case-sensitive Make search case sensitive
-m, --mask-env-variables Mask environment variable values
Examples:
henv list
henv list --dir ./apps --depth 5
henv search API_KEY
henv search "^LOG_" --pattern
henv search api --case-sensitive
henv search SECRET --mask-env-variables
henv search PORT --depth 3
henv search DATABASE --dir /path/to/projects
npm install
npm run build# Start development mode - creates temporary 'henv-dev' executable
npm run dev
# In another terminal, use the global executable anywhere:
henv-dev list
henv-dev search API_KEY
henv-dev list --dir /path/to/projects
# Press Ctrl+C in the dev terminal to exit and cleanup# Build and install global 'henv' executable
npm run build
# Use the global executable anywhere:
henv list
henv search DATABASE_URL
henv list --dir /path/to/projects
# Uninstall when done
npm run uninstall-binnpm run start list
npm run start list --dir /path/to/projects-
Single Git Project: If you run
henv listfrom within a git repository, it will show all environment files for that project. -
Multiple Projects: If you run it from a directory containing multiple git projects, it will:
- Discover all git projects with environment files
- Show a summary list
- Allow you to select a project for detailed view
.env(default environment).env.development.env.test.env.production.env.prod.env.staging.env.local- And any other
.env.*pattern
Create some test environment files:
# Default environment
echo "DATABASE_URL=localhost:5432
API_KEY=secret123
DEBUG=true" > .env
# Development environment
echo "DATABASE_URL=dev.localhost:5432
API_KEY=dev_key_456
DEBUG=true
LOG_LEVEL=debug" > .env.development
# Production environment
echo "DATABASE_URL=prod.database.com:5432
API_KEY=prod_key_789
DEBUG=false
LOG_LEVEL=error" > .env.productionThen explore your environment variables:
# List all environment files and variables
npm run dev list
# Search for specific variables
npm run dev search API_KEY
npm run dev search DATABASE --pattern
npm run dev search "^LOG_" --pattern
# Search with options
npm run dev search api --case-sensitive
npm run dev search "URL$" --pattern --mask-env-variablesnpm run dev- Start development mode with temporary global executable and live code changesnpm run build- Build TypeScript and install production executable to system binnpm run start- Run the built version locally (traditional way)
henv list- List all environment variables in current contexthenv search <term>- Search for environment variables by name--pattern- Use regex pattern matching--case-sensitive- Case sensitive search--depth <n>- Search depth (default: 7)--mask-env-variables- Mask variable values
npm run dev-bin- Internal: Start development bin managernpm run install-bin- Install built executable to system binnpm run uninstall-bin- Remove executables from system bin
# Install dependencies
npm install
# Development workflow (recommended)
npm run dev # Creates henv-dev executable with live reloading
# Production workflow
npm run build # Creates henv executable
# Traditional local development
npm run start list