Environment Config Manager
Manage, validate, and synchronize environment configuration files across your project and deployment targets.
Workflow
Discover all environment files Search the project for every env-related file:
find . -maxdepth 3 -name ".env*" -not -path "*/node_modules/*" -not -path "*/.git/*"Common files:
.env,.env.local,.env.development,.env.staging,.env.production,.env.exampleParse and catalog all variables For each env file, extract every variable name and note:
- Which file defines it
- Whether it has a non-empty value
- Whether the key looks like a secret (contains KEY, SECRET, TOKEN, PASSWORD, CREDENTIAL, PRIVATE)
- Whether it has a comment/description
Validate required variables Check that the active
.envcontains every variable from the template:Missing in .env (defined in .env.example): - DATABASE_URL - STRIPE_SECRET_KEY Extra in .env (not in .env.example): - DEBUG_MODEDetect variables referenced in code but missing from env files
grep -rn "process\.env\." --include="*.ts" --include="*.tsx" --include="*.js" src/ app/ | grep -oP 'process\.env\.\K[A-Z_][A-Z0-9_]*' | sort -uCompare against env files and report unreferenced variables.
Generate or update .env.example Create a sanitized template from the current
.env:- Strip secret values, replace with descriptive placeholders
- Preserve non-secret defaults (PORT=3000, NODE_ENV=development)
- Group variables by prefix with section comments
Compare environments Produce a comparison matrix:
Variable .env .env.staging .env.production DATABASE_URL ✓ ✓ ✓ STRIPE_SECRET_KEY ✓ ✓ ✗ ← MISSING DEBUG_MODE ✓ ✗ ✗Audit git safety
grep -n "\.env" .gitignore 2>/dev/null git ls-files --cached | grep -i "\.env"Flag tracked .env files with secrets as critical.
Report findings organized by severity:
- Critical: Secrets at risk of git exposure, production env missing required vars
- Warning: Variables referenced in code but not in env files
- Info: Extra variables not referenced in code
Rules
- NEVER print actual values of secret environment variables
- Always treat variables containing KEY, SECRET, TOKEN, PASSWORD, PRIVATE, CREDENTIAL as sensitive
- When generating .env.example, replace secrets with placeholder hints
- Do not modify .env files without explicit user confirmation
- If .env is not in .gitignore, warn immediately
- Preserve comments and grouping when updating .env.example