{"library":"loco-cli","title":"Loco CLI","description":"Loco CLI is a command-line interface tool designed to automate the synchronization of project translations with the Loco localization platform (localise.biz). It facilitates both pulling translations from Loco into your local project and pushing local changes back to Loco. The current stable version is 3.4.0, with a fairly active release cadence, frequently adding new features, improving types, and updating dependencies as seen in recent changelogs. A key differentiator is its focus as a Node.js-based solution, offering flexibility in configuration via `package.json` or various `.locorc` files, supporting both JSON and YAML formats, and now providing a dedicated documentation website. It aims to streamline the localization workflow for developers using JavaScript/TypeScript projects.","language":"javascript","status":"active","last_verified":"Wed Apr 22","install":{"commands":["npm install loco-cli"],"cli":{"name":"loco","version":null}},"imports":["import { run } from 'loco-cli';","import type { LocoConfig } from 'loco-cli';","import type { LocoCommandOptions } from 'loco-cli';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { run } from 'loco-cli';\nimport path from 'node:path';\n\nasync function syncTranslations() {\n  console.log('Starting translation sync...');\n  try {\n    // Example: Programmatically run the 'pull' command\n    // This assumes `run` function can accept arguments programmatically.\n    // In typical usage, you'd use 'npx loco-cli pull' from the terminal.\n    await run(['pull', '--config', path.resolve(process.cwd(), '.locorc.js')], { \n      cwd: process.cwd(),\n      // Pass environment variables or specific options needed by the CLI\n      env: { LOCO_API_KEY: process.env.LOCO_API_KEY ?? '', ...process.env }\n    });\n    console.log('Translations pulled successfully!');\n\n    // Example: Programmatically run the 'push' command with a specific tag\n    await run(['push', '--tag', 'web-app', '--yes'], { \n      cwd: process.cwd(),\n      env: { LOCO_API_KEY: process.env.LOCO_API_KEY ?? '', ...process.env }\n    });\n    console.log('Translations pushed successfully!');\n\n  } catch (error) {\n    console.error('Error during translation sync:', error);\n    process.exit(1);\n  }\n}\n\nsyncTranslations();","lang":"typescript","description":"Demonstrates programmatic execution of `loco-cli` commands ('pull' and 'push') within a TypeScript environment, including configuration loading and API key handling.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}