lezu 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,454 @@
1
+ # Lezu CLI
2
+
3
+ The official command-line interface for Lezu translation management platform.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ # Use directly with npx (recommended)
9
+ npx lezu
10
+
11
+ # Or install globally
12
+ npm install -g lezu
13
+ ```
14
+
15
+ ## Quick Start
16
+
17
+ 1. **Interactive Mode** (recommended for first-time users):
18
+ ```bash
19
+ npx lezu
20
+ ```
21
+
22
+ 2. **Direct Commands**:
23
+ ```bash
24
+ # Download translations
25
+ npx lezu load --project=YOUR_PROJECT_ID --api-key=YOUR_API_KEY
26
+
27
+ # Add a new translation key
28
+ npx lezu add --key=common.save --en="Save" --es="Guardar"
29
+
30
+ # Get project information
31
+ npx lezu get project
32
+
33
+ # Create a release
34
+ npx lezu release create --version=1.0.0
35
+ ```
36
+
37
+ ## Configuration
38
+
39
+ ### Environment Variables
40
+ ```bash
41
+ LEZU_PROJECT_ID=your_project_id
42
+ LEZU_API_KEY=your_api_key
43
+ LEZU_API_URL=https://api.lezu.app # Optional, defaults to production
44
+ ```
45
+
46
+ ### Configuration File
47
+ Create a `.lezurc` or `.lezurc.json` file in your project root:
48
+
49
+ ```json
50
+ {
51
+ "projectId": "your_project_id",
52
+ "apiKey": "your_api_key",
53
+ "dest": "./src/i18n",
54
+ "format": "json",
55
+ "environment": "production"
56
+ }
57
+ ```
58
+
59
+ ### Configuration Priority
60
+ 1. Command-line arguments (highest priority)
61
+ 2. Environment variables
62
+ 3. Configuration file
63
+ 4. Defaults (lowest priority)
64
+
65
+ ## Commands
66
+
67
+ ### `lezu load`
68
+ Download translation files from Lezu.
69
+
70
+ **Usage:**
71
+ ```bash
72
+ lezu load [options]
73
+ ```
74
+
75
+ **Options:**
76
+ - `-p, --project <id>` - Project ID
77
+ - `-k, --api-key <key>` - API key
78
+ - `-d, --dest <path>` - Destination folder (default: `./src/i18n`)
79
+ - `-f, --format <format>` - Output format: `json`, `js`, `ts`, `yaml`, `po` (default: `json`)
80
+ - `-l, --languages <languages>` - Comma-separated list of languages to download
81
+ - `-r, --release <id>` - Specific release ID to download
82
+ - `-e, --environment <env>` - Environment (default: `production`)
83
+ - `--flatten` - Flatten nested keys (e.g., `common.save` instead of `{ common: { save: "..." } }`)
84
+ - `--namespace` - Use namespace folder structure (`locales/en.json`)
85
+ - `--include-empty` - Include empty translations
86
+ - `-w, --watch` - Watch for changes and auto-update
87
+ - `--watch-interval <ms>` - Watch interval in milliseconds (default: `5000`)
88
+ - `--api-url <url>` - API URL (default: `https://api.lezu.app`)
89
+
90
+ **Examples:**
91
+ ```bash
92
+ # Basic usage
93
+ lezu load --project=proj_123 --api-key=lk_456
94
+
95
+ # Download specific languages only
96
+ lezu load --languages=en,es,fr
97
+
98
+ # Download from a specific release
99
+ lezu load --release=rel_789
100
+
101
+ # Flatten keys and output as TypeScript
102
+ lezu load --flatten --format=ts
103
+
104
+ # Export as gettext .po files
105
+ lezu load --format=po
106
+
107
+ # Watch mode for development
108
+ lezu load --watch --watch-interval=2000
109
+ ```
110
+
111
+ **Output Formats:**
112
+
113
+ - **JSON** (default):
114
+ ```json
115
+ {
116
+ "common": {
117
+ "save": "Save",
118
+ "cancel": "Cancel"
119
+ }
120
+ }
121
+ ```
122
+
123
+ - **JavaScript (ES modules)**:
124
+ ```javascript
125
+ export default {
126
+ common: {
127
+ save: "Save",
128
+ cancel: "Cancel"
129
+ }
130
+ }
131
+ ```
132
+
133
+ - **TypeScript**:
134
+ ```typescript
135
+ export default {
136
+ common: {
137
+ save: "Save",
138
+ cancel: "Cancel"
139
+ }
140
+ } as const
141
+ ```
142
+
143
+ - **YAML**:
144
+ ```yaml
145
+ common:
146
+ save: Save
147
+ cancel: Cancel
148
+ ```
149
+
150
+ - **Gettext (.po)**:
151
+ ```po
152
+ # Translation file for en
153
+ # Generated by Lezu CLI on 2024-01-15T10:30:00.000Z
154
+ msgid ""
155
+ msgstr ""
156
+ "Language: en\n"
157
+ "MIME-Version: 1.0\n"
158
+ "Content-Type: text/plain; charset=UTF-8\n"
159
+ "Content-Transfer-Encoding: 8bit\n"
160
+ "Generated-By: Lezu CLI\n"
161
+
162
+ msgid "common.save"
163
+ msgstr "Save"
164
+
165
+ msgid "common.cancel"
166
+ msgstr "Cancel"
167
+ ```
168
+
169
+ ### `lezu add`
170
+ Add a new translation key with values.
171
+
172
+ **Usage:**
173
+ ```bash
174
+ lezu add --key=<key> [options]
175
+ ```
176
+
177
+ **Options:**
178
+ - `-k, --key <key>` - **Required.** Translation key (e.g., "common.save")
179
+ - `-v, --value <value>` - Value for the source language
180
+ - `--en <value>` - English translation
181
+ - `--es <value>` - Spanish translation
182
+ - `--fr <value>` - French translation
183
+ - `--de <value>` - German translation
184
+ - `--nl <value>` - Dutch translation
185
+ - `--it <value>` - Italian translation
186
+ - `--pt <value>` - Portuguese translation
187
+ - `--ru <value>` - Russian translation
188
+ - `--ja <value>` - Japanese translation
189
+ - `--ko <value>` - Korean translation
190
+ - `--zh <value>` - Chinese translation
191
+ - `--ar <value>` - Arabic translation
192
+ - `-d, --description <desc>` - Description for the translation key
193
+ - `--auto` - Auto-translate to all enabled languages using AI
194
+ - `-p, --project <id>` - Project ID
195
+ - `-a, --api-key <key>` - API key
196
+
197
+ **Examples:**
198
+ ```bash
199
+ # Add key with specific translations
200
+ lezu add --key=common.save --en="Save" --es="Guardar" --fr="Enregistrer"
201
+
202
+ # Add key with auto-translation
203
+ lezu add --key=common.delete --en="Delete" --auto
204
+
205
+ # Add key with description
206
+ lezu add --key=error.validation --description="Validation error message" --en="This field is required"
207
+ ```
208
+
209
+ **Subscription Requirements:**
210
+ - **Free**: Cannot add keys
211
+ - **Basic+**: Can add keys and translations
212
+ - **Pro+**: Can add keys with auto-translation
213
+
214
+ ### `lezu get`
215
+ Get information about your project.
216
+
217
+ #### `lezu get project`
218
+ Get project information and statistics.
219
+
220
+ **Usage:**
221
+ ```bash
222
+ lezu get project [options]
223
+ ```
224
+
225
+ **Options:**
226
+ - `--stats` - Include detailed statistics
227
+ - `--json` - Output as JSON
228
+ - `-p, --project <id>` - Project ID
229
+ - `-a, --api-key <key>` - API key
230
+
231
+ **Example:**
232
+ ```bash
233
+ lezu get project --stats
234
+ ```
235
+
236
+ #### `lezu get languages`
237
+ List all languages in your project.
238
+
239
+ **Usage:**
240
+ ```bash
241
+ lezu get languages [options]
242
+ ```
243
+
244
+ **Options:**
245
+ - `--include-disabled` - Include disabled languages
246
+ - `--json` - Output as JSON
247
+ - `-p, --project <id>` - Project ID
248
+ - `-a, --api-key <key>` - API key
249
+
250
+ **Example:**
251
+ ```bash
252
+ lezu get languages --include-disabled
253
+ ```
254
+
255
+ #### `lezu get releases`
256
+ List all releases in your project.
257
+
258
+ **Usage:**
259
+ ```bash
260
+ lezu get releases [options]
261
+ ```
262
+
263
+ **Options:**
264
+ - `-e, --environment <env>` - Environment (default: `production`)
265
+ - `--limit <n>` - Limit number of results (default: `10`)
266
+ - `--json` - Output as JSON
267
+ - `-p, --project <id>` - Project ID
268
+ - `-a, --api-key <key>` - API key
269
+
270
+ **Example:**
271
+ ```bash
272
+ lezu get releases --environment=staging --limit=20
273
+ ```
274
+
275
+ ### `lezu release`
276
+ Manage releases.
277
+
278
+ #### `lezu release create`
279
+ Create a new release.
280
+
281
+ **Usage:**
282
+ ```bash
283
+ lezu release create [options]
284
+ ```
285
+
286
+ **Options:**
287
+ - `-v, --version <version>` - Release version (e.g., "1.0.0")
288
+ - `-n, --name <name>` - Release name
289
+ - `-d, --description <desc>` - Release description
290
+ - `-e, --environment <env>` - Environment (default: `production`)
291
+ - `--reviewed-only` - Include only reviewed translations
292
+ - `--set-current` - Set this release as the current release
293
+ - `--timestamp <iso>` - Specific timestamp for the release (ISO format)
294
+ - `--languages <langs>` - Comma-separated list of languages to include
295
+ - `--json` - Output as JSON
296
+ - `-p, --project <id>` - Project ID
297
+ - `-a, --api-key <key>` - API key
298
+
299
+ **Examples:**
300
+ ```bash
301
+ # Create a basic release
302
+ lezu release create --version=1.0.0
303
+
304
+ # Create release with specific timestamp and set as current
305
+ lezu release create --version=1.1.0 --timestamp=2024-01-15T10:00:00Z --set-current
306
+
307
+ # Create release with only reviewed translations
308
+ lezu release create --version=1.0.1 --reviewed-only --name="Hotfix Release"
309
+ ```
310
+
311
+ **Subscription Requirements:**
312
+ - **Free**: Cannot create releases
313
+ - **Basic**: Cannot create releases
314
+ - **Pro+**: Can create releases
315
+
316
+ #### `lezu release current <releaseId>`
317
+ Set a release as current.
318
+
319
+ **Usage:**
320
+ ```bash
321
+ lezu release current <releaseId> [options]
322
+ ```
323
+
324
+ **Example:**
325
+ ```bash
326
+ lezu release current rel_123abc456def
327
+ ```
328
+
329
+ #### `lezu release list`
330
+ List all releases (alias for `lezu get releases`).
331
+
332
+ ## API Keys and Authentication
333
+
334
+ ### Getting an API Key
335
+ 1. Go to [Lezu Dashboard](https://app.lezu.app)
336
+ 2. Navigate to your project settings
337
+ 3. Go to the "API Keys" section
338
+ 4. Click "Create API Key"
339
+ 5. Copy the generated key (it will only be shown once)
340
+
341
+ ### API Key Scopes
342
+ API keys have different capabilities based on your subscription:
343
+
344
+ **Free Plan:**
345
+ - ✅ Download translations (`load`)
346
+ - ✅ Get project information (`get`)
347
+ - ❌ Add keys (`add`)
348
+ - ❌ Create releases (`release create`)
349
+
350
+ **Basic Plan:**
351
+ - ✅ All Free features
352
+ - ✅ Add translation keys (`add`)
353
+ - ✅ Update translations
354
+ - ❌ Create releases
355
+
356
+ **Pro+ Plans:**
357
+ - ✅ All Basic features
358
+ - ✅ Create releases (`release create`)
359
+ - ✅ Auto-translation with AI
360
+ - ✅ Higher rate limits
361
+
362
+ ### Rate Limits
363
+ Rate limits are applied per API key per minute:
364
+
365
+ | Plan | Requests/min | Translations/min |
366
+ |------|-------------|------------------|
367
+ | Free | 50 | 10 |
368
+ | Basic | 500 | 100 |
369
+ | Pro | 5,000 | 1,000 |
370
+ | Team | 10,000 | 2,000 |
371
+ | Enterprise | 50,000 | 10,000 |
372
+
373
+ ## Error Handling
374
+
375
+ The CLI provides clear error messages for common issues:
376
+
377
+ - **401 Unauthorized**: Invalid API key
378
+ - **402 Payment Required**: Subscription required or expired
379
+ - **403 Forbidden**: Feature requires subscription upgrade
380
+ - **404 Not Found**: Project or resource not found
381
+ - **429 Too Many Requests**: Rate limit exceeded
382
+
383
+ ## Troubleshooting
384
+
385
+ ### Common Issues
386
+
387
+ **"Configuration errors: Project ID is required"**
388
+ - Set `LEZU_PROJECT_ID` environment variable
389
+ - Or use `--project` flag
390
+ - Or add `projectId` to `.lezurc` file
391
+
392
+ **"API request failed: 401 Unauthorized"**
393
+ - Check your API key is correct
394
+ - Ensure the API key hasn't expired
395
+ - Verify the API key belongs to the correct project
396
+
397
+ **"Subscription upgrade required"**
398
+ - Your current plan doesn't support this feature
399
+ - Upgrade your subscription at [app.lezu.app/billing](https://app.lezu.app/billing)
400
+
401
+ **"Rate limit exceeded"**
402
+ - Wait for the rate limit window to reset
403
+ - Consider upgrading your subscription for higher limits
404
+
405
+ ### Debug Mode
406
+ Set the `DEBUG` environment variable to see detailed logs:
407
+
408
+ ```bash
409
+ DEBUG=lezu* npx lezu load
410
+ ```
411
+
412
+ ## Integration Examples
413
+
414
+ ### CI/CD Pipeline
415
+ ```yaml
416
+ # GitHub Actions example
417
+ - name: Download translations
418
+ run: npx lezu load
419
+ env:
420
+ LEZU_PROJECT_ID: ${{ secrets.LEZU_PROJECT_ID }}
421
+ LEZU_API_KEY: ${{ secrets.LEZU_API_KEY }}
422
+ ```
423
+
424
+ ### Package.json Scripts
425
+ ```json
426
+ {
427
+ "scripts": {
428
+ "i18n:pull": "lezu load",
429
+ "i18n:watch": "lezu load --watch",
430
+ "i18n:release": "lezu release create --version=$npm_package_version"
431
+ }
432
+ }
433
+ ```
434
+
435
+ ### Pre-build Hook
436
+ ```json
437
+ {
438
+ "scripts": {
439
+ "prebuild": "lezu load --format=js",
440
+ "build": "vite build"
441
+ }
442
+ }
443
+ ```
444
+
445
+ ## Support
446
+
447
+ - 📖 [Documentation](https://docs.lezu.app)
448
+ - 💬 [Discord Community](https://discord.gg/lezu)
449
+ - 📧 [Email Support](mailto:support@lezu.app)
450
+ - 🐛 [Report Issues](https://github.com/lezu-app/cli/issues)
451
+
452
+ ## License
453
+
454
+ MIT License - see [LICENSE](LICENSE) file for details.
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ LezuApiClient
4
+ } from "./chunk-UN7HQJOX.js";
5
+ export {
6
+ LezuApiClient
7
+ };
8
+ //# sourceMappingURL=api-CS5JMU72.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,249 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ loadConfig,
4
+ validateConfig
5
+ } from "./chunk-VGQICGPH.js";
6
+ import {
7
+ LezuApiClient
8
+ } from "./chunk-UN7HQJOX.js";
9
+
10
+ // src/commands/load.ts
11
+ import { Command } from "commander";
12
+ import chalk from "chalk";
13
+ import ora from "ora";
14
+
15
+ // src/writer.ts
16
+ import { writeFileSync, mkdirSync } from "fs";
17
+ import { dirname, join } from "path";
18
+ var TranslationWriter = class {
19
+ config;
20
+ constructor(config) {
21
+ this.config = config;
22
+ }
23
+ write(translations) {
24
+ mkdirSync(this.config.dest, { recursive: true });
25
+ for (const [language, content] of Object.entries(translations)) {
26
+ const processedContent = this.processContent(content);
27
+ const filePath = this.getFilePath(language);
28
+ mkdirSync(dirname(filePath), { recursive: true });
29
+ const fileContent = this.formatContent(processedContent, language);
30
+ writeFileSync(filePath, fileContent, "utf-8");
31
+ console.log(`\u2705 Written ${language} translations to ${filePath}`);
32
+ }
33
+ }
34
+ processContent(content) {
35
+ if (this.config.flatten) {
36
+ return this.flattenObject(content);
37
+ }
38
+ if (!this.config.includeEmpty) {
39
+ return this.removeEmptyValues(content);
40
+ }
41
+ return content;
42
+ }
43
+ flattenObject(obj, prefix = "") {
44
+ const result = {};
45
+ for (const [key, value] of Object.entries(obj)) {
46
+ const newKey = prefix ? `${prefix}.${key}` : key;
47
+ if (typeof value === "object" && value !== null && !Array.isArray(value)) {
48
+ Object.assign(result, this.flattenObject(value, newKey));
49
+ } else {
50
+ result[newKey] = value;
51
+ }
52
+ }
53
+ return result;
54
+ }
55
+ removeEmptyValues(obj) {
56
+ if (typeof obj !== "object" || obj === null) {
57
+ return obj;
58
+ }
59
+ const result = {};
60
+ for (const [key, value] of Object.entries(obj)) {
61
+ if (typeof value === "object" && value !== null) {
62
+ const cleaned = this.removeEmptyValues(value);
63
+ if (Object.keys(cleaned).length > 0) {
64
+ result[key] = cleaned;
65
+ }
66
+ } else if (value !== "" && value !== null && value !== void 0) {
67
+ result[key] = value;
68
+ }
69
+ }
70
+ return result;
71
+ }
72
+ getFilePath(language) {
73
+ const extension = this.getFileExtension();
74
+ if (this.config.namespace) {
75
+ return join(this.config.dest, "locales", `${language}.${extension}`);
76
+ } else {
77
+ return join(this.config.dest, `${language}.${extension}`);
78
+ }
79
+ }
80
+ getFileExtension() {
81
+ switch (this.config.format) {
82
+ case "json":
83
+ return "json";
84
+ case "js":
85
+ return "js";
86
+ case "ts":
87
+ return "ts";
88
+ case "yaml":
89
+ return "yaml";
90
+ case "po":
91
+ return "po";
92
+ default:
93
+ return "json";
94
+ }
95
+ }
96
+ formatContent(content, language) {
97
+ switch (this.config.format) {
98
+ case "json":
99
+ return JSON.stringify(content, null, 2);
100
+ case "js":
101
+ return `export default ${JSON.stringify(content, null, 2)}`;
102
+ case "ts":
103
+ return `const translations = ${JSON.stringify(content, null, 2)} as const
104
+
105
+ export default translations`;
106
+ case "yaml":
107
+ return this.toYaml(content);
108
+ case "po":
109
+ return this.toPo(content, language);
110
+ default:
111
+ return JSON.stringify(content, null, 2);
112
+ }
113
+ }
114
+ toYaml(obj, indent = 0) {
115
+ let result = "";
116
+ const spaces = " ".repeat(indent);
117
+ for (const [key, value] of Object.entries(obj)) {
118
+ if (typeof value === "object" && value !== null) {
119
+ result += `${spaces}${key}:
120
+ ${this.toYaml(value, indent + 2)}`;
121
+ } else {
122
+ const escapedValue = String(value).includes(":") || String(value).includes("#") ? `"${String(value).replace(/"/g, '\\"')}"` : value;
123
+ result += `${spaces}${key}: ${escapedValue}
124
+ `;
125
+ }
126
+ }
127
+ return result;
128
+ }
129
+ toPo(obj, language) {
130
+ const now = (/* @__PURE__ */ new Date()).toISOString();
131
+ let result = `# Translation file for ${language}
132
+ # Generated by Lezu CLI on ${now}
133
+ msgid ""
134
+ msgstr ""
135
+ "Language: ${language}\\n"
136
+ "MIME-Version: 1.0\\n"
137
+ "Content-Type: text/plain; charset=UTF-8\\n"
138
+ "Content-Transfer-Encoding: 8bit\\n"
139
+ "Generated-By: Lezu CLI\\n"
140
+
141
+ `;
142
+ const flatEntries = this.flattenForPo(obj);
143
+ for (const [key, value] of Object.entries(flatEntries)) {
144
+ const escapedKey = this.escapePoString(key);
145
+ const escapedValue = this.escapePoString(String(value));
146
+ result += `msgid "${escapedKey}"
147
+ `;
148
+ result += `msgstr "${escapedValue}"
149
+
150
+ `;
151
+ }
152
+ return result;
153
+ }
154
+ flattenForPo(obj, prefix = "") {
155
+ const result = {};
156
+ for (const [key, value] of Object.entries(obj)) {
157
+ const fullKey = prefix ? `${prefix}.${key}` : key;
158
+ if (typeof value === "object" && value !== null && !Array.isArray(value)) {
159
+ Object.assign(result, this.flattenForPo(value, fullKey));
160
+ } else {
161
+ result[fullKey] = String(value);
162
+ }
163
+ }
164
+ return result;
165
+ }
166
+ escapePoString(str) {
167
+ return str.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t");
168
+ }
169
+ };
170
+
171
+ // src/commands/load.ts
172
+ function createLoadCommand() {
173
+ const command = new Command("load").description("Download translation files from Lezu").option("-p, --project <id>", "Project ID").option("-k, --api-key <key>", "API key").option("-d, --dest <path>", "Destination folder", "./src/i18n").option("-f, --format <format>", "Output format (json, js, ts, yaml, po)", "json").option("-l, --languages <languages>", "Comma-separated list of languages to download").option("-r, --release <id>", "Specific release ID").option("-e, --environment <env>", "Environment", "production").option("--api-url <url>", "API URL", "https://api.lezu.app").option("--flatten", "Flatten nested keys").option("--namespace", "Use namespace folder structure").option("--include-empty", "Include empty translations").option("-w, --watch", "Watch for changes").option("--watch-interval <ms>", "Watch interval in milliseconds", "5000").action(async (options) => {
174
+ try {
175
+ if (options.languages) {
176
+ options.languages = options.languages.split(",").map((l) => l.trim());
177
+ }
178
+ if (options.watchInterval) {
179
+ options.watchInterval = parseInt(options.watchInterval, 10);
180
+ }
181
+ const config = loadConfig(options);
182
+ const errors = validateConfig(config);
183
+ if (errors.length > 0) {
184
+ console.error(chalk.red("Configuration errors:"));
185
+ errors.forEach((error) => console.error(chalk.red(` \u2022 ${error}`)));
186
+ process.exit(1);
187
+ }
188
+ await syncTranslations(config);
189
+ if (config.watch) {
190
+ console.log(chalk.cyan(`
191
+ \u{1F441} Watching for changes every ${config.watchInterval}ms...`));
192
+ console.log(chalk.gray("Press Ctrl+C to stop"));
193
+ setInterval(async () => {
194
+ console.log(chalk.gray("\n\u{1F504} Checking for updates..."));
195
+ await syncTranslations(config);
196
+ }, config.watchInterval);
197
+ }
198
+ } catch (error) {
199
+ console.error(chalk.red("\n\u274C Error:"), error instanceof Error ? error.message : error);
200
+ process.exit(1);
201
+ }
202
+ });
203
+ return command;
204
+ }
205
+ async function syncTranslations(config) {
206
+ const spinner = ora("Connecting to Lezu API...").start();
207
+ try {
208
+ const client = new LezuApiClient(config);
209
+ if (!config.release && config.environment) {
210
+ spinner.text = "Fetching latest release...";
211
+ const latestRelease = await client.getLatestRelease();
212
+ if (latestRelease) {
213
+ config.release = latestRelease;
214
+ spinner.succeed(`Using latest release: ${latestRelease}`);
215
+ spinner.start("Fetching translations...");
216
+ } else {
217
+ spinner.info("No releases found, fetching current translations...");
218
+ spinner.start();
219
+ }
220
+ }
221
+ spinner.text = "Fetching translations...";
222
+ const response = await client.getTranslations();
223
+ if (!response.translations || Object.keys(response.translations).length === 0) {
224
+ spinner.fail("No translations found");
225
+ return;
226
+ }
227
+ spinner.succeed(`Fetched translations for ${Object.keys(response.translations).length} languages`);
228
+ const writer = new TranslationWriter(config);
229
+ writer.write(response.translations);
230
+ console.log(chalk.green("\n\u2728 Translations synced successfully!"));
231
+ console.log(chalk.gray("\nSummary:"));
232
+ console.log(chalk.gray(` \u2022 Project: ${config.projectId}`));
233
+ console.log(chalk.gray(` \u2022 Languages: ${Object.keys(response.translations).join(", ")}`));
234
+ console.log(chalk.gray(` \u2022 Destination: ${config.dest}`));
235
+ console.log(chalk.gray(` \u2022 Format: ${config.format}`));
236
+ if (response.meta?.version) {
237
+ console.log(chalk.gray(` \u2022 Version: ${response.meta.version}`));
238
+ }
239
+ } catch (error) {
240
+ spinner.fail("Failed to sync translations");
241
+ throw error;
242
+ }
243
+ }
244
+
245
+ export {
246
+ createLoadCommand,
247
+ syncTranslations
248
+ };
249
+ //# sourceMappingURL=chunk-2MDUFSO7.js.map