Skip to content

Environment variables

Runtime behavior is controlled partly by environment variables. Canonical names live in packages/cli/src/constants/env.ts — update that file (one place) when adding or renaming vars; docs and snapshots should follow.

I18NPRUNE_* — config overlay

Merged after defaults and the config file, before discovery and CLI flags (see Configuration README). Values are also listed in the i18nprune config --json output under the env snapshot (these keys only).

VariableEffect
I18NPRUNE_SOURCEOverride config.locales.source with a language code (e.g. en, pt-br) — not a JSON path.
I18NPRUNE_LOCALES_DIROverride config.locales.directory.
I18NPRUNE_SRCOverride config.src (scan root).
I18NPRUNE_FUNCTIONSComma-separated list overriding config.functions.
I18NPRUNE_NO_DISCOVERYWhen truthy (1, true, yes), skip discovery layer where applicable.
I18NPRUNE_NO_INITWhen truthy, treated like non-interactive init paths; also skips interactive prompts together with CI and non-TTY stdin (see JSON output (--json)).
I18NPRUNE_NO_UPDATE_CHECKWhen truthy (1, true, yes), skip all npm registry update discovery: no background refresh, no banner hint, no version --check fetch. CI=true also skips (see CLI cache).
I18NPRUNE_HOMEOverride the CLI home directory that holds machine-local state (default ~/.i18nprune, or %USERPROFILE%\\.i18nprune on Windows). The value is trimmed and resolved to an absolute path at runtime (path.resolve), so relative values are interpreted from the current working directory. It relocates both <home>/cache/ (project/analysis/translate cache) and <home>/state/version.json (npm update-check throttle). When set to a non-empty value, each command prints an [info] line with the resolved path. Not included in config --json env snapshot.

I18NPRUNE_GENERATE_* — generate command defaults

Read when running i18nprune generate; merged into options before CLI flags (see packages/cli/src/commands/generate/env.ts).

VariableEffect
I18NPRUNE_GENERATE_LANGDefault target language code.
I18NPRUNE_GENERATE_FORCETruthy → force re-translate.
I18NPRUNE_GENERATE_DRY_RUNTruthy → dry-run.

Translation backends (generate)

Full rules (translate.primary, translate.providers rows, credentials, precedence) are in Translation config.

Which backend runs (precedence): --providerI18NPRUNE_TRANSLATE_PROVIDERtranslate.primary → core default.

For secrets and endpoints, each env var listed below — when set — supersedes the matching field on the active translate.providers row (id must match — see translate):

VariableWhen used
I18NPRUNE_TRANSLATE_PROVIDERBackend id when flag omitted (google, deepl, llm, …). Case-insensitive.
I18NPRUNE_TRANSLATE_MAX_WORKERSPositive integer: default cap on parallel translateLeaf calls for generate (including generate --resume) when --workers is omitted. Lower precedence than --workers; higher than translate.workers in the file.
I18NPRUNE_TRANSLATE_DEEPL_API_KEYSupersedes apiKey for deepl.
I18NPRUNE_TRANSLATE_LIBRE_URLSupersedes baseUrl for libre.
I18NPRUNE_TRANSLATE_LLM_API_KEYSupersedes apiKey for llm.
I18NPRUNE_TRANSLATE_LLM_BASE_URLSupersedes baseUrl for llm.
I18NPRUNE_TRANSLATE_LLM_MODELSupersedes model for llm.

These I18NPRUNE_TRANSLATE_* vars (especially keys) are intentionally not listed in i18nprune config --json env snapshot (avoid accidental leak of secrets in CI logs).

Other variables

VariableEffect
CIWhen 1 or true, contributes to skipping interactive prompts (with I18NPRUNE_NO_INIT and non-TTY stdin).

Source of truth

  • Names: packages/cli/src/constants/env.ts
  • Config namespaces: Command namespaces (config.missing, …)