CLI referenceverbatra watch

verbatra watch

Re-translate on every source change until interrupted.

Watch the source locale file and re-run a translation on each debounced change, until you interrupt it. watch runs an initial translation at startup, then keeps your target locales current as you save. Before it runs, it loads .env.local and then .env from the working directory; a variable already set in the real environment wins.

Synopsis

verbatra watch [flags]

Flags

FlagArgumentDefaultEffect
--cwd<path>current directoryresolve config and locale files from this directory
--config<path>search for oneload this config file instead of searching for one
--debounce<ms>300wait this many milliseconds after the last change before translating; must be a bare positive integer (a value like 250ms, 0, or -1 is a usage error, exit 2)
--concurrency<n>1translate up to n target locales at once per run; must be a positive integer
--no-cachenoneoff (cache on)bypass the local translation-memory cache (verbatra.cache.json) on every run
--jsonnoneoffprint each run as one NDJSON record (one JSON object per line) on stdout

With --json, each run emits one WatchRunResult record: a success carrying the run summary, or a failure carrying an error code and message. The startup line, the stopping notice, and per-run progress all go to stderr, so the stdout stream stays clean NDJSON. A failed run is just a record on the stream: it neither stops the watcher nor changes the exit code.

--concurrency applies to each cycle's run. Because each run's token budget is fresh, a --concurrency above 1 still fails every run with exit 2 when the config sets a maxTokens budget. --no-cache bypasses the translation-memory cache on every cycle.

Stopping

The first interrupt (Ctrl-C, or SIGTERM) lets the current run finish, stops the watcher cleanly, and exits 0. A second interrupt while that shutdown is still in flight force-stops with exit 130.

Examples

# watch and re-translate on each change
verbatra watch

# calmer in a busy editor: wait 1s after the last change, stream NDJSON
verbatra watch --debounce 1000 --json

Exit codes

CodeMeaning
0stopped cleanly by a single interrupt
2could not start or stop: a config error, a startup or shutdown failure, or a usage error (including an invalid --debounce)
130force-stopped by a second interrupt
Edit on GitHub