lingo.dev 0.95.0 → 0.97.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/build/cli.cjs CHANGED
@@ -29,7 +29,8 @@ function getSettings(explicitApiKey) {
29
29
  llm: {
30
30
  openaiApiKey: env.OPENAI_API_KEY || _optionalChain([systemFile, 'access', _40 => _40.llm, 'optionalAccess', _41 => _41.openaiApiKey]),
31
31
  anthropicApiKey: env.ANTHROPIC_API_KEY || _optionalChain([systemFile, 'access', _42 => _42.llm, 'optionalAccess', _43 => _43.anthropicApiKey]),
32
- groqApiKey: env.GROQ_API_KEY || _optionalChain([systemFile, 'access', _44 => _44.llm, 'optionalAccess', _45 => _45.groqApiKey])
32
+ groqApiKey: env.GROQ_API_KEY || _optionalChain([systemFile, 'access', _44 => _44.llm, 'optionalAccess', _45 => _45.groqApiKey]),
33
+ googleApiKey: env.GOOGLE_API_KEY || _optionalChain([systemFile, 'access', _46 => _46.llm, 'optionalAccess', _47 => _47.googleApiKey])
33
34
  }
34
35
  };
35
36
  }
@@ -57,7 +58,8 @@ var SettingsSchema = _zod2.default.object({
57
58
  llm: _zod2.default.object({
58
59
  openaiApiKey: _zod2.default.string().optional(),
59
60
  anthropicApiKey: _zod2.default.string().optional(),
60
- groqApiKey: _zod2.default.string().optional()
61
+ groqApiKey: _zod2.default.string().optional(),
62
+ googleApiKey: _zod2.default.string().optional()
61
63
  })
62
64
  });
63
65
  var SETTINGS_KEYS = flattenZodObject(
@@ -80,7 +82,8 @@ function _loadEnv() {
80
82
  LINGODOTDEV_WEB_URL: _zod2.default.string().optional(),
81
83
  OPENAI_API_KEY: _zod2.default.string().optional(),
82
84
  ANTHROPIC_API_KEY: _zod2.default.string().optional(),
83
- GROQ_API_KEY: _zod2.default.string().optional()
85
+ GROQ_API_KEY: _zod2.default.string().optional(),
86
+ GOOGLE_API_KEY: _zod2.default.string().optional()
84
87
  }).passthrough().parse(process.env);
85
88
  }
86
89
  function _loadSystemFile() {
@@ -96,7 +99,8 @@ function _loadSystemFile() {
96
99
  llm: _zod2.default.object({
97
100
  openaiApiKey: _zod2.default.string().optional(),
98
101
  anthropicApiKey: _zod2.default.string().optional(),
99
- groqApiKey: _zod2.default.string().optional()
102
+ groqApiKey: _zod2.default.string().optional(),
103
+ googleApiKey: _zod2.default.string().optional()
100
104
  }).optional()
101
105
  }).passthrough().parse(data);
102
106
  }
@@ -129,30 +133,36 @@ Please use LINGODOTDEV_API_KEY instead.
129
133
  function _envVarsInfo() {
130
134
  const env = _loadEnv();
131
135
  const systemFile = _loadSystemFile();
132
- if (env.LINGODOTDEV_API_KEY && _optionalChain([systemFile, 'access', _46 => _46.auth, 'optionalAccess', _47 => _47.apiKey])) {
136
+ if (env.LINGODOTDEV_API_KEY && _optionalChain([systemFile, 'access', _48 => _48.auth, 'optionalAccess', _49 => _49.apiKey])) {
133
137
  console.info(
134
138
  "\x1B[36m%s\x1B[0m",
135
139
  `\u2139\uFE0F Using LINGODOTDEV_API_KEY env var instead of credentials from user config`
136
140
  );
137
141
  }
138
- if (env.OPENAI_API_KEY && _optionalChain([systemFile, 'access', _48 => _48.llm, 'optionalAccess', _49 => _49.openaiApiKey])) {
142
+ if (env.OPENAI_API_KEY && _optionalChain([systemFile, 'access', _50 => _50.llm, 'optionalAccess', _51 => _51.openaiApiKey])) {
139
143
  console.info(
140
144
  "\x1B[36m%s\x1B[0m",
141
145
  `\u2139\uFE0F Using OPENAI_API_KEY env var instead of key from user config.`
142
146
  );
143
147
  }
144
- if (env.ANTHROPIC_API_KEY && _optionalChain([systemFile, 'access', _50 => _50.llm, 'optionalAccess', _51 => _51.anthropicApiKey])) {
148
+ if (env.ANTHROPIC_API_KEY && _optionalChain([systemFile, 'access', _52 => _52.llm, 'optionalAccess', _53 => _53.anthropicApiKey])) {
145
149
  console.info(
146
150
  "\x1B[36m%s\x1B[0m",
147
151
  `\u2139\uFE0F Using ANTHROPIC_API_KEY env var instead of key from user config`
148
152
  );
149
153
  }
150
- if (env.GROQ_API_KEY && _optionalChain([systemFile, 'access', _52 => _52.llm, 'optionalAccess', _53 => _53.groqApiKey])) {
154
+ if (env.GROQ_API_KEY && _optionalChain([systemFile, 'access', _54 => _54.llm, 'optionalAccess', _55 => _55.groqApiKey])) {
151
155
  console.info(
152
156
  "\x1B[36m%s\x1B[0m",
153
157
  `\u2139\uFE0F Using GROQ_API_KEY env var instead of key from user config`
154
158
  );
155
159
  }
160
+ if (env.GOOGLE_API_KEY && _optionalChain([systemFile, 'access', _56 => _56.llm, 'optionalAccess', _57 => _57.googleApiKey])) {
161
+ console.info(
162
+ "\x1B[36m%s\x1B[0m",
163
+ `\u2139\uFE0F Using GOOGLE_API_KEY env var instead of key from user config`
164
+ );
165
+ }
156
166
  if (env.LINGODOTDEV_API_URL) {
157
167
  console.info(
158
168
  "\x1B[36m%s\x1B[0m",
@@ -208,7 +218,7 @@ function createAuthenticator(params) {
208
218
  });
209
219
  if (res.ok) {
210
220
  const payload = await res.json();
211
- if (!_optionalChain([payload, 'optionalAccess', _54 => _54.email])) {
221
+ if (!_optionalChain([payload, 'optionalAccess', _58 => _58.email])) {
212
222
  return null;
213
223
  }
214
224
  return {
@@ -970,7 +980,7 @@ var init_default = new (0, _interactivecommander.InteractiveCommand)().command("
970
980
  });
971
981
  const auth2 = await newAuthenticator.whoami();
972
982
  if (auth2) {
973
- _ora2.default.call(void 0, ).succeed(`Authenticated as ${_optionalChain([auth2, 'optionalAccess', _55 => _55.email])}`);
983
+ _ora2.default.call(void 0, ).succeed(`Authenticated as ${_optionalChain([auth2, 'optionalAccess', _59 => _59.email])}`);
974
984
  } else {
975
985
  _ora2.default.call(void 0, ).fail("Authentication failed.");
976
986
  }
@@ -1055,7 +1065,7 @@ function getBuckets(i18nConfig) {
1055
1065
  const includeItems = bucketEntry.include.map(
1056
1066
  (item) => resolveBucketItem(item)
1057
1067
  );
1058
- const excludeItems = _optionalChain([bucketEntry, 'access', _56 => _56.exclude, 'optionalAccess', _57 => _57.map, 'call', _58 => _58(
1068
+ const excludeItems = _optionalChain([bucketEntry, 'access', _60 => _60.exclude, 'optionalAccess', _61 => _61.map, 'call', _62 => _62(
1059
1069
  (item) => resolveBucketItem(item)
1060
1070
  )]);
1061
1071
  const config = {
@@ -1093,7 +1103,7 @@ function extractPathPatterns(sourceLocale, include, exclude) {
1093
1103
  delimiter: pattern.delimiter
1094
1104
  }))
1095
1105
  );
1096
- const excludedPatterns = _optionalChain([exclude, 'optionalAccess', _59 => _59.flatMap, 'call', _60 => _60(
1106
+ const excludedPatterns = _optionalChain([exclude, 'optionalAccess', _63 => _63.flatMap, 'call', _64 => _64(
1097
1107
  (pattern) => expandPlaceholderedGlob(
1098
1108
  pattern.path,
1099
1109
  __spec.resolveOverriddenLocale.call(void 0, sourceLocale, pattern.delimiter)
@@ -1346,12 +1356,12 @@ function composeLoaders(...loaders) {
1346
1356
  return {
1347
1357
  init: async () => {
1348
1358
  for (const loader of loaders) {
1349
- await _optionalChain([loader, 'access', _61 => _61.init, 'optionalCall', _62 => _62()]);
1359
+ await _optionalChain([loader, 'access', _65 => _65.init, 'optionalCall', _66 => _66()]);
1350
1360
  }
1351
1361
  },
1352
1362
  setDefaultLocale(locale) {
1353
1363
  for (const loader of loaders) {
1354
- _optionalChain([loader, 'access', _63 => _63.setDefaultLocale, 'optionalCall', _64 => _64(locale)]);
1364
+ _optionalChain([loader, 'access', _67 => _67.setDefaultLocale, 'optionalCall', _68 => _68(locale)]);
1355
1365
  }
1356
1366
  return this;
1357
1367
  },
@@ -1384,7 +1394,7 @@ function createLoader(lDefinition) {
1384
1394
  if (state.initCtx) {
1385
1395
  return state.initCtx;
1386
1396
  }
1387
- state.initCtx = await _optionalChain([lDefinition, 'access', _65 => _65.init, 'optionalCall', _66 => _66()]);
1397
+ state.initCtx = await _optionalChain([lDefinition, 'access', _69 => _69.init, 'optionalCall', _70 => _70()]);
1388
1398
  return state.initCtx;
1389
1399
  },
1390
1400
  setDefaultLocale(locale) {
@@ -1489,7 +1499,7 @@ function createNormalizeLoader() {
1489
1499
  return normalized;
1490
1500
  },
1491
1501
  push: async (locale, data, originalInput) => {
1492
- const keysMap = _nullishCoalesce(_optionalChain([originalInput, 'optionalAccess', _67 => _67.keysMap]), () => ( {}));
1502
+ const keysMap = _nullishCoalesce(_optionalChain([originalInput, 'optionalAccess', _71 => _71.keysMap]), () => ( {}));
1493
1503
  const input2 = mapDenormalizedKeys(data, keysMap);
1494
1504
  const denormalized = _flat.unflatten.call(void 0, input2, {
1495
1505
  delimiter: "/",
@@ -1592,8 +1602,8 @@ async function getTrailingNewLine(pathPattern, locale, originalLocale) {
1592
1602
  if (!templateData) {
1593
1603
  templateData = await readFileForLocale(pathPattern, originalLocale);
1594
1604
  }
1595
- if (_optionalChain([templateData, 'optionalAccess', _68 => _68.match, 'call', _69 => _69(/[\r\n]$/)])) {
1596
- 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";
1605
+ if (_optionalChain([templateData, 'optionalAccess', _72 => _72.match, 'call', _73 => _73(/[\r\n]$/)])) {
1606
+ const ending = _optionalChain([templateData, 'optionalAccess', _74 => _74.includes, 'call', _75 => _75("\r\n")]) ? "\r\n" : _optionalChain([templateData, 'optionalAccess', _76 => _76.includes, 'call', _77 => _77("\r")]) ? "\r" : "\n";
1597
1607
  return ending;
1598
1608
  }
1599
1609
  return "";
@@ -1857,7 +1867,7 @@ var _sync3 = require('csv-stringify/sync');
1857
1867
 
1858
1868
  function detectKeyColumnName(csvString) {
1859
1869
  const row = _sync.parse.call(void 0, csvString)[0];
1860
- const firstColumn = _optionalChain([row, 'optionalAccess', _74 => _74[0], 'optionalAccess', _75 => _75.trim, 'call', _76 => _76()]);
1870
+ const firstColumn = _optionalChain([row, 'optionalAccess', _78 => _78[0], 'optionalAccess', _79 => _79.trim, 'call', _80 => _80()]);
1861
1871
  return firstColumn || "KEY";
1862
1872
  }
1863
1873
  function createCsvLoader() {
@@ -1955,7 +1965,7 @@ function createHtmlLoader() {
1955
1965
  break;
1956
1966
  }
1957
1967
  const siblings = Array.from(parent.childNodes).filter(
1958
- (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _77 => _77.textContent, 'optionalAccess', _78 => _78.trim, 'call', _79 => _79()])
1968
+ (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _81 => _81.textContent, 'optionalAccess', _82 => _82.trim, 'call', _83 => _83()])
1959
1969
  );
1960
1970
  const index = siblings.indexOf(current);
1961
1971
  if (index !== -1) {
@@ -1990,11 +2000,11 @@ function createHtmlLoader() {
1990
2000
  result[getPath(element, attr)] = value;
1991
2001
  }
1992
2002
  });
1993
- Array.from(element.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _80 => _80.textContent, 'optionalAccess', _81 => _81.trim, 'call', _82 => _82()])).forEach(processNode);
2003
+ Array.from(element.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _84 => _84.textContent, 'optionalAccess', _85 => _85.trim, 'call', _86 => _86()])).forEach(processNode);
1994
2004
  }
1995
2005
  };
1996
- Array.from(document.head.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _83 => _83.textContent, 'optionalAccess', _84 => _84.trim, 'call', _85 => _85()])).forEach(processNode);
1997
- Array.from(document.body.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _86 => _86.textContent, 'optionalAccess', _87 => _87.trim, 'call', _88 => _88()])).forEach(processNode);
2006
+ Array.from(document.head.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _87 => _87.textContent, 'optionalAccess', _88 => _88.trim, 'call', _89 => _89()])).forEach(processNode);
2007
+ Array.from(document.body.childNodes).filter((n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _90 => _90.textContent, 'optionalAccess', _91 => _91.trim, 'call', _92 => _92()])).forEach(processNode);
1998
2008
  return result;
1999
2009
  },
2000
2010
  async push(locale, data, originalInput) {
@@ -2016,7 +2026,7 @@ function createHtmlLoader() {
2016
2026
  for (let i = 0; i < indices.length; i++) {
2017
2027
  const index = parseInt(indices[i]);
2018
2028
  const siblings = Array.from(parent.childNodes).filter(
2019
- (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _89 => _89.textContent, 'optionalAccess', _90 => _90.trim, 'call', _91 => _91()])
2029
+ (n) => n.nodeType === 1 || n.nodeType === 3 && _optionalChain([n, 'access', _93 => _93.textContent, 'optionalAccess', _94 => _94.trim, 'call', _95 => _95()])
2020
2030
  );
2021
2031
  if (index >= siblings.length) {
2022
2032
  if (i === indices.length - 1) {
@@ -2067,7 +2077,7 @@ function createMarkdownLoader() {
2067
2077
  yaml: yamlEngine
2068
2078
  }
2069
2079
  });
2070
- const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess', _92 => _92.trim, 'call', _93 => _93()]), () => ( ""))).filter(Boolean);
2080
+ const sections = content.split(SECTION_REGEX).map((section) => _nullishCoalesce(_optionalChain([section, 'optionalAccess', _96 => _96.trim, 'call', _97 => _97()]), () => ( ""))).filter(Boolean);
2071
2081
  return {
2072
2082
  ...Object.fromEntries(
2073
2083
  sections.map((section, index) => [`${MD_SECTION_PREFIX}${index}`, section]).filter(([, section]) => Boolean(section))
@@ -2079,7 +2089,7 @@ function createMarkdownLoader() {
2079
2089
  const frontmatter = Object.fromEntries(
2080
2090
  Object.entries(data).filter(([key]) => key.startsWith(FM_ATTR_PREFIX)).map(([key, value]) => [key.replace(FM_ATTR_PREFIX, ""), value])
2081
2091
  );
2082
- 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', _94 => _94.trim, 'call', _95 => _95()]), () => ( ""))).filter(Boolean).join("\n\n");
2092
+ 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', _98 => _98.trim, 'call', _99 => _99()]), () => ( ""))).filter(Boolean).join("\n\n");
2083
2093
  if (Object.keys(frontmatter).length > 0) {
2084
2094
  content = `
2085
2095
  ${content}`;
@@ -2123,7 +2133,7 @@ function isSkippableLine(line) {
2123
2133
  function parsePropertyLine(line) {
2124
2134
  const [key, ...valueParts] = line.split("=");
2125
2135
  return {
2126
- key: _optionalChain([key, 'optionalAccess', _96 => _96.trim, 'call', _97 => _97()]) || "",
2136
+ key: _optionalChain([key, 'optionalAccess', _100 => _100.trim, 'call', _101 => _101()]) || "",
2127
2137
  value: valueParts.join("=").trim()
2128
2138
  };
2129
2139
  }
@@ -2209,7 +2219,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
2209
2219
  if (rootTranslationEntity.shouldTranslate === false) {
2210
2220
  continue;
2211
2221
  }
2212
- const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _98 => _98.localizations, 'optionalAccess', _99 => _99[locale]]);
2222
+ const langTranslationEntity = _optionalChain([rootTranslationEntity, 'optionalAccess', _102 => _102.localizations, 'optionalAccess', _103 => _103[locale]]);
2213
2223
  if (langTranslationEntity) {
2214
2224
  if ("stringUnit" in langTranslationEntity) {
2215
2225
  resultData[translationKey] = langTranslationEntity.stringUnit.value;
@@ -2218,7 +2228,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
2218
2228
  resultData[translationKey] = {};
2219
2229
  const pluralForms = langTranslationEntity.variations.plural;
2220
2230
  for (const form in pluralForms) {
2221
- if (_optionalChain([pluralForms, 'access', _100 => _100[form], 'optionalAccess', _101 => _101.stringUnit, 'optionalAccess', _102 => _102.value])) {
2231
+ if (_optionalChain([pluralForms, 'access', _104 => _104[form], 'optionalAccess', _105 => _105.stringUnit, 'optionalAccess', _106 => _106.value])) {
2222
2232
  resultData[translationKey][form] = pluralForms[form].stringUnit.value;
2223
2233
  }
2224
2234
  }
@@ -2241,7 +2251,7 @@ function createXcodeXcstringsLoader(defaultLocale) {
2241
2251
  const hasDoNotTranslateFlag = originalInput && originalInput.strings && originalInput.strings[key] && originalInput.strings[key].shouldTranslate === false;
2242
2252
  if (typeof value === "string") {
2243
2253
  langDataToMerge.strings[key] = {
2244
- extractionState: _optionalChain([originalInput, 'optionalAccess', _103 => _103.strings, 'optionalAccess', _104 => _104[key], 'optionalAccess', _105 => _105.extractionState]),
2254
+ extractionState: _optionalChain([originalInput, 'optionalAccess', _107 => _107.strings, 'optionalAccess', _108 => _108[key], 'optionalAccess', _109 => _109.extractionState]),
2245
2255
  localizations: {
2246
2256
  [locale]: {
2247
2257
  stringUnit: {
@@ -2424,7 +2434,7 @@ function createPoDataLoader(params) {
2424
2434
  Object.entries(entries).forEach(([msgid, entry]) => {
2425
2435
  if (msgid && entry.msgid) {
2426
2436
  const context = entry.msgctxt || "";
2427
- const fullEntry = _optionalChain([parsedPo, 'access', _106 => _106.translations, 'access', _107 => _107[context], 'optionalAccess', _108 => _108[msgid]]);
2437
+ const fullEntry = _optionalChain([parsedPo, 'access', _110 => _110.translations, 'access', _111 => _111[context], 'optionalAccess', _112 => _112[msgid]]);
2428
2438
  if (fullEntry) {
2429
2439
  result[msgid] = fullEntry;
2430
2440
  }
@@ -2434,8 +2444,8 @@ function createPoDataLoader(params) {
2434
2444
  return result;
2435
2445
  },
2436
2446
  async push(locale, data, originalInput, originalLocale, pullInput) {
2437
- const currentSections = _optionalChain([pullInput, 'optionalAccess', _109 => _109.split, 'call', _110 => _110("\n\n"), 'access', _111 => _111.filter, 'call', _112 => _112(Boolean)]) || [];
2438
- const originalSections = _optionalChain([originalInput, 'optionalAccess', _113 => _113.split, 'call', _114 => _114("\n\n"), 'access', _115 => _115.filter, 'call', _116 => _116(Boolean)]) || [];
2447
+ const currentSections = _optionalChain([pullInput, 'optionalAccess', _113 => _113.split, 'call', _114 => _114("\n\n"), 'access', _115 => _115.filter, 'call', _116 => _116(Boolean)]) || [];
2448
+ const originalSections = _optionalChain([originalInput, 'optionalAccess', _117 => _117.split, 'call', _118 => _118("\n\n"), 'access', _119 => _119.filter, 'call', _120 => _120(Boolean)]) || [];
2439
2449
  const result = originalSections.map((section) => {
2440
2450
  const sectionPo = _gettextparser2.default.po.parse(section);
2441
2451
  if (Object.keys(sectionPo.translations).length === 0) {
@@ -2504,8 +2514,8 @@ function createPoContentLoader() {
2504
2514
  {
2505
2515
  ...entry,
2506
2516
  msgstr: [
2507
- _optionalChain([data, 'access', _117 => _117[entry.msgid], 'optionalAccess', _118 => _118.singular]),
2508
- _optionalChain([data, 'access', _119 => _119[entry.msgid], 'optionalAccess', _120 => _120.plural]) || null
2517
+ _optionalChain([data, 'access', _121 => _121[entry.msgid], 'optionalAccess', _122 => _122.singular]),
2518
+ _optionalChain([data, 'access', _123 => _123[entry.msgid], 'optionalAccess', _124 => _124.plural]) || null
2509
2519
  ].filter(Boolean)
2510
2520
  }
2511
2521
  ]).fromPairs().value();
@@ -2781,7 +2791,7 @@ function createDatoClient(params) {
2781
2791
  only_valid: "true",
2782
2792
  ids: !records.length ? void 0 : records.join(",")
2783
2793
  }
2784
- }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _121 => _121.response, 'optionalAccess', _122 => _122.body, 'optionalAccess', _123 => _123.data, 'optionalAccess', _124 => _124[0]]) || error));
2794
+ }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _125 => _125.response, 'optionalAccess', _126 => _126.body, 'optionalAccess', _127 => _127.data, 'optionalAccess', _128 => _128[0]]) || error));
2785
2795
  },
2786
2796
  findRecordsForModel: async (modelId, records) => {
2787
2797
  try {
@@ -2791,9 +2801,9 @@ function createDatoClient(params) {
2791
2801
  filter: {
2792
2802
  type: modelId,
2793
2803
  only_valid: "true",
2794
- ids: !_optionalChain([records, 'optionalAccess', _125 => _125.length]) ? void 0 : records.join(",")
2804
+ ids: !_optionalChain([records, 'optionalAccess', _129 => _129.length]) ? void 0 : records.join(",")
2795
2805
  }
2796
- }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _126 => _126.response, 'optionalAccess', _127 => _127.body, 'optionalAccess', _128 => _128.data, 'optionalAccess', _129 => _129[0]]) || error));
2806
+ }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _130 => _130.response, 'optionalAccess', _131 => _131.body, 'optionalAccess', _132 => _132.data, 'optionalAccess', _133 => _133[0]]) || error));
2797
2807
  return result;
2798
2808
  } catch (_error) {
2799
2809
  throw new Error(
@@ -2807,9 +2817,9 @@ function createDatoClient(params) {
2807
2817
  },
2808
2818
  updateRecord: async (id, payload) => {
2809
2819
  try {
2810
- await dato.items.update(id, payload).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _130 => _130.response, 'optionalAccess', _131 => _131.body, 'optionalAccess', _132 => _132.data, 'optionalAccess', _133 => _133[0]]) || error));
2820
+ await dato.items.update(id, payload).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _134 => _134.response, 'optionalAccess', _135 => _135.body, 'optionalAccess', _136 => _136.data, 'optionalAccess', _137 => _137[0]]) || error));
2811
2821
  } catch (_error) {
2812
- if (_optionalChain([_error, 'optionalAccess', _134 => _134.attributes, 'optionalAccess', _135 => _135.details, 'optionalAccess', _136 => _136.message])) {
2822
+ if (_optionalChain([_error, 'optionalAccess', _138 => _138.attributes, 'optionalAccess', _139 => _139.details, 'optionalAccess', _140 => _140.message])) {
2813
2823
  throw new Error(
2814
2824
  [
2815
2825
  `${_error.attributes.details.message}`,
@@ -2830,9 +2840,9 @@ function createDatoClient(params) {
2830
2840
  },
2831
2841
  enableFieldLocalization: async (args) => {
2832
2842
  try {
2833
- await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _137 => _137.response, 'optionalAccess', _138 => _138.body, 'optionalAccess', _139 => _139.data, 'optionalAccess', _140 => _140[0]]) || error));
2843
+ await dato.fields.update(`${args.modelId}::${args.fieldId}`, { localized: true }).catch((error) => Promise.reject(_optionalChain([error, 'optionalAccess', _141 => _141.response, 'optionalAccess', _142 => _142.body, 'optionalAccess', _143 => _143.data, 'optionalAccess', _144 => _144[0]]) || error));
2834
2844
  } catch (_error) {
2835
- if (_optionalChain([_error, 'optionalAccess', _141 => _141.attributes, 'optionalAccess', _142 => _142.code]) === "NOT_FOUND") {
2845
+ if (_optionalChain([_error, 'optionalAccess', _145 => _145.attributes, 'optionalAccess', _146 => _146.code]) === "NOT_FOUND") {
2836
2846
  throw new Error(
2837
2847
  [
2838
2848
  `Field "${args.fieldId}" not found in model "${args.modelId}".`,
@@ -2840,7 +2850,7 @@ function createDatoClient(params) {
2840
2850
  ].join("\n\n")
2841
2851
  );
2842
2852
  }
2843
- if (_optionalChain([_error, 'optionalAccess', _143 => _143.attributes, 'optionalAccess', _144 => _144.details, 'optionalAccess', _145 => _145.message])) {
2853
+ if (_optionalChain([_error, 'optionalAccess', _147 => _147.attributes, 'optionalAccess', _148 => _148.details, 'optionalAccess', _149 => _149.message])) {
2844
2854
  throw new Error(
2845
2855
  [`${_error.attributes.details.message}`, `Error: ${JSON.stringify(_error, null, 2)}`].join("\n\n")
2846
2856
  );
@@ -2906,7 +2916,7 @@ function createDatoApiLoader(config, onConfigUpdate) {
2906
2916
  }
2907
2917
  }
2908
2918
  const records = await dato.findRecordsForModel(modelId);
2909
- const recordChoices = createRecordChoices(records, _optionalChain([config, 'access', _146 => _146.models, 'access', _147 => _147[modelId], 'optionalAccess', _148 => _148.records]) || [], project);
2919
+ const recordChoices = createRecordChoices(records, _optionalChain([config, 'access', _150 => _150.models, 'access', _151 => _151[modelId], 'optionalAccess', _152 => _152.records]) || [], project);
2910
2920
  const selectedRecords = await promptRecordSelection(modelName, recordChoices);
2911
2921
  result.models[modelId].records = records.filter((record) => selectedRecords.includes(record.id));
2912
2922
  updatedConfig.models[modelId].records = selectedRecords;
@@ -2918,14 +2928,14 @@ function createDatoApiLoader(config, onConfigUpdate) {
2918
2928
  },
2919
2929
  async pull(locale, input2, initCtx) {
2920
2930
  const result = {};
2921
- for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _149 => _149.models]) || {})) {
2922
- let records = _optionalChain([initCtx, 'optionalAccess', _150 => _150.models, 'access', _151 => _151[modelId], 'access', _152 => _152.records]) || [];
2931
+ for (const modelId of _lodash2.default.keys(_optionalChain([initCtx, 'optionalAccess', _153 => _153.models]) || {})) {
2932
+ let records = _optionalChain([initCtx, 'optionalAccess', _154 => _154.models, 'access', _155 => _155[modelId], 'access', _156 => _156.records]) || [];
2923
2933
  const recordIds = records.map((record) => record.id);
2924
2934
  records = await dato.findRecords(recordIds);
2925
2935
  console.log(`Fetched ${records.length} records for model ${modelId}`);
2926
2936
  if (records.length > 0) {
2927
2937
  result[modelId] = {
2928
- fields: _optionalChain([initCtx, 'optionalAccess', _153 => _153.models, 'optionalAccess', _154 => _154[modelId], 'optionalAccess', _155 => _155.fields]) || [],
2938
+ fields: _optionalChain([initCtx, 'optionalAccess', _157 => _157.models, 'optionalAccess', _158 => _158[modelId], 'optionalAccess', _159 => _159.fields]) || [],
2929
2939
  records
2930
2940
  };
2931
2941
  }
@@ -2984,7 +2994,7 @@ function createRecordChoices(records, selectedIds = [], project) {
2984
2994
  return records.map((record) => ({
2985
2995
  name: `${record.id} - https://${project.internal_domain}/editor/item_types/${record.item_type.id}/items/${record.id}`,
2986
2996
  value: record.id,
2987
- checked: _optionalChain([selectedIds, 'optionalAccess', _156 => _156.includes, 'call', _157 => _157(record.id)])
2997
+ checked: _optionalChain([selectedIds, 'optionalAccess', _160 => _160.includes, 'call', _161 => _161(record.id)])
2988
2998
  }));
2989
2999
  }
2990
3000
  async function promptRecordSelection(modelName, choices) {
@@ -3251,7 +3261,7 @@ var _nodewebvtt = require('node-webvtt'); var _nodewebvtt2 = _interopRequireDefa
3251
3261
  function createVttLoader() {
3252
3262
  return createLoader({
3253
3263
  async pull(locale, input2) {
3254
- const vtt = _optionalChain([_nodewebvtt2.default, 'access', _158 => _158.parse, 'call', _159 => _159(input2), 'optionalAccess', _160 => _160.cues]);
3264
+ const vtt = _optionalChain([_nodewebvtt2.default, 'access', _162 => _162.parse, 'call', _163 => _163(input2), 'optionalAccess', _164 => _164.cues]);
3255
3265
  if (Object.keys(vtt).length === 0) {
3256
3266
  return {};
3257
3267
  } else {
@@ -3305,7 +3315,7 @@ function variableExtractLoader(params) {
3305
3315
  for (let i = 0; i < matches.length; i++) {
3306
3316
  const match = matches[i];
3307
3317
  const currentValue = result[key].value;
3308
- const newValue = _optionalChain([currentValue, 'optionalAccess', _161 => _161.replace, 'call', _162 => _162(match, `{variable:${i}}`)]);
3318
+ const newValue = _optionalChain([currentValue, 'optionalAccess', _165 => _165.replace, 'call', _166 => _166(match, `{variable:${i}}`)]);
3309
3319
  result[key].value = newValue;
3310
3320
  result[key].variables[i] = match;
3311
3321
  }
@@ -3319,7 +3329,7 @@ function variableExtractLoader(params) {
3319
3329
  for (let i = 0; i < valueObj.variables.length; i++) {
3320
3330
  const variable = valueObj.variables[i];
3321
3331
  const currentValue = result[key];
3322
- const newValue = _optionalChain([currentValue, 'optionalAccess', _163 => _163.replace, 'call', _164 => _164(`{variable:${i}}`, variable)]);
3332
+ const newValue = _optionalChain([currentValue, 'optionalAccess', _167 => _167.replace, 'call', _168 => _168(`{variable:${i}}`, variable)]);
3323
3333
  result[key] = newValue;
3324
3334
  }
3325
3335
  }
@@ -3502,7 +3512,7 @@ function createVueJsonLoader() {
3502
3512
  return createLoader({
3503
3513
  pull: async (locale, input2, ctx) => {
3504
3514
  const parsed = parseVueFile(input2);
3505
- return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _165 => _165.i18n, 'optionalAccess', _166 => _166[locale]]), () => ( {}));
3515
+ return _nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _169 => _169.i18n, 'optionalAccess', _170 => _170[locale]]), () => ( {}));
3506
3516
  },
3507
3517
  push: async (locale, data, originalInput) => {
3508
3518
  const parsed = parseVueFile(_nullishCoalesce(originalInput, () => ( "")));
@@ -3683,7 +3693,7 @@ function updateStringsInObjectExpression(objectExpression, data) {
3683
3693
  objectExpression.properties.forEach((prop) => {
3684
3694
  if (!t.isObjectProperty(prop)) return;
3685
3695
  const key = getPropertyKey(prop);
3686
- const incomingVal = _optionalChain([data, 'optionalAccess', _167 => _167[key]]);
3696
+ const incomingVal = _optionalChain([data, 'optionalAccess', _171 => _171[key]]);
3687
3697
  if (incomingVal === void 0) {
3688
3698
  return;
3689
3699
  }
@@ -3719,7 +3729,7 @@ function updateStringsInArrayExpression(arrayExpression, incoming) {
3719
3729
  let modified = false;
3720
3730
  arrayExpression.elements.forEach((element, index) => {
3721
3731
  if (!element) return;
3722
- const incomingVal = _optionalChain([incoming, 'optionalAccess', _168 => _168[index]]);
3732
+ const incomingVal = _optionalChain([incoming, 'optionalAccess', _172 => _172[index]]);
3723
3733
  if (incomingVal === void 0) return;
3724
3734
  if (t.isStringLiteral(element) && typeof incomingVal === "string") {
3725
3735
  if (element.value !== incomingVal) {
@@ -3995,7 +4005,7 @@ function createMdxSectionsSplit2Loader() {
3995
4005
  const content = _lodash2.default.chain(data.sections).values().join("\n\n").value();
3996
4006
  const result = {
3997
4007
  frontmatter: data.frontmatter,
3998
- codePlaceholders: _optionalChain([pullInput, 'optionalAccess', _169 => _169.codePlaceholders]) || {},
4008
+ codePlaceholders: _optionalChain([pullInput, 'optionalAccess', _173 => _173.codePlaceholders]) || {},
3999
4009
  content
4000
4010
  };
4001
4011
  return result;
@@ -4438,7 +4448,7 @@ function createBasicTranslator(model, systemPrompt) {
4438
4448
  ]
4439
4449
  });
4440
4450
  const result = JSON.parse(response.text);
4441
- return _optionalChain([result, 'optionalAccess', _170 => _170.data]) || {};
4451
+ return _optionalChain([result, 'optionalAccess', _174 => _174.data]) || {};
4442
4452
  }
4443
4453
  }
4444
4454
  function extractPayloadChunks(payload) {
@@ -4479,6 +4489,7 @@ function countWordsInRecord(payload) {
4479
4489
  // src/cli/processor/index.ts
4480
4490
  var _openai = require('@ai-sdk/openai');
4481
4491
  var _anthropic = require('@ai-sdk/anthropic');
4492
+ var _google = require('@ai-sdk/google');
4482
4493
  function createProcessor(provider, params) {
4483
4494
  if (!provider) {
4484
4495
  const result = createLingoLocalizer(params);
@@ -4508,7 +4519,7 @@ function getPureModelProvider(provider) {
4508
4519
 
4509
4520
  ${_chalk2.default.hex(colors.blue)("Docs: https://lingo.dev/go/docs")}
4510
4521
  `;
4511
- switch (_optionalChain([provider, 'optionalAccess', _171 => _171.id])) {
4522
+ switch (_optionalChain([provider, 'optionalAccess', _175 => _175.id])) {
4512
4523
  case "openai":
4513
4524
  if (!process.env.OPENAI_API_KEY) {
4514
4525
  throw new Error(
@@ -4528,8 +4539,17 @@ function getPureModelProvider(provider) {
4528
4539
  return _anthropic.createAnthropic.call(void 0, {
4529
4540
  apiKey: process.env.ANTHROPIC_API_KEY
4530
4541
  })(provider.model);
4542
+ case "google":
4543
+ if (!process.env.GOOGLE_API_KEY) {
4544
+ throw new Error(
4545
+ createMissingKeyErrorMessage("Google", "GOOGLE_API_KEY")
4546
+ );
4547
+ }
4548
+ return _google.createGoogleGenerativeAI.call(void 0, {
4549
+ apiKey: process.env.GOOGLE_API_KEY
4550
+ })(provider.model);
4531
4551
  default:
4532
- throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess', _172 => _172.id])));
4552
+ throw new Error(createUnsupportedProviderErrorMessage(_optionalChain([provider, 'optionalAccess', _176 => _176.id])));
4533
4553
  }
4534
4554
  }
4535
4555
 
@@ -4753,7 +4773,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
4753
4773
  validateParams(i18nConfig, flags);
4754
4774
  ora.succeed("Localization configuration is valid");
4755
4775
  ora.start("Connecting to Lingo.dev Localization Engine...");
4756
- const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _173 => _173.provider]);
4776
+ const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _177 => _177.provider]);
4757
4777
  if (isByokMode) {
4758
4778
  authId = null;
4759
4779
  ora.succeed("Using external provider (BYOK mode)");
@@ -4767,16 +4787,16 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
4767
4787
  flags
4768
4788
  });
4769
4789
  let buckets = getBuckets(i18nConfig);
4770
- if (_optionalChain([flags, 'access', _174 => _174.bucket, 'optionalAccess', _175 => _175.length])) {
4790
+ if (_optionalChain([flags, 'access', _178 => _178.bucket, 'optionalAccess', _179 => _179.length])) {
4771
4791
  buckets = buckets.filter(
4772
4792
  (bucket) => flags.bucket.includes(bucket.type)
4773
4793
  );
4774
4794
  }
4775
4795
  ora.succeed("Buckets retrieved");
4776
- if (_optionalChain([flags, 'access', _176 => _176.file, 'optionalAccess', _177 => _177.length])) {
4796
+ if (_optionalChain([flags, 'access', _180 => _180.file, 'optionalAccess', _181 => _181.length])) {
4777
4797
  buckets = buckets.map((bucket) => {
4778
4798
  const paths = bucket.paths.filter(
4779
- (path16) => flags.file.find((file) => _optionalChain([path16, 'access', _178 => _178.pathPattern, 'optionalAccess', _179 => _179.includes, 'call', _180 => _180(file)]))
4799
+ (path16) => flags.file.find((file) => _optionalChain([path16, 'access', _182 => _182.pathPattern, 'optionalAccess', _183 => _183.includes, 'call', _184 => _184(file)]))
4780
4800
  );
4781
4801
  return { ...bucket, paths };
4782
4802
  }).filter((bucket) => bucket.paths.length > 0);
@@ -4795,7 +4815,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
4795
4815
  });
4796
4816
  }
4797
4817
  }
4798
- const targetLocales = _optionalChain([flags, 'access', _181 => _181.locale, 'optionalAccess', _182 => _182.length]) ? flags.locale : i18nConfig.locale.targets;
4818
+ const targetLocales = _optionalChain([flags, 'access', _185 => _185.locale, 'optionalAccess', _186 => _186.length]) ? flags.locale : i18nConfig.locale.targets;
4799
4819
  ora.start("Setting up localization cache...");
4800
4820
  const checkLockfileProcessor = createDeltaProcessor("");
4801
4821
  const lockfileExists = await checkLockfileProcessor.checkIfLockExists();
@@ -5139,12 +5159,12 @@ function validateParams(i18nConfig, flags) {
5139
5159
  message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
5140
5160
  docUrl: "bucketNotFound"
5141
5161
  });
5142
- } else if (_optionalChain([flags, 'access', _183 => _183.locale, 'optionalAccess', _184 => _184.some, 'call', _185 => _185((locale) => !i18nConfig.locale.targets.includes(locale))])) {
5162
+ } else if (_optionalChain([flags, 'access', _187 => _187.locale, 'optionalAccess', _188 => _188.some, 'call', _189 => _189((locale) => !i18nConfig.locale.targets.includes(locale))])) {
5143
5163
  throw new CLIError({
5144
5164
  message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
5145
5165
  docUrl: "localeTargetNotFound"
5146
5166
  });
5147
- } else if (_optionalChain([flags, 'access', _186 => _186.bucket, 'optionalAccess', _187 => _187.some, 'call', _188 => _188(
5167
+ } else if (_optionalChain([flags, 'access', _190 => _190.bucket, 'optionalAccess', _191 => _191.some, 'call', _192 => _192(
5148
5168
  (bucket) => !i18nConfig.buckets[bucket]
5149
5169
  )])) {
5150
5170
  throw new CLIError({
@@ -5594,7 +5614,7 @@ function createLingoDotDevLocalizer(explicitApiKey) {
5594
5614
  const response = await engine.whoami();
5595
5615
  return {
5596
5616
  authenticated: !!response,
5597
- username: _optionalChain([response, 'optionalAccess', _189 => _189.email])
5617
+ username: _optionalChain([response, 'optionalAccess', _193 => _193.email])
5598
5618
  };
5599
5619
  } catch (e2) {
5600
5620
  return { authenticated: false };
@@ -5628,17 +5648,18 @@ function createLingoDotDevLocalizer(explicitApiKey) {
5628
5648
 
5629
5649
 
5630
5650
 
5651
+
5631
5652
  function createExplicitLocalizer(provider) {
5632
5653
  switch (provider.id) {
5633
5654
  default:
5634
5655
  throw new Error(
5635
5656
  _dedent2.default`
5636
5657
  You're trying to use unsupported provider: ${_chalk2.default.dim(provider.id)}.
5637
-
5658
+
5638
5659
  To fix this issue:
5639
5660
  1. Switch to one of the supported providers, or
5640
5661
  2. Remove the ${_chalk2.default.italic("provider")} node from your i18n.json configuration to switch to ${_chalk2.default.hex(colors.green)("Lingo.dev")}
5641
-
5662
+
5642
5663
  ${_chalk2.default.hex(colors.blue)("Docs: https://lingo.dev/go/docs")}
5643
5664
  `
5644
5665
  );
@@ -5658,6 +5679,14 @@ function createExplicitLocalizer(provider) {
5658
5679
  apiKeyName: "ANTHROPIC_API_KEY",
5659
5680
  baseUrl: provider.baseUrl
5660
5681
  });
5682
+ case "google":
5683
+ return createAiSdkLocalizer({
5684
+ factory: (params) => _google.createGoogleGenerativeAI.call(void 0, params).languageModel(provider.model),
5685
+ id: provider.id,
5686
+ prompt: provider.prompt,
5687
+ apiKeyName: "GOOGLE_API_KEY",
5688
+ baseUrl: provider.baseUrl
5689
+ });
5661
5690
  }
5662
5691
  }
5663
5692
  function createAiSdkLocalizer(params) {
@@ -5779,8 +5808,8 @@ async function setup(input2) {
5779
5808
  throw new Error(
5780
5809
  "No buckets found in i18n.json. Please add at least one bucket containing i18n content."
5781
5810
  );
5782
- } else if (_optionalChain([ctx, 'access', _190 => _190.flags, 'access', _191 => _191.bucket, 'optionalAccess', _192 => _192.some, 'call', _193 => _193(
5783
- (bucket) => !_optionalChain([ctx, 'access', _194 => _194.config, 'optionalAccess', _195 => _195.buckets, 'access', _196 => _196[bucket]])
5811
+ } else if (_optionalChain([ctx, 'access', _194 => _194.flags, 'access', _195 => _195.bucket, 'optionalAccess', _196 => _196.some, 'call', _197 => _197(
5812
+ (bucket) => !_optionalChain([ctx, 'access', _198 => _198.config, 'optionalAccess', _199 => _199.buckets, 'access', _200 => _200[bucket]])
5784
5813
  )])) {
5785
5814
  throw new Error(
5786
5815
  `One or more specified buckets do not exist in i18n.json. Please add them to the list first and try again.`
@@ -5793,7 +5822,7 @@ async function setup(input2) {
5793
5822
  title: "Selecting localization provider",
5794
5823
  task: async (ctx, task) => {
5795
5824
  ctx.localizer = createLocalizer(
5796
- _optionalChain([ctx, 'access', _197 => _197.config, 'optionalAccess', _198 => _198.provider]),
5825
+ _optionalChain([ctx, 'access', _201 => _201.config, 'optionalAccess', _202 => _202.provider]),
5797
5826
  ctx.flags.apiKey
5798
5827
  );
5799
5828
  if (!ctx.localizer) {
@@ -5933,7 +5962,8 @@ async function plan(input2) {
5933
5962
  bucketPathPattern: bucketPath.pathPattern,
5934
5963
  injectLocale: bucket.injectLocale || [],
5935
5964
  lockedKeys: bucket.lockedKeys || [],
5936
- lockedPatterns: bucket.lockedPatterns || []
5965
+ lockedPatterns: bucket.lockedPatterns || [],
5966
+ onlyKeys: input2.flags.key || []
5937
5967
  });
5938
5968
  }
5939
5969
  }
@@ -6084,6 +6114,8 @@ function createWorkerTask(args) {
6084
6114
  });
6085
6115
  const processableData = _lodash2.default.chain(sourceData).entries().filter(
6086
6116
  ([key, value]) => delta.added.includes(key) || delta.updated.includes(key) || !!args.ctx.flags.force
6117
+ ).filter(
6118
+ ([key]) => !assignedTask.onlyKeys.length || assignedTask.onlyKeys.includes(key)
6087
6119
  ).fromPairs().value();
6088
6120
  if (!Object.keys(processableData).length) {
6089
6121
  return { status: "skipped" };
@@ -6168,38 +6200,29 @@ var flagsSchema2 = _zod.z.object({
6168
6200
  targetLocale: _zod.z.array(_zod.z.string()).optional()
6169
6201
  });
6170
6202
 
6171
- // src/cli/cmd/run/index.ts
6203
+ // src/cli/cmd/run/_utils.ts
6204
+ async function determineAuthId(ctx) {
6205
+ const isByokMode = !!_optionalChain([ctx, 'access', _203 => _203.config, 'optionalAccess', _204 => _204.provider]);
6206
+ if (isByokMode) {
6207
+ return null;
6208
+ } else {
6209
+ try {
6210
+ const authStatus = await _optionalChain([ctx, 'access', _205 => _205.localizer, 'optionalAccess', _206 => _206.checkAuth, 'call', _207 => _207()]);
6211
+ return _optionalChain([authStatus, 'optionalAccess', _208 => _208.username]) || null;
6212
+ } catch (e3) {
6213
+ return null;
6214
+ }
6215
+ }
6216
+ }
6172
6217
 
6218
+ // src/cli/cmd/run/index.ts
6173
6219
  var run_default = new (0, _interactivecommander.Command)().command("run").description("Run Lingo.dev localization engine").helpOption("-h, --help", "Show help").option(
6174
6220
  "--source-locale <source-locale>",
6175
- "Locale to use as source locale. Defaults to i18n.json locale.source",
6176
- (val, prev) => {
6177
- if (!val) return prev;
6178
- if (!process.argv.includes("--target-locale")) {
6179
- console.error(
6180
- `
6181
- \u274C ${_chalk2.default.red("Error")}: --source-locale must be used together with --target-locale
6182
- `
6183
- );
6184
- process.exit(1);
6185
- }
6186
- return val;
6187
- }
6221
+ "Locale to use as source locale. Defaults to i18n.json locale.source"
6188
6222
  ).option(
6189
6223
  "--target-locale <target-locale>",
6190
6224
  "Locale to use as target locale. Defaults to i18n.json locale.targets",
6191
- (val, prev) => {
6192
- if (!val) return prev;
6193
- if (!process.argv.includes("--source-locale")) {
6194
- console.error(
6195
- `
6196
- \u274C ${_chalk2.default.red("Error")}: --target-locale must be used together with --source-locale
6197
- `
6198
- );
6199
- process.exit(1);
6200
- }
6201
- return prev ? [...prev, val] : [val];
6202
- }
6225
+ (val, prev) => prev ? [...prev, val] : [val]
6203
6226
  ).option(
6204
6227
  "--bucket <bucket>",
6205
6228
  "Bucket to process",
@@ -6226,6 +6249,7 @@ var run_default = new (0, _interactivecommander.Command)().command("run").descri
6226
6249
  "Number of concurrent tasks to run",
6227
6250
  (val) => parseInt(val)
6228
6251
  ).action(async (args) => {
6252
+ let authId = null;
6229
6253
  try {
6230
6254
  const ctx = {
6231
6255
  flags: flagsSchema2.parse(args),
@@ -6241,6 +6265,11 @@ var run_default = new (0, _interactivecommander.Command)().command("run").descri
6241
6265
  await renderHero();
6242
6266
  await renderSpacer();
6243
6267
  await setup(ctx);
6268
+ authId = await determineAuthId(ctx);
6269
+ trackEvent(authId, "cmd.run.start", {
6270
+ config: ctx.config,
6271
+ flags: ctx.flags
6272
+ });
6244
6273
  await renderSpacer();
6245
6274
  await plan(ctx);
6246
6275
  await renderSpacer();
@@ -6248,7 +6277,12 @@ var run_default = new (0, _interactivecommander.Command)().command("run").descri
6248
6277
  await renderSpacer();
6249
6278
  await renderSummary(ctx.results);
6250
6279
  await renderSpacer();
6280
+ trackEvent(authId, "cmd.run.success", {
6281
+ config: ctx.config,
6282
+ flags: ctx.flags
6283
+ });
6251
6284
  } catch (error) {
6285
+ trackEvent(authId || "unknown", "cmd.run.error", {});
6252
6286
  process.exit(1);
6253
6287
  }
6254
6288
  });
@@ -6322,7 +6356,7 @@ var InBranchFlow = class extends IntegrationFlow {
6322
6356
  _child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
6323
6357
  _child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
6324
6358
  _child_process.execSync.call(void 0, `git config user.email "${gitConfig.userEmail}"`);
6325
- _optionalChain([this, 'access', _199 => _199.platformKit, 'optionalAccess', _200 => _200.gitConfig, 'call', _201 => _201()]);
6359
+ _optionalChain([this, 'access', _209 => _209.platformKit, 'optionalAccess', _210 => _210.gitConfig, 'call', _211 => _211()]);
6326
6360
  _child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
6327
6361
  _child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
6328
6362
  if (!processOwnCommits) {
@@ -6354,7 +6388,7 @@ var InBranchFlow = class extends IntegrationFlow {
6354
6388
  // src/cli/cmd/ci/flows/pull-request.ts
6355
6389
  var PullRequestFlow = class extends InBranchFlow {
6356
6390
  async preRun() {
6357
- const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _202 => _202()]);
6391
+ const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _212 => _212()]);
6358
6392
  if (!canContinue) {
6359
6393
  return false;
6360
6394
  }
@@ -6609,10 +6643,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
6609
6643
  repo_slug: this.platformConfig.repositoryName,
6610
6644
  state: "OPEN"
6611
6645
  }).then(({ data: { values } }) => {
6612
- return _optionalChain([values, 'optionalAccess', _203 => _203.find, 'call', _204 => _204(
6613
- ({ source, destination }) => _optionalChain([source, 'optionalAccess', _205 => _205.branch, 'optionalAccess', _206 => _206.name]) === branch && _optionalChain([destination, 'optionalAccess', _207 => _207.branch, 'optionalAccess', _208 => _208.name]) === this.platformConfig.baseBranchName
6646
+ return _optionalChain([values, 'optionalAccess', _213 => _213.find, 'call', _214 => _214(
6647
+ ({ source, destination }) => _optionalChain([source, 'optionalAccess', _215 => _215.branch, 'optionalAccess', _216 => _216.name]) === branch && _optionalChain([destination, 'optionalAccess', _217 => _217.branch, 'optionalAccess', _218 => _218.name]) === this.platformConfig.baseBranchName
6614
6648
  )]);
6615
- }).then((pr) => _optionalChain([pr, 'optionalAccess', _209 => _209.id]));
6649
+ }).then((pr) => _optionalChain([pr, 'optionalAccess', _219 => _219.id]));
6616
6650
  }
6617
6651
  async closePullRequest({ pullRequestNumber }) {
6618
6652
  await this.bb.repositories.declinePullRequest({
@@ -6708,7 +6742,7 @@ var GitHubPlatformKit = class extends PlatformKit {
6708
6742
  repo: this.platformConfig.repositoryName,
6709
6743
  base: this.platformConfig.baseBranchName,
6710
6744
  state: "open"
6711
- }).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _210 => _210.number]));
6745
+ }).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _220 => _220.number]));
6712
6746
  }
6713
6747
  async closePullRequest({ pullRequestNumber }) {
6714
6748
  await this.octokit.rest.pulls.update({
@@ -6823,7 +6857,7 @@ var GitlabPlatformKit = class extends PlatformKit {
6823
6857
  branch
6824
6858
  );
6825
6859
  return true;
6826
- } catch (e3) {
6860
+ } catch (e4) {
6827
6861
  return false;
6828
6862
  }
6829
6863
  }
@@ -6835,7 +6869,7 @@ var GitlabPlatformKit = class extends PlatformKit {
6835
6869
  sourceBranch: branch,
6836
6870
  state: "opened"
6837
6871
  });
6838
- return _optionalChain([mergeRequests, 'access', _211 => _211[0], 'optionalAccess', _212 => _212.iid]);
6872
+ return _optionalChain([mergeRequests, 'access', _221 => _221[0], 'optionalAccess', _222 => _222.iid]);
6839
6873
  }
6840
6874
  async closePullRequest({
6841
6875
  pullRequestNumber
@@ -6925,7 +6959,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
6925
6959
  }
6926
6960
  const env = {
6927
6961
  LINGODOTDEV_API_KEY: settings.auth.apiKey,
6928
- LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _213 => _213.pullRequest, 'optionalAccess', _214 => _214.toString, 'call', _215 => _215()]) || "false",
6962
+ LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _223 => _223.pullRequest, 'optionalAccess', _224 => _224.toString, 'call', _225 => _225()]) || "false",
6929
6963
  ...options.commitMessage && {
6930
6964
  LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage
6931
6965
  },
@@ -6945,7 +6979,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
6945
6979
  const { isPullRequestMode } = platformKit.config;
6946
6980
  ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
6947
6981
  const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
6948
- const canRun = await _optionalChain([flow, 'access', _216 => _216.preRun, 'optionalCall', _217 => _217()]);
6982
+ const canRun = await _optionalChain([flow, 'access', _226 => _226.preRun, 'optionalCall', _227 => _227()]);
6949
6983
  if (canRun === false) {
6950
6984
  return;
6951
6985
  }
@@ -6955,7 +6989,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
6955
6989
  if (!hasChanges) {
6956
6990
  return;
6957
6991
  }
6958
- await _optionalChain([flow, 'access', _218 => _218.postRun, 'optionalCall', _219 => _219()]);
6992
+ await _optionalChain([flow, 'access', _228 => _228.postRun, 'optionalCall', _229 => _229()]);
6959
6993
  });
6960
6994
  function parseBooleanArg(val) {
6961
6995
  if (val === true) return true;
@@ -7006,13 +7040,13 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
7006
7040
  flags
7007
7041
  });
7008
7042
  let buckets = getBuckets(i18nConfig);
7009
- if (_optionalChain([flags, 'access', _220 => _220.bucket, 'optionalAccess', _221 => _221.length])) {
7043
+ if (_optionalChain([flags, 'access', _230 => _230.bucket, 'optionalAccess', _231 => _231.length])) {
7010
7044
  buckets = buckets.filter((bucket) => flags.bucket.includes(bucket.type));
7011
7045
  }
7012
7046
  ora.succeed("Buckets retrieved");
7013
- if (_optionalChain([flags, 'access', _222 => _222.file, 'optionalAccess', _223 => _223.length])) {
7047
+ if (_optionalChain([flags, 'access', _232 => _232.file, 'optionalAccess', _233 => _233.length])) {
7014
7048
  buckets = buckets.map((bucket) => {
7015
- const paths = bucket.paths.filter((path16) => flags.file.find((file) => _optionalChain([path16, 'access', _224 => _224.pathPattern, 'optionalAccess', _225 => _225.match, 'call', _226 => _226(file)])));
7049
+ const paths = bucket.paths.filter((path16) => flags.file.find((file) => _optionalChain([path16, 'access', _234 => _234.pathPattern, 'optionalAccess', _235 => _235.match, 'call', _236 => _236(file)])));
7016
7050
  return { ...bucket, paths };
7017
7051
  }).filter((bucket) => bucket.paths.length > 0);
7018
7052
  if (buckets.length === 0) {
@@ -7028,7 +7062,7 @@ var status_default = new (0, _interactivecommander.Command)().command("status").
7028
7062
  });
7029
7063
  }
7030
7064
  }
7031
- const targetLocales = _optionalChain([flags, 'access', _227 => _227.locale, 'optionalAccess', _228 => _228.length]) ? flags.locale : i18nConfig.locale.targets;
7065
+ const targetLocales = _optionalChain([flags, 'access', _237 => _237.locale, 'optionalAccess', _238 => _238.length]) ? flags.locale : i18nConfig.locale.targets;
7032
7066
  let totalSourceKeyCount = 0;
7033
7067
  let uniqueKeysToTranslate = 0;
7034
7068
  let totalExistingTranslations = 0;
@@ -7369,12 +7403,12 @@ function validateParams2(i18nConfig, flags) {
7369
7403
  message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
7370
7404
  docUrl: "bucketNotFound"
7371
7405
  });
7372
- } else if (_optionalChain([flags, 'access', _229 => _229.locale, 'optionalAccess', _230 => _230.some, 'call', _231 => _231((locale) => !i18nConfig.locale.targets.includes(locale))])) {
7406
+ } else if (_optionalChain([flags, 'access', _239 => _239.locale, 'optionalAccess', _240 => _240.some, 'call', _241 => _241((locale) => !i18nConfig.locale.targets.includes(locale))])) {
7373
7407
  throw new CLIError({
7374
7408
  message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
7375
7409
  docUrl: "localeTargetNotFound"
7376
7410
  });
7377
- } else if (_optionalChain([flags, 'access', _232 => _232.bucket, 'optionalAccess', _233 => _233.some, 'call', _234 => _234((bucket) => !i18nConfig.buckets[bucket])])) {
7411
+ } else if (_optionalChain([flags, 'access', _242 => _242.bucket, 'optionalAccess', _243 => _243.some, 'call', _244 => _244((bucket) => !i18nConfig.buckets[bucket])])) {
7378
7412
  throw new CLIError({
7379
7413
  message: `One or more specified buckets do not exist in i18n.json. Please add them to the list and try again.`,
7380
7414
  docUrl: "bucketNotFound"
@@ -7457,7 +7491,7 @@ async function renderHero2() {
7457
7491
  // package.json
7458
7492
  var package_default = {
7459
7493
  name: "lingo.dev",
7460
- version: "0.95.0",
7494
+ version: "0.97.0",
7461
7495
  description: "Lingo.dev CLI",
7462
7496
  private: false,
7463
7497
  publishConfig: {
@@ -7570,6 +7604,7 @@ var package_default = {
7570
7604
  license: "Apache-2.0",
7571
7605
  dependencies: {
7572
7606
  "@ai-sdk/anthropic": "^1.2.11",
7607
+ "@ai-sdk/google": "^1.2.19",
7573
7608
  "@ai-sdk/openai": "^1.3.22",
7574
7609
  "@babel/generator": "^7.27.1",
7575
7610
  "@babel/parser": "^7.27.1",
@@ -7579,10 +7614,10 @@ var package_default = {
7579
7614
  "@gitbeaker/rest": "^39.34.3",
7580
7615
  "@inkjs/ui": "^2.0.0",
7581
7616
  "@inquirer/prompts": "^7.4.1",
7617
+ "@lingo.dev/_compiler": "workspace:*",
7618
+ "@lingo.dev/_react": "workspace:*",
7582
7619
  "@lingo.dev/_sdk": "workspace:*",
7583
7620
  "@lingo.dev/_spec": "workspace:*",
7584
- "@lingo.dev/_react": "workspace:*",
7585
- "@lingo.dev/_compiler": "workspace:*",
7586
7621
  "@modelcontextprotocol/sdk": "^1.5.0",
7587
7622
  "@paralleldrive/cuid2": "^2.2.2",
7588
7623
  ai: "^4.3.15",