Small repo-local CLI that catches env drift between code, .env.example, Docker / docker-compose, and GitHub Actions.
I kept hitting the same issue while working fast, especially with coding agents: the code worked, but the repo did not. .env.example drifted, CI expected different variables, Docker had its own set, and onboarding broke.
This tool catches that drift early. It is useful in any repo, and especially handy in fast-moving AI-assisted repos where config drift shows up early.
- env vars used in code but missing from
.env.example - vars referenced in Docker or GitHub Actions but undocumented locally
- stale keys left behind in
.env.example
It scans Python and JS/TS code, .env.example, Docker / docker-compose files, and GitHub Actions workflows with simple deterministic patterns.
This repository includes AGENTS.md and Copilot instructions for use with coding agents.
The project is intentionally small, deterministic, and easy to audit.
Requires Python 3.11+.
uv syncFallback:
python -m pip install .uv run dotenvdrift .
uv run dotenvdrift examples/broken-repo
uv run dotenvdrift . --json
uv run dotenvdrift . --strict
uv run dotenvdrift . --only missingSample output:
missing
NODE_ENV web/client.ts:2
OPENAI_API_KEY app/settings.py:4
VITE_API_BASE_URL web/client.ts:1
undocumented
DATABASE_URL docker-compose.yml:5
PYPI_TOKEN .github/workflows/release.yml:11
RELEASE_REGION .github/workflows/release.yml:7
unused
DEBUG_SQL .env.example:2
✗ 7 drift issues
- It never loads or prints env values, only names and locations.
- It is heuristic-based, using regex and line-based scanning instead of full parsing.
- It may miss dynamically constructed env names.
- It does not validate values or types.
- It stays generic. AWS, GCP, Azure, and crypto repos work when they use env vars, but there is no provider-specific logic.
- It does not sync secrets, manage vaults, or auto-fix anything.
uv run python -m unittest discover -s tests -p 'test_*.py' -v
uv build0: no issues, or issues found without--strict1: issues found with--strict2: invalid repository path
MIT
