Skip to content

bobfromarcher/envdoc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

envdoc

npm CI license zero deps

Finds every environment variable your code reads and tells you which ones are documented. It can generate a .env.example, print a Markdown table, or fail CI when code references a variable that is missing from your .env.example. No dependencies, no AI.

A new process.env.SOMETHING that never makes it into .env.example is a common cause of "works on my machine". envdoc reads your source the way your runtime does and reports the drift.

envdoc running on a sample project

Install

npm install -g @bobfromarcher/envdoc
# or run once:
npx @bobfromarcher/envdoc

Languages

envdoc recognises environment access in JavaScript and TypeScript (process.env.X, process.env['X'], import.meta.env.X), Python (os.environ['X'], os.environ.get('X'), os.getenv('X')), Go (os.Getenv("X"), os.LookupEnv), and Ruby (ENV['X']).

Usage

envdoc [path] [options]
Option Description
--write Write or update .env.example (existing values are kept)
--check Exit 1 if code uses vars missing from .env.example
--markdown, --md Print a Markdown table of all referenced variables
--json Print raw JSON
--env <file> The dotenv file to diff against (default .env.example)
-h, --help Show help
-v, --version Show version

Examples

envdoc                      # summary for the current directory
envdoc --write              # regenerate .env.example, keeping known values
envdoc src --markdown > ENV.md

Guard it in CI

# .github/workflows/env.yml
- run: npx @bobfromarcher/envdoc --check

The build fails the moment someone references a variable that is not documented, so your code and your .env.example stay in sync.

Fast path

When ripgrep is on your PATH, envdoc uses it to list files (respecting .gitignore) and scans thousands of files in milliseconds. Without ripgrep it falls back to a built-in Node walk with the same results and still zero npm dependencies.

Development

git clone https://github.com/bobfromarcher/envdoc
cd envdoc
node test/test.js

CI runs the suite on Node 18, 20 and 22 across Linux, macOS and Windows.

License

MIT, bobfromarcher.

About

Find every env var your code reads, then document it — .env.example generator + CI guard. Zero deps, zero AI.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors