Prismy CLI for i18n Translation Management
raw JSON →The Prismy CLI is a command-line interface tool designed to streamline the management of internationalization (i18n) translations, particularly for new keys within a Git branch. It integrates with Prismy, an AI-powered translation platform, to facilitate localized software development. The current stable version is 1.4.1, with recent updates like v1.3.6 suggesting an active development and release cadence. Key differentiators include its tight integration with Git workflows for automatically detecting new i18n keys and generating translations, as well as features for syncing translation files directly with the Prismy platform. It also provides an agent skill to contextualize AI coding tools with project-specific terminology, tone of voice, and translation workflows, significantly enhancing the developer experience for localized applications. The CLI requires Node.js version 18 or higher for execution.
Common errors
error prismy: command not found ↓
npm install -g prismy-cli or ensure it's available in your node_modules/.bin directory if installed locally, and use npx prismy-cli or include it in your package.json scripts. error Error: Authentication Failed: Invalid API Key ↓
prismy auth --key YOUR_VALID_KEY. Ensure no typos or extra spaces are present. error Error: Node.js version XX is not supported. Please upgrade to Node.js 18 or higher. ↓
nvm (Node Version Manager) can help you manage multiple Node.js versions easily. Warnings
gotcha Prismy CLI explicitly requires Node.js version 18 or higher for proper functionality. ↓
gotcha Hardcoding Prismy API keys directly into scripts or source code poses a significant security risk. ↓
gotcha The `prismy generate` command relies on detecting new i18n keys in uncommitted or recently committed Git changes. ↓
Install
npm install prismy-cli yarn add prismy-cli pnpm add prismy-cli Quickstart
import { execSync } from 'child_process';
import * as path from 'path';
// Ensure prismy-cli is installed (e.g., as a dev dependency or globally)
// npm install --save-dev prismy-cli
// or npm install -g prismy-cli
const prismyBin = path.resolve(process.cwd(), 'node_modules/.bin/prismy');
// It's highly recommended to use environment variables for API keys in production
const prismyApiKey = process.env.PRISMY_API_KEY ?? 'YOUR_SECRET_PRISMY_API_KEY_HERE';
try {
if (!prismyApiKey || prismyApiKey === 'YOUR_SECRET_PRISMY_API_KEY_HERE') {
console.warn('Warning: PRISMY_API_KEY is not set. Authentication might fail.');
}
console.log('Authenticating with Prismy...');
execSync(`${prismyBin} auth --key "${prismyApiKey}"`, { stdio: 'inherit' });
console.log('Authentication successful.');
console.log('Generating translations (dry run)...');
// This command detects new i18n keys in your Git changes
// and sends them to Prismy for AI translation.
// Use --dry-run to preview changes without modifying files.
execSync(`${prismyBin} generate --dry-run`, { stdio: 'inherit' });
console.log('Dry run complete. Review potential changes in your translation files.');
// To apply the translations, remove --dry-run:
// execSync(`${prismyBin} generate`, { stdio: 'inherit' });
} catch (error) {
console.error('Error running Prismy CLI commands:', error.message);
process.exit(1);
}