Skip to content

CLI Reference

Commands

validate

Validate .env file(s) against a schema.

bash
envguard validate [flags]
FlagShortDefaultDescription
--schema-senvguard.yamlPath to schema YAML file
--env-e.envPath to .env file (repeatable)
--format-ftextOutput format: text, json, github, sarif
--strictfalseFail if .env contains undefined keys
--env-name""Environment name for requiredIn/devOnly
--scan-secretsfalseScan for hardcoded secrets
--watchfalseEnable watch mode
--discoverfalseAuto-discover packages in monorepo
--severitycriticalMinimum severity to treat as error

Multiple --env files are merged right-to-left (later files override earlier ones).

scan

Scan .env files for hardcoded secrets.

bash
envguard scan [flags]
FlagShortDefaultDescription
--env-e.envPath to .env file (repeatable)
--format-ftextOutput format: text, json, sarif
--schema-s""Optional schema with custom secret rules
--baseline""Baseline file to suppress known matches

lint

Lint a schema file for best practices.

bash
envguard lint [flags]
FlagShortDefaultDescription
--schema-senvguard.yamlPath to schema YAML file
--format-ftextOutput format: text, json

init

Generate a starter envguard.yaml schema file.

bash
envguard init [flags]
FlagShortDefaultDescription
--inferfalseInfer schema from existing .env file
--env-e.envPath to .env file for inference
--configfalseGenerate .envguardrc.yaml config file

generate-example

Generate .env.example from a schema.

bash
envguard generate-example [flags]
FlagShortDefaultDescription
--schema-senvguard.yamlPath to schema YAML file

audit

Audit source code for environment variable usage.

bash
envguard audit [flags]
FlagShortDefaultDescription
--src.Source code directory
--env-e.envPath to .env file
--format-ftextOutput format: text, json, sarif

sync

Sync .env.example with .env.

bash
envguard sync [flags]
FlagShortDefaultDescription
--env-e.envPath to .env file
--example.env.examplePath to .env.example file
--format-ftextOutput format: text, json, sarif

watch

Watch files and re-validate on changes.

bash
envguard watch [flags]
FlagShortDefaultDescription
--env-e.envPath to .env file (repeatable)
--schema-senvguard.yamlPath to schema YAML file
--debounce300msDebounce duration
--command""Command to run after validation
--clearfalseClear terminal before each run
--quietfalseOnly show errors
--format-ftextOutput format

install-hook

Install a Git hook.

bash
envguard install-hook <hook-name> [args...]

uninstall-hook

Uninstall a Git hook.

bash
envguard uninstall-hook <hook-name>

lsp

Start the LSP server.

bash
envguard lsp

version

Print version information.

bash
envguard version

Global Flags

FlagDescription
--helpShow help for any command
--verboseEnable verbose logging

Released under the MIT License.