envcheck doctor

Comprehensive health check for your project's environment configuration.

Usage

envcheck doctor [OPTIONS]

Options

OptionDescription
-d, --dir <DIR>Project directory (default: current)
-f, --format <FORMAT>Output format: text, json, html
--allInclude all checks (including slow ones)
--no-k8sSkip Kubernetes checks
--no-terraformSkip Terraform checks (Phase 2)
--no-ansibleSkip Ansible checks (Phase 2)

What It Checks

The doctor command runs a comprehensive suite of checks:

1. .env Files

✓ Found .env.example
✓ Found .env.local
✓ Found .env.prod
✓ Linted 3 files (0 errors, 2 warnings)

2. Key Consistency

Comparing .env.example ↔ .env.local
  Missing in .env.local: API_KEY (W004)

Comparing .env.example ↔ .env.prod
  Missing in .env.prod: DEBUG_MODE (W004)
  Extra in .env.prod: PRODUCTION_SECRET (I001)

3. Kubernetes Sync

Checking k8s/**/*.yaml
  W005: Key in K8s but missing in .env: DATABASE_URL
  W006: Key in .env but unused in K8s: LOCAL_ONLY

4. Terraform (Phase 2)

Checking terraform/**/*.tf
  W007: var.database_url not in .env
  W008: TF_VAR_api_key not in .env

5. Ansible (Phase 2)

Checking ansible/**/*.yml
  W009: lookup('env', 'APP_SECRET') not in .env

6. GitOps (Phase 2.5)

Checking argocd/**/*.yaml
  W010: ArgoCD plugin env not in .env

Examples

Run in current directory

envcheck doctor

Run in specific directory

envcheck doctor --dir /path/to/project

HTML report

envcheck doctor --format=html > report.html

Skip Kubernetes checks

envcheck doctor --no-k8s

All checks (including slow ones)

envcheck doctor --all

Exit Codes

CodeMeaning
0All checks passed
1Errors found
2Warnings found
3Some checks skipped

Output Formats

Text (default)

=== envcheck doctor ===

[1/5] .env files
  ✓ .env.example exists
  ✓ .env.local exists
  ✓ .env.prod exists

[2/5] Linting
  ✓ 3 files linted (1 warning)

[3/5] Key consistency
  ⚠ .env.local missing: API_KEY

[4/5] Kubernetes sync
  ⚠ K8s uses: DATABASE_URL (not in .env)

[5/5] Terraform
  ⊘ Skipped (--no-terraform)

Summary: 1 warning found

JSON

{
  "summary": {"errors": 0, "warnings": 2, "skipped": 1},
  "checks": [...]
}

HTML

Generates a standalone HTML report with:

  • Summary dashboard
  • Expandable sections
  • Copy-pasteable fix suggestions

CI/CD Usage

GitHub Actions

- name: Run envcheck doctor
  run: envcheck doctor --format=github

- name: Upload HTML report
  uses: actions/upload-artifact@v4
  with:
    name: envcheck-report
    path: report.html
  if: always()

Pre-commit

repos:
  - repo: https://github.com/envcheck/envcheck
    rev: v0.1.0
    hooks:
      - id: envcheck-doctor
        args: ["--all"]

Project Discovery

The doctor command automatically finds files:

PatternDescription
.env*All .env files in project root
k8s/**/*.yamlKubernetes manifests
k8s/**/*.ymlKubernetes manifests (alt extension)
terraform/**/*.tfTerraform files
ansible/**/*.ymlAnsible playbooks
.github/workflows/*.ymlGitHub Actions
argocd/**/*.yamlArgoCD manifests

See Also