CLI referenceOverview

Overview

The verbatra command: its eight subcommands, the shared flags, how it reads your environment, and the exit-code contract.

@verbatra/cli ships the verbatra binary, a thin wrapper over @verbatra/sdk. Eight commands do the work:

CommandWhat it does
initcreate a verbatra config and .env.example for this project
translatetranslate every target locale once, then exit
watchre-translate on every source change until interrupted
checkreport which keys are missing or stale per locale, read-only
difflist the exact keys that would be added, re-translated, or are orphaned per locale, read-only
exportexport untranslated strings into an Excel workbook for a human translator
importimport a filled workbook back into the locale files
studiostart Verbatra Studio, the local translation dashboard

Install and invoke

Install @verbatra/cli as a dev dependency and run the binary through your package manager:

pnpm add -D @verbatra/cli
pnpm verbatra translate      # or: npx verbatra translate, yarn verbatra translate

You need Node.js >=22.14.0.

Shared conventions

  • --cwd <path> resolves the config and locale files from that directory instead of the current one. Every command takes it.
  • --config <path> loads that config file instead of searching for one. Every command except init takes it; the search order is described in The config file.
  • --json prints a machine-readable result on stdout, keeping stdout clean for piping: errors go to stderr. translate, watch, check, diff, export, and import support it; init and studio do not.
  • --help and --version print and exit 0. An unknown command or flag exits 2.

Environment files

translate, watch, and studio load .env.local and then .env from the working directory before they run. A variable already set in your real environment always wins. API keys are read only from the environment, never from the config file or a flag: see Providers. The read-only commands (check, diff) and the workbook commands (export, import) never call a provider and load no .env files.

Exit codes

The exit code is the contract a CI step or script branches on:

CodeMeaning
0success (also --help and --version)
1translate or import finished but some locales failed, check found a locale out of sync, or diff found pending changes
2could not run: a whole-run error (config, source, provider, lock), or a usage error
130watch or studio was force-stopped by a second interrupt

Each command page spells out how these codes apply to it. See CI and exit codes for wiring them into a pipeline.

Edit on GitHub