@envra/cli
v0.1.2
Published
CLI for envra: check, sync, docs, doctor
Maintainers
Readme
@envra/cli
Command-line tools for envra: validate env, generate .env.example and ENVIRONMENT.md, and run hygiene checks (doctor).
Install
pnpm add -D @envra/cli
# or
npm install -D @envra/cliYour project should also depend on @envra/core. The CLI loads your config with jiti (TypeScript without a separate build step for the config file).
Commands
pnpm envra check -c ./env.config.ts
pnpm envra sync -c ./env.config.ts -o .env.example
pnpm envra docs -c ./env.config.ts -o ENVIRONMENT.md
pnpm envra doctor -c ./env.config.tsExport defineEnv(...) as default or env, or export field builders as envraSchema, schema, environmentFields, or envFields.
check and doctor — env loading
--env-file <path>— repeatable; each file is parsed with dotenv and merged (later overrides earlier). Starts fromprocess.env.--env-dir <dir>— after--env-file, loads<dir>/.envthen<dir>/.env.<node-env>if they exist.--node-env <name>— segment for.env.<name>(default:NODE_ENVordevelopment).--env-preset nest— sets default--env-dirtoenv(matches many NestConfigModulelayouts).
--profile / -p is the schema profile for envra rules (requiredIn / onlyIn), not the env file name.
doctor
--undeclared <policy>—ignore-system(default),all, orloaded-only(only warn on extra keys that appeared in loaded files).--json— print structured JSON for CI.
Windows
If envra fails when run via node on Windows, call the entry file directly, e.g. node node_modules/@envra/cli/dist/cli.js check -c ./env.config.ts.
Documentation
License
MIT — see LICENSE in the monorepo.
