@vocoder/cli 0.9.0 → 0.10.0

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/dist/bin.mjs CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  getPackagesToInstall,
8
8
  getSetupSnippets,
9
9
  loadVocoderConfig
10
- } from "./chunk-IZN5HVYD.mjs";
10
+ } from "./chunk-73U4VZYP.mjs";
11
11
 
12
12
  // src/bin.ts
13
13
  import { Command } from "commander";
@@ -167,7 +167,9 @@ var VocoderAPI = class {
167
167
  key: entry.key || this.stableTextKey(`${entry.text}:${index}`),
168
168
  text: entry.text,
169
169
  ...entry.context ? { context: entry.context } : {},
170
- ...entry.formality ? { formality: entry.formality } : {}
170
+ ...entry.formality ? { formality: entry.formality } : {},
171
+ ...entry.uiRole ? { uiRole: entry.uiRole } : {},
172
+ ...entry.featureArea ? { featureArea: entry.featureArea } : {}
171
173
  }));
172
174
  }
173
175
  async submitTranslation(branch, entries, targetLocales, options, repoIdentity) {
@@ -193,7 +195,8 @@ var VocoderAPI = class {
193
195
  ...options?.clientRunId ? { clientRunId: options.clientRunId } : {},
194
196
  ...repoIdentity?.repoCanonical ? { repoCanonical: repoIdentity.repoCanonical } : {},
195
197
  ...repoIdentity?.repoAppDir !== void 0 ? { repoAppDir: repoIdentity.repoAppDir } : {},
196
- ...repoIdentity?.commitSha ? { commitSha: repoIdentity.commitSha } : {}
198
+ ...repoIdentity?.commitSha ? { commitSha: repoIdentity.commitSha } : {},
199
+ ...options?.appIndustry ? { appIndustry: options.appIndustry } : {}
197
200
  })
198
201
  },
199
202
  "Translation submission failed"
@@ -3325,7 +3328,9 @@ function buildStringEntries(extractedStrings) {
3325
3328
  key: str.key,
3326
3329
  text: str.text,
3327
3330
  ...str.context ? { context: str.context } : {},
3328
- ...str.formality ? { formality: str.formality } : {}
3331
+ ...str.formality ? { formality: str.formality } : {},
3332
+ ...str.uiRole ? { uiRole: str.uiRole } : {},
3333
+ ...str.featureArea ? { featureArea: str.featureArea } : {}
3329
3334
  });
3330
3335
  continue;
3331
3336
  }
@@ -3374,9 +3379,7 @@ async function sync(options = {}) {
3374
3379
  }
3375
3380
  const spinner4 = p8.spinner();
3376
3381
  try {
3377
- spinner4.start("Detecting branch");
3378
3382
  const branch = detectBranch(options.branch);
3379
- spinner4.stop(`Branch: ${chalk8.cyan(branch)}`);
3380
3383
  spinner4.start("Loading project configuration");
3381
3384
  const localConfig = {
3382
3385
  apiKey: mergedConfig.apiKey,
@@ -3391,14 +3394,17 @@ async function sync(options = {}) {
3391
3394
  policyDefaultMaxWaitMs: apiConfig.syncPolicy.defaultMaxWaitMs,
3392
3395
  fallbackTimeoutMs: 6e4
3393
3396
  });
3397
+ const fileConfig = loadVocoderConfig(process.cwd());
3394
3398
  const config = {
3395
3399
  ...localConfig,
3396
3400
  ...apiConfig,
3397
3401
  includePattern: mergedConfig.includePattern,
3398
3402
  excludePattern: mergedConfig.excludePattern,
3399
- timeout: waitTimeoutMs
3403
+ timeout: waitTimeoutMs,
3404
+ ...fileConfig?.appIndustry ? { appIndustry: fileConfig.appIndustry } : {},
3405
+ ...fileConfig?.formality ? { formality: fileConfig.formality } : {}
3400
3406
  };
3401
- spinner4.stop("Project configuration loaded");
3407
+ spinner4.stop(`Branch: ${chalk8.cyan(branch)}`);
3402
3408
  if (!options.force && !isTargetBranch(branch, config.targetBranches)) {
3403
3409
  p8.log.warn(
3404
3410
  `Skipping translations (${chalk8.cyan(branch)} is not a target branch)`
@@ -3487,19 +3493,20 @@ async function sync(options = {}) {
3487
3493
  requestedMode,
3488
3494
  requestedMaxWaitMs: waitTimeoutMs,
3489
3495
  clientRunId: randomUUID(),
3490
- force: options.force
3496
+ force: options.force,
3497
+ // Sync appIndustry from vocoder.config.ts to ProjectApp on every push
3498
+ ...config.appIndustry ? { appIndustry: config.appIndustry } : {}
3491
3499
  },
3492
3500
  repoIdentity ? { ...repoIdentity, commitSha } : { commitSha }
3493
3501
  );
3494
- spinner4.stop(
3495
- `Submitted to API - Batch ${chalk8.cyan(batchResponse.batchId)}`
3496
- );
3502
+ spinner4.stop("Strings submitted");
3497
3503
  const effectiveMode = batchResponse.effectiveMode ?? resolveEffectiveModeFromPolicy({
3498
3504
  branch,
3499
3505
  requestedMode,
3500
3506
  policy: config.syncPolicy
3501
3507
  });
3502
3508
  if (options.verbose) {
3509
+ p8.log.info(`Batch: ${chalk8.dim(batchResponse.batchId)}`);
3503
3510
  p8.log.info(`Requested mode: ${requestedMode}`);
3504
3511
  p8.log.info(`Effective mode: ${effectiveMode}`);
3505
3512
  p8.log.info(`Wait timeout: ${waitTimeoutMs}ms`);
@@ -3508,24 +3515,17 @@ async function sync(options = {}) {
3508
3515
  }
3509
3516
  }
3510
3517
  if (batchResponse.status === "UP_TO_DATE" && batchResponse.noChanges) {
3511
- p8.log.success("No changes detected - strings are up to date");
3512
- }
3513
- p8.log.info(`New strings: ${chalk8.cyan(batchResponse.newStrings)}`);
3514
- if (batchResponse.deletedStrings && batchResponse.deletedStrings > 0) {
3515
- p8.log.info(
3516
- `Deleted strings: ${chalk8.yellow(batchResponse.deletedStrings)} (archived)`
3517
- );
3518
- }
3519
- p8.log.info(`Total strings: ${chalk8.cyan(batchResponse.totalStrings)}`);
3520
- if (batchResponse.newStrings === 0) {
3521
- p8.log.success("No new strings - using existing translations");
3518
+ p8.log.success(`Up to date \u2014 ${chalk8.cyan(batchResponse.totalStrings)} strings, no changes`);
3519
+ } else if (batchResponse.newStrings === 0) {
3520
+ const archivedNote = batchResponse.deletedStrings && batchResponse.deletedStrings > 0 ? `, ${chalk8.yellow(batchResponse.deletedStrings)} archived` : "";
3521
+ p8.log.success(`No new strings \u2014 ${chalk8.cyan(batchResponse.totalStrings)} total${archivedNote}, using existing translations`);
3522
3522
  } else {
3523
- p8.log.info(
3524
- `Syncing to ${config.targetLocales.length} locales (${config.targetLocales.join(", ")})`
3525
- );
3526
- if (batchResponse.estimatedTime) {
3527
- p8.log.info(`Estimated time: ~${batchResponse.estimatedTime}s`);
3523
+ const statParts = [`${chalk8.cyan(batchResponse.newStrings)} new, ${chalk8.cyan(batchResponse.totalStrings)} total`];
3524
+ if (batchResponse.deletedStrings && batchResponse.deletedStrings > 0) {
3525
+ statParts.push(`${chalk8.yellow(batchResponse.deletedStrings)} archived`);
3528
3526
  }
3527
+ const estTime = batchResponse.estimatedTime ? ` (~${batchResponse.estimatedTime}s)` : "";
3528
+ p8.log.info(`${statParts.join(", ")} \u2192 syncing to ${config.targetLocales.join(", ")}${estTime}`);
3529
3529
  }
3530
3530
  let artifacts = null;
3531
3531
  if (batchResponse.translations) {
@@ -3536,7 +3536,8 @@ async function sync(options = {}) {
3536
3536
  }
3537
3537
  let waitError = null;
3538
3538
  if (!artifacts && (effectiveMode === "required" || effectiveMode === "best-effort")) {
3539
- spinner4.start(`Waiting for translations (max ${waitTimeoutMs}ms)`);
3539
+ const waitTimeoutSecs = Math.round(waitTimeoutMs / 1e3);
3540
+ spinner4.start(`Waiting for translations (max ${waitTimeoutSecs}s)`);
3540
3541
  let lastProgress = 0;
3541
3542
  try {
3542
3543
  const completion = await api.waitForCompletion(