@tricrepe/flowtranslator-cli
v1.0.0
Published
A powerful AI-powered translation CLI tool
Downloads
15
Maintainers
Readme
FlowTranslator CLI
A powerful AI-powered translation CLI tool that helps you translate text with AI assistance step by step.
Installation
Global Installation
npm install -g @tricrepe/flowtranslator-cliLocal Installation
npm install @tricrepe/flowtranslator-cliUsing Yarn
yarn global add @tricrepe/flowtranslator-cliUsage
After installation, you can run the CLI using:
flowtranslatorOr if installed locally:
npx flowtranslatorConfiguration
The CLI requires LLM configuration to function. On first run, you'll be guided through the setup process automatically.
Interactive Setup
When you first run flowtranslator, you'll be prompted to provide:
- Model Name: The AI model to use (e.g.,
gpt-4o,claude-3-5-sonnet-20241022) - Base URL: The API endpoint (e.g.,
https://api.openai.com/v1) - API Key: Your authentication key
Configuration File
The configuration is saved to:
~/.flowtranslator/config.jsonExample configuration:
{
"modelName": "gpt-4o",
"baseURL": "https://api.openai.com/v1",
"apiKey": "your-api-key-here"
}Reconfiguring
To reconfigure your settings at any time:
- Press
Ctrl+Enterwhile the CLI is running - Or manually edit the configuration file at
~/.flowtranslator/config.json
Supported LLM Providers
The CLI works with any OpenAI-compatible API endpoint, including:
- OpenAI:
https://api.openai.com/v1 - Anthropic Claude:
https://api.anthropic.com/v1 - Google Gemini:
https://generativelanguage.googleapis.com/v1beta - 智谱AI:
https://open.bigmodel.cn/api/paas/v4/ - Local models:
http://localhost:1234/v1(Ollama, LM Studio, etc.)
Features
- 🤖 AI-Powered Translation: Advanced AI assistance for accurate translations
- 📝 Interactive Interface: Beautiful terminal UI with real-time feedback
- 🎯 Context-Aware: Understands context for better translations
- ✏️ Editing Support: Edit translations before finalizing
- 📋 History Tracking: Keep track of your translation history
- 🔧 Multiple Formats: Support for various file formats
Example Prompts
- "Translate this text to Chinese: Hello, how are you today?"
- "Help me translate this document from English to Spanish"
- "What's the best way to translate technical terms?"
- "Translate and preserve the formatting of this markdown file"
Requirements
- Node.js 18 or higher
- LLM API key and endpoint (configured during first run)
Development
Local Development
# Clone the repository
git clone https://github.com/cestcavision/flowtranslator.git
cd flowtranslator
# Install dependencies
yarn install
# Quick development workflow (recommended)
./dev.sh
# Or run in development mode
yarn dev
# Build for production
yarn build
# Start the built CLI
yarn startDevelopment Scripts
For quick iteration during development:
# Quick build and install (for daily development)
./dev.sh
# Complete build and install
./build-and-install.sh
# Clean all build files and reinstall
./clean.sh && ./build-and-install.sh
# Show development options
./build-and-install.sh --helpBuilding
# Build all dependencies
yarn build:cli
# Package for distribution
yarn package
# Release to npm
yarn releaseLicense
MIT
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Troubleshooting
Configuration Issues
- No configuration found: Run
flowtranslatorand follow the setup prompts - Invalid API key: Reconfigure with
Ctrl+Enteror edit~/.flowtranslator/config.json - Wrong endpoint: Ensure the base URL matches your LLM provider's API endpoint
Installation Issues
# If flowtranslator command is not found
npm unlink -g @tricrepe/flowtranslator-cli
cd packages/cli && npm link
# If permissions error
chmod +x packages/cli/dist/index.js
# For build issues
./clean.sh --deep && ./build-and-install.shCommon Problems
- Raw mode error: This is normal in some terminal environments and doesn't affect functionality
- Empty configuration: All three fields (modelName, baseURL, apiKey) must be provided
- Network issues: Check your internet connection and API endpoint accessibility
Files Created by FlowTranslator
- Configuration:
~/.flowtranslator/config.json- LLM settings - Translation Memory:
./memory.json- AI-learned translation patterns - Translations: Currently displayed in the CLI, with export functionality planned
Support
If you encounter any issues, please file an issue on GitHub.
