CLI overview
i18nprune is a Node 18+ ESM CLI built with Commander. The entry point is packages/cli/bin/cli.ts, compiled to dist/cli.js.
Global behaviour
- Argv is passed through
preprocessArgv(packages/cli/src/argv/index.ts) before Commander parses it. preActionon the root command:- Resolves
setConfigPath,ensureConfigPathResolved(duplicate config files),setRunOptions,setCliGlobalOverrides, clears context cache. - Skips
ensureConfigforinit,config,languages,help,review,doctorso those work without creating a config file first.
- Resolves
RunOptions(json,quiet,silent) is the process-wide verbosity contract; commands read it viagetRunOptions()orresolveContext().run. There is no separate JSON envelope flag: when JSON is emitted, it always uses the envelope shape documented under JSON output (--json).
Subcommands
Use the canonical command name (e.g. generate, validate, languages). There are no short Commander aliases (gen, val, …).
Optional convenience: if the first argv token after the binary is --langs, it is rewritten to languages before parsing (DOUBLE_DASH_TO_CANONICAL in packages/cli/src/argv/index.ts).
Global flags (short)
| Flag | Long | Role |
|---|---|---|
-v | --version | Print version — see version |
-q | --quiet | Less noise (see verbosity) |
-s | --silent | Stricter suppression |
-h | --help | Help (Commander default) |
-c | --config | Path to a single i18nprune config file |
Other global options use --long only (--json, --yes, --source, …) besides -c / --config.
Global --json
Full behavior, envelope shape, supported commands, and edge cases: JSON output (--json).