@globalize-now/cli-client
v0.1.9
Published
CLI and library client for the Globalize translation platform
Readme
@globalize-now/cli-client
CLI and TypeScript library for the Globalize translation platform. Manage translation projects, languages, glossaries, style guides, and more from the command line or programmatically.
Installation
npm install @globalize-now/cli-clientOr run the CLI directly:
npx @globalize-now/cli-clientAuthentication
The client resolves your API key in this order:
- Environment variable -- set
GLOBALIZE_API_KEY - Config file -- reads from
~/.globalize/config.json
Manage authentication via the CLI:
globalise-now-cli auth login # Save your API key
globalise-now-cli auth status # Check current auth
globalise-now-cli auth logout # Remove saved credentialsCLI Usage
globalise-now-cli [command] [subcommand] [options]Global options:
| Flag | Description |
|------|-------------|
| --json | Output raw JSON instead of formatted tables |
Commands
| Group | Commands | Description |
|-------|----------|-------------|
| orgs | list, create, delete | Manage organisations |
| projects | list, create, get, delete | Manage translation projects |
| languages | list, get | Browse the language catalog |
| project-languages | list, add, remove | Configure languages on a project |
| repositories | list, create, delete, detect | Connect and scan git repositories |
| glossary | list, create, delete | Manage translation glossaries |
| style-guides | list, upsert, delete | Set translation style instructions |
| api-keys | list, create, revoke | Manage API keys |
| members | list, invite, remove | Manage organisation members |
Examples
# List all projects
globalise-now-cli projects list
# Create a project with English source and French/German targets
globalise-now-cli projects create "My App" en fr,de
# Connect a git repository
globalise-now-cli repositories create <project-id> https://github.com/org/repo github
# Add a glossary entry
globalise-now-cli glossary create <project-id> "Sign up" "S'inscrire" <source-lang-id> <target-lang-id>Library Usage
All CLI commands are also available as typed functions:
import { createApiClient, listProjects, createProject } from "@globalize-now/cli-client";
const client = createApiClient("glb_your_api_key");
// List projects
const projects = await listProjects(client);
// Create a project
const project = await createProject(client, "My App", "en", ["fr", "de"]);Exports
Client & Auth
createApiClient(apiKey, apiUrl?)-- create a typed API clientresolveAuth()-- resolve API key from env or config filereadConfigFile()/writeConfigFile(config)/deleteConfigFile()-- manage~/.globalize/config.json
API Functions
| Module | Functions |
|--------|-----------|
| Organisations | listOrgs, createOrg, deleteOrg |
| Projects | listProjects, createProject, getProject, deleteProject |
| Languages | listLanguages, getLanguage |
| Project Languages | listProjectLanguages, addProjectLanguage, removeProjectLanguage |
| Repositories | listRepositories, createRepository, deleteRepository, detectRepository |
| Glossary | listGlossary, createGlossaryEntry, deleteGlossaryEntry |
| Style Guides | listStyleGuides, upsertStyleGuide, deleteStyleGuide |
| API Keys | listApiKeys, createApiKey, revokeApiKey |
| Members | listMembers, inviteMember, removeMember |
Development
Requires Node.js >= 18.
cd api-client
npm install
npm run build # Generate API types from OpenAPI spec + compile TypeScript
npm run dev # Watch mode (TypeScript only)
npm run lint # ESLint + Prettier + type check
npm run format # Auto-fix lint and formattingEnvironment variables
| Variable | Description |
|----------|-------------|
| GLOBALIZE_API_KEY | API key (skips config file lookup) |
| GLOBALIZE_API_URL | Override API base URL (default: https://api.globalize.now) |
