verbatra

v0.4.8
io.github.verbatra/verbatra Checked 3 days ago Published 17 days ago

Translation status, glossary, and editing tools for a verbatra i18n project, over stdio.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

project.snapshot

Reads the resolved project configuration: whether a usable config is loaded (configured), source locale, target locales, file format, the locale-file path pattern, the configured provider id, where the config was loaded from, where the glossary comes from, the humanEdits policy (protect, suggest, or overwrite; protect when unset), and whether a translate run prunes orphaned keys (prune, false when unset), and whether this server replaces translation values with markers (valuesRedacted). Call it first, since every other tool takes its locale codes from this project, a provider id of none means…

project.doctor

Checks the project setup and says how to fix what fails: whether the config loads and validates, the format resolves to an adapter, the provider id is supported, the API key environment variable is set (by name only; a value is never read or returned), the network policy permits the provider's host, and the source locale file parses, plus informational checks on plural rules, plural completeness, locale codes, and leftover locale state. Each check has an id, a title, a status (pass, warn, fail, or skipped), a detail, and, on a failure, a fix: one imperative sentence naming the next step. warn…

status.check

Reports, per target locale, how many keys are missing, stale, or up to date against the source, and whether the locale is in sync, as counts only. Use it for a fast answer to how far a project has drifted before deciding whether any translation work is needed. Do not use it when you need the affected key names, which only status.diff returns. The optional locales parameter narrows the report to the named target locales; omit it to cover every configured target locale. Each locale also carries provenance, the counts of who wrote its current values (byOrigin, byReviewState) over the keys present…

ParameterTypeDescription
localesarray

status.diff

Lists, per target locale, the exact keys that the next translate run would add, re-translate, or leave orphaned. Use it after status.check when you need the key names behind the counts, and to show a person what translation.translatePending would change before asking to spend on it. Do not use it as a content view: it returns key names, never translated values, and the lists are uncapped, so a large project returns a large result. The optional locales parameter narrows the diff to the named target locales; omit it to cover every configured target locale. Each locale also carries changedOrigins…

ParameterTypeDescription
localesarray

glossary.get

Reads the project glossary: every term with its translation for all locales (target), its per-locale translations (targets), the renderings each locale must never use (forbidden), case sensitivity, note and part of speech, plus the terms kept untranslated (doNotTranslate), the glossary format version, and where the glossary comes from. Pass a configured target locale as locale to also get effective: exactly the terms a translation into that locale is held to, after falling back from the locale to its base language to the shared translation. Use it before writing or reviewing a translation to l…

ParameterTypeDescription
localestring

glossary.write

Changes one glossary term and returns the whole glossary afterwards, in the shape glossary.get returns; on a server that redacts values it returns only termCount and doNotTranslateCount with empty lists. Pass term plus any of: translation (a string sets it, null clears it; without locale it is the translation for all locales, and clearing it leaves the term's per-locale data in place, the term being removed once nothing else is left), locale (a configured target locale that translation and forbidden apply to), forbidden (the renderings that locale must never use, replacing any listed before; n…

ParameterTypeDescription
term *string
caseSensitiveboolean
doNotTranslateboolean
forbidden
localestring
lockTimeoutMsinteger
note
partOfSpeech
translation

lock.state

Reads the translation lock file: whether it exists and, when it does, its version and the per-locale count of keys that are missing, stale, or up to date against the recorded baseline. Use it to tell a project that has never been translated, which has no lock file (exists: false), from one whose recorded baseline has drifted. Do not confuse it with status.check, which compares the locale files themselves rather than the recorded baseline. Each locale also carries provenance: counts byOrigin and byReviewState over the keys present in both the source and that locale, read from verbatra.provenanc…

history.list

Lists the recent git commits that touched the source locale file or any configured target locale file, newest first, each with its hash, author name (never the email address), author date, subject, and touched paths. Use it to see who last changed a locale file and when. available: false is not an empty history: its reason is git-missing, not-a-repository, bare-repository, dubious-ownership (git refuses the repository over its owner), timeout (git log was stopped), output-too-large, unsafe-config (a content filter that cannot be switched off), or git-too-old. Renames are not followed, so histo…

ParameterTypeDescription
limitinteger

history.keyRevisions

Lists the git commits in which one key's value changed in one target locale, newest first, each with its commit hash, author name (never the email address), author date, subject, the value, origin (the write path recorded in verbatra.provenance.json in that commit: machine, memory, fuzzy, agent, human, import, unknown, unrecorded, or external; absent when that file could not be read, is above its size limit or the time ran out), sourceChanged (true when the key's source text now differs from the one the lock file recorded in that commit, false when it matches, unknown when that cannot be told)…

ParameterTypeDescription
key *string
locale *string
limitinteger

key.integrity

Reports one key's placeholder, inline markup, ICU syntax, and ICU plural, ordinal, and select arm drift against the lock-file baseline, per target locale. Use it to decide whether a translation is safe to keep, typically before or right after rewriting one with translation.editEntry. Do not read it as a general correctness check: it only checks keys whose source text changed since the baseline was recorded for them. A row is returned for every locale in scope, but its entries array is empty when the key has no baseline entry yet or its source text still matches the baseline, which means checke…

ParameterTypeDescription
key *string
localesarray

locale.integrity

Lists every translation in the target locales that is broken right now: a value that lost or gained a source placeholder or inline markup, no longer parses as ICU MessageFormat, or carries ICU plural, ordinal, or select arms that do not fit the target language. Use it to find every integrity problem in one call, for instance before deciding which keys to fix or retranslate, rather than calling key.integrity key by key. Every key present in both the source and a target locale is judged, whatever its sync state, and only failing keys are listed, so an empty entries list means every translation o…

ParameterTypeDescription
localesarray

key.value

Reads one key's current source text and, when it exists, its current text in one target locale. Use it to see the text before changing it with translation.editEntry, and to confirm afterwards what was written. Do not use it for bulk reads: it answers for one key in one locale per call. The required locale parameter must be a configured target locale and the required key parameter must exist in the source; an unknown one fails with an error rather than an empty result. target is absent when the key has not been translated into that locale yet, while an empty string is a real stored value. descr…

ParameterTypeDescription
key *string
locale *string

key.context

Reads what you need to write one key in one target locale: what key.value returns, plus the glossary entries that apply (every term whose source occurs in the source text, with the translation and forbidden renderings that locale is held to, and every term to keep untranslated that occurs in it) and the key's maxLength budget in characters when the config or verbatra.limits.json sets one (maxLengthSource says which; limitsNotice appears when that file cannot be used). Call it before translation.editEntry so the value follows the project's terminology. Pass the value you intend to write as the…

ParameterTypeDescription
key *string
locale *string
draftstring

locale.values

Reads the current source text and, when it exists, the current target text of many keys at once, page by page, across the target locales. Use it to search or scan translation content rather than key names, where key.value would need one call per key. The optional locales parameter narrows the target locales; keys lists exact key names, or query keeps keys whose name, source, or target contains that text, ignoring case, but not both. Each page holds at most limit entries (default 200, at most 1000), ordered by locale and then in source key order (keys only in a target follow); a page lists a lo…

ParameterTypeDescription
cursorstring
keysarray
limitinteger
localesarray
querystring

translation.editEntry

Writes one caller-supplied translation for one key in one target locale. Use it whenever you already know the correct text: it never calls a provider and costs nothing, so prefer it over translation.retranslateEntry. Do not use it to obtain a translation: what is written is exactly the value you send. The required locale parameter must be a configured target locale, the required key parameter must exist in the source, and the required value parameter is the new text, capped at 20000 characters. The value is accepted only if it passes the integrity gate (it carries the source's placeholders, pa…

ParameterTypeDescription
key *string
locale *string
value *string
lockTimeoutMsinteger

translation.estimate

Estimates what translation.translatePending would send and cost, without spending anything: the same result as the verbatra translate --estimate --json CLI command, a dry run whose estimate field carries the number of keys and provider requests, the tokens or characters they amount to, per locale and in total, and a cost in the config's currency when the config's rates block covers the configured provider and model (pricing says why when it does not). Call it before any spend call, with the same locales, and show the figure to the user so they can agree to it or pass a maxTokens ceiling. The o…

ParameterTypeDescription
localesarray

review.queue

Lists, per target locale, every key whose current value a provider, the translation memory, a fuzzy match, or an AI agent wrote and that no person has approved yet, with the provenance of that value. The queue is computed from the committed locale files, verbatra.lock.json, and verbatra.provenance.json, so every teammate sees the same one. Use it to find the translations waiting for a person, and to report them to the user. Each entry's reasons are the flags the last translate run on this machine gave the key, empty when it gave none; lastRunAt says when that run finished. A key leaves the que…

report.provenance

Reports, per target locale, where each current translation came from and whether a person reviewed it, as verbatra report provenance does: counts per bucket (machine-unreviewed, machine-reviewed, human, import, external for a value edited outside verbatra, unrecorded, unknown) over the keys with a value in both the source and that locale. Use it to answer audit questions such as which values a person wrote or which were edited outside verbatra. Counts are always complete. Set includeEntries to true to also list keys with their origin, reviewState, provider, model, and reviewer, optionally only…

ParameterTypeDescription
bucketsarray
cursorstring
includeEntriesboolean
limitinteger
localesarray

review.approve

Records that a person reviewed one key's current translation in one target locale and accepts it. The approval is written to verbatra.provenance.json, so it is shared with every teammate and CI job that pulls the file, the key leaves review.queue, and it counts for verbatra check --require-reviewed. Call it only when the user has read the value and told you to record this decision: never decide on your own translations or edits on your own initiative, because the decision is recorded as the named person's review. The required locale parameter must be a configured target locale and the required…

ParameterTypeDescription
key *string
locale *string
reviewer *string
expectedHashstringThe 16-digit hash from the reviewed value's marker when the server redacts values. Pass exactly one of expectedValue and expectedHash.
expectedValuestringThe translation the user reviewed, as read with key.value. Pass exactly one of expectedValue and expectedHash.
lockTimeoutMsinteger

review.reject

Records that a person reviewed one key's current translation in one target locale and refuses it, and removes that translation so it gets replaced. The value is deleted from the locale file and its lock entry is dropped, so the key reads as missing until the next translate run or a person fills it; there is no undo on this surface, so read the value with key.value first. A rejected record stays in verbatra.provenance.json, so no translation memory puts the same text back. Call it only when the user has read the value and told you to record this decision: never decide on your own translations o…

ParameterTypeDescription
key *string
locale *string
reviewer *string
expectedHashstringThe 16-digit hash from the reviewed value's marker when the server redacts values. Pass exactly one of expectedValue and expectedHash.
expectedValuestringThe translation the user reviewed, as read with key.value. Pass exactly one of expectedValue and expectedHash.
lockTimeoutMsinteger

usage.summary

Reads the token usage and budget status left behind by the last translate or translation.translatePending run: input and output tokens consumed and, when a token budget is configured, its ceiling, behavior, how much of it was counted, and whether it was exceeded. Use it to report what the last run cost before deciding, with the user, to spend more. Do not expect live figures: only a real translate run updates it, and available: false means no non-dry run has completed in this project yet. budget.standing says where the run ended against its ceiling: within when it never reached it; stopped-bef…

usage.history

Reads the local run history: one record per finished translate, watch, translation.translatePending or retranslation run that left a trace, failed and refused runs included, newest first, with when it ran, what triggered it (translate or retranslate), the provider and model, entries (for a retranslate record, how many entries were attempted), the tokens it used, what it cost, and per locale the counts of translated keys, cache hits, fuzzy hits, generated plural forms, pruned keys, integrity refusals and provider failures, plus how many keys were missing, stale or up to date afterwards. Use it…

ParameterTypeDescription
limitinteger