lingo.dev 0.92.16 → 0.92.18

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.cjs CHANGED
@@ -26,36 +26,65 @@ function getSettings(explicitApiKey) {
26
26
  _envVarsInfo();
27
27
  return {
28
28
  auth: {
29
- apiKey: explicitApiKey || env.LINGODOTDEV_API_KEY || _optionalChain([systemFile, 'access', _31 => _31.auth, 'optionalAccess', _32 => _32.apiKey]) || defaults.auth.apiKey,
30
- apiUrl: env.LINGODOTDEV_API_URL || _optionalChain([systemFile, 'access', _33 => _33.auth, 'optionalAccess', _34 => _34.apiUrl]) || defaults.auth.apiUrl,
31
- webUrl: env.LINGODOTDEV_WEB_URL || _optionalChain([systemFile, 'access', _35 => _35.auth, 'optionalAccess', _36 => _36.webUrl]) || defaults.auth.webUrl
29
+ apiKey: explicitApiKey || env.LINGODOTDEV_API_KEY || _optionalChain([systemFile, 'access', _34 => _34.auth, 'optionalAccess', _35 => _35.apiKey]) || defaults.auth.apiKey,
30
+ apiUrl: env.LINGODOTDEV_API_URL || _optionalChain([systemFile, 'access', _36 => _36.auth, 'optionalAccess', _37 => _37.apiUrl]) || defaults.auth.apiUrl,
31
+ webUrl: env.LINGODOTDEV_WEB_URL || _optionalChain([systemFile, 'access', _38 => _38.auth, 'optionalAccess', _39 => _39.webUrl]) || defaults.auth.webUrl
32
+ },
33
+ llm: {
34
+ openaiApiKey: env.OPENAI_API_KEY || _optionalChain([systemFile, 'access', _40 => _40.llm, 'optionalAccess', _41 => _41.openaiApiKey]),
35
+ anthropicApiKey: env.ANTHROPIC_API_KEY || _optionalChain([systemFile, 'access', _42 => _42.llm, 'optionalAccess', _43 => _43.anthropicApiKey]),
36
+ groqApiKey: env.GROQ_API_KEY || _optionalChain([systemFile, 'access', _44 => _44.llm, 'optionalAccess', _45 => _45.groqApiKey])
32
37
  }
33
38
  };
34
39
  }
35
40
  function saveSettings(settings) {
36
41
  _saveSystemFile(settings);
37
42
  }
43
+ function loadSystemSettings() {
44
+ return _loadSystemFile();
45
+ }
46
+ var flattenZodObject = (schema, prefix = "") => {
47
+ return Object.entries(schema.shape).flatMap(([key, value]) => {
48
+ const newPrefix = prefix ? `${prefix}.${key}` : key;
49
+ if (value instanceof _zod2.default.ZodObject) {
50
+ return flattenZodObject(value, newPrefix);
51
+ }
52
+ return [newPrefix];
53
+ });
54
+ };
38
55
  var SettingsSchema = _zod2.default.object({
39
56
  auth: _zod2.default.object({
40
57
  apiKey: _zod2.default.string(),
41
58
  apiUrl: _zod2.default.string(),
42
59
  webUrl: _zod2.default.string()
60
+ }),
61
+ llm: _zod2.default.object({
62
+ openaiApiKey: _zod2.default.string().optional(),
63
+ anthropicApiKey: _zod2.default.string().optional(),
64
+ groqApiKey: _zod2.default.string().optional()
43
65
  })
44
66
  });
67
+ var SETTINGS_KEYS = flattenZodObject(
68
+ SettingsSchema
69
+ );
45
70
  function _loadDefaults() {
46
71
  return {
47
72
  auth: {
48
73
  apiKey: "",
49
74
  apiUrl: "https://engine.lingo.dev",
50
75
  webUrl: "https://lingo.dev"
51
- }
76
+ },
77
+ llm: {}
52
78
  };
53
79
  }
54
80
  function _loadEnv() {
55
81
  return _zod2.default.object({
56
82
  LINGODOTDEV_API_KEY: _zod2.default.string().optional(),
57
83
  LINGODOTDEV_API_URL: _zod2.default.string().optional(),
58
- LINGODOTDEV_WEB_URL: _zod2.default.string().optional()
84
+ LINGODOTDEV_WEB_URL: _zod2.default.string().optional(),
85
+ OPENAI_API_KEY: _zod2.default.string().optional(),
86
+ ANTHROPIC_API_KEY: _zod2.default.string().optional(),
87
+ GROQ_API_KEY: _zod2.default.string().optional()
59
88
  }).passthrough().parse(process.env);
60
89
  }
61
90
  function _loadSystemFile() {
@@ -67,6 +96,11 @@ function _loadSystemFile() {
67
96
  apiKey: _zod2.default.string().optional(),
68
97
  apiUrl: _zod2.default.string().optional(),
69
98
  webUrl: _zod2.default.string().optional()
99
+ }).optional(),
100
+ llm: _zod2.default.object({
101
+ openaiApiKey: _zod2.default.string().optional(),
102
+ anthropicApiKey: _zod2.default.string().optional(),
103
+ groqApiKey: _zod2.default.string().optional()
70
104
  }).optional()
71
105
  }).passthrough().parse(data);
72
106
  }
@@ -99,17 +133,41 @@ Please use LINGODOTDEV_API_KEY instead.
99
133
  function _envVarsInfo() {
100
134
  const env = _loadEnv();
101
135
  const systemFile = _loadSystemFile();
102
- if (env.LINGODOTDEV_API_KEY && _optionalChain([systemFile, 'access', _37 => _37.auth, 'optionalAccess', _38 => _38.apiKey])) {
136
+ if (env.LINGODOTDEV_API_KEY && _optionalChain([systemFile, 'access', _46 => _46.auth, 'optionalAccess', _47 => _47.apiKey])) {
137
+ console.info(
138
+ "\x1B[36m%s\x1B[0m",
139
+ `\u2139\uFE0F Using LINGODOTDEV_API_KEY env var instead of credentials from user config`
140
+ );
141
+ }
142
+ if (env.OPENAI_API_KEY && _optionalChain([systemFile, 'access', _48 => _48.llm, 'optionalAccess', _49 => _49.openaiApiKey])) {
103
143
  console.info(
104
144
  "\x1B[36m%s\x1B[0m",
105
- `\u2139\uFE0F Using LINGODOTDEV_API_KEY env var instead of credentials from login flow (saved in .lingodotdevrc)`
145
+ `\u2139\uFE0F Using OPENAI_API_KEY env var instead of key from user config.`
146
+ );
147
+ }
148
+ if (env.ANTHROPIC_API_KEY && _optionalChain([systemFile, 'access', _50 => _50.llm, 'optionalAccess', _51 => _51.anthropicApiKey])) {
149
+ console.info(
150
+ "\x1B[36m%s\x1B[0m",
151
+ `\u2139\uFE0F Using ANTHROPIC_API_KEY env var instead of key from user config`
152
+ );
153
+ }
154
+ if (env.GROQ_API_KEY && _optionalChain([systemFile, 'access', _52 => _52.llm, 'optionalAccess', _53 => _53.groqApiKey])) {
155
+ console.info(
156
+ "\x1B[36m%s\x1B[0m",
157
+ `\u2139\uFE0F Using GROQ_API_KEY env var instead of key from user config`
106
158
  );
107
159
  }
108
160
  if (env.LINGODOTDEV_API_URL) {
109
- console.info("\x1B[36m%s\x1B[0m", `\u2139\uFE0F Using LINGODOTDEV_API_URL: ${env.LINGODOTDEV_API_URL}`);
161
+ console.info(
162
+ "\x1B[36m%s\x1B[0m",
163
+ `\u2139\uFE0F Using LINGODOTDEV_API_URL: ${env.LINGODOTDEV_API_URL}`
164
+ );
110
165
  }
111
166
  if (env.LINGODOTDEV_WEB_URL) {
112
- console.info("\x1B[36m%s\x1B[0m", `\u2139\uFE0F Using LINGODOTDEV_WEB_URL: ${env.LINGODOTDEV_WEB_URL}`);
167
+ console.info(
168
+ "\x1B[36m%s\x1B[0m",
169
+ `\u2139\uFE0F Using LINGODOTDEV_WEB_URL: ${env.LINGODOTDEV_WEB_URL}`
170
+ );
113
171
  }
114
172
  }
115
173
 
@@ -154,7 +212,7 @@ function createAuthenticator(params) {
154
212
  });
155
213
  if (res.ok) {
156
214
  const payload = await res.json();
157
- if (!_optionalChain([payload, 'optionalAccess', _39 => _39.email])) {
215
+ if (!_optionalChain([payload, 'optionalAccess', _54 => _54.email])) {
158
216
  return null;
159
217
  }
160
218
  return {
@@ -774,7 +832,7 @@ var init_default = new (0, _interactivecommander.InteractiveCommand)().command("
774
832
  });
775
833
  const auth2 = await newAuthenticator.whoami();
776
834
  if (auth2) {
777
- _ora2.default.call(void 0, ).succeed(`Authenticated as ${_optionalChain([auth2, 'optionalAccess', _40 => _40.email])}`);
835
+ _ora2.default.call(void 0, ).succeed(`Authenticated as ${_optionalChain([auth2, 'optionalAccess', _55 => _55.email])}`);
778
836
  } else {
779
837
  _ora2.default.call(void 0, ).fail("Authentication failed.");
780
838
  }
@@ -859,7 +917,7 @@ function getBuckets(i18nConfig) {
859
917
  const includeItems = bucketEntry.include.map(
860
918
  (item) => resolveBucketItem(item)
861
919
  );
862
- const excludeItems = _optionalChain([bucketEntry, 'access', _41 => _41.exclude, 'optionalAccess', _42 => _42.map, 'call', _43 => _43(
920
+ const excludeItems = _optionalChain([bucketEntry, 'access', _56 => _56.exclude, 'optionalAccess', _57 => _57.map, 'call', _58 => _58(
863
921
  (item) => resolveBucketItem(item)
864
922
  )]);
865
923
  const config = {
@@ -897,7 +955,7 @@ function extractPathPatterns(sourceLocale, include, exclude) {
897
955
  delimiter: pattern.delimiter
898
956
  }))
899
957
  );
900
- const excludedPatterns = _optionalChain([exclude, 'optionalAccess', _44 => _44.flatMap, 'call', _45 => _45(
958
+ const excludedPatterns = _optionalChain([exclude, 'optionalAccess', _59 => _59.flatMap, 'call', _60 => _60(
901
959
  (pattern) => expandPlaceholderedGlob(
902
960
  pattern.path,
903
961
  __spec.resolveOverriddenLocale.call(void 0, sourceLocale, pattern.delimiter)
@@ -1017,6 +1075,123 @@ var files_default = new (0, _interactivecommander.Command)().command("files").de
1017
1075
  // src/cli/cmd/show/index.ts
1018
1076
  var show_default = new (0, _interactivecommander.Command)().command("show").description("Prints out the current configuration").helpOption("-h, --help", "Show help").addCommand(config_default).addCommand(locale_default).addCommand(files_default);
1019
1077
 
1078
+ // src/cli/cmd/config/index.ts
1079
+
1080
+
1081
+ // src/cli/cmd/config/set.ts
1082
+
1083
+ var _chalk = require('chalk'); var _chalk2 = _interopRequireDefault(_chalk);
1084
+ var _dedent = require('dedent'); var _dedent2 = _interopRequireDefault(_dedent);
1085
+
1086
+ var set_default = new (0, _interactivecommander.Command)().name("set").description("Set a configuration key to a value").addHelpText("afterAll", `
1087
+ Available keys:
1088
+ ${SETTINGS_KEYS.join("\n ")}`).argument("<key>", "Configuration key to set").argument("<value>", "New value").helpOption("-h, --help", "Show help").action(async (key, value) => {
1089
+ if (!SETTINGS_KEYS.includes(key)) {
1090
+ console.error(
1091
+ _dedent2.default`
1092
+ ${_chalk2.default.red("\u2716")} Unknown configuration key: ${_chalk2.default.bold(key)}
1093
+ Run ${_chalk2.default.dim("lingo.dev config set --help")} to see available keys.
1094
+ `
1095
+ );
1096
+ process.exitCode = 1;
1097
+ return;
1098
+ }
1099
+ const current = loadSystemSettings();
1100
+ const updated = _lodash2.default.cloneDeep(current);
1101
+ _lodash2.default.set(updated, key, value);
1102
+ try {
1103
+ saveSettings(updated);
1104
+ console.log(`${_chalk2.default.green("\u2714")} Set ${_chalk2.default.bold(key)}`);
1105
+ } catch (err) {
1106
+ console.error(
1107
+ _chalk2.default.red(
1108
+ `\u2716 Failed to save configuration: ${_chalk2.default.dim(
1109
+ err instanceof Error ? err.message : String(err)
1110
+ )}`
1111
+ )
1112
+ );
1113
+ process.exitCode = 1;
1114
+ }
1115
+ });
1116
+
1117
+ // src/cli/cmd/config/unset.ts
1118
+
1119
+
1120
+
1121
+
1122
+ var unset_default = new (0, _interactivecommander.Command)().name("unset").description("Remove a configuration key").addHelpText("afterAll", `
1123
+ Available keys:
1124
+ ${SETTINGS_KEYS.join("\n ")}`).argument("<key>", "Configuration key to remove").helpOption("-h, --help", "Show help").action(async (key) => {
1125
+ if (!SETTINGS_KEYS.includes(key)) {
1126
+ console.error(
1127
+ _dedent2.default`
1128
+ ${_chalk2.default.red("\u2716")} Unknown configuration key: ${_chalk2.default.bold(key)}
1129
+ Run ${_chalk2.default.dim("lingo.dev config unset --help")} to see available keys.
1130
+ `
1131
+ );
1132
+ process.exitCode = 1;
1133
+ return;
1134
+ }
1135
+ const settings = loadSystemSettings();
1136
+ const currentValue = _lodash2.default.get(settings, key);
1137
+ if (!_lodash2.default.trim(String(currentValue || ""))) {
1138
+ console.log(`${_chalk2.default.cyan("\u2139")} ${_chalk2.default.bold(key)} is not set.`);
1139
+ return;
1140
+ } else {
1141
+ const updated = _lodash2.default.cloneDeep(settings);
1142
+ _lodash2.default.unset(updated, key);
1143
+ try {
1144
+ saveSettings(updated);
1145
+ console.log(
1146
+ `${_chalk2.default.green("\u2714")} Removed configuration key ${_chalk2.default.bold(key)}`
1147
+ );
1148
+ } catch (err) {
1149
+ console.error(
1150
+ _chalk2.default.red(
1151
+ `\u2716 Failed to save configuration: ${_chalk2.default.dim(
1152
+ err instanceof Error ? err.message : String(err)
1153
+ )}`
1154
+ )
1155
+ );
1156
+ process.exitCode = 1;
1157
+ }
1158
+ }
1159
+ });
1160
+
1161
+ // src/cli/cmd/config/get.ts
1162
+
1163
+
1164
+
1165
+
1166
+ var get_default = new (0, _interactivecommander.Command)().name("get").description("Get the value of a configuration key").addHelpText("afterAll", `
1167
+ Available keys:
1168
+ ${SETTINGS_KEYS.join("\n ")}`).argument("<key>", "Configuration key").helpOption("-h, --help", "Show help").action(async (key) => {
1169
+ if (!SETTINGS_KEYS.includes(key)) {
1170
+ console.error(
1171
+ _dedent2.default`
1172
+ ${_chalk2.default.red("\u2716")} Unknown configuration key: ${_chalk2.default.bold(key)}
1173
+ Run ${_chalk2.default.dim("lingo.dev config get --help")} to see available keys.
1174
+ `
1175
+ );
1176
+ process.exitCode = 1;
1177
+ return;
1178
+ }
1179
+ const settings = loadSystemSettings();
1180
+ const value = _lodash2.default.get(settings, key);
1181
+ if (!value) {
1182
+ console.log(`${_chalk2.default.cyan("\u2139")} ${_chalk2.default.bold(key)} is not set.`);
1183
+ return;
1184
+ }
1185
+ if (typeof value === "object") {
1186
+ console.log(JSON.stringify(value, null, 2));
1187
+ } else {
1188
+ console.log(value);
1189
+ }
1190
+ });
1191
+
1192
+ // src/cli/cmd/config/index.ts
1193
+ var config_default2 = new (0, _interactivecommander.Command)().command("config").description("Manage Lingo.dev CLI configuration").helpOption("-h, --help", "Show help").addCommand(set_default).addCommand(unset_default).addCommand(get_default);
1194
+
1020
1195
  // src/cli/cmd/i18n.ts
1021
1196
 
1022
1197
 
@@ -1033,12 +1208,12 @@ function composeLoaders(...loaders) {
1033
1208
  return {
1034
1209
  init: async () => {
1035
1210
  for (const loader of loaders) {
1036
- await _optionalChain([loader, 'access', _46 => _46.init, 'optionalCall', _47 => _47()]);
1211
+ await _optionalChain([loader, 'access', _61 => _61.init, 'optionalCall', _62 => _62()]);
1037
1212
  }
1038
1213
  },
1039
1214
  setDefaultLocale(locale) {
1040
1215
  for (const loader of loaders) {
1041
- _optionalChain([loader, 'access', _48 => _48.setDefaultLocale, 'optionalCall', _49 => _49(locale)]);
1216
+ _optionalChain([loader, 'access', _63 => _63.setDefaultLocale, 'optionalCall', _64 => _64(locale)]);
1042
1217
  }
1043
1218
  return this;
1044
1219
  },
@@ -1071,7 +1246,7 @@ function createLoader(lDefinition) {
1071
1246
  if (state.initCtx) {
1072
1247
  return state.initCtx;
1073
1248
  }
1074
- state.initCtx = await _optionalChain([lDefinition, 'access', _50 => _50.init, 'optionalCall', _51 => _51()]);
1249
+ state.initCtx = await _optionalChain([lDefinition, 'access', _65 => _65.init, 'optionalCall', _66 => _66()]);
1075
1250
  return state.initCtx;
1076
1251
  },
1077
1252
  setDefaultLocale(locale) {
@@ -1176,7 +1351,7 @@ function createNormalizeLoader() {
1176
1351
  return normalized;
1177
1352
  },
1178
1353
  push: async (locale, data, originalInput) => {
1179
- const keysMap = _nullishCoalesce(_optionalChain([originalInput, 'optionalAccess', _52 => _52.keysMap]), () => ( {}));
1354
+ const keysMap = _nullishCoalesce(_optionalChain([originalInput, 'optionalAccess', _67 => _67.keysMap]), () => ( {}));
1180
1355
  const input2 = mapDenormalizedKeys(data, keysMap);
1181
1356
  const denormalized = _flat.unflatten.call(void 0, input2, {
1182
1357
  delimiter: "/",
@@ -1250,7 +1425,7 @@ function createTextFileLoader(pathPattern) {
1250
1425
  const trimmedResult = result.trim();
1251
1426
  return trimmedResult;
1252
1427
  },
1253
- async push(locale, data, _30, originalLocale) {
1428
+ async push(locale, data, _33, originalLocale) {
1254
1429
  const draftPath = pathPattern.replaceAll("[locale]", locale);
1255
1430
  const finalPath = path12.default.resolve(draftPath);
1256
1431
  const dirPath = path12.default.dirname(finalPath);
@@ -1279,8 +1454,8 @@ async function getTrailingNewLine(pathPattern, locale, originalLocale) {
1279
1454
  if (!templateData) {
1280
1455
  templateData = await readFileForLocale(pathPattern, originalLocale);
1281
1456
  }
1282
- if (_optionalChain([templateData, 'optionalAccess', _53 => _53.match, 'call', _54 => _54(/[\r\n]$/)])) {
1283
- const ending = _optionalChain([templateData, 'optionalAccess', _55 => _55.includes, 'call', _56 => _56("\r\n")]) ? "\r\n" : _optionalChain([templateData, 'optionalAccess', _57 => _57.includes, 'call', _58 => _58("\r")]) ? "\r" : "\n";
1457
+ if (_optionalChain([templateData, 'optionalAccess', _68 => _68.match, 'call', _69 => _69(/[\r\n]$/)])) {
1458
+ const ending = _optionalChain([templateData, 'optionalAccess', _70 => _70.includes, 'call', _71 => _71("\r\n")]) ? "\r\n" : _optionalChain([templateData, 'optionalAccess', _72 => _72.includes, 'call', _73 => _73("\r")]) ? "\r" : "\n";
1284
1459
  return ending;
1285
1460
  }
1286
1461
  return "";
@@ -1622,7 +1797,7 @@ function createHtmlLoader() {
1622
1797
  break;
1623
1798
  }
1624
1799
  const siblings = Array.from(parent.childNodes).filter(
1625
- (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _59 => _59.textContent, 'optionalAccess', _60 => _60.trim, 'call', _61 => _61()])
1800
+ (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _74 => _74.textContent, 'optionalAccess', _75 => _75.trim, 'call', _76 => _76()])
1626
1801
  );
1627
1802
  const index = siblings.indexOf(current);
1628
1803
  if (index !== -1) {
@@ -1657,11 +1832,11 @@ function createHtmlLoader() {
1657
1832
  result[getPath(element, attr)] = value;
1658
1833
  }
1659
1834
  });
1660
- Array.from(element.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _62 => _62.textContent, 'optionalAccess', _63 => _63.trim, 'call', _64 => _64()])).forEach(processNode);
1835
+ Array.from(element.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _77 => _77.textContent, 'optionalAccess', _78 => _78.trim, 'call', _79 => _79()])).forEach(processNode);
1661
1836
  }
1662
1837
  };
1663
- Array.from(document.head.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _65 => _65.textContent, 'optionalAccess', _66 => _66.trim, 'call', _67 => _67()])).forEach(processNode);
1664
- Array.from(document.body.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _68 => _68.textContent, 'optionalAccess', _69 => _69.trim, 'call', _70 => _70()])).forEach(processNode);
1838
+ Array.from(document.head.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _80 => _80.textContent, 'optionalAccess', _81 => _81.trim, 'call', _82 => _82()])).forEach(processNode);
1839
+ Array.from(document.body.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _83 => _83.textContent, 'optionalAccess', _84 => _84.trim, 'call', _85 => _85()])).forEach(processNode);
1665
1840
  return result;
1666
1841
  },
1667
1842
  async push(locale, data, originalInput) {
@@ -1683,7 +1858,7 @@ function createHtmlLoader() {
1683
1858
  for (let i = 0; i < indices.length; i++) {
1684
1859
  const index = parseInt(indices[i]);
1685
1860
  const siblings = Array.from(parent.childNodes).filter(
1686
- (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _71 => _71.textContent, 'optionalAccess', _72 => _72.trim, 'call', _73 => _73()])
1861
+ (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _86 => _86.textContent, 'optionalAccess', _87 => _87.trim, 'call', _88 => _88()])
1687
1862
  );
1688
1863
  if (index >= siblings.length) {
1689
1864
  if (i === indices.length - 1) {
@@ -1734,7 +1909,7 @@ function createMarkdownLoader() {
1734
1909
  yaml: yamlEngine
1735
1910
  }
1736
1911
  });
1737
- const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess', _74 => _74.trim, 'call', _75 => _75()]), () => ( ""))).filter(Boolean);
1912
+ const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess', _89 => _89.trim, 'call', _90 => _90()]), () => ( ""))).filter(Boolean);
1738
1913
  return {
1739
1914
  ...Object.fromEntries(
1740
1915
  sections.map((section, index) => [`${MD_SECTION_PREFIX}${index}`, section]).filter(([, section]) => Boolean(section))
@@ -1746,7 +1921,7 @@ function createMarkdownLoader() {
1746
1921
  const frontmatter = Object.fromEntries(
1747
1922
  Object.entries(data).filter(([key]) => key.startsWith(FM_ATTR_PREFIX)).map(([key, value]) => [key.replace(FM_ATTR_PREFIX, ""), value])
1748
1923
  );
1749
- let content = Object.entries(data).filter(([key]) => key.startsWith(MD_SECTION_PREFIX)).sort(([a], [b]) => Number(a.split("-").pop()) - Number(b.split("-").pop())).map(([, value]) => _nullishCoalesce(_optionalChain([value, 'optionalAccess', _76 => _76.trim, 'call', _77 => _77()]), () => ( ""))).filter(Boolean).join("\n\n");
1924
+ let content = Object.entries(data).filter(([key]) => key.startsWith(MD_SECTION_PREFIX)).sort(([a], [b]) => Number(a.split("-").pop()) - Number(b.split("-").pop())).map(([, value]) => _nullishCoalesce(_optionalChain([value, 'optionalAccess', _91 => _91.trim, 'call', _92 => _92()]), () => ( ""))).filter(Boolean).join("\n\n");
1750
1925
  if (Object.keys(frontmatter).length > 0) {
1751
1926
  content = `
1752
1927
  ${content}`;
@@ -1779,7 +1954,7 @@ function createPropertiesLoader() {
1779
1954
  return result;
1780
1955
  },
1781
1956
  async push(locale, payload) {
1782
- const result = Object.entries(payload).filter(([_30, value]) => value != null).map(([key, value]) => `${key}=${value}`).join("\n");
1957
+ const result = Object.entries(payload).filter(([_33, value]) => value != null).map(([key, value]) => `${key}=${value}`).join("\n");
1783
1958
  return result;
1784
1959
  }
1785
1960
  });
@@ -1790,7 +1965,7 @@ function isSkippableLine(line) {
1790
1965
  function parsePropertyLine(line) {
1791
1966
  const [key, ...valueParts] = line.split("=");
1792
1967
  return {
1793
- key: _optionalChain([key, 'optionalAccess', _78 => _78.trim, 'call', _79 => _79()]) || "",
1968
+ key: _optionalChain([key, 'optionalAccess', _93 => _93.trim, 'call', _94 => _94()]) || "",
1794
1969
  value: valueParts.join("=").trim()
1795
1970
  };
1796
1971
  }
@@ -1876,7 +2051,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
1876
2051
  if (rootTranslationEntity.shouldTranslate === false) {
1877
2052
  continue;
1878
2053
  }
1879
- const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _80 => _80.localizations, 'optionalAccess', _81 => _81[locale]]);
2054
+ const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _95 => _95.localizations, 'optionalAccess', _96 => _96[locale]]);
1880
2055
  if (langTranslationEntity) {
1881
2056
  if ("stringUnit" in langTranslationEntity) {
1882
2057
  resultData[translationKey] = langTranslationEntity.stringUnit.value;
@@ -1885,7 +2060,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
1885
2060
  resultData[translationKey] = {};
1886
2061
  const pluralForms = langTranslationEntity.variations.plural;
1887
2062
  for (const form in pluralForms) {
1888
- if (_optionalChain([pluralForms, 'access', _82 => _82[form], 'optionalAccess', _83 => _83.stringUnit, 'optionalAccess', _84 => _84.value])) {
2063
+ if (_optionalChain([pluralForms, 'access', _97 => _97[form], 'optionalAccess', _98 => _98.stringUnit, 'optionalAccess', _99 => _99.value])) {
1889
2064
  resultData[translationKey][form] = pluralForms[form].stringUnit.value;
1890
2065
  }
1891
2066
  }
@@ -1908,7 +2083,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
1908
2083
  const hasDoNotTranslateFlag = originalInput && originalInput.strings && originalInput.strings[key] && originalInput.strings[key].shouldTranslate === false;
1909
2084
  if (typeof value === "string") {
1910
2085
  langDataToMerge.strings[key] = {
1911
- extractionState: _optionalChain([originalInput, 'optionalAccess', _85 => _85.strings, 'optionalAccess', _86 => _86[key], 'optionalAccess', _87 => _87.extractionState]),
2086
+ extractionState: _optionalChain([originalInput, 'optionalAccess', _100 => _100.strings, 'optionalAccess', _101 => _101[key], 'optionalAccess', _102 => _102.extractionState]),
1912
2087
  localizations: {
1913
2088
  [locale]: {
1914
2089
  stringUnit: {
@@ -2046,10 +2221,10 @@ function createUnlocalizableLoader(isCacheRestore = false, returnUnlocalizedKeys
2046
2221
  }
2047
2222
  }
2048
2223
  return false;
2049
- }).map(([key, _30]) => key);
2050
- const result = _lodash2.default.omitBy(input2, (_30, key) => passthroughKeys.includes(key));
2224
+ }).map(([key, _33]) => key);
2225
+ const result = _lodash2.default.omitBy(input2, (_33, key) => passthroughKeys.includes(key));
2051
2226
  if (returnUnlocalizedKeys) {
2052
- result.unlocalizable = _lodash2.default.omitBy(input2, (_30, key) => !passthroughKeys.includes(key));
2227
+ result.unlocalizable = _lodash2.default.omitBy(input2, (_33, key) => !passthroughKeys.includes(key));
2053
2228
  }
2054
2229
  return result;
2055
2230
  },
@@ -2083,12 +2258,15 @@ function createPoDataLoader(params) {
2083
2258
  const sections = input2.split("\n\n").filter(Boolean);
2084
2259
  for (const section of sections) {
2085
2260
  const sectionPo = _gettextparser2.default.po.parse(section);
2261
+ if (Object.keys(sectionPo.translations).length === 0) {
2262
+ continue;
2263
+ }
2086
2264
  const contextKey = _lodash2.default.keys(sectionPo.translations)[0];
2087
2265
  const entries = sectionPo.translations[contextKey];
2088
2266
  Object.entries(entries).forEach(([msgid, entry]) => {
2089
2267
  if (msgid && entry.msgid) {
2090
2268
  const context = entry.msgctxt || "";
2091
- const fullEntry = _optionalChain([parsedPo, 'access', _88 => _88.translations, 'access', _89 => _89[context], 'optionalAccess', _90 => _90[msgid]]);
2269
+ const fullEntry = _optionalChain([parsedPo, 'access', _103 => _103.translations, 'access', _104 => _104[context], 'optionalAccess', _105 => _105[msgid]]);
2092
2270
  if (fullEntry) {
2093
2271
  result[msgid] = fullEntry;
2094
2272
  }
@@ -2098,10 +2276,13 @@ function createPoDataLoader(params) {
2098
2276
  return result;
2099
2277
  },
2100
2278
  async push(locale, data, originalInput, originalLocale, pullInput) {
2101
- const currentSections = _optionalChain([pullInput, 'optionalAccess', _91 => _91.split, 'call', _92 => _92("\n\n"), 'access', _93 => _93.filter, 'call', _94 => _94(Boolean)]) || [];
2102
- const originalSections = _optionalChain([originalInput, 'optionalAccess', _95 => _95.split, 'call', _96 => _96("\n\n"), 'access', _97 => _97.filter, 'call', _98 => _98(Boolean)]) || [];
2279
+ const currentSections = _optionalChain([pullInput, 'optionalAccess', _106 => _106.split, 'call', _107 => _107("\n\n"), 'access', _108 => _108.filter, 'call', _109 => _109(Boolean)]) || [];
2280
+ const originalSections = _optionalChain([originalInput, 'optionalAccess', _110 => _110.split, 'call', _111 => _111("\n\n"), 'access', _112 => _112.filter, 'call', _113 => _113(Boolean)]) || [];
2103
2281
  const result = originalSections.map((section) => {
2104
2282
  const sectionPo = _gettextparser2.default.po.parse(section);
2283
+ if (Object.keys(sectionPo.translations).length === 0) {
2284
+ return null;
2285
+ }
2105
2286
  const contextKey = _lodash2.default.keys(sectionPo.translations)[0];
2106
2287
  const entries = sectionPo.translations[contextKey];
2107
2288
  const msgid = Object.keys(entries).find((key) => entries[key].msgid);
@@ -2136,7 +2317,7 @@ function createPoDataLoader(params) {
2136
2317
  ).trim();
2137
2318
  }
2138
2319
  return section.trim();
2139
- }).join("\n\n");
2320
+ }).filter(Boolean).join("\n\n");
2140
2321
  return result;
2141
2322
  }
2142
2323
  });
@@ -2164,8 +2345,8 @@ function createPoContentLoader() {
2164
2345
  {
2165
2346
  ...entry,
2166
2347
  msgstr: [
2167
- _optionalChain([data, 'access', _99 => _99[entry.msgid], 'optionalAccess', _100 => _100.singular]),
2168
- _optionalChain([data, 'access', _101 => _101[entry.msgid], 'optionalAccess', _102 => _102.plural]) || null
2348
+ _optionalChain([data, 'access', _114 => _114[entry.msgid], 'optionalAccess', _115 => _115.singular]),
2349
+ _optionalChain([data, 'access', _116 => _116[entry.msgid], 'optionalAccess', _117 => _117.plural]) || null
2169
2350
  ].filter(Boolean)
2170
2351
  }
2171
2352
  ]).fromPairs().value();
@@ -2412,7 +2593,7 @@ function createDatoClient(params) {
2412
2593
  only_valid: "true",
2413
2594
  ids: !records.length ? void 0 : records.join(",")
2414
2595
  }
2415
- }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _103 => _103.response, 'optionalAccess', _104 => _104.body, 'optionalAccess', _105 => _105.data, 'optionalAccess', _106 => _106[0]]) || error));
2596
+ }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _118 => _118.response, 'optionalAccess', _119 => _119.body, 'optionalAccess', _120 => _120.data, 'optionalAccess', _121 => _121[0]]) || error));
2416
2597
  },
2417
2598
  findRecordsForModel: async (modelId, records) => {
2418
2599
  try {
@@ -2422,9 +2603,9 @@ function createDatoClient(params) {
2422
2603
  filter: {
2423
2604
  type: modelId,
2424
2605
  only_valid: "true",
2425
- ids: !_optionalChain([records, 'optionalAccess', _107 => _107.length]) ? void 0 : records.join(",")
2606
+ ids: !_optionalChain([records, 'optionalAccess', _122 => _122.length]) ? void 0 : records.join(",")
2426
2607
  }
2427
- }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _108 => _108.response, 'optionalAccess', _109 => _109.body, 'optionalAccess', _110 => _110.data, 'optionalAccess', _111 => _111[0]]) || error));
2608
+ }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _123 => _123.response, 'optionalAccess', _124 => _124.body, 'optionalAccess', _125 => _125.data, 'optionalAccess', _126 => _126[0]]) || error));
2428
2609
  return result;
2429
2610
  } catch (_error) {
2430
2611
  throw new Error(
@@ -2438,9 +2619,9 @@ function createDatoClient(params) {
2438
2619
  },
2439
2620
  updateRecord: async (id, payload) => {
2440
2621
  try {
2441
- await dato.items.update(id, payload).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _112 => _112.response, 'optionalAccess', _113 => _113.body, 'optionalAccess', _114 => _114.data, 'optionalAccess', _115 => _115[0]]) || error));
2622
+ await dato.items.update(id, payload).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _127 => _127.response, 'optionalAccess', _128 => _128.body, 'optionalAccess', _129 => _129.data, 'optionalAccess', _130 => _130[0]]) || error));
2442
2623
  } catch (_error) {
2443
- if (_optionalChain([_error, 'optionalAccess', _116 => _116.attributes, 'optionalAccess', _117 => _117.details, 'optionalAccess', _118 => _118.message])) {
2624
+ if (_optionalChain([_error, 'optionalAccess', _131 => _131.attributes, 'optionalAccess', _132 => _132.details, 'optionalAccess', _133 => _133.message])) {
2444
2625
  throw new Error(
2445
2626
  [
2446
2627
  `${_error.attributes.details.message}`,
@@ -2461,9 +2642,9 @@ function createDatoClient(params) {
2461
2642
  },
2462
2643
  enableFieldLocalization: async (args) => {
2463
2644
  try {
2464
- await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _119 => _119.response, 'optionalAccess', _120 => _120.body, 'optionalAccess', _121 => _121.data, 'optionalAccess', _122 => _122[0]]) || error));
2645
+ await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _134 => _134.response, 'optionalAccess', _135 => _135.body, 'optionalAccess', _136 => _136.data, 'optionalAccess', _137 => _137[0]]) || error));
2465
2646
  } catch (_error) {
2466
- if (_optionalChain([_error, 'optionalAccess', _123 => _123.attributes, 'optionalAccess', _124 => _124.code]) === "NOT_FOUND") {
2647
+ if (_optionalChain([_error, 'optionalAccess', _138 => _138.attributes, 'optionalAccess', _139 => _139.code]) === "NOT_FOUND") {
2467
2648
  throw new Error(
2468
2649
  [
2469
2650
  `Field "${args.fieldId}" not found in model "${args.modelId}".`,
@@ -2471,7 +2652,7 @@ function createDatoClient(params) {
2471
2652
  ].join("\n\n")
2472
2653
  );
2473
2654
  }
2474
- if (_optionalChain([_error, 'optionalAccess', _125 => _125.attributes, 'optionalAccess', _126 => _126.details, 'optionalAccess', _127 => _127.message])) {
2655
+ if (_optionalChain([_error, 'optionalAccess', _140 => _140.attributes, 'optionalAccess', _141 => _141.details, 'optionalAccess', _142 => _142.message])) {
2475
2656
  throw new Error(
2476
2657
  [`${_error.attributes.details.message}`, `Error: ${JSON.stringify(_error, null, 2)}`].join("\n\n")
2477
2658
  );
@@ -2537,7 +2718,7 @@ function createDatoApiLoader(config, onConfigUpdate) {
2537
2718
  }
2538
2719
  }
2539
2720
  const records = await dato.findRecordsForModel(modelId);
2540
- const recordChoices = createRecordChoices(records, _optionalChain([config, 'access', _128 => _128.models, 'access', _129 => _129[modelId], 'optionalAccess', _130 => _130.records]) || [], project);
2721
+ const recordChoices = createRecordChoices(records, _optionalChain([config, 'access', _143 => _143.models, 'access', _144 => _144[modelId], 'optionalAccess', _145 => _145.records]) || [], project);
2541
2722
  const selectedRecords = await promptRecordSelection(modelName, recordChoices);
2542
2723
  result.models[modelId].records = records.filter((record) => selectedRecords.includes(record.id));
2543
2724
  updatedConfig.models[modelId].records = selectedRecords;
@@ -2549,14 +2730,14 @@ function createDatoApiLoader(config, onConfigUpdate) {
2549
2730
  },
2550
2731
  async pull(locale, input2, initCtx) {
2551
2732
  const result = {};
2552
- for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _131 => _131.models]) || {})) {
2553
- let records = _optionalChain([initCtx, 'optionalAccess', _132 => _132.models, 'access', _133 => _133[modelId], 'access', _134 => _134.records]) || [];
2733
+ for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _146 => _146.models]) || {})) {
2734
+ let records = _optionalChain([initCtx, 'optionalAccess', _147 => _147.models, 'access', _148 => _148[modelId], 'access', _149 => _149.records]) || [];
2554
2735
  const recordIds = records.map((record) => record.id);
2555
2736
  records = await dato.findRecords(recordIds);
2556
2737
  console.log(`Fetched ${records.length} records for model ${modelId}`);
2557
2738
  if (records.length > 0) {
2558
2739
  result[modelId] = {
2559
- fields: _optionalChain([initCtx, 'optionalAccess', _135 => _135.models, 'optionalAccess', _136 => _136[modelId], 'optionalAccess', _137 => _137.fields]) || [],
2740
+ fields: _optionalChain([initCtx, 'optionalAccess', _150 => _150.models, 'optionalAccess', _151 => _151[modelId], 'optionalAccess', _152 => _152.fields]) || [],
2560
2741
  records
2561
2742
  };
2562
2743
  }
@@ -2615,7 +2796,7 @@ function createRecordChoices(records, selectedIds = [], project) {
2615
2796
  return records.map((record) => ({
2616
2797
  name: `${record.id} - https://${project.internal_domain}/editor/item_types/${record.item_type.id}/items/${record.id}`,
2617
2798
  value: record.id,
2618
- checked: _optionalChain([selectedIds, 'optionalAccess', _138 => _138.includes, 'call', _139 => _139(record.id)])
2799
+ checked: _optionalChain([selectedIds, 'optionalAccess', _153 => _153.includes, 'call', _154 => _154(record.id)])
2619
2800
  }));
2620
2801
  }
2621
2802
  async function promptRecordSelection(modelName, choices) {
@@ -2882,7 +3063,7 @@ var _nodewebvtt = require('node-webvtt'); var _nodewebvtt2 = _interopRequireDefa
2882
3063
  function createVttLoader() {
2883
3064
  return createLoader({
2884
3065
  async pull(locale, input2) {
2885
- const vtt = _optionalChain([_nodewebvtt2.default, 'access', _140 => _140.parse, 'call', _141 => _141(input2), 'optionalAccess', _142 => _142.cues]);
3066
+ const vtt = _optionalChain([_nodewebvtt2.default, 'access', _155 => _155.parse, 'call', _156 => _156(input2), 'optionalAccess', _157 => _157.cues]);
2886
3067
  if (Object.keys(vtt).length === 0) {
2887
3068
  return {};
2888
3069
  } else {
@@ -2936,7 +3117,7 @@ function variableExtractLoader(params) {
2936
3117
  for (let i = 0; i < matches.length; i++) {
2937
3118
  const match = matches[i];
2938
3119
  const currentValue = result[key].value;
2939
- const newValue = _optionalChain([currentValue, 'optionalAccess', _143 => _143.replace, 'call', _144 => _144(match, `{variable:${i}}`)]);
3120
+ const newValue = _optionalChain([currentValue, 'optionalAccess', _158 => _158.replace, 'call', _159 => _159(match, `{variable:${i}}`)]);
2940
3121
  result[key].value = newValue;
2941
3122
  result[key].variables[i] = match;
2942
3123
  }
@@ -2950,7 +3131,7 @@ function variableExtractLoader(params) {
2950
3131
  for (let i = 0; i < valueObj.variables.length; i++) {
2951
3132
  const variable = valueObj.variables[i];
2952
3133
  const currentValue = result[key];
2953
- const newValue = _optionalChain([currentValue, 'optionalAccess', _145 => _145.replace, 'call', _146 => _146(`{variable:${i}}`, variable)]);
3134
+ const newValue = _optionalChain([currentValue, 'optionalAccess', _160 => _160.replace, 'call', _161 => _161(`{variable:${i}}`, variable)]);
2954
3135
  result[key] = newValue;
2955
3136
  }
2956
3137
  }
@@ -3133,7 +3314,7 @@ function createVueJsonLoader() {
3133
3314
  return createLoader({
3134
3315
  pull: async (locale, input2, ctx) => {
3135
3316
  const parsed = parseVueFile(input2);
3136
- return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _147 => _147.i18n, 'optionalAccess', _148 => _148[locale]]), () => ( {}));
3317
+ return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _162 => _162.i18n, 'optionalAccess', _163 => _163[locale]]), () => ( {}));
3137
3318
  },
3138
3319
  push: async (locale, data, originalInput) => {
3139
3320
  const parsed = parseVueFile(_nullishCoalesce(originalInput, () => ( "")));
@@ -3314,7 +3495,7 @@ function updateStringsInObjectExpression(objectExpression, data) {
3314
3495
  objectExpression.properties.forEach((prop) => {
3315
3496
  if (!t.isObjectProperty(prop)) return;
3316
3497
  const key = getPropertyKey(prop);
3317
- const incomingVal = _optionalChain([data, 'optionalAccess', _149 => _149[key]]);
3498
+ const incomingVal = _optionalChain([data, 'optionalAccess', _164 => _164[key]]);
3318
3499
  if (incomingVal === void 0) {
3319
3500
  return;
3320
3501
  }
@@ -3350,7 +3531,7 @@ function updateStringsInArrayExpression(arrayExpression, incoming) {
3350
3531
  let modified = false;
3351
3532
  arrayExpression.elements.forEach((element, index) => {
3352
3533
  if (!element) return;
3353
- const incomingVal = _optionalChain([incoming, 'optionalAccess', _150 => _150[index]]);
3534
+ const incomingVal = _optionalChain([incoming, 'optionalAccess', _165 => _165[index]]);
3354
3535
  if (incomingVal === void 0) return;
3355
3536
  if (t.isStringLiteral(element) && typeof incomingVal === "string") {
3356
3537
  if (element.value !== incomingVal) {
@@ -3626,7 +3807,7 @@ function createMdxSectionsSplit2Loader() {
3626
3807
  const content = _lodash2.default.chain(data.sections).values().join("\n\n").value();
3627
3808
  const result = {
3628
3809
  frontmatter: data.frontmatter,
3629
- codePlaceholders: _optionalChain([pullInput, 'optionalAccess', _151 => _151.codePlaceholders]) || {},
3810
+ codePlaceholders: _optionalChain([pullInput, 'optionalAccess', _166 => _166.codePlaceholders]) || {},
3630
3811
  content
3631
3812
  };
3632
3813
  return result;
@@ -3969,14 +4150,14 @@ function createBucketLoader(bucketType, bucketPathPattern, options, lockedKeys,
3969
4150
  }
3970
4151
 
3971
4152
  // src/cli/cmd/i18n.ts
3972
- var _chalk = require('chalk'); var _chalk2 = _interopRequireDefault(_chalk);
4153
+
3973
4154
  var _diff = require('diff');
3974
4155
 
3975
4156
  var _externaleditor = require('external-editor'); var _externaleditor2 = _interopRequireDefault(_externaleditor);
3976
4157
 
3977
4158
  // src/cli/processor/index.ts
3978
4159
 
3979
- var _dedent = require('dedent'); var _dedent2 = _interopRequireDefault(_dedent);
4160
+
3980
4161
 
3981
4162
  // src/cli/processor/lingo.ts
3982
4163
  var __sdk = require('@lingo.dev/_sdk');
@@ -4069,7 +4250,7 @@ function createBasicTranslator(model, systemPrompt) {
4069
4250
  ]
4070
4251
  });
4071
4252
  const result = JSON.parse(response.text);
4072
- return _optionalChain([result, 'optionalAccess', _152 => _152.data]) || {};
4253
+ return _optionalChain([result, 'optionalAccess', _167 => _167.data]) || {};
4073
4254
  }
4074
4255
  }
4075
4256
  function extractPayloadChunks(payload) {
@@ -4151,7 +4332,7 @@ function getPureModelProvider(provider) {
4151
4332
 
4152
4333
  ${_chalk2.default.hex(colors.blue)("Docs: https://lingo.dev/go/docs")}
4153
4334
  `;
4154
- switch (_optionalChain([provider, 'optionalAccess', _153 => _153.id])) {
4335
+ switch (_optionalChain([provider, 'optionalAccess', _168 => _168.id])) {
4155
4336
  case "openai":
4156
4337
  if (!process.env.OPENAI_API_KEY) {
4157
4338
  throw new Error(
@@ -4172,7 +4353,7 @@ function getPureModelProvider(provider) {
4172
4353
  apiKey: process.env.ANTHROPIC_API_KEY
4173
4354
  })(provider.model);
4174
4355
  default:
4175
- throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess', _154 => _154.id])));
4356
+ throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess', _169 => _169.id])));
4176
4357
  }
4177
4358
  }
4178
4359
 
@@ -4396,7 +4577,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
4396
4577
  validateParams(i18nConfig, flags);
4397
4578
  ora.succeed("Localization configuration is valid");
4398
4579
  ora.start("Connecting to Lingo.dev Localization Engine...");
4399
- const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _155 => _155.provider]);
4580
+ const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _170 => _170.provider]);
4400
4581
  if (isByokMode) {
4401
4582
  authId = null;
4402
4583
  ora.succeed("Using external provider (BYOK mode)");
@@ -4410,16 +4591,16 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
4410
4591
  flags
4411
4592
  });
4412
4593
  let buckets = getBuckets(i18nConfig);
4413
- if (_optionalChain([flags, 'access', _156 => _156.bucket, 'optionalAccess', _157 => _157.length])) {
4594
+ if (_optionalChain([flags, 'access', _171 => _171.bucket, 'optionalAccess', _172 => _172.length])) {
4414
4595
  buckets = buckets.filter(
4415
4596
  (bucket) => flags.bucket.includes(bucket.type)
4416
4597
  );
4417
4598
  }
4418
4599
  ora.succeed("Buckets retrieved");
4419
- if (_optionalChain([flags, 'access', _158 => _158.file, 'optionalAccess', _159 => _159.length])) {
4600
+ if (_optionalChain([flags, 'access', _173 => _173.file, 'optionalAccess', _174 => _174.length])) {
4420
4601
  buckets = buckets.map((bucket) => {
4421
4602
  const paths = bucket.paths.filter(
4422
- (path16) => flags.file.find((file) => _optionalChain([path16, 'access', _160 => _160.pathPattern, 'optionalAccess', _161 => _161.includes, 'call', _162 => _162(file)]))
4603
+ (path16) => flags.file.find((file) => _optionalChain([path16, 'access', _175 => _175.pathPattern, 'optionalAccess', _176 => _176.includes, 'call', _177 => _177(file)]))
4423
4604
  );
4424
4605
  return { ...bucket, paths };
4425
4606
  }).filter((bucket) => bucket.paths.length > 0);
@@ -4438,7 +4619,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
4438
4619
  });
4439
4620
  }
4440
4621
  }
4441
- const targetLocales = _optionalChain([flags, 'access', _163 => _163.locale, 'optionalAccess', _164 => _164.length]) ? flags.locale : i18nConfig.locale.targets;
4622
+ const targetLocales = _optionalChain([flags, 'access', _178 => _178.locale, 'optionalAccess', _179 => _179.length]) ? flags.locale : i18nConfig.locale.targets;
4442
4623
  ora.start("Setting up localization cache...");
4443
4624
  const checkLockfileProcessor = createDeltaProcessor("");
4444
4625
  const lockfileExists = await checkLockfileProcessor.checkIfLockExists();
@@ -4612,7 +4793,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
4612
4793
  if (flags.key) {
4613
4794
  processableData = _lodash2.default.pickBy(
4614
4795
  processableData,
4615
- (_30, key) => key === flags.key
4796
+ (_33, key) => key === flags.key
4616
4797
  );
4617
4798
  }
4618
4799
  if (flags.verbose) {
@@ -4782,12 +4963,12 @@ function validateParams(i18nConfig, flags) {
4782
4963
  message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
4783
4964
  docUrl: "bucketNotFound"
4784
4965
  });
4785
- } else if (_optionalChain([flags, 'access', _165 => _165.locale, 'optionalAccess', _166 => _166.some, 'call', _167 => _167((locale) => !i18nConfig.locale.targets.includes(locale))])) {
4966
+ } else if (_optionalChain([flags, 'access', _180 => _180.locale, 'optionalAccess', _181 => _181.some, 'call', _182 => _182((locale) => !i18nConfig.locale.targets.includes(locale))])) {
4786
4967
  throw new CLIError({
4787
4968
  message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
4788
4969
  docUrl: "localeTargetNotFound"
4789
4970
  });
4790
- } else if (_optionalChain([flags, 'access', _168 => _168.bucket, 'optionalAccess', _169 => _169.some, 'call', _170 => _170(
4971
+ } else if (_optionalChain([flags, 'access', _183 => _183.bucket, 'optionalAccess', _184 => _184.some, 'call', _185 => _185(
4791
4972
  (bucket) => !i18nConfig.buckets[bucket]
4792
4973
  )])) {
4793
4974
  throw new CLIError({
@@ -5115,7 +5296,7 @@ var _stdiojs = require('@modelcontextprotocol/sdk/server/stdio.js');
5115
5296
  var _mcpjs = require('@modelcontextprotocol/sdk/server/mcp.js');
5116
5297
 
5117
5298
 
5118
- var mcp_default = new (0, _interactivecommander.Command)().command("mcp").description("Use Lingo.dev model context provider with your AI agent").helpOption("-h, --help", "Show help").action(async (_30, program) => {
5299
+ var mcp_default = new (0, _interactivecommander.Command)().command("mcp").description("Use Lingo.dev model context provider with your AI agent").helpOption("-h, --help", "Show help").action(async (_33, program) => {
5119
5300
  const apiKey = program.args[0];
5120
5301
  const settings = getSettings(apiKey);
5121
5302
  if (!settings.auth.apiKey) {
@@ -5252,7 +5433,7 @@ var InBranchFlow = class extends IntegrationFlow {
5252
5433
  _child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
5253
5434
  _child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
5254
5435
  _child_process.execSync.call(void 0, `git config user.email "${gitConfig.userEmail}"`);
5255
- _optionalChain([this, 'access', _171 => _171.platformKit, 'optionalAccess', _172 => _172.gitConfig, 'call', _173 => _173()]);
5436
+ _optionalChain([this, 'access', _186 => _186.platformKit, 'optionalAccess', _187 => _187.gitConfig, 'call', _188 => _188()]);
5256
5437
  _child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
5257
5438
  _child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
5258
5439
  if (!processOwnCommits) {
@@ -5284,7 +5465,7 @@ var InBranchFlow = class extends IntegrationFlow {
5284
5465
  // src/cli/cmd/ci/flows/pull-request.ts
5285
5466
  var PullRequestFlow = class extends InBranchFlow {
5286
5467
  async preRun() {
5287
- const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _174 => _174()]);
5468
+ const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _189 => _189()]);
5288
5469
  if (!canContinue) {
5289
5470
  return false;
5290
5471
  }
@@ -5536,10 +5717,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
5536
5717
  repo_slug: this.platformConfig.repositoryName,
5537
5718
  state: "OPEN"
5538
5719
  }).then(({ data: { values } }) => {
5539
- return _optionalChain([values, 'optionalAccess', _175 => _175.find, 'call', _176 => _176(
5540
- ({ source, destination }) => _optionalChain([source, 'optionalAccess', _177 => _177.branch, 'optionalAccess', _178 => _178.name]) === branch && _optionalChain([destination, 'optionalAccess', _179 => _179.branch, 'optionalAccess', _180 => _180.name]) === this.platformConfig.baseBranchName
5720
+ return _optionalChain([values, 'optionalAccess', _190 => _190.find, 'call', _191 => _191(
5721
+ ({ source, destination }) => _optionalChain([source, 'optionalAccess', _192 => _192.branch, 'optionalAccess', _193 => _193.name]) === branch && _optionalChain([destination, 'optionalAccess', _194 => _194.branch, 'optionalAccess', _195 => _195.name]) === this.platformConfig.baseBranchName
5541
5722
  )]);
5542
- }).then((pr) => _optionalChain([pr, 'optionalAccess', _181 => _181.id]));
5723
+ }).then((pr) => _optionalChain([pr, 'optionalAccess', _196 => _196.id]));
5543
5724
  }
5544
5725
  async closePullRequest({ pullRequestNumber }) {
5545
5726
  await this.bb.repositories.declinePullRequest({
@@ -5635,7 +5816,7 @@ var GitHubPlatformKit = class extends PlatformKit {
5635
5816
  repo: this.platformConfig.repositoryName,
5636
5817
  base: this.platformConfig.baseBranchName,
5637
5818
  state: "open"
5638
- }).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _182 => _182.number]));
5819
+ }).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _197 => _197.number]));
5639
5820
  }
5640
5821
  async closePullRequest({ pullRequestNumber }) {
5641
5822
  await this.octokit.rest.pulls.update({
@@ -5762,7 +5943,7 @@ var GitlabPlatformKit = class extends PlatformKit {
5762
5943
  sourceBranch: branch,
5763
5944
  state: "opened"
5764
5945
  });
5765
- return _optionalChain([mergeRequests, 'access', _183 => _183[0], 'optionalAccess', _184 => _184.iid]);
5946
+ return _optionalChain([mergeRequests, 'access', _198 => _198[0], 'optionalAccess', _199 => _199.iid]);
5766
5947
  }
5767
5948
  async closePullRequest({
5768
5949
  pullRequestNumber
@@ -5846,7 +6027,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
5846
6027
  }
5847
6028
  const env = {
5848
6029
  LINGODOTDEV_API_KEY: settings.auth.apiKey,
5849
- LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _185 => _185.pullRequest, 'optionalAccess', _186 => _186.toString, 'call', _187 => _187()]) || "false",
6030
+ LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _200 => _200.pullRequest, 'optionalAccess', _201 => _201.toString, 'call', _202 => _202()]) || "false",
5850
6031
  ...options.commitMessage && {
5851
6032
  LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage
5852
6033
  },
@@ -5866,7 +6047,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
5866
6047
  const { isPullRequestMode } = platformKit.config;
5867
6048
  ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
5868
6049
  const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
5869
- const canRun = await _optionalChain([flow, 'access', _188 => _188.preRun, 'optionalCall', _189 => _189()]);
6050
+ const canRun = await _optionalChain([flow, 'access', _203 => _203.preRun, 'optionalCall', _204 => _204()]);
5870
6051
  if (canRun === false) {
5871
6052
  return;
5872
6053
  }
@@ -5874,7 +6055,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
5874
6055
  if (!hasChanges) {
5875
6056
  return;
5876
6057
  }
5877
- await _optionalChain([flow, 'access', _190 => _190.postRun, 'optionalCall', _191 => _191()]);
6058
+ await _optionalChain([flow, 'access', _205 => _205.postRun, 'optionalCall', _206 => _206()]);
5878
6059
  });
5879
6060
 
5880
6061
  // src/cli/cmd/status.ts
@@ -5918,13 +6099,13 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
5918
6099
  flags
5919
6100
  });
5920
6101
  let buckets = getBuckets(i18nConfig);
5921
- if (_optionalChain([flags, 'access', _192 => _192.bucket, 'optionalAccess', _193 => _193.length])) {
6102
+ if (_optionalChain([flags, 'access', _207 => _207.bucket, 'optionalAccess', _208 => _208.length])) {
5922
6103
  buckets = buckets.filter((bucket) => flags.bucket.includes(bucket.type));
5923
6104
  }
5924
6105
  ora.succeed("Buckets retrieved");
5925
- if (_optionalChain([flags, 'access', _194 => _194.file, 'optionalAccess', _195 => _195.length])) {
6106
+ if (_optionalChain([flags, 'access', _209 => _209.file, 'optionalAccess', _210 => _210.length])) {
5926
6107
  buckets = buckets.map((bucket) => {
5927
- const paths = bucket.paths.filter((path16) => flags.file.find((file) => _optionalChain([path16, 'access', _196 => _196.pathPattern, 'optionalAccess', _197 => _197.match, 'call', _198 => _198(file)])));
6108
+ const paths = bucket.paths.filter((path16) => flags.file.find((file) => _optionalChain([path16, 'access', _211 => _211.pathPattern, 'optionalAccess', _212 => _212.match, 'call', _213 => _213(file)])));
5928
6109
  return { ...bucket, paths };
5929
6110
  }).filter((bucket) => bucket.paths.length > 0);
5930
6111
  if (buckets.length === 0) {
@@ -5940,7 +6121,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
5940
6121
  });
5941
6122
  }
5942
6123
  }
5943
- const targetLocales = _optionalChain([flags, 'access', _199 => _199.locale, 'optionalAccess', _200 => _200.length]) ? flags.locale : i18nConfig.locale.targets;
6124
+ const targetLocales = _optionalChain([flags, 'access', _214 => _214.locale, 'optionalAccess', _215 => _215.length]) ? flags.locale : i18nConfig.locale.targets;
5944
6125
  let totalSourceKeyCount = 0;
5945
6126
  let uniqueKeysToTranslate = 0;
5946
6127
  let totalExistingTranslations = 0;
@@ -6281,12 +6462,12 @@ function validateParams2(i18nConfig, flags) {
6281
6462
  message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
6282
6463
  docUrl: "bucketNotFound"
6283
6464
  });
6284
- } else if (_optionalChain([flags, 'access', _201 => _201.locale, 'optionalAccess', _202 => _202.some, 'call', _203 => _203((locale) => !i18nConfig.locale.targets.includes(locale))])) {
6465
+ } else if (_optionalChain([flags, 'access', _216 => _216.locale, 'optionalAccess', _217 => _217.some, 'call', _218 => _218((locale) => !i18nConfig.locale.targets.includes(locale))])) {
6285
6466
  throw new CLIError({
6286
6467
  message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
6287
6468
  docUrl: "localeTargetNotFound"
6288
6469
  });
6289
- } else if (_optionalChain([flags, 'access', _204 => _204.bucket, 'optionalAccess', _205 => _205.some, 'call', _206 => _206((bucket) => !i18nConfig.buckets[bucket])])) {
6470
+ } else if (_optionalChain([flags, 'access', _219 => _219.bucket, 'optionalAccess', _220 => _220.some, 'call', _221 => _221((bucket) => !i18nConfig.buckets[bucket])])) {
6290
6471
  throw new CLIError({
6291
6472
  message: `One or more specified buckets do not exist in i18n.json. Please add them to the list and try again.`,
6292
6473
  docUrl: "bucketNotFound"
@@ -6369,7 +6550,7 @@ async function renderHero() {
6369
6550
  // package.json
6370
6551
  var package_default = {
6371
6552
  name: "lingo.dev",
6372
- version: "0.92.16",
6553
+ version: "0.92.18",
6373
6554
  description: "Lingo.dev CLI",
6374
6555
  private: false,
6375
6556
  publishConfig: {
@@ -6584,7 +6765,7 @@ function createLingoDotDevLocalizer(explicitApiKey) {
6584
6765
  const response = await engine.whoami();
6585
6766
  return {
6586
6767
  authenticated: !!response,
6587
- username: _optionalChain([response, 'optionalAccess', _207 => _207.email])
6768
+ username: _optionalChain([response, 'optionalAccess', _222 => _222.email])
6588
6769
  };
6589
6770
  } catch (e3) {
6590
6771
  return { authenticated: false };
@@ -6769,14 +6950,14 @@ async function setup(input2) {
6769
6950
  throw new Error(
6770
6951
  "No buckets found in i18n.json. Please add at least one bucket containing i18n content."
6771
6952
  );
6772
- } else if (_optionalChain([ctx, 'access', _208 => _208.flags, 'access', _209 => _209.locale, 'optionalAccess', _210 => _210.some, 'call', _211 => _211(
6773
- (locale) => !_optionalChain([ctx, 'access', _212 => _212.config, 'optionalAccess', _213 => _213.locale, 'access', _214 => _214.targets, 'access', _215 => _215.includes, 'call', _216 => _216(locale)])
6953
+ } else if (_optionalChain([ctx, 'access', _223 => _223.flags, 'access', _224 => _224.locale, 'optionalAccess', _225 => _225.some, 'call', _226 => _226(
6954
+ (locale) => !_optionalChain([ctx, 'access', _227 => _227.config, 'optionalAccess', _228 => _228.locale, 'access', _229 => _229.targets, 'access', _230 => _230.includes, 'call', _231 => _231(locale)])
6774
6955
  )])) {
6775
6956
  throw new Error(
6776
6957
  `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list first and try again.`
6777
6958
  );
6778
- } else if (_optionalChain([ctx, 'access', _217 => _217.flags, 'access', _218 => _218.bucket, 'optionalAccess', _219 => _219.some, 'call', _220 => _220(
6779
- (bucket) => !_optionalChain([ctx, 'access', _221 => _221.config, 'optionalAccess', _222 => _222.buckets, 'access', _223 => _223[bucket]])
6959
+ } else if (_optionalChain([ctx, 'access', _232 => _232.flags, 'access', _233 => _233.bucket, 'optionalAccess', _234 => _234.some, 'call', _235 => _235(
6960
+ (bucket) => !_optionalChain([ctx, 'access', _236 => _236.config, 'optionalAccess', _237 => _237.buckets, 'access', _238 => _238[bucket]])
6780
6961
  )])) {
6781
6962
  throw new Error(
6782
6963
  `One or more specified buckets do not exist in i18n.json. Please add them to the list first and try again.`
@@ -6788,7 +6969,7 @@ async function setup(input2) {
6788
6969
  {
6789
6970
  title: "Selecting localization provider",
6790
6971
  task: async (ctx, task) => {
6791
- ctx.localizer = createLocalizer(_optionalChain([ctx, 'access', _224 => _224.config, 'optionalAccess', _225 => _225.provider]));
6972
+ ctx.localizer = createLocalizer(_optionalChain([ctx, 'access', _239 => _239.config, 'optionalAccess', _240 => _240.provider]));
6792
6973
  if (!ctx.localizer) {
6793
6974
  throw new Error(
6794
6975
  "Could not create localization provider. Please check your i18n.json configuration."
@@ -6974,7 +7155,7 @@ async function execute(input2) {
6974
7155
  const workerTasks = [];
6975
7156
  for (let i = 0; i < workersCount; i++) {
6976
7157
  const assignedTasks = ctx.tasks.filter(
6977
- (_30, idx) => idx % workersCount === i
7158
+ (_33, idx) => idx % workersCount === i
6978
7159
  );
6979
7160
  workerTasks.push(
6980
7161
  createWorkerTask({
@@ -7309,7 +7490,7 @@ ${_gradientstring.vice.call(void 0,
7309
7490
 
7310
7491
  Star the the repo :) https://github.com/LingoDotDev/lingo.dev
7311
7492
  `
7312
- ).version(`v${package_default.version}`, "-v, --version", "Show version").addCommand(init_default).interactive("-y, --no-interactive", "Disable interactive mode").addCommand(i18n_default).addCommand(auth_default).addCommand(show_default).addCommand(lockfile_default).addCommand(cleanup_default).addCommand(mcp_default).addCommand(ci_default).addCommand(status_default).addCommand(may_the_fourth_default, { hidden: true }).addCommand(run_default, { hidden: true }).exitOverride((err) => {
7493
+ ).version(`v${package_default.version}`, "-v, --version", "Show version").addCommand(init_default).interactive("-y, --no-interactive", "Disable interactive mode").addCommand(i18n_default).addCommand(auth_default).addCommand(show_default).addCommand(config_default2).addCommand(lockfile_default).addCommand(cleanup_default).addCommand(mcp_default).addCommand(ci_default).addCommand(status_default).addCommand(may_the_fourth_default, { hidden: true }).addCommand(run_default, { hidden: true }).exitOverride((err) => {
7313
7494
  if (err.code === "commander.helpDisplayed" || err.code === "commander.version" || err.code === "commander.help") {
7314
7495
  process.exit(0);
7315
7496
  }