@intlayer/cli 9.3.1 → 9.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/init.cjs CHANGED
@@ -48,6 +48,11 @@ const BASE_INIT_STEP_OPTIONS = [
48
48
  label: "Editor LSP",
49
49
  hint: "go-to-definition from keys to .content files"
50
50
  },
51
+ {
52
+ value: "eslint",
53
+ label: "Lint rules (ESLint / oxlint)",
54
+ hint: "flag hardcoded text and dynamic calls the compiler cannot optimize"
55
+ },
51
56
  {
52
57
  value: "skills",
53
58
  label: "AI skills",
@@ -104,68 +109,6 @@ const CONTENT_STRATEGY_OPTIONS = [
104
109
  hint: "plain /locales/{locale}/{namespace}.json files synced via @intlayer/sync-json-plugin"
105
110
  }
106
111
  ];
107
- const COMPAT_LIB_OPTIONS = [
108
- {
109
- value: "i18next",
110
- label: "i18next / react-i18next",
111
- hint: "i18next JSON format — installs @intlayer/i18next + @intlayer/sync-json-plugin",
112
- packages: ["i18next", "react-i18next"]
113
- },
114
- {
115
- value: "next-intl",
116
- label: "next-intl / use-intl",
117
- hint: "ICU format, Next.js — installs @intlayer/next-intl + @intlayer/sync-json-plugin",
118
- packages: ["next-intl"]
119
- },
120
- {
121
- value: "vue-i18n",
122
- label: "vue-i18n",
123
- hint: "Vue i18n JSON format — installs @intlayer/vue-i18n + @intlayer/sync-json-plugin",
124
- packages: ["vue-i18n"]
125
- },
126
- {
127
- value: "nuxtjs-i18n",
128
- label: "@nuxtjs/i18n",
129
- hint: "Nuxt i18n module — installs @intlayer/nuxtjs-i18n + @intlayer/sync-json-plugin",
130
- packages: ["@nuxtjs/i18n"]
131
- },
132
- {
133
- value: "next-i18next",
134
- label: "next-i18next",
135
- hint: "i18next JSON format, Next.js — installs @intlayer/next-i18next + @intlayer/sync-json-plugin",
136
- packages: ["next-i18next"]
137
- },
138
- {
139
- value: "next-translate",
140
- label: "next-translate",
141
- hint: "i18next flat-namespace JSON, Next.js — installs @intlayer/next-translate + @intlayer/sync-json-plugin",
142
- packages: ["next-translate"]
143
- },
144
- {
145
- value: "react-intl",
146
- label: "react-intl",
147
- hint: "ICU format — installs @intlayer/react-intl + @intlayer/sync-json-plugin",
148
- packages: ["react-intl"]
149
- },
150
- {
151
- value: "lingui-po",
152
- label: "Lingui (.po catalogs)",
153
- hint: "gettext PO — Lingui's default, installs @intlayer/lingui + @intlayer/sync-po-plugin",
154
- packages: ["@lingui/core"]
155
- },
156
- {
157
- value: "lingui-json",
158
- label: "Lingui (.json catalogs)",
159
- hint: "JSON catalogs — installs @intlayer/lingui + @intlayer/sync-json-plugin",
160
- packages: ["@lingui/core"]
161
- },
162
- {
163
- value: "svelte-i18n",
164
- label: "svelte-i18n",
165
- hint: "Flat i18next JSON — installs @intlayer/svelte-i18n + @intlayer/sync-json-plugin",
166
- packages: ["svelte-i18n"]
167
- }
168
- ];
169
112
  /** Reads the merged dependencies of the project at `root`. */
170
113
  const getProjectDependencies = (root) => {
171
114
  try {
@@ -240,74 +183,11 @@ const runInteractiveInit = async (root, baseOptions) => {
240
183
  }
241
184
  routingMode = selectedRoutingMode;
242
185
  }
243
- const knownCompatPackages = [
244
- "i18next",
245
- "react-i18next",
246
- "next-intl",
247
- "use-intl",
248
- "vue-i18n",
249
- "@nuxtjs/i18n",
250
- "next-i18next",
251
- "next-translate",
252
- "react-intl",
253
- "@lingui/core",
254
- "@lingui/react",
255
- "svelte-i18n",
256
- "@ngneat/transloco",
257
- "@ngx-translate/core",
258
- "node-polyglot",
259
- "i18n-js"
260
- ];
261
- const existingDeps = getProjectDependencies(root);
262
- const hasCompatLib = knownCompatPackages.some((pkg) => Boolean(existingDeps[pkg]));
263
- let hintDependencies;
264
- if (!hasCompatLib) {
265
- const selectedCompatLibs = await _clack_prompts.multiselect({
266
- message: "Are you using any existing i18n library? (Select all that apply, or press Enter to skip)",
267
- options: COMPAT_LIB_OPTIONS.map((opt) => ({
268
- value: opt.value,
269
- label: opt.label,
270
- hint: opt.hint
271
- })),
272
- required: false
273
- });
274
- if (_clack_prompts.isCancel(selectedCompatLibs)) {
275
- _clack_prompts.cancel("Operation cancelled.");
276
- return;
277
- }
278
- const selectedLibs = selectedCompatLibs;
279
- if (selectedLibs.length > 0) {
280
- hintDependencies = {};
281
- for (const value of selectedLibs) {
282
- const option = COMPAT_LIB_OPTIONS.find((o) => o.value === value);
283
- if (option?.packages) for (const pkg of option.packages) hintDependencies[pkg] = "*";
284
- }
285
- const hasLinguiPo = selectedLibs.includes("lingui-po");
286
- const hasLinguiJson = selectedLibs.includes("lingui-json");
287
- if (hasLinguiPo && hasLinguiJson) {
288
- const linguiFormat = await _clack_prompts.select({
289
- message: "Which catalog format does Lingui use in your project?",
290
- options: [{
291
- value: "po",
292
- label: ".po files (gettext)",
293
- hint: "Lingui's default — installs @intlayer/sync-po-plugin"
294
- }, {
295
- value: "json",
296
- label: ".json files",
297
- hint: "JSON catalogs — installs @intlayer/sync-json-plugin"
298
- }],
299
- initialValue: "po"
300
- });
301
- if (_clack_prompts.isCancel(linguiFormat)) {
302
- _clack_prompts.cancel("Operation cancelled.");
303
- return;
304
- }
305
- if (linguiFormat === "json") hintDependencies["__lingui_json__"] = "*";
306
- } else if (hasLinguiJson && !hasLinguiPo) hintDependencies["__lingui_json__"] = "*";
307
- }
308
- }
186
+ const detectedCompatLibraries = (0, _intlayer_engine_cli.detectCompatI18nLibraries)(getProjectDependencies(root));
187
+ const hasCompatLib = detectedCompatLibraries.length > 0;
188
+ if (hasCompatLib) _clack_prompts.log.info(`Detected existing i18n ${detectedCompatLibraries.length > 1 ? "libraries" : "library"}: ${detectedCompatLibraries.join(", ")} — the matching Intlayer compat adapter and catalog sync will be set up.`);
309
189
  let contentStrategy;
310
- if (!hasCompatLib && !hintDependencies) {
190
+ if (!hasCompatLib) {
311
191
  const selectedContentStrategy = await _clack_prompts.select({
312
192
  message: "How do you want to organize your translated content?",
313
193
  options: CONTENT_STRATEGY_OPTIONS,
@@ -322,14 +202,14 @@ const runInteractiveInit = async (root, baseOptions) => {
322
202
  const options = {
323
203
  ...baseOptions,
324
204
  routingMode,
325
- hintDependencies,
326
205
  contentStrategy,
327
206
  noInstallPackages: !steps.includes("packages"),
328
207
  noGitignore: baseOptions?.noGitignore,
329
208
  noGithubActions: baseOptions?.noGithubActions || !steps.includes("githubActions"),
330
209
  noFrameworkSetup: baseOptions?.noFrameworkSetup || !steps.includes("frameworkSetup"),
331
210
  noVscodeExtension: !steps.includes("vscodeExtension"),
332
- noLsp: !steps.includes("lsp")
211
+ noLsp: !steps.includes("lsp"),
212
+ noEslint: !steps.includes("eslint")
333
213
  };
334
214
  await (0, _intlayer_engine_cli.initIntlayer)(root, options);
335
215
  const needsPlatform = steps.includes("skills") || steps.includes("mcp");
@@ -1 +1 @@
1
- {"version":3,"file":"init.cjs","names":["resolve","existsSync","join","readFileSync","p","initIntlayer","getDetectedPlatform","PLATFORMS","PLATFORM_OPTIONS","initSkills","initMCP","initCompiler","initBuildOptimization","login","setupCmsCredentials"],"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 (covers every project in a monorepo)',\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;CAEjB,OAAO,mBAAeA,mBAAQ,YAAY,IAAI,GAAG;EAC/C,QAAIC,wBAAWC,gBAAK,YAAY,cAAc,CAAC,GAC7C,OAAO;EAET,iBAAaF,mBAAQ,YAAY,IAAI;CACvC;CAIA,OAAO;AACT;AAcA,MAAM,yBAID;CACH;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;AACF;;AAGA,MAAM,uBAID;CACH;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;AACF;;;;;;AAOA,MAAM,2BAID;CACH;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;AACF;AAmBA,MAAM,qBAAwC;CAC5C;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,UAAU,CAAC,WAAW,eAAe;CACvC;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,UAAU,CAAC,WAAW;CACxB;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,UAAU,CAAC,UAAU;CACvB;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,UAAU,CAAC,cAAc;CAC3B;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,UAAU,CAAC,cAAc;CAC3B;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,UAAU,CAAC,gBAAgB;CAC7B;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;EACN,UAAU,CAAC,YAAY;CACzB;CACA;EACE,OAAO;EACP,OAAO;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AM,IAAI;IACZ,EAAE;GACJ,CAAC,EACwB,CAAC;EAC5B,QAAQ;GACN,eAAE,OAAO,sBAAsB;GAC/B;EACF;CACF;CAEA,IAAI,MAAM,SAAS,QAAQ,GACzB,MAAMC,8BAAW,MAAM,cAAc;CAGvC,IAAI,MAAM,SAAS,KAAK,GACtB,MAAMC,wBAAQ,MAAM,cAAc;CAGpC,IAAI,MAAM,SAAS,UAAU,GAC3B,MAAMC,kCAAa,IAAI;CAGzB,IAAI,MAAM,SAAS,mBAAmB,GACpC,MAAMC,oDAAsB,IAAI;CAMlC,MAAM,iBAAiB,MAAMR,eAAE,QAAQ;EACrC,SACE;EACF,cAAc;CAChB,CAAC;CAED,IAAIA,eAAE,SAAS,cAAc,GAAG;EAC9B,eAAE,OAAO,sBAAsB;EAC/B;CACF;CAEA,IAAI,gBAAgB;EAClB,eAAE,IAAI,KAAK,uDAAuD;EAGlE,MAAMS,yBAAM;GACV,WAAW;GACX,gBAAgB,oBAAgBC,0CAAoB,MAAM,WAAW;EACvE,CAAC;CACH;CAEA,eAAE,MAAM,kCAAkC;AAC5C;AAEA,MAAa,OAAO,OAClB,aACA,SACA,gBACG;CACH,MAAM,OAAO,cACT,oBAAgBd,mBAAQ,WAAW,CAAC,IACpC,gBAAgB,QAAQ,IAAI,CAAC;CAEjC,IAAI,aAAa;EACf,MAAM,mBAAmB,MAAM,OAAO;EACtC;CACF;CAEA,UAAMK,mCAAa,MAAM,OAAO;AAClC"}
1
+ {"version":3,"file":"init.cjs","names":["resolve","existsSync","join","readFileSync","p","detectCompatI18nLibraries","initIntlayer","getDetectedPlatform","PLATFORMS","PLATFORM_OPTIONS","initSkills","initMCP","initCompiler","initBuildOptimization","login","setupCmsCredentials"],"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 detectCompatI18nLibraries,\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 | 'eslint'\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 (covers every project in a monorepo)',\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: 'eslint',\n label: 'Lint rules (ESLint / oxlint)',\n hint: 'flag hardcoded text and dynamic calls the compiler cannot optimize',\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/** 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 — never asked, always derived from the\n // installed packages. `detectMissingIntlayerPackages` reads the very same\n // dependency map to schedule the compat adapter, the sync plugin and the\n // catalog template, so a project without any of those packages is simply set\n // up on Intlayer alone.\n const detectedCompatLibraries = detectCompatI18nLibraries(\n getProjectDependencies(root)\n );\n const hasCompatLib = detectedCompatLibraries.length > 0;\n\n if (hasCompatLib) {\n p.log.info(\n `Detected existing i18n ${detectedCompatLibraries.length > 1 ? 'libraries' : 'library'}: ${detectedCompatLibraries.join(', ')} — the matching Intlayer compat adapter and catalog sync will be set up.`\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) {\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 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 noEslint: !steps.includes('eslint'),\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":";;;;;;;;;;;;;;;;AAwBA,MAAa,mBAAmB,aAAqB;CACnD,IAAI,aAAa;CAEjB,OAAO,mBAAeA,mBAAQ,YAAY,IAAI,GAAG;EAC/C,QAAIC,wBAAWC,gBAAK,YAAY,cAAc,CAAC,GAC7C,OAAO;EAET,iBAAaF,mBAAQ,YAAY,IAAI;CACvC;CAIA,OAAO;AACT;AAeA,MAAM,yBAID;CACH;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;AACF;;AAGA,MAAM,uBAID;CACH;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;AACF;;;;;;AAOA,MAAM,2BAID;CACH;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;AACF;;AAGA,MAAM,0BAA0B,SAAyC;CACvE,IAAI;EACF,MAAM,sBAAkBE,gBAAK,MAAM,cAAc;EACjD,IAAI,KAACD,oBAAW,eAAe,GAAG,OAAO,CAAC;EAC1C,MAAM,EAAE,eAAe,CAAC,GAAG,kBAAkB,CAAC,MAAM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A,IAAI,MAAM,SAAS,QAAQ,GACzB,MAAMC,8BAAW,MAAM,cAAc;CAGvC,IAAI,MAAM,SAAS,KAAK,GACtB,MAAMC,wBAAQ,MAAM,cAAc;CAGpC,IAAI,MAAM,SAAS,UAAU,GAC3B,MAAMC,kCAAa,IAAI;CAGzB,IAAI,MAAM,SAAS,mBAAmB,GACpC,MAAMC,oDAAsB,IAAI;CAMlC,MAAM,iBAAiB,MAAMT,eAAE,QAAQ;EACrC,SACE;EACF,cAAc;CAChB,CAAC;CAED,IAAIA,eAAE,SAAS,cAAc,GAAG;EAC9B,eAAE,OAAO,sBAAsB;EAC/B;CACF;CAEA,IAAI,gBAAgB;EAClB,eAAE,IAAI,KAAK,uDAAuD;EAGlE,MAAMU,yBAAM;GACV,WAAW;GACX,gBAAgB,oBAAgBC,0CAAoB,MAAM,WAAW;EACvE,CAAC;CACH;CAEA,eAAE,MAAM,kCAAkC;AAC5C;AAEA,MAAa,OAAO,OAClB,aACA,SACA,gBACG;CACH,MAAM,OAAO,cACT,oBAAgBf,mBAAQ,WAAW,CAAC,IACpC,gBAAgB,QAAQ,IAAI,CAAC;CAEjC,IAAI,aAAa;EACf,MAAM,mBAAmB,MAAM,OAAO;EACtC;CACF;CAEA,UAAMM,mCAAa,MAAM,OAAO;AAClC"}
package/dist/esm/init.mjs CHANGED
@@ -5,7 +5,7 @@ import { PLATFORM_OPTIONS, getDetectedPlatform, initSkills } from "./initSkills.
5
5
  import { initMCP } from "./initMCP.mjs";
6
6
  import { existsSync, readFileSync } from "node:fs";
7
7
  import { join, resolve } from "node:path";
8
- import { PLATFORMS, initIntlayer, setupCmsCredentials } from "@intlayer/engine/cli";
8
+ import { PLATFORMS, detectCompatI18nLibraries, initIntlayer, setupCmsCredentials } from "@intlayer/engine/cli";
9
9
  import enquirer from "enquirer";
10
10
  import * as p from "@clack/prompts";
11
11
 
@@ -44,6 +44,11 @@ const BASE_INIT_STEP_OPTIONS = [
44
44
  label: "Editor LSP",
45
45
  hint: "go-to-definition from keys to .content files"
46
46
  },
47
+ {
48
+ value: "eslint",
49
+ label: "Lint rules (ESLint / oxlint)",
50
+ hint: "flag hardcoded text and dynamic calls the compiler cannot optimize"
51
+ },
47
52
  {
48
53
  value: "skills",
49
54
  label: "AI skills",
@@ -100,68 +105,6 @@ const CONTENT_STRATEGY_OPTIONS = [
100
105
  hint: "plain /locales/{locale}/{namespace}.json files synced via @intlayer/sync-json-plugin"
101
106
  }
102
107
  ];
103
- const COMPAT_LIB_OPTIONS = [
104
- {
105
- value: "i18next",
106
- label: "i18next / react-i18next",
107
- hint: "i18next JSON format — installs @intlayer/i18next + @intlayer/sync-json-plugin",
108
- packages: ["i18next", "react-i18next"]
109
- },
110
- {
111
- value: "next-intl",
112
- label: "next-intl / use-intl",
113
- hint: "ICU format, Next.js — installs @intlayer/next-intl + @intlayer/sync-json-plugin",
114
- packages: ["next-intl"]
115
- },
116
- {
117
- value: "vue-i18n",
118
- label: "vue-i18n",
119
- hint: "Vue i18n JSON format — installs @intlayer/vue-i18n + @intlayer/sync-json-plugin",
120
- packages: ["vue-i18n"]
121
- },
122
- {
123
- value: "nuxtjs-i18n",
124
- label: "@nuxtjs/i18n",
125
- hint: "Nuxt i18n module — installs @intlayer/nuxtjs-i18n + @intlayer/sync-json-plugin",
126
- packages: ["@nuxtjs/i18n"]
127
- },
128
- {
129
- value: "next-i18next",
130
- label: "next-i18next",
131
- hint: "i18next JSON format, Next.js — installs @intlayer/next-i18next + @intlayer/sync-json-plugin",
132
- packages: ["next-i18next"]
133
- },
134
- {
135
- value: "next-translate",
136
- label: "next-translate",
137
- hint: "i18next flat-namespace JSON, Next.js — installs @intlayer/next-translate + @intlayer/sync-json-plugin",
138
- packages: ["next-translate"]
139
- },
140
- {
141
- value: "react-intl",
142
- label: "react-intl",
143
- hint: "ICU format — installs @intlayer/react-intl + @intlayer/sync-json-plugin",
144
- packages: ["react-intl"]
145
- },
146
- {
147
- value: "lingui-po",
148
- label: "Lingui (.po catalogs)",
149
- hint: "gettext PO — Lingui's default, installs @intlayer/lingui + @intlayer/sync-po-plugin",
150
- packages: ["@lingui/core"]
151
- },
152
- {
153
- value: "lingui-json",
154
- label: "Lingui (.json catalogs)",
155
- hint: "JSON catalogs — installs @intlayer/lingui + @intlayer/sync-json-plugin",
156
- packages: ["@lingui/core"]
157
- },
158
- {
159
- value: "svelte-i18n",
160
- label: "svelte-i18n",
161
- hint: "Flat i18next JSON — installs @intlayer/svelte-i18n + @intlayer/sync-json-plugin",
162
- packages: ["svelte-i18n"]
163
- }
164
- ];
165
108
  /** Reads the merged dependencies of the project at `root`. */
166
109
  const getProjectDependencies = (root) => {
167
110
  try {
@@ -236,74 +179,11 @@ const runInteractiveInit = async (root, baseOptions) => {
236
179
  }
237
180
  routingMode = selectedRoutingMode;
238
181
  }
239
- const knownCompatPackages = [
240
- "i18next",
241
- "react-i18next",
242
- "next-intl",
243
- "use-intl",
244
- "vue-i18n",
245
- "@nuxtjs/i18n",
246
- "next-i18next",
247
- "next-translate",
248
- "react-intl",
249
- "@lingui/core",
250
- "@lingui/react",
251
- "svelte-i18n",
252
- "@ngneat/transloco",
253
- "@ngx-translate/core",
254
- "node-polyglot",
255
- "i18n-js"
256
- ];
257
- const existingDeps = getProjectDependencies(root);
258
- const hasCompatLib = knownCompatPackages.some((pkg) => Boolean(existingDeps[pkg]));
259
- let hintDependencies;
260
- if (!hasCompatLib) {
261
- const selectedCompatLibs = await p.multiselect({
262
- message: "Are you using any existing i18n library? (Select all that apply, or press Enter to skip)",
263
- options: COMPAT_LIB_OPTIONS.map((opt) => ({
264
- value: opt.value,
265
- label: opt.label,
266
- hint: opt.hint
267
- })),
268
- required: false
269
- });
270
- if (p.isCancel(selectedCompatLibs)) {
271
- p.cancel("Operation cancelled.");
272
- return;
273
- }
274
- const selectedLibs = selectedCompatLibs;
275
- if (selectedLibs.length > 0) {
276
- hintDependencies = {};
277
- for (const value of selectedLibs) {
278
- const option = COMPAT_LIB_OPTIONS.find((o) => o.value === value);
279
- if (option?.packages) for (const pkg of option.packages) hintDependencies[pkg] = "*";
280
- }
281
- const hasLinguiPo = selectedLibs.includes("lingui-po");
282
- const hasLinguiJson = selectedLibs.includes("lingui-json");
283
- if (hasLinguiPo && hasLinguiJson) {
284
- const linguiFormat = await p.select({
285
- message: "Which catalog format does Lingui use in your project?",
286
- options: [{
287
- value: "po",
288
- label: ".po files (gettext)",
289
- hint: "Lingui's default — installs @intlayer/sync-po-plugin"
290
- }, {
291
- value: "json",
292
- label: ".json files",
293
- hint: "JSON catalogs — installs @intlayer/sync-json-plugin"
294
- }],
295
- initialValue: "po"
296
- });
297
- if (p.isCancel(linguiFormat)) {
298
- p.cancel("Operation cancelled.");
299
- return;
300
- }
301
- if (linguiFormat === "json") hintDependencies["__lingui_json__"] = "*";
302
- } else if (hasLinguiJson && !hasLinguiPo) hintDependencies["__lingui_json__"] = "*";
303
- }
304
- }
182
+ const detectedCompatLibraries = detectCompatI18nLibraries(getProjectDependencies(root));
183
+ const hasCompatLib = detectedCompatLibraries.length > 0;
184
+ if (hasCompatLib) p.log.info(`Detected existing i18n ${detectedCompatLibraries.length > 1 ? "libraries" : "library"}: ${detectedCompatLibraries.join(", ")} — the matching Intlayer compat adapter and catalog sync will be set up.`);
305
185
  let contentStrategy;
306
- if (!hasCompatLib && !hintDependencies) {
186
+ if (!hasCompatLib) {
307
187
  const selectedContentStrategy = await p.select({
308
188
  message: "How do you want to organize your translated content?",
309
189
  options: CONTENT_STRATEGY_OPTIONS,
@@ -318,14 +198,14 @@ const runInteractiveInit = async (root, baseOptions) => {
318
198
  const options = {
319
199
  ...baseOptions,
320
200
  routingMode,
321
- hintDependencies,
322
201
  contentStrategy,
323
202
  noInstallPackages: !steps.includes("packages"),
324
203
  noGitignore: baseOptions?.noGitignore,
325
204
  noGithubActions: baseOptions?.noGithubActions || !steps.includes("githubActions"),
326
205
  noFrameworkSetup: baseOptions?.noFrameworkSetup || !steps.includes("frameworkSetup"),
327
206
  noVscodeExtension: !steps.includes("vscodeExtension"),
328
- noLsp: !steps.includes("lsp")
207
+ noLsp: !steps.includes("lsp"),
208
+ noEslint: !steps.includes("eslint")
329
209
  };
330
210
  await initIntlayer(root, options);
331
211
  const needsPlatform = steps.includes("skills") || steps.includes("mcp");
@@ -1 +1 @@
1
- {"version":3,"file":"init.mjs","names":[],"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 (covers every project in a monorepo)',\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;CAEjB,OAAO,eAAe,QAAQ,YAAY,IAAI,GAAG;EAC/C,IAAI,WAAW,KAAK,YAAY,cAAc,CAAC,GAC7C,OAAO;EAET,aAAa,QAAQ,YAAY,IAAI;CACvC;CAIA,OAAO;AACT;AAcA,MAAM,yBAID;CACH;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;AACF;;AAGA,MAAM,uBAID;CACH;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;CACA;EACE,OAAO;E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AE,OAAO,sBAAsB;EAC/B;CACF;CAEA,IAAI,gBAAgB;EAClB,EAAE,IAAI,KAAK,uDAAuD;EAGlE,MAAM,MAAM;GACV,WAAW;GACX,gBAAgB,gBAAgB,oBAAoB,MAAM,WAAW;EACvE,CAAC;CACH;CAEA,EAAE,MAAM,kCAAkC;AAC5C;AAEA,MAAa,OAAO,OAClB,aACA,SACA,gBACG;CACH,MAAM,OAAO,cACT,gBAAgB,QAAQ,WAAW,CAAC,IACpC,gBAAgB,QAAQ,IAAI,CAAC;CAEjC,IAAI,aAAa;EACf,MAAM,mBAAmB,MAAM,OAAO;EACtC;CACF;CAEA,MAAM,aAAa,MAAM,OAAO;AAClC"}
1
+ {"version":3,"file":"init.mjs","names":[],"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 detectCompatI18nLibraries,\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 | 'eslint'\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 (covers every project in a monorepo)',\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: 'eslint',\n label: 'Lint rules (ESLint / oxlint)',\n hint: 'flag hardcoded text and dynamic calls the compiler cannot optimize',\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/** 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 — never asked, always derived from the\n // installed packages. `detectMissingIntlayerPackages` reads the very same\n // dependency map to schedule the compat adapter, the sync plugin and the\n // catalog template, so a project without any of those packages is simply set\n // up on Intlayer alone.\n const detectedCompatLibraries = detectCompatI18nLibraries(\n getProjectDependencies(root)\n );\n const hasCompatLib = detectedCompatLibraries.length > 0;\n\n if (hasCompatLib) {\n p.log.info(\n `Detected existing i18n ${detectedCompatLibraries.length > 1 ? 'libraries' : 'library'}: ${detectedCompatLibraries.join(', ')} — the matching Intlayer compat adapter and catalog sync will be set up.`\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) {\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 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 noEslint: !steps.includes('eslint'),\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":";;;;;;;;;;;;AAwBA,MAAa,mBAAmB,aAAqB;CACnD,IAAI,aAAa;CAEjB,OAAO,eAAe,QAAQ,YAAY,IAAI,GAAG;EAC/C,IAAI,WAAW,KAAK,YAAY,cAAc,CAAC,GAC7C,OAAO;EAET,aAAa,QAAQ,YAAY,IAAI;CACvC;CAIA,OAAO;AACT;AAeA,MAAM,yBAID;CACH;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;CACA;EACE,OAAO;EACP,OAAO;EACP,MAAM;CACR;CACA;EACE,OAAO;EACP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C,IACpC,gBAAgB,QAAQ,IAAI,CAAC;CAEjC,IAAI,aAAa;EACf,MAAM,mBAAmB,MAAM,OAAO;EACtC;CACF;CAEA,MAAM,aAAa,MAAM,OAAO;AAClC"}
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","names":[],"sources":["../../src/init.ts"],"mappings":";;cAuBa,kBAAe;cA2hBf,OAAI,sBACK,UACV,aAAW,0BACA"}
1
+ {"version":3,"file":"init.d.ts","names":[],"sources":["../../src/init.ts"],"mappings":";;cAwBa,kBAAe;cAuXf,OAAI,sBACK,UACV,aAAW,0BACA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlayer/cli",
3
- "version": "9.3.1",
3
+ "version": "9.3.2",
4
4
  "private": false,
5
5
  "description": "Provides uniform command-line interface scripts for Intlayer, used in packages like intlayer-cli and intlayer.",
6
6
  "keywords": [
@@ -67,22 +67,22 @@
67
67
  },
68
68
  "dependencies": {
69
69
  "@clack/prompts": "1.7.0",
70
- "@intlayer/api": "9.3.1",
71
- "@intlayer/babel": "9.3.1",
72
- "@intlayer/config": "9.3.1",
73
- "@intlayer/core": "9.3.1",
74
- "@intlayer/dictionaries-entry": "9.3.1",
75
- "@intlayer/engine": "9.3.1",
76
- "@intlayer/remote-dictionaries-entry": "9.3.1",
77
- "@intlayer/types": "9.3.1",
78
- "@intlayer/unmerged-dictionaries-entry": "9.3.1",
70
+ "@intlayer/api": "9.3.2",
71
+ "@intlayer/babel": "9.3.2",
72
+ "@intlayer/config": "9.3.2",
73
+ "@intlayer/core": "9.3.2",
74
+ "@intlayer/dictionaries-entry": "9.3.2",
75
+ "@intlayer/engine": "9.3.2",
76
+ "@intlayer/remote-dictionaries-entry": "9.3.2",
77
+ "@intlayer/types": "9.3.2",
78
+ "@intlayer/unmerged-dictionaries-entry": "9.3.2",
79
79
  "commander": "15.0.0",
80
80
  "enquirer": "2.4.1",
81
81
  "eventsource": "4.1.1",
82
82
  "fast-glob": "3.3.3"
83
83
  },
84
84
  "devDependencies": {
85
- "@intlayer/ai": "9.3.1",
85
+ "@intlayer/ai": "9.3.2",
86
86
  "@types/node": "26.2.0",
87
87
  "@utils/ts-config": "1.0.4",
88
88
  "@utils/ts-config-types": "1.0.4",
@@ -93,7 +93,7 @@
93
93
  "vitest": "4.1.10"
94
94
  },
95
95
  "peerDependencies": {
96
- "@intlayer/ai": "9.3.1"
96
+ "@intlayer/ai": "9.3.2"
97
97
  },
98
98
  "peerDependenciesMeta": {
99
99
  "@intlayer/ai": {