env-time-travel
v0.3.0
Published
CLI for tracing .env variable history through git
Readme
env-time-travel
env-time-travel is a CLI for tracing .env variables through git history. It shows who added a variable, when it changed, when it disappeared, and whether it still exists today.
Install
pnpm add -g env-time-travelUsage
env-time-travel [variable] [options]Options:
--allShow all variables. This is the default when no variable is provided.--auditAudit.envhistory for likely secret variables left in git history.--diff <commit1> <commit2>Show exact env changes between two commits.--export <format>Export timelines asjson,csv, ormarkdown.--file <path>Track a specific env file. Defaults to.env.--jsonEmit JSON instead of colored terminal output.--secrets-checkScan git history for accidentally committed secret values.--zombiesOnly show removed variables.--since <date>Only include changes on or afterYYYY-MM-DD.
Examples:
env-time-travel DB_HOST
env-time-travel --all
env-time-travel --audit
env-time-travel --diff HEAD~5 HEAD
env-time-travel --all --export json
env-time-travel DB_HOST --export markdown
env-time-travel --secrets-check
env-time-travel --zombies --since 2024-01-01
env-time-travel API_URL --jsonHow It Works
- Reads git patch history for
.envfiles. - Parses added and removed
KEY=VALUElines from diff hunks. - Builds a per-variable timeline of
ADDED,CHANGED, andREMOVEDevents. - Cross-references the current
.envto determine whether each variable is still current. - Checks
.env.example,.env.sample, and.env.templateto detect documented variables that no longer exist.
Zombie Variables
A zombie variable is a variable that has been removed from the current tracked env file, but still appears in documentation files like .env.example, .env.sample, or .env.template. These are often stale variables that still confuse new contributors or deployment tooling.
