Prismy CLI
A powerful CLI tool that automatically generates translations for new i18n keys in your git branch. Perfect for maintaining multilingual applications without manual translation overhead.
Features
- 🔍 Smart Detection: Automatically detects new translation keys in your current branch or local changes
- 🌐 Multi-language Support: Generates translations for all configured languages
- 🔧 Git Integration: Seamlessly works with your git workflow
- ⚡ Fast Processing: Only processes files that have actually changed
- 🔐 Secure: API key management with local storage
Installation
npm install -g prismy-cli
Quick Start
prismy auth your-api-key-here
- Generate translations for your changes:
prismy generate
That's it! The CLI will automatically detect new translation keys in your changed files and generate translations for all configured languages.
Usage
Authentication
prismy auth <your-api-key>
prismy auth --show
prismy auth --reset
Generate Translations
prismy generate
prismy generate --base-branch feature/my-feature
prismy generate --repo-name my-project
prismy generate --base-branch main --repo-name my-project
prismy generate -b main -r my-project
Default Behavior
When you run prismy
without any commands, it defaults to prismy generate
:
prismy
prismy generate
How It Works
- Repository Analysis: Connects to your repository and fetches translation configuration
- Change Detection: Compares your current branch with the base branch to find modified files
- File Processing: Identifies translation files that contain new keys
- Translation Generation: Sends new keys to the Prismy API for translation
- File Updates: Automatically updates your translation files with the new translations
Configuration
The CLI automatically fetches configuration from your repository, including:
- Main branch name
- Translation files to sync
- Supported languages
- File structure
Examples
Basic Workflow
git checkout -b feature/new-translations
prismy generate
git add .
git commit -m "Add translations for new features"
Working with Feature Branches
prismy generate --base-branch develop
Debug Mode
Enable debug logging to see detailed information:
DEBUG=1 prismy generate
Error Handling
The CLI provides clear error messages for common issues:
- No API key: Prompts you to set up authentication
- No repository config: Ensures your repository is properly configured
- API errors: Clear messages about API connectivity issues
- File errors: Warnings about missing or inaccessible files
Repository Detection Issues
If the CLI cannot automatically detect your repository name from the git remote, you have two options:
- Interactive prompt: The CLI will ask you to enter the repository name manually
- Command line option: Use
--repo-name
to specify it directly
prismy generate --repo-name my-project-name
This is particularly useful in environments where:
- Git remotes are not configured
- Repository URLs don't follow standard patterns
- You're working with local-only repositories
Development
Building from Source
git clone <repository-url>
cd prismy-cli
npm install
npm run build
npm start
Available Scripts
npm run build
- Compile TypeScript to JavaScript
npm run dev
- Watch mode for development
npm run lint
- Run ESLint
npm run format
- Format code with Prettier
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
License
ISC
Support
If you encounter any issues or have questions, please open an issue in the repository.