@0xlimao/traduora-cli
v0.2.1
Published
Modern Traduora CLI with TypeScript and client_credentials support
Downloads
40
Readme
@0xlimao/traduora-cli
A modern CLI and JavaScript SDK for Traduora with first-class client_credentials support.
- CLI commands for project status, terms, translations, and exports
- Interactive
initflow to bootstrap credentials and default state - SDK package for scripting with both ESM and CommonJS
- Docusaurus documentation with English, Traditional Chinese, Simplified Chinese, and Japanese
Table of Contents
- Highlights
- Installation
- Quick Start
- CLI Usage
- Configuration
- JavaScript SDK
- Documentation Site
- Development
- Testing
- Release
- Contributing
- License
Highlights
- Uses term
valueas the user-facing key (instead of UUIDs) - Supports
client_credentialsas the default auth model - Supports interactive account login to create a project client automatically
- Supports config file logic (
json/js/ts) and environment variable fallback
Installation
From npm
pnpm add @0xlimao/traduora-cliGlobal CLI install
pnpm add -g @0xlimao/traduora-cliFrom source
git clone https://github.com/flyinglimao/traduora-cli.git
cd traduora-cli
pnpm install
pnpm buildQuick Start
Initialize interactively:
traduora initShow help:
traduora --help
traduora project --help
traduora term --help
traduora translation --help
traduora export --helpTypical flow:
traduora project status
traduora translation use en_GB
traduora term add form.email.required
traduora translation add --term form.email.required --value "E-mail input is required"
traduora export --format jsonnested --output ./i18n/en_GB.jsonCLI Usage
Init
traduora init --helpinit supports:
- Input API credentials directly (
client_credentials), then prompt for project ID - Login with account/password, select a project, then create a project client (
--role admin|editor|viewer)
Project
traduora project --help
traduora project status --helpproject only provides status.
It always uses the current project from state/config.
For term/translation/export commands, project is resolved from currentProjectId in state.
Term
traduora term --help
traduora term add --help
traduora term list --help
traduora term update --help
traduora term delete --helpTranslation
traduora translation --help
traduora translation use --help
traduora translation add --help
traduora translation list --help
traduora translation update --help
traduora translation delete --helpExport
traduora export --helpConfiguration
Priority order:
- Environment variables
- Config file
- CLI options
Supported config files:
traduora.config.jsontraduora.config.tstraduora.config.jstraduora.config.mjstraduora.config.cjs
Supported environment variables:
TRADUORA_BASE_URLTRADUORA_GRANT_TYPETRADUORA_CLIENT_IDTRADUORA_CLIENT_SECRETTRADUORA_USERNAMETRADUORA_PASSWORDTRADUORA_ACCESS_TOKEN
State (currentProjectId, currentLocale) is stored in .traduora.state.json.
JavaScript SDK
ESM
import { createApi } from "@0xlimao/traduora-cli";
const { api } = await createApi();
const terms = await api.listTerms("<projectId>");
console.log(terms);CommonJS
const { createApi } = require("@0xlimao/traduora-cli");
(async () => {
const { api } = await createApi();
const terms = await api.listTerms("<projectId>");
console.log(terms);
})();For full method details, see the SDK TypeScript Reference in the docs site.
Documentation Site
- Production: https://flyinglimao.github.io/traduora-cli/
- Source:
docs/
Run locally:
cd docs
pnpm install
pnpm startDevelopment
pnpm install
pnpm build
pnpm typecheck
pnpm dev -- --helpTesting
Local Docker integration test (CLI + SDK against real Traduora instance):
pnpm test:e2e:localSee test instructions in test/README.md.
Release
- npm publish is handled by GitHub Actions with npm Trusted Publishing (OIDC)
- Docs are deployed to GitHub Pages by GitHub Actions
Contributing
Issues and pull requests are welcome:
- Issues: https://github.com/flyinglimao/traduora-cli/issues
- Repository: https://github.com/flyinglimao/traduora-cli
License
MIT. See LICENSE.
