CLI
Validate, print, and watch configuration in dev and CI.
The confkit CLI validates, prints, watches, scaffolds, and explains your configuration.
Quick Reference
npx confkit help
npx confkit check --file conf/config.ts --env production
npx confkit print --file conf/config.ts --json
npx confkit diff --from-env development --to-env production
npx confkit diff --from-source env --to-source file:config.yaml --matrix
npx confkit dev --file conf/config.ts
npx confkit init
npx confkit explain --key DATABASE_URL
npx confkit types --out confkit-env.d.ts
npx confkit types --server --out confkit-env-server.d.ts
npx confkit types --watch
npx confkit scan --dir src --allow NODE_ENV,VERCEL_ENV
npx confkit ws check
npx confkit ws types --serverCommands
check— Validate and print a summary table; exits non‑zero on failure--strict— also fail if unknown keys (not in the schema) are present
print— Print values (redacted by default)--json— print raw JSON--no-redact— disable redaction (dangerous; avoid committing)
diff— Compare two environments or two sources- Environments:
--from-env <a> --to-env <b>(respects.env*resolution perNODE_ENV) - Sources:
--from-source <name> --to-source <name>(matches by substring of source name; e.g.env,file:config.yaml) --matrix— print a matrixKey | A | B | Status--json— output structured diff{ added, removed, changed }--no-redact— disable redaction (env‑diff only; source‑diff shows raw source values)
- Environments:
dev— Watch sources and diff on change- Controls:
rreload,stoggle redaction,ccopy invalid paths to clipboard --watch a,b,c— add additional globs/paths to watch
- Controls:
init— Scaffoldconf/config.ts, generate.env.examplefrom your schema, and add a GitHub Action workflow (includesconfkit checkandconfkit scan)explain— Show where values come from; use--key <name>to filterdoctor— Basic environment checks and production warningstypes— Generate aconfkit-env.d.tsdeclaring client modules with concrete keys as strings (@confkit/next/clientandconfkit:client)--server— generate a server-sideConfkitEnvinterface inferred from your schema--watch— regenerate on changes to config/env files
scan— Scan your code forprocess.env.*/import.meta.env.*usages and compare to the schema- prints unknown keys used in code (not declared) and schema keys unused in code
--dir <path>— root directory to scan (default CWD)--allow <keys>— comma-separated keys to ignore (e.g.NODE_ENV)
ws— Monorepo helpers; discover workspaces and run per‑workspacews check— validate every workspace that hasconf/config.(ts|js)ws types— generate types in each matching workspace (client or--server)- Flags:
--root <path>(override monorepo root),--only <substring>(filter by workspace name),--fail-fast(stop on first failure),--server,--out <file>
Common Flags
--file <path>— config file (defaultconf/config.ts)--env <name>— setNODE_ENVbefore loading
Note: If --file is omitted, Confkit searches upward from the current directory for the nearest conf/config.(ts|tsx|mjs|js).
+---------------------------+---------------------------+
| Key | Value |
+---------------------------+---------------------------+
| DATABASE_URL | ••• |
| FEATURES.abTestVariant | "A" |
| NODE_ENV | "development" |
| PORT | 3000 |
+---------------------------+---------------------------+