@intlayer/cli 9.0.0-canary.11 → 9.0.0-canary.13

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 (167) hide show
  1. package/dist/cjs/auth/login.cjs +2 -2
  2. package/dist/cjs/auth/login.cjs.map +1 -1
  3. package/dist/cjs/build.cjs +6 -6
  4. package/dist/cjs/build.cjs.map +1 -1
  5. package/dist/cjs/ci.cjs +2 -2
  6. package/dist/cjs/ci.cjs.map +1 -1
  7. package/dist/cjs/cli.cjs.map +1 -1
  8. package/dist/cjs/config.cjs +2 -2
  9. package/dist/cjs/config.cjs.map +1 -1
  10. package/dist/cjs/extract.cjs +7 -7
  11. package/dist/cjs/extract.cjs.map +1 -1
  12. package/dist/cjs/fill/fill.cjs +11 -11
  13. package/dist/cjs/fill/fill.cjs.map +1 -1
  14. package/dist/cjs/fill/formatAutoFilledFilePath.cjs +2 -2
  15. package/dist/cjs/fill/formatAutoFilledFilePath.cjs.map +1 -1
  16. package/dist/cjs/fill/formatFillData.cjs +3 -3
  17. package/dist/cjs/fill/formatFillData.cjs.map +1 -1
  18. package/dist/cjs/fill/listTranslationsTasks.cjs +2 -2
  19. package/dist/cjs/fill/listTranslationsTasks.cjs.map +1 -1
  20. package/dist/cjs/fill/translateDictionary.cjs +7 -7
  21. package/dist/cjs/fill/translateDictionary.cjs.map +1 -1
  22. package/dist/cjs/fill/writeFill.cjs +5 -5
  23. package/dist/cjs/fill/writeFill.cjs.map +1 -1
  24. package/dist/cjs/getTargetDictionary.cjs +2 -2
  25. package/dist/cjs/getTargetDictionary.cjs.map +1 -1
  26. package/dist/cjs/init.cjs +41 -5
  27. package/dist/cjs/init.cjs.map +1 -1
  28. package/dist/cjs/initBuildOptimization.cjs +6 -6
  29. package/dist/cjs/initBuildOptimization.cjs.map +1 -1
  30. package/dist/cjs/initCompiler.cjs +3 -3
  31. package/dist/cjs/initCompiler.cjs.map +1 -1
  32. package/dist/cjs/initMCP.cjs +3 -3
  33. package/dist/cjs/initMCP.cjs.map +1 -1
  34. package/dist/cjs/initSkills.cjs +11 -11
  35. package/dist/cjs/initSkills.cjs.map +1 -1
  36. package/dist/cjs/listContentDeclaration.cjs +4 -4
  37. package/dist/cjs/listContentDeclaration.cjs.map +1 -1
  38. package/dist/cjs/listProjects.cjs +2 -2
  39. package/dist/cjs/listProjects.cjs.map +1 -1
  40. package/dist/cjs/liveSync.cjs +4 -4
  41. package/dist/cjs/liveSync.cjs.map +1 -1
  42. package/dist/cjs/pull.cjs +6 -6
  43. package/dist/cjs/pull.cjs.map +1 -1
  44. package/dist/cjs/push/pullLog.cjs.map +1 -1
  45. package/dist/cjs/push/push.cjs +13 -13
  46. package/dist/cjs/push/push.cjs.map +1 -1
  47. package/dist/cjs/pushConfig.cjs +2 -2
  48. package/dist/cjs/pushConfig.cjs.map +1 -1
  49. package/dist/cjs/reviewDoc/reviewDoc.cjs +16 -16
  50. package/dist/cjs/reviewDoc/reviewDoc.cjs.map +1 -1
  51. package/dist/cjs/reviewDoc/reviewDocBlockAware.cjs +11 -11
  52. package/dist/cjs/reviewDoc/reviewDocBlockAware.cjs.map +1 -1
  53. package/dist/cjs/reviewDoc/reviewDocLog.cjs +7 -7
  54. package/dist/cjs/reviewDoc/reviewDocLog.cjs.map +1 -1
  55. package/dist/cjs/scan.cjs +5 -5
  56. package/dist/cjs/scan.cjs.map +1 -1
  57. package/dist/cjs/searchDoc.cjs +2 -2
  58. package/dist/cjs/searchDoc.cjs.map +1 -1
  59. package/dist/cjs/test/listMissingTranslations.cjs +2 -2
  60. package/dist/cjs/test/listMissingTranslations.cjs.map +1 -1
  61. package/dist/cjs/test/test.cjs +11 -11
  62. package/dist/cjs/test/test.cjs.map +1 -1
  63. package/dist/cjs/translateDoc/translateDoc.cjs +6 -6
  64. package/dist/cjs/translateDoc/translateDoc.cjs.map +1 -1
  65. package/dist/cjs/translateDoc/translateFile.cjs +5 -5
  66. package/dist/cjs/translateDoc/translateFile.cjs.map +1 -1
  67. package/dist/cjs/utils/calculateChunks.cjs +4 -4
  68. package/dist/cjs/utils/calculateChunks.cjs.map +1 -1
  69. package/dist/cjs/utils/getOutputFilePath.cjs +2 -2
  70. package/dist/cjs/utils/getOutputFilePath.cjs.map +1 -1
  71. package/dist/cjs/utils/mapChunksBetweenFiles.cjs +4 -4
  72. package/dist/cjs/utils/mapChunksBetweenFiles.cjs.map +1 -1
  73. package/dist/cjs/watch.cjs +6 -6
  74. package/dist/cjs/watch.cjs.map +1 -1
  75. package/dist/esm/auth/login.mjs +1 -1
  76. package/dist/esm/auth/login.mjs.map +1 -1
  77. package/dist/esm/build.mjs +3 -3
  78. package/dist/esm/build.mjs.map +1 -1
  79. package/dist/esm/ci.mjs +1 -1
  80. package/dist/esm/ci.mjs.map +1 -1
  81. package/dist/esm/cli.mjs.map +1 -1
  82. package/dist/esm/config.mjs +1 -1
  83. package/dist/esm/config.mjs.map +1 -1
  84. package/dist/esm/extract.mjs +3 -3
  85. package/dist/esm/extract.mjs.map +1 -1
  86. package/dist/esm/fill/fill.mjs +3 -3
  87. package/dist/esm/fill/fill.mjs.map +1 -1
  88. package/dist/esm/fill/formatAutoFilledFilePath.mjs +1 -1
  89. package/dist/esm/fill/formatAutoFilledFilePath.mjs.map +1 -1
  90. package/dist/esm/fill/formatFillData.mjs +1 -1
  91. package/dist/esm/fill/formatFillData.mjs.map +1 -1
  92. package/dist/esm/fill/listTranslationsTasks.mjs +1 -1
  93. package/dist/esm/fill/listTranslationsTasks.mjs.map +1 -1
  94. package/dist/esm/fill/translateDictionary.mjs +1 -1
  95. package/dist/esm/fill/translateDictionary.mjs.map +1 -1
  96. package/dist/esm/fill/writeFill.mjs +2 -2
  97. package/dist/esm/fill/writeFill.mjs.map +1 -1
  98. package/dist/esm/getTargetDictionary.mjs +1 -1
  99. package/dist/esm/getTargetDictionary.mjs.map +1 -1
  100. package/dist/esm/init.mjs +37 -1
  101. package/dist/esm/init.mjs.map +1 -1
  102. package/dist/esm/initBuildOptimization.mjs +1 -1
  103. package/dist/esm/initBuildOptimization.mjs.map +1 -1
  104. package/dist/esm/initCompiler.mjs +1 -1
  105. package/dist/esm/initCompiler.mjs.map +1 -1
  106. package/dist/esm/initMCP.mjs +1 -1
  107. package/dist/esm/initMCP.mjs.map +1 -1
  108. package/dist/esm/initSkills.mjs +1 -1
  109. package/dist/esm/initSkills.mjs.map +1 -1
  110. package/dist/esm/listContentDeclaration.mjs +2 -2
  111. package/dist/esm/listContentDeclaration.mjs.map +1 -1
  112. package/dist/esm/listProjects.mjs +1 -1
  113. package/dist/esm/listProjects.mjs.map +1 -1
  114. package/dist/esm/liveSync.mjs +2 -2
  115. package/dist/esm/liveSync.mjs.map +1 -1
  116. package/dist/esm/pull.mjs +3 -3
  117. package/dist/esm/pull.mjs.map +1 -1
  118. package/dist/esm/push/pullLog.mjs.map +1 -1
  119. package/dist/esm/push/push.mjs +3 -3
  120. package/dist/esm/push/push.mjs.map +1 -1
  121. package/dist/esm/pushConfig.mjs +1 -1
  122. package/dist/esm/pushConfig.mjs.map +1 -1
  123. package/dist/esm/reviewDoc/reviewDoc.mjs +3 -3
  124. package/dist/esm/reviewDoc/reviewDoc.mjs.map +1 -1
  125. package/dist/esm/reviewDoc/reviewDocBlockAware.mjs +2 -2
  126. package/dist/esm/reviewDoc/reviewDocBlockAware.mjs.map +1 -1
  127. package/dist/esm/reviewDoc/reviewDocLog.mjs +2 -2
  128. package/dist/esm/reviewDoc/reviewDocLog.mjs.map +1 -1
  129. package/dist/esm/scan.mjs +1 -1
  130. package/dist/esm/scan.mjs.map +1 -1
  131. package/dist/esm/searchDoc.mjs +1 -1
  132. package/dist/esm/searchDoc.mjs.map +1 -1
  133. package/dist/esm/test/listMissingTranslations.mjs +1 -1
  134. package/dist/esm/test/listMissingTranslations.mjs.map +1 -1
  135. package/dist/esm/test/test.mjs +2 -2
  136. package/dist/esm/test/test.mjs.map +1 -1
  137. package/dist/esm/translateDoc/translateDoc.mjs +2 -2
  138. package/dist/esm/translateDoc/translateDoc.mjs.map +1 -1
  139. package/dist/esm/translateDoc/translateFile.mjs +1 -1
  140. package/dist/esm/translateDoc/translateFile.mjs.map +1 -1
  141. package/dist/esm/utils/calculateChunks.mjs +1 -1
  142. package/dist/esm/utils/calculateChunks.mjs.map +1 -1
  143. package/dist/esm/utils/getOutputFilePath.mjs +1 -1
  144. package/dist/esm/utils/getOutputFilePath.mjs.map +1 -1
  145. package/dist/esm/utils/mapChunksBetweenFiles.mjs +1 -1
  146. package/dist/esm/utils/mapChunksBetweenFiles.mjs.map +1 -1
  147. package/dist/esm/watch.mjs +3 -3
  148. package/dist/esm/watch.mjs.map +1 -1
  149. package/dist/types/fill/fill.d.ts +1 -1
  150. package/dist/types/fill/translateDictionary.d.ts +2 -2
  151. package/dist/types/fill/translateDictionary.d.ts.map +1 -1
  152. package/dist/types/getTargetDictionary.d.ts +1 -1
  153. package/dist/types/index.d.ts +4 -4
  154. package/dist/types/init.d.ts +1 -1
  155. package/dist/types/init.d.ts.map +1 -1
  156. package/dist/types/initMCP.d.ts +1 -1
  157. package/dist/types/initSkills.d.ts +1 -1
  158. package/dist/types/listProjects.d.ts +1 -1
  159. package/dist/types/push/pullLog.d.ts +1 -1
  160. package/dist/types/push/push.d.ts +1 -1
  161. package/dist/types/reviewDoc/reviewDoc.d.ts +1 -1
  162. package/dist/types/reviewDoc/reviewDoc.d.ts.map +1 -1
  163. package/dist/types/reviewDoc/reviewDocLog.d.ts +1 -1
  164. package/dist/types/scan.d.ts.map +1 -1
  165. package/dist/types/translateDoc/translateDoc.d.ts.map +1 -1
  166. package/dist/types/translateDoc/types.d.ts +1 -1
  167. package/package.json +13 -13
package/dist/cjs/init.cjs CHANGED
@@ -7,7 +7,7 @@ const require_initSkills = require('./initSkills.cjs');
7
7
  const require_initMCP = require('./initMCP.cjs');
8
8
  let node_fs = require("node:fs");
9
9
  let node_path = require("node:path");
10
- let _intlayer_chokidar_cli = require("@intlayer/chokidar/cli");
10
+ let _intlayer_engine_cli = require("@intlayer/engine/cli");
11
11
  let enquirer = require("enquirer");
12
12
  enquirer = require_runtime.__toESM(enquirer);
13
13
  let _clack_prompts = require("@clack/prompts");
@@ -82,6 +82,28 @@ const ROUTING_MODE_OPTIONS = [
82
82
  hint: "/about?locale=fr"
83
83
  }
84
84
  ];
85
+ /**
86
+ * Content organization strategies offered by the interactive init flow.
87
+ * Drives the `compiler.output` template (autogenerated content: compiler /
88
+ * autofill / extract) or the injection of the syncJSON plugin.
89
+ */
90
+ const CONTENT_STRATEGY_OPTIONS = [
91
+ {
92
+ value: "per-component",
93
+ label: "Per component (default)",
94
+ hint: "multilingual .content files co-located with the components"
95
+ },
96
+ {
97
+ value: "centralized",
98
+ label: "Centralized folder",
99
+ hint: "per-locale JSON dictionaries under /locales/{locale}/{key}.content.json"
100
+ },
101
+ {
102
+ value: "json-namespaces",
103
+ label: "JSON namespaces",
104
+ hint: "plain /locales/{locale}/{namespace}.json files synced via @intlayer/sync-json-plugin"
105
+ }
106
+ ];
85
107
  const COMPAT_LIB_OPTIONS = [
86
108
  {
87
109
  value: "i18next",
@@ -284,10 +306,24 @@ const runInteractiveInit = async (root, baseOptions) => {
284
306
  } else if (hasLinguiJson && !hasLinguiPo) hintDependencies["__lingui_json__"] = "*";
285
307
  }
286
308
  }
287
- await (0, _intlayer_chokidar_cli.initIntlayer)(root, {
309
+ let contentStrategy;
310
+ if (!hasCompatLib && !hintDependencies) {
311
+ const selectedContentStrategy = await _clack_prompts.select({
312
+ message: "How do you want to organize your translated content?",
313
+ options: CONTENT_STRATEGY_OPTIONS,
314
+ initialValue: "per-component"
315
+ });
316
+ if (_clack_prompts.isCancel(selectedContentStrategy)) {
317
+ _clack_prompts.cancel("Operation cancelled.");
318
+ return;
319
+ }
320
+ contentStrategy = selectedContentStrategy;
321
+ }
322
+ await (0, _intlayer_engine_cli.initIntlayer)(root, {
288
323
  ...baseOptions,
289
324
  routingMode,
290
325
  hintDependencies,
326
+ contentStrategy,
291
327
  noInstallPackages: !steps.includes("packages"),
292
328
  noGitignore: baseOptions?.noGitignore,
293
329
  noGithubActions: baseOptions?.noGithubActions || !steps.includes("githubActions"),
@@ -305,7 +341,7 @@ const runInteractiveInit = async (root, baseOptions) => {
305
341
  name: "platforms",
306
342
  message: "Which platform are you using? (Type to search)",
307
343
  multiple: false,
308
- initial: detectedPlatform ? _intlayer_chokidar_cli.PLATFORMS.indexOf(detectedPlatform) : void 0,
344
+ initial: detectedPlatform ? _intlayer_engine_cli.PLATFORMS.indexOf(detectedPlatform) : void 0,
309
345
  choices: require_initSkills.PLATFORM_OPTIONS.map((opt) => ({
310
346
  name: opt.value,
311
347
  message: opt.label,
@@ -333,7 +369,7 @@ const runInteractiveInit = async (root, baseOptions) => {
333
369
  _clack_prompts.log.info("Opening your browser to log in to the Intlayer CMS...");
334
370
  await require_auth_login.login({
335
371
  exitAfter: false,
336
- onCredentials: (credentials) => (0, _intlayer_chokidar_cli.setupCmsCredentials)(root, credentials)
372
+ onCredentials: (credentials) => (0, _intlayer_engine_cli.setupCmsCredentials)(root, credentials)
337
373
  });
338
374
  }
339
375
  _clack_prompts.outro("Intlayer initialization complete");
@@ -344,7 +380,7 @@ const init = async (projectRoot, options, interactive) => {
344
380
  await runInteractiveInit(root, options);
345
381
  return;
346
382
  }
347
- await (0, _intlayer_chokidar_cli.initIntlayer)(root, options);
383
+ await (0, _intlayer_engine_cli.initIntlayer)(root, options);
348
384
  };
349
385
 
350
386
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"init.cjs","names":["p","getDetectedPlatform","PLATFORMS","PLATFORM_OPTIONS","initSkills","initMCP","initCompiler","initBuildOptimization","login"],"sources":["../../src/init.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\nimport * as p from '@clack/prompts';\nimport {\n type InitOptions,\n initIntlayer,\n PLATFORMS,\n type Platform,\n type RoutingMode,\n setupCmsCredentials,\n} from '@intlayer/chokidar/cli';\nimport enquirer from 'enquirer';\nimport { login } from './auth/login';\nimport { initBuildOptimization } from './initBuildOptimization';\nimport { initCompiler } from './initCompiler';\nimport { initMCP } from './initMCP';\nimport {\n getDetectedPlatform,\n initSkills,\n PLATFORM_OPTIONS,\n} from './initSkills';\n\nexport const findProjectRoot = (startDir: string) => {\n let currentDir = startDir;\n\n while (currentDir !== resolve(currentDir, '..')) {\n if (existsSync(join(currentDir, 'package.json'))) {\n return currentDir;\n }\n currentDir = resolve(currentDir, '..');\n }\n\n // If no package.json is found, return the start directory.\n // The initIntlayer function will handle the missing package.json error.\n return startDir;\n};\n\n/** Individually selectable setup steps exposed by the interactive init flow. */\ntype InitStep =\n | 'packages'\n | 'githubActions'\n | 'frameworkSetup'\n | 'vscodeExtension'\n | 'lsp'\n | 'skills'\n | 'mcp'\n | 'compiler'\n | 'buildOptimization';\n\nconst BASE_INIT_STEP_OPTIONS: Array<{\n value: InitStep;\n label: string;\n hint: string;\n}> = [\n {\n value: 'packages',\n label: 'Install & upgrade packages',\n hint: 'install missing Intlayer dependencies and upgrade outdated ones',\n },\n {\n value: 'githubActions',\n label: 'CI/CD (GitHub Actions)',\n hint: 'scaffold the fill and test workflows that run on every pull request',\n },\n {\n value: 'frameworkSetup',\n label: 'Framework setup',\n hint: 'middleware/proxy and providers in layout/page',\n },\n {\n value: 'vscodeExtension',\n label: 'VS Code extension',\n hint: 'recommend the Intlayer extension',\n },\n {\n value: 'lsp',\n label: 'Editor LSP',\n hint: 'go-to-definition from keys to .content files',\n },\n {\n value: 'skills',\n label: 'AI skills',\n hint: 'install the Intlayer documentation as agent skills',\n },\n {\n value: 'mcp',\n label: 'MCP server',\n hint: 'configure the Intlayer MCP server',\n },\n];\n\n/** Locale routing strategies offered by the interactive init flow. */\nconst ROUTING_MODE_OPTIONS: Array<{\n value: RoutingMode;\n label: string;\n hint: string;\n}> = [\n {\n value: 'prefix-no-default',\n label: 'Prefix all except the default locale',\n hint: '/about, /fr/about (default)',\n },\n {\n value: 'prefix-all',\n label: 'Prefix all locales',\n hint: '/en/about, /fr/about',\n },\n {\n value: 'no-prefix',\n label: 'No locale in the URL',\n hint: '/about',\n },\n {\n value: 'search-params',\n label: 'Use a search parameter',\n hint: '/about?locale=fr',\n },\n];\n\n/**\n * Compat i18n library options surfaced in the interactive init prompt.\n * The `packages` field lists the package names to inject as hint-deps so\n * `detectMissingIntlayerPackages` detects the right sync plugin even before\n * those libraries are installed.\n */\ntype CompatLibOption = {\n value: string;\n label: string;\n hint: string;\n /**\n * Package names to inject as hint-dependencies (fake \"installed\" so that\n * the detection logic schedules the correct sync plugin and compat adapter).\n */\n packages?: string[];\n};\n\nconst COMPAT_LIB_OPTIONS: CompatLibOption[] = [\n {\n value: 'i18next',\n label: 'i18next / react-i18next',\n hint: 'i18next JSON format — installs @intlayer/i18next + @intlayer/sync-json-plugin',\n packages: ['i18next', 'react-i18next'],\n },\n {\n value: 'next-intl',\n label: 'next-intl / use-intl',\n hint: 'ICU format, Next.js — installs @intlayer/next-intl + @intlayer/sync-json-plugin',\n packages: ['next-intl'],\n },\n {\n value: 'vue-i18n',\n label: 'vue-i18n',\n hint: 'Vue i18n JSON format — installs @intlayer/vue-i18n + @intlayer/sync-json-plugin',\n packages: ['vue-i18n'],\n },\n {\n value: 'nuxtjs-i18n',\n label: '@nuxtjs/i18n',\n hint: 'Nuxt i18n module — installs @intlayer/nuxtjs-i18n + @intlayer/sync-json-plugin',\n packages: ['@nuxtjs/i18n'],\n },\n {\n value: 'next-i18next',\n label: 'next-i18next',\n hint: 'i18next JSON format, Next.js — installs @intlayer/next-i18next + @intlayer/sync-json-plugin',\n packages: ['next-i18next'],\n },\n {\n value: 'next-translate',\n label: 'next-translate',\n hint: 'i18next flat-namespace JSON, Next.js — installs @intlayer/next-translate + @intlayer/sync-json-plugin',\n packages: ['next-translate'],\n },\n {\n value: 'react-intl',\n label: 'react-intl',\n hint: 'ICU format — installs @intlayer/react-intl + @intlayer/sync-json-plugin',\n packages: ['react-intl'],\n },\n {\n value: 'lingui-po',\n label: 'Lingui (.po catalogs)',\n hint: \"gettext PO — Lingui's default, installs @intlayer/lingui + @intlayer/sync-po-plugin\",\n packages: ['@lingui/core'],\n },\n {\n value: 'lingui-json',\n label: 'Lingui (.json catalogs)',\n hint: 'JSON catalogs — installs @intlayer/lingui + @intlayer/sync-json-plugin',\n packages: ['@lingui/core'],\n },\n {\n value: 'svelte-i18n',\n label: 'svelte-i18n',\n hint: 'Flat i18next JSON — installs @intlayer/svelte-i18n + @intlayer/sync-json-plugin',\n packages: ['svelte-i18n'],\n },\n];\n\n/** Reads the merged dependencies of the project at `root`. */\nconst getProjectDependencies = (root: string): Record<string, string> => {\n try {\n const packageJsonPath = join(root, 'package.json');\n if (!existsSync(packageJsonPath)) return {};\n const { dependencies = {}, devDependencies = {} } = JSON.parse(\n readFileSync(packageJsonPath, 'utf-8')\n );\n return { ...dependencies, ...devDependencies };\n } catch {\n return {};\n }\n};\n\n/** Returns true when the project at `root` depends on Next.js. */\nconst isNextJsProject = (root: string): boolean =>\n Boolean(getProjectDependencies(root).next);\n\n/** Returns true when the project at `root` depends on Vite. */\nconst isViteProject = (root: string): boolean =>\n Boolean(getProjectDependencies(root).vite);\n\n/**\n * Returns true when the project uses a URL-based router for which a locale\n * routing strategy is meaningful: Next.js, React Router, or TanStack Router.\n * Apps without URL routing (e.g. React Native / Expo) are excluded, since\n * `routing.mode` has no effect there.\n */\nconst hasUrlRouting = (root: string): boolean => {\n const deps = getProjectDependencies(root);\n\n // React Native / Expo apps have no URL routing — never ask for a strategy.\n if (deps['react-native'] || deps.expo) return false;\n\n return Boolean(\n deps.next ||\n deps['react-router'] ||\n deps['react-router-dom'] ||\n deps['@tanstack/react-router'] ||\n deps['@tanstack/react-start']\n );\n};\n\n/**\n * Runs `init` in interactive mode: prompts the user with a checkbox of setup\n * steps, then forwards the selection to {@link initIntlayer} (packages, GitHub\n * Actions, VS Code extension, LSP) and runs the dedicated skills/MCP installers\n * for the steps that own their own prompts. The `.gitignore` entry is not\n * offered as a checkbox — it is always added (unless `--no-gitignore` is set).\n */\nconst runInteractiveInit = async (\n root: string,\n baseOptions?: InitOptions\n): Promise<void> => {\n p.intro('Initialize Intlayer');\n\n const stepOptions = [...BASE_INIT_STEP_OPTIONS];\n\n const nextJsProject = isNextJsProject(root);\n\n // The compiler is plugged in directly on Vite; on Next.js it needs a Babel\n // config. Only offer the step when one of those frameworks is detected.\n if (nextJsProject || isViteProject(root)) {\n stepOptions.push({\n value: 'compiler',\n label: 'Compiler',\n hint: nextJsProject\n ? 'add the Babel compiler config to extract inline content (Next.js)'\n : 'auto-extract inline content at build time (already plugged in on Vite)',\n });\n }\n\n if (nextJsProject) {\n stepOptions.push({\n value: 'buildOptimization',\n label: 'Bundle optimization',\n hint: 'choose @intlayer/babel or @intlayer/swc for tree-shaking and minification (Next.js only)',\n });\n }\n\n const selected = await p.multiselect<InitStep>({\n message: 'Select what you want to set up:',\n options: stepOptions,\n initialValues: BASE_INIT_STEP_OPTIONS.map((option) => option.value),\n required: false,\n });\n\n if (p.isCancel(selected)) {\n p.cancel('Operation cancelled.');\n return;\n }\n\n const steps = selected as InitStep[];\n\n // Locale routing strategy → written to `routing.mode` in the config file.\n // Only relevant for URL-based routers (Next.js, React Router, TanStack);\n // skipped for apps without URL routing such as React Native / Expo.\n let routingMode: RoutingMode | undefined;\n\n if (hasUrlRouting(root)) {\n const selectedRoutingMode = await p.select<RoutingMode>({\n message: 'Which locale routing strategy do you want?',\n options: ROUTING_MODE_OPTIONS,\n initialValue: 'prefix-no-default',\n });\n\n if (p.isCancel(selectedRoutingMode)) {\n p.cancel('Operation cancelled.');\n return;\n }\n\n routingMode = selectedRoutingMode;\n }\n\n // Compat i18n library detection / selection.\n // When a compat library is already present in package.json the detection\n // in detectMissingIntlayerPackages handles everything automatically. We\n // only show the prompt when none of the known compat libs is detected so\n // we don't ask redundant questions.\n const knownCompatPackages = [\n 'i18next',\n 'react-i18next',\n 'next-intl',\n 'use-intl',\n 'vue-i18n',\n '@nuxtjs/i18n',\n 'next-i18next',\n 'next-translate',\n 'react-intl',\n '@lingui/core',\n '@lingui/react',\n 'svelte-i18n',\n '@ngneat/transloco',\n '@ngx-translate/core',\n 'node-polyglot',\n 'i18n-js',\n ];\n\n const existingDeps = getProjectDependencies(root);\n const hasCompatLib = knownCompatPackages.some((pkg) =>\n Boolean(existingDeps[pkg])\n );\n\n let hintDependencies: Record<string, string> | undefined;\n\n if (!hasCompatLib) {\n const selectedCompatLibs = await p.multiselect<string>({\n message:\n 'Are you using any existing i18n library? (Select all that apply, or press Enter to skip)',\n options: COMPAT_LIB_OPTIONS.map((opt) => ({\n value: opt.value,\n label: opt.label,\n hint: opt.hint,\n })),\n required: false,\n });\n\n if (p.isCancel(selectedCompatLibs)) {\n p.cancel('Operation cancelled.');\n return;\n }\n\n const selectedLibs = selectedCompatLibs as string[];\n\n if (selectedLibs.length > 0) {\n hintDependencies = {};\n\n for (const value of selectedLibs) {\n const option = COMPAT_LIB_OPTIONS.find((o) => o.value === value);\n if (option?.packages) {\n for (const pkg of option.packages) {\n hintDependencies[pkg] = '*';\n }\n }\n }\n\n // Lingui-specific: determine the catalog format so the right sync plugin\n // is chosen. If both lingui variants are selected, ask for clarification.\n const hasLinguiPo = selectedLibs.includes('lingui-po');\n const hasLinguiJson = selectedLibs.includes('lingui-json');\n\n if (hasLinguiPo && hasLinguiJson) {\n // Both selected — ask for clarification\n const linguiFormat = await p.select<'po' | 'json'>({\n message: 'Which catalog format does Lingui use in your project?',\n options: [\n {\n value: 'po' as const,\n label: '.po files (gettext)',\n hint: \"Lingui's default — installs @intlayer/sync-po-plugin\",\n },\n {\n value: 'json' as const,\n label: '.json files',\n hint: 'JSON catalogs — installs @intlayer/sync-json-plugin',\n },\n ],\n initialValue: 'po' as const,\n });\n\n if (p.isCancel(linguiFormat)) {\n p.cancel('Operation cancelled.');\n return;\n }\n\n // Signal JSON format to detectMissingIntlayerPackages via a sentinel\n // hint dep (the lingui detection only needs @lingui/core; the format\n // is conveyed through linguiCatalogFormat option from the filesystem\n // scan). For JSON we override by injecting a flag the init/index.ts\n // can read back from hintDependencies.\n if (linguiFormat === 'json') {\n hintDependencies['__lingui_json__'] = '*';\n }\n } else if (hasLinguiJson && !hasLinguiPo) {\n hintDependencies['__lingui_json__'] = '*';\n }\n // hasLinguiPo alone: @lingui/core hint is enough; PO is the default\n }\n }\n\n const options: InitOptions = {\n ...baseOptions,\n routingMode,\n hintDependencies,\n noInstallPackages: !steps.includes('packages'),\n // The `.gitignore` entry is never offered as a checkbox: in interactive\n // mode we always add `.intlayer` to `.gitignore`, only honoring an explicit\n // `--no-gitignore` flag from the command line.\n noGitignore: baseOptions?.noGitignore,\n // Respect explicit `--no-*` flags from the command line even when the\n // corresponding step is selected in the checkbox.\n noGithubActions:\n baseOptions?.noGithubActions || !steps.includes('githubActions'),\n noFrameworkSetup:\n baseOptions?.noFrameworkSetup || !steps.includes('frameworkSetup'),\n noVscodeExtension: !steps.includes('vscodeExtension'),\n noLsp: !steps.includes('lsp'),\n };\n\n await initIntlayer(root, options);\n\n const needsPlatform = steps.includes('skills') || steps.includes('mcp');\n\n let sharedPlatform: Platform | undefined;\n\n if (needsPlatform) {\n const detectedPlatform = getDetectedPlatform();\n\n try {\n const response = await enquirer.prompt<{ platforms: Platform }>({\n type: 'autocomplete',\n name: 'platforms',\n message: 'Which platform are you using? (Type to search)',\n multiple: false,\n initial: detectedPlatform\n ? PLATFORMS.indexOf(detectedPlatform)\n : undefined,\n choices: PLATFORM_OPTIONS.map((opt) => ({\n name: opt.value,\n message: opt.label,\n hint: opt.hint,\n })),\n });\n sharedPlatform = response.platforms;\n } catch {\n p.cancel('Operation cancelled.');\n return;\n }\n }\n\n if (steps.includes('skills')) {\n await initSkills(root, sharedPlatform);\n }\n\n if (steps.includes('mcp')) {\n await initMCP(root, sharedPlatform);\n }\n\n if (steps.includes('compiler')) {\n await initCompiler(root);\n }\n\n if (steps.includes('buildOptimization')) {\n await initBuildOptimization(root);\n }\n\n // CMS / visual editor is the last step: an opt-in browser login that\n // persists the access-key credentials to `.env` and enables the editor in the\n // config file. Asked last so the browser flow does not interrupt setup.\n const shouldSetUpCms = await p.confirm({\n message:\n 'Set up the Intlayer CMS now? (opens your browser to log in, then stores the credentials in your .env)',\n initialValue: false,\n });\n\n if (p.isCancel(shouldSetUpCms)) {\n p.cancel('Operation cancelled.');\n return;\n }\n\n if (shouldSetUpCms) {\n p.log.info('Opening your browser to log in to the Intlayer CMS...');\n // `exitAfter: false` keeps the process alive so the flow can finish; the\n // credentials are persisted to `.env` and the editor enabled in the config.\n await login({\n exitAfter: false,\n onCredentials: (credentials) => setupCmsCredentials(root, credentials),\n });\n }\n\n p.outro('Intlayer initialization complete');\n};\n\nexport const init = async (\n projectRoot?: string,\n options?: InitOptions,\n interactive?: boolean\n) => {\n const root = projectRoot\n ? findProjectRoot(resolve(projectRoot))\n : findProjectRoot(process.cwd());\n\n if (interactive) {\n await runInteractiveInit(root, options);\n return;\n }\n\n await initIntlayer(root, options);\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAsBA,MAAa,mBAAmB,aAAqB;CACnD,IAAI,aAAa;AAEjB,QAAO,sCAAuB,YAAY,KAAK,EAAE;AAC/C,kDAAoB,YAAY,eAAe,CAAC,CAC9C,QAAO;AAET,sCAAqB,YAAY,KAAK;;AAKxC,QAAO;;AAeT,MAAM,yBAID;CACH;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACP;CACD;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACP;CACD;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACP;CACD;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACP;CACD;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACP;CACD;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACP;CACD;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACP;CACF;;AAGD,MAAM,uBAID;CACH;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACP;CACD;EACE,OAAO;EACP,O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CAEvE,IAAI;AAEJ,KAAI,eAAe;EACjB,MAAM,mBAAmBC,wCAAqB;AAE9C,MAAI;AAeF,qBAAiB,MAdM,iBAAS,OAAgC;IAC9D,MAAM;IACN,MAAM;IACN,SAAS;IACT,UAAU;IACV,SAAS,mBACLC,iCAAU,QAAQ,iBAAiB,GACnC;IACJ,SAASC,oCAAiB,KAAK,SAAS;KACtC,MAAM,IAAI;KACV,SAAS,IAAI;KACb,MAAM,IAAI;KACX,EAAE;IACJ,CAAC,EACwB;UACpB;AACN,kBAAE,OAAO,uBAAuB;AAChC;;;AAIJ,KAAI,MAAM,SAAS,SAAS,CAC1B,OAAMC,8BAAW,MAAM,eAAe;AAGxC,KAAI,MAAM,SAAS,MAAM,CACvB,OAAMC,wBAAQ,MAAM,eAAe;AAGrC,KAAI,MAAM,SAAS,WAAW,CAC5B,OAAMC,kCAAa,KAAK;AAG1B,KAAI,MAAM,SAAS,oBAAoB,CACrC,OAAMC,oDAAsB,KAAK;CAMnC,MAAM,iBAAiB,MAAMP,eAAE,QAAQ;EACrC,SACE;EACF,cAAc;EACf,CAAC;AAEF,KAAIA,eAAE,SAAS,eAAe,EAAE;AAC9B,iBAAE,OAAO,uBAAuB;AAChC;;AAGF,KAAI,gBAAgB;AAClB,iBAAE,IAAI,KAAK,wDAAwD;AAGnE,QAAMQ,yBAAM;GACV,WAAW;GACX,gBAAgB,gEAAoC,MAAM,YAAY;GACvE,CAAC;;AAGJ,gBAAE,MAAM,mCAAmC;;AAG7C,MAAa,OAAO,OAClB,aACA,SACA,gBACG;CACH,MAAM,OAAO,cACT,uCAAwB,YAAY,CAAC,GACrC,gBAAgB,QAAQ,KAAK,CAAC;AAElC,KAAI,aAAa;AACf,QAAM,mBAAmB,MAAM,QAAQ;AACvC;;AAGF,gDAAmB,MAAM,QAAQ"}
1
+ {"version":3,"file":"init.cjs","names":["p","getDetectedPlatform","PLATFORMS","PLATFORM_OPTIONS","initSkills","initMCP","initCompiler","initBuildOptimization","login"],"sources":["../../src/init.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\nimport * as p from '@clack/prompts';\nimport {\n type ContentStrategy,\n type InitOptions,\n initIntlayer,\n PLATFORMS,\n type Platform,\n type RoutingMode,\n setupCmsCredentials,\n} from '@intlayer/engine/cli';\nimport enquirer from 'enquirer';\nimport { login } from './auth/login';\nimport { initBuildOptimization } from './initBuildOptimization';\nimport { initCompiler } from './initCompiler';\nimport { initMCP } from './initMCP';\nimport {\n getDetectedPlatform,\n initSkills,\n PLATFORM_OPTIONS,\n} from './initSkills';\n\nexport const findProjectRoot = (startDir: string) => {\n let currentDir = startDir;\n\n while (currentDir !== resolve(currentDir, '..')) {\n if (existsSync(join(currentDir, 'package.json'))) {\n return currentDir;\n }\n currentDir = resolve(currentDir, '..');\n }\n\n // If no package.json is found, return the start directory.\n // The initIntlayer function will handle the missing package.json error.\n return startDir;\n};\n\n/** Individually selectable setup steps exposed by the interactive init flow. */\ntype InitStep =\n | 'packages'\n | 'githubActions'\n | 'frameworkSetup'\n | 'vscodeExtension'\n | 'lsp'\n | 'skills'\n | 'mcp'\n | 'compiler'\n | 'buildOptimization';\n\nconst BASE_INIT_STEP_OPTIONS: Array<{\n value: InitStep;\n label: string;\n hint: string;\n}> = [\n {\n value: 'packages',\n label: 'Install & upgrade packages',\n hint: 'install missing Intlayer dependencies and upgrade outdated ones',\n },\n {\n value: 'githubActions',\n label: 'CI/CD (GitHub Actions)',\n hint: 'scaffold the fill and test workflows that run on every pull request',\n },\n {\n value: 'frameworkSetup',\n label: 'Framework setup',\n hint: 'middleware/proxy and providers in layout/page',\n },\n {\n value: 'vscodeExtension',\n label: 'VS Code extension',\n hint: 'recommend the Intlayer extension',\n },\n {\n value: 'lsp',\n label: 'Editor LSP',\n hint: 'go-to-definition from keys to .content files',\n },\n {\n value: 'skills',\n label: 'AI skills',\n hint: 'install the Intlayer documentation as agent skills',\n },\n {\n value: 'mcp',\n label: 'MCP server',\n hint: 'configure the Intlayer MCP server',\n },\n];\n\n/** Locale routing strategies offered by the interactive init flow. */\nconst ROUTING_MODE_OPTIONS: Array<{\n value: RoutingMode;\n label: string;\n hint: string;\n}> = [\n {\n value: 'prefix-no-default',\n label: 'Prefix all except the default locale',\n hint: '/about, /fr/about (default)',\n },\n {\n value: 'prefix-all',\n label: 'Prefix all locales',\n hint: '/en/about, /fr/about',\n },\n {\n value: 'no-prefix',\n label: 'No locale in the URL',\n hint: '/about',\n },\n {\n value: 'search-params',\n label: 'Use a search parameter',\n hint: '/about?locale=fr',\n },\n];\n\n/**\n * Content organization strategies offered by the interactive init flow.\n * Drives the `compiler.output` template (autogenerated content: compiler /\n * autofill / extract) or the injection of the syncJSON plugin.\n */\nconst CONTENT_STRATEGY_OPTIONS: Array<{\n value: ContentStrategy;\n label: string;\n hint: string;\n}> = [\n {\n value: 'per-component',\n label: 'Per component (default)',\n hint: 'multilingual .content files co-located with the components',\n },\n {\n value: 'centralized',\n label: 'Centralized folder',\n hint: 'per-locale JSON dictionaries under /locales/{locale}/{key}.content.json',\n },\n {\n value: 'json-namespaces',\n label: 'JSON namespaces',\n hint: 'plain /locales/{locale}/{namespace}.json files synced via @intlayer/sync-json-plugin',\n },\n];\n\n/**\n * Compat i18n library options surfaced in the interactive init prompt.\n * The `packages` field lists the package names to inject as hint-deps so\n * `detectMissingIntlayerPackages` detects the right sync plugin even before\n * those libraries are installed.\n */\ntype CompatLibOption = {\n value: string;\n label: string;\n hint: string;\n /**\n * Package names to inject as hint-dependencies (fake \"installed\" so that\n * the detection logic schedules the correct sync plugin and compat adapter).\n */\n packages?: string[];\n};\n\nconst COMPAT_LIB_OPTIONS: CompatLibOption[] = [\n {\n value: 'i18next',\n label: 'i18next / react-i18next',\n hint: 'i18next JSON format — installs @intlayer/i18next + @intlayer/sync-json-plugin',\n packages: ['i18next', 'react-i18next'],\n },\n {\n value: 'next-intl',\n label: 'next-intl / use-intl',\n hint: 'ICU format, Next.js — installs @intlayer/next-intl + @intlayer/sync-json-plugin',\n packages: ['next-intl'],\n },\n {\n value: 'vue-i18n',\n label: 'vue-i18n',\n hint: 'Vue i18n JSON format — installs @intlayer/vue-i18n + @intlayer/sync-json-plugin',\n packages: ['vue-i18n'],\n },\n {\n value: 'nuxtjs-i18n',\n label: '@nuxtjs/i18n',\n hint: 'Nuxt i18n module — installs @intlayer/nuxtjs-i18n + @intlayer/sync-json-plugin',\n packages: ['@nuxtjs/i18n'],\n },\n {\n value: 'next-i18next',\n label: 'next-i18next',\n hint: 'i18next JSON format, Next.js — installs @intlayer/next-i18next + @intlayer/sync-json-plugin',\n packages: ['next-i18next'],\n },\n {\n value: 'next-translate',\n label: 'next-translate',\n hint: 'i18next flat-namespace JSON, Next.js — installs @intlayer/next-translate + @intlayer/sync-json-plugin',\n packages: ['next-translate'],\n },\n {\n value: 'react-intl',\n label: 'react-intl',\n hint: 'ICU format — installs @intlayer/react-intl + @intlayer/sync-json-plugin',\n packages: ['react-intl'],\n },\n {\n value: 'lingui-po',\n label: 'Lingui (.po catalogs)',\n hint: \"gettext PO — Lingui's default, installs @intlayer/lingui + @intlayer/sync-po-plugin\",\n packages: ['@lingui/core'],\n },\n {\n value: 'lingui-json',\n label: 'Lingui (.json catalogs)',\n hint: 'JSON catalogs — installs @intlayer/lingui + @intlayer/sync-json-plugin',\n packages: ['@lingui/core'],\n },\n {\n value: 'svelte-i18n',\n label: 'svelte-i18n',\n hint: 'Flat i18next JSON — installs @intlayer/svelte-i18n + @intlayer/sync-json-plugin',\n packages: ['svelte-i18n'],\n },\n];\n\n/** Reads the merged dependencies of the project at `root`. */\nconst getProjectDependencies = (root: string): Record<string, string> => {\n try {\n const packageJsonPath = join(root, 'package.json');\n if (!existsSync(packageJsonPath)) return {};\n const { dependencies = {}, devDependencies = {} } = JSON.parse(\n readFileSync(packageJsonPath, 'utf-8')\n );\n return { ...dependencies, ...devDependencies };\n } catch {\n return {};\n }\n};\n\n/** Returns true when the project at `root` depends on Next.js. */\nconst isNextJsProject = (root: string): boolean =>\n Boolean(getProjectDependencies(root).next);\n\n/** Returns true when the project at `root` depends on Vite. */\nconst isViteProject = (root: string): boolean =>\n Boolean(getProjectDependencies(root).vite);\n\n/**\n * Returns true when the project uses a URL-based router for which a locale\n * routing strategy is meaningful: Next.js, React Router, or TanStack Router.\n * Apps without URL routing (e.g. React Native / Expo) are excluded, since\n * `routing.mode` has no effect there.\n */\nconst hasUrlRouting = (root: string): boolean => {\n const deps = getProjectDependencies(root);\n\n // React Native / Expo apps have no URL routing — never ask for a strategy.\n if (deps['react-native'] || deps.expo) return false;\n\n return Boolean(\n deps.next ||\n deps['react-router'] ||\n deps['react-router-dom'] ||\n deps['@tanstack/react-router'] ||\n deps['@tanstack/react-start']\n );\n};\n\n/**\n * Runs `init` in interactive mode: prompts the user with a checkbox of setup\n * steps, then forwards the selection to {@link initIntlayer} (packages, GitHub\n * Actions, VS Code extension, LSP) and runs the dedicated skills/MCP installers\n * for the steps that own their own prompts. The `.gitignore` entry is not\n * offered as a checkbox — it is always added (unless `--no-gitignore` is set).\n */\nconst runInteractiveInit = async (\n root: string,\n baseOptions?: InitOptions\n): Promise<void> => {\n p.intro('Initialize Intlayer');\n\n const stepOptions = [...BASE_INIT_STEP_OPTIONS];\n\n const nextJsProject = isNextJsProject(root);\n\n // The compiler is plugged in directly on Vite; on Next.js it needs a Babel\n // config. Only offer the step when one of those frameworks is detected.\n if (nextJsProject || isViteProject(root)) {\n stepOptions.push({\n value: 'compiler',\n label: 'Compiler',\n hint: nextJsProject\n ? 'add the Babel compiler config to extract inline content (Next.js)'\n : 'auto-extract inline content at build time (already plugged in on Vite)',\n });\n }\n\n if (nextJsProject) {\n stepOptions.push({\n value: 'buildOptimization',\n label: 'Bundle optimization',\n hint: 'choose @intlayer/babel or @intlayer/swc for tree-shaking and minification (Next.js only)',\n });\n }\n\n const selected = await p.multiselect<InitStep>({\n message: 'Select what you want to set up:',\n options: stepOptions,\n initialValues: BASE_INIT_STEP_OPTIONS.map((option) => option.value),\n required: false,\n });\n\n if (p.isCancel(selected)) {\n p.cancel('Operation cancelled.');\n return;\n }\n\n const steps = selected as InitStep[];\n\n // Locale routing strategy → written to `routing.mode` in the config file.\n // Only relevant for URL-based routers (Next.js, React Router, TanStack);\n // skipped for apps without URL routing such as React Native / Expo.\n let routingMode: RoutingMode | undefined;\n\n if (hasUrlRouting(root)) {\n const selectedRoutingMode = await p.select<RoutingMode>({\n message: 'Which locale routing strategy do you want?',\n options: ROUTING_MODE_OPTIONS,\n initialValue: 'prefix-no-default',\n });\n\n if (p.isCancel(selectedRoutingMode)) {\n p.cancel('Operation cancelled.');\n return;\n }\n\n routingMode = selectedRoutingMode;\n }\n\n // Compat i18n library detection / selection.\n // When a compat library is already present in package.json the detection\n // in detectMissingIntlayerPackages handles everything automatically. We\n // only show the prompt when none of the known compat libs is detected so\n // we don't ask redundant questions.\n const knownCompatPackages = [\n 'i18next',\n 'react-i18next',\n 'next-intl',\n 'use-intl',\n 'vue-i18n',\n '@nuxtjs/i18n',\n 'next-i18next',\n 'next-translate',\n 'react-intl',\n '@lingui/core',\n '@lingui/react',\n 'svelte-i18n',\n '@ngneat/transloco',\n '@ngx-translate/core',\n 'node-polyglot',\n 'i18n-js',\n ];\n\n const existingDeps = getProjectDependencies(root);\n const hasCompatLib = knownCompatPackages.some((pkg) =>\n Boolean(existingDeps[pkg])\n );\n\n let hintDependencies: Record<string, string> | undefined;\n\n if (!hasCompatLib) {\n const selectedCompatLibs = await p.multiselect<string>({\n message:\n 'Are you using any existing i18n library? (Select all that apply, or press Enter to skip)',\n options: COMPAT_LIB_OPTIONS.map((opt) => ({\n value: opt.value,\n label: opt.label,\n hint: opt.hint,\n })),\n required: false,\n });\n\n if (p.isCancel(selectedCompatLibs)) {\n p.cancel('Operation cancelled.');\n return;\n }\n\n const selectedLibs = selectedCompatLibs as string[];\n\n if (selectedLibs.length > 0) {\n hintDependencies = {};\n\n for (const value of selectedLibs) {\n const option = COMPAT_LIB_OPTIONS.find((o) => o.value === value);\n if (option?.packages) {\n for (const pkg of option.packages) {\n hintDependencies[pkg] = '*';\n }\n }\n }\n\n // Lingui-specific: determine the catalog format so the right sync plugin\n // is chosen. If both lingui variants are selected, ask for clarification.\n const hasLinguiPo = selectedLibs.includes('lingui-po');\n const hasLinguiJson = selectedLibs.includes('lingui-json');\n\n if (hasLinguiPo && hasLinguiJson) {\n // Both selected — ask for clarification\n const linguiFormat = await p.select<'po' | 'json'>({\n message: 'Which catalog format does Lingui use in your project?',\n options: [\n {\n value: 'po' as const,\n label: '.po files (gettext)',\n hint: \"Lingui's default — installs @intlayer/sync-po-plugin\",\n },\n {\n value: 'json' as const,\n label: '.json files',\n hint: 'JSON catalogs — installs @intlayer/sync-json-plugin',\n },\n ],\n initialValue: 'po' as const,\n });\n\n if (p.isCancel(linguiFormat)) {\n p.cancel('Operation cancelled.');\n return;\n }\n\n // Signal JSON format to detectMissingIntlayerPackages via a sentinel\n // hint dep (the lingui detection only needs @lingui/core; the format\n // is conveyed through linguiCatalogFormat option from the filesystem\n // scan). For JSON we override by injecting a flag the init/index.ts\n // can read back from hintDependencies.\n if (linguiFormat === 'json') {\n hintDependencies['__lingui_json__'] = '*';\n }\n } else if (hasLinguiJson && !hasLinguiPo) {\n hintDependencies['__lingui_json__'] = '*';\n }\n // hasLinguiPo alone: @lingui/core hint is enough; PO is the default\n }\n }\n\n // Content organization strategy → drives `compiler.output` (autogenerated\n // content) or the syncJSON plugin injection. A compat library already\n // dictates the catalog layout (its JSON/PO files are synced as-is), so the\n // question is only asked when none is in play.\n let contentStrategy: ContentStrategy | undefined;\n\n if (!hasCompatLib && !hintDependencies) {\n const selectedContentStrategy = await p.select<ContentStrategy>({\n message: 'How do you want to organize your translated content?',\n options: CONTENT_STRATEGY_OPTIONS,\n initialValue: 'per-component',\n });\n\n if (p.isCancel(selectedContentStrategy)) {\n p.cancel('Operation cancelled.');\n return;\n }\n\n contentStrategy = selectedContentStrategy;\n }\n\n const options: InitOptions = {\n ...baseOptions,\n routingMode,\n hintDependencies,\n contentStrategy,\n noInstallPackages: !steps.includes('packages'),\n // The `.gitignore` entry is never offered as a checkbox: in interactive\n // mode we always add `.intlayer` to `.gitignore`, only honoring an explicit\n // `--no-gitignore` flag from the command line.\n noGitignore: baseOptions?.noGitignore,\n // Respect explicit `--no-*` flags from the command line even when the\n // corresponding step is selected in the checkbox.\n noGithubActions:\n baseOptions?.noGithubActions || !steps.includes('githubActions'),\n noFrameworkSetup:\n baseOptions?.noFrameworkSetup || !steps.includes('frameworkSetup'),\n noVscodeExtension: !steps.includes('vscodeExtension'),\n noLsp: !steps.includes('lsp'),\n };\n\n await initIntlayer(root, options);\n\n const needsPlatform = steps.includes('skills') || steps.includes('mcp');\n\n let sharedPlatform: Platform | undefined;\n\n if (needsPlatform) {\n const detectedPlatform = getDetectedPlatform();\n\n try {\n const response = await enquirer.prompt<{ platforms: Platform }>({\n type: 'autocomplete',\n name: 'platforms',\n message: 'Which platform are you using? (Type to search)',\n multiple: false,\n initial: detectedPlatform\n ? PLATFORMS.indexOf(detectedPlatform)\n : undefined,\n choices: PLATFORM_OPTIONS.map((opt) => ({\n name: opt.value,\n message: opt.label,\n hint: opt.hint,\n })),\n });\n sharedPlatform = response.platforms;\n } catch {\n p.cancel('Operation cancelled.');\n return;\n }\n }\n\n if (steps.includes('skills')) {\n await initSkills(root, sharedPlatform);\n }\n\n if (steps.includes('mcp')) {\n await initMCP(root, sharedPlatform);\n }\n\n if (steps.includes('compiler')) {\n await initCompiler(root);\n }\n\n if (steps.includes('buildOptimization')) {\n await initBuildOptimization(root);\n }\n\n // CMS / visual editor is the last step: an opt-in browser login that\n // persists the access-key credentials to `.env` and enables the editor in the\n // config file. Asked last so the browser flow does not interrupt setup.\n const shouldSetUpCms = await p.confirm({\n message:\n 'Set up the Intlayer CMS now? (opens your browser to log in, then stores the credentials in your .env)',\n initialValue: false,\n });\n\n if (p.isCancel(shouldSetUpCms)) {\n p.cancel('Operation cancelled.');\n return;\n }\n\n if (shouldSetUpCms) {\n p.log.info('Opening your browser to log in to the Intlayer CMS...');\n // `exitAfter: false` keeps the process alive so the flow can finish; the\n // credentials are persisted to `.env` and the editor enabled in the config.\n await login({\n exitAfter: false,\n onCredentials: (credentials) => setupCmsCredentials(root, credentials),\n });\n }\n\n p.outro('Intlayer initialization complete');\n};\n\nexport const init = async (\n projectRoot?: string,\n options?: InitOptions,\n interactive?: boolean\n) => {\n const root = projectRoot\n ? findProjectRoot(resolve(projectRoot))\n : findProjectRoot(process.cwd());\n\n if (interactive) {\n await runInteractiveInit(root, options);\n return;\n }\n\n await initIntlayer(root, options);\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAuBA,MAAa,mBAAmB,aAAqB;CACnD,IAAI,aAAa;AAEjB,QAAO,sCAAuB,YAAY,KAAK,EAAE;AAC/C,kDAAoB,YAAY,eAAe,CAAC,CAC9C,QAAO;AAET,sCAAqB,YAAY,KAAK;;AAKxC,QAAO;;AAeT,MAAM,yBAID;CACH;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACP;CACD;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACP;CACD;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACP;CACD;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACP;CACD;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACP;CACD;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACP;CACD;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACP;CACF;;AAGD,MAAM,uBAID;CACH;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACP;CACD;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACP;CACD;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACP;CACD;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACP;CACF;;;;;;AAOD,MAAM,2BAID;CACH;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACP;CACD;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACP;CACD;EACE,OAAO;EACP,OAA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AAQ;AACvC;;AAGF,8CAAmB,MAAM,QAAQ"}
@@ -3,7 +3,7 @@ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
3
  const require_init = require('./init.cjs');
4
4
  let node_fs = require("node:fs");
5
5
  let node_path = require("node:path");
6
- let _intlayer_chokidar_cli = require("@intlayer/chokidar/cli");
6
+ let _intlayer_engine_cli = require("@intlayer/engine/cli");
7
7
  let _clack_prompts = require("@clack/prompts");
8
8
  _clack_prompts = require_runtime.__toESM(_clack_prompts);
9
9
 
@@ -47,12 +47,12 @@ const initBuildOptimization = async (projectRoot) => {
47
47
  _clack_prompts.cancel("Operation cancelled.");
48
48
  return;
49
49
  }
50
- const packageManager = (0, _intlayer_chokidar_cli.detectPackageManager)(root);
50
+ const packageManager = (0, _intlayer_engine_cli.detectPackageManager)(root);
51
51
  const packageToInstall = plugin === "babel" ? "@intlayer/babel" : "@intlayer/swc";
52
52
  const spinner = _clack_prompts.spinner();
53
53
  spinner.start("Installing packages...");
54
54
  try {
55
- (0, _intlayer_chokidar_cli.installPackages)(root, [packageToInstall], packageManager, true);
55
+ (0, _intlayer_engine_cli.installPackages)(root, [packageToInstall], packageManager, true);
56
56
  spinner.stop(`Installed: ${packageToInstall}`);
57
57
  } catch {
58
58
  spinner.stop("Package installation failed");
@@ -65,13 +65,13 @@ const initBuildOptimization = async (projectRoot) => {
65
65
  const existingBabelConfig = BABEL_CONFIG_CANDIDATES.find((file) => (0, node_fs.existsSync)((0, node_path.join)(root, file)));
66
66
  if (existingBabelConfig) {
67
67
  _clack_prompts.log.warn(`${existingBabelConfig} already exists — add the Intlayer plugins manually.`);
68
- _clack_prompts.note(_intlayer_chokidar_cli.NEXT_INTLAYER_BABEL_CONFIG_CONTENT, "Plugins to add to your babel config");
68
+ _clack_prompts.note(_intlayer_engine_cli.NEXT_INTLAYER_BABEL_CONFIG_CONTENT, "Plugins to add to your babel config");
69
69
  } else try {
70
- (0, node_fs.writeFileSync)((0, node_path.join)(root, "babel.config.js"), _intlayer_chokidar_cli.NEXT_INTLAYER_BABEL_CONFIG_CONTENT, { encoding: "utf-8" });
70
+ (0, node_fs.writeFileSync)((0, node_path.join)(root, "babel.config.js"), _intlayer_engine_cli.NEXT_INTLAYER_BABEL_CONFIG_CONTENT, { encoding: "utf-8" });
71
71
  _clack_prompts.log.success("Created babel.config.js with the Intlayer compiler plugins (extract, purge, minify, optimize)");
72
72
  } catch {
73
73
  _clack_prompts.log.warn("Could not create babel.config.js — please create it manually.");
74
- _clack_prompts.note(_intlayer_chokidar_cli.NEXT_INTLAYER_BABEL_CONFIG_CONTENT, "babel.config.js");
74
+ _clack_prompts.note(_intlayer_engine_cli.NEXT_INTLAYER_BABEL_CONFIG_CONTENT, "babel.config.js");
75
75
  }
76
76
  _clack_prompts.outro("Build optimization configuration complete");
77
77
  };
@@ -1 +1 @@
1
- {"version":3,"file":"initBuildOptimization.cjs","names":["findProjectRoot","p","NEXT_INTLAYER_BABEL_CONFIG_CONTENT"],"sources":["../../src/initBuildOptimization.ts"],"sourcesContent":["import { existsSync, writeFileSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\nimport * as p from '@clack/prompts';\nimport {\n detectPackageManager,\n installPackages,\n NEXT_INTLAYER_BABEL_CONFIG_CONTENT,\n} from '@intlayer/chokidar/cli';\nimport { findProjectRoot } from './init';\n\n/** Intlayer build optimization plugin choices for Next.js. */\nexport type BuildOptimizationPlugin = 'babel' | 'swc';\n\n/** Babel config filenames Next.js picks up, ordered by preference. */\nconst BABEL_CONFIG_CANDIDATES = [\n 'babel.config.js',\n 'babel.config.cjs',\n 'babel.config.mjs',\n 'babel.config.ts',\n];\n\n/**\n * Interactive prompt to select a build optimization plugin for Next.js and\n * scaffold the required files. The two options are independent — pick one:\n *\n * - `@intlayer/babel` — runs the full compiler pipeline (extract, purge, minify,\n * optimize) through Babel. Installs `@intlayer/babel` and creates a\n * `babel.config.js`.\n * - `@intlayer/swc` — lightweight SWC plugin that rewrites `useIntlayer` imports.\n * Installs only the dependency; `withIntlayer` wires it in automatically, so\n * no config file is required.\n *\n * @param projectRoot - Optional project root; defaults to the current directory.\n */\nexport const initBuildOptimization = async (\n projectRoot?: string\n): Promise<void> => {\n const root = findProjectRoot(\n projectRoot ? resolve(projectRoot) : process.cwd()\n );\n p.intro('Configuring Next.js build optimization');\n\n const plugin = (await p.select({\n message: 'Which build optimization plugin do you want to use?',\n options: [\n {\n value: 'babel',\n label: '@intlayer/babel',\n hint: 'Full pipeline — extract, purge, minify and optimize via Babel; creates babel.config.js',\n },\n {\n value: 'swc',\n label: '@intlayer/swc',\n hint: 'Lightweight — SWC plugin that rewrites useIntlayer imports; wired automatically by withIntlayer',\n },\n ],\n })) as BuildOptimizationPlugin;\n\n if (p.isCancel(plugin) || !plugin) {\n p.cancel('Operation cancelled.');\n return;\n }\n\n const packageManager = detectPackageManager(root);\n const packageToInstall =\n plugin === 'babel' ? '@intlayer/babel' : '@intlayer/swc';\n\n const spinner = p.spinner();\n spinner.start('Installing packages...');\n\n try {\n installPackages(root, [packageToInstall], packageManager, true);\n spinner.stop(`Installed: ${packageToInstall}`);\n } catch {\n spinner.stop('Package installation failed');\n p.log.warn(`Please install manually: ${packageToInstall} (dev dependency)`);\n }\n\n // SWC needs no extra setup — withIntlayer injects the plugin at build time.\n if (plugin === 'swc') {\n p.outro('Build optimization configuration complete');\n return;\n }\n\n // BABEL — scaffold babel.config.js with the full compiler pipeline.\n const existingBabelConfig = BABEL_CONFIG_CANDIDATES.find((file) =>\n existsSync(join(root, file))\n );\n\n if (existingBabelConfig) {\n p.log.warn(\n `${existingBabelConfig} already exists — add the Intlayer plugins manually.`\n );\n p.note(\n NEXT_INTLAYER_BABEL_CONFIG_CONTENT,\n 'Plugins to add to your babel config'\n );\n } else {\n try {\n writeFileSync(\n join(root, 'babel.config.js'),\n NEXT_INTLAYER_BABEL_CONFIG_CONTENT,\n { encoding: 'utf-8' }\n );\n p.log.success(\n 'Created babel.config.js with the Intlayer compiler plugins (extract, purge, minify, optimize)'\n );\n } catch {\n p.log.warn(\n 'Could not create babel.config.js — please create it manually.'\n );\n p.note(NEXT_INTLAYER_BABEL_CONFIG_CONTENT, 'babel.config.js');\n }\n }\n\n p.outro('Build optimization configuration complete');\n};\n"],"mappings":";;;;;;;;;;;AAcA,MAAM,0BAA0B;CAC9B;CACA;CACA;CACA;CACD;;;;;;;;;;;;;;AAeD,MAAa,wBAAwB,OACnC,gBACkB;CAClB,MAAM,OAAOA,6BACX,qCAAsB,YAAY,GAAG,QAAQ,KAAK,CACnD;AACD,gBAAE,MAAM,yCAAyC;CAEjD,MAAM,SAAU,MAAMC,eAAE,OAAO;EAC7B,SAAS;EACT,SAAS,CACP;GACE,OAAO;GACP,OAAO;GACP,MAAM;GACP,EACD;GACE,OAAO;GACP,OAAO;GACP,MAAM;GACP,CACF;EACF,CAAC;AAEF,KAAIA,eAAE,SAAS,OAAO,IAAI,CAAC,QAAQ;AACjC,iBAAE,OAAO,uBAAuB;AAChC;;CAGF,MAAM,kEAAsC,KAAK;CACjD,MAAM,mBACJ,WAAW,UAAU,oBAAoB;CAE3C,MAAM,UAAUA,eAAE,SAAS;AAC3B,SAAQ,MAAM,yBAAyB;AAEvC,KAAI;AACF,8CAAgB,MAAM,CAAC,iBAAiB,EAAE,gBAAgB,KAAK;AAC/D,UAAQ,KAAK,cAAc,mBAAmB;SACxC;AACN,UAAQ,KAAK,8BAA8B;AAC3C,iBAAE,IAAI,KAAK,4BAA4B,iBAAiB,mBAAmB;;AAI7E,KAAI,WAAW,OAAO;AACpB,iBAAE,MAAM,4CAA4C;AACpD;;CAIF,MAAM,sBAAsB,wBAAwB,MAAM,qDACxC,MAAM,KAAK,CAAC,CAC7B;AAED,KAAI,qBAAqB;AACvB,iBAAE,IAAI,KACJ,GAAG,oBAAoB,sDACxB;AACD,iBAAE,KACAC,2DACA,sCACD;OAED,KAAI;AACF,iDACO,MAAM,kBAAkB,EAC7BA,2DACA,EAAE,UAAU,SAAS,CACtB;AACD,iBAAE,IAAI,QACJ,gGACD;SACK;AACN,iBAAE,IAAI,KACJ,gEACD;AACD,iBAAE,KAAKA,2DAAoC,kBAAkB;;AAIjE,gBAAE,MAAM,4CAA4C"}
1
+ {"version":3,"file":"initBuildOptimization.cjs","names":["findProjectRoot","p","NEXT_INTLAYER_BABEL_CONFIG_CONTENT"],"sources":["../../src/initBuildOptimization.ts"],"sourcesContent":["import { existsSync, writeFileSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\nimport * as p from '@clack/prompts';\nimport {\n detectPackageManager,\n installPackages,\n NEXT_INTLAYER_BABEL_CONFIG_CONTENT,\n} from '@intlayer/engine/cli';\nimport { findProjectRoot } from './init';\n\n/** Intlayer build optimization plugin choices for Next.js. */\nexport type BuildOptimizationPlugin = 'babel' | 'swc';\n\n/** Babel config filenames Next.js picks up, ordered by preference. */\nconst BABEL_CONFIG_CANDIDATES = [\n 'babel.config.js',\n 'babel.config.cjs',\n 'babel.config.mjs',\n 'babel.config.ts',\n];\n\n/**\n * Interactive prompt to select a build optimization plugin for Next.js and\n * scaffold the required files. The two options are independent — pick one:\n *\n * - `@intlayer/babel` — runs the full compiler pipeline (extract, purge, minify,\n * optimize) through Babel. Installs `@intlayer/babel` and creates a\n * `babel.config.js`.\n * - `@intlayer/swc` — lightweight SWC plugin that rewrites `useIntlayer` imports.\n * Installs only the dependency; `withIntlayer` wires it in automatically, so\n * no config file is required.\n *\n * @param projectRoot - Optional project root; defaults to the current directory.\n */\nexport const initBuildOptimization = async (\n projectRoot?: string\n): Promise<void> => {\n const root = findProjectRoot(\n projectRoot ? resolve(projectRoot) : process.cwd()\n );\n p.intro('Configuring Next.js build optimization');\n\n const plugin = (await p.select({\n message: 'Which build optimization plugin do you want to use?',\n options: [\n {\n value: 'babel',\n label: '@intlayer/babel',\n hint: 'Full pipeline — extract, purge, minify and optimize via Babel; creates babel.config.js',\n },\n {\n value: 'swc',\n label: '@intlayer/swc',\n hint: 'Lightweight — SWC plugin that rewrites useIntlayer imports; wired automatically by withIntlayer',\n },\n ],\n })) as BuildOptimizationPlugin;\n\n if (p.isCancel(plugin) || !plugin) {\n p.cancel('Operation cancelled.');\n return;\n }\n\n const packageManager = detectPackageManager(root);\n const packageToInstall =\n plugin === 'babel' ? '@intlayer/babel' : '@intlayer/swc';\n\n const spinner = p.spinner();\n spinner.start('Installing packages...');\n\n try {\n installPackages(root, [packageToInstall], packageManager, true);\n spinner.stop(`Installed: ${packageToInstall}`);\n } catch {\n spinner.stop('Package installation failed');\n p.log.warn(`Please install manually: ${packageToInstall} (dev dependency)`);\n }\n\n // SWC needs no extra setup — withIntlayer injects the plugin at build time.\n if (plugin === 'swc') {\n p.outro('Build optimization configuration complete');\n return;\n }\n\n // BABEL — scaffold babel.config.js with the full compiler pipeline.\n const existingBabelConfig = BABEL_CONFIG_CANDIDATES.find((file) =>\n existsSync(join(root, file))\n );\n\n if (existingBabelConfig) {\n p.log.warn(\n `${existingBabelConfig} already exists — add the Intlayer plugins manually.`\n );\n p.note(\n NEXT_INTLAYER_BABEL_CONFIG_CONTENT,\n 'Plugins to add to your babel config'\n );\n } else {\n try {\n writeFileSync(\n join(root, 'babel.config.js'),\n NEXT_INTLAYER_BABEL_CONFIG_CONTENT,\n { encoding: 'utf-8' }\n );\n p.log.success(\n 'Created babel.config.js with the Intlayer compiler plugins (extract, purge, minify, optimize)'\n );\n } catch {\n p.log.warn(\n 'Could not create babel.config.js — please create it manually.'\n );\n p.note(NEXT_INTLAYER_BABEL_CONFIG_CONTENT, 'babel.config.js');\n }\n }\n\n p.outro('Build optimization configuration complete');\n};\n"],"mappings":";;;;;;;;;;;AAcA,MAAM,0BAA0B;CAC9B;CACA;CACA;CACA;CACD;;;;;;;;;;;;;;AAeD,MAAa,wBAAwB,OACnC,gBACkB;CAClB,MAAM,OAAOA,6BACX,qCAAsB,YAAY,GAAG,QAAQ,KAAK,CACnD;AACD,gBAAE,MAAM,yCAAyC;CAEjD,MAAM,SAAU,MAAMC,eAAE,OAAO;EAC7B,SAAS;EACT,SAAS,CACP;GACE,OAAO;GACP,OAAO;GACP,MAAM;GACP,EACD;GACE,OAAO;GACP,OAAO;GACP,MAAM;GACP,CACF;EACF,CAAC;AAEF,KAAIA,eAAE,SAAS,OAAO,IAAI,CAAC,QAAQ;AACjC,iBAAE,OAAO,uBAAuB;AAChC;;CAGF,MAAM,gEAAsC,KAAK;CACjD,MAAM,mBACJ,WAAW,UAAU,oBAAoB;CAE3C,MAAM,UAAUA,eAAE,SAAS;AAC3B,SAAQ,MAAM,yBAAyB;AAEvC,KAAI;AACF,4CAAgB,MAAM,CAAC,iBAAiB,EAAE,gBAAgB,KAAK;AAC/D,UAAQ,KAAK,cAAc,mBAAmB;SACxC;AACN,UAAQ,KAAK,8BAA8B;AAC3C,iBAAE,IAAI,KAAK,4BAA4B,iBAAiB,mBAAmB;;AAI7E,KAAI,WAAW,OAAO;AACpB,iBAAE,MAAM,4CAA4C;AACpD;;CAIF,MAAM,sBAAsB,wBAAwB,MAAM,qDACxC,MAAM,KAAK,CAAC,CAC7B;AAED,KAAI,qBAAqB;AACvB,iBAAE,IAAI,KACJ,GAAG,oBAAoB,sDACxB;AACD,iBAAE,KACAC,yDACA,sCACD;OAED,KAAI;AACF,iDACO,MAAM,kBAAkB,EAC7BA,yDACA,EAAE,UAAU,SAAS,CACtB;AACD,iBAAE,IAAI,QACJ,gGACD;SACK;AACN,iBAAE,IAAI,KACJ,gEACD;AACD,iBAAE,KAAKA,yDAAoC,kBAAkB;;AAIjE,gBAAE,MAAM,4CAA4C"}
@@ -3,7 +3,7 @@ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
3
  const require_init = require('./init.cjs');
4
4
  let node_fs = require("node:fs");
5
5
  let node_path = require("node:path");
6
- let _intlayer_chokidar_cli = require("@intlayer/chokidar/cli");
6
+ let _intlayer_engine_cli = require("@intlayer/engine/cli");
7
7
  let _clack_prompts = require("@clack/prompts");
8
8
  _clack_prompts = require_runtime.__toESM(_clack_prompts);
9
9
 
@@ -80,12 +80,12 @@ const initCompiler = async (projectRoot) => {
80
80
  return;
81
81
  }
82
82
  _clack_prompts.intro("Configuring the Intlayer compiler for Next.js");
83
- const packageManager = (0, _intlayer_chokidar_cli.detectPackageManager)(root);
83
+ const packageManager = (0, _intlayer_engine_cli.detectPackageManager)(root);
84
84
  const devPackagesToInstall = ["@intlayer/babel"];
85
85
  const spinner = _clack_prompts.spinner();
86
86
  spinner.start("Installing packages...");
87
87
  try {
88
- (0, _intlayer_chokidar_cli.installPackages)(root, devPackagesToInstall, packageManager, true);
88
+ (0, _intlayer_engine_cli.installPackages)(root, devPackagesToInstall, packageManager, true);
89
89
  spinner.stop(`Installed: ${devPackagesToInstall.join(", ")}`);
90
90
  } catch {
91
91
  spinner.stop("Package installation failed");
@@ -1 +1 @@
1
- {"version":3,"file":"initCompiler.cjs","names":["findProjectRoot","p"],"sources":["../../src/initCompiler.ts"],"sourcesContent":["import { existsSync, readFileSync, writeFileSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\nimport * as p from '@clack/prompts';\nimport { detectPackageManager, installPackages } from '@intlayer/chokidar/cli';\nimport { findProjectRoot } from './init';\n\n/** Framework the Intlayer compiler can be wired into during init. */\ntype CompilerFramework = 'vite' | 'nextjs' | 'unknown';\n\n/**\n * babel.config.js that runs the Intlayer compiler passes for Next.js.\n *\n * Mirrors the Next.js (Babel) tab of `docs/docs/en/compiler.md`: the extract\n * plugin pulls inline content into dictionaries and the optimize plugin\n * rewrites `useIntlayer` into direct dictionary imports. On Vite the same work\n * is handled by the `intlayer()` plugin (which bundles the compiler in v9), so\n * no Babel config is needed.\n */\nconst BABEL_COMPILER_CONFIG_CONTENT = `const {\n intlayerExtractBabelPlugin,\n intlayerOptimizeBabelPlugin,\n getExtractPluginOptions,\n getOptimizePluginOptions,\n} = require(\"@intlayer/babel\");\n\nmodule.exports = {\n presets: [\"next/babel\"],\n plugins: [\n // Extract content from components into dictionaries\n [intlayerExtractBabelPlugin, getExtractPluginOptions()],\n // Optimize imports by replacing useIntlayer with direct dictionary imports\n [intlayerOptimizeBabelPlugin, getOptimizePluginOptions()],\n ],\n};\n`;\n\n/**\n * Reads the project dependencies and detects which framework the compiler\n * should target. Next.js is checked before Vite because a Next.js project may\n * transitively depend on Vite tooling.\n */\nconst detectCompilerFramework = (root: string): CompilerFramework => {\n try {\n const packageJsonPath = join(root, 'package.json');\n if (!existsSync(packageJsonPath)) return 'unknown';\n\n const { dependencies = {}, devDependencies = {} } = JSON.parse(\n readFileSync(packageJsonPath, 'utf-8')\n );\n const allDependencies = { ...dependencies, ...devDependencies };\n\n if (allDependencies.next) return 'nextjs';\n if (allDependencies.vite) return 'vite';\n\n return 'unknown';\n } catch {\n return 'unknown';\n }\n};\n\n/**\n * Scaffolds the Intlayer compiler for the current project during interactive\n * init.\n *\n * - **Vite** — nothing to do: since v9 the compiler is built into the\n * `intlayer()` plugin in `vite.config.ts`, so this only confirms the setup\n * to the user.\n * - **Next.js** — installs `@intlayer/babel` and writes a `babel.config.js`\n * that runs the extract + optimize compiler passes.\n *\n * In non-interactive init this function is never called, so the compiler setup\n * is left untouched.\n */\nexport const initCompiler = async (projectRoot?: string): Promise<void> => {\n const root = findProjectRoot(\n projectRoot ? resolve(projectRoot) : process.cwd()\n );\n\n const framework = detectCompilerFramework(root);\n\n if (framework === 'vite') {\n // Since v9 the compiler is bundled inside intlayer() — nothing to scaffold.\n p.log.info(\n 'Vite detected — the compiler is built into `intlayer()` in your vite.config. Nothing to configure.'\n );\n return;\n }\n\n if (framework !== 'nextjs') {\n p.log.warn(\n 'No supported framework detected for the compiler — skipping. See the compiler docs for manual setup.'\n );\n return;\n }\n\n p.intro('Configuring the Intlayer compiler for Next.js');\n\n const packageManager = detectPackageManager(root);\n const devPackagesToInstall = ['@intlayer/babel'];\n\n const spinner = p.spinner();\n spinner.start('Installing packages...');\n\n try {\n installPackages(root, devPackagesToInstall, packageManager, true);\n spinner.stop(`Installed: ${devPackagesToInstall.join(', ')}`);\n } catch {\n spinner.stop('Package installation failed');\n p.log.warn(\n `Please install manually: ${devPackagesToInstall.join(' ')} (dev dependency)`\n );\n }\n\n const babelConfigCandidates = [\n 'babel.config.js',\n 'babel.config.cjs',\n 'babel.config.mjs',\n 'babel.config.ts',\n '.babelrc',\n '.babelrc.js',\n ];\n\n const existingBabelConfig = babelConfigCandidates.find((file) =>\n existsSync(join(root, file))\n );\n\n if (existingBabelConfig) {\n p.log.warn(\n `${existingBabelConfig} already exists — add the Intlayer compiler plugins manually.`\n );\n p.note(\n BABEL_COMPILER_CONFIG_CONTENT,\n 'Plugins to add to your babel config'\n );\n } else {\n try {\n writeFileSync(\n join(root, 'babel.config.js'),\n BABEL_COMPILER_CONFIG_CONTENT,\n { encoding: 'utf-8' }\n );\n p.log.success(\n 'Created babel.config.js with the Intlayer compiler extract and optimize plugins'\n );\n } catch {\n p.log.warn(\n 'Could not create babel.config.js — please create it manually.'\n );\n p.note(BABEL_COMPILER_CONFIG_CONTENT, 'babel.config.js');\n }\n }\n\n p.outro('Compiler configuration complete');\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAkBA,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;AAuBtC,MAAM,2BAA2B,SAAoC;AACnE,KAAI;EACF,MAAM,sCAAuB,MAAM,eAAe;AAClD,MAAI,yBAAY,gBAAgB,CAAE,QAAO;EAEzC,MAAM,EAAE,eAAe,EAAE,EAAE,kBAAkB,EAAE,KAAK,KAAK,gCAC1C,iBAAiB,QAAQ,CACvC;EACD,MAAM,kBAAkB;GAAE,GAAG;GAAc,GAAG;GAAiB;AAE/D,MAAI,gBAAgB,KAAM,QAAO;AACjC,MAAI,gBAAgB,KAAM,QAAO;AAEjC,SAAO;SACD;AACN,SAAO;;;;;;;;;;;;;;;;AAiBX,MAAa,eAAe,OAAO,gBAAwC;CACzE,MAAM,OAAOA,6BACX,qCAAsB,YAAY,GAAG,QAAQ,KAAK,CACnD;CAED,MAAM,YAAY,wBAAwB,KAAK;AAE/C,KAAI,cAAc,QAAQ;AAExB,iBAAE,IAAI,KACJ,qGACD;AACD;;AAGF,KAAI,cAAc,UAAU;AAC1B,iBAAE,IAAI,KACJ,uGACD;AACD;;AAGF,gBAAE,MAAM,gDAAgD;CAExD,MAAM,kEAAsC,KAAK;CACjD,MAAM,uBAAuB,CAAC,kBAAkB;CAEhD,MAAM,UAAUC,eAAE,SAAS;AAC3B,SAAQ,MAAM,yBAAyB;AAEvC,KAAI;AACF,8CAAgB,MAAM,sBAAsB,gBAAgB,KAAK;AACjE,UAAQ,KAAK,cAAc,qBAAqB,KAAK,KAAK,GAAG;SACvD;AACN,UAAQ,KAAK,8BAA8B;AAC3C,iBAAE,IAAI,KACJ,4BAA4B,qBAAqB,KAAK,IAAI,CAAC,mBAC5D;;CAYH,MAAM,sBAAsB;EAR1B;EACA;EACA;EACA;EACA;EACA;EAG+C,CAAC,MAAM,qDACtC,MAAM,KAAK,CAAC,CAC7B;AAED,KAAI,qBAAqB;AACvB,iBAAE,IAAI,KACJ,GAAG,oBAAoB,+DACxB;AACD,iBAAE,KACA,+BACA,sCACD;OAED,KAAI;AACF,iDACO,MAAM,kBAAkB,EAC7B,+BACA,EAAE,UAAU,SAAS,CACtB;AACD,iBAAE,IAAI,QACJ,kFACD;SACK;AACN,iBAAE,IAAI,KACJ,gEACD;AACD,iBAAE,KAAK,+BAA+B,kBAAkB;;AAI5D,gBAAE,MAAM,kCAAkC"}
1
+ {"version":3,"file":"initCompiler.cjs","names":["findProjectRoot","p"],"sources":["../../src/initCompiler.ts"],"sourcesContent":["import { existsSync, readFileSync, writeFileSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\nimport * as p from '@clack/prompts';\nimport { detectPackageManager, installPackages } from '@intlayer/engine/cli';\nimport { findProjectRoot } from './init';\n\n/** Framework the Intlayer compiler can be wired into during init. */\ntype CompilerFramework = 'vite' | 'nextjs' | 'unknown';\n\n/**\n * babel.config.js that runs the Intlayer compiler passes for Next.js.\n *\n * Mirrors the Next.js (Babel) tab of `docs/docs/en/compiler.md`: the extract\n * plugin pulls inline content into dictionaries and the optimize plugin\n * rewrites `useIntlayer` into direct dictionary imports. On Vite the same work\n * is handled by the `intlayer()` plugin (which bundles the compiler in v9), so\n * no Babel config is needed.\n */\nconst BABEL_COMPILER_CONFIG_CONTENT = `const {\n intlayerExtractBabelPlugin,\n intlayerOptimizeBabelPlugin,\n getExtractPluginOptions,\n getOptimizePluginOptions,\n} = require(\"@intlayer/babel\");\n\nmodule.exports = {\n presets: [\"next/babel\"],\n plugins: [\n // Extract content from components into dictionaries\n [intlayerExtractBabelPlugin, getExtractPluginOptions()],\n // Optimize imports by replacing useIntlayer with direct dictionary imports\n [intlayerOptimizeBabelPlugin, getOptimizePluginOptions()],\n ],\n};\n`;\n\n/**\n * Reads the project dependencies and detects which framework the compiler\n * should target. Next.js is checked before Vite because a Next.js project may\n * transitively depend on Vite tooling.\n */\nconst detectCompilerFramework = (root: string): CompilerFramework => {\n try {\n const packageJsonPath = join(root, 'package.json');\n if (!existsSync(packageJsonPath)) return 'unknown';\n\n const { dependencies = {}, devDependencies = {} } = JSON.parse(\n readFileSync(packageJsonPath, 'utf-8')\n );\n const allDependencies = { ...dependencies, ...devDependencies };\n\n if (allDependencies.next) return 'nextjs';\n if (allDependencies.vite) return 'vite';\n\n return 'unknown';\n } catch {\n return 'unknown';\n }\n};\n\n/**\n * Scaffolds the Intlayer compiler for the current project during interactive\n * init.\n *\n * - **Vite** — nothing to do: since v9 the compiler is built into the\n * `intlayer()` plugin in `vite.config.ts`, so this only confirms the setup\n * to the user.\n * - **Next.js** — installs `@intlayer/babel` and writes a `babel.config.js`\n * that runs the extract + optimize compiler passes.\n *\n * In non-interactive init this function is never called, so the compiler setup\n * is left untouched.\n */\nexport const initCompiler = async (projectRoot?: string): Promise<void> => {\n const root = findProjectRoot(\n projectRoot ? resolve(projectRoot) : process.cwd()\n );\n\n const framework = detectCompilerFramework(root);\n\n if (framework === 'vite') {\n // Since v9 the compiler is bundled inside intlayer() — nothing to scaffold.\n p.log.info(\n 'Vite detected — the compiler is built into `intlayer()` in your vite.config. Nothing to configure.'\n );\n return;\n }\n\n if (framework !== 'nextjs') {\n p.log.warn(\n 'No supported framework detected for the compiler — skipping. See the compiler docs for manual setup.'\n );\n return;\n }\n\n p.intro('Configuring the Intlayer compiler for Next.js');\n\n const packageManager = detectPackageManager(root);\n const devPackagesToInstall = ['@intlayer/babel'];\n\n const spinner = p.spinner();\n spinner.start('Installing packages...');\n\n try {\n installPackages(root, devPackagesToInstall, packageManager, true);\n spinner.stop(`Installed: ${devPackagesToInstall.join(', ')}`);\n } catch {\n spinner.stop('Package installation failed');\n p.log.warn(\n `Please install manually: ${devPackagesToInstall.join(' ')} (dev dependency)`\n );\n }\n\n const babelConfigCandidates = [\n 'babel.config.js',\n 'babel.config.cjs',\n 'babel.config.mjs',\n 'babel.config.ts',\n '.babelrc',\n '.babelrc.js',\n ];\n\n const existingBabelConfig = babelConfigCandidates.find((file) =>\n existsSync(join(root, file))\n );\n\n if (existingBabelConfig) {\n p.log.warn(\n `${existingBabelConfig} already exists — add the Intlayer compiler plugins manually.`\n );\n p.note(\n BABEL_COMPILER_CONFIG_CONTENT,\n 'Plugins to add to your babel config'\n );\n } else {\n try {\n writeFileSync(\n join(root, 'babel.config.js'),\n BABEL_COMPILER_CONFIG_CONTENT,\n { encoding: 'utf-8' }\n );\n p.log.success(\n 'Created babel.config.js with the Intlayer compiler extract and optimize plugins'\n );\n } catch {\n p.log.warn(\n 'Could not create babel.config.js — please create it manually.'\n );\n p.note(BABEL_COMPILER_CONFIG_CONTENT, 'babel.config.js');\n }\n }\n\n p.outro('Compiler configuration complete');\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAkBA,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;AAuBtC,MAAM,2BAA2B,SAAoC;AACnE,KAAI;EACF,MAAM,sCAAuB,MAAM,eAAe;AAClD,MAAI,yBAAY,gBAAgB,CAAE,QAAO;EAEzC,MAAM,E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;AAI5D,gBAAE,MAAM,kCAAkC"}
@@ -3,7 +3,7 @@ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
3
  const require_initSkills = require('./initSkills.cjs');
4
4
  const require_init = require('./init.cjs');
5
5
  let node_path = require("node:path");
6
- let _intlayer_chokidar_cli = require("@intlayer/chokidar/cli");
6
+ let _intlayer_engine_cli = require("@intlayer/engine/cli");
7
7
  let enquirer = require("enquirer");
8
8
  enquirer = require_runtime.__toESM(enquirer);
9
9
  let _clack_prompts = require("@clack/prompts");
@@ -23,7 +23,7 @@ const initMCP = async (projectRoot, preselectedPlatform) => {
23
23
  name: "platforms",
24
24
  message: "Which platform are you using? (Type to search)",
25
25
  multiple: false,
26
- initial: detectedPlatform ? _intlayer_chokidar_cli.PLATFORMS.indexOf(detectedPlatform) : void 0,
26
+ initial: detectedPlatform ? _intlayer_engine_cli.PLATFORMS.indexOf(detectedPlatform) : void 0,
27
27
  choices: require_initSkills.PLATFORM_OPTIONS.map((opt) => ({
28
28
  name: opt.value,
29
29
  message: opt.label,
@@ -58,7 +58,7 @@ const initMCP = async (projectRoot, preselectedPlatform) => {
58
58
  const s = _clack_prompts.spinner();
59
59
  s.start("Configuring MCP Server...");
60
60
  try {
61
- const result = await (0, _intlayer_chokidar_cli.installMCP)(root, platform, transport);
61
+ const result = await (0, _intlayer_engine_cli.installMCP)(root, platform, transport);
62
62
  s.stop("MCP Server configured successfully");
63
63
  _clack_prompts.note(result, "Success");
64
64
  } catch (error) {
@@ -1 +1 @@
1
- {"version":3,"file":"initMCP.cjs","names":["findProjectRoot","getDetectedPlatform","PLATFORMS","PLATFORM_OPTIONS","p"],"sources":["../../src/initMCP.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport * as p from '@clack/prompts';\nimport {\n installMCP,\n type MCPTransport,\n PLATFORMS,\n type Platform,\n} from '@intlayer/chokidar/cli';\nimport enquirer from 'enquirer';\nimport { findProjectRoot } from './init';\nimport { getDetectedPlatform, PLATFORM_OPTIONS } from './initSkills';\n\nexport const initMCP = async (\n projectRoot?: string,\n preselectedPlatform?: Platform\n) => {\n const root = findProjectRoot(\n projectRoot ? resolve(projectRoot) : process.cwd()\n );\n\n p.intro('Initializing Intlayer MCP Server');\n\n let platform: Platform;\n\n if (preselectedPlatform) {\n platform = preselectedPlatform;\n } else {\n const detectedPlatform = getDetectedPlatform();\n\n try {\n const response = await enquirer.prompt<{ platforms: Platform }>({\n type: 'autocomplete',\n name: 'platforms',\n message: 'Which platform are you using? (Type to search)',\n multiple: false,\n initial: detectedPlatform\n ? PLATFORMS.indexOf(detectedPlatform)\n : undefined,\n choices: PLATFORM_OPTIONS.map((opt) => ({\n name: opt.value,\n message: opt.label,\n hint: opt.hint,\n })),\n });\n platform = response.platforms;\n } catch {\n p.cancel('Operation cancelled.');\n return;\n }\n }\n\n if (!platform) {\n p.cancel('Operation cancelled. No platform selected.');\n return;\n }\n\n const transport = (await p.select({\n message: 'Which transport method do you want to use?',\n options: [\n {\n value: 'stdio',\n label: 'Local server (stdio)',\n hint: 'Recommended. Integrates all features including CLI tools.',\n },\n {\n value: 'sse',\n label: 'Remote server (SSE)',\n hint: 'Hosted by Intlayer. Documentation only.',\n },\n ],\n })) as MCPTransport;\n\n if (p.isCancel(transport) || !transport) {\n p.cancel('Operation cancelled.');\n return;\n }\n\n const s = p.spinner();\n s.start('Configuring MCP Server...');\n\n try {\n const result = await installMCP(root, platform, transport);\n\n s.stop('MCP Server configured successfully');\n\n p.note(result, 'Success');\n } catch (error) {\n s.stop('Failed to configure MCP Server');\n p.log.error(error instanceof Error ? error.message : String(error));\n }\n\n p.outro('Intlayer MCP Server initialization complete');\n};\n"],"mappings":";;;;;;;;;;;;AAYA,MAAa,UAAU,OACrB,aACA,wBACG;CACH,MAAM,OAAOA,6BACX,qCAAsB,YAAY,GAAG,QAAQ,KAAK,CACnD;AAED,gBAAE,MAAM,mCAAmC;CAE3C,IAAI;AAEJ,KAAI,oBACF,YAAW;MACN;EACL,MAAM,mBAAmBC,wCAAqB;AAE9C,MAAI;AAeF,eAAW,MAdY,iBAAS,OAAgC;IAC9D,MAAM;IACN,MAAM;IACN,SAAS;IACT,UAAU;IACV,SAAS,mBACLC,iCAAU,QAAQ,iBAAiB,GACnC;IACJ,SAASC,oCAAiB,KAAK,SAAS;KACtC,MAAM,IAAI;KACV,SAAS,IAAI;KACb,MAAM,IAAI;KACX,EAAE;IACJ,CAAC,EACkB;UACd;AACN,kBAAE,OAAO,uBAAuB;AAChC;;;AAIJ,KAAI,CAAC,UAAU;AACb,iBAAE,OAAO,6CAA6C;AACtD;;CAGF,MAAM,YAAa,MAAMC,eAAE,OAAO;EAChC,SAAS;EACT,SAAS,CACP;GACE,OAAO;GACP,OAAO;GACP,MAAM;GACP,EACD;GACE,OAAO;GACP,OAAO;GACP,MAAM;GACP,CACF;EACF,CAAC;AAEF,KAAIA,eAAE,SAAS,UAAU,IAAI,CAAC,WAAW;AACvC,iBAAE,OAAO,uBAAuB;AAChC;;CAGF,MAAM,IAAIA,eAAE,SAAS;AACrB,GAAE,MAAM,4BAA4B;AAEpC,KAAI;EACF,MAAM,SAAS,6CAAiB,MAAM,UAAU,UAAU;AAE1D,IAAE,KAAK,qCAAqC;AAE5C,iBAAE,KAAK,QAAQ,UAAU;UAClB,OAAO;AACd,IAAE,KAAK,iCAAiC;AACxC,iBAAE,IAAI,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,CAAC;;AAGrE,gBAAE,MAAM,8CAA8C"}
1
+ {"version":3,"file":"initMCP.cjs","names":["findProjectRoot","getDetectedPlatform","PLATFORMS","PLATFORM_OPTIONS","p"],"sources":["../../src/initMCP.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport * as p from '@clack/prompts';\nimport {\n installMCP,\n type MCPTransport,\n PLATFORMS,\n type Platform,\n} from '@intlayer/engine/cli';\nimport enquirer from 'enquirer';\nimport { findProjectRoot } from './init';\nimport { getDetectedPlatform, PLATFORM_OPTIONS } from './initSkills';\n\nexport const initMCP = async (\n projectRoot?: string,\n preselectedPlatform?: Platform\n) => {\n const root = findProjectRoot(\n projectRoot ? resolve(projectRoot) : process.cwd()\n );\n\n p.intro('Initializing Intlayer MCP Server');\n\n let platform: Platform;\n\n if (preselectedPlatform) {\n platform = preselectedPlatform;\n } else {\n const detectedPlatform = getDetectedPlatform();\n\n try {\n const response = await enquirer.prompt<{ platforms: Platform }>({\n type: 'autocomplete',\n name: 'platforms',\n message: 'Which platform are you using? (Type to search)',\n multiple: false,\n initial: detectedPlatform\n ? PLATFORMS.indexOf(detectedPlatform)\n : undefined,\n choices: PLATFORM_OPTIONS.map((opt) => ({\n name: opt.value,\n message: opt.label,\n hint: opt.hint,\n })),\n });\n platform = response.platforms;\n } catch {\n p.cancel('Operation cancelled.');\n return;\n }\n }\n\n if (!platform) {\n p.cancel('Operation cancelled. No platform selected.');\n return;\n }\n\n const transport = (await p.select({\n message: 'Which transport method do you want to use?',\n options: [\n {\n value: 'stdio',\n label: 'Local server (stdio)',\n hint: 'Recommended. Integrates all features including CLI tools.',\n },\n {\n value: 'sse',\n label: 'Remote server (SSE)',\n hint: 'Hosted by Intlayer. Documentation only.',\n },\n ],\n })) as MCPTransport;\n\n if (p.isCancel(transport) || !transport) {\n p.cancel('Operation cancelled.');\n return;\n }\n\n const s = p.spinner();\n s.start('Configuring MCP Server...');\n\n try {\n const result = await installMCP(root, platform, transport);\n\n s.stop('MCP Server configured successfully');\n\n p.note(result, 'Success');\n } catch (error) {\n s.stop('Failed to configure MCP Server');\n p.log.error(error instanceof Error ? error.message : String(error));\n }\n\n p.outro('Intlayer MCP Server initialization complete');\n};\n"],"mappings":";;;;;;;;;;;;AAYA,MAAa,UAAU,OACrB,aACA,wBACG;CACH,MAAM,OAAOA,6BACX,qCAAsB,YAAY,GAAG,QAAQ,KAAK,CACnD;AAED,gBAAE,MAAM,mCAAmC;CAE3C,IAAI;AAEJ,KAAI,oBACF,YAAW;MACN;EACL,MAAM,mBAAmBC,wCAAqB;AAE9C,MAAI;AAeF,eAAW,MAdY,iBAAS,OAAgC;IAC9D,MAAM;IACN,MAAM;IACN,SAAS;IACT,UAAU;IACV,SAAS,mBACLC,+BAAU,QAAQ,iBAAiB,GACnC;IACJ,SAASC,oCAAiB,KAAK,SAAS;KACtC,MAAM,IAAI;KACV,SAAS,IAAI;KACb,MAAM,IAAI;KACX,EAAE;IACJ,CAAC,EACkB;UACd;AACN,kBAAE,OAAO,uBAAuB;AAChC;;;AAIJ,KAAI,CAAC,UAAU;AACb,iBAAE,OAAO,6CAA6C;AACtD;;CAGF,MAAM,YAAa,MAAMC,eAAE,OAAO;EAChC,SAAS;EACT,SAAS,CACP;GACE,OAAO;GACP,OAAO;GACP,MAAM;GACP,EACD;GACE,OAAO;GACP,OAAO;GACP,MAAM;GACP,CACF;EACF,CAAC;AAEF,KAAIA,eAAE,SAAS,UAAU,IAAI,CAAC,WAAW;AACvC,iBAAE,OAAO,uBAAuB;AAChC;;CAGF,MAAM,IAAIA,eAAE,SAAS;AACrB,GAAE,MAAM,4BAA4B;AAEpC,KAAI;EACF,MAAM,SAAS,2CAAiB,MAAM,UAAU,UAAU;AAE1D,IAAE,KAAK,qCAAqC;AAE5C,iBAAE,KAAK,QAAQ,UAAU;UAClB,OAAO;AACd,IAAE,KAAK,iCAAiC;AACxC,iBAAE,IAAI,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,CAAC;;AAGrE,gBAAE,MAAM,8CAA8C"}
@@ -3,21 +3,21 @@ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
3
  const require_init = require('./init.cjs');
4
4
  let node_fs = require("node:fs");
5
5
  let node_path = require("node:path");
6
- let _intlayer_chokidar_cli = require("@intlayer/chokidar/cli");
6
+ let _intlayer_engine_cli = require("@intlayer/engine/cli");
7
7
  let enquirer = require("enquirer");
8
8
  enquirer = require_runtime.__toESM(enquirer);
9
9
  let _clack_prompts = require("@clack/prompts");
10
10
  _clack_prompts = require_runtime.__toESM(_clack_prompts);
11
11
 
12
12
  //#region src/initSkills.ts
13
- const PLATFORM_CHECKS = _intlayer_chokidar_cli.PLATFORMS.filter((platform) => _intlayer_chokidar_cli.PLATFORMS_METADATA[platform]?.check).map((platform) => ({
14
- check: _intlayer_chokidar_cli.PLATFORMS_METADATA[platform]?.check ?? (() => false),
13
+ const PLATFORM_CHECKS = _intlayer_engine_cli.PLATFORMS.filter((platform) => _intlayer_engine_cli.PLATFORMS_METADATA[platform]?.check).map((platform) => ({
14
+ check: _intlayer_engine_cli.PLATFORMS_METADATA[platform]?.check ?? (() => false),
15
15
  platform
16
16
  }));
17
- const PLATFORM_OPTIONS = _intlayer_chokidar_cli.PLATFORMS.map((platform) => ({
17
+ const PLATFORM_OPTIONS = _intlayer_engine_cli.PLATFORMS.map((platform) => ({
18
18
  value: platform,
19
- label: _intlayer_chokidar_cli.PLATFORMS_METADATA[platform]?.label ?? "",
20
- hint: `(${_intlayer_chokidar_cli.PLATFORMS_METADATA[platform]?.dir})`
19
+ label: _intlayer_engine_cli.PLATFORMS_METADATA[platform]?.label ?? "",
20
+ hint: `(${_intlayer_engine_cli.PLATFORMS_METADATA[platform]?.dir})`
21
21
  }));
22
22
  const getDetectedPlatform = () => PLATFORM_CHECKS.find(({ check }) => check())?.platform;
23
23
  const getDependencies = (root) => {
@@ -46,7 +46,7 @@ const initSkills = async (projectRoot, preselectedPlatform) => {
46
46
  name: "platforms",
47
47
  message: "Which platforms are you using? (Type to search)",
48
48
  multiple: false,
49
- initial: detectedPlatform ? _intlayer_chokidar_cli.PLATFORMS.indexOf(detectedPlatform) : void 0,
49
+ initial: detectedPlatform ? _intlayer_engine_cli.PLATFORMS.indexOf(detectedPlatform) : void 0,
50
50
  choices: PLATFORM_OPTIONS.map((opt) => ({
51
51
  name: opt.value,
52
52
  message: opt.label,
@@ -62,14 +62,14 @@ const initSkills = async (projectRoot, preselectedPlatform) => {
62
62
  _clack_prompts.log.warn("No platform selected. Nothing to install.");
63
63
  return;
64
64
  }
65
- const initialValues = (0, _intlayer_chokidar_cli.getInitialSkills)(getDependencies(root));
65
+ const initialValues = (0, _intlayer_engine_cli.getInitialSkills)(getDependencies(root));
66
66
  const selectedSkills = await _clack_prompts.multiselect({
67
67
  message: "Select the documentation skills to provide to your AI:",
68
68
  initialValues,
69
- options: _intlayer_chokidar_cli.SKILLS.map((skill) => ({
69
+ options: _intlayer_engine_cli.SKILLS.map((skill) => ({
70
70
  value: skill,
71
71
  label: skill,
72
- hint: _intlayer_chokidar_cli.SKILLS_METADATA[skill]
72
+ hint: _intlayer_engine_cli.SKILLS_METADATA[skill]
73
73
  })),
74
74
  required: false
75
75
  });
@@ -80,7 +80,7 @@ const initSkills = async (projectRoot, preselectedPlatform) => {
80
80
  const s = _clack_prompts.spinner();
81
81
  s.start("Installing skills...");
82
82
  try {
83
- const result = await (0, _intlayer_chokidar_cli.installSkills)(root, platform, selectedSkills);
83
+ const result = await (0, _intlayer_engine_cli.installSkills)(root, platform, selectedSkills);
84
84
  s.stop("Skills installed successfully");
85
85
  _clack_prompts.note(result, "Success");
86
86
  } catch (error) {
@@ -1 +1 @@
1
- {"version":3,"file":"initSkills.cjs","names":["PLATFORMS","PLATFORMS_METADATA","findProjectRoot","p","SKILLS","SKILLS_METADATA"],"sources":["../../src/initSkills.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\nimport * as p from '@clack/prompts';\nimport {\n getInitialSkills,\n installSkills,\n PLATFORMS,\n PLATFORMS_METADATA,\n type Platform,\n SKILLS,\n SKILLS_METADATA,\n} from '@intlayer/chokidar/cli';\nimport enquirer from 'enquirer';\nimport { findProjectRoot } from './init';\n\nconst PLATFORM_CHECKS: Array<{ check: () => boolean; platform: Platform }> =\n PLATFORMS.filter((platform) => PLATFORMS_METADATA[platform]?.check).map(\n (platform) => ({\n check: PLATFORMS_METADATA[platform]?.check ?? (() => false),\n platform,\n })\n );\n\nexport const PLATFORM_OPTIONS: Array<{\n value: Platform;\n label: string;\n hint: string;\n}> = PLATFORMS.map((platform) => ({\n value: platform,\n label: PLATFORMS_METADATA[platform]?.label ?? '',\n hint: `(${PLATFORMS_METADATA[platform]?.dir})`,\n}));\n\nexport const getDetectedPlatform = (): Platform | undefined =>\n PLATFORM_CHECKS.find(({ check }) => check())?.platform;\n\nconst getDependencies = (root: string): Record<string, string> => {\n try {\n const packageJsonPath = join(root, 'package.json');\n if (!existsSync(packageJsonPath)) return {};\n\n const { dependencies = {}, devDependencies = {} } = JSON.parse(\n readFileSync(packageJsonPath, 'utf-8')\n );\n return { ...dependencies, ...devDependencies };\n } catch {\n return {};\n }\n};\n\nexport const initSkills = async (\n projectRoot?: string,\n preselectedPlatform?: Platform\n) => {\n const root = findProjectRoot(\n projectRoot ? resolve(projectRoot) : process.cwd()\n );\n\n p.intro('Initializing Intlayer skills');\n\n let platform: Platform;\n\n if (preselectedPlatform) {\n platform = preselectedPlatform;\n } else {\n const detectedPlatform = getDetectedPlatform();\n\n try {\n const response = await enquirer.prompt<{ platforms: Platform }>({\n type: 'autocomplete',\n name: 'platforms',\n message: 'Which platforms are you using? (Type to search)',\n multiple: false,\n initial: detectedPlatform\n ? PLATFORMS.indexOf(detectedPlatform)\n : undefined,\n choices: PLATFORM_OPTIONS.map((opt) => ({\n name: opt.value,\n message: opt.label,\n hint: opt.hint,\n })),\n });\n platform = response.platforms;\n } catch {\n p.cancel('Operation cancelled.');\n return;\n }\n }\n\n if (!platform) {\n p.log.warn('No platform selected. Nothing to install.');\n return;\n }\n\n const dependencies = getDependencies(root);\n const initialValues = getInitialSkills(dependencies);\n\n const selectedSkills = await p.multiselect({\n message: 'Select the documentation skills to provide to your AI:',\n initialValues,\n options: SKILLS.map((skill) => ({\n value: skill,\n label: skill,\n hint: SKILLS_METADATA[skill],\n })),\n required: false,\n });\n\n if (\n p.isCancel(selectedSkills) ||\n !selectedSkills ||\n (selectedSkills as string[]).length === 0\n ) {\n p.cancel('Operation cancelled. No skills selected.');\n return;\n }\n\n const s = p.spinner();\n s.start('Installing skills...');\n\n try {\n const result = await installSkills(root, platform, selectedSkills);\n\n s.stop('Skills installed successfully');\n\n p.note(result, 'Success');\n } catch (error) {\n s.stop('Failed to install skills');\n p.log.error(error instanceof Error ? error.message : String(error));\n }\n\n p.outro('Intlayer skills initialization complete');\n};\n"],"mappings":";;;;;;;;;;;;AAeA,MAAM,kBACJA,iCAAU,QAAQ,aAAaC,0CAAmB,WAAW,MAAM,CAAC,KACjE,cAAc;CACb,OAAOA,0CAAmB,WAAW,gBAAgB;CACrD;CACD,EACF;AAEH,MAAa,mBAIRD,iCAAU,KAAK,cAAc;CAChC,OAAO;CACP,OAAOC,0CAAmB,WAAW,SAAS;CAC9C,MAAM,IAAIA,0CAAmB,WAAW,IAAI;CAC7C,EAAE;AAEH,MAAa,4BACX,gBAAgB,MAAM,EAAE,YAAY,OAAO,CAAC,EAAE;AAEhD,MAAM,mBAAmB,SAAyC;AAChE,KAAI;EACF,MAAM,sCAAuB,MAAM,eAAe;AAClD,MAAI,yBAAY,gBAAgB,CAAE,QAAO,EAAE;EAE3C,MAAM,EAAE,eAAe,EAAE,EAAE,kBAAkB,EAAE,KAAK,KAAK,gCAC1C,iBAAiB,QAAQ,CACvC;AACD,SAAO;GAAE,GAAG;GAAc,GAAG;GAAiB;SACxC;AACN,SAAO,EAAE;;;AAIb,MAAa,aAAa,OACxB,aACA,wBACG;CACH,MAAM,OAAOC,6BACX,qCAAsB,YAAY,GAAG,QAAQ,KAAK,CACnD;AAED,gBAAE,MAAM,+BAA+B;CAEvC,IAAI;AAEJ,KAAI,oBACF,YAAW;MACN;EACL,MAAM,mBAAmB,qBAAqB;AAE9C,MAAI;AAeF,eAAW,MAdY,iBAAS,OAAgC;IAC9D,MAAM;IACN,MAAM;IACN,SAAS;IACT,UAAU;IACV,SAAS,mBACLF,iCAAU,QAAQ,iBAAiB,GACnC;IACJ,SAAS,iBAAiB,KAAK,SAAS;KACtC,MAAM,IAAI;KACV,SAAS,IAAI;KACb,MAAM,IAAI;KACX,EAAE;IACJ,CAAC,EACkB;UACd;AACN,kBAAE,OAAO,uBAAuB;AAChC;;;AAIJ,KAAI,CAAC,UAAU;AACb,iBAAE,IAAI,KAAK,4CAA4C;AACvD;;CAIF,MAAM,6DADe,gBAAgB,KACc,CAAC;CAEpD,MAAM,iBAAiB,MAAMG,eAAE,YAAY;EACzC,SAAS;EACT;EACA,SAASC,8BAAO,KAAK,WAAW;GAC9B,OAAO;GACP,OAAO;GACP,MAAMC,uCAAgB;GACvB,EAAE;EACH,UAAU;EACX,CAAC;AAEF,KACEF,eAAE,SAAS,eAAe,IAC1B,CAAC,kBACA,eAA4B,WAAW,GACxC;AACA,iBAAE,OAAO,2CAA2C;AACpD;;CAGF,MAAM,IAAIA,eAAE,SAAS;AACrB,GAAE,MAAM,uBAAuB;AAE/B,KAAI;EACF,MAAM,SAAS,gDAAoB,MAAM,UAAU,eAAe;AAElE,IAAE,KAAK,gCAAgC;AAEvC,iBAAE,KAAK,QAAQ,UAAU;UAClB,OAAO;AACd,IAAE,KAAK,2BAA2B;AAClC,iBAAE,IAAI,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,CAAC;;AAGrE,gBAAE,MAAM,0CAA0C"}
1
+ {"version":3,"file":"initSkills.cjs","names":["PLATFORMS","PLATFORMS_METADATA","findProjectRoot","p","SKILLS","SKILLS_METADATA"],"sources":["../../src/initSkills.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\nimport * as p from '@clack/prompts';\nimport {\n getInitialSkills,\n installSkills,\n PLATFORMS,\n PLATFORMS_METADATA,\n type Platform,\n SKILLS,\n SKILLS_METADATA,\n} from '@intlayer/engine/cli';\nimport enquirer from 'enquirer';\nimport { findProjectRoot } from './init';\n\nconst PLATFORM_CHECKS: Array<{ check: () => boolean; platform: Platform }> =\n PLATFORMS.filter((platform) => PLATFORMS_METADATA[platform]?.check).map(\n (platform) => ({\n check: PLATFORMS_METADATA[platform]?.check ?? (() => false),\n platform,\n })\n );\n\nexport const PLATFORM_OPTIONS: Array<{\n value: Platform;\n label: string;\n hint: string;\n}> = PLATFORMS.map((platform) => ({\n value: platform,\n label: PLATFORMS_METADATA[platform]?.label ?? '',\n hint: `(${PLATFORMS_METADATA[platform]?.dir})`,\n}));\n\nexport const getDetectedPlatform = (): Platform | undefined =>\n PLATFORM_CHECKS.find(({ check }) => check())?.platform;\n\nconst getDependencies = (root: string): Record<string, string> => {\n try {\n const packageJsonPath = join(root, 'package.json');\n if (!existsSync(packageJsonPath)) return {};\n\n const { dependencies = {}, devDependencies = {} } = JSON.parse(\n readFileSync(packageJsonPath, 'utf-8')\n );\n return { ...dependencies, ...devDependencies };\n } catch {\n return {};\n }\n};\n\nexport const initSkills = async (\n projectRoot?: string,\n preselectedPlatform?: Platform\n) => {\n const root = findProjectRoot(\n projectRoot ? resolve(projectRoot) : process.cwd()\n );\n\n p.intro('Initializing Intlayer skills');\n\n let platform: Platform;\n\n if (preselectedPlatform) {\n platform = preselectedPlatform;\n } else {\n const detectedPlatform = getDetectedPlatform();\n\n try {\n const response = await enquirer.prompt<{ platforms: Platform }>({\n type: 'autocomplete',\n name: 'platforms',\n message: 'Which platforms are you using? (Type to search)',\n multiple: false,\n initial: detectedPlatform\n ? PLATFORMS.indexOf(detectedPlatform)\n : undefined,\n choices: PLATFORM_OPTIONS.map((opt) => ({\n name: opt.value,\n message: opt.label,\n hint: opt.hint,\n })),\n });\n platform = response.platforms;\n } catch {\n p.cancel('Operation cancelled.');\n return;\n }\n }\n\n if (!platform) {\n p.log.warn('No platform selected. Nothing to install.');\n return;\n }\n\n const dependencies = getDependencies(root);\n const initialValues = getInitialSkills(dependencies);\n\n const selectedSkills = await p.multiselect({\n message: 'Select the documentation skills to provide to your AI:',\n initialValues,\n options: SKILLS.map((skill) => ({\n value: skill,\n label: skill,\n hint: SKILLS_METADATA[skill],\n })),\n required: false,\n });\n\n if (\n p.isCancel(selectedSkills) ||\n !selectedSkills ||\n (selectedSkills as string[]).length === 0\n ) {\n p.cancel('Operation cancelled. No skills selected.');\n return;\n }\n\n const s = p.spinner();\n s.start('Installing skills...');\n\n try {\n const result = await installSkills(root, platform, selectedSkills);\n\n s.stop('Skills installed successfully');\n\n p.note(result, 'Success');\n } catch (error) {\n s.stop('Failed to install skills');\n p.log.error(error instanceof Error ? error.message : String(error));\n }\n\n p.outro('Intlayer skills initialization complete');\n};\n"],"mappings":";;;;;;;;;;;;AAeA,MAAM,kBACJA,+BAAU,QAAQ,aAAaC,wCAAmB,WAAW,MAAM,CAAC,KACjE,cAAc;CACb,OAAOA,wCAAmB,WAAW,gBAAgB;CACrD;CACD,EACF;AAEH,MAAa,mBAIRD,+BAAU,KAAK,cAAc;CAChC,OAAO;CACP,OAAOC,wCAAmB,WAAW,SAAS;CAC9C,MAAM,IAAIA,wCAAmB,WAAW,IAAI;CAC7C,EAAE;AAEH,MAAa,4BACX,gBAAgB,MAAM,EAAE,YAAY,OAAO,CAAC,EAAE;AAEhD,MAAM,mBAAmB,SAAyC;AAChE,KAAI;EACF,MAAM,sCAAuB,MAAM,eAAe;AAClD,MAAI,yBAAY,gBAAgB,CAAE,QAAO,EAAE;EAE3C,MAAM,EAAE,eAAe,EAAE,EAAE,kBAAkB,EAAE,KAAK,KAAK,gCAC1C,iBAAiB,QAAQ,CACvC;AACD,SAAO;GAAE,GAAG;GAAc,GAAG;GAAiB;SACxC;AACN,SAAO,EAAE;;;AAIb,MAAa,aAAa,OACxB,aACA,wBACG;CACH,MAAM,OAAOC,6BACX,qCAAsB,YAAY,GAAG,QAAQ,KAAK,CACnD;AAED,gBAAE,MAAM,+BAA+B;CAEvC,IAAI;AAEJ,KAAI,oBACF,YAAW;MACN;EACL,MAAM,mBAAmB,qBAAqB;AAE9C,MAAI;AAeF,eAAW,MAdY,iBAAS,OAAgC;IAC9D,MAAM;IACN,MAAM;IACN,SAAS;IACT,UAAU;IACV,SAAS,mBACLF,+BAAU,QAAQ,iBAAiB,GACnC;IACJ,SAAS,iBAAiB,KAAK,SAAS;KACtC,MAAM,IAAI;KACV,SAAS,IAAI;KACb,MAAM,IAAI;KACX,EAAE;IACJ,CAAC,EACkB;UACd;AACN,kBAAE,OAAO,uBAAuB;AAChC;;;AAIJ,KAAI,CAAC,UAAU;AACb,iBAAE,IAAI,KAAK,4CAA4C;AACvD;;CAIF,MAAM,2DADe,gBAAgB,KACc,CAAC;CAEpD,MAAM,iBAAiB,MAAMG,eAAE,YAAY;EACzC,SAAS;EACT;EACA,SAASC,4BAAO,KAAK,WAAW;GAC9B,OAAO;GACP,OAAO;GACP,MAAMC,qCAAgB;GACvB,EAAE;EACH,UAAU;EACX,CAAC;AAEF,KACEF,eAAE,SAAS,eAAe,IAC1B,CAAC,kBACA,eAA4B,WAAW,GACxC;AACA,iBAAE,OAAO,2CAA2C;AACpD;;CAGF,MAAM,IAAIA,eAAE,SAAS;AACrB,GAAE,MAAM,uBAAuB;AAE/B,KAAI;EACF,MAAM,SAAS,8CAAoB,MAAM,UAAU,eAAe;AAElE,IAAE,KAAK,gCAAgC;AAEvC,iBAAE,KAAK,QAAQ,UAAU;UAClB,OAAO;AACd,IAAE,KAAK,2BAA2B;AAClC,iBAAE,IAAI,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,CAAC;;AAGrE,gBAAE,MAAM,0CAA0C"}
@@ -1,16 +1,16 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
3
  let node_path = require("node:path");
4
- let _intlayer_chokidar_cli = require("@intlayer/chokidar/cli");
5
- let _intlayer_chokidar_utils = require("@intlayer/chokidar/utils");
6
4
  let _intlayer_config_logger = require("@intlayer/config/logger");
7
5
  let _intlayer_config_node = require("@intlayer/config/node");
6
+ let _intlayer_engine_cli = require("@intlayer/engine/cli");
7
+ let _intlayer_engine_utils = require("@intlayer/engine/utils");
8
8
  let _intlayer_unmerged_dictionaries_entry = require("@intlayer/unmerged-dictionaries-entry");
9
9
 
10
10
  //#region src/listContentDeclaration.ts
11
11
  const listContentDeclarationRows = async (options) => {
12
12
  const config = (0, _intlayer_config_node.getConfiguration)(options?.configOptions);
13
- await (0, _intlayer_chokidar_cli.prepareIntlayer)(config);
13
+ await (0, _intlayer_engine_cli.prepareIntlayer)(config);
14
14
  const unmergedDictionariesRecord = (0, _intlayer_unmerged_dictionaries_entry.getUnmergedDictionaries)(config);
15
15
  return Object.values(unmergedDictionariesRecord).flat().map((dictionary) => ({
16
16
  key: dictionary.key ?? "",
@@ -30,7 +30,7 @@ const listContentDeclaration = async (options) => {
30
30
  maxSize: 60
31
31
  }),
32
32
  " - ",
33
- (0, _intlayer_chokidar_utils.formatPath)(row.path)
33
+ (0, _intlayer_engine_utils.formatPath)(row.path)
34
34
  ].join(""));
35
35
  appLogger(`Content declaration files:`);
36
36
  lines.forEach((line) => {
@@ -1 +1 @@
1
- {"version":3,"file":"listContentDeclaration.cjs","names":[],"sources":["../../src/listContentDeclaration.ts"],"sourcesContent":["import { relative } from 'node:path';\nimport { prepareIntlayer } from '@intlayer/chokidar/cli';\nimport { formatPath } from '@intlayer/chokidar/utils';\nimport {\n colon,\n colorizeKey,\n colorizeNumber,\n getAppLogger,\n} from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry';\n\ntype ListContentDeclarationOptions = {\n configOptions?: GetConfigurationOptions;\n json?: boolean;\n absolute?: boolean;\n};\n\nexport const listContentDeclarationRows = async (\n options?: ListContentDeclarationOptions\n) => {\n const config = getConfiguration(options?.configOptions);\n\n await prepareIntlayer(config);\n\n const unmergedDictionariesRecord = getUnmergedDictionaries(config);\n\n const rows = Object.values(unmergedDictionariesRecord)\n .flat()\n .map((dictionary) => ({\n key: dictionary.key ?? '',\n path: options?.absolute\n ? (dictionary.filePath ?? 'Remote')\n : relative(config.system.baseDir, dictionary.filePath ?? 'Remote'),\n }));\n return rows;\n};\n\nexport const listContentDeclaration = async (\n options?: ListContentDeclarationOptions\n) => {\n const rows = await listContentDeclarationRows(options);\n\n if (options?.json) {\n console.log(JSON.stringify(rows));\n return;\n }\n\n const config = getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(config);\n\n const lines = rows.map((row) =>\n [\n colon(` - ${colorizeKey(row.key)}`, {\n colSize: rows.map((row) => row.key.length),\n maxSize: 60,\n }),\n ' - ',\n formatPath(row.path),\n ].join('')\n );\n\n appLogger(`Content declaration files:`);\n\n lines.forEach((line) => {\n appLogger(line, {\n level: 'info',\n });\n });\n\n appLogger(`Total content declaration files: ${colorizeNumber(rows.length)}`);\n};\n"],"mappings":";;;;;;;;;;AAqBA,MAAa,6BAA6B,OACxC,YACG;CACH,MAAM,qDAA0B,SAAS,cAAc;AAEvD,mDAAsB,OAAO;CAE7B,MAAM,gGAAqD,OAAO;AAUlE,QARa,OAAO,OAAO,2BAA2B,CACnD,MAAM,CACN,KAAK,gBAAgB;EACpB,KAAK,WAAW,OAAO;EACvB,MAAM,SAAS,WACV,WAAW,YAAY,mCACf,OAAO,OAAO,SAAS,WAAW,YAAY,SAAS;EACrE,EACQ;;AAGb,MAAa,yBAAyB,OACpC,YACG;CACH,MAAM,OAAO,MAAM,2BAA2B,QAAQ;AAEtD,KAAI,SAAS,MAAM;AACjB,UAAQ,IAAI,KAAK,UAAU,KAAK,CAAC;AACjC;;CAIF,MAAM,kGAD0B,SAAS,cACJ,CAAC;CAEtC,MAAM,QAAQ,KAAK,KAAK,QACtB;qCACQ,+CAAkB,IAAI,IAAI,IAAI;GAClC,SAAS,KAAK,KAAK,QAAQ,IAAI,IAAI,OAAO;GAC1C,SAAS;GACV,CAAC;EACF;2CACW,IAAI,KAAK;EACrB,CAAC,KAAK,GAAG,CACX;AAED,WAAU,6BAA6B;AAEvC,OAAM,SAAS,SAAS;AACtB,YAAU,MAAM,EACd,OAAO,QACR,CAAC;GACF;AAEF,WAAU,gFAAmD,KAAK,OAAO,GAAG"}
1
+ {"version":3,"file":"listContentDeclaration.cjs","names":[],"sources":["../../src/listContentDeclaration.ts"],"sourcesContent":["import { relative } from 'node:path';\nimport {\n colon,\n colorizeKey,\n colorizeNumber,\n getAppLogger,\n} from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport { prepareIntlayer } from '@intlayer/engine/cli';\nimport { formatPath } from '@intlayer/engine/utils';\nimport { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry';\n\ntype ListContentDeclarationOptions = {\n configOptions?: GetConfigurationOptions;\n json?: boolean;\n absolute?: boolean;\n};\n\nexport const listContentDeclarationRows = async (\n options?: ListContentDeclarationOptions\n) => {\n const config = getConfiguration(options?.configOptions);\n\n await prepareIntlayer(config);\n\n const unmergedDictionariesRecord = getUnmergedDictionaries(config);\n\n const rows = Object.values(unmergedDictionariesRecord)\n .flat()\n .map((dictionary) => ({\n key: dictionary.key ?? '',\n path: options?.absolute\n ? (dictionary.filePath ?? 'Remote')\n : relative(config.system.baseDir, dictionary.filePath ?? 'Remote'),\n }));\n return rows;\n};\n\nexport const listContentDeclaration = async (\n options?: ListContentDeclarationOptions\n) => {\n const rows = await listContentDeclarationRows(options);\n\n if (options?.json) {\n console.log(JSON.stringify(rows));\n return;\n }\n\n const config = getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(config);\n\n const lines = rows.map((row) =>\n [\n colon(` - ${colorizeKey(row.key)}`, {\n colSize: rows.map((row) => row.key.length),\n maxSize: 60,\n }),\n ' - ',\n formatPath(row.path),\n ].join('')\n );\n\n appLogger(`Content declaration files:`);\n\n lines.forEach((line) => {\n appLogger(line, {\n level: 'info',\n });\n });\n\n appLogger(`Total content declaration files: ${colorizeNumber(rows.length)}`);\n};\n"],"mappings":";;;;;;;;;;AAqBA,MAAa,6BAA6B,OACxC,YACG;CACH,MAAM,qDAA0B,SAAS,cAAc;AAEvD,iDAAsB,OAAO;CAE7B,MAAM,gGAAqD,OAAO;AAUlE,QARa,OAAO,OAAO,2BAA2B,CACnD,MAAM,CACN,KAAK,gBAAgB;EACpB,KAAK,WAAW,OAAO;EACvB,MAAM,SAAS,WACV,WAAW,YAAY,mCACf,OAAO,OAAO,SAAS,WAAW,YAAY,SAAS;EACrE,EACQ;;AAGb,MAAa,yBAAyB,OACpC,YACG;CACH,MAAM,OAAO,MAAM,2BAA2B,QAAQ;AAEtD,KAAI,SAAS,MAAM;AACjB,UAAQ,IAAI,KAAK,UAAU,KAAK,CAAC;AACjC;;CAIF,MAAM,kGAD0B,SAAS,cACJ,CAAC;CAEtC,MAAM,QAAQ,KAAK,KAAK,QACtB;qCACQ,+CAAkB,IAAI,IAAI,IAAI;GAClC,SAAS,KAAK,KAAK,QAAQ,IAAI,IAAI,OAAO;GAC1C,SAAS;GACV,CAAC;EACF;yCACW,IAAI,KAAK;EACrB,CAAC,KAAK,GAAG,CACX;AAED,WAAU,6BAA6B;AAEvC,OAAM,SAAS,SAAS;AACtB,YAAU,MAAM,EACd,OAAO,QACR,CAAC;GACF;AAEF,WAAU,gFAAmD,KAAK,OAAO,GAAG"}
@@ -1,11 +1,11 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
3
  let node_path = require("node:path");
4
- let _intlayer_chokidar_cli = require("@intlayer/chokidar/cli");
4
+ let _intlayer_engine_cli = require("@intlayer/engine/cli");
5
5
 
6
6
  //#region src/listProjects.ts
7
7
  const listProjectsCommand = async (options) => {
8
- const { searchDir, projectsPath } = await (0, _intlayer_chokidar_cli.listProjects)(options);
8
+ const { searchDir, projectsPath } = await (0, _intlayer_engine_cli.listProjects)(options);
9
9
  const projectsRelativePath = projectsPath.map((projectPath) => options?.absolute ? projectPath : (0, node_path.relative)(searchDir, projectPath)).map((projectPath) => projectPath === "" ? "." : projectPath);
10
10
  if (options?.json) {
11
11
  console.dir(projectsRelativePath, {
@@ -1 +1 @@
1
- {"version":3,"file":"listProjects.cjs","names":[],"sources":["../../src/listProjects.ts"],"sourcesContent":["import { relative } from 'node:path';\nimport { type ListProjectsOptions, listProjects } from '@intlayer/chokidar/cli';\n\nexport type ListProjectsCommandOptions = ListProjectsOptions & {\n json?: boolean;\n absolute?: boolean;\n};\n\nexport const listProjectsCommand = async (\n options?: ListProjectsCommandOptions\n) => {\n const { searchDir, projectsPath } = await listProjects(options);\n\n const projectsRelativePath = projectsPath\n .map((projectPath) =>\n options?.absolute ? projectPath : relative(searchDir, projectPath)\n )\n .map((projectPath) => (projectPath === '' ? '.' : projectPath));\n\n if (options?.json) {\n console.dir(projectsRelativePath, { depth: null, arrayLimit: null });\n return;\n }\n\n if (projectsPath.length === 0) {\n console.log('No Intlayer projects found.');\n return;\n }\n\n console.log(`Found ${projectsPath.length} Intlayer project(s):\\n`);\n projectsPath.forEach((project) => {\n console.log(` - ${project}`);\n });\n};\n"],"mappings":";;;;;;AAQA,MAAa,sBAAsB,OACjC,YACG;CACH,MAAM,EAAE,WAAW,iBAAiB,+CAAmB,QAAQ;CAE/D,MAAM,uBAAuB,aAC1B,KAAK,gBACJ,SAAS,WAAW,sCAAuB,WAAW,YAAY,CACnE,CACA,KAAK,gBAAiB,gBAAgB,KAAK,MAAM,YAAa;AAEjE,KAAI,SAAS,MAAM;AACjB,UAAQ,IAAI,sBAAsB;GAAE,OAAO;GAAM,YAAY;GAAM,CAAC;AACpE;;AAGF,KAAI,aAAa,WAAW,GAAG;AAC7B,UAAQ,IAAI,8BAA8B;AAC1C;;AAGF,SAAQ,IAAI,SAAS,aAAa,OAAO,yBAAyB;AAClE,cAAa,SAAS,YAAY;AAChC,UAAQ,IAAI,OAAO,UAAU;GAC7B"}
1
+ {"version":3,"file":"listProjects.cjs","names":[],"sources":["../../src/listProjects.ts"],"sourcesContent":["import { relative } from 'node:path';\nimport { type ListProjectsOptions, listProjects } from '@intlayer/engine/cli';\n\nexport type ListProjectsCommandOptions = ListProjectsOptions & {\n json?: boolean;\n absolute?: boolean;\n};\n\nexport const listProjectsCommand = async (\n options?: ListProjectsCommandOptions\n) => {\n const { searchDir, projectsPath } = await listProjects(options);\n\n const projectsRelativePath = projectsPath\n .map((projectPath) =>\n options?.absolute ? projectPath : relative(searchDir, projectPath)\n )\n .map((projectPath) => (projectPath === '' ? '.' : projectPath));\n\n if (options?.json) {\n console.dir(projectsRelativePath, { depth: null, arrayLimit: null });\n return;\n }\n\n if (projectsPath.length === 0) {\n console.log('No Intlayer projects found.');\n return;\n }\n\n console.log(`Found ${projectsPath.length} Intlayer project(s):\\n`);\n projectsPath.forEach((project) => {\n console.log(` - ${project}`);\n });\n};\n"],"mappings":";;;;;;AAQA,MAAa,sBAAsB,OACjC,YACG;CACH,MAAM,EAAE,WAAW,iBAAiB,6CAAmB,QAAQ;CAE/D,MAAM,uBAAuB,aAC1B,KAAK,gBACJ,SAAS,WAAW,sCAAuB,WAAW,YAAY,CACnE,CACA,KAAK,gBAAiB,gBAAgB,KAAK,MAAM,YAAa;AAEjE,KAAI,SAAS,MAAM;AACjB,UAAQ,IAAI,sBAAsB;GAAE,OAAO;GAAM,YAAY;GAAM,CAAC;AACpE;;AAGF,KAAI,aAAa,WAAW,GAAG;AAC7B,UAAQ,IAAI,8BAA8B;AAC1C;;AAGF,SAAQ,IAAI,SAAS,aAAa,OAAO,yBAAyB;AAClE,cAAa,SAAS,YAAY;AAChC,UAAQ,IAAI,OAAO,UAAU;GAC7B"}
@@ -1,12 +1,12 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
3
  const require_IntlayerEventListener = require('./IntlayerEventListener.cjs');
4
- let _intlayer_chokidar_build = require("@intlayer/chokidar/build");
5
- let _intlayer_chokidar_utils = require("@intlayer/chokidar/utils");
6
4
  let _intlayer_config_colors = require("@intlayer/config/colors");
7
5
  _intlayer_config_colors = require_runtime.__toESM(_intlayer_config_colors);
8
6
  let _intlayer_config_logger = require("@intlayer/config/logger");
9
7
  let _intlayer_config_node = require("@intlayer/config/node");
8
+ let _intlayer_engine_build = require("@intlayer/engine/build");
9
+ let _intlayer_engine_utils = require("@intlayer/engine/utils");
10
10
  let _intlayer_unmerged_dictionaries_entry = require("@intlayer/unmerged-dictionaries-entry");
11
11
  let node_http = require("node:http");
12
12
  let _intlayer_config_package_json = require("@intlayer/config/package.json");
@@ -17,7 +17,7 @@ let _intlayer_dictionaries_entry = require("@intlayer/dictionaries-entry");
17
17
  //#region src/liveSync.ts
18
18
  const writeDictionary = async (dictionary, configuration) => {
19
19
  (0, _intlayer_config_logger.getAppLogger)(configuration)(`Writing dictionary ${dictionary.key}`);
20
- await (0, _intlayer_chokidar_build.buildDictionary)([dictionary], configuration);
20
+ await (0, _intlayer_engine_build.buildDictionary)([dictionary], configuration);
21
21
  };
22
22
  const liveSync = async (options) => {
23
23
  const configuration = (0, _intlayer_config_node.getConfiguration)(options?.configOptions);
@@ -26,7 +26,7 @@ const liveSync = async (options) => {
26
26
  let parallelProcess = null;
27
27
  let eventListener = null;
28
28
  if (options?.with) {
29
- parallelProcess = (0, _intlayer_chokidar_utils.runParallel)(options.with);
29
+ parallelProcess = (0, _intlayer_engine_utils.runParallel)(options.with);
30
30
  parallelProcess.result.catch(() => {});
31
31
  }
32
32
  if (configuration.editor.liveSync && configuration.editor.backendURL && configuration.editor.clientId && configuration.editor.clientSecret) {