Skip to main content

envtrap run

The primary command. Spawns your application as a monitored child process.

Arguments

Options

How envtrap run works

  1. Loads envtrap.json from CWD (if present) and applies defaults for missing fields
  2. Loads secrets from process.env (minus system variable blocklist) and the .env file
  3. Starts the in-memory MITM TLS proxy (unless --no-mitm or channels.network: "off")
  4. Builds the child process environment: adds HTTP_PROXY, HTTPS_PROXY, NODE_EXTRA_CA_CERTS, NODE_OPTIONS (with --import hooks.mjs), and internal envtrap env vars
  5. Spawns the child with stdio: ['inherit', 'pipe', 'pipe']
  6. Pipes and scans stdout/stderr in real time
  7. On child exit: prints summary, writes .envtrap-report.json, removes system CA

Examples

Basic:
Pass arguments through:
Custom .env file:
Disable MITM proxy (no network scanning):
Quiet mode with JSONL log file:
Verbose debug output:
npm / package.json integration:

envtrap check

Validates envtrap.json in the current working directory and reports any schema errors.
envtrap reads and parses envtrap.json, validates every field against the expected schema, and prints a human-readable report. Valid configuration:
Invalid configuration:
No config file found:
Exit codes:
  • 0 — Config is valid (or no config file exists)
  • 1 — Config file has validation errors

Internal Environment Variables

envtrap passes the following variables to the child process. These are read by hooks.mjs and should not be set manually:

Exit Codes