@intlayer/cli 9.5.11 → 9.6.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.
Files changed (90) hide show
  1. package/dist/cjs/_virtual/_utils_asset.cjs +1 -1
  2. package/dist/cjs/build.cjs +2 -2
  3. package/dist/cjs/build.cjs.map +1 -1
  4. package/dist/cjs/ci.cjs +1 -1
  5. package/dist/cjs/cli.cjs +51 -12
  6. package/dist/cjs/cli.cjs.map +1 -1
  7. package/dist/cjs/extract.cjs +1 -1
  8. package/dist/cjs/fill/fill.cjs +25 -9
  9. package/dist/cjs/fill/fill.cjs.map +1 -1
  10. package/dist/cjs/getTargetDictionary.cjs +1 -1
  11. package/dist/cjs/index.cjs +15 -1
  12. package/dist/cjs/init.cjs +98 -27
  13. package/dist/cjs/init.cjs.map +1 -1
  14. package/dist/cjs/initChromeExtension.cjs +26 -3
  15. package/dist/cjs/initChromeExtension.cjs.map +1 -1
  16. package/dist/cjs/initInfra.cjs +6 -0
  17. package/dist/cjs/initInfra.cjs.map +1 -1
  18. package/dist/cjs/initMCP.cjs +18 -7
  19. package/dist/cjs/initMCP.cjs.map +1 -1
  20. package/dist/cjs/initSkills.cjs +37 -34
  21. package/dist/cjs/initSkills.cjs.map +1 -1
  22. package/dist/cjs/listContentDeclaration.cjs +1 -1
  23. package/dist/cjs/listProjects.cjs +1 -1
  24. package/dist/cjs/pull.cjs +1 -1
  25. package/dist/cjs/push/push.cjs +1 -1
  26. package/dist/cjs/reviewDoc/reviewDoc.cjs +1 -1
  27. package/dist/cjs/reviewDoc/reviewDocBlockAware.cjs +1 -1
  28. package/dist/cjs/scan.cjs +1 -1
  29. package/dist/cjs/scan.cjs.map +1 -1
  30. package/dist/cjs/translateDoc/translateDoc.cjs +1 -1
  31. package/dist/cjs/upgrade.cjs +1 -1
  32. package/dist/cjs/utils/getParentPackageJSON.cjs +1 -1
  33. package/dist/cjs/utils/isInteractiveTerminal.cjs +12 -0
  34. package/dist/cjs/utils/isInteractiveTerminal.cjs.map +1 -0
  35. package/dist/cjs/utils/parseChoice.cjs +21 -0
  36. package/dist/cjs/utils/parseChoice.cjs.map +1 -0
  37. package/dist/esm/_virtual/_utils_asset.mjs +1 -1
  38. package/dist/esm/build.mjs +1 -1
  39. package/dist/esm/build.mjs.map +1 -1
  40. package/dist/esm/ci.mjs +1 -1
  41. package/dist/esm/cli.mjs +51 -12
  42. package/dist/esm/cli.mjs.map +1 -1
  43. package/dist/esm/extract.mjs +1 -1
  44. package/dist/esm/fill/fill.mjs +25 -9
  45. package/dist/esm/fill/fill.mjs.map +1 -1
  46. package/dist/esm/getTargetDictionary.mjs +1 -1
  47. package/dist/esm/index.mjs +5 -4
  48. package/dist/esm/init.mjs +93 -28
  49. package/dist/esm/init.mjs.map +1 -1
  50. package/dist/esm/initChromeExtension.mjs +24 -4
  51. package/dist/esm/initChromeExtension.mjs.map +1 -1
  52. package/dist/esm/initInfra.mjs +6 -0
  53. package/dist/esm/initInfra.mjs.map +1 -1
  54. package/dist/esm/initMCP.mjs +21 -11
  55. package/dist/esm/initMCP.mjs.map +1 -1
  56. package/dist/esm/initSkills.mjs +37 -36
  57. package/dist/esm/initSkills.mjs.map +1 -1
  58. package/dist/esm/listContentDeclaration.mjs +1 -1
  59. package/dist/esm/listProjects.mjs +1 -1
  60. package/dist/esm/pull.mjs +1 -1
  61. package/dist/esm/push/push.mjs +1 -1
  62. package/dist/esm/reviewDoc/reviewDoc.mjs +1 -1
  63. package/dist/esm/reviewDoc/reviewDocBlockAware.mjs +1 -1
  64. package/dist/esm/scan.mjs +1 -1
  65. package/dist/esm/scan.mjs.map +1 -1
  66. package/dist/esm/translateDoc/translateDoc.mjs +1 -1
  67. package/dist/esm/upgrade.mjs +1 -1
  68. package/dist/esm/utils/getParentPackageJSON.mjs +1 -1
  69. package/dist/esm/utils/isInteractiveTerminal.mjs +11 -0
  70. package/dist/esm/utils/isInteractiveTerminal.mjs.map +1 -0
  71. package/dist/esm/utils/parseChoice.mjs +20 -0
  72. package/dist/esm/utils/parseChoice.mjs.map +1 -0
  73. package/dist/types/fill/fill.d.ts +22 -1
  74. package/dist/types/fill/fill.d.ts.map +1 -1
  75. package/dist/types/fill/index.d.ts +2 -2
  76. package/dist/types/index.d.ts +6 -5
  77. package/dist/types/init.d.ts +36 -0
  78. package/dist/types/init.d.ts.map +1 -1
  79. package/dist/types/initChromeExtension.d.ts +19 -1
  80. package/dist/types/initChromeExtension.d.ts.map +1 -1
  81. package/dist/types/initInfra.d.ts.map +1 -1
  82. package/dist/types/initMCP.d.ts +16 -2
  83. package/dist/types/initMCP.d.ts.map +1 -1
  84. package/dist/types/initSkills.d.ts +23 -6
  85. package/dist/types/initSkills.d.ts.map +1 -1
  86. package/dist/types/utils/isInteractiveTerminal.d.ts +9 -0
  87. package/dist/types/utils/isInteractiveTerminal.d.ts.map +1 -0
  88. package/dist/types/utils/parseChoice.d.ts +13 -0
  89. package/dist/types/utils/parseChoice.d.ts.map +1 -0
  90. package/package.json +18 -13
@@ -1,5 +1,5 @@
1
- let node_path = require("node:path");
2
1
  let node_fs = require("node:fs");
2
+ let node_path = require("node:path");
3
3
  let node_url = require("node:url");
4
4
 
5
5
  //#region \0utils:asset
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- let _intlayer_engine_cli = require("@intlayer/engine/cli");
3
2
  let _intlayer_config_node = require("@intlayer/config/node");
4
3
  let _intlayer_engine_utils = require("@intlayer/engine/utils");
5
4
  let _intlayer_engine_watcher = require("@intlayer/engine/watcher");
5
+ let _intlayer_engine_logConfigDetails = require("@intlayer/engine/logConfigDetails");
6
6
 
7
7
  //#region src/build.ts
8
8
  /**
@@ -11,7 +11,7 @@ let _intlayer_engine_watcher = require("@intlayer/engine/watcher");
11
11
  */
12
12
  const build = async (options) => {
13
13
  const config = (0, _intlayer_config_node.getConfiguration)(options?.configOptions);
14
- (0, _intlayer_engine_cli.logConfigDetails)(options?.configOptions);
14
+ (0, _intlayer_engine_logConfigDetails.logConfigDetails)(options?.configOptions);
15
15
  let parallelProcess = null;
16
16
  if (options?.watch) {
17
17
  const bundlerAlreadyWatching = await (0, _intlayer_engine_utils.claimCliContentWatcher)(config, "intlayer build --watch");
@@ -1 +1 @@
1
- {"version":3,"file":"build.cjs","names":["getConfiguration","claimCliContentWatcher","runParallel","buildAndWatchIntlayer"],"sources":["../../src/build.ts"],"sourcesContent":["import {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport { logConfigDetails } from '@intlayer/engine/cli';\nimport {\n claimCliContentWatcher,\n type ParallelHandle,\n reportRedundantContentWatcher,\n runParallel,\n} from '@intlayer/engine/utils';\nimport { buildAndWatchIntlayer } from '@intlayer/engine/watcher';\n\ntype BuildOptions = {\n watch?: boolean;\n skipPrepare?: boolean;\n with?: string | string[];\n configOptions?: GetConfigurationOptions;\n};\n\n/**\n * Get locales dictionaries .content.{json|ts|tsx|js|jsx|mjs|cjs} and build the JSON dictionaries in the .intlayer directory.\n * Watch mode available to get the change in the .content.{json|ts|tsx|js|jsx|mjs|cjs}\n */\nexport const build = async (options?: BuildOptions) => {\n const config = getConfiguration(options?.configOptions);\n logConfigDetails(options?.configOptions);\n\n let parallelProcess: ParallelHandle | null = null;\n\n // Only watch mode keeps a watcher alive; a one-off build has nothing to\n // deduplicate. Claimed before the child is spawned so the bundler plugin\n // inside it stands down instead of racing this command.\n if (options?.watch) {\n const bundlerAlreadyWatching = await claimCliContentWatcher(\n config,\n 'intlayer build --watch'\n );\n\n if (bundlerAlreadyWatching) {\n reportRedundantContentWatcher(config, {\n cliLabel: 'intlayer build --watch',\n bundlerLabel: bundlerAlreadyWatching.label,\n });\n }\n }\n\n if (options?.with) {\n parallelProcess = runParallel(options.with);\n // Handle the promise to avoid unhandled rejection\n parallelProcess.result.catch(() => {\n // Parallel process failed or was terminated\n });\n }\n\n await buildAndWatchIntlayer({\n persistent: options?.watch ?? false,\n skipPrepare: options?.skipPrepare ?? false,\n configuration: config,\n });\n\n if (!options?.watch && parallelProcess) {\n parallelProcess.kill();\n }\n};\n"],"mappings":";;;;;;;;;;;AAwBA,MAAa,QAAQ,OAAO,YAA2B;CACrD,MAAM,aAASA,wCAAiB,SAAS,aAAa;CACtD,2CAAiB,SAAS,aAAa;CAEvC,IAAI,kBAAyC;CAK7C,IAAI,SAAS,OAAO;EAClB,MAAM,yBAAyB,UAAMC,+CACnC,QACA,wBACF;EAEA,IAAI,wBACF,0DAA8B,QAAQ;GACpC,UAAU;GACV,cAAc,uBAAuB;EACvC,CAAC;CAEL;CAEA,IAAI,SAAS,MAAM;EACjB,sBAAkBC,oCAAY,QAAQ,IAAI;EAE1C,gBAAgB,OAAO,YAAY,CAEnC,CAAC;CACH;CAEA,UAAMC,gDAAsB;EAC1B,YAAY,SAAS,SAAS;EAC9B,aAAa,SAAS,eAAe;EACrC,eAAe;CACjB,CAAC;CAED,IAAI,CAAC,SAAS,SAAS,iBACrB,gBAAgB,KAAK;AAEzB"}
1
+ {"version":3,"file":"build.cjs","names":["getConfiguration","claimCliContentWatcher","runParallel","buildAndWatchIntlayer"],"sources":["../../src/build.ts"],"sourcesContent":["import {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport { logConfigDetails } from '@intlayer/engine/logConfigDetails';\nimport {\n claimCliContentWatcher,\n type ParallelHandle,\n reportRedundantContentWatcher,\n runParallel,\n} from '@intlayer/engine/utils';\nimport { buildAndWatchIntlayer } from '@intlayer/engine/watcher';\n\ntype BuildOptions = {\n watch?: boolean;\n skipPrepare?: boolean;\n with?: string | string[];\n configOptions?: GetConfigurationOptions;\n};\n\n/**\n * Get locales dictionaries .content.{json|ts|tsx|js|jsx|mjs|cjs} and build the JSON dictionaries in the .intlayer directory.\n * Watch mode available to get the change in the .content.{json|ts|tsx|js|jsx|mjs|cjs}\n */\nexport const build = async (options?: BuildOptions) => {\n const config = getConfiguration(options?.configOptions);\n logConfigDetails(options?.configOptions);\n\n let parallelProcess: ParallelHandle | null = null;\n\n // Only watch mode keeps a watcher alive; a one-off build has nothing to\n // deduplicate. Claimed before the child is spawned so the bundler plugin\n // inside it stands down instead of racing this command.\n if (options?.watch) {\n const bundlerAlreadyWatching = await claimCliContentWatcher(\n config,\n 'intlayer build --watch'\n );\n\n if (bundlerAlreadyWatching) {\n reportRedundantContentWatcher(config, {\n cliLabel: 'intlayer build --watch',\n bundlerLabel: bundlerAlreadyWatching.label,\n });\n }\n }\n\n if (options?.with) {\n parallelProcess = runParallel(options.with);\n // Handle the promise to avoid unhandled rejection\n parallelProcess.result.catch(() => {\n // Parallel process failed or was terminated\n });\n }\n\n await buildAndWatchIntlayer({\n persistent: options?.watch ?? false,\n skipPrepare: options?.skipPrepare ?? false,\n configuration: config,\n });\n\n if (!options?.watch && parallelProcess) {\n parallelProcess.kill();\n }\n};\n"],"mappings":";;;;;;;;;;;AAwBA,MAAa,QAAQ,OAAO,YAA2B;CACrD,MAAM,aAASA,wCAAiB,SAAS,aAAa;CACtD,wDAAiB,SAAS,aAAa;CAEvC,IAAI,kBAAyC;CAK7C,IAAI,SAAS,OAAO;EAClB,MAAM,yBAAyB,UAAMC,+CACnC,QACA,wBACF;EAEA,IAAI,wBACF,0DAA8B,QAAQ;GACpC,UAAU;GACV,cAAc,uBAAuB;EACvC,CAAC;CAEL;CAEA,IAAI,SAAS,MAAM;EACjB,sBAAkBC,oCAAY,QAAQ,IAAI;EAE1C,gBAAgB,OAAO,YAAY,CAEnC,CAAC;CACH;CAEA,UAAMC,gDAAsB;EAC1B,YAAY,SAAS,SAAS;EAC9B,aAAa,SAAS,eAAe;EACrC,eAAe;CACjB,CAAC;CAED,IAAI,CAAC,SAAS,SAAS,iBACrB,gBAAgB,KAAK;AAEzB"}
package/dist/cjs/ci.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- let node_path = require("node:path");
3
2
  let _intlayer_engine_cli = require("@intlayer/engine/cli");
3
+ let node_path = require("node:path");
4
4
  let _intlayer_config_logger = require("@intlayer/config/logger");
5
5
  let node_child_process = require("node:child_process");
6
6
 
package/dist/cjs/cli.cjs CHANGED
@@ -154,7 +154,7 @@ const setAPI = () => {
154
154
  /**
155
155
  * INIT
156
156
  */
157
- const initCmd = program.command("init").description("Initialize Intlayer in the project").option("--project-root [projectRoot]", "Project root directory").option("--no-gitignore", "Do not add .intlayer to .gitignore").option("--no-github-actions", "Do not scaffold the fill and test GitHub Actions workflows").option("--no-framework-setup", "Do not set up the project (Intlayer config, tsconfig, bundler plugin, middleware/proxy, providers in layout/page)").option("-i, --interactive", "Interactively choose what to set up (packages, skills, MCP, VS Code extension, LSP, …)").option("--routing <routing>", "Locale routing: prefix-no-default | prefix-all | no-prefix | search-params | none").action(async (options) => {
157
+ const initCmd = program.command("init").enablePositionalOptions().description("Install the Intlayer packages and set up the framework. Use --interactive, or the init subcommands, for the other setup steps (CI, skills, MCP, VS Code, LSP, lint, CMS, …)").option("--project-root [projectRoot]", "Project root directory").option("--no-gitignore", "Do not add .intlayer to .gitignore").option("--no-github-actions", "With --interactive: do not scaffold the GitHub Actions workflows, even if selected").option("--no-framework-setup", "Do not set up the project (Intlayer config, tsconfig, bundler plugin, middleware/proxy, providers in layout/page)").option("-i, --interactive", "Interactively choose what to set up (packages, skills, MCP, VS Code extension, LSP, …). Needs a terminal").option("--routing <routing>", "Locale routing: prefix-no-default | prefix-all | no-prefix | search-params | none").action(async (options) => {
158
158
  const { init, parseLocaleRoutingChoice, getRoutingInitOptions } = await Promise.resolve().then(() => require("./init.cjs"));
159
159
  return init(options.projectRoot, {
160
160
  noGitignore: options.gitignore === false,
@@ -164,21 +164,59 @@ const setAPI = () => {
164
164
  ...options.routing ? getRoutingInitOptions(parseLocaleRoutingChoice(options.routing)) : {}
165
165
  }, options.interactive === true);
166
166
  });
167
- initCmd.command("skills").description("Initialize Intlayer skills in the project").option("--project-root [projectRoot]", "Project root directory").action(async (options) => {
168
- const { initSkills } = await Promise.resolve().then(() => require("./initSkills.cjs"));
169
- await initSkills(options.projectRoot);
167
+ initCmd.command("packages").description("Install the missing Intlayer packages and upgrade the outdated ones").option("--project-root [projectRoot]", "Project root directory").action(async (options) => {
168
+ const { initSteps } = await Promise.resolve().then(() => require("./init.cjs"));
169
+ return initSteps(options.projectRoot, ["packages"], { upgradeToVersion: packageJson.version });
170
170
  });
171
- initCmd.command("mcp").description("Initialize Intlayer MCP server in the project").option("--project-root [projectRoot]", "Project root directory").action(async (options) => {
172
- const { initMCP } = await Promise.resolve().then(() => require("./initMCP.cjs"));
173
- return initMCP(options.projectRoot);
171
+ initCmd.command("project").alias("framework").description("Set up the project: Intlayer config, tsconfig, bundler plugin, middleware/proxy, providers in layout/page and .gitignore").option("--project-root [projectRoot]", "Project root directory").option("--no-gitignore", "Do not add .intlayer to .gitignore").option("--routing <routing>", "Locale routing: prefix-no-default | prefix-all | no-prefix | search-params | none").action(async (options) => {
172
+ const { initSteps, parseLocaleRoutingChoice, getRoutingInitOptions } = await Promise.resolve().then(() => require("./init.cjs"));
173
+ return initSteps(options.projectRoot, ["projectSetup"], {
174
+ noGitignore: options.gitignore === false,
175
+ ...options.routing ? getRoutingInitOptions(parseLocaleRoutingChoice(options.routing)) : {}
176
+ });
177
+ });
178
+ initCmd.command("github-actions").alias("ci").description("Scaffold the fill and test GitHub Actions workflows that run on every pull request").option("--project-root [projectRoot]", "Project root directory").action(async (options) => {
179
+ const { initSteps } = await Promise.resolve().then(() => require("./init.cjs"));
180
+ return initSteps(options.projectRoot, ["githubActions"]);
181
+ });
182
+ initCmd.command("vscode-extension").alias("vscode").description("Recommend the Intlayer VS Code extension in .vscode/extensions.json").option("--project-root [projectRoot]", "Project root directory").action(async (options) => {
183
+ const { initSteps } = await Promise.resolve().then(() => require("./init.cjs"));
184
+ return initSteps(options.projectRoot, ["vscodeExtension"]);
185
+ });
186
+ initCmd.command("lsp").description("Configure the Intlayer language server in .vscode/settings.json").option("--project-root [projectRoot]", "Project root directory").action(async (options) => {
187
+ const { initSteps } = await Promise.resolve().then(() => require("./init.cjs"));
188
+ return initSteps(options.projectRoot, ["lsp"]);
189
+ });
190
+ initCmd.command("eslint").alias("lint").description("Enable the Intlayer lint rules (ESLint / oxlint), when the project already lints").option("--project-root [projectRoot]", "Project root directory").action(async (options) => {
191
+ const { initSteps } = await Promise.resolve().then(() => require("./init.cjs"));
192
+ return initSteps(options.projectRoot, ["eslint"], { upgradeToVersion: packageJson.version });
193
+ });
194
+ initCmd.command("skills").description("Initialize Intlayer skills in the project").option("--project-root [projectRoot]", "Project root directory").option("-p, --platform <platform>", "AI platform (e.g. Claude, Cursor, VSCode). Detected when omitted").option("-s, --skills <skills...>", "Skills to install (e.g. Usage Content React). Defaults to the project stack without a terminal").action(async (options) => {
195
+ const { initSkills, parsePlatform, parseSkills } = await Promise.resolve().then(() => require("./initSkills.cjs"));
196
+ await initSkills(options.projectRoot, {
197
+ platform: options.platform ? parsePlatform(options.platform) : void 0,
198
+ skills: options.skills ? parseSkills(options.skills) : void 0
199
+ });
200
+ });
201
+ initCmd.command("mcp").description("Initialize Intlayer MCP server in the project").option("--project-root [projectRoot]", "Project root directory").option("-p, --platform <platform>", "AI platform (e.g. Claude, Cursor, VSCode). Detected when omitted").option("-t, --transport <transport>", "stdio (local server, default without a terminal) | sse (hosted)").action(async (options) => {
202
+ const { initMCP, parseMCPTransport } = await Promise.resolve().then(() => require("./initMCP.cjs"));
203
+ const { parsePlatform } = await Promise.resolve().then(() => require("./initSkills.cjs"));
204
+ return initMCP(options.projectRoot, {
205
+ platform: options.platform ? parsePlatform(options.platform) : void 0,
206
+ transport: options.transport ? parseMCPTransport(options.transport) : void 0
207
+ });
208
+ });
209
+ initCmd.command("cms").description("Log in to the Intlayer CMS through your browser, then store the credentials in your .env").option("--project-root [projectRoot]", "Project root directory").action(async (options) => {
210
+ const { initCms } = await Promise.resolve().then(() => require("./init.cjs"));
211
+ return initCms(options.projectRoot);
174
212
  });
175
- initCmd.command("infra").description("Set up the Intlayer infrastructure: desktop app, all-in-one Docker container or Docker Compose stack (runs https://intlayer.org/install.sh, or install.ps1 on Windows)").option("-m, --mode <mode>", "Skip the menu: desktop | docker | compose").action(async (options) => {
213
+ initCmd.command("infra").description("Set up the Intlayer infrastructure: desktop app, all-in-one Docker container or Docker Compose stack (runs https://intlayer.org/install.sh, or install.ps1 on Windows)").option("-m, --mode <mode>", "Skip the menu: desktop | docker | compose (required without a terminal)").action(async (options) => {
176
214
  const { initInfra, parseInfraMode } = await Promise.resolve().then(() => require("./initInfra.cjs"));
177
215
  return initInfra({ mode: options.mode ? parseInfraMode(options.mode) : void 0 });
178
216
  });
179
- initCmd.command("extension").alias("chrome-extension").description("Install the Intlayer Chrome extension or Firefox add-on in your browser").action(async () => {
180
- const { initChromeExtension } = await Promise.resolve().then(() => require("./initChromeExtension.cjs"));
181
- return initChromeExtension();
217
+ initCmd.command("extension").alias("chrome-extension").description("Install the Intlayer Chrome extension or Firefox add-on in your browser").option("-b, --browser <browsers...>", "Browsers to open the store page for: chrome | firefox. Without a terminal, the links are only printed").action(async (options) => {
218
+ const { initChromeExtension, parseExtensionBrowsers } = await Promise.resolve().then(() => require("./initChromeExtension.cjs"));
219
+ return initChromeExtension({ browsers: options.browser ? parseExtensionBrowsers(options.browser) : void 0 });
182
220
  });
183
221
  /**
184
222
  * UPGRADE
@@ -404,7 +442,7 @@ const setAPI = () => {
404
442
  const keys = [...options.keys ?? [], ...options.key ?? []];
405
443
  const excludedKeys = [...options.excludedKeys ?? [], ...options.excludedKey ?? []];
406
444
  const dictionaries = [...options.dictionaries ?? [], ...options.dictionary ?? []];
407
- return fill({
445
+ await fill({
408
446
  ...options,
409
447
  keys: keys.length > 0 ? keys : void 0,
410
448
  excludedKeys: excludedKeys.length > 0 ? excludedKeys : void 0,
@@ -573,6 +611,7 @@ const setAPI = () => {
573
611
  const { runCI } = await Promise.resolve().then(() => require("./ci.cjs"));
574
612
  process.exit(await runCI(args));
575
613
  });
614
+ program.enablePositionalOptions();
576
615
  program.parse(process.argv);
577
616
  return program;
578
617
  };
@@ -1 +1 @@
1
- {"version":3,"file":"cli.cjs","names":["pathDirname","fileURLToPath","getParentPackageJSON","getConfiguration","Command","Option"],"sources":["../../src/cli.ts"],"sourcesContent":["import { dirname as pathDirname } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport type { AIOptions as BaseAIOptions } from '@intlayer/api';\nimport { logger, setPrefix } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport type { DiffMode, ListGitFilesOptions } from '@intlayer/engine/cli';\nimport type { CustomIntlayerConfig } from '@intlayer/types/config';\nimport { Command, Option } from 'commander';\nimport type { FillOptions } from './fill/fill';\nimport { getParentPackageJSON } from './utils/getParentPackageJSON';\n\n// Extended AI options to include customPrompt\ntype AIOptions = BaseAIOptions & {\n customPrompt?: string;\n};\n\nconst isESModule = typeof import.meta.url === 'string';\n\nexport const dirname = isESModule\n ? pathDirname(fileURLToPath(import.meta.url))\n : __dirname;\n\nconst packageJson = getParentPackageJSON(dirname);\n\nconst logOptions = [\n ['--verbose', 'Verbose (default to true using CLI)'],\n ['--prefix [prefix]', 'Prefix'],\n];\n\nconst ciOptions = [\n [\n '--ci',\n 'CI mode - Run the command in every Intlayer project of the repository (or only the current one), injecting per-project credentials from INTLAYER_PROJECT_CREDENTIALS',\n ],\n];\n\nconst configurationOptions = [\n ['--env-file [envFile]', 'Environment file'],\n ['-e, --env [env]', 'Environment'],\n ['--base-dir [baseDir]', 'Base directory'],\n ['--no-cache [noCache]', 'No cache'],\n ...logOptions,\n ...ciOptions,\n];\n\nconst aiOptions = [\n ['--provider [provider]', 'Provider'],\n ['--temperature [temperature]', 'Temperature'],\n ['--model [model]', 'Model'],\n ['--api-key [apiKey]', 'Provider API key'],\n ['--custom-prompt [prompt]', 'Custom prompt'],\n ['--application-context [applicationContext]', 'Application context'],\n ['--data-serialization [dataSerialization]', 'Data serialization'],\n];\n\nconst gitOptions = [\n ['--git-diff [gitDiff]', 'Git diff mode - Check git diff between two refs'],\n ['--git-diff-base [gitDiffBase]', 'Git diff base ref'],\n ['--git-diff-current [gitDiffCurrent]', 'Git diff current ref'],\n ['--uncommitted [uncommitted]', 'Uncommitted'],\n ['--unpushed [unpushed]', 'Unpushed'],\n ['--untracked [untracked]', 'Untracked'],\n];\n\nconst extractKeysFromOptions = (options: object, keys: string[]) =>\n keys.filter((key) => options[key as keyof typeof options] !== undefined);\n\n/**\n * Helper functions to apply common options to commands\n */\nconst applyOptions = (command: Command, options: string[][]) => {\n options.forEach(([flag, description]) => {\n command.option(flag!, description);\n });\n return command;\n};\n\nconst removeUndefined = <T extends Record<string, any>>(obj: T): T =>\n Object.fromEntries(\n Object.entries(obj).filter(([_, value]) => value !== undefined)\n ) as T;\n\nconst applyConfigOptions = (command: Command) =>\n applyOptions(command, configurationOptions);\nconst applyAIOptions = (command: Command) => applyOptions(command, aiOptions);\nconst applyGitOptions = (command: Command) => applyOptions(command, gitOptions);\n\nconst extractAiOptions = (options: AIOptions): AIOptions | undefined => {\n const {\n apiKey,\n provider,\n model,\n temperature,\n applicationContext,\n customPrompt,\n dataSerialization,\n } = options;\n\n const configuration = getConfiguration();\n\n const { ai } = configuration;\n\n // `AIOptions` is discriminated on `provider`, which is only known at runtime\n // here (CLI flag or configuration file), so the merged object cannot be\n // narrowed to a single member of the union.\n return removeUndefined({\n ...ai,\n apiKey: apiKey ?? configuration.ai?.apiKey,\n provider: provider ?? (configuration.ai?.provider as AIOptions['provider']),\n model: model ?? configuration.ai?.model,\n temperature: temperature ?? configuration.ai?.temperature,\n applicationContext:\n applicationContext ?? configuration.ai?.applicationContext,\n customPrompt: customPrompt ?? (configuration.ai as any)?.customPrompt,\n dataSerialization: dataSerialization ?? configuration.ai?.dataSerialization,\n }) as AIOptions;\n};\n\ntype GitOptions = {\n gitDiff?: boolean;\n gitDiffBase?: string;\n gitDiffCurrent?: string;\n uncommitted?: boolean;\n unpushed?: boolean;\n untracked?: boolean;\n};\n\nconst gitOptionKeys: (keyof GitOptions)[] = [\n 'gitDiff',\n 'gitDiffBase',\n 'gitDiffCurrent',\n 'uncommitted',\n 'unpushed',\n 'untracked',\n];\n\nconst extractGitOptions = (\n options: GitOptions\n): ListGitFilesOptions | undefined => {\n const filteredOptions = extractKeysFromOptions(options, gitOptionKeys);\n\n const isOptionEmpty = filteredOptions.length === 0;\n\n if (isOptionEmpty) return undefined;\n\n const {\n gitDiff,\n gitDiffBase,\n gitDiffCurrent,\n uncommitted,\n unpushed,\n untracked,\n } = options;\n\n const mode = [\n gitDiff && 'gitDiff',\n uncommitted && 'uncommitted',\n unpushed && 'unpushed',\n untracked && 'untracked',\n ].filter(Boolean) as DiffMode[];\n\n return removeUndefined({\n mode,\n baseRef: gitDiffBase,\n currentRef: gitDiffCurrent,\n absolute: true,\n });\n};\n\ntype LogOptions = {\n prefix?: string;\n verbose?: boolean;\n};\n\nexport type ConfigurationOptions = {\n baseDir?: string;\n env?: string;\n envFile?: string;\n noCache?: boolean;\n checkTypes?: boolean;\n} & LogOptions;\n\nconst configurationOptionKeys: (keyof ConfigurationOptions)[] = [\n 'baseDir',\n 'env',\n 'envFile',\n 'verbose',\n 'prefix',\n 'checkTypes',\n];\n\nconst extractConfigOptions = (\n options: ConfigurationOptions & { with?: string }\n): GetConfigurationOptions | undefined => {\n const filteredOptions = extractKeysFromOptions(\n options,\n configurationOptionKeys\n );\n\n const isOptionEmpty = filteredOptions.length === 0;\n\n if (isOptionEmpty) {\n return undefined;\n }\n\n const { baseDir, env, envFile, verbose, noCache, checkTypes } = options;\n\n const log = removeUndefined({\n mode:\n typeof verbose !== 'undefined'\n ? verbose\n ? 'verbose'\n : 'default'\n : undefined,\n });\n\n const build = removeUndefined({\n checkTypes,\n });\n\n const override: CustomIntlayerConfig = removeUndefined({\n log:\n Object.keys(log).length > 0\n ? (log as CustomIntlayerConfig['log'])\n : undefined,\n build: Object.keys(build).length > 0 ? build : undefined,\n });\n\n return removeUndefined({\n baseDir,\n env,\n envFile,\n override: Object.keys(override).length > 0 ? override : undefined,\n cache: typeof noCache !== 'undefined' ? !noCache : undefined,\n });\n};\n\n/**\n * Set the API for the CLI\n *\n * Example of commands:\n *\n * npm run intlayer build --watch\n * npm run intlayer push --dictionaries id1 id2 id3 --deleteLocaleDir\n */\nexport const setAPI = (): Command => {\n const isWithCommand = process.argv.includes('--with');\n\n if (!isWithCommand) {\n setPrefix('');\n }\n\n const program = new Command();\n\n program\n .version(\n packageJson.version!,\n '-v, --version',\n 'Print the Intlayer CLI version'\n )\n .description('Intlayer CLI');\n\n // Keep `-V` (commander's default short flag) working alongside `-v`\n program.addOption(\n new Option('-V', 'Print the Intlayer CLI version').hideHelp()\n );\n program.on('option:V', () => {\n console.log(packageJson.version ?? 'unknown');\n process.exit(0);\n });\n\n // Explicit version subcommand for convenience: `npx intlayer version`\n program\n .command('version')\n .description('Print the Intlayer CLI version')\n .action(() => {\n // Prefer the resolved package.json version; fallback to unknown\n // Keeping output minimal to align with common CLI behavior\n console.log(packageJson.version ?? 'unknown');\n });\n\n /**\n * AUTH\n */\n const loginCmd = program\n .command('login')\n .description('Login to Intlayer')\n .option('--cms-url [cmsUrl]', 'CMS URL');\n\n applyConfigOptions(loginCmd);\n\n loginCmd.action(async (options) => {\n const { login } = await import('./auth/login');\n const configOptions = extractConfigOptions(options) ?? {\n override: {\n log: {\n prefix: '',\n mode: 'verbose',\n },\n },\n };\n\n return login({\n cmsUrl: options.cmsUrl,\n configOptions,\n });\n });\n\n /**\n * INIT\n */\n const initCmd = program\n .command('init')\n .description('Initialize Intlayer in the project')\n .option('--project-root [projectRoot]', 'Project root directory')\n .option('--no-gitignore', 'Do not add .intlayer to .gitignore')\n .option(\n '--no-github-actions',\n 'Do not scaffold the fill and test GitHub Actions workflows'\n )\n .option(\n '--no-framework-setup',\n 'Do not set up the project (Intlayer config, tsconfig, bundler plugin, middleware/proxy, providers in layout/page)'\n )\n .option(\n '-i, --interactive',\n 'Interactively choose what to set up (packages, skills, MCP, VS Code extension, LSP, …)'\n )\n .option(\n '--routing <routing>',\n 'Locale routing: prefix-no-default | prefix-all | no-prefix | search-params | none'\n )\n .action(async (options) => {\n const { init, parseLocaleRoutingChoice, getRoutingInitOptions } =\n await import('./init');\n return init(\n options.projectRoot,\n {\n noGitignore: options.gitignore === false,\n noGithubActions: options.githubActions === false,\n noFrameworkSetup: options.frameworkSetup === false,\n upgradeToVersion: packageJson.version,\n ...(options.routing\n ? getRoutingInitOptions(parseLocaleRoutingChoice(options.routing))\n : {}),\n },\n options.interactive === true\n );\n });\n\n initCmd\n .command('skills')\n .description('Initialize Intlayer skills in the project')\n .option('--project-root [projectRoot]', 'Project root directory')\n .action(async (options) => {\n const { initSkills } = await import('./initSkills');\n await initSkills(options.projectRoot);\n });\n\n initCmd\n .command('mcp')\n .description('Initialize Intlayer MCP server in the project')\n .option('--project-root [projectRoot]', 'Project root directory')\n .action(async (options) => {\n const { initMCP } = await import('./initMCP');\n return initMCP(options.projectRoot);\n });\n\n initCmd\n .command('infra')\n .description(\n 'Set up the Intlayer infrastructure: desktop app, all-in-one Docker container or Docker Compose stack (runs https://intlayer.org/install.sh, or install.ps1 on Windows)'\n )\n .option('-m, --mode <mode>', 'Skip the menu: desktop | docker | compose')\n .action(async (options) => {\n const { initInfra, parseInfraMode } = await import('./initInfra');\n return initInfra({\n mode: options.mode ? parseInfraMode(options.mode) : undefined,\n });\n });\n\n initCmd\n .command('extension')\n .alias('chrome-extension')\n .description(\n 'Install the Intlayer Chrome extension or Firefox add-on in your browser'\n )\n .action(async () => {\n const { initChromeExtension } = await import('./initChromeExtension');\n return initChromeExtension();\n });\n\n /**\n * UPGRADE\n */\n program\n .command('upgrade')\n .description(\n 'List the Intlayer packages of every package.json of the project and upgrade them to the latest version'\n )\n .option('--project-root [projectRoot]', 'Project root directory')\n .option('--dry-run', 'List the packages and their target version only')\n .option('--tag <tag>', 'npm dist-tag to upgrade to (e.g. canary)', 'latest')\n .action(async (options) => {\n const { upgrade } = await import('./upgrade');\n return upgrade(options.projectRoot, {\n dryRun: options.dryRun === true,\n distTag: options.tag,\n });\n });\n\n /**\n * DICTIONARIES\n */\n\n const dictionariesProgram = program\n .command('dictionary')\n .alias('dictionaries')\n .alias('dic')\n .description('Dictionaries operations');\n\n // Dictionary build command\n const buildOptions = {\n description: 'Build the dictionaries',\n options: [\n ['-w, --watch', 'Watch for changes'],\n ['--skip-prepare', 'Skip the prepare step'],\n ['--with [with...]', 'Start command in parallel with the build'],\n ['--check-types', 'Check TypeScript type and log errors'],\n ],\n };\n\n // Add build command to dictionaries program\n const dictionariesBuildCmd = dictionariesProgram\n .command('build')\n .description(buildOptions.description);\n\n applyOptions(dictionariesBuildCmd, buildOptions.options);\n applyConfigOptions(dictionariesBuildCmd);\n dictionariesBuildCmd.action(async (options) => {\n const { build } = await import('./build');\n build({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Add build command to root program as well\n const rootBuildCmd = program\n .command('build')\n .description(buildOptions.description);\n\n applyOptions(rootBuildCmd, buildOptions.options);\n applyConfigOptions(rootBuildCmd);\n rootBuildCmd.action(async (options) => {\n const { build } = await import('./build');\n build({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n const watchOptions = {\n description: 'Watch the dictionaries changes',\n options: [['--with [with...]', 'Start command in parallel with the build']],\n };\n\n // Add build command to dictionaries program\n const dictionariesWatchCmd = dictionariesProgram\n .command('watch')\n .description(buildOptions.description);\n\n applyOptions(dictionariesWatchCmd, watchOptions.options);\n applyConfigOptions(dictionariesWatchCmd);\n dictionariesWatchCmd.action(async (options) => {\n const { watchContentDeclaration } = await import('./watch');\n watchContentDeclaration({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Add build command to root program as well\n const rootWatchCmd = program\n .command('watch')\n .description(buildOptions.description);\n\n applyOptions(rootWatchCmd, watchOptions.options);\n applyConfigOptions(rootWatchCmd);\n rootWatchCmd.action(async (options) => {\n const { watchContentDeclaration } = await import('./watch');\n watchContentDeclaration({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Dictionary pull command\n const pullOptions = {\n description: 'Pull dictionaries from the server',\n options: [\n ['-d, --dictionaries [ids...]', 'List of dictionary IDs to pull'],\n [\n '--dictionary [ids...]',\n 'List of dictionary IDs to pull (alias for --dictionaries)',\n ],\n ['--new-dictionaries-path [path]', 'Path to save the new dictionaries'],\n // Backward-compatibility for older tests/flags (camelCase)\n [\n '--newDictionariesPath [path]',\n '[alias] Path to save the new dictionaries',\n ],\n ],\n };\n\n // Add pull command to dictionaries program\n const dictionariesPullCmd = dictionariesProgram\n .command('pull')\n .description(pullOptions.description);\n\n applyOptions(dictionariesPullCmd, pullOptions.options);\n applyConfigOptions(dictionariesPullCmd);\n dictionariesPullCmd.action(async (options) => {\n const { pull } = await import('./pull');\n // Merge dictionary aliases\n const dictionaries = [\n ...(options.dictionaries ?? []),\n ...(options.dictionary ?? []),\n ];\n\n pull({\n ...options,\n dictionaries: dictionaries.length > 0 ? dictionaries : undefined,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Add pull command to root program as well\n const rootPullCmd = program\n .command('pull')\n .description(pullOptions.description);\n\n applyOptions(rootPullCmd, pullOptions.options);\n applyConfigOptions(rootPullCmd);\n rootPullCmd.action(async (options) => {\n const { pull } = await import('./pull');\n // Merge dictionary aliases\n const dictionaries = [\n ...(options.dictionaries ?? []),\n ...(options.dictionary ?? []),\n ];\n\n pull({\n ...options,\n dictionaries: dictionaries.length > 0 ? dictionaries : undefined,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Dictionary push command\n const pushOptions = {\n description:\n 'Push all dictionaries. Create or update the pushed dictionaries',\n options: [\n ['-d, --dictionaries [ids...]', 'List of dictionary IDs to push'],\n [\n '--dictionary [ids...]',\n 'List of dictionary IDs to push (alias for --dictionaries)',\n ],\n [\n '-r, --delete-locale-dictionary',\n 'Delete the local dictionaries after pushing',\n ],\n [\n '-k, --keep-locale-dictionary',\n 'Keep the local dictionaries after pushing',\n ],\n // Backward-compatibility for older tests/flags (camelCase)\n [\n '--deleteLocaleDictionary',\n '[alias] Delete the local dictionaries after pushing',\n ],\n [\n '--keepLocaleDictionary',\n '[alias] Keep the local dictionaries after pushing',\n ],\n [\n '--build [build]',\n 'Build the dictionaries before pushing to ensure the content is up to date. True will force the build, false will skip the build, undefined will allow using the cache of the build',\n ],\n ],\n };\n\n // Add push command to dictionaries program\n const dictionariesPushCmd = dictionariesProgram\n .command('push')\n .description(pushOptions.description);\n\n applyOptions(dictionariesPushCmd, pushOptions.options);\n applyConfigOptions(dictionariesPushCmd);\n applyGitOptions(dictionariesPushCmd);\n\n dictionariesPushCmd.action(async (options) => {\n const { push } = await import('./push/push');\n // Merge dictionary aliases\n const dictionaries = [\n ...(options.dictionaries || []),\n ...(options.dictionary || []),\n ];\n\n return push({\n ...options,\n dictionaries: dictionaries.length > 0 ? dictionaries : undefined,\n gitOptions: extractGitOptions(options),\n configOptions: extractConfigOptions(options),\n } as FillOptions);\n });\n\n // Add push command to root program as well\n const rootPushCmd = program\n .command('push')\n .description(pushOptions.description);\n\n applyOptions(rootPushCmd, pushOptions.options);\n applyConfigOptions(rootPushCmd);\n applyGitOptions(rootPushCmd);\n\n rootPushCmd.action(async (options) => {\n const { push } = await import('./push/push');\n // Merge dictionary aliases\n const dictionaries = [\n ...(options.dictionaries || []),\n ...(options.dictionary || []),\n ];\n\n return push({\n ...options,\n dictionaries: dictionaries.length > 0 ? dictionaries : undefined,\n gitOptions: extractGitOptions(options),\n configOptions: extractConfigOptions(options),\n } as FillOptions);\n });\n\n /**\n * CONFIGURATION\n */\n\n // Define the parent command\n const configurationProgram = program\n .command('configuration')\n .alias('config')\n .alias('conf')\n .description('Configuration operations');\n\n const configGetCmd = configurationProgram\n .command('get')\n .description('Get the configuration');\n\n applyConfigOptions(configGetCmd);\n configGetCmd.action(async (options) => {\n const { getConfig } = await import('./config');\n getConfig({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Define the `push config` subcommand and add it to the `push` command\n const configPushCmd = configurationProgram\n .command('push')\n .description('Push the configuration');\n\n applyConfigOptions(configPushCmd);\n configPushCmd.action(async (options) => {\n const { pushConfig } = await import('./pushConfig');\n pushConfig({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n /**\n * PROJECTS\n */\n\n const projectsProgram = program\n .command('projects')\n .alias('project')\n .description('List Intlayer projects');\n\n const projectsListCmd = projectsProgram\n .command('list')\n .description('List all Intlayer projects in the directory')\n .option('--base-dir [baseDir]', 'Base directory to search from')\n .option(\n '--git-root',\n 'Search from the git root directory instead of the base directory'\n )\n .option('--json', 'Output the results as JSON');\n\n projectsListCmd.action(async (options) => {\n const { listProjectsCommand } = await import('./listProjects');\n listProjectsCommand({\n baseDir: options.baseDir,\n gitRoot: options.gitRoot,\n json: options.json,\n });\n });\n\n // Add alias for projects list command at root level\n const rootProjectsListCmd = program\n .command('projects-list')\n .alias('pl')\n .description('List all Intlayer projects in the directory')\n .option('--base-dir [baseDir]', 'Base directory to search from')\n .option(\n '--git-root',\n 'Search from the git root directory instead of the base directory'\n )\n .option('--absolute', 'Output the results as absolute paths')\n .option('--json', 'Output the results as JSON');\n\n rootProjectsListCmd.action(async (options) => {\n const { listProjectsCommand } = await import('./listProjects');\n listProjectsCommand({\n baseDir: options.baseDir,\n gitRoot: options.gitRoot,\n json: options.json,\n absolute: options.absolute,\n });\n });\n\n /**\n * CONTENT DECLARATION\n */\n\n const contentProgram = program\n .command('content')\n .description('Content declaration operations');\n\n contentProgram\n .command('list')\n .description('List the content declaration files')\n .option('--json', 'Output the results as JSON')\n .option('--absolute', 'Output the results as absolute paths')\n .action(async (options) => {\n const { listContentDeclaration } = await import(\n './listContentDeclaration'\n );\n listContentDeclaration({\n json: options.json,\n absolute: options.absolute,\n });\n });\n\n // Add alias for content list command\n program\n .command('list')\n .description('List the content declaration files')\n .option('--json', 'Output the results as JSON')\n .option('--absolute', 'Output the results as absolute paths')\n .action(async (options) => {\n const { listContentDeclaration } = await import(\n './listContentDeclaration'\n );\n listContentDeclaration({\n json: options.json,\n absolute: options.absolute,\n });\n });\n\n const testProgram = contentProgram\n .command('test')\n .description('Test if there are missing translations')\n .option(\n '--build [build]',\n 'Build the dictionaries before testing to ensure the content is up to date. True will force the build, false will skip the build, undefined will allow using the cache of the build'\n );\n\n applyConfigOptions(testProgram);\n testProgram.action(async (options) => {\n const { testMissingTranslations } = await import('./test');\n testMissingTranslations({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Add alias for content test command\n const rootTestCmd = program\n .command('test')\n .description('Test if there are missing translations')\n .option(\n '--build [build]',\n 'Build the dictionaries before testing to ensure the content is up to date. True will force the build, false will skip the build, undefined will allow using the cache of the build'\n );\n\n applyConfigOptions(rootTestCmd);\n rootTestCmd.action(async (options) => {\n const { testMissingTranslations } = await import('./test');\n testMissingTranslations({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n const fillProgram = program\n .command('fill')\n .description('Fill the dictionaries')\n .option('-f, --file [files...]', 'List of Dictionary files to fill')\n .option('--source-locale [sourceLocale]', 'Source locale to translate from')\n .option(\n '--output-locales [outputLocales...]',\n 'Target locales to translate to'\n )\n .option(\n '--mode [mode]',\n 'Fill mode: complete, review. Complete will fill all missing content, review will fill missing content and review existing keys',\n 'complete'\n )\n .option('-k, --keys [keys...]', 'Filter dictionaries based on keys')\n .option(\n '--key [keys...]',\n 'Filter dictionaries based on keys (alias for --keys)'\n )\n .option(\n '--excluded-keys [excludedKeys...]',\n 'Filter out dictionaries based on keys'\n )\n .option(\n '--excluded-key [excludedKeys...]',\n 'Filter out dictionaries based on keys (alias for --excluded-keys)'\n )\n .option(\n '--path-filter [pathFilters...]',\n 'Filter dictionaries based on glob pattern'\n )\n .option(\n '--build [build]',\n 'Build the dictionaries before filling to ensure the content is up to date. True will force the build, false will skip the build, undefined will allow using the cache of the build'\n )\n .option(\n '--skip-metadata',\n 'Skip filling missing metadata (description, title, tags) for dictionaries'\n );\n\n applyConfigOptions(fillProgram);\n applyAIOptions(fillProgram);\n applyGitOptions(fillProgram);\n\n fillProgram.action(async (options) => {\n const { fill } = await import('./fill/fill');\n // Merge key aliases\n const keys = [...(options.keys ?? []), ...(options.key ?? [])];\n const excludedKeys = [\n ...(options.excludedKeys ?? []),\n ...(options.excludedKey ?? []),\n ];\n // Merge dictionary aliases\n const dictionaries = [\n ...(options.dictionaries ?? []),\n ...(options.dictionary ?? []),\n ];\n\n return fill({\n ...options,\n keys: keys.length > 0 ? keys : undefined,\n excludedKeys: excludedKeys.length > 0 ? excludedKeys : undefined,\n dictionaries: dictionaries.length > 0 ? dictionaries : undefined,\n aiOptions: extractAiOptions(options),\n gitOptions: extractGitOptions(options),\n configOptions: extractConfigOptions(options),\n } as FillOptions);\n });\n\n /**\n * DOCS\n */\n\n const docParams = [\n ['--doc-pattern [docPattern...]', 'Documentation pattern'],\n [\n '--excluded-glob-pattern [excludedGlobPattern...]',\n 'Excluded glob pattern',\n ],\n [\n '--nb-simultaneous-file-processed [nbSimultaneousFileProcessed]',\n 'Number of simultaneous file processed',\n ],\n ['--locales [locales...]', 'Locales'],\n ['--base-locale [baseLocale]', 'Base locale'],\n [\n '--custom-instructions [customInstructions]',\n 'Custom instructions added to the prompt. Usefull to apply specific rules regarding formatting, urls translation, etc.',\n ],\n [\n '--skip-if-modified-before [skipIfModifiedBefore]',\n 'Skip the file if it has been modified before the given time. Can be an absolute time as \"2025-12-05\" (string or Date) or a relative time in ms `1 * 60 * 60 * 1000` (1 hour). This option check update time of the file using the `fs.stat` method. So it could be impacted by Git or other tools that modify the file.',\n ],\n [\n '--skip-if-modified-after [skipIfModifiedAfter]',\n 'Skip the file if it has been modified within the given time. Can be an absolute time as \"2025-12-05\" (string or Date) or a relative time in ms `1 * 60 * 60 * 1000` (1 hour). This option check update time of the file using the `fs.stat` method. So it could be impacted by Git or other tools that modify the file.',\n ],\n ['--skip-if-exists', 'Skip the file if it already exists'],\n ];\n\n const docProgram = program\n .command('doc')\n .description('Documentation operations');\n\n const translateProgram = docProgram\n .command('translate')\n .description('Translate the documentation');\n\n applyConfigOptions(translateProgram);\n applyAIOptions(translateProgram);\n applyGitOptions(translateProgram);\n applyOptions(translateProgram, docParams);\n\n translateProgram.action(async (options) => {\n const { translateDoc } = await import('./translateDoc/translateDoc');\n return translateDoc({\n docPattern: options.docPattern,\n excludedGlobPattern: options.excludedGlobPattern,\n locales: options.locales,\n baseLocale: options.baseLocale,\n aiOptions: extractAiOptions(options),\n gitOptions: extractGitOptions(options),\n nbSimultaneousFileProcessed: options.nbSimultaneousFileProcessed,\n configOptions: extractConfigOptions(options),\n customInstructions: options.customInstructions,\n skipIfModifiedBefore: options.skipIfModifiedBefore,\n skipIfModifiedAfter: options.skipIfModifiedAfter,\n skipIfExists: options.skipIfExists,\n });\n });\n\n const reviewProgram = docProgram\n .command('review')\n .description('Review the documentation')\n .option(\n '--mode [mode]',\n 'How the review runs: \"apply\" (default) translates the diverging blocks with AI and writes the files; \"report\" calls no AI and logs the blocks that need attention (line numbers and content, for both locales) to help another agent generate the translations; \"synthesis\" calls no AI and only logs the final recap of the documents that are up to date and the ones that have blocks to edit.',\n 'apply'\n );\n\n applyConfigOptions(reviewProgram);\n applyAIOptions(reviewProgram);\n applyGitOptions(reviewProgram);\n applyOptions(reviewProgram, docParams);\n\n reviewProgram.action(async (options) => {\n const { reviewDoc } = await import('./reviewDoc/reviewDoc');\n await reviewDoc({\n docPattern: options.docPattern,\n excludedGlobPattern: options.excludedGlobPattern,\n locales: options.locales,\n baseLocale: options.baseLocale,\n aiOptions: extractAiOptions(options),\n gitOptions: extractGitOptions(options),\n nbSimultaneousFileProcessed: options.nbSimultaneousFileProcessed,\n configOptions: extractConfigOptions(options),\n customInstructions: options.customInstructions,\n skipIfModifiedBefore: options.skipIfModifiedBefore,\n skipIfModifiedAfter: options.skipIfModifiedAfter,\n skipIfExists: options.skipIfExists,\n mode: options.mode,\n });\n });\n\n const searchProgram = docProgram\n .command('search')\n .description('Search the documentation')\n .argument('<query>', 'Search query')\n .option('--limit [limit]', 'Limit the number of results', '10');\n\n applyConfigOptions(searchProgram);\n\n searchProgram.action(async (query, options) => {\n const { searchDoc } = await import('./searchDoc');\n return searchDoc({\n query,\n limit: options.limit ? parseInt(options.limit, 10) : 10,\n configOptions: extractConfigOptions(options),\n });\n });\n\n /**\n * LIVE SYNC\n */\n\n const liveOptions = [\n ['--with [with...]', 'Start command in parallel with the live sync'],\n ];\n\n const liveCmd = program\n .command('live')\n .description(\n 'Live sync - Watch for changes made on the CMS and update the application content accordingly'\n );\n\n applyOptions(liveCmd, liveOptions);\n applyConfigOptions(liveCmd);\n\n liveCmd.action(async (options) => {\n const { liveSync } = await import('./liveSync');\n return liveSync({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n /**\n * EDITOR\n */\n\n const editorProgram = program\n .command('editor')\n .description('Visual editor operations');\n\n const editorStartCmd = editorProgram\n .command('start')\n .description('Start the Intlayer visual editor');\n\n applyConfigOptions(editorStartCmd);\n\n editorStartCmd.action(async (options) => {\n const { startEditor } = await import('./editor');\n startEditor({\n env: options.env,\n envFile: options.envFile,\n });\n });\n\n /**\n * EXTRACT\n */\n const extractProgram = program\n .command('extract')\n .alias('ext')\n .description(\n 'Extract strings from components to be placed in a .content file close to the component'\n );\n\n applyConfigOptions(extractProgram);\n\n extractProgram\n .option('-f, --file [files...]', 'List of files to extract')\n .option('--code-only', 'Only extract the component code', false)\n .option('--declaration-only', 'Only generate content declaration', false)\n .action(async (options) => {\n const { extract } = await import('./extract');\n extract({\n files: options.file,\n configOptions: extractConfigOptions(options),\n codeOnly: options.codeOnly,\n declarationOnly: options.declarationOnly,\n });\n });\n\n /**\n * STANDALONE\n */\n const bundleCmd = program\n .command('standalone')\n .description('Create a standalone bundle of the application content')\n .option(\n '-o, --outfile [outfile]',\n 'Output file for the bundle',\n 'intlayer-bundle.js'\n )\n .option('--packages [packages...]', 'List of packages to bundle')\n .option('--version [version]', 'Version of the packages to bundle')\n .option('--minify', 'Minify the output')\n .option('--platform [platform]', 'Target platform', 'browser')\n .option('--format [format]', 'Output format', 'esm')\n .action(async (options) => {\n const { bundle } = await import('./bundle');\n bundle({\n outfile: options.outfile,\n bundlePackages: options.packages,\n version: options.version,\n minify: options.minify,\n platform: options.platform,\n format: options.format,\n configOptions: extractConfigOptions(options),\n });\n });\n\n applyConfigOptions(bundleCmd);\n\n /**\n * SCAN\n */\n const scanCmd = program\n .command('scan')\n .description(\n 'Scan a website to measure its page size and audit its i18n / SEO health'\n )\n .argument('<url>', 'URL of the website to scan')\n .option('--no-deep', 'Disable the deeper puppeteer-based render scan')\n .option('--json', 'Output the results as JSON');\n\n applyConfigOptions(scanCmd);\n\n scanCmd.action(async (url, options) => {\n const { scan } = await import('./scan');\n return scan(url, {\n deep: options.deep,\n json: options.json,\n configOptions: extractConfigOptions(options),\n });\n });\n\n /**\n * CI / AUTOMATION\n *\n * `--ci` is accepted by every command. It re-runs the same command (flag\n * stripped) in every Intlayer project of the repository, injecting\n * per-project credentials from INTLAYER_PROJECT_CREDENTIALS. Handled once at\n * the program level so no action needs to know about it: the process exits\n * with the aggregated status once every project has run.\n */\n program.hook('preAction', async (_program, actionCommand) => {\n if (!actionCommand.opts().ci) return;\n\n const { runCI } = await import('./ci');\n process.exit(await runCI(process.argv.slice(2)));\n });\n\n /**\n * @deprecated `intlayer ci <command...>` is replaced by `intlayer <command> --ci`.\n * Kept hidden so workflows scaffolded by older versions keep working.\n */\n program\n .command('ci', { hidden: true })\n .argument('<command...>', 'The intlayer command to execute')\n .allowUnknownOption() // Forward flags like --verbose to the subcommand\n .action(async (args: string[]) => {\n logger(\n '`intlayer ci <command>` is deprecated, use `intlayer <command> --ci` instead.',\n { level: 'warn' }\n );\n const { runCI } = await import('./ci');\n process.exit(await runCI(args));\n });\n\n // Every command must be registered before parsing: commander dispatches\n // synchronously, so anything added after this line is an unknown command.\n program.parse(process.argv);\n\n return program;\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AAQ,KAAK,MAAM,MAAM,QAAQ,KAAK,MAAM,CAAC,CAAC,CAAC;CACjD,CAAC;;;;;CAMD,QACG,QAAQ,MAAM,EAAE,QAAQ,KAAK,CAAC,CAAC,CAC/B,SAAS,gBAAgB,iCAAiC,CAAC,CAC3D,mBAAmB,CAAC,CACpB,OAAO,OAAO,SAAmB;EAChC,oCACE,iFACA,EAAE,OAAO,OAAO,CAClB;EACA,MAAM,EAAE,UAAU,2CAAM;EACxB,QAAQ,KAAK,MAAM,MAAM,IAAI,CAAC;CAChC,CAAC;CAIH,QAAQ,MAAM,QAAQ,IAAI;CAE1B,OAAO;AACT"}
1
+ {"version":3,"file":"cli.cjs","names":["pathDirname","fileURLToPath","getParentPackageJSON","getConfiguration","Command","Option"],"sources":["../../src/cli.ts"],"sourcesContent":["import { dirname as pathDirname } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport type { AIOptions as BaseAIOptions } from '@intlayer/api';\nimport { logger, setPrefix } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport type { DiffMode, ListGitFilesOptions } from '@intlayer/engine/cli';\nimport type { CustomIntlayerConfig } from '@intlayer/types/config';\nimport { Command, Option } from 'commander';\nimport type { FillOptions } from './fill/fill';\nimport { getParentPackageJSON } from './utils/getParentPackageJSON';\n\n// Extended AI options to include customPrompt\ntype AIOptions = BaseAIOptions & {\n customPrompt?: string;\n};\n\nconst isESModule = typeof import.meta.url === 'string';\n\nexport const dirname = isESModule\n ? pathDirname(fileURLToPath(import.meta.url))\n : __dirname;\n\nconst packageJson = getParentPackageJSON(dirname);\n\nconst logOptions = [\n ['--verbose', 'Verbose (default to true using CLI)'],\n ['--prefix [prefix]', 'Prefix'],\n];\n\nconst ciOptions = [\n [\n '--ci',\n 'CI mode - Run the command in every Intlayer project of the repository (or only the current one), injecting per-project credentials from INTLAYER_PROJECT_CREDENTIALS',\n ],\n];\n\nconst configurationOptions = [\n ['--env-file [envFile]', 'Environment file'],\n ['-e, --env [env]', 'Environment'],\n ['--base-dir [baseDir]', 'Base directory'],\n ['--no-cache [noCache]', 'No cache'],\n ...logOptions,\n ...ciOptions,\n];\n\nconst aiOptions = [\n ['--provider [provider]', 'Provider'],\n ['--temperature [temperature]', 'Temperature'],\n ['--model [model]', 'Model'],\n ['--api-key [apiKey]', 'Provider API key'],\n ['--custom-prompt [prompt]', 'Custom prompt'],\n ['--application-context [applicationContext]', 'Application context'],\n ['--data-serialization [dataSerialization]', 'Data serialization'],\n];\n\nconst gitOptions = [\n ['--git-diff [gitDiff]', 'Git diff mode - Check git diff between two refs'],\n ['--git-diff-base [gitDiffBase]', 'Git diff base ref'],\n ['--git-diff-current [gitDiffCurrent]', 'Git diff current ref'],\n ['--uncommitted [uncommitted]', 'Uncommitted'],\n ['--unpushed [unpushed]', 'Unpushed'],\n ['--untracked [untracked]', 'Untracked'],\n];\n\nconst extractKeysFromOptions = (options: object, keys: string[]) =>\n keys.filter((key) => options[key as keyof typeof options] !== undefined);\n\n/**\n * Helper functions to apply common options to commands\n */\nconst applyOptions = (command: Command, options: string[][]) => {\n options.forEach(([flag, description]) => {\n command.option(flag!, description);\n });\n return command;\n};\n\nconst removeUndefined = <T extends Record<string, any>>(obj: T): T =>\n Object.fromEntries(\n Object.entries(obj).filter(([_, value]) => value !== undefined)\n ) as T;\n\nconst applyConfigOptions = (command: Command) =>\n applyOptions(command, configurationOptions);\nconst applyAIOptions = (command: Command) => applyOptions(command, aiOptions);\nconst applyGitOptions = (command: Command) => applyOptions(command, gitOptions);\n\nconst extractAiOptions = (options: AIOptions): AIOptions | undefined => {\n const {\n apiKey,\n provider,\n model,\n temperature,\n applicationContext,\n customPrompt,\n dataSerialization,\n } = options;\n\n const configuration = getConfiguration();\n\n const { ai } = configuration;\n\n // `AIOptions` is discriminated on `provider`, which is only known at runtime\n // here (CLI flag or configuration file), so the merged object cannot be\n // narrowed to a single member of the union.\n return removeUndefined({\n ...ai,\n apiKey: apiKey ?? configuration.ai?.apiKey,\n provider: provider ?? (configuration.ai?.provider as AIOptions['provider']),\n model: model ?? configuration.ai?.model,\n temperature: temperature ?? configuration.ai?.temperature,\n applicationContext:\n applicationContext ?? configuration.ai?.applicationContext,\n customPrompt: customPrompt ?? (configuration.ai as any)?.customPrompt,\n dataSerialization: dataSerialization ?? configuration.ai?.dataSerialization,\n }) as AIOptions;\n};\n\ntype GitOptions = {\n gitDiff?: boolean;\n gitDiffBase?: string;\n gitDiffCurrent?: string;\n uncommitted?: boolean;\n unpushed?: boolean;\n untracked?: boolean;\n};\n\nconst gitOptionKeys: (keyof GitOptions)[] = [\n 'gitDiff',\n 'gitDiffBase',\n 'gitDiffCurrent',\n 'uncommitted',\n 'unpushed',\n 'untracked',\n];\n\nconst extractGitOptions = (\n options: GitOptions\n): ListGitFilesOptions | undefined => {\n const filteredOptions = extractKeysFromOptions(options, gitOptionKeys);\n\n const isOptionEmpty = filteredOptions.length === 0;\n\n if (isOptionEmpty) return undefined;\n\n const {\n gitDiff,\n gitDiffBase,\n gitDiffCurrent,\n uncommitted,\n unpushed,\n untracked,\n } = options;\n\n const mode = [\n gitDiff && 'gitDiff',\n uncommitted && 'uncommitted',\n unpushed && 'unpushed',\n untracked && 'untracked',\n ].filter(Boolean) as DiffMode[];\n\n return removeUndefined({\n mode,\n baseRef: gitDiffBase,\n currentRef: gitDiffCurrent,\n absolute: true,\n });\n};\n\ntype LogOptions = {\n prefix?: string;\n verbose?: boolean;\n};\n\nexport type ConfigurationOptions = {\n baseDir?: string;\n env?: string;\n envFile?: string;\n noCache?: boolean;\n checkTypes?: boolean;\n} & LogOptions;\n\nconst configurationOptionKeys: (keyof ConfigurationOptions)[] = [\n 'baseDir',\n 'env',\n 'envFile',\n 'verbose',\n 'prefix',\n 'checkTypes',\n];\n\nconst extractConfigOptions = (\n options: ConfigurationOptions & { with?: string }\n): GetConfigurationOptions | undefined => {\n const filteredOptions = extractKeysFromOptions(\n options,\n configurationOptionKeys\n );\n\n const isOptionEmpty = filteredOptions.length === 0;\n\n if (isOptionEmpty) {\n return undefined;\n }\n\n const { baseDir, env, envFile, verbose, noCache, checkTypes } = options;\n\n const log = removeUndefined({\n mode:\n typeof verbose !== 'undefined'\n ? verbose\n ? 'verbose'\n : 'default'\n : undefined,\n });\n\n const build = removeUndefined({\n checkTypes,\n });\n\n const override: CustomIntlayerConfig = removeUndefined({\n log:\n Object.keys(log).length > 0\n ? (log as CustomIntlayerConfig['log'])\n : undefined,\n build: Object.keys(build).length > 0 ? build : undefined,\n });\n\n return removeUndefined({\n baseDir,\n env,\n envFile,\n override: Object.keys(override).length > 0 ? override : undefined,\n cache: typeof noCache !== 'undefined' ? !noCache : undefined,\n });\n};\n\n/**\n * Set the API for the CLI\n *\n * Example of commands:\n *\n * npm run intlayer build --watch\n * npm run intlayer push --dictionaries id1 id2 id3 --deleteLocaleDir\n */\nexport const setAPI = (): Command => {\n const isWithCommand = process.argv.includes('--with');\n\n if (!isWithCommand) {\n setPrefix('');\n }\n\n const program = new Command();\n\n program\n .version(\n packageJson.version!,\n '-v, --version',\n 'Print the Intlayer CLI version'\n )\n .description('Intlayer CLI');\n\n // Keep `-V` (commander's default short flag) working alongside `-v`\n program.addOption(\n new Option('-V', 'Print the Intlayer CLI version').hideHelp()\n );\n program.on('option:V', () => {\n console.log(packageJson.version ?? 'unknown');\n process.exit(0);\n });\n\n // Explicit version subcommand for convenience: `npx intlayer version`\n program\n .command('version')\n .description('Print the Intlayer CLI version')\n .action(() => {\n // Prefer the resolved package.json version; fallback to unknown\n // Keeping output minimal to align with common CLI behavior\n console.log(packageJson.version ?? 'unknown');\n });\n\n /**\n * AUTH\n */\n const loginCmd = program\n .command('login')\n .description('Login to Intlayer')\n .option('--cms-url [cmsUrl]', 'CMS URL');\n\n applyConfigOptions(loginCmd);\n\n loginCmd.action(async (options) => {\n const { login } = await import('./auth/login');\n const configOptions = extractConfigOptions(options) ?? {\n override: {\n log: {\n prefix: '',\n mode: 'verbose',\n },\n },\n };\n\n return login({\n cmsUrl: options.cmsUrl,\n configOptions,\n });\n });\n\n /**\n * INIT\n */\n const initCmd = program\n .command('init')\n // Options after a subcommand belong to it: `init project --routing` and\n // `init skills --project-root` must not be consumed by `init` itself,\n // which declares the same options. Needs the root to be positional too.\n .enablePositionalOptions()\n .description(\n 'Install the Intlayer packages and set up the framework. Use --interactive, or the init subcommands, for the other setup steps (CI, skills, MCP, VS Code, LSP, lint, CMS, …)'\n )\n .option('--project-root [projectRoot]', 'Project root directory')\n .option('--no-gitignore', 'Do not add .intlayer to .gitignore')\n .option(\n '--no-github-actions',\n 'With --interactive: do not scaffold the GitHub Actions workflows, even if selected'\n )\n .option(\n '--no-framework-setup',\n 'Do not set up the project (Intlayer config, tsconfig, bundler plugin, middleware/proxy, providers in layout/page)'\n )\n .option(\n '-i, --interactive',\n 'Interactively choose what to set up (packages, skills, MCP, VS Code extension, LSP, …). Needs a terminal'\n )\n .option(\n '--routing <routing>',\n 'Locale routing: prefix-no-default | prefix-all | no-prefix | search-params | none'\n )\n .action(async (options) => {\n const { init, parseLocaleRoutingChoice, getRoutingInitOptions } =\n await import('./init');\n return init(\n options.projectRoot,\n {\n noGitignore: options.gitignore === false,\n noGithubActions: options.githubActions === false,\n noFrameworkSetup: options.frameworkSetup === false,\n upgradeToVersion: packageJson.version,\n ...(options.routing\n ? getRoutingInitOptions(parseLocaleRoutingChoice(options.routing))\n : {}),\n },\n options.interactive === true\n );\n });\n\n initCmd\n .command('packages')\n .description(\n 'Install the missing Intlayer packages and upgrade the outdated ones'\n )\n .option('--project-root [projectRoot]', 'Project root directory')\n .action(async (options) => {\n const { initSteps } = await import('./init');\n return initSteps(options.projectRoot, ['packages'], {\n upgradeToVersion: packageJson.version,\n });\n });\n\n initCmd\n .command('project')\n .alias('framework')\n .description(\n 'Set up the project: Intlayer config, tsconfig, bundler plugin, middleware/proxy, providers in layout/page and .gitignore'\n )\n .option('--project-root [projectRoot]', 'Project root directory')\n .option('--no-gitignore', 'Do not add .intlayer to .gitignore')\n .option(\n '--routing <routing>',\n 'Locale routing: prefix-no-default | prefix-all | no-prefix | search-params | none'\n )\n .action(async (options) => {\n const { initSteps, parseLocaleRoutingChoice, getRoutingInitOptions } =\n await import('./init');\n return initSteps(options.projectRoot, ['projectSetup'], {\n noGitignore: options.gitignore === false,\n ...(options.routing\n ? getRoutingInitOptions(parseLocaleRoutingChoice(options.routing))\n : {}),\n });\n });\n\n initCmd\n .command('github-actions')\n .alias('ci')\n .description(\n 'Scaffold the fill and test GitHub Actions workflows that run on every pull request'\n )\n .option('--project-root [projectRoot]', 'Project root directory')\n .action(async (options) => {\n const { initSteps } = await import('./init');\n return initSteps(options.projectRoot, ['githubActions']);\n });\n\n initCmd\n .command('vscode-extension')\n .alias('vscode')\n .description(\n 'Recommend the Intlayer VS Code extension in .vscode/extensions.json'\n )\n .option('--project-root [projectRoot]', 'Project root directory')\n .action(async (options) => {\n const { initSteps } = await import('./init');\n return initSteps(options.projectRoot, ['vscodeExtension']);\n });\n\n initCmd\n .command('lsp')\n .description(\n 'Configure the Intlayer language server in .vscode/settings.json'\n )\n .option('--project-root [projectRoot]', 'Project root directory')\n .action(async (options) => {\n const { initSteps } = await import('./init');\n return initSteps(options.projectRoot, ['lsp']);\n });\n\n initCmd\n .command('eslint')\n .alias('lint')\n .description(\n 'Enable the Intlayer lint rules (ESLint / oxlint), when the project already lints'\n )\n .option('--project-root [projectRoot]', 'Project root directory')\n .action(async (options) => {\n const { initSteps } = await import('./init');\n return initSteps(options.projectRoot, ['eslint'], {\n upgradeToVersion: packageJson.version,\n });\n });\n\n initCmd\n .command('skills')\n .description('Initialize Intlayer skills in the project')\n .option('--project-root [projectRoot]', 'Project root directory')\n .option(\n '-p, --platform <platform>',\n 'AI platform (e.g. Claude, Cursor, VSCode). Detected when omitted'\n )\n .option(\n '-s, --skills <skills...>',\n 'Skills to install (e.g. Usage Content React). Defaults to the project stack without a terminal'\n )\n .action(async (options) => {\n const { initSkills, parsePlatform, parseSkills } = await import(\n './initSkills'\n );\n await initSkills(options.projectRoot, {\n platform: options.platform\n ? parsePlatform(options.platform)\n : undefined,\n skills: options.skills ? parseSkills(options.skills) : undefined,\n });\n });\n\n initCmd\n .command('mcp')\n .description('Initialize Intlayer MCP server in the project')\n .option('--project-root [projectRoot]', 'Project root directory')\n .option(\n '-p, --platform <platform>',\n 'AI platform (e.g. Claude, Cursor, VSCode). Detected when omitted'\n )\n .option(\n '-t, --transport <transport>',\n 'stdio (local server, default without a terminal) | sse (hosted)'\n )\n .action(async (options) => {\n const { initMCP, parseMCPTransport } = await import('./initMCP');\n const { parsePlatform } = await import('./initSkills');\n return initMCP(options.projectRoot, {\n platform: options.platform\n ? parsePlatform(options.platform)\n : undefined,\n transport: options.transport\n ? parseMCPTransport(options.transport)\n : undefined,\n });\n });\n\n initCmd\n .command('cms')\n .description(\n 'Log in to the Intlayer CMS through your browser, then store the credentials in your .env'\n )\n .option('--project-root [projectRoot]', 'Project root directory')\n .action(async (options) => {\n const { initCms } = await import('./init');\n return initCms(options.projectRoot);\n });\n\n initCmd\n .command('infra')\n .description(\n 'Set up the Intlayer infrastructure: desktop app, all-in-one Docker container or Docker Compose stack (runs https://intlayer.org/install.sh, or install.ps1 on Windows)'\n )\n .option(\n '-m, --mode <mode>',\n 'Skip the menu: desktop | docker | compose (required without a terminal)'\n )\n .action(async (options) => {\n const { initInfra, parseInfraMode } = await import('./initInfra');\n return initInfra({\n mode: options.mode ? parseInfraMode(options.mode) : undefined,\n });\n });\n\n initCmd\n .command('extension')\n .alias('chrome-extension')\n .description(\n 'Install the Intlayer Chrome extension or Firefox add-on in your browser'\n )\n .option(\n '-b, --browser <browsers...>',\n 'Browsers to open the store page for: chrome | firefox. Without a terminal, the links are only printed'\n )\n .action(async (options) => {\n const { initChromeExtension, parseExtensionBrowsers } = await import(\n './initChromeExtension'\n );\n return initChromeExtension({\n browsers: options.browser\n ? parseExtensionBrowsers(options.browser)\n : undefined,\n });\n });\n\n /**\n * UPGRADE\n */\n program\n .command('upgrade')\n .description(\n 'List the Intlayer packages of every package.json of the project and upgrade them to the latest version'\n )\n .option('--project-root [projectRoot]', 'Project root directory')\n .option('--dry-run', 'List the packages and their target version only')\n .option('--tag <tag>', 'npm dist-tag to upgrade to (e.g. canary)', 'latest')\n .action(async (options) => {\n const { upgrade } = await import('./upgrade');\n return upgrade(options.projectRoot, {\n dryRun: options.dryRun === true,\n distTag: options.tag,\n });\n });\n\n /**\n * DICTIONARIES\n */\n\n const dictionariesProgram = program\n .command('dictionary')\n .alias('dictionaries')\n .alias('dic')\n .description('Dictionaries operations');\n\n // Dictionary build command\n const buildOptions = {\n description: 'Build the dictionaries',\n options: [\n ['-w, --watch', 'Watch for changes'],\n ['--skip-prepare', 'Skip the prepare step'],\n ['--with [with...]', 'Start command in parallel with the build'],\n ['--check-types', 'Check TypeScript type and log errors'],\n ],\n };\n\n // Add build command to dictionaries program\n const dictionariesBuildCmd = dictionariesProgram\n .command('build')\n .description(buildOptions.description);\n\n applyOptions(dictionariesBuildCmd, buildOptions.options);\n applyConfigOptions(dictionariesBuildCmd);\n dictionariesBuildCmd.action(async (options) => {\n const { build } = await import('./build');\n build({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Add build command to root program as well\n const rootBuildCmd = program\n .command('build')\n .description(buildOptions.description);\n\n applyOptions(rootBuildCmd, buildOptions.options);\n applyConfigOptions(rootBuildCmd);\n rootBuildCmd.action(async (options) => {\n const { build } = await import('./build');\n build({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n const watchOptions = {\n description: 'Watch the dictionaries changes',\n options: [['--with [with...]', 'Start command in parallel with the build']],\n };\n\n // Add build command to dictionaries program\n const dictionariesWatchCmd = dictionariesProgram\n .command('watch')\n .description(buildOptions.description);\n\n applyOptions(dictionariesWatchCmd, watchOptions.options);\n applyConfigOptions(dictionariesWatchCmd);\n dictionariesWatchCmd.action(async (options) => {\n const { watchContentDeclaration } = await import('./watch');\n watchContentDeclaration({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Add build command to root program as well\n const rootWatchCmd = program\n .command('watch')\n .description(buildOptions.description);\n\n applyOptions(rootWatchCmd, watchOptions.options);\n applyConfigOptions(rootWatchCmd);\n rootWatchCmd.action(async (options) => {\n const { watchContentDeclaration } = await import('./watch');\n watchContentDeclaration({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Dictionary pull command\n const pullOptions = {\n description: 'Pull dictionaries from the server',\n options: [\n ['-d, --dictionaries [ids...]', 'List of dictionary IDs to pull'],\n [\n '--dictionary [ids...]',\n 'List of dictionary IDs to pull (alias for --dictionaries)',\n ],\n ['--new-dictionaries-path [path]', 'Path to save the new dictionaries'],\n // Backward-compatibility for older tests/flags (camelCase)\n [\n '--newDictionariesPath [path]',\n '[alias] Path to save the new dictionaries',\n ],\n ],\n };\n\n // Add pull command to dictionaries program\n const dictionariesPullCmd = dictionariesProgram\n .command('pull')\n .description(pullOptions.description);\n\n applyOptions(dictionariesPullCmd, pullOptions.options);\n applyConfigOptions(dictionariesPullCmd);\n dictionariesPullCmd.action(async (options) => {\n const { pull } = await import('./pull');\n // Merge dictionary aliases\n const dictionaries = [\n ...(options.dictionaries ?? []),\n ...(options.dictionary ?? []),\n ];\n\n pull({\n ...options,\n dictionaries: dictionaries.length > 0 ? dictionaries : undefined,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Add pull command to root program as well\n const rootPullCmd = program\n .command('pull')\n .description(pullOptions.description);\n\n applyOptions(rootPullCmd, pullOptions.options);\n applyConfigOptions(rootPullCmd);\n rootPullCmd.action(async (options) => {\n const { pull } = await import('./pull');\n // Merge dictionary aliases\n const dictionaries = [\n ...(options.dictionaries ?? []),\n ...(options.dictionary ?? []),\n ];\n\n pull({\n ...options,\n dictionaries: dictionaries.length > 0 ? dictionaries : undefined,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Dictionary push command\n const pushOptions = {\n description:\n 'Push all dictionaries. Create or update the pushed dictionaries',\n options: [\n ['-d, --dictionaries [ids...]', 'List of dictionary IDs to push'],\n [\n '--dictionary [ids...]',\n 'List of dictionary IDs to push (alias for --dictionaries)',\n ],\n [\n '-r, --delete-locale-dictionary',\n 'Delete the local dictionaries after pushing',\n ],\n [\n '-k, --keep-locale-dictionary',\n 'Keep the local dictionaries after pushing',\n ],\n // Backward-compatibility for older tests/flags (camelCase)\n [\n '--deleteLocaleDictionary',\n '[alias] Delete the local dictionaries after pushing',\n ],\n [\n '--keepLocaleDictionary',\n '[alias] Keep the local dictionaries after pushing',\n ],\n [\n '--build [build]',\n 'Build the dictionaries before pushing to ensure the content is up to date. True will force the build, false will skip the build, undefined will allow using the cache of the build',\n ],\n ],\n };\n\n // Add push command to dictionaries program\n const dictionariesPushCmd = dictionariesProgram\n .command('push')\n .description(pushOptions.description);\n\n applyOptions(dictionariesPushCmd, pushOptions.options);\n applyConfigOptions(dictionariesPushCmd);\n applyGitOptions(dictionariesPushCmd);\n\n dictionariesPushCmd.action(async (options) => {\n const { push } = await import('./push/push');\n // Merge dictionary aliases\n const dictionaries = [\n ...(options.dictionaries || []),\n ...(options.dictionary || []),\n ];\n\n return push({\n ...options,\n dictionaries: dictionaries.length > 0 ? dictionaries : undefined,\n gitOptions: extractGitOptions(options),\n configOptions: extractConfigOptions(options),\n } as FillOptions);\n });\n\n // Add push command to root program as well\n const rootPushCmd = program\n .command('push')\n .description(pushOptions.description);\n\n applyOptions(rootPushCmd, pushOptions.options);\n applyConfigOptions(rootPushCmd);\n applyGitOptions(rootPushCmd);\n\n rootPushCmd.action(async (options) => {\n const { push } = await import('./push/push');\n // Merge dictionary aliases\n const dictionaries = [\n ...(options.dictionaries || []),\n ...(options.dictionary || []),\n ];\n\n return push({\n ...options,\n dictionaries: dictionaries.length > 0 ? dictionaries : undefined,\n gitOptions: extractGitOptions(options),\n configOptions: extractConfigOptions(options),\n } as FillOptions);\n });\n\n /**\n * CONFIGURATION\n */\n\n // Define the parent command\n const configurationProgram = program\n .command('configuration')\n .alias('config')\n .alias('conf')\n .description('Configuration operations');\n\n const configGetCmd = configurationProgram\n .command('get')\n .description('Get the configuration');\n\n applyConfigOptions(configGetCmd);\n configGetCmd.action(async (options) => {\n const { getConfig } = await import('./config');\n getConfig({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Define the `push config` subcommand and add it to the `push` command\n const configPushCmd = configurationProgram\n .command('push')\n .description('Push the configuration');\n\n applyConfigOptions(configPushCmd);\n configPushCmd.action(async (options) => {\n const { pushConfig } = await import('./pushConfig');\n pushConfig({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n /**\n * PROJECTS\n */\n\n const projectsProgram = program\n .command('projects')\n .alias('project')\n .description('List Intlayer projects');\n\n const projectsListCmd = projectsProgram\n .command('list')\n .description('List all Intlayer projects in the directory')\n .option('--base-dir [baseDir]', 'Base directory to search from')\n .option(\n '--git-root',\n 'Search from the git root directory instead of the base directory'\n )\n .option('--json', 'Output the results as JSON');\n\n projectsListCmd.action(async (options) => {\n const { listProjectsCommand } = await import('./listProjects');\n listProjectsCommand({\n baseDir: options.baseDir,\n gitRoot: options.gitRoot,\n json: options.json,\n });\n });\n\n // Add alias for projects list command at root level\n const rootProjectsListCmd = program\n .command('projects-list')\n .alias('pl')\n .description('List all Intlayer projects in the directory')\n .option('--base-dir [baseDir]', 'Base directory to search from')\n .option(\n '--git-root',\n 'Search from the git root directory instead of the base directory'\n )\n .option('--absolute', 'Output the results as absolute paths')\n .option('--json', 'Output the results as JSON');\n\n rootProjectsListCmd.action(async (options) => {\n const { listProjectsCommand } = await import('./listProjects');\n listProjectsCommand({\n baseDir: options.baseDir,\n gitRoot: options.gitRoot,\n json: options.json,\n absolute: options.absolute,\n });\n });\n\n /**\n * CONTENT DECLARATION\n */\n\n const contentProgram = program\n .command('content')\n .description('Content declaration operations');\n\n contentProgram\n .command('list')\n .description('List the content declaration files')\n .option('--json', 'Output the results as JSON')\n .option('--absolute', 'Output the results as absolute paths')\n .action(async (options) => {\n const { listContentDeclaration } = await import(\n './listContentDeclaration'\n );\n listContentDeclaration({\n json: options.json,\n absolute: options.absolute,\n });\n });\n\n // Add alias for content list command\n program\n .command('list')\n .description('List the content declaration files')\n .option('--json', 'Output the results as JSON')\n .option('--absolute', 'Output the results as absolute paths')\n .action(async (options) => {\n const { listContentDeclaration } = await import(\n './listContentDeclaration'\n );\n listContentDeclaration({\n json: options.json,\n absolute: options.absolute,\n });\n });\n\n const testProgram = contentProgram\n .command('test')\n .description('Test if there are missing translations')\n .option(\n '--build [build]',\n 'Build the dictionaries before testing to ensure the content is up to date. True will force the build, false will skip the build, undefined will allow using the cache of the build'\n );\n\n applyConfigOptions(testProgram);\n testProgram.action(async (options) => {\n const { testMissingTranslations } = await import('./test');\n testMissingTranslations({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n // Add alias for content test command\n const rootTestCmd = program\n .command('test')\n .description('Test if there are missing translations')\n .option(\n '--build [build]',\n 'Build the dictionaries before testing to ensure the content is up to date. True will force the build, false will skip the build, undefined will allow using the cache of the build'\n );\n\n applyConfigOptions(rootTestCmd);\n rootTestCmd.action(async (options) => {\n const { testMissingTranslations } = await import('./test');\n testMissingTranslations({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n const fillProgram = program\n .command('fill')\n .description('Fill the dictionaries')\n .option('-f, --file [files...]', 'List of Dictionary files to fill')\n .option('--source-locale [sourceLocale]', 'Source locale to translate from')\n .option(\n '--output-locales [outputLocales...]',\n 'Target locales to translate to'\n )\n .option(\n '--mode [mode]',\n 'Fill mode: complete, review. Complete will fill all missing content, review will fill missing content and review existing keys',\n 'complete'\n )\n .option('-k, --keys [keys...]', 'Filter dictionaries based on keys')\n .option(\n '--key [keys...]',\n 'Filter dictionaries based on keys (alias for --keys)'\n )\n .option(\n '--excluded-keys [excludedKeys...]',\n 'Filter out dictionaries based on keys'\n )\n .option(\n '--excluded-key [excludedKeys...]',\n 'Filter out dictionaries based on keys (alias for --excluded-keys)'\n )\n .option(\n '--path-filter [pathFilters...]',\n 'Filter dictionaries based on glob pattern'\n )\n .option(\n '--build [build]',\n 'Build the dictionaries before filling to ensure the content is up to date. True will force the build, false will skip the build, undefined will allow using the cache of the build'\n )\n .option(\n '--skip-metadata',\n 'Skip filling missing metadata (description, title, tags) for dictionaries'\n );\n\n applyConfigOptions(fillProgram);\n applyAIOptions(fillProgram);\n applyGitOptions(fillProgram);\n\n fillProgram.action(async (options) => {\n const { fill } = await import('./fill/fill');\n // Merge key aliases\n const keys = [...(options.keys ?? []), ...(options.key ?? [])];\n const excludedKeys = [\n ...(options.excludedKeys ?? []),\n ...(options.excludedKey ?? []),\n ];\n // Merge dictionary aliases\n const dictionaries = [\n ...(options.dictionaries ?? []),\n ...(options.dictionary ?? []),\n ];\n\n await fill({\n ...options,\n keys: keys.length > 0 ? keys : undefined,\n excludedKeys: excludedKeys.length > 0 ? excludedKeys : undefined,\n dictionaries: dictionaries.length > 0 ? dictionaries : undefined,\n aiOptions: extractAiOptions(options),\n gitOptions: extractGitOptions(options),\n configOptions: extractConfigOptions(options),\n } as FillOptions);\n });\n\n /**\n * DOCS\n */\n\n const docParams = [\n ['--doc-pattern [docPattern...]', 'Documentation pattern'],\n [\n '--excluded-glob-pattern [excludedGlobPattern...]',\n 'Excluded glob pattern',\n ],\n [\n '--nb-simultaneous-file-processed [nbSimultaneousFileProcessed]',\n 'Number of simultaneous file processed',\n ],\n ['--locales [locales...]', 'Locales'],\n ['--base-locale [baseLocale]', 'Base locale'],\n [\n '--custom-instructions [customInstructions]',\n 'Custom instructions added to the prompt. Usefull to apply specific rules regarding formatting, urls translation, etc.',\n ],\n [\n '--skip-if-modified-before [skipIfModifiedBefore]',\n 'Skip the file if it has been modified before the given time. Can be an absolute time as \"2025-12-05\" (string or Date) or a relative time in ms `1 * 60 * 60 * 1000` (1 hour). This option check update time of the file using the `fs.stat` method. So it could be impacted by Git or other tools that modify the file.',\n ],\n [\n '--skip-if-modified-after [skipIfModifiedAfter]',\n 'Skip the file if it has been modified within the given time. Can be an absolute time as \"2025-12-05\" (string or Date) or a relative time in ms `1 * 60 * 60 * 1000` (1 hour). This option check update time of the file using the `fs.stat` method. So it could be impacted by Git or other tools that modify the file.',\n ],\n ['--skip-if-exists', 'Skip the file if it already exists'],\n ];\n\n const docProgram = program\n .command('doc')\n .description('Documentation operations');\n\n const translateProgram = docProgram\n .command('translate')\n .description('Translate the documentation');\n\n applyConfigOptions(translateProgram);\n applyAIOptions(translateProgram);\n applyGitOptions(translateProgram);\n applyOptions(translateProgram, docParams);\n\n translateProgram.action(async (options) => {\n const { translateDoc } = await import('./translateDoc/translateDoc');\n return translateDoc({\n docPattern: options.docPattern,\n excludedGlobPattern: options.excludedGlobPattern,\n locales: options.locales,\n baseLocale: options.baseLocale,\n aiOptions: extractAiOptions(options),\n gitOptions: extractGitOptions(options),\n nbSimultaneousFileProcessed: options.nbSimultaneousFileProcessed,\n configOptions: extractConfigOptions(options),\n customInstructions: options.customInstructions,\n skipIfModifiedBefore: options.skipIfModifiedBefore,\n skipIfModifiedAfter: options.skipIfModifiedAfter,\n skipIfExists: options.skipIfExists,\n });\n });\n\n const reviewProgram = docProgram\n .command('review')\n .description('Review the documentation')\n .option(\n '--mode [mode]',\n 'How the review runs: \"apply\" (default) translates the diverging blocks with AI and writes the files; \"report\" calls no AI and logs the blocks that need attention (line numbers and content, for both locales) to help another agent generate the translations; \"synthesis\" calls no AI and only logs the final recap of the documents that are up to date and the ones that have blocks to edit.',\n 'apply'\n );\n\n applyConfigOptions(reviewProgram);\n applyAIOptions(reviewProgram);\n applyGitOptions(reviewProgram);\n applyOptions(reviewProgram, docParams);\n\n reviewProgram.action(async (options) => {\n const { reviewDoc } = await import('./reviewDoc/reviewDoc');\n await reviewDoc({\n docPattern: options.docPattern,\n excludedGlobPattern: options.excludedGlobPattern,\n locales: options.locales,\n baseLocale: options.baseLocale,\n aiOptions: extractAiOptions(options),\n gitOptions: extractGitOptions(options),\n nbSimultaneousFileProcessed: options.nbSimultaneousFileProcessed,\n configOptions: extractConfigOptions(options),\n customInstructions: options.customInstructions,\n skipIfModifiedBefore: options.skipIfModifiedBefore,\n skipIfModifiedAfter: options.skipIfModifiedAfter,\n skipIfExists: options.skipIfExists,\n mode: options.mode,\n });\n });\n\n const searchProgram = docProgram\n .command('search')\n .description('Search the documentation')\n .argument('<query>', 'Search query')\n .option('--limit [limit]', 'Limit the number of results', '10');\n\n applyConfigOptions(searchProgram);\n\n searchProgram.action(async (query, options) => {\n const { searchDoc } = await import('./searchDoc');\n return searchDoc({\n query,\n limit: options.limit ? parseInt(options.limit, 10) : 10,\n configOptions: extractConfigOptions(options),\n });\n });\n\n /**\n * LIVE SYNC\n */\n\n const liveOptions = [\n ['--with [with...]', 'Start command in parallel with the live sync'],\n ];\n\n const liveCmd = program\n .command('live')\n .description(\n 'Live sync - Watch for changes made on the CMS and update the application content accordingly'\n );\n\n applyOptions(liveCmd, liveOptions);\n applyConfigOptions(liveCmd);\n\n liveCmd.action(async (options) => {\n const { liveSync } = await import('./liveSync');\n return liveSync({\n ...options,\n configOptions: extractConfigOptions(options),\n });\n });\n\n /**\n * EDITOR\n */\n\n const editorProgram = program\n .command('editor')\n .description('Visual editor operations');\n\n const editorStartCmd = editorProgram\n .command('start')\n .description('Start the Intlayer visual editor');\n\n applyConfigOptions(editorStartCmd);\n\n editorStartCmd.action(async (options) => {\n const { startEditor } = await import('./editor');\n startEditor({\n env: options.env,\n envFile: options.envFile,\n });\n });\n\n /**\n * EXTRACT\n */\n const extractProgram = program\n .command('extract')\n .alias('ext')\n .description(\n 'Extract strings from components to be placed in a .content file close to the component'\n );\n\n applyConfigOptions(extractProgram);\n\n extractProgram\n .option('-f, --file [files...]', 'List of files to extract')\n .option('--code-only', 'Only extract the component code', false)\n .option('--declaration-only', 'Only generate content declaration', false)\n .action(async (options) => {\n const { extract } = await import('./extract');\n extract({\n files: options.file,\n configOptions: extractConfigOptions(options),\n codeOnly: options.codeOnly,\n declarationOnly: options.declarationOnly,\n });\n });\n\n /**\n * STANDALONE\n */\n const bundleCmd = program\n .command('standalone')\n .description('Create a standalone bundle of the application content')\n .option(\n '-o, --outfile [outfile]',\n 'Output file for the bundle',\n 'intlayer-bundle.js'\n )\n .option('--packages [packages...]', 'List of packages to bundle')\n .option('--version [version]', 'Version of the packages to bundle')\n .option('--minify', 'Minify the output')\n .option('--platform [platform]', 'Target platform', 'browser')\n .option('--format [format]', 'Output format', 'esm')\n .action(async (options) => {\n const { bundle } = await import('./bundle');\n bundle({\n outfile: options.outfile,\n bundlePackages: options.packages,\n version: options.version,\n minify: options.minify,\n platform: options.platform,\n format: options.format,\n configOptions: extractConfigOptions(options),\n });\n });\n\n applyConfigOptions(bundleCmd);\n\n /**\n * SCAN\n */\n const scanCmd = program\n .command('scan')\n .description(\n 'Scan a website to measure its page size and audit its i18n / SEO health'\n )\n .argument('<url>', 'URL of the website to scan')\n .option('--no-deep', 'Disable the deeper puppeteer-based render scan')\n .option('--json', 'Output the results as JSON');\n\n applyConfigOptions(scanCmd);\n\n scanCmd.action(async (url, options) => {\n const { scan } = await import('./scan');\n return scan(url, {\n deep: options.deep,\n json: options.json,\n configOptions: extractConfigOptions(options),\n });\n });\n\n /**\n * CI / AUTOMATION\n *\n * `--ci` is accepted by every command. It re-runs the same command (flag\n * stripped) in every Intlayer project of the repository, injecting\n * per-project credentials from INTLAYER_PROJECT_CREDENTIALS. Handled once at\n * the program level so no action needs to know about it: the process exits\n * with the aggregated status once every project has run.\n */\n program.hook('preAction', async (_program, actionCommand) => {\n if (!actionCommand.opts().ci) return;\n\n const { runCI } = await import('./ci');\n process.exit(await runCI(process.argv.slice(2)));\n });\n\n /**\n * @deprecated `intlayer ci <command...>` is replaced by `intlayer <command> --ci`.\n * Kept hidden so workflows scaffolded by older versions keep working.\n */\n program\n .command('ci', { hidden: true })\n .argument('<command...>', 'The intlayer command to execute')\n .allowUnknownOption() // Forward flags like --verbose to the subcommand\n .action(async (args: string[]) => {\n logger(\n '`intlayer ci <command>` is deprecated, use `intlayer <command> --ci` instead.',\n { level: 'warn' }\n );\n const { runCI } = await import('./ci');\n process.exit(await runCI(args));\n });\n\n // Hand the arguments after a subcommand name to that subcommand in order, so\n // `init` can let its subcommands own the options it declares too (see\n // `initCmd`). Set last: commands created before do not inherit it.\n program.enablePositionalOptions();\n\n // Every command must be registered before parsing: commander dispatches\n // synchronously, so anything added after this line is an unknown command.\n program.parse(process.argv);\n\n return program;\n};\n"],"mappings":";;;;;;;;;AAmBA,MAAM,aAAa,yDAA2B;AAE9C,MAAa,UAAU,iBACnBA,uBAAYC,qEAA6B,CAAC,IAC1C;AAEJ,MAAM,cAAcC,wDAAqB,OAAO;AAEhD,MAAM,aAAa,CACjB,CAAC,aAAa,qCAAqC,GACnD,CAAC,qBAAqB,QAAQ,CAChC;AAEA,MAAM,YAAY,CAChB,CACE,QACA,sKACF,CACF;AAEA,MAAM,uBAAuB;CAC3B,CAAC,wBAAwB,kBAAkB;CAC3C,CAAC,mBAAmB,aAAa;CACjC,CAAC,wBAAwB,gBAAgB;CACzC,CAAC,wBAAwB,UAAU;CACnC,GAAG;CACH,GAAG;AACL;AAEA,MAAM,YAAY;CAChB,CAAC,yBAAyB,UAAU;CACpC,CAAC,+BAA+B,aAAa;CAC7C,CAAC,mBAAmB,OAAO;CAC3B,CAAC,sBAAsB,kBAAkB;CACzC,CAAC,4BAA4B,eAAe;CAC5C,CAAC,8CAA8C,qBAAqB;CACpE,CAAC,4CAA4C,oBAAoB;AACnE;AAEA,MAAM,aAAa;CACjB,CAAC,wBAAwB,iDAAiD;CAC1E,CAAC,iCAAiC,mBAAmB;CACrD,CAAC,uCAAuC,sBAAsB;CAC9D,CAAC,+BAA+B,aAAa;CAC7C,CAAC,yBAAyB,UAAU;CACpC,CAAC,2BAA2B,WAAW;AACzC;AAEA,MAAM,0BAA0B,SAAiB,SAC/C,KAAK,QAAQ,QAAQ,QAAQ,SAAiC,MAAS;;;;AAKzE,MAAM,gBAAgB,SAAkB,YAAwB;C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D,IAAI,CAAC,cAAc,KAAK,CAAC,CAAC,IAAI;EAE9B,MAAM,EAAE,UAAU,2CAAM;EACxB,QAAQ,KAAK,MAAM,MAAM,QAAQ,KAAK,MAAM,CAAC,CAAC,CAAC;CACjD,CAAC;;;;;CAMD,QACG,QAAQ,MAAM,EAAE,QAAQ,KAAK,CAAC,CAAC,CAC/B,SAAS,gBAAgB,iCAAiC,CAAC,CAC3D,mBAAmB,CAAC,CACpB,OAAO,OAAO,SAAmB;EAChC,oCACE,iFACA,EAAE,OAAO,OAAO,CAClB;EACA,MAAM,EAAE,UAAU,2CAAM;EACxB,QAAQ,KAAK,MAAM,MAAM,IAAI,CAAC;CAChC,CAAC;CAKH,QAAQ,wBAAwB;CAIhC,QAAQ,MAAM,QAAQ,IAAI;CAE1B,OAAO;AACT"}
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
- let node_path = require("node:path");
4
3
  let _intlayer_engine_cli = require("@intlayer/engine/cli");
5
4
  let node_fs = require("node:fs");
5
+ let node_path = require("node:path");
6
6
  let _intlayer_config_colors = require("@intlayer/config/colors");
7
7
  _intlayer_config_colors = require_runtime.__toESM(_intlayer_config_colors);
8
8
  let _intlayer_config_logger = require("@intlayer/config/logger");
@@ -5,8 +5,8 @@ const require_utils_setupAI = require('../utils/setupAI.cjs');
5
5
  const require_fill_listTranslationsTasks = require('./listTranslationsTasks.cjs');
6
6
  const require_fill_translateDictionary = require('./translateDictionary.cjs');
7
7
  const require_fill_writeFill = require('./writeFill.cjs');
8
- let node_path = require("node:path");
9
8
  let _intlayer_engine_cli = require("@intlayer/engine/cli");
9
+ let node_path = require("node:path");
10
10
  let _intlayer_config_colors = require("@intlayer/config/colors");
11
11
  _intlayer_config_colors = require_runtime.__toESM(_intlayer_config_colors);
12
12
  let _intlayer_config_logger = require("@intlayer/config/logger");
@@ -18,6 +18,9 @@ let _intlayer_engine_build = require("@intlayer/engine/build");
18
18
  const NB_CONCURRENT_TRANSLATIONS = 7;
19
19
  /**
20
20
  * Fill translations based on the provided options.
21
+ *
22
+ * @returns What was done, so callers without a terminal (editor extension,
23
+ * MCP) can tell a completed run from one that translated nothing.
21
24
  */
22
25
  const fill = async (options) => {
23
26
  const configuration = (0, _intlayer_config_node.getConfiguration)(options?.configOptions);
@@ -30,13 +33,16 @@ const fill = async (options) => {
30
33
  const baseLocale = options?.sourceLocale ?? defaultLocale;
31
34
  const outputLocales = options?.outputLocales ? require_getTargetDictionary.ensureArray(options.outputLocales) : locales;
32
35
  const aiResult = await require_utils_setupAI.setupAI(configuration, options?.aiOptions);
33
- if (!aiResult?.hasAIAccess) return;
36
+ if (!aiResult?.hasAIAccess) return { status: "no-ai-access" };
34
37
  const { aiClient, aiConfig, isCustomAI } = aiResult;
35
38
  if (isCustomAI && aiClient && aiConfig) {
36
39
  const { hasAIAccess, error } = await aiClient.checkAISDKAccess(aiConfig);
37
40
  if (!hasAIAccess) {
38
41
  appLogger(`${_intlayer_config_logger.x} ${error}`);
39
- return;
42
+ return {
43
+ status: "no-ai-access",
44
+ error
45
+ };
40
46
  }
41
47
  }
42
48
  const targetUnmergedDictionaries = await require_getTargetDictionary.getTargetUnmergedDictionaries(options);
@@ -50,7 +56,7 @@ const fill = async (options) => {
50
56
  });
51
57
  const keysToProcess = Array.from(affectedDictionaryKeys);
52
58
  appLogger(["Affected dictionary keys for processing:", keysToProcess.length > 0 ? keysToProcess.map((key) => (0, _intlayer_config_logger.colorizeKey)(key)).join(", ") : (0, _intlayer_config_logger.colorize)("No keys found", _intlayer_config_colors.YELLOW)]);
53
- if (keysToProcess.length === 0) return;
59
+ if (keysToProcess.length === 0) return { status: "no-dictionaries" };
54
60
  /**
55
61
  * List the translations tasks
56
62
  *
@@ -63,6 +69,7 @@ const fill = async (options) => {
63
69
  const globalLimiter = (0, _intlayer_engine_utils.getGlobalLimiter)(nbConcurrentTranslations);
64
70
  const nbConcurrentTasks = Math.max(1, Math.min(options?.nbConcurrentTasks ?? nbConcurrentTranslations, translationTasks.length));
65
71
  const taskLimiter = (0, _intlayer_engine_utils.getTaskLimiter)(nbConcurrentTasks);
72
+ let writtenCount = 0;
66
73
  const runners = translationTasks.map((task) => taskLimiter(async () => {
67
74
  const relativePath = (0, node_path.relative)(configuration?.system?.baseDir ?? process.cwd(), task?.dictionaryFilePath ?? "");
68
75
  appLogger(`${task.dictionaryPreset} Processing ${(0, _intlayer_config_logger.colorizePath)((0, node_path.basename)(relativePath))}`, { level: "info" });
@@ -81,17 +88,26 @@ const fill = async (options) => {
81
88
  const hasDictionaryLevelFill = typeof dictFill === "string" || typeof dictFill === "function" || typeof dictFill === "object" && dictFill !== null;
82
89
  const isPerLocale = typeof dictionaryOutput.locale === "string";
83
90
  const effectiveFill = hasDictionaryLevelFill ? dictFill : isPerLocale ? configuration.dictionary?.fill ?? true : false;
84
- if (typeof effectiveFill === "string" || typeof effectiveFill === "function" || typeof effectiveFill === "object" && effectiveFill !== null) await require_fill_writeFill.writeFill({
85
- ...dictionaryOutput,
86
- fill: effectiveFill
87
- }, outputLocales, [sourceLocale], configuration);
88
- else {
91
+ if (typeof effectiveFill === "string" || typeof effectiveFill === "function" || typeof effectiveFill === "object" && effectiveFill !== null) {
92
+ await require_fill_writeFill.writeFill({
93
+ ...dictionaryOutput,
94
+ fill: effectiveFill
95
+ }, outputLocales, [sourceLocale], configuration);
96
+ writtenCount++;
97
+ } else {
89
98
  await (0, _intlayer_engine_build.writeContentDeclaration)(dictionaryOutput, configuration);
99
+ writtenCount++;
90
100
  if (dictionaryOutput.filePath) appLogger(`${task.dictionaryPreset} Content declaration written to ${(0, _intlayer_engine_utils.formatPath)((0, node_path.basename)(dictionaryOutput.filePath))}`, { level: "info" });
91
101
  }
92
102
  }));
93
103
  await Promise.all(runners);
94
104
  await globalLimiter.onIdle();
105
+ return {
106
+ status: "completed",
107
+ dictionaryKeys: keysToProcess,
108
+ taskCount: translationTasks.length,
109
+ writtenCount
110
+ };
95
111
  };
96
112
 
97
113
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"fill.cjs","names":["getConfiguration","getAppLogger","prepareIntlayer","ensureArray","setupAI","x","getTargetUnmergedDictionaries","loadContentDeclarations","join","colorizeKey","colorize","ANSIColors","listTranslationsTasks","getGlobalLimiter","getTaskLimiter","relative","colorizePath","basename","translateDictionary","writeFill","writeContentDeclaration","formatPath"],"sources":["../../../src/fill/fill.ts"],"sourcesContent":["import { basename, join, relative } from 'node:path';\nimport type { AIOptions } from '@intlayer/api';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport {\n colorize,\n colorizeKey,\n colorizePath,\n getAppLogger,\n x,\n} from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\nimport {\n loadContentDeclarations,\n prepareIntlayer,\n writeContentDeclaration,\n} from '@intlayer/engine/build';\nimport {\n type ListGitFilesOptions,\n logConfigDetails,\n} from '@intlayer/engine/cli';\nimport {\n formatPath,\n getGlobalLimiter,\n getTaskLimiter,\n} from '@intlayer/engine/utils';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport type { Fill } from '@intlayer/types/dictionary';\nimport {\n ensureArray,\n type GetTargetDictionaryOptions,\n getTargetUnmergedDictionaries,\n} from '../getTargetDictionary';\nimport { setupAI } from '../utils/setupAI';\nimport {\n listTranslationsTasks,\n type TranslationTask,\n} from './listTranslationsTasks';\nimport { translateDictionary } from './translateDictionary';\nimport { writeFill } from './writeFill';\n\nconst NB_CONCURRENT_TRANSLATIONS = 7;\n\n// Arguments for the fill function\nexport type FillOptions = {\n sourceLocale?: Locale;\n outputLocales?: Locale | Locale[];\n mode?: 'complete' | 'review';\n gitOptions?: ListGitFilesOptions;\n aiOptions?: AIOptions; // Added aiOptions to be passed to translateJSON\n verbose?: boolean;\n nbConcurrentTranslations?: number;\n nbConcurrentTasks?: number; // NEW: number of tasks that may run at once\n build?: boolean;\n skipMetadata?: boolean;\n} & GetTargetDictionaryOptions;\n\n/**\n * Fill translations based on the provided options.\n */\nexport const fill = async (options?: FillOptions): Promise<void> => {\n const configuration = getConfiguration(options?.configOptions);\n logConfigDetails(options?.configOptions);\n\n const appLogger = getAppLogger(configuration);\n\n if (options?.build === true) {\n await prepareIntlayer(configuration, { forceRun: true });\n } else if (typeof options?.build === 'undefined') {\n await prepareIntlayer(configuration);\n }\n\n const { defaultLocale, locales } = configuration.internationalization;\n const mode = options?.mode ?? 'complete';\n const baseLocale = options?.sourceLocale ?? defaultLocale;\n\n const outputLocales = options?.outputLocales\n ? ensureArray(options.outputLocales)\n : locales;\n\n const aiResult = await setupAI(configuration, options?.aiOptions);\n\n if (!aiResult?.hasAIAccess) return;\n\n const { aiClient, aiConfig, isCustomAI } = aiResult;\n\n if (isCustomAI && aiClient && aiConfig) {\n const { hasAIAccess, error } = await aiClient.checkAISDKAccess(aiConfig);\n if (!hasAIAccess) {\n appLogger(`${x} ${error}`);\n return;\n }\n }\n\n const targetUnmergedDictionaries =\n await getTargetUnmergedDictionaries(options);\n\n // Load the original source content declaration files to recover function-type\n // `fill` values that are lost when dictionaries are JSON-serialised into\n // unmerged_dictionaries.cjs. Dictionary-level fill takes priority over the\n // config-level fill, but we can only know that by reading the source files.\n const uniqueSourcePaths = [\n ...new Set(\n targetUnmergedDictionaries\n .filter((unmergedDictionary) =>\n ['local', 'hybrid'].includes(unmergedDictionary.location!)\n )\n .map((unmergedDictionary) => unmergedDictionary.filePath)\n .filter(Boolean) as string[]\n ),\n ];\n const sourceDictionaries = await loadContentDeclarations(\n uniqueSourcePaths.map((sourcePath) =>\n join(configuration.system.baseDir, sourcePath)\n ),\n configuration,\n undefined,\n {\n logError: false,\n }\n );\n // Map relative filePath → original fill value from the source file\n const originalFillByPath = new Map<string, Fill | undefined>();\n\n for (const dictionary of sourceDictionaries) {\n if (dictionary.filePath) {\n originalFillByPath.set(\n dictionary.filePath,\n dictionary.fill as Fill | undefined\n );\n }\n }\n\n const affectedDictionaryKeys = new Set<string>();\n\n targetUnmergedDictionaries.forEach((dict) => {\n affectedDictionaryKeys.add(dict.key);\n });\n\n const keysToProcess = Array.from(affectedDictionaryKeys);\n\n appLogger([\n 'Affected dictionary keys for processing:',\n keysToProcess.length > 0\n ? keysToProcess.map((key) => colorizeKey(key)).join(', ')\n : colorize('No keys found', ANSIColors.YELLOW),\n ]);\n\n if (keysToProcess.length === 0) return;\n\n /**\n * List the translations tasks\n *\n * Create a list of per-locale dictionaries to translate\n *\n * In 'complete' mode, filter only the missing locales to translate\n */\n const translationTasks: TranslationTask[] = listTranslationsTasks(\n targetUnmergedDictionaries.map((dictionary) => dictionary.localId!),\n outputLocales,\n mode,\n baseLocale,\n configuration\n );\n\n // AI calls in flight at once (translateJSON + metadata audit)\n const nbConcurrentTranslations =\n options?.nbConcurrentTranslations ?? NB_CONCURRENT_TRANSLATIONS;\n const globalLimiter = getGlobalLimiter(nbConcurrentTranslations);\n\n // NEW: number of *tasks* that may run at once (start/prepare/log/write)\n const nbConcurrentTasks = Math.max(\n 1,\n Math.min(\n options?.nbConcurrentTasks ?? nbConcurrentTranslations,\n translationTasks.length\n )\n );\n\n const taskLimiter = getTaskLimiter(nbConcurrentTasks);\n\n const runners = translationTasks.map((task) =>\n taskLimiter(async () => {\n const relativePath = relative(\n configuration?.system?.baseDir ?? process.cwd(),\n task?.dictionaryFilePath ?? ''\n );\n\n // log AFTER acquiring a task slot\n appLogger(\n `${task.dictionaryPreset} Processing ${colorizePath(basename(relativePath))}`,\n { level: 'info' }\n );\n\n const translationTaskResult = await translateDictionary(\n task,\n configuration,\n {\n mode,\n aiOptions: options?.aiOptions,\n fillMetadata: !options?.skipMetadata,\n onHandle: globalLimiter,\n aiClient,\n aiConfig,\n }\n );\n\n if (!translationTaskResult?.dictionaryOutput) return;\n\n const { dictionaryOutput, sourceLocale } = translationTaskResult;\n\n // Determine if we should write to separate files\n // - If dictionary has explicit fill setting (string, function, or object), use it\n // - If dictionary is per-locale AND has no explicit fill=false, use global fill config\n // - If dictionary is multilingual (no locale property), always write to same file\n //\n // NOTE: function-type fill values are lost during JSON serialisation of\n // unmerged_dictionaries.cjs. We recover them by checking the original\n // source file that was loaded above (originalFillByPath). Dictionary-level\n // fill always takes priority over config-level fill.\n const originalFill = originalFillByPath.get(\n dictionaryOutput.filePath ?? ''\n );\n\n // originalFill is undefined when the source file had no fill property; use\n // the (possibly JSON-preserved) dictionaryOutput.fill as a fallback so that\n // string/boolean fill values set directly on the dict still work.\n const dictFill: Fill | undefined =\n originalFill !== undefined ? originalFill : dictionaryOutput.fill;\n\n const hasDictionaryLevelFill =\n typeof dictFill === 'string' ||\n typeof dictFill === 'function' ||\n (typeof dictFill === 'object' && dictFill !== null);\n\n const isPerLocale = typeof dictionaryOutput.locale === 'string';\n\n const effectiveFill = hasDictionaryLevelFill\n ? dictFill\n : isPerLocale\n ? (configuration.dictionary?.fill ?? true)\n : false; // Multilingual dictionaries (no locale property) always write to same file unless explicitly set on the dictionary\n\n const isFillOtherFile =\n typeof effectiveFill === 'string' ||\n typeof effectiveFill === 'function' ||\n (typeof effectiveFill === 'object' && effectiveFill !== null);\n\n if (isFillOtherFile) {\n await writeFill(\n {\n ...dictionaryOutput,\n // Ensure fill is set on the dictionary for writeFill to use\n fill: effectiveFill,\n },\n outputLocales,\n [sourceLocale],\n configuration\n );\n } else {\n await writeContentDeclaration(dictionaryOutput, configuration);\n\n if (dictionaryOutput.filePath) {\n appLogger(\n `${task.dictionaryPreset} Content declaration written to ${formatPath(basename(dictionaryOutput.filePath))}`,\n { level: 'info' }\n );\n }\n }\n })\n );\n\n await Promise.all(runners);\n await (globalLimiter as any).onIdle();\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAwCA,MAAM,6BAA6B;;;;AAmBnC,MAAa,OAAO,OAAO,YAAyC;CAClE,MAAM,oBAAgBA,wCAAiB,SAAS,aAAa;CAC7D,2CAAiB,SAAS,aAAa;CAEvC,MAAM,gBAAYC,sCAAa,aAAa;CAE5C,IAAI,SAAS,UAAU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AkB,YAAY,kBAAkB,MAGxD,MAAMC,iCACJ;GACE,GAAG;GAEH,MAAM;EACR,GACA,eACA,CAAC,YAAY,GACb,aACF;OACK;GACL,UAAMC,gDAAwB,kBAAkB,aAAa;GAE7D,IAAI,iBAAiB,UACnB,UACE,GAAG,KAAK,iBAAiB,sCAAkCC,uCAAWJ,oBAAS,iBAAiB,QAAQ,CAAC,KACzG,EAAE,OAAO,OAAO,CAClB;EAEJ;CACF,CAAC,CACH;CAEA,MAAM,QAAQ,IAAI,OAAO;CACzB,MAAO,cAAsB,OAAO;AACtC"}
1
+ {"version":3,"file":"fill.cjs","names":["getConfiguration","getAppLogger","prepareIntlayer","ensureArray","setupAI","x","getTargetUnmergedDictionaries","loadContentDeclarations","join","colorizeKey","colorize","ANSIColors","listTranslationsTasks","getGlobalLimiter","getTaskLimiter","relative","colorizePath","basename","translateDictionary","writeFill","writeContentDeclaration","formatPath"],"sources":["../../../src/fill/fill.ts"],"sourcesContent":["import { basename, join, relative } from 'node:path';\nimport type { AIOptions } from '@intlayer/api';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport {\n colorize,\n colorizeKey,\n colorizePath,\n getAppLogger,\n x,\n} from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\nimport {\n loadContentDeclarations,\n prepareIntlayer,\n writeContentDeclaration,\n} from '@intlayer/engine/build';\nimport {\n type ListGitFilesOptions,\n logConfigDetails,\n} from '@intlayer/engine/cli';\nimport {\n formatPath,\n getGlobalLimiter,\n getTaskLimiter,\n} from '@intlayer/engine/utils';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport type { Fill } from '@intlayer/types/dictionary';\nimport {\n ensureArray,\n type GetTargetDictionaryOptions,\n getTargetUnmergedDictionaries,\n} from '../getTargetDictionary';\nimport { setupAI } from '../utils/setupAI';\nimport {\n listTranslationsTasks,\n type TranslationTask,\n} from './listTranslationsTasks';\nimport { translateDictionary } from './translateDictionary';\nimport { writeFill } from './writeFill';\n\nconst NB_CONCURRENT_TRANSLATIONS = 7;\n\n// Arguments for the fill function\nexport type FillOptions = {\n sourceLocale?: Locale;\n outputLocales?: Locale | Locale[];\n mode?: 'complete' | 'review';\n gitOptions?: ListGitFilesOptions;\n aiOptions?: AIOptions; // Added aiOptions to be passed to translateJSON\n verbose?: boolean;\n nbConcurrentTranslations?: number;\n nbConcurrentTasks?: number; // NEW: number of tasks that may run at once\n build?: boolean;\n skipMetadata?: boolean;\n} & GetTargetDictionaryOptions;\n\n/** Outcome of a {@link fill} run. */\nexport type FillResult =\n | {\n /** No AI provider is reachable: nothing was translated. */\n status: 'no-ai-access';\n /** Why the AI provider could not be used, when known. */\n error?: string;\n }\n | {\n /** No dictionary matched the filters: nothing was translated. */\n status: 'no-dictionaries';\n }\n | {\n status: 'completed';\n /** Keys of the dictionaries processed. */\n dictionaryKeys: string[];\n /** Translation tasks (one per dictionary and locale set) run. */\n taskCount: number;\n /** Tasks whose translation was written. */\n writtenCount: number;\n };\n\n/**\n * Fill translations based on the provided options.\n *\n * @returns What was done, so callers without a terminal (editor extension,\n * MCP) can tell a completed run from one that translated nothing.\n */\nexport const fill = async (options?: FillOptions): Promise<FillResult> => {\n const configuration = getConfiguration(options?.configOptions);\n logConfigDetails(options?.configOptions);\n\n const appLogger = getAppLogger(configuration);\n\n if (options?.build === true) {\n await prepareIntlayer(configuration, { forceRun: true });\n } else if (typeof options?.build === 'undefined') {\n await prepareIntlayer(configuration);\n }\n\n const { defaultLocale, locales } = configuration.internationalization;\n const mode = options?.mode ?? 'complete';\n const baseLocale = options?.sourceLocale ?? defaultLocale;\n\n const outputLocales = options?.outputLocales\n ? ensureArray(options.outputLocales)\n : locales;\n\n const aiResult = await setupAI(configuration, options?.aiOptions);\n\n if (!aiResult?.hasAIAccess) return { status: 'no-ai-access' };\n\n const { aiClient, aiConfig, isCustomAI } = aiResult;\n\n if (isCustomAI && aiClient && aiConfig) {\n const { hasAIAccess, error } = await aiClient.checkAISDKAccess(aiConfig);\n if (!hasAIAccess) {\n appLogger(`${x} ${error}`);\n return { status: 'no-ai-access', error };\n }\n }\n\n const targetUnmergedDictionaries =\n await getTargetUnmergedDictionaries(options);\n\n // Load the original source content declaration files to recover function-type\n // `fill` values that are lost when dictionaries are JSON-serialised into\n // unmerged_dictionaries.cjs. Dictionary-level fill takes priority over the\n // config-level fill, but we can only know that by reading the source files.\n const uniqueSourcePaths = [\n ...new Set(\n targetUnmergedDictionaries\n .filter((unmergedDictionary) =>\n ['local', 'hybrid'].includes(unmergedDictionary.location!)\n )\n .map((unmergedDictionary) => unmergedDictionary.filePath)\n .filter(Boolean) as string[]\n ),\n ];\n const sourceDictionaries = await loadContentDeclarations(\n uniqueSourcePaths.map((sourcePath) =>\n join(configuration.system.baseDir, sourcePath)\n ),\n configuration,\n undefined,\n {\n logError: false,\n }\n );\n // Map relative filePath → original fill value from the source file\n const originalFillByPath = new Map<string, Fill | undefined>();\n\n for (const dictionary of sourceDictionaries) {\n if (dictionary.filePath) {\n originalFillByPath.set(\n dictionary.filePath,\n dictionary.fill as Fill | undefined\n );\n }\n }\n\n const affectedDictionaryKeys = new Set<string>();\n\n targetUnmergedDictionaries.forEach((dict) => {\n affectedDictionaryKeys.add(dict.key);\n });\n\n const keysToProcess = Array.from(affectedDictionaryKeys);\n\n appLogger([\n 'Affected dictionary keys for processing:',\n keysToProcess.length > 0\n ? keysToProcess.map((key) => colorizeKey(key)).join(', ')\n : colorize('No keys found', ANSIColors.YELLOW),\n ]);\n\n if (keysToProcess.length === 0) return { status: 'no-dictionaries' };\n\n /**\n * List the translations tasks\n *\n * Create a list of per-locale dictionaries to translate\n *\n * In 'complete' mode, filter only the missing locales to translate\n */\n const translationTasks: TranslationTask[] = listTranslationsTasks(\n targetUnmergedDictionaries.map((dictionary) => dictionary.localId!),\n outputLocales,\n mode,\n baseLocale,\n configuration\n );\n\n // AI calls in flight at once (translateJSON + metadata audit)\n const nbConcurrentTranslations =\n options?.nbConcurrentTranslations ?? NB_CONCURRENT_TRANSLATIONS;\n const globalLimiter = getGlobalLimiter(nbConcurrentTranslations);\n\n // NEW: number of *tasks* that may run at once (start/prepare/log/write)\n const nbConcurrentTasks = Math.max(\n 1,\n Math.min(\n options?.nbConcurrentTasks ?? nbConcurrentTranslations,\n translationTasks.length\n )\n );\n\n const taskLimiter = getTaskLimiter(nbConcurrentTasks);\n\n let writtenCount = 0;\n\n const runners = translationTasks.map((task) =>\n taskLimiter(async () => {\n const relativePath = relative(\n configuration?.system?.baseDir ?? process.cwd(),\n task?.dictionaryFilePath ?? ''\n );\n\n // log AFTER acquiring a task slot\n appLogger(\n `${task.dictionaryPreset} Processing ${colorizePath(basename(relativePath))}`,\n { level: 'info' }\n );\n\n const translationTaskResult = await translateDictionary(\n task,\n configuration,\n {\n mode,\n aiOptions: options?.aiOptions,\n fillMetadata: !options?.skipMetadata,\n onHandle: globalLimiter,\n aiClient,\n aiConfig,\n }\n );\n\n if (!translationTaskResult?.dictionaryOutput) return;\n\n const { dictionaryOutput, sourceLocale } = translationTaskResult;\n\n // Determine if we should write to separate files\n // - If dictionary has explicit fill setting (string, function, or object), use it\n // - If dictionary is per-locale AND has no explicit fill=false, use global fill config\n // - If dictionary is multilingual (no locale property), always write to same file\n //\n // NOTE: function-type fill values are lost during JSON serialisation of\n // unmerged_dictionaries.cjs. We recover them by checking the original\n // source file that was loaded above (originalFillByPath). Dictionary-level\n // fill always takes priority over config-level fill.\n const originalFill = originalFillByPath.get(\n dictionaryOutput.filePath ?? ''\n );\n\n // originalFill is undefined when the source file had no fill property; use\n // the (possibly JSON-preserved) dictionaryOutput.fill as a fallback so that\n // string/boolean fill values set directly on the dict still work.\n const dictFill: Fill | undefined =\n originalFill !== undefined ? originalFill : dictionaryOutput.fill;\n\n const hasDictionaryLevelFill =\n typeof dictFill === 'string' ||\n typeof dictFill === 'function' ||\n (typeof dictFill === 'object' && dictFill !== null);\n\n const isPerLocale = typeof dictionaryOutput.locale === 'string';\n\n const effectiveFill = hasDictionaryLevelFill\n ? dictFill\n : isPerLocale\n ? (configuration.dictionary?.fill ?? true)\n : false; // Multilingual dictionaries (no locale property) always write to same file unless explicitly set on the dictionary\n\n const isFillOtherFile =\n typeof effectiveFill === 'string' ||\n typeof effectiveFill === 'function' ||\n (typeof effectiveFill === 'object' && effectiveFill !== null);\n\n if (isFillOtherFile) {\n await writeFill(\n {\n ...dictionaryOutput,\n // Ensure fill is set on the dictionary for writeFill to use\n fill: effectiveFill,\n },\n outputLocales,\n [sourceLocale],\n configuration\n );\n writtenCount++;\n } else {\n await writeContentDeclaration(dictionaryOutput, configuration);\n writtenCount++;\n\n if (dictionaryOutput.filePath) {\n appLogger(\n `${task.dictionaryPreset} Content declaration written to ${formatPath(basename(dictionaryOutput.filePath))}`,\n { level: 'info' }\n );\n }\n }\n })\n );\n\n await Promise.all(runners);\n await (globalLimiter as any).onIdle();\n\n return {\n status: 'completed',\n dictionaryKeys: keysToProcess,\n taskCount: translationTasks.length,\n writtenCount,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAwCA,MAAM,6BAA6B;;;;;;;AA4CnC,MAAa,OAAO,OAAO,YAA+C;CACxE,MAAM,oBAAgBA,wCAAiB,SAAS,aAAa;CAC7D,2CAAiB,SAAS,aAAa;CAEvC,MAAM,gBAAYC,sCAAa,aAAa;CAE5C,IAAI,SAAS,UAAU,MACrB,UAAMC,wCAAgB,eAAe,EAAE,UAAU,KAAK,CAAC;MAClD,IAAI,OAAO,SAAS,UAAU,aACnC,UAAMA,wCAAgB,aAAa;CAGrC,MAAM,EAAE,eAAe,YAAY,cAAc;CACjD,MAAM,OAAO,SAAS,QAAQ;CAC9B,MAAM,aAAa,SAAS,gBAAgB;CAE5C,MAAM,gBAAgB,SAAS,gBAC3BC,wCAAY,QAAQ,aAAa,IACjC;CAEJ,MAAM,WAAW,MAAMC,8BAAQ,eAAe,SAAS,SAAS;CAEhE,IAAI,CAAC,UAAU,aAAa,OAAO,EAAE,QAAQ,eAAe;CAE5D,MAAM,EAAE,UAAU,U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