Dire CLI Commands

October 25, 2025 ยท View on GitHub

Dire is both a translation tool and an i18n file maintenance system. Commands are organized by their primary purpose.

Setup & Configuration

Commands for initializing and configuring Dire.

CommandDescriptionExample
dire initCreate a configuration file (.dire.toml)dire init
dire init --forceOverwrite existing configuration filedire init --force

Translation Commands

Universal Translation Commands

Commands that work with all provider types (LLMs and translation services).

CommandDescriptionExample
direTranslate all missing keys in your i18n filesdire
dire --keys <key>Translate specific key(s)dire --keys "auth.login,auth.register"
dire --sourcedApply only glossary and memory translations (no provider)dire --sourced
dire --glossaryApply only glossary translations (no provider)dire --glossary
dire --glossary --overwriteOverwrite existing translations with glossary valuesdire --glossary --overwrite
dire --memoryApply only memory translations (no provider)dire --memory
dire --stubCreate placeholder translations (empty strings)dire --stub
dire --include-stubsInclude empty strings as missing translationsdire --include-stubs
dire --no-trimPreserve whitespace in translationsdire --no-trim

LLM-Only Translation Commands

Advanced commands requiring LLM providers (Claude, OpenAI, Gemini, Mistral). These do NOT work with translation services like DeepL or Google Translate.

CommandDescriptionExample
dire --context <context>Add context for better AI translationsdire --context "E-commerce checkout"
dire --rephrase --keys <key> --locale <locale>Generate rephrase options for existing translationsdire --rephrase --keys auth.login --locale en-US

File Maintenance Commands

Commands for managing and maintaining i18n file structure and completeness.

CommandDescriptionExample
dire --pruneRemove orphaned keys from non-reference localesdire --prune
dire --checkLint translation completeness (CI/CD mode)dire --check
dire --check --format jsonOutput lint results in JSON formatdire --check --format json

General Options

Universal flags that work across all commands.

CommandDescriptionExample
dire --verboseShow detailed progress informationdire --verbose
dire --debugEnable debug loggingdire --debug
dire --helpShow help informationdire --help
dire --versionShow current versiondire --version

Configuration Override Flags

These flags override settings from your .dire.toml configuration file:

FlagDescriptionExample
--directory <path>Override files.directorydire --directory ./i18n
--locales <filename=language-code>Override files.locales mappingdire --locales en.json=en-US,fr.json=fr-FR
--indent <number>Override files.indentdire --indent 4
--formality <level>Override styleGuide.formalitydire --formality formal
--project-name <name>Override project.namedire --project-name "My App"
--project-description <text>Override project.descriptiondire --project-description "Online store for shoes"
--project-domain <domain>Override project.domaindire --project-domain "e-commerce"
--provider-active <name>Override providers.activedire --provider-active claude
--provider-model <model>Override active provider modeldire --provider-model claude-3-5-sonnet
--provider-temperature <float>Override provider temperaturedire --provider-temperature 0.3
--provider-max-tokens <number>Override provider max tokensdire --provider-max-tokens 4096

What Each Command Does

Setup & Configuration

dire init

  • Creates a .dire.toml configuration file
  • Sets up default and example settings for your project
  • Use --force flag to overwrite existing configuration

Translation Commands

dire (Main Command)

  • Scans your configured i18n files
  • Identifies missing translations
  • Applies glossary and memory translations
  • Uses the configured provider to generate translations for missing keys
  • Saves results back to your files

dire --keys <key>

  • Translates only specific keys instead of all missing ones
  • Focuses on particular sections of your translations
  • Supports multiple keys separated by commas

dire --sourced

  • Uses both glossary entries and translation memory
  • Reuses existing translations found in your files
  • Skips provider-powered translation generation
  • Convenience flag equivalent to using --glossary --memory together
  • No API key required

dire --glossary

  • Uses only your configured glossary entries
  • Applies exact matches from your glossary configuration
  • Skips translation memory and provider-powered translation
  • No API key required

dire --glossary --overwrite

  • Overwrites existing translations with glossary values
  • Requires --glossary flag (cannot be used with --sourced or --memory)
  • Useful for enforcing glossary terms across all translation files
  • Updates translations even when they already exist
  • No API key required

Use Cases:

  • Terminology updates: Apply glossary changes to existing translations
  • Consistency enforcement: Ensure all files use the same glossary terms
  • Brand alignment: Update translations to match new brand guidelines

dire --memory

  • Reuses only existing translations found in your files (translation memory)
  • Finds matches based on source text across different keys
  • Skips glossary and provider-powered translation
  • No API key required

dire --stub

  • Creates empty string placeholders for all missing translations
  • Skips provider translation generation
  • Useful for setting up translation file structure
  • No API key required

dire --context <context>

  • Provides additional context to improve translation quality
  • Improves translation accuracy
  • Ensures domain-specific terminology
  • Maintains consistent tone and style

dire --rephrase --keys <key> --locale <locale>

  • Generates rephrase options for existing translations
  • Requires both a specific key and target locale
  • Helps improve translation quality and alternatives
  • Only works with single keys, not multiple keys

dire --include-stubs

  • Treats empty string translations as missing translations
  • Processes placeholder values that need actual translations
  • Useful when working with incomplete translation files

dire --no-trim

  • Preserves leading/trailing spaces
  • Maintains exact formatting
  • Keeps intentional whitespace in translations

File Maintenance Commands

dire --prune

  • Removes orphaned translation keys that don't exist in the reference locale
  • Identifies the reference locale (the one with the most keys)
  • Cleans up keys from other locales that are no longer in the reference
  • Keeps your translation files synchronized and maintainable over time
  • Essential for ongoing i18n file maintenance as your project evolves
  • No API key required

dire --check

  • Lints translation files for completeness issues
  • Exits with code 0 if complete, 1 if missing translations found
  • Perfect for CI/CD pipelines to prevent incomplete translations from reaching production
  • Use --format json for machine-readable output
  • Respects --include-stubs (treats empty strings as missing)
  • Supports --keys flag to lint specific translation keys only

Exit Codes:

  • 0 - All translations complete
  • 1 - Missing translations detected
  • 2 - Configuration or system errors