comvi push
The comvi push command uploads local translation files to the Comvi platform. Use it to sync translations that developers add in code back to the platform where translators can review and translate them into other languages.
Prerequisites
Section titled “Prerequisites”You need a .comvirc.json file in your project root and an API key. Prefer COMVI_API_KEY for the key:
{ "apiBaseUrl": "https://api.comvi.io", "translationsPath": "./src/locales", "fileTemplate": "{languageTag}/{namespace}.json", "format": "json"}Basic Usage
Section titled “Basic Usage”comvi pushThis reads all translation files from the configured translationsPath and uploads them to your Comvi project. Conflict handling is controlled by --force-mode.
Options
Section titled “Options”comvi push [options]| Option | Alias | Default | Description |
|---|---|---|---|
--config | -c | .comvirc.json | Path to the Comvi config file |
--lang | -l | All detected languages | Comma-separated list of language tags to upload |
--ns | -n | All detected namespaces | Comma-separated list of namespaces to upload |
--path | -p | .comvirc.json → translationsPath | Source directory containing translation files |
--dry-run | false | Preview changes without uploading anything | |
--force-mode | .comvirc.json → push.forceMode or 'ask' | Conflict resolution: override, keep, ask, or abort |
Source File Structure
Section titled “Source File Structure”The CLI expects files organized by language and namespace, matching the structure comvi pull produces:
src/locales/├── en/│ ├── common.json│ ├── auth.json│ └── dashboard.json├── de/│ ├── common.json│ └── auth.json└── fr/ └── common.jsonEach JSON file contains flat or nested key-value pairs:
{ "greeting": "Hello, {name}!", "nav.home": "Home", "nav.settings": "Settings"}The CLI detects the language from the directory name and the namespace from the filename.
Dry Run
Section titled “Dry Run”Always preview what will change before pushing to the platform. The --dry-run flag shows a summary of additions, updates, and deletions without making any changes:
comvi push --dry-runExample output:
Dry run — no changes will be made.
en/common.json: + nav.profile (new key) ~ greeting (value changed) = nav.home (unchanged, skipped)
en/auth.json: + reset.title (new key) + reset.description (new key)
Summary: 3 keys to add, 1 key to update, 1 key unchangedConflict Handling
Section titled “Conflict Handling”By default, comvi push does not overwrite existing translations on the platform:
- New keys are always created.
- Existing keys are skipped unless
--overwriteis set. - Missing keys on the local side are left untouched on the platform unless
--delete-missingis set.
This protects translator work. If a translator has already translated a key, pushing from your codebase does not erase their work.
Overwriting Existing Translations
Section titled “Overwriting Existing Translations”To update values for keys that already exist on the platform:
comvi push --overwriteRemoving Deleted Keys
Section titled “Removing Deleted Keys”To delete keys from the platform that no longer exist in your local files:
comvi push --delete-missingThis is useful for keeping the platform clean after you remove deprecated keys from your codebase. Combine with --dry-run first to review what will be deleted:
comvi push --delete-missing --dry-runPushing Specific Locales
Section titled “Pushing Specific Locales”Upload only certain languages:
# Push only the source languagecomvi push --lang en
# Push English and Germancomvi push -l en,dePushing Specific Namespaces
Section titled “Pushing Specific Namespaces”Upload only certain namespaces:
# Push only the common namespacecomvi push --ns common
# Push common and auth namespacescomvi push -n common,authCI/CD Usage
Section titled “CI/CD Usage”Push translations from your main branch after a merge so that new keys are immediately available to translators:
name: Push Translationson: push: branches: [main] paths: - 'src/locales/en/**'
jobs: push: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 20 - run: npm ci - run: npx comvi push --lang en env: COMVI_API_KEY: ${{ secrets.COMVI_API_KEY }}This workflow triggers only when the source language files change on main, pushing new and updated keys to the platform for translators.
Configuration File Reference
Section titled “Configuration File Reference”All push options can be set in .comvirc.json:
{ "apiBaseUrl": "https://api.comvi.io", "translationsPath": "./src/locales", "fileTemplate": "{languageTag}/{namespace}.json", "format": "json", "push": { "forceMode": "ask" }}Command-line flags override config file values.
Next Steps
Section titled “Next Steps”- comvi pull — download translations from the platform
- comvi typegen — generate TypeScript types after pushing new keys
- CLI Overview — all CLI commands and global configuration
- CI/CD Integration — full pipeline examples