A cybernetic organism sent back in time to terminate missing environment variables.
npm install envinator-cli> "Come with me if you want to deploy." โ A developer should be able to run npx envinator in a fresh repo and be operational in seconds.
Envinator is a specialized CLI tool sent back in time to statically analyze your codebase. It identifies all usages of process.env, compares them against your local .env file, and ruthlessly prompts you to populate missing variables.
No more undefined runtime errors. No more asking "What's the API key again?" Now with a custom Envinator theme.
---
You don't even need to install it. Just run it in your project root:
``bash`
npx envinator
Envinator will:
1. Scan your directory for process.env usages using AST analysis..env
2. Identify discrepancies against your current file..env
3. Interrogate you to fill in missing values.
4. Update your (and optionally .env.example).
---
- Cybernetic AST Scanning: Uses ts-morph to parse your code. It won't get fooled by comments or strings like regex would.`
- Destructuring Detection: Detects complex patterns like:
typescript`
const { DB_HOST, DB_PORT: port } = process.env; // Targets acquired.
sk_live_...
- Secure Input: Automatically masks sensitive keys (PASSWORD, KEY, SECRET, TOKEN) during input.
- Target Location: Shows you exactly where a variable is used (file & line number).
- Secret Leak Detection: Scans for hardcoded secrets (e.g., , ghp_...) in your source code and warns you immediately..env
- Unused Variable Detection: Identifies variables in your that are not used in your codebase, keeping your config clean.env.d.ts
- Auto-Generated Types: Can generate a declaration file to strongly type usage of process.env.
- Skynet Ready (CI/CD): Auto-detects non-TTY environments and switches to lint mode.
- Zero Config: Works out of the box for TypeScript and JavaScript projects.
---
`bash`
npx envinator [options]
| Option | Alias | Description | Default |
| --- | --- | --- | --- |
| --dir | -d | The directory to scan for code | ./ |--env
| | -e | Path to your environment file | .env |--types
| | -t | Output path for TypeScript definitions | |--example
| | -x | Update .env.example with new keys | true |--no-example
| | | Skip updating .env.example | |--dry-run
| | | Scan and report without writing to disk | false |--lint
| | | Exit code 1 if variables are missing (CI mode) | false |
Use Envinator to fail your build if a developer forgot to add a new variable:
`yaml`In your GitHub Action
- name: Verify Environment Integrity
run: npx envinator --dir ./src --env .env.example --lint
---
Envinator uses ts-morph to build an Abstract Syntax Tree of your code. It looks for three access patterns:
1. Property Access: process.env.API_URLprocess.env['STRIPE_KEY']
2. Element Access: const { REDIS_URL } = process.env
3. Destructuring:
It ignores dynamic access (e.g., process.env[dynamicVar]) and warns you about them since they cannot be statically determined.
---
If you want to install it globally or as a dev dependency:
`bash`
npm install -D envinator-clior
yarn add -D envinator-clior
pnpm add -D envinator-cli
Add it to your package.json scripts:
`json`
{
"scripts": {
"env:check": "envinator --lint",
"env:setup": "envinator"
}
}
---
`bashInstall dependencies
npm install
---
๐ค Contributing
1. Fork the repository
2. Create your feature branch (
git checkout -b feature/skynet-upgrade`)---
MIT ยฉ 2026
---
> "Hasta la vista, undefined."