{"_id":"@akshitkrnagpal/env-doctor","_rev":"3-6677a7f9790c2d937506a6fa4ffc54ab","name":"@akshitkrnagpal/env-doctor","dist-tags":{"latest":"0.2.1"},"versions":{"0.1.0":{"name":"@akshitkrnagpal/env-doctor","version":"0.1.0","keywords":["env","dotenv","audit","cli","secrets","lint","fix","config"],"author":{"name":"akshitkrnagpal"},"license":"MIT","_id":"@akshitkrnagpal/env-doctor@0.1.0","maintainers":[{"name":"akshitkrnagpal","email":"nagpalkrakshit@gmail.com"}],"homepage":"https://github.com/akshitkrnagpal/env-doctor#readme","bugs":{"url":"https://github.com/akshitkrnagpal/env-doctor/issues"},"bin":{"env-doctor":"bin/env-doctor-node.js"},"dist":{"shasum":"4c64a16b9af0297b9d2cdda80c6f99ead8ead539","tarball":"https://registry.npmjs.org/@akshitkrnagpal/env-doctor/-/env-doctor-0.1.0.tgz","fileCount":41,"integrity":"sha512-hFoxKD68BpAT+fIIc6Q/XsUMtwny9KMhgKVie4j3cAzwhRsy3T6vq51Tqb3jkdyt/GXL2luMaenDX6n6rn+s5A==","signatures":[{"sig":"MEQCIB+pUzkGzKl/ORHrWwmGdDnySlbUyzCb22noNC7CfwUUAiAZsyNfppEqjWbADX7laAZHUbyEROHL5rHE0NmzLOHLFQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":237774},"main":"./dist/index.mjs","type":"module","types":"./src/index.ts","exports":{".":{"bun":"./src/index.ts","types":"./src/index.ts","import":"./dist/index.mjs"}},"gitHead":"5e49c0c16955fba121635162bd46b4c4fff632b5","scripts":{"dev":"bun run src/cli/index.ts","test":"bun test","build":"bun build src/cli/index.ts --compile --outfile bin/env-doctor","start":"bun run src/cli/index.ts","build:npm":"bun build src/cli/index.ts --outfile dist/cli.mjs --target node --minify && bun build src/index.ts --outfile dist/index.mjs --target node --minify","typecheck":"bun x tsc --noEmit --skipLibCheck","prepublishOnly":"bun run build:npm"},"_npmUser":{"name":"akshitkrnagpal","email":"nagpalkrakshit@gmail.com"},"repository":{"url":"git+https://github.com/akshitkrnagpal/env-doctor.git","type":"git"},"_npmVersion":"11.9.0","description":"A .env file auditor for developers — detect unused vars, missing vars, hardcoded secrets, env drift, and more","directories":{},"_nodeVersion":"24.14.0","dependencies":{"ora":"^8.0.1","chalk":"^5.3.0","commander":"^12.1.0"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.5.3","@types/node":"^20.14.10"},"_npmOperationalInternal":{"tmp":"tmp/env-doctor_0.1.0_1775108517089_0.37477602580753033","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@akshitkrnagpal/env-doctor","version":"0.2.0","keywords":["env","dotenv","audit","cli","secrets","lint","fix","config"],"author":{"name":"akshitkrnagpal"},"license":"MIT","_id":"@akshitkrnagpal/env-doctor@0.2.0","maintainers":[{"name":"akshitkrnagpal","email":"nagpalkrakshit@gmail.com"}],"homepage":"https://github.com/akshitkrnagpal/env-doctor#readme","bugs":{"url":"https://github.com/akshitkrnagpal/env-doctor/issues"},"bin":{"env-doctor":"bin/env-doctor-node.js"},"dist":{"shasum":"e0f9076700780ec5af3f686aa5b8e2d9923502f3","tarball":"https://registry.npmjs.org/@akshitkrnagpal/env-doctor/-/env-doctor-0.2.0.tgz","fileCount":51,"integrity":"sha512-aJBtX0tT/1XDb9EV2k/36Cmzkk1fTSWTDYhLNlhs3n6u9NODJ1yv9h9V6jMc3h9C/5g1bHwYJT18MwYk1Lgv1Q==","signatures":[{"sig":"MEQCIGSQQeV8YuM8gP85kCBEqhKvDvhnb93ENbi0575HWta/AiBi6dlVtm6RKwAY6UE6/q1J30XbQK6tbcQCYzgBhfd4uA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@akshitkrnagpal%2fenv-doctor@0.2.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":304186},"main":"./dist/index.mjs","type":"module","types":"./src/index.ts","exports":{".":{"bun":"./src/index.ts","types":"./src/index.ts","import":"./dist/index.mjs"}},"gitHead":"58bbff5bb865e1f8b53da22d5319a4853c75813b","scripts":{"dev":"bun run src/cli/index.ts","test":"bun test","build":"bun build src/cli/index.ts --compile --outfile bin/env-doctor","start":"bun run src/cli/index.ts","build:npm":"bun build src/cli/index.ts --outfile dist/cli.mjs --target node --minify && bun build src/index.ts --outfile dist/index.mjs --target node --minify","typecheck":"bun x tsc --noEmit --skipLibCheck","prepublishOnly":"bun run build:npm"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:75ab3574-cbb3-4576-a0ec-449c6d2c61da"}},"repository":{"url":"git+https://github.com/akshitkrnagpal/env-doctor.git","type":"git"},"_npmVersion":"11.9.0","description":"A .env file auditor for developers — detect unused vars, missing vars, hardcoded secrets, env drift, and more","directories":{},"_nodeVersion":"24.14.0","dependencies":{"ora":"^8.0.1","chalk":"^5.3.0","commander":"^12.1.0"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.5.3","@types/node":"^20.14.10"},"_npmOperationalInternal":{"tmp":"tmp/env-doctor_0.2.0_1775109677865_0.27802373496132393","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@akshitkrnagpal/env-doctor","version":"0.2.1","description":"A .env file auditor for developers — detect unused vars, missing vars, hardcoded secrets, env drift, and more","type":"module","main":"./dist/index.mjs","types":"./src/index.ts","exports":{".":{"import":"./dist/index.mjs","bun":"./src/index.ts","types":"./src/index.ts"}},"bin":{"env-doctor":"bin/env-doctor-node.js"},"scripts":{"build":"bun build src/cli/index.ts --compile --outfile bin/env-doctor","build:npm":"bun build src/cli/index.ts --outfile dist/cli.mjs --target node --minify && bun build src/index.ts --outfile dist/index.mjs --target node --minify","dev":"bun run src/cli/index.ts","start":"bun run src/cli/index.ts","prepublishOnly":"bun run build:npm","typecheck":"bun x tsc --noEmit --skipLibCheck","test":"bun test"},"keywords":["env","dotenv","audit","cli","secrets","lint","fix","config"],"author":{"name":"akshitkrnagpal"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/akshitkrnagpal/env-doctor.git"},"homepage":"https://github.com/akshitkrnagpal/env-doctor#readme","dependencies":{"chalk":"^5.3.0","commander":"^12.1.0","ora":"^8.0.1"},"devDependencies":{"@types/node":"^20.14.10","typescript":"^5.5.3"},"gitHead":"f503f34dc0a0e86680cc8a3fdc877f39f8057da7","_id":"@akshitkrnagpal/env-doctor@0.2.1","bugs":{"url":"https://github.com/akshitkrnagpal/env-doctor/issues"},"_nodeVersion":"24.14.1","_npmVersion":"11.11.0","dist":{"integrity":"sha512-A88zwKEgzxzKYtSvDDqC9XO0qam8hi5TEZZ6ST6Jxnp/y1blHosKyMCjOHQv2yuj/F4MvKDhuMQQ/uGlATvneA==","shasum":"658ee37372b05afb304c92bfff40620686f49733","tarball":"https://registry.npmjs.org/@akshitkrnagpal/env-doctor/-/env-doctor-0.2.1.tgz","fileCount":52,"unpackedSize":310858,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@akshitkrnagpal%2fenv-doctor@0.2.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIE6OKJ61MPznqpp1n2F/OookSaBElsIFNddU13ifknKmAiA69advAp+tzV5XxKMfKr8m2kMV+FjWNQjb/AVu7SOLxA=="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:75ab3574-cbb3-4576-a0ec-449c6d2c61da"}},"directories":{},"maintainers":[{"name":"akshitkrnagpal","email":"nagpalkrakshit@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/env-doctor_0.2.1_1775137135779_0.06842589092554574"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-02T05:41:56.958Z","modified":"2026-04-02T13:38:56.238Z","0.1.0":"2026-04-02T05:41:57.231Z","0.2.0":"2026-04-02T06:01:18.039Z","0.2.1":"2026-04-02T13:38:55.982Z"},"bugs":{"url":"https://github.com/akshitkrnagpal/env-doctor/issues"},"author":{"name":"akshitkrnagpal"},"license":"MIT","homepage":"https://github.com/akshitkrnagpal/env-doctor#readme","keywords":["env","dotenv","audit","cli","secrets","lint","fix","config"],"repository":{"type":"git","url":"git+https://github.com/akshitkrnagpal/env-doctor.git"},"description":"A .env file auditor for developers — detect unused vars, missing vars, hardcoded secrets, env drift, and more","maintainers":[{"name":"akshitkrnagpal","email":"nagpalkrakshit@gmail.com"}],"readme":"# env-doctor\n\n[![CI](https://github.com/akshitkrnagpal/env-doctor/actions/workflows/ci.yml/badge.svg)](https://github.com/akshitkrnagpal/env-doctor/actions/workflows/ci.yml)\n[![npm version](https://img.shields.io/npm/v/@akshitkrnagpal/env-doctor.svg)](https://www.npmjs.com/package/@akshitkrnagpal/env-doctor)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nA `.env` file auditor for developers. Detect unused variables, missing variables, hardcoded secrets, environment drift, and more across your entire codebase or monorepo.\n\n## Features\n\n- **Unused detection** -- Find variables defined in `.env` but never referenced in code\n- **Missing detection** -- Find variables referenced in code but missing from `.env`\n- **Secret scanning** -- Detect hardcoded API keys, tokens, passwords, and connection strings\n- **Env drift** -- Compare `.env.development` vs `.env.production` and find inconsistencies\n- **Format validation** -- Catch duplicate keys, empty values, syntax errors\n- **Example sync** -- Ensure `.env` has all variables from `.env.example`\n- **Init** -- Generate `.env.example` from an existing `.env` (values stripped)\n- **Auto-fix** -- Remove duplicates, sort keys, add missing vars from `.env.example`\n- **Git safety** -- Check if `.env` is gitignored, tracked, or leaked in git history\n- **Env diff** -- Detailed colored diff between two `.env` files showing added, removed, and changed values\n- **Audit report** -- Generate a markdown report with pass/fail summaries across all checks\n- **Config file** -- Load settings from `.envdoctorrc.json` or `package.json`\n- **Shell completions** -- Bash, Zsh, and Fish completion scripts\n\n## Multi-language support\n\nenv-doctor scans for environment variable usage across multiple languages:\n\n- **JavaScript/TypeScript** -- `process.env.VAR`, `process.env['VAR']`, `process.env[\"VAR\"]`\n- **Python** -- `os.environ['VAR']`, `os.environ.get('VAR')`, `os.getenv('VAR')`\n- **Ruby** -- `ENV['VAR']`, `ENV.fetch('VAR')`\n- **Go** -- `os.Getenv(\"VAR\")`\n- **Rust** -- `env::var(\"VAR\")`, `std::env::var(\"VAR\")`\n- **PHP** -- `getenv('VAR')`, `$_ENV['VAR']`, `$_SERVER['VAR']`\n- **Java/Kotlin** -- `System.getenv(\"VAR\")`\n- **.env files** -- `${VAR}` references\n\n## Installation\n\n```bash\n# Using npm\nnpm install -g @akshitkrnagpal/env-doctor\n\n# Run without installing\nnpx @akshitkrnagpal/env-doctor\n\n# Using bun\nbunx @akshitkrnagpal/env-doctor\n```\n\n## Usage\n\n### Commands\n\n```bash\n# Run all audits (default command)\nenv-doctor\n\n# Individual commands\nenv-doctor unused          # Find unused env vars\nenv-doctor missing         # Find missing env vars\nenv-doctor drift           # Compare env files across environments\nenv-doctor secrets         # Scan for hardcoded secrets\nenv-doctor validate        # Validate .env file format\nenv-doctor sync            # Check .env against .env.example\nenv-doctor init            # Create .env.example from .env\nenv-doctor fix             # Auto-fix common issues\nenv-doctor git-check       # Check git safety for .env files\nenv-doctor diff <a> <b>    # Detailed diff between two .env files\nenv-doctor report          # Generate markdown audit report\nenv-doctor completion      # Generate shell completions\n```\n\n### Global flags\n\n```\n-v, --verbose              Verbose output with extra details\n-q, --quiet                Suppress non-essential output\n    --no-color             Disable color output\n    --json                 Output as JSON (for CI integration)\n-d, --dir <path>           Target directory (default: cwd)\n-e, --env-file <path>      Specific .env file (default: .env)\n    --ignore <patterns...> Directories/files to ignore\n```\n\n### Fix command\n\nAuto-fix common `.env` file issues:\n\n```bash\n# Preview fixes without writing\nenv-doctor fix --dry-run\n\n# Apply all fixes (remove duplicates, sort, add missing)\nenv-doctor fix\n\n# Selective fixes\nenv-doctor fix --no-sort                 # Skip sorting\nenv-doctor fix --no-remove-duplicates    # Keep duplicates\nenv-doctor fix --no-add-missing          # Don't add from .env.example\n```\n\nThe fix command:\n- **Removes duplicate keys** -- keeps the last occurrence\n- **Sorts keys alphabetically** -- for consistent ordering\n- **Adds missing variables** -- from `.env.example` with placeholder values\n\n### Git check command\n\nCheck git safety for `.env` files:\n\n```bash\n# Run standalone\nenv-doctor git-check\n\n# Also included in the default check command\nenv-doctor check\n```\n\nThe git-check command:\n- **Checks `.gitignore`** -- warns if `.env` is not listed in `.gitignore`\n- **Checks tracked files** -- warns if any `.env` files are tracked by git\n- **Checks `.env.example`** -- suggests adding `.env.example` to git if missing\n- **Scans git history** -- detects accidentally committed `.env` files\n\n### Diff command\n\nShow a detailed diff between two `.env` files:\n\n```bash\n# Compare two env files\nenv-doctor diff .env.development .env.production\n\n# Show unchanged keys too\nenv-doctor diff .env.local .env.staging --verbose\n\n# JSON output\nenv-doctor diff .env .env.example --json\n```\n\nThe diff shows:\n- **Added keys** in green\n- **Removed keys** in red\n- **Changed values** in yellow with old and new values\n- **Unchanged keys** in gray (only with `--verbose`)\n\n### Report command\n\nGenerate a markdown audit report:\n\n```bash\n# Print report to stdout\nenv-doctor report\n\n# Write report to a file\nenv-doctor report --output audit-report.md\n\n# JSON output\nenv-doctor report --json\n```\n\nThe report includes:\n- Summary with pass/fail/skip counts\n- Sections for format validation, unused/missing variables, secrets, drift, sync, and git safety\n- Timestamp and project path\n\n### Shell completions\n\n```bash\n# Bash (add to ~/.bashrc)\neval \"$(env-doctor completion bash)\"\n\n# Zsh (add to ~/.zshrc)\neval \"$(env-doctor completion zsh)\"\n\n# Fish (save to completions dir)\nenv-doctor completion fish > ~/.config/fish/completions/env-doctor.fish\n```\n\n## Configuration\n\nenv-doctor loads settings from `.envdoctorrc.json` or the `\"env-doctor\"` key in `package.json`. CLI flags always take precedence over config file values.\n\n### `.envdoctorrc.json`\n\n```json\n{\n  \"ignore\": [\"vendor\", \"tmp\", \"generated\"],\n  \"envFile\": \".env.local\",\n  \"secretPatterns\": [\n    {\n      \"name\": \"Custom Internal Token\",\n      \"regex\": \"INTERNAL_[A-Z0-9]{32}\",\n      \"severity\": \"high\"\n    }\n  ]\n}\n```\n\n### `package.json`\n\n```json\n{\n  \"env-doctor\": {\n    \"ignore\": [\"vendor\"],\n    \"envFile\": \".env.local\"\n  }\n}\n```\n\n### Config options\n\n| Option           | Type     | Description                                    |\n| ---------------- | -------- | ---------------------------------------------- |\n| `ignore`         | string[] | Glob patterns to ignore when scanning          |\n| `envFile`        | string   | Path to the `.env` file (relative to root)     |\n| `secretPatterns` | array    | Additional secret patterns with name, regex, severity |\n\n## Examples\n\n```bash\n# Scan a specific project directory\nenv-doctor -d ./my-project\n\n# Use a specific env file\nenv-doctor -e .env.local\n\n# JSON output for CI pipelines\nenv-doctor --json\n\n# Ignore certain directories\nenv-doctor --ignore vendor tmp\n\n# Compare specific env files\nenv-doctor drift .env.staging .env.production\n\n# Generate .env.example\nenv-doctor init -o .env.example\n\n# Verbose output for debugging\nenv-doctor missing -v\n\n# Fix issues in dry-run mode\nenv-doctor fix --dry-run\n```\n\n## CI Integration\n\nenv-doctor exits with code 0 when no issues are found and code 1 when issues are detected, making it suitable for CI pipelines.\n\n### GitHub Actions\n\n```yaml\nname: Env Audit\non: [push, pull_request]\njobs:\n  audit:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      - uses: oven-sh/setup-bun@v2\n      - run: bunx @akshitkrnagpal/env-doctor --json\n```\n\n## Development\n\n```bash\n# Install dependencies\nbun install\n\n# Run in dev mode\nbun dev\n\n# Run tests\nbun test\n\n# Type check\nbun run typecheck\n\n# Build for npm\nbun run build:npm\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}