lingo.dev 0.79.1 → 0.79.2

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/build/cli.mjs CHANGED
@@ -854,10 +854,14 @@ function getBuckets(i18nConfig) {
854
854
  const result = Object.entries(i18nConfig.buckets).map(([bucketType, bucketEntry]) => {
855
855
  const includeItems = bucketEntry.include.map((item) => resolveBucketItem(item));
856
856
  const excludeItems = bucketEntry.exclude?.map((item) => resolveBucketItem(item));
857
- return {
857
+ const config = {
858
858
  type: bucketType,
859
- config: extractPathPatterns(i18nConfig.locale.source, includeItems, excludeItems)
859
+ paths: extractPathPatterns(i18nConfig.locale.source, includeItems, excludeItems)
860
860
  };
861
+ if (bucketEntry.injectLocale) {
862
+ config.injectLocale = bucketEntry.injectLocale;
863
+ }
864
+ return config;
861
865
  });
862
866
  return result;
863
867
  }
@@ -947,7 +951,7 @@ var files_default = new Command4().command("files").description("Print out the l
947
951
  }
948
952
  const buckets = getBuckets(i18nConfig);
949
953
  for (const bucket of buckets) {
950
- for (const bucketConfig of bucket.config) {
954
+ for (const bucketConfig of bucket.paths) {
951
955
  const sourceLocale = resolveOverriddenLocale2(i18nConfig.locale.source, bucketConfig.delimiter);
952
956
  const sourcePath = bucketConfig.pathPattern.replace(/\[locale\]/g, sourceLocale);
953
957
  const targetPaths = i18nConfig.locale.targets.map((_targetLocale) => {
@@ -987,7 +991,7 @@ import { bucketTypeSchema, localeCodeSchema, resolveOverriddenLocale as resolveO
987
991
  import { LingoDotDevEngine } from "@lingo.dev/_sdk";
988
992
  import { Command as Command6 } from "interactive-commander";
989
993
  import Z4 from "zod";
990
- import _19 from "lodash";
994
+ import _20 from "lodash";
991
995
  import Ora5 from "ora";
992
996
 
993
997
  // src/cli/loaders/_utils.ts
@@ -1194,7 +1198,7 @@ function createTextFileLoader(pathPattern) {
1194
1198
  const trimmedResult = result.trim();
1195
1199
  return trimmedResult;
1196
1200
  },
1197
- async push(locale, data, _21, originalLocale) {
1201
+ async push(locale, data, _22, originalLocale) {
1198
1202
  const draftPath = pathPattern.replaceAll("[locale]", locale);
1199
1203
  const finalPath = path10.resolve(draftPath);
1200
1204
  const dirPath = path10.dirname(finalPath);
@@ -1636,7 +1640,7 @@ function createPropertiesLoader() {
1636
1640
  return result;
1637
1641
  },
1638
1642
  async push(locale, payload) {
1639
- const result = Object.entries(payload).filter(([_21, value]) => value != null).map(([key, value]) => `${key}=${value}`).join("\n");
1643
+ const result = Object.entries(payload).filter(([_22, value]) => value != null).map(([key, value]) => `${key}=${value}`).join("\n");
1640
1644
  return result;
1641
1645
  }
1642
1646
  });
@@ -1903,10 +1907,10 @@ function createUnlocalizableLoader(isCacheRestore = false, returnUnlocalizedKeys
1903
1907
  }
1904
1908
  }
1905
1909
  return false;
1906
- }).map(([key, _21]) => key);
1907
- const result = _10.omitBy(input2, (_21, key) => passthroughKeys.includes(key));
1910
+ }).map(([key, _22]) => key);
1911
+ const result = _10.omitBy(input2, (_22, key) => passthroughKeys.includes(key));
1908
1912
  if (returnUnlocalizedKeys) {
1909
- result.unlocalizable = _10.omitBy(input2, (_21, key) => !passthroughKeys.includes(key));
1913
+ result.unlocalizable = _10.omitBy(input2, (_22, key) => !passthroughKeys.includes(key));
1910
1914
  }
1911
1915
  return result;
1912
1916
  },
@@ -2989,6 +2993,34 @@ function parseVueFile(input2) {
2989
2993
  return { before, after, i18n };
2990
2994
  }
2991
2995
 
2996
+ // src/cli/loaders/inject-locale.ts
2997
+ import _18 from "lodash";
2998
+ function createInjectLocaleLoader(injectLocaleKeys) {
2999
+ return createLoader({
3000
+ async pull(locale, data) {
3001
+ if (!injectLocaleKeys) {
3002
+ return data;
3003
+ }
3004
+ const omitKeys = injectLocaleKeys.filter((key) => {
3005
+ return _18.get(data, key) === locale;
3006
+ });
3007
+ const result = _18.omit(data, omitKeys);
3008
+ return result;
3009
+ },
3010
+ async push(locale, data, originalInput, originalLocale) {
3011
+ if (!injectLocaleKeys) {
3012
+ return data;
3013
+ }
3014
+ injectLocaleKeys.forEach((key) => {
3015
+ if (_18.get(originalInput, key) === originalLocale) {
3016
+ _18.set(data, key, locale);
3017
+ }
3018
+ });
3019
+ return data;
3020
+ }
3021
+ });
3022
+ }
3023
+
2992
3024
  // src/cli/loaders/index.ts
2993
3025
  function createBucketLoader(bucketType, bucketPathPattern, options) {
2994
3026
  switch (bucketType) {
@@ -3023,6 +3055,7 @@ function createBucketLoader(bucketType, bucketPathPattern, options) {
3023
3055
  createTextFileLoader(bucketPathPattern),
3024
3056
  createPrettierLoader({ parser: "json", bucketPathPattern }),
3025
3057
  createJsonLoader(),
3058
+ createInjectLocaleLoader(options.injectLocale),
3026
3059
  createFlatLoader(),
3027
3060
  createSyncLoader(),
3028
3061
  createUnlocalizableLoader(options.isCacheRestore, options.returnUnlocalizedKeys)
@@ -3168,7 +3201,7 @@ import path12 from "path";
3168
3201
  import Z3 from "zod";
3169
3202
  import YAML3 from "yaml";
3170
3203
  import { MD5 } from "object-hash";
3171
- import _18 from "lodash";
3204
+ import _19 from "lodash";
3172
3205
  function createLockfileHelper() {
3173
3206
  return {
3174
3207
  isLockfileExists: () => {
@@ -3178,23 +3211,23 @@ function createLockfileHelper() {
3178
3211
  registerSourceData: (pathPattern, sourceData) => {
3179
3212
  const lockfile = _loadLockfile();
3180
3213
  const sectionKey = MD5(pathPattern);
3181
- const sectionChecksums = _18.mapValues(sourceData, (value) => MD5(value));
3214
+ const sectionChecksums = _19.mapValues(sourceData, (value) => MD5(value));
3182
3215
  lockfile.checksums[sectionKey] = sectionChecksums;
3183
3216
  _saveLockfile(lockfile);
3184
3217
  },
3185
3218
  registerPartialSourceData: (pathPattern, partialSourceData) => {
3186
3219
  const lockfile = _loadLockfile();
3187
3220
  const sectionKey = MD5(pathPattern);
3188
- const sectionChecksums = _18.mapValues(partialSourceData, (value) => MD5(value));
3189
- lockfile.checksums[sectionKey] = _18.merge({}, lockfile.checksums[sectionKey] ?? {}, sectionChecksums);
3221
+ const sectionChecksums = _19.mapValues(partialSourceData, (value) => MD5(value));
3222
+ lockfile.checksums[sectionKey] = _19.merge({}, lockfile.checksums[sectionKey] ?? {}, sectionChecksums);
3190
3223
  _saveLockfile(lockfile);
3191
3224
  },
3192
3225
  extractUpdatedData: (pathPattern, sourceData) => {
3193
3226
  const lockfile = _loadLockfile();
3194
3227
  const sectionKey = MD5(pathPattern);
3195
- const currentChecksums = _18.mapValues(sourceData, (value) => MD5(value));
3228
+ const currentChecksums = _19.mapValues(sourceData, (value) => MD5(value));
3196
3229
  const savedChecksums = lockfile.checksums[sectionKey] || {};
3197
- const updatedData = _18.pickBy(sourceData, (value, key) => savedChecksums[key] !== currentChecksums[key]);
3230
+ const updatedData = _19.pickBy(sourceData, (value, key) => savedChecksums[key] !== currentChecksums[key]);
3198
3231
  return updatedData;
3199
3232
  }
3200
3233
  };
@@ -3346,11 +3379,9 @@ var i18n_default = new Command6().command("i18n").description("Run Localization
3346
3379
  ora.succeed("Buckets retrieved");
3347
3380
  if (flags.file?.length) {
3348
3381
  buckets = buckets.map((bucket) => {
3349
- const config = bucket.config.filter(
3350
- (config2) => flags.file.find((file) => config2.pathPattern?.match(file))
3351
- );
3352
- return { ...bucket, config };
3353
- }).filter((bucket) => bucket.config.length > 0);
3382
+ const paths = bucket.paths.filter((path15) => flags.file.find((file) => path15.pathPattern?.match(file)));
3383
+ return { ...bucket, paths };
3384
+ }).filter((bucket) => bucket.paths.length > 0);
3354
3385
  if (buckets.length === 0) {
3355
3386
  ora.fail("No buckets found. All buckets were filtered out by --file option.");
3356
3387
  process.exit(1);
@@ -3358,8 +3389,8 @@ var i18n_default = new Command6().command("i18n").description("Run Localization
3358
3389
  ora.info(`\x1B[36mProcessing only filtered buckets:\x1B[0m`);
3359
3390
  buckets.map((bucket) => {
3360
3391
  ora.info(` ${bucket.type}:`);
3361
- bucket.config.forEach((config) => {
3362
- ora.info(` - ${config.pathPattern}`);
3392
+ bucket.paths.forEach((path15) => {
3393
+ ora.info(` - ${path15.pathPattern}`);
3363
3394
  });
3364
3395
  });
3365
3396
  }
@@ -3370,16 +3401,17 @@ var i18n_default = new Command6().command("i18n").description("Run Localization
3370
3401
  if (!lockfileHelper.isLockfileExists()) {
3371
3402
  ora.start("Creating i18n.lock...");
3372
3403
  for (const bucket of buckets) {
3373
- for (const bucketConfig of bucket.config) {
3374
- const sourceLocale = resolveOverriddenLocale3(i18nConfig.locale.source, bucketConfig.delimiter);
3375
- const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern, {
3404
+ for (const bucketPath of bucket.paths) {
3405
+ const sourceLocale = resolveOverriddenLocale3(i18nConfig.locale.source, bucketPath.delimiter);
3406
+ const bucketLoader = createBucketLoader(bucket.type, bucketPath.pathPattern, {
3376
3407
  isCacheRestore: false,
3377
- defaultLocale: sourceLocale
3408
+ defaultLocale: sourceLocale,
3409
+ injectLocale: bucket.injectLocale
3378
3410
  });
3379
3411
  bucketLoader.setDefaultLocale(sourceLocale);
3380
3412
  await bucketLoader.init();
3381
3413
  const sourceData = await bucketLoader.pull(i18nConfig.locale.source);
3382
- lockfileHelper.registerSourceData(bucketConfig.pathPattern, sourceData);
3414
+ lockfileHelper.registerSourceData(bucketPath.pathPattern, sourceData);
3383
3415
  }
3384
3416
  }
3385
3417
  ora.succeed("i18n.lock created");
@@ -3393,13 +3425,14 @@ var i18n_default = new Command6().command("i18n").description("Run Localization
3393
3425
  const cacheOra = Ora5({ indent: 2 });
3394
3426
  for (const bucket of buckets) {
3395
3427
  cacheOra.info(`Processing bucket: ${bucket.type}`);
3396
- for (const bucketConfig of bucket.config) {
3428
+ for (const bucketPath of bucket.paths) {
3397
3429
  const bucketOra = Ora5({ indent: 4 });
3398
- bucketOra.info(`Processing path: ${bucketConfig.pathPattern}`);
3399
- const sourceLocale = resolveOverriddenLocale3(i18nConfig.locale.source, bucketConfig.delimiter);
3400
- const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern, {
3430
+ bucketOra.info(`Processing path: ${bucketPath.pathPattern}`);
3431
+ const sourceLocale = resolveOverriddenLocale3(i18nConfig.locale.source, bucketPath.delimiter);
3432
+ const bucketLoader = createBucketLoader(bucket.type, bucketPath.pathPattern, {
3401
3433
  isCacheRestore: true,
3402
- defaultLocale: sourceLocale
3434
+ defaultLocale: sourceLocale,
3435
+ injectLocale: bucket.injectLocale
3403
3436
  });
3404
3437
  bucketLoader.setDefaultLocale(sourceLocale);
3405
3438
  await bucketLoader.init();
@@ -3415,7 +3448,7 @@ var i18n_default = new Command6().command("i18n").description("Run Localization
3415
3448
  }
3416
3449
  }
3417
3450
  await bucketLoader.push(targetLocale, targetData);
3418
- lockfileHelper.registerPartialSourceData(bucketConfig.pathPattern, cachedSourceData);
3451
+ lockfileHelper.registerPartialSourceData(bucketPath.pathPattern, cachedSourceData);
3419
3452
  bucketOra.succeed(
3420
3453
  `[${sourceLocale} -> ${targetLocale}] Recovered ${Object.keys(cachedSourceData).length} entries from cache`
3421
3454
  );
@@ -3433,29 +3466,30 @@ var i18n_default = new Command6().command("i18n").description("Run Localization
3433
3466
  ora.start("Checking for lockfile updates...");
3434
3467
  let requiresUpdate = null;
3435
3468
  bucketLoop: for (const bucket of buckets) {
3436
- for (const bucketConfig of bucket.config) {
3437
- const sourceLocale = resolveOverriddenLocale3(i18nConfig.locale.source, bucketConfig.delimiter);
3438
- const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern, {
3469
+ for (const bucketPath of bucket.paths) {
3470
+ const sourceLocale = resolveOverriddenLocale3(i18nConfig.locale.source, bucketPath.delimiter);
3471
+ const bucketLoader = createBucketLoader(bucket.type, bucketPath.pathPattern, {
3439
3472
  isCacheRestore: false,
3440
3473
  defaultLocale: sourceLocale,
3441
- returnUnlocalizedKeys: true
3474
+ returnUnlocalizedKeys: true,
3475
+ injectLocale: bucket.injectLocale
3442
3476
  });
3443
3477
  bucketLoader.setDefaultLocale(sourceLocale);
3444
3478
  await bucketLoader.init();
3445
3479
  const { unlocalizable: sourceUnlocalizable, ...sourceData } = await bucketLoader.pull(
3446
3480
  i18nConfig.locale.source
3447
3481
  );
3448
- const updatedSourceData = lockfileHelper.extractUpdatedData(bucketConfig.pathPattern, sourceData);
3482
+ const updatedSourceData = lockfileHelper.extractUpdatedData(bucketPath.pathPattern, sourceData);
3449
3483
  if (Object.keys(updatedSourceData).length > 0) {
3450
3484
  requiresUpdate = "updated";
3451
3485
  break bucketLoop;
3452
3486
  }
3453
3487
  for (const _targetLocale of targetLocales) {
3454
- const targetLocale = resolveOverriddenLocale3(_targetLocale, bucketConfig.delimiter);
3488
+ const targetLocale = resolveOverriddenLocale3(_targetLocale, bucketPath.delimiter);
3455
3489
  const { unlocalizable: targetUnlocalizable, ...targetData } = await bucketLoader.pull(targetLocale);
3456
- const missingKeys = _19.difference(Object.keys(sourceData), Object.keys(targetData));
3457
- const extraKeys = _19.difference(Object.keys(targetData), Object.keys(sourceData));
3458
- const unlocalizableDataDiff = !_19.isEqual(sourceUnlocalizable, targetUnlocalizable);
3490
+ const missingKeys = _20.difference(Object.keys(sourceData), Object.keys(targetData));
3491
+ const extraKeys = _20.difference(Object.keys(targetData), Object.keys(sourceData));
3492
+ const unlocalizableDataDiff = !_20.isEqual(sourceUnlocalizable, targetUnlocalizable);
3459
3493
  if (missingKeys.length > 0) {
3460
3494
  requiresUpdate = "missing";
3461
3495
  break bucketLoop;
@@ -3489,22 +3523,23 @@ var i18n_default = new Command6().command("i18n").description("Run Localization
3489
3523
  try {
3490
3524
  console.log();
3491
3525
  ora.info(`Processing bucket: ${bucket.type}`);
3492
- for (const bucketConfig of bucket.config) {
3493
- const bucketOra = Ora5({ indent: 2 }).info(`Processing path: ${bucketConfig.pathPattern}`);
3494
- const sourceLocale = resolveOverriddenLocale3(i18nConfig.locale.source, bucketConfig.delimiter);
3495
- const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern, {
3526
+ for (const bucketPath of bucket.paths) {
3527
+ const bucketOra = Ora5({ indent: 2 }).info(`Processing path: ${bucketPath.pathPattern}`);
3528
+ const sourceLocale = resolveOverriddenLocale3(i18nConfig.locale.source, bucketPath.delimiter);
3529
+ const bucketLoader = createBucketLoader(bucket.type, bucketPath.pathPattern, {
3496
3530
  isCacheRestore: false,
3497
- defaultLocale: sourceLocale
3531
+ defaultLocale: sourceLocale,
3532
+ injectLocale: bucket.injectLocale
3498
3533
  });
3499
3534
  bucketLoader.setDefaultLocale(sourceLocale);
3500
3535
  await bucketLoader.init();
3501
3536
  let sourceData = await bucketLoader.pull(sourceLocale);
3502
3537
  for (const _targetLocale of targetLocales) {
3503
- const targetLocale = resolveOverriddenLocale3(_targetLocale, bucketConfig.delimiter);
3538
+ const targetLocale = resolveOverriddenLocale3(_targetLocale, bucketPath.delimiter);
3504
3539
  try {
3505
3540
  bucketOra.start(`[${sourceLocale} -> ${targetLocale}] (0%) Localization in progress...`);
3506
3541
  sourceData = await bucketLoader.pull(sourceLocale);
3507
- const updatedSourceData = flags.force ? sourceData : lockfileHelper.extractUpdatedData(bucketConfig.pathPattern, sourceData);
3542
+ const updatedSourceData = flags.force ? sourceData : lockfileHelper.extractUpdatedData(bucketPath.pathPattern, sourceData);
3508
3543
  const targetData = await bucketLoader.pull(targetLocale);
3509
3544
  let processableData = calculateDataDelta({
3510
3545
  sourceData,
@@ -3512,7 +3547,7 @@ var i18n_default = new Command6().command("i18n").description("Run Localization
3512
3547
  targetData
3513
3548
  });
3514
3549
  if (flags.key) {
3515
- processableData = _19.pickBy(processableData, (_21, key) => key === flags.key);
3550
+ processableData = _20.pickBy(processableData, (_22, key) => key === flags.key);
3516
3551
  }
3517
3552
  if (flags.verbose) {
3518
3553
  bucketOra.info(JSON.stringify(processableData, null, 2));
@@ -3548,11 +3583,11 @@ var i18n_default = new Command6().command("i18n").description("Run Localization
3548
3583
  if (flags.verbose) {
3549
3584
  bucketOra.info(JSON.stringify(processedTargetData, null, 2));
3550
3585
  }
3551
- let finalTargetData = _19.merge({}, sourceData, targetData, processedTargetData);
3586
+ let finalTargetData = _20.merge({}, sourceData, targetData, processedTargetData);
3552
3587
  if (flags.interactive) {
3553
3588
  bucketOra.stop();
3554
3589
  const reviewedData = await reviewChanges({
3555
- pathPattern: bucketConfig.pathPattern,
3590
+ pathPattern: bucketPath.pathPattern,
3556
3591
  targetLocale,
3557
3592
  currentData: targetData,
3558
3593
  proposedData: finalTargetData,
@@ -3560,9 +3595,9 @@ var i18n_default = new Command6().command("i18n").description("Run Localization
3560
3595
  force: flags.force
3561
3596
  });
3562
3597
  finalTargetData = reviewedData;
3563
- bucketOra.start(`Applying changes to ${bucketConfig} (${targetLocale})`);
3598
+ bucketOra.start(`Applying changes to ${bucketPath} (${targetLocale})`);
3564
3599
  }
3565
- const finalDiffSize = _19.chain(finalTargetData).omitBy((value, key) => value === targetData[key]).size().value();
3600
+ const finalDiffSize = _20.chain(finalTargetData).omitBy((value, key) => value === targetData[key]).size().value();
3566
3601
  await bucketLoader.push(targetLocale, finalTargetData);
3567
3602
  if (finalDiffSize > 0 || flags.force) {
3568
3603
  bucketOra.succeed(`[${sourceLocale} -> ${targetLocale}] Localization completed`);
@@ -3579,7 +3614,7 @@ var i18n_default = new Command6().command("i18n").description("Run Localization
3579
3614
  }
3580
3615
  }
3581
3616
  }
3582
- lockfileHelper.registerSourceData(bucketConfig.pathPattern, sourceData);
3617
+ lockfileHelper.registerSourceData(bucketPath.pathPattern, sourceData);
3583
3618
  }
3584
3619
  } catch (_error) {
3585
3620
  const error = new Error(`Failed to process bucket ${bucket.type}: ${_error.message}`);
@@ -3607,9 +3642,9 @@ var i18n_default = new Command6().command("i18n").description("Run Localization
3607
3642
  }
3608
3643
  });
3609
3644
  function calculateDataDelta(args) {
3610
- const newKeys = _19.difference(Object.keys(args.sourceData), Object.keys(args.targetData));
3645
+ const newKeys = _20.difference(Object.keys(args.sourceData), Object.keys(args.targetData));
3611
3646
  const updatedKeys = Object.keys(args.updatedSourceData);
3612
- const result = _19.chain(args.sourceData).pickBy((value, key) => newKeys.includes(key) || updatedKeys.includes(key)).value();
3647
+ const result = _20.chain(args.sourceData).pickBy((value, key) => newKeys.includes(key) || updatedKeys.includes(key)).value();
3613
3648
  return result;
3614
3649
  }
3615
3650
  async function retryWithExponentialBackoff(operation, maxAttempts, baseDelay = 1e3) {
@@ -3755,7 +3790,7 @@ Reviewing changes for ${chalk.blue(args.pathPattern)} (${chalk.yellow(args.targe
3755
3790
  return args.currentData;
3756
3791
  }
3757
3792
  const customData = { ...args.currentData };
3758
- const changes = _19.reduce(
3793
+ const changes = _20.reduce(
3759
3794
  args.proposedData,
3760
3795
  (result, value, key) => {
3761
3796
  if (args.currentData[key] !== value) {
@@ -3818,7 +3853,7 @@ var lockfile_default = new Command7().command("lockfile").description("Create a
3818
3853
  const i18nConfig = getConfig();
3819
3854
  const buckets = getBuckets(i18nConfig);
3820
3855
  for (const bucket of buckets) {
3821
- for (const bucketConfig of bucket.config) {
3856
+ for (const bucketConfig of bucket.paths) {
3822
3857
  const sourceLocale = resolveOverriddenLocale4(i18nConfig.locale.source, bucketConfig.delimiter);
3823
3858
  const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern, {
3824
3859
  isCacheRestore: false,
@@ -3839,9 +3874,12 @@ var flagsSchema = Z5.object({
3839
3874
  // src/cli/cmd/cleanup.ts
3840
3875
  import { resolveOverriddenLocale as resolveOverriddenLocale5 } from "@lingo.dev/_spec";
3841
3876
  import { Command as Command8 } from "interactive-commander";
3842
- import _20 from "lodash";
3877
+ import _21 from "lodash";
3843
3878
  import Ora7 from "ora";
3844
- var cleanup_default = new Command8().command("cleanup").description("Remove keys from target files that do not exist in the source file").helpOption("-h, --help", "Show help").option("--locale <locale>", "Specific locale to cleanup").option("--bucket <bucket>", "Specific bucket to cleanup").option("--dry-run", "Show what would be removed without making changes").option("--verbose", "Show detailed output including:\n - List of keys that would be removed.\n - Processing steps.").action(async function(options) {
3879
+ var cleanup_default = new Command8().command("cleanup").description("Remove keys from target files that do not exist in the source file").helpOption("-h, --help", "Show help").option("--locale <locale>", "Specific locale to cleanup").option("--bucket <bucket>", "Specific bucket to cleanup").option("--dry-run", "Show what would be removed without making changes").option(
3880
+ "--verbose",
3881
+ "Show detailed output including:\n - List of keys that would be removed.\n - Processing steps."
3882
+ ).action(async function(options) {
3845
3883
  const ora = Ora7();
3846
3884
  const results = [];
3847
3885
  try {
@@ -3857,7 +3895,7 @@ var cleanup_default = new Command8().command("cleanup").description("Remove keys
3857
3895
  for (const bucket of buckets) {
3858
3896
  console.log();
3859
3897
  ora.info(`Processing bucket: ${bucket.type}`);
3860
- for (const bucketConfig of bucket.config) {
3898
+ for (const bucketConfig of bucket.paths) {
3861
3899
  const sourceLocale = resolveOverriddenLocale5(i18nConfig.locale.source, bucketConfig.delimiter);
3862
3900
  const bucketOra = Ora7({ indent: 2 }).info(`Processing path: ${bucketConfig.pathPattern}`);
3863
3901
  const bucketLoader = createBucketLoader(bucket.type, bucketConfig.pathPattern, {
@@ -3872,7 +3910,7 @@ var cleanup_default = new Command8().command("cleanup").description("Remove keys
3872
3910
  try {
3873
3911
  const targetData = await bucketLoader.pull(targetLocale);
3874
3912
  const targetKeys = Object.keys(targetData);
3875
- const keysToRemove = _20.difference(targetKeys, sourceKeys);
3913
+ const keysToRemove = _21.difference(targetKeys, sourceKeys);
3876
3914
  if (keysToRemove.length === 0) {
3877
3915
  bucketOra.succeed(`[${targetLocale}] No keys to remove`);
3878
3916
  continue;
@@ -3881,7 +3919,7 @@ var cleanup_default = new Command8().command("cleanup").description("Remove keys
3881
3919
  bucketOra.info(`[${targetLocale}] Keys to remove: ${JSON.stringify(keysToRemove, null, 2)}`);
3882
3920
  }
3883
3921
  if (!options.dryRun) {
3884
- const cleanedData = _20.pick(targetData, sourceKeys);
3922
+ const cleanedData = _21.pick(targetData, sourceKeys);
3885
3923
  await bucketLoader.push(targetLocale, cleanedData);
3886
3924
  bucketOra.succeed(`[${targetLocale}] Removed ${keysToRemove.length} keys`);
3887
3925
  } else {
@@ -3936,7 +3974,7 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
3936
3974
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3937
3975
  import Z6 from "zod";
3938
3976
  import { ReplexicaEngine } from "@lingo.dev/_sdk";
3939
- var mcp_default = new Command9().command("mcp").description("Use Lingo.dev model context provider with your AI agent").helpOption("-h, --help", "Show help").action(async (_21, program) => {
3977
+ var mcp_default = new Command9().command("mcp").description("Use Lingo.dev model context provider with your AI agent").helpOption("-h, --help", "Show help").action(async (_22, program) => {
3940
3978
  const apiKey = program.args[0];
3941
3979
  const settings = getSettings(apiKey);
3942
3980
  if (!settings.auth.apiKey) {
@@ -4131,35 +4169,21 @@ var PullRequestFlow = class extends InBranchFlow {
4131
4169
  this.ora.start(
4132
4170
  `Checking for existing PR with head ${i18nBranchName} and base ${this.platformKit.platformConfig.baseBranchName}`
4133
4171
  );
4134
- const existingPrNumber = await this.platformKit.getOpenPullRequestNumber({
4172
+ let prNumber = await this.platformKit.getOpenPullRequestNumber({
4135
4173
  branch: i18nBranchName
4136
4174
  });
4137
- this.ora.succeed(existingPrNumber ? "PR found" : "No PR found");
4138
- if (existingPrNumber) {
4139
- this.ora.start(`Closing existing PR ${existingPrNumber}`);
4140
- await this.platformKit.closePullRequest({
4141
- pullRequestNumber: existingPrNumber
4142
- });
4143
- this.ora.succeed(`Closed existing PR ${existingPrNumber}`);
4144
- }
4145
- this.ora.start(`Creating new PR`);
4146
- const newPrNumber = await this.platformKit.createPullRequest({
4147
- head: i18nBranchName,
4148
- title: this.platformKit.config.pullRequestTitle,
4149
- body: this.getPrBodyContent()
4150
- });
4151
- this.ora.succeed(`Created new PR ${newPrNumber}`);
4152
- if (existingPrNumber) {
4153
- this.ora.start(`Posting comment about outdated PR ${existingPrNumber}`);
4154
- await this.platformKit.commentOnPullRequest({
4155
- pullRequestNumber: existingPrNumber,
4156
- body: `This PR is now outdated. A new version has been created at ${this.platformKit.buildPullRequestUrl(
4157
- newPrNumber
4158
- )}`
4175
+ if (prNumber) {
4176
+ this.ora.succeed(`Existing PR found: #${prNumber}`);
4177
+ } else {
4178
+ this.ora.start(`Creating new PR`);
4179
+ prNumber = await this.platformKit.createPullRequest({
4180
+ head: i18nBranchName,
4181
+ title: this.platformKit.config.pullRequestTitle,
4182
+ body: this.getPrBodyContent()
4159
4183
  });
4160
- this.ora.succeed(`Posted comment about outdated PR ${existingPrNumber}`);
4184
+ this.ora.succeed(`Created new PR: #${prNumber}`);
4161
4185
  }
4162
- return newPrNumber;
4186
+ return prNumber;
4163
4187
  }
4164
4188
  checkoutI18nBranch(i18nBranchName) {
4165
4189
  execSync3(`git fetch origin ${i18nBranchName}`, { stdio: "inherit" });
@@ -4613,7 +4637,7 @@ var ci_default = new Command10().command("ci").description("Run Lingo.dev CI/CD
4613
4637
  // package.json
4614
4638
  var package_default = {
4615
4639
  name: "lingo.dev",
4616
- version: "0.79.1",
4640
+ version: "0.79.2",
4617
4641
  description: "Lingo.dev CLI",
4618
4642
  private: false,
4619
4643
  publishConfig: {