Skip to content

Feature: Add lingo.dev validate command for configuration validation #1300

@sushanthach12

Description

@sushanthach12

Problem

Currently, users can check translation status with lingo.dev status and view files with lingo.dev show files, but there's no dedicated command to validate that:

All configured file paths actually exist
Files are accessible (read/write permissions)
Configuration is syntactically and semantically correct
No broken file references
This causes issues when copying configs between projects, after moving files, or checking setup in CI/CD before running translations.

Proposed Solution

Add a validate command that performs comprehensive configuration validation and file accessibility checks.

Use Cases

  1. Quick configuration check before running translations
  2. CI/CD quality gate to ensure valid setup
  3. Debugging configuration issues
  4. Onboarding new team members
  5. Post-migration validation

Proposed API

# Basic validation
lingo.dev validate

# Strict mode (treat missing target files as errors)
lingo.dev validate --strict

# With authentication check
lingo.dev validate --api-key=<key>

Expected Output

✓ Configuration file (i18n.json) exists
✓ Source locale 'en' is valid
✓ Target locales ['es', 'fr'] are valid
✓ Bucket type 'json' is supported
✓ Source file exists: src/locales/en/common.json
✓ Source file exists: src/locales/en/messages.json
⚠ Target file missing: src/locales/es/common.json (will be created)
✓ All source files are readable
✓ Target directories are writable

Validation complete: 6 checks passed, 2 warnings

Implementation Details

  • New command: packages/cli/src/cli/cmd/validate.ts
  • Reuses existing utilities: getConfig(), getBuckets(), checkIfFileExists()
  • ~200-300 lines of code
  • 2-4 hours implementation time
  • Follows existing error handling patterns with CLIError

Benefits

  • Early Detection: Catches setup issues before running translations
  • CI/CD Integration: Can be used as a quality gate in pipelines
  • Better DX: Quick feedback on configuration correctness
  • No Breaking Changes: New command, doesn't modify existing behavior

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions