@intlayer/cli 9.0.0-canary.1 → 9.0.0-canary.11
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/auth/login.cjs +42 -29
- package/dist/cjs/auth/login.cjs.map +1 -1
- package/dist/cjs/cli.cjs +21 -12
- package/dist/cjs/cli.cjs.map +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/init.cjs +332 -2
- package/dist/cjs/init.cjs.map +1 -1
- package/dist/cjs/initBuildOptimization.cjs +81 -0
- package/dist/cjs/initBuildOptimization.cjs.map +1 -0
- package/dist/cjs/initCompiler.cjs +117 -0
- package/dist/cjs/initCompiler.cjs.map +1 -0
- package/dist/cjs/initMCP.cjs +22 -19
- package/dist/cjs/initMCP.cjs.map +1 -1
- package/dist/cjs/initSkills.cjs +21 -18
- package/dist/cjs/initSkills.cjs.map +1 -1
- package/dist/cjs/reviewDoc/reviewDocBlockAware.cjs +1 -1
- package/dist/cjs/translateDoc/translateFile.cjs +1 -1
- package/dist/esm/auth/login.mjs +42 -29
- package/dist/esm/auth/login.mjs.map +1 -1
- package/dist/esm/cli.mjs +21 -12
- package/dist/esm/cli.mjs.map +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/init.mjs +332 -4
- package/dist/esm/init.mjs.map +1 -1
- package/dist/esm/initBuildOptimization.mjs +78 -0
- package/dist/esm/initBuildOptimization.mjs.map +1 -0
- package/dist/esm/initCompiler.mjs +114 -0
- package/dist/esm/initCompiler.mjs.map +1 -0
- package/dist/esm/initMCP.mjs +22 -19
- package/dist/esm/initMCP.mjs.map +1 -1
- package/dist/esm/initSkills.mjs +21 -18
- package/dist/esm/initSkills.mjs.map +1 -1
- package/dist/esm/reviewDoc/reviewDocBlockAware.mjs +1 -1
- package/dist/esm/translateDoc/translateFile.mjs +1 -1
- package/dist/types/auth/login.d.ts +13 -4
- package/dist/types/auth/login.d.ts.map +1 -1
- package/dist/types/cli.d.ts.map +1 -1
- package/dist/types/init.d.ts +1 -1
- package/dist/types/init.d.ts.map +1 -1
- package/dist/types/initBuildOptimization.d.ts +20 -0
- package/dist/types/initBuildOptimization.d.ts.map +1 -0
- package/dist/types/initCompiler.d.ts +18 -0
- package/dist/types/initCompiler.d.ts.map +1 -0
- package/dist/types/initMCP.d.ts +3 -1
- package/dist/types/initMCP.d.ts.map +1 -1
- package/dist/types/initSkills.d.ts +1 -1
- package/dist/types/initSkills.d.ts.map +1 -1
- package/package.json +13 -13
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { findProjectRoot } from "./init.mjs";
|
|
2
|
+
import { existsSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { join, resolve } from "node:path";
|
|
4
|
+
import { NEXT_INTLAYER_BABEL_CONFIG_CONTENT, detectPackageManager, installPackages } from "@intlayer/chokidar/cli";
|
|
5
|
+
import * as p from "@clack/prompts";
|
|
6
|
+
|
|
7
|
+
//#region src/initBuildOptimization.ts
|
|
8
|
+
/** Babel config filenames Next.js picks up, ordered by preference. */
|
|
9
|
+
const BABEL_CONFIG_CANDIDATES = [
|
|
10
|
+
"babel.config.js",
|
|
11
|
+
"babel.config.cjs",
|
|
12
|
+
"babel.config.mjs",
|
|
13
|
+
"babel.config.ts"
|
|
14
|
+
];
|
|
15
|
+
/**
|
|
16
|
+
* Interactive prompt to select a build optimization plugin for Next.js and
|
|
17
|
+
* scaffold the required files. The two options are independent — pick one:
|
|
18
|
+
*
|
|
19
|
+
* - `@intlayer/babel` — runs the full compiler pipeline (extract, purge, minify,
|
|
20
|
+
* optimize) through Babel. Installs `@intlayer/babel` and creates a
|
|
21
|
+
* `babel.config.js`.
|
|
22
|
+
* - `@intlayer/swc` — lightweight SWC plugin that rewrites `useIntlayer` imports.
|
|
23
|
+
* Installs only the dependency; `withIntlayer` wires it in automatically, so
|
|
24
|
+
* no config file is required.
|
|
25
|
+
*
|
|
26
|
+
* @param projectRoot - Optional project root; defaults to the current directory.
|
|
27
|
+
*/
|
|
28
|
+
const initBuildOptimization = async (projectRoot) => {
|
|
29
|
+
const root = findProjectRoot(projectRoot ? resolve(projectRoot) : process.cwd());
|
|
30
|
+
p.intro("Configuring Next.js build optimization");
|
|
31
|
+
const plugin = await p.select({
|
|
32
|
+
message: "Which build optimization plugin do you want to use?",
|
|
33
|
+
options: [{
|
|
34
|
+
value: "babel",
|
|
35
|
+
label: "@intlayer/babel",
|
|
36
|
+
hint: "Full pipeline — extract, purge, minify and optimize via Babel; creates babel.config.js"
|
|
37
|
+
}, {
|
|
38
|
+
value: "swc",
|
|
39
|
+
label: "@intlayer/swc",
|
|
40
|
+
hint: "Lightweight — SWC plugin that rewrites useIntlayer imports; wired automatically by withIntlayer"
|
|
41
|
+
}]
|
|
42
|
+
});
|
|
43
|
+
if (p.isCancel(plugin) || !plugin) {
|
|
44
|
+
p.cancel("Operation cancelled.");
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const packageManager = detectPackageManager(root);
|
|
48
|
+
const packageToInstall = plugin === "babel" ? "@intlayer/babel" : "@intlayer/swc";
|
|
49
|
+
const spinner = p.spinner();
|
|
50
|
+
spinner.start("Installing packages...");
|
|
51
|
+
try {
|
|
52
|
+
installPackages(root, [packageToInstall], packageManager, true);
|
|
53
|
+
spinner.stop(`Installed: ${packageToInstall}`);
|
|
54
|
+
} catch {
|
|
55
|
+
spinner.stop("Package installation failed");
|
|
56
|
+
p.log.warn(`Please install manually: ${packageToInstall} (dev dependency)`);
|
|
57
|
+
}
|
|
58
|
+
if (plugin === "swc") {
|
|
59
|
+
p.outro("Build optimization configuration complete");
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const existingBabelConfig = BABEL_CONFIG_CANDIDATES.find((file) => existsSync(join(root, file)));
|
|
63
|
+
if (existingBabelConfig) {
|
|
64
|
+
p.log.warn(`${existingBabelConfig} already exists — add the Intlayer plugins manually.`);
|
|
65
|
+
p.note(NEXT_INTLAYER_BABEL_CONFIG_CONTENT, "Plugins to add to your babel config");
|
|
66
|
+
} else try {
|
|
67
|
+
writeFileSync(join(root, "babel.config.js"), NEXT_INTLAYER_BABEL_CONFIG_CONTENT, { encoding: "utf-8" });
|
|
68
|
+
p.log.success("Created babel.config.js with the Intlayer compiler plugins (extract, purge, minify, optimize)");
|
|
69
|
+
} catch {
|
|
70
|
+
p.log.warn("Could not create babel.config.js — please create it manually.");
|
|
71
|
+
p.note(NEXT_INTLAYER_BABEL_CONFIG_CONTENT, "babel.config.js");
|
|
72
|
+
}
|
|
73
|
+
p.outro("Build optimization configuration complete");
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
//#endregion
|
|
77
|
+
export { initBuildOptimization };
|
|
78
|
+
//# sourceMappingURL=initBuildOptimization.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initBuildOptimization.mjs","names":[],"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,OAAO,gBACX,cAAc,QAAQ,YAAY,GAAG,QAAQ,KAAK,CACnD;AACD,GAAE,MAAM,yCAAyC;CAEjD,MAAM,SAAU,MAAM,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,KAAI,EAAE,SAAS,OAAO,IAAI,CAAC,QAAQ;AACjC,IAAE,OAAO,uBAAuB;AAChC;;CAGF,MAAM,iBAAiB,qBAAqB,KAAK;CACjD,MAAM,mBACJ,WAAW,UAAU,oBAAoB;CAE3C,MAAM,UAAU,EAAE,SAAS;AAC3B,SAAQ,MAAM,yBAAyB;AAEvC,KAAI;AACF,kBAAgB,MAAM,CAAC,iBAAiB,EAAE,gBAAgB,KAAK;AAC/D,UAAQ,KAAK,cAAc,mBAAmB;SACxC;AACN,UAAQ,KAAK,8BAA8B;AAC3C,IAAE,IAAI,KAAK,4BAA4B,iBAAiB,mBAAmB;;AAI7E,KAAI,WAAW,OAAO;AACpB,IAAE,MAAM,4CAA4C;AACpD;;CAIF,MAAM,sBAAsB,wBAAwB,MAAM,SACxD,WAAW,KAAK,MAAM,KAAK,CAAC,CAC7B;AAED,KAAI,qBAAqB;AACvB,IAAE,IAAI,KACJ,GAAG,oBAAoB,sDACxB;AACD,IAAE,KACA,oCACA,sCACD;OAED,KAAI;AACF,gBACE,KAAK,MAAM,kBAAkB,EAC7B,oCACA,EAAE,UAAU,SAAS,CACtB;AACD,IAAE,IAAI,QACJ,gGACD;SACK;AACN,IAAE,IAAI,KACJ,gEACD;AACD,IAAE,KAAK,oCAAoC,kBAAkB;;AAIjE,GAAE,MAAM,4CAA4C"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { findProjectRoot } from "./init.mjs";
|
|
2
|
+
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { join, resolve } from "node:path";
|
|
4
|
+
import { detectPackageManager, installPackages } from "@intlayer/chokidar/cli";
|
|
5
|
+
import * as p from "@clack/prompts";
|
|
6
|
+
|
|
7
|
+
//#region src/initCompiler.ts
|
|
8
|
+
/**
|
|
9
|
+
* babel.config.js that runs the Intlayer compiler passes for Next.js.
|
|
10
|
+
*
|
|
11
|
+
* Mirrors the Next.js (Babel) tab of `docs/docs/en/compiler.md`: the extract
|
|
12
|
+
* plugin pulls inline content into dictionaries and the optimize plugin
|
|
13
|
+
* rewrites `useIntlayer` into direct dictionary imports. On Vite the same work
|
|
14
|
+
* is handled by the `intlayer()` plugin (which bundles the compiler in v9), so
|
|
15
|
+
* no Babel config is needed.
|
|
16
|
+
*/
|
|
17
|
+
const BABEL_COMPILER_CONFIG_CONTENT = `const {
|
|
18
|
+
intlayerExtractBabelPlugin,
|
|
19
|
+
intlayerOptimizeBabelPlugin,
|
|
20
|
+
getExtractPluginOptions,
|
|
21
|
+
getOptimizePluginOptions,
|
|
22
|
+
} = require("@intlayer/babel");
|
|
23
|
+
|
|
24
|
+
module.exports = {
|
|
25
|
+
presets: ["next/babel"],
|
|
26
|
+
plugins: [
|
|
27
|
+
// Extract content from components into dictionaries
|
|
28
|
+
[intlayerExtractBabelPlugin, getExtractPluginOptions()],
|
|
29
|
+
// Optimize imports by replacing useIntlayer with direct dictionary imports
|
|
30
|
+
[intlayerOptimizeBabelPlugin, getOptimizePluginOptions()],
|
|
31
|
+
],
|
|
32
|
+
};
|
|
33
|
+
`;
|
|
34
|
+
/**
|
|
35
|
+
* Reads the project dependencies and detects which framework the compiler
|
|
36
|
+
* should target. Next.js is checked before Vite because a Next.js project may
|
|
37
|
+
* transitively depend on Vite tooling.
|
|
38
|
+
*/
|
|
39
|
+
const detectCompilerFramework = (root) => {
|
|
40
|
+
try {
|
|
41
|
+
const packageJsonPath = join(root, "package.json");
|
|
42
|
+
if (!existsSync(packageJsonPath)) return "unknown";
|
|
43
|
+
const { dependencies = {}, devDependencies = {} } = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
|
44
|
+
const allDependencies = {
|
|
45
|
+
...dependencies,
|
|
46
|
+
...devDependencies
|
|
47
|
+
};
|
|
48
|
+
if (allDependencies.next) return "nextjs";
|
|
49
|
+
if (allDependencies.vite) return "vite";
|
|
50
|
+
return "unknown";
|
|
51
|
+
} catch {
|
|
52
|
+
return "unknown";
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Scaffolds the Intlayer compiler for the current project during interactive
|
|
57
|
+
* init.
|
|
58
|
+
*
|
|
59
|
+
* - **Vite** — nothing to do: since v9 the compiler is built into the
|
|
60
|
+
* `intlayer()` plugin in `vite.config.ts`, so this only confirms the setup
|
|
61
|
+
* to the user.
|
|
62
|
+
* - **Next.js** — installs `@intlayer/babel` and writes a `babel.config.js`
|
|
63
|
+
* that runs the extract + optimize compiler passes.
|
|
64
|
+
*
|
|
65
|
+
* In non-interactive init this function is never called, so the compiler setup
|
|
66
|
+
* is left untouched.
|
|
67
|
+
*/
|
|
68
|
+
const initCompiler = async (projectRoot) => {
|
|
69
|
+
const root = findProjectRoot(projectRoot ? resolve(projectRoot) : process.cwd());
|
|
70
|
+
const framework = detectCompilerFramework(root);
|
|
71
|
+
if (framework === "vite") {
|
|
72
|
+
p.log.info("Vite detected — the compiler is built into `intlayer()` in your vite.config. Nothing to configure.");
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (framework !== "nextjs") {
|
|
76
|
+
p.log.warn("No supported framework detected for the compiler — skipping. See the compiler docs for manual setup.");
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
p.intro("Configuring the Intlayer compiler for Next.js");
|
|
80
|
+
const packageManager = detectPackageManager(root);
|
|
81
|
+
const devPackagesToInstall = ["@intlayer/babel"];
|
|
82
|
+
const spinner = p.spinner();
|
|
83
|
+
spinner.start("Installing packages...");
|
|
84
|
+
try {
|
|
85
|
+
installPackages(root, devPackagesToInstall, packageManager, true);
|
|
86
|
+
spinner.stop(`Installed: ${devPackagesToInstall.join(", ")}`);
|
|
87
|
+
} catch {
|
|
88
|
+
spinner.stop("Package installation failed");
|
|
89
|
+
p.log.warn(`Please install manually: ${devPackagesToInstall.join(" ")} (dev dependency)`);
|
|
90
|
+
}
|
|
91
|
+
const existingBabelConfig = [
|
|
92
|
+
"babel.config.js",
|
|
93
|
+
"babel.config.cjs",
|
|
94
|
+
"babel.config.mjs",
|
|
95
|
+
"babel.config.ts",
|
|
96
|
+
".babelrc",
|
|
97
|
+
".babelrc.js"
|
|
98
|
+
].find((file) => existsSync(join(root, file)));
|
|
99
|
+
if (existingBabelConfig) {
|
|
100
|
+
p.log.warn(`${existingBabelConfig} already exists — add the Intlayer compiler plugins manually.`);
|
|
101
|
+
p.note(BABEL_COMPILER_CONFIG_CONTENT, "Plugins to add to your babel config");
|
|
102
|
+
} else try {
|
|
103
|
+
writeFileSync(join(root, "babel.config.js"), BABEL_COMPILER_CONFIG_CONTENT, { encoding: "utf-8" });
|
|
104
|
+
p.log.success("Created babel.config.js with the Intlayer compiler extract and optimize plugins");
|
|
105
|
+
} catch {
|
|
106
|
+
p.log.warn("Could not create babel.config.js — please create it manually.");
|
|
107
|
+
p.note(BABEL_COMPILER_CONFIG_CONTENT, "babel.config.js");
|
|
108
|
+
}
|
|
109
|
+
p.outro("Compiler configuration complete");
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
//#endregion
|
|
113
|
+
export { initCompiler };
|
|
114
|
+
//# sourceMappingURL=initCompiler.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initCompiler.mjs","names":[],"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,kBAAkB,KAAK,MAAM,eAAe;AAClD,MAAI,CAAC,WAAW,gBAAgB,CAAE,QAAO;EAEzC,MAAM,EAAE,eAAe,EAAE,EAAE,kBAAkB,EAAE,KAAK,KAAK,MACvD,aAAa,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,OAAO,gBACX,cAAc,QAAQ,YAAY,GAAG,QAAQ,KAAK,CACnD;CAED,MAAM,YAAY,wBAAwB,KAAK;AAE/C,KAAI,cAAc,QAAQ;AAExB,IAAE,IAAI,KACJ,qGACD;AACD;;AAGF,KAAI,cAAc,UAAU;AAC1B,IAAE,IAAI,KACJ,uGACD;AACD;;AAGF,GAAE,MAAM,gDAAgD;CAExD,MAAM,iBAAiB,qBAAqB,KAAK;CACjD,MAAM,uBAAuB,CAAC,kBAAkB;CAEhD,MAAM,UAAU,EAAE,SAAS;AAC3B,SAAQ,MAAM,yBAAyB;AAEvC,KAAI;AACF,kBAAgB,MAAM,sBAAsB,gBAAgB,KAAK;AACjE,UAAQ,KAAK,cAAc,qBAAqB,KAAK,KAAK,GAAG;SACvD;AACN,UAAQ,KAAK,8BAA8B;AAC3C,IAAE,IAAI,KACJ,4BAA4B,qBAAqB,KAAK,IAAI,CAAC,mBAC5D;;CAYH,MAAM,sBAAsB;EAR1B;EACA;EACA;EACA;EACA;EACA;EAG+C,CAAC,MAAM,SACtD,WAAW,KAAK,MAAM,KAAK,CAAC,CAC7B;AAED,KAAI,qBAAqB;AACvB,IAAE,IAAI,KACJ,GAAG,oBAAoB,+DACxB;AACD,IAAE,KACA,+BACA,sCACD;OAED,KAAI;AACF,gBACE,KAAK,MAAM,kBAAkB,EAC7B,+BACA,EAAE,UAAU,SAAS,CACtB;AACD,IAAE,IAAI,QACJ,kFACD;SACK;AACN,IAAE,IAAI,KACJ,gEACD;AACD,IAAE,KAAK,+BAA+B,kBAAkB;;AAI5D,GAAE,MAAM,kCAAkC"}
|
package/dist/esm/initMCP.mjs
CHANGED
|
@@ -1,32 +1,35 @@
|
|
|
1
|
-
import { findProjectRoot } from "./init.mjs";
|
|
2
1
|
import { PLATFORM_OPTIONS, getDetectedPlatform } from "./initSkills.mjs";
|
|
2
|
+
import { findProjectRoot } from "./init.mjs";
|
|
3
3
|
import { resolve } from "node:path";
|
|
4
4
|
import { PLATFORMS, installMCP } from "@intlayer/chokidar/cli";
|
|
5
5
|
import enquirer from "enquirer";
|
|
6
6
|
import * as p from "@clack/prompts";
|
|
7
7
|
|
|
8
8
|
//#region src/initMCP.ts
|
|
9
|
-
const initMCP = async (projectRoot) => {
|
|
9
|
+
const initMCP = async (projectRoot, preselectedPlatform) => {
|
|
10
10
|
const root = findProjectRoot(projectRoot ? resolve(projectRoot) : process.cwd());
|
|
11
11
|
p.intro("Initializing Intlayer MCP Server");
|
|
12
|
-
const detectedPlatform = getDetectedPlatform();
|
|
13
12
|
let platform;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
13
|
+
if (preselectedPlatform) platform = preselectedPlatform;
|
|
14
|
+
else {
|
|
15
|
+
const detectedPlatform = getDetectedPlatform();
|
|
16
|
+
try {
|
|
17
|
+
platform = (await enquirer.prompt({
|
|
18
|
+
type: "autocomplete",
|
|
19
|
+
name: "platforms",
|
|
20
|
+
message: "Which platform are you using? (Type to search)",
|
|
21
|
+
multiple: false,
|
|
22
|
+
initial: detectedPlatform ? PLATFORMS.indexOf(detectedPlatform) : void 0,
|
|
23
|
+
choices: PLATFORM_OPTIONS.map((opt) => ({
|
|
24
|
+
name: opt.value,
|
|
25
|
+
message: opt.label,
|
|
26
|
+
hint: opt.hint
|
|
27
|
+
}))
|
|
28
|
+
})).platforms;
|
|
29
|
+
} catch {
|
|
30
|
+
p.cancel("Operation cancelled.");
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
30
33
|
}
|
|
31
34
|
if (!platform) {
|
|
32
35
|
p.cancel("Operation cancelled. No platform selected.");
|
package/dist/esm/initMCP.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initMCP.mjs","names":[],"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} from '@intlayer/chokidar/cli';\nimport enquirer from 'enquirer';\nimport { findProjectRoot } from './init';\nimport { getDetectedPlatform, PLATFORM_OPTIONS } from './initSkills';\n\nexport const initMCP = async (projectRoot?: string) => {\n const root = findProjectRoot(\n projectRoot ? resolve(projectRoot) : process.cwd()\n );\n\n p.intro('Initializing Intlayer MCP Server');\n\n
|
|
1
|
+
{"version":3,"file":"initMCP.mjs","names":[],"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,OAAO,gBACX,cAAc,QAAQ,YAAY,GAAG,QAAQ,KAAK,CACnD;AAED,GAAE,MAAM,mCAAmC;CAE3C,IAAI;AAEJ,KAAI,oBACF,YAAW;MACN;EACL,MAAM,mBAAmB,qBAAqB;AAE9C,MAAI;AAeF,eAAW,MAdY,SAAS,OAAgC;IAC9D,MAAM;IACN,MAAM;IACN,SAAS;IACT,UAAU;IACV,SAAS,mBACL,UAAU,QAAQ,iBAAiB,GACnC;IACJ,SAAS,iBAAiB,KAAK,SAAS;KACtC,MAAM,IAAI;KACV,SAAS,IAAI;KACb,MAAM,IAAI;KACX,EAAE;IACJ,CAAC,EACkB;UACd;AACN,KAAE,OAAO,uBAAuB;AAChC;;;AAIJ,KAAI,CAAC,UAAU;AACb,IAAE,OAAO,6CAA6C;AACtD;;CAGF,MAAM,YAAa,MAAM,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,KAAI,EAAE,SAAS,UAAU,IAAI,CAAC,WAAW;AACvC,IAAE,OAAO,uBAAuB;AAChC;;CAGF,MAAM,IAAI,EAAE,SAAS;AACrB,GAAE,MAAM,4BAA4B;AAEpC,KAAI;EACF,MAAM,SAAS,MAAM,WAAW,MAAM,UAAU,UAAU;AAE1D,IAAE,KAAK,qCAAqC;AAE5C,IAAE,KAAK,QAAQ,UAAU;UAClB,OAAO;AACd,IAAE,KAAK,iCAAiC;AACxC,IAAE,IAAI,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,CAAC;;AAGrE,GAAE,MAAM,8CAA8C"}
|
package/dist/esm/initSkills.mjs
CHANGED
|
@@ -29,27 +29,30 @@ const getDependencies = (root) => {
|
|
|
29
29
|
return {};
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
|
-
const initSkills = async (projectRoot) => {
|
|
32
|
+
const initSkills = async (projectRoot, preselectedPlatform) => {
|
|
33
33
|
const root = findProjectRoot(projectRoot ? resolve(projectRoot) : process.cwd());
|
|
34
34
|
p.intro("Initializing Intlayer skills");
|
|
35
|
-
const detectedPlatform = getDetectedPlatform();
|
|
36
35
|
let platform;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
36
|
+
if (preselectedPlatform) platform = preselectedPlatform;
|
|
37
|
+
else {
|
|
38
|
+
const detectedPlatform = getDetectedPlatform();
|
|
39
|
+
try {
|
|
40
|
+
platform = (await enquirer.prompt({
|
|
41
|
+
type: "autocomplete",
|
|
42
|
+
name: "platforms",
|
|
43
|
+
message: "Which platforms are you using? (Type to search)",
|
|
44
|
+
multiple: false,
|
|
45
|
+
initial: detectedPlatform ? PLATFORMS.indexOf(detectedPlatform) : void 0,
|
|
46
|
+
choices: PLATFORM_OPTIONS.map((opt) => ({
|
|
47
|
+
name: opt.value,
|
|
48
|
+
message: opt.label,
|
|
49
|
+
hint: opt.hint
|
|
50
|
+
}))
|
|
51
|
+
})).platforms;
|
|
52
|
+
} catch {
|
|
53
|
+
p.cancel("Operation cancelled.");
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
53
56
|
}
|
|
54
57
|
if (!platform) {
|
|
55
58
|
p.log.warn("No platform selected. Nothing to install.");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initSkills.mjs","names":[],"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 (projectRoot?: string) => {\n const root = findProjectRoot(\n projectRoot ? resolve(projectRoot) : process.cwd()\n );\n\n p.intro('Initializing Intlayer skills');\n\n
|
|
1
|
+
{"version":3,"file":"initSkills.mjs","names":[],"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,kBACJ,UAAU,QAAQ,aAAa,mBAAmB,WAAW,MAAM,CAAC,KACjE,cAAc;CACb,OAAO,mBAAmB,WAAW,gBAAgB;CACrD;CACD,EACF;AAEH,MAAa,mBAIR,UAAU,KAAK,cAAc;CAChC,OAAO;CACP,OAAO,mBAAmB,WAAW,SAAS;CAC9C,MAAM,IAAI,mBAAmB,WAAW,IAAI;CAC7C,EAAE;AAEH,MAAa,4BACX,gBAAgB,MAAM,EAAE,YAAY,OAAO,CAAC,EAAE;AAEhD,MAAM,mBAAmB,SAAyC;AAChE,KAAI;EACF,MAAM,kBAAkB,KAAK,MAAM,eAAe;AAClD,MAAI,CAAC,WAAW,gBAAgB,CAAE,QAAO,EAAE;EAE3C,MAAM,EAAE,eAAe,EAAE,EAAE,kBAAkB,EAAE,KAAK,KAAK,MACvD,aAAa,iBAAiB,QAAQ,CACvC;AACD,SAAO;GAAE,GAAG;GAAc,GAAG;GAAiB;SACxC;AACN,SAAO,EAAE;;;AAIb,MAAa,aAAa,OACxB,aACA,wBACG;CACH,MAAM,OAAO,gBACX,cAAc,QAAQ,YAAY,GAAG,QAAQ,KAAK,CACnD;AAED,GAAE,MAAM,+BAA+B;CAEvC,IAAI;AAEJ,KAAI,oBACF,YAAW;MACN;EACL,MAAM,mBAAmB,qBAAqB;AAE9C,MAAI;AAeF,eAAW,MAdY,SAAS,OAAgC;IAC9D,MAAM;IACN,MAAM;IACN,SAAS;IACT,UAAU;IACV,SAAS,mBACL,UAAU,QAAQ,iBAAiB,GACnC;IACJ,SAAS,iBAAiB,KAAK,SAAS;KACtC,MAAM,IAAI;KACV,SAAS,IAAI;KACb,MAAM,IAAI;KACX,EAAE;IACJ,CAAC,EACkB;UACd;AACN,KAAE,OAAO,uBAAuB;AAChC;;;AAIJ,KAAI,CAAC,UAAU;AACb,IAAE,IAAI,KAAK,4CAA4C;AACvD;;CAIF,MAAM,gBAAgB,iBADD,gBAAgB,KACc,CAAC;CAEpD,MAAM,iBAAiB,MAAM,EAAE,YAAY;EACzC,SAAS;EACT;EACA,SAAS,OAAO,KAAK,WAAW;GAC9B,OAAO;GACP,OAAO;GACP,MAAM,gBAAgB;GACvB,EAAE;EACH,UAAU;EACX,CAAC;AAEF,KACE,EAAE,SAAS,eAAe,IAC1B,CAAC,kBACA,eAA4B,WAAW,GACxC;AACA,IAAE,OAAO,2CAA2C;AACpD;;CAGF,MAAM,IAAI,EAAE,SAAS;AACrB,GAAE,MAAM,uBAAuB;AAE/B,KAAI;EACF,MAAM,SAAS,MAAM,cAAc,MAAM,UAAU,eAAe;AAElE,IAAE,KAAK,gCAAgC;AAEvC,IAAE,KAAK,QAAQ,UAAU;UAClB,OAAO;AACd,IAAE,KAAK,2BAA2B;AAClC,IAAE,IAAI,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,CAAC;;AAGrE,GAAE,MAAM,0CAA0C"}
|
|
@@ -8,8 +8,8 @@ import { formatLocale, formatPath } from "@intlayer/chokidar/utils";
|
|
|
8
8
|
import * as ANSIColors from "@intlayer/config/colors";
|
|
9
9
|
import { colon, colorize, colorizeNumber, getAppLogger } from "@intlayer/config/logger";
|
|
10
10
|
import { getConfiguration } from "@intlayer/config/node";
|
|
11
|
-
import { retryManager } from "@intlayer/config/utils";
|
|
12
11
|
import { readFile } from "node:fs/promises";
|
|
12
|
+
import { retryManager } from "@intlayer/config/utils";
|
|
13
13
|
import { buildAlignmentPlan, mergeReviewedSegments } from "@intlayer/chokidar/docReview";
|
|
14
14
|
import { getLocaleName } from "@intlayer/core/localization";
|
|
15
15
|
import { ENGLISH } from "@intlayer/types/locales";
|
|
@@ -7,8 +7,8 @@ import { dirname, relative } from "node:path";
|
|
|
7
7
|
import { formatLocale, formatPath } from "@intlayer/chokidar/utils";
|
|
8
8
|
import * as ANSIColors from "@intlayer/config/colors";
|
|
9
9
|
import { colon, colorize, colorizeNumber, getAppLogger } from "@intlayer/config/logger";
|
|
10
|
-
import { retryManager } from "@intlayer/config/utils";
|
|
11
10
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
11
|
+
import { retryManager } from "@intlayer/config/utils";
|
|
12
12
|
import { performance } from "node:perf_hooks";
|
|
13
13
|
|
|
14
14
|
//#region src/translateDoc/translateFile.ts
|
|
@@ -5,12 +5,21 @@ type LoginOptions = {
|
|
|
5
5
|
cmsUrl?: string;
|
|
6
6
|
configOptions?: GetConfigurationOptions;
|
|
7
7
|
/**
|
|
8
|
-
* When false, do not call process.exit(0) after a successful
|
|
9
|
-
*
|
|
10
|
-
* Defaults to true to preserve existing standalone-login behaviour.
|
|
11
|
-
* Access-key login always exits because the user must configure .env first.
|
|
8
|
+
* When false, do not call process.exit(0) after a successful login so the
|
|
9
|
+
* caller can continue (e.g. retry a command inline, or finish an interactive
|
|
10
|
+
* setup). Defaults to true to preserve existing standalone-login behaviour.
|
|
12
11
|
*/
|
|
13
12
|
exitAfter?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Invoked with the access-key credentials when the login flow returns a
|
|
15
|
+
* `clientId` / `clientSecret` pair. When provided, the caller takes ownership
|
|
16
|
+
* of persisting the credentials (e.g. writing them to `.env` and enabling the
|
|
17
|
+
* editor in the config), so the default manual-setup instructions are skipped.
|
|
18
|
+
*/
|
|
19
|
+
onCredentials?: (credentials: {
|
|
20
|
+
clientId: string;
|
|
21
|
+
clientSecret: string;
|
|
22
|
+
}) => void | Promise<void>;
|
|
14
23
|
};
|
|
15
24
|
declare const login: (options?: LoginOptions) => Promise<void>;
|
|
16
25
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.d.ts","names":[],"sources":["../../../src/auth/login.ts"],"mappings":";;;KAiEK,YAAA;EACH,MAAA;EACA,aAAA,GAAgB,uBAAA;EAFD
|
|
1
|
+
{"version":3,"file":"login.d.ts","names":[],"sources":["../../../src/auth/login.ts"],"mappings":";;;KAiEK,YAAA;EACH,MAAA;EACA,aAAA,GAAgB,uBAAA;EAFD;;;;;EAQf,SAAA;EAAA;;;;;;EAOA,aAAA,IAAiB,WAAA;IACf,QAAA;IACA,YAAA;EAAA,aACW,OAAA;AAAA;AAAA,cAGF,KAAA,GAAe,OAAA,GAAS,YAAA,KAAiB,OAAA"}
|
package/dist/types/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","names":[],"sources":["../../src/cli.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"cli.d.ts","names":[],"sources":["../../src/cli.ts"],"mappings":";;;cA4Ca,OAAA;AAAA,KA4IR,UAAA;EACH,MAAA;EACA,OAAA;AAAA;AAAA,KAGU,oBAAA;EACV,OAAA;EACA,GAAA;EACA,OAAA;EACA,OAAA;EACA,UAAA;AAAA,IACE,UAAA;AANJ;;;;;;;;AAAA,cAuEa,MAAA,QAAa,OAAA"}
|
package/dist/types/init.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { InitOptions } from "@intlayer/chokidar/cli";
|
|
|
2
2
|
|
|
3
3
|
//#region src/init.d.ts
|
|
4
4
|
declare const findProjectRoot: (startDir: string) => string;
|
|
5
|
-
declare const init: (projectRoot?: string, options?: InitOptions) => Promise<void>;
|
|
5
|
+
declare const init: (projectRoot?: string, options?: InitOptions, interactive?: boolean) => Promise<void>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { findProjectRoot, init };
|
|
8
8
|
//# sourceMappingURL=init.d.ts.map
|
package/dist/types/init.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","names":[],"sources":["../../src/init.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"init.d.ts","names":[],"sources":["../../src/init.ts"],"mappings":";;;cAsBa,eAAA,GAAmB,QAAA;AAAA,cA0enB,IAAA,GACX,WAAA,WACA,OAAA,GAAU,WAAA,EACV,WAAA,eAAqB,OAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region src/initBuildOptimization.d.ts
|
|
2
|
+
/** Intlayer build optimization plugin choices for Next.js. */
|
|
3
|
+
type BuildOptimizationPlugin = 'babel' | 'swc';
|
|
4
|
+
/**
|
|
5
|
+
* Interactive prompt to select a build optimization plugin for Next.js and
|
|
6
|
+
* scaffold the required files. The two options are independent — pick one:
|
|
7
|
+
*
|
|
8
|
+
* - `@intlayer/babel` — runs the full compiler pipeline (extract, purge, minify,
|
|
9
|
+
* optimize) through Babel. Installs `@intlayer/babel` and creates a
|
|
10
|
+
* `babel.config.js`.
|
|
11
|
+
* - `@intlayer/swc` — lightweight SWC plugin that rewrites `useIntlayer` imports.
|
|
12
|
+
* Installs only the dependency; `withIntlayer` wires it in automatically, so
|
|
13
|
+
* no config file is required.
|
|
14
|
+
*
|
|
15
|
+
* @param projectRoot - Optional project root; defaults to the current directory.
|
|
16
|
+
*/
|
|
17
|
+
declare const initBuildOptimization: (projectRoot?: string) => Promise<void>;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { BuildOptimizationPlugin, initBuildOptimization };
|
|
20
|
+
//# sourceMappingURL=initBuildOptimization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initBuildOptimization.d.ts","names":[],"sources":["../../src/initBuildOptimization.ts"],"mappings":";;KAWY,uBAAA;;;;;AAuBZ;;;;;;;;;cAAa,qBAAA,GACX,WAAA,cACC,OAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region src/initCompiler.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Scaffolds the Intlayer compiler for the current project during interactive
|
|
4
|
+
* init.
|
|
5
|
+
*
|
|
6
|
+
* - **Vite** — nothing to do: since v9 the compiler is built into the
|
|
7
|
+
* `intlayer()` plugin in `vite.config.ts`, so this only confirms the setup
|
|
8
|
+
* to the user.
|
|
9
|
+
* - **Next.js** — installs `@intlayer/babel` and writes a `babel.config.js`
|
|
10
|
+
* that runs the extract + optimize compiler passes.
|
|
11
|
+
*
|
|
12
|
+
* In non-interactive init this function is never called, so the compiler setup
|
|
13
|
+
* is left untouched.
|
|
14
|
+
*/
|
|
15
|
+
declare const initCompiler: (projectRoot?: string) => Promise<void>;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { initCompiler };
|
|
18
|
+
//# sourceMappingURL=initCompiler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initCompiler.d.ts","names":[],"sources":["../../src/initCompiler.ts"],"mappings":";;AAyEA;;;;;;;;;;;;cAAa,YAAA,GAAsB,WAAA,cAAuB,OAAA"}
|
package/dist/types/initMCP.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { Platform } from "@intlayer/chokidar/cli";
|
|
2
|
+
|
|
1
3
|
//#region src/initMCP.d.ts
|
|
2
|
-
declare const initMCP: (projectRoot?: string) => Promise<void>;
|
|
4
|
+
declare const initMCP: (projectRoot?: string, preselectedPlatform?: Platform) => Promise<void>;
|
|
3
5
|
//#endregion
|
|
4
6
|
export { initMCP };
|
|
5
7
|
//# sourceMappingURL=initMCP.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initMCP.d.ts","names":[],"sources":["../../src/initMCP.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"initMCP.d.ts","names":[],"sources":["../../src/initMCP.ts"],"mappings":";;;cAYa,OAAA,GACX,WAAA,WACA,mBAAA,GAAsB,QAAA,KAAQ,OAAA"}
|
|
@@ -7,7 +7,7 @@ declare const PLATFORM_OPTIONS: Array<{
|
|
|
7
7
|
hint: string;
|
|
8
8
|
}>;
|
|
9
9
|
declare const getDetectedPlatform: () => Platform | undefined;
|
|
10
|
-
declare const initSkills: (projectRoot?: string) => Promise<void>;
|
|
10
|
+
declare const initSkills: (projectRoot?: string, preselectedPlatform?: Platform) => Promise<void>;
|
|
11
11
|
//#endregion
|
|
12
12
|
export { PLATFORM_OPTIONS, getDetectedPlatform, initSkills };
|
|
13
13
|
//# sourceMappingURL=initSkills.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initSkills.d.ts","names":[],"sources":["../../src/initSkills.ts"],"mappings":";;;cAuBa,gBAAA,EAAkB,KAAA;EAC7B,KAAA,EAAO,QAAA;EACP,KAAA;EACA,IAAA;AAAA;AAAA,cAOW,mBAAA,QAA0B,QAAA;AAAA,cAiB1B,UAAA,
|
|
1
|
+
{"version":3,"file":"initSkills.d.ts","names":[],"sources":["../../src/initSkills.ts"],"mappings":";;;cAuBa,gBAAA,EAAkB,KAAA;EAC7B,KAAA,EAAO,QAAA;EACP,KAAA;EACA,IAAA;AAAA;AAAA,cAOW,mBAAA,QAA0B,QAAA;AAAA,cAiB1B,UAAA,GACX,WAAA,WACA,mBAAA,GAAsB,QAAA,KAAQ,OAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/cli",
|
|
3
|
-
"version": "9.0.0-canary.
|
|
3
|
+
"version": "9.0.0-canary.11",
|
|
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,23 +67,23 @@
|
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"@clack/prompts": "0.11.0",
|
|
70
|
-
"@intlayer/api": "9.0.0-canary.
|
|
71
|
-
"@intlayer/babel": "9.0.0-canary.
|
|
72
|
-
"@intlayer/chokidar": "9.0.0-canary.
|
|
73
|
-
"@intlayer/config": "9.0.0-canary.
|
|
74
|
-
"@intlayer/core": "9.0.0-canary.
|
|
75
|
-
"@intlayer/dictionaries-entry": "9.0.0-canary.
|
|
76
|
-
"@intlayer/remote-dictionaries-entry": "9.0.0-canary.
|
|
77
|
-
"@intlayer/types": "9.0.0-canary.
|
|
78
|
-
"@intlayer/unmerged-dictionaries-entry": "9.0.0-canary.
|
|
70
|
+
"@intlayer/api": "9.0.0-canary.11",
|
|
71
|
+
"@intlayer/babel": "9.0.0-canary.11",
|
|
72
|
+
"@intlayer/chokidar": "9.0.0-canary.11",
|
|
73
|
+
"@intlayer/config": "9.0.0-canary.11",
|
|
74
|
+
"@intlayer/core": "9.0.0-canary.11",
|
|
75
|
+
"@intlayer/dictionaries-entry": "9.0.0-canary.11",
|
|
76
|
+
"@intlayer/remote-dictionaries-entry": "9.0.0-canary.11",
|
|
77
|
+
"@intlayer/types": "9.0.0-canary.11",
|
|
78
|
+
"@intlayer/unmerged-dictionaries-entry": "9.0.0-canary.11",
|
|
79
79
|
"commander": "14.0.3",
|
|
80
80
|
"enquirer": "2.4.1",
|
|
81
81
|
"eventsource": "4.1.0",
|
|
82
82
|
"fast-glob": "3.3.3"
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
|
-
"@intlayer/ai": "9.0.0-canary.
|
|
86
|
-
"@types/node": "25.9.
|
|
85
|
+
"@intlayer/ai": "9.0.0-canary.11",
|
|
86
|
+
"@types/node": "25.9.4",
|
|
87
87
|
"@utils/ts-config": "1.0.4",
|
|
88
88
|
"@utils/ts-config-types": "1.0.4",
|
|
89
89
|
"@utils/tsdown-config": "1.0.4",
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"vitest": "4.1.9"
|
|
94
94
|
},
|
|
95
95
|
"peerDependencies": {
|
|
96
|
-
"@intlayer/ai": "9.0.0-canary.
|
|
96
|
+
"@intlayer/ai": "9.0.0-canary.11"
|
|
97
97
|
},
|
|
98
98
|
"peerDependenciesMeta": {
|
|
99
99
|
"@intlayer/ai": {
|