@intlayer/mcp 7.5.10 → 7.5.12
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/tools/cli.cjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let node_path = require("node:path");
|
|
3
|
+
let _intlayer_chokidar = require("@intlayer/chokidar");
|
|
2
4
|
let _intlayer_cli = require("@intlayer/cli");
|
|
3
5
|
let _intlayer_types = require("@intlayer/types");
|
|
4
6
|
let zod_v3 = require("zod/v3");
|
|
@@ -195,22 +197,26 @@ const loadCLITools = async (server) => {
|
|
|
195
197
|
server.registerTool("intlayer-content-list", {
|
|
196
198
|
title: "List Content Declarations",
|
|
197
199
|
description: "List the content declaration (.content.{ts,tsx,js,json,...}) files present in the project. That files contain the multilingual content of the application and are used to build the dictionaries.",
|
|
198
|
-
inputSchema: {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
200
|
+
inputSchema: {
|
|
201
|
+
configOptions: zod_v3.default.object({
|
|
202
|
+
baseDir: zod_v3.default.string().optional(),
|
|
203
|
+
env: zod_v3.default.string().optional(),
|
|
204
|
+
envFile: zod_v3.default.string().optional(),
|
|
205
|
+
override: zod_v3.default.object({ log: zod_v3.default.object({
|
|
206
|
+
prefix: zod_v3.default.string().optional(),
|
|
207
|
+
verbose: zod_v3.default.boolean().optional()
|
|
208
|
+
}).optional() }).optional()
|
|
209
|
+
}).optional().describe("Configuration options"),
|
|
210
|
+
absolute: zod_v3.default.boolean().optional().describe("Output the results as absolute paths instead of relative paths"),
|
|
211
|
+
json: zod_v3.default.boolean().optional().describe("Output the results as JSON instead of formatted text")
|
|
212
|
+
},
|
|
207
213
|
annotations: { readOnlyHint: true }
|
|
208
214
|
}, async (props) => {
|
|
209
215
|
try {
|
|
210
216
|
const rows = (0, _intlayer_cli.listContentDeclarationRows)(props);
|
|
211
217
|
return { content: [{
|
|
212
218
|
type: "text",
|
|
213
|
-
text: JSON.stringify(rows, null, 2)
|
|
219
|
+
text: props.json ? JSON.stringify(rows) : JSON.stringify(rows, null, 2)
|
|
214
220
|
}] };
|
|
215
221
|
} catch (error) {
|
|
216
222
|
return { content: [{
|
|
@@ -281,6 +287,38 @@ const loadCLITools = async (server) => {
|
|
|
281
287
|
}] };
|
|
282
288
|
}
|
|
283
289
|
});
|
|
290
|
+
server.registerTool("intlayer-projects-list", {
|
|
291
|
+
title: "List Projects",
|
|
292
|
+
description: "List all Intlayer projects in the directory. Search for configuration files to find all Intlayer projects.",
|
|
293
|
+
inputSchema: {
|
|
294
|
+
baseDir: zod_v3.default.string().optional().describe("Base directory to search from"),
|
|
295
|
+
gitRoot: zod_v3.default.boolean().optional().describe("Search from the git root directory instead of the base directory"),
|
|
296
|
+
absolute: zod_v3.default.boolean().optional().describe("Output the results as absolute paths instead of relative paths"),
|
|
297
|
+
json: zod_v3.default.boolean().optional().describe("Output the results as JSON instead of formatted text")
|
|
298
|
+
},
|
|
299
|
+
annotations: { readOnlyHint: true }
|
|
300
|
+
}, async (props) => {
|
|
301
|
+
try {
|
|
302
|
+
const { searchDir, projectsPath } = await (0, _intlayer_chokidar.listProjects)({
|
|
303
|
+
baseDir: props.baseDir,
|
|
304
|
+
gitRoot: props.gitRoot
|
|
305
|
+
});
|
|
306
|
+
const projectsRelativePath = projectsPath.map((projectPath) => props.absolute ? projectPath : (0, node_path.relative)(searchDir, projectPath)).map((projectPath) => projectPath === "" ? "." : projectPath);
|
|
307
|
+
const outputPaths = props.absolute ? projectsPath : projectsRelativePath;
|
|
308
|
+
return { content: [{
|
|
309
|
+
type: "text",
|
|
310
|
+
text: props.json ? JSON.stringify(outputPaths) : JSON.stringify({
|
|
311
|
+
searchDir,
|
|
312
|
+
projectsPath: outputPaths
|
|
313
|
+
}, null, 2)
|
|
314
|
+
}] };
|
|
315
|
+
} catch (error) {
|
|
316
|
+
return { content: [{
|
|
317
|
+
type: "text",
|
|
318
|
+
text: `Projects list failed: ${error instanceof Error ? error.message : "An unknown error occurred"}`
|
|
319
|
+
}] };
|
|
320
|
+
}
|
|
321
|
+
});
|
|
284
322
|
};
|
|
285
323
|
|
|
286
324
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.cjs","names":["loadCLITools: LoadCLITools","z","log: Partial<LogConfig>","Locales","fillOptions: any","pushOptions: any"],"sources":["../../../src/tools/cli.ts"],"sourcesContent":["import {\n build,\n fill,\n init,\n listContentDeclarationRows,\n listMissingTranslations,\n pull,\n push,\n transform,\n} from '@intlayer/cli';\nimport { Locales, type LogConfig } from '@intlayer/types';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport z from 'zod/v3';\n\ntype LoadCLITools = (server: McpServer) => Promise<void>;\n\nexport const loadCLITools: LoadCLITools = async (server) => {\n server.registerTool(\n 'intlayer-init',\n {\n title: 'Initialize Intlayer',\n description: 'Initialize Intlayer in the project',\n inputSchema: {\n projectRoot: z.string().describe('Project root directory'),\n },\n annotations: {\n destructiveHint: true,\n },\n },\n async ({ projectRoot }) => {\n try {\n await init(projectRoot);\n\n return {\n content: [\n {\n type: 'text',\n text: 'Initialization successful.',\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Initialization failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-build',\n {\n title: 'Build Dictionaries',\n description:\n 'Build the dictionaries. List all content declarations files `.content.{ts,tsx,js,json,...}` to update the content callable using the `useIntlayer` hook.',\n inputSchema: {\n watch: z.boolean().optional().describe('Watch for changes'),\n baseDir: z.string().optional().describe('Base directory'),\n env: z.string().optional().describe('Environment'),\n envFile: z.string().optional().describe('Environment file'),\n verbose: z.boolean().optional().describe('Verbose output'),\n prefix: z.string().optional().describe('Log prefix'),\n },\n annotations: {\n destructiveHint: true,\n },\n },\n async ({ watch, baseDir, env, envFile, verbose, prefix }) => {\n try {\n const log: Partial<LogConfig> = {};\n if (verbose) {\n log.mode = 'verbose';\n }\n if (prefix) {\n log.prefix = prefix;\n }\n\n await build({\n watch,\n configOptions: {\n baseDir,\n env,\n envFile,\n override: {\n log,\n },\n },\n });\n\n return {\n content: [\n {\n type: 'text',\n text: 'Build successful.',\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Build failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-fill',\n {\n title: 'Fill Translations',\n description:\n 'Fill the dictionaries with missing translations / review translations using Intlayer servers',\n inputSchema: {\n sourceLocale: z\n .nativeEnum(Locales.ALL_LOCALES)\n .optional()\n .describe('Source locale'),\n outputLocales: z\n .union([\n z.nativeEnum(Locales.ALL_LOCALES),\n z.array(z.nativeEnum(Locales.ALL_LOCALES)),\n ])\n .optional()\n .describe('Output locales'),\n file: z\n .union([z.string(), z.array(z.string())])\n .optional()\n .describe('File path'),\n mode: z.enum(['complete', 'review']).optional().describe('Fill mode'),\n keys: z\n .union([z.string(), z.array(z.string())])\n .optional()\n .describe('Keys to include'),\n excludedKeys: z\n .union([z.string(), z.array(z.string())])\n .optional()\n .describe('Keys to exclude'),\n pathFilter: z\n .union([z.string(), z.array(z.string())])\n .optional()\n .describe('Path filter'),\n gitOptions: z\n .object({\n gitDiff: z.boolean().optional(),\n gitDiffBase: z.string().optional(),\n gitDiffCurrent: z.string().optional(),\n uncommitted: z.boolean().optional(),\n unpushed: z.boolean().optional(),\n untracked: z.boolean().optional(),\n })\n .optional()\n .describe('Git options'),\n aiOptions: z\n .object({\n provider: z.string().optional(),\n temperature: z.number().optional(),\n model: z.string().optional(),\n apiKey: z.string().optional(),\n customPrompt: z.string().optional(),\n applicationContext: z.string().optional(),\n })\n .optional()\n .describe('AI options'),\n },\n annotations: {\n destructiveHint: true,\n },\n },\n async (props) => {\n try {\n const { gitOptions, ...rest } = props;\n const fillOptions: any = { ...rest, gitOptions: undefined };\n\n if (gitOptions) {\n const { gitDiff, uncommitted, unpushed, untracked, ...restGit } =\n gitOptions;\n const mode = [];\n if (gitDiff) mode.push('gitDiff');\n if (uncommitted) mode.push('uncommitted');\n if (unpushed) mode.push('unpushed');\n if (untracked) mode.push('untracked');\n\n fillOptions.gitOptions = { ...restGit, mode };\n }\n\n await fill(fillOptions);\n\n return {\n content: [\n {\n type: 'text',\n text: 'Fill successful.',\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Fill failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-push',\n {\n title: 'Push Dictionaries',\n description: 'Push local dictionaries to the server',\n inputSchema: {\n deleteLocaleDictionary: z\n .boolean()\n .optional()\n .describe('Delete local dictionary after push'),\n keepLocaleDictionary: z\n .boolean()\n .optional()\n .describe('Keep local dictionary after push'),\n dictionaries: z\n .array(z.string())\n .optional()\n .describe('List of dictionaries to push'),\n gitOptions: z\n .object({\n gitDiff: z.boolean().optional(),\n gitDiffBase: z.string().optional(),\n gitDiffCurrent: z.string().optional(),\n uncommitted: z.boolean().optional(),\n unpushed: z.boolean().optional(),\n untracked: z.boolean().optional(),\n })\n .optional()\n .describe('Git options'),\n },\n annotations: {\n destructiveHint: true,\n },\n },\n async (props) => {\n try {\n const { gitOptions, ...rest } = props;\n const pushOptions: any = { ...rest, gitOptions: undefined };\n\n if (gitOptions) {\n const { gitDiff, uncommitted, unpushed, untracked, ...restGit } =\n gitOptions;\n const mode = [];\n if (gitDiff) mode.push('gitDiff');\n if (uncommitted) mode.push('uncommitted');\n if (unpushed) mode.push('unpushed');\n if (untracked) mode.push('untracked');\n\n pushOptions.gitOptions = { ...restGit, mode };\n }\n\n await push(pushOptions);\n\n return {\n content: [\n {\n type: 'text',\n text: 'Push successful.',\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Push failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-pull',\n {\n title: 'Pull Dictionaries',\n description: 'Pull dictionaries from the CMS',\n inputSchema: {\n dictionaries: z\n .array(z.string())\n .optional()\n .describe('List of dictionaries to pull'),\n newDictionariesPath: z\n .string()\n .optional()\n .describe('Path to save new dictionaries'),\n },\n annotations: {\n destructiveHint: true,\n },\n },\n async (props) => {\n try {\n await pull(props);\n\n return {\n content: [\n {\n type: 'text',\n text: 'Pull successful.',\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Pull failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-content-list',\n {\n title: 'List Content Declarations',\n description:\n 'List the content declaration (.content.{ts,tsx,js,json,...}) files present in the project. That files contain the multilingual content of the application and are used to build the dictionaries.',\n inputSchema: {\n configOptions: z\n .object({\n baseDir: z.string().optional(),\n env: z.string().optional(),\n envFile: z.string().optional(),\n override: z\n .object({\n log: z\n .object({\n prefix: z.string().optional(),\n verbose: z.boolean().optional(),\n })\n .optional(),\n })\n .optional(),\n })\n .optional()\n .describe('Configuration options'),\n },\n annotations: {\n readOnlyHint: true,\n },\n },\n async (props) => {\n try {\n const rows = listContentDeclarationRows(props);\n return {\n content: [\n {\n type: 'text',\n text: JSON.stringify(rows, null, 2),\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Content list failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-content-test',\n {\n title: 'Test Translations',\n description:\n 'Test if there are missing translations in the content declaration files. That files contain the multilingual content of the application and are used to build the dictionaries.',\n inputSchema: {\n configOptions: z\n .object({\n baseDir: z.string().optional(),\n env: z.string().optional(),\n envFile: z.string().optional(),\n override: z\n .object({\n log: z\n .object({\n prefix: z.string().optional(),\n verbose: z.boolean().optional(),\n })\n .optional(),\n })\n .optional(),\n })\n .optional()\n .describe('Configuration options'),\n },\n annotations: {\n readOnlyHint: true,\n },\n },\n async (props) => {\n try {\n const missingTranslations = listMissingTranslations(\n props?.configOptions\n );\n return {\n content: [\n {\n type: 'text',\n text: JSON.stringify(missingTranslations, null, 2),\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Content test failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-transform',\n {\n title: 'Transform Component',\n description:\n 'Transform an existing component to use Intlayer. Trigger this action to transform an existing component to be multilingual. If the component does not exist, create a normal React component including text in JSX, and then trigger this tool to transform it.',\n inputSchema: {\n file: z\n .union([z.string(), z.array(z.string())])\n .optional()\n .describe('List of files to transform'),\n outputContentDeclarations: z\n .string()\n .optional()\n .describe('Path to output content declaration files'),\n configOptions: z\n .object({\n baseDir: z.string().optional(),\n env: z.string().optional(),\n envFile: z.string().optional(),\n override: z\n .object({\n log: z\n .object({\n prefix: z.string().optional(),\n verbose: z.boolean().optional(),\n })\n .optional(),\n })\n .optional(),\n })\n .optional()\n .describe('Configuration options'),\n },\n annotations: {\n destructiveHint: true,\n },\n },\n async (props) => {\n try {\n await transform({\n files: Array.isArray(props.file)\n ? props.file\n : props.file\n ? [props.file]\n : undefined,\n outputContentDeclarations: props.outputContentDeclarations,\n configOptions: props.configOptions,\n });\n\n return {\n content: [\n {\n type: 'text',\n text: 'Transform successful.',\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Transform failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n};\n"],"mappings":";;;;;;;AAgBA,MAAaA,eAA6B,OAAO,WAAW;AAC1D,QAAO,aACL,iBACA;EACE,OAAO;EACP,aAAa;EACb,aAAa,EACX,aAAaC,eAAE,QAAQ,CAAC,SAAS,yBAAyB,EAC3D;EACD,aAAa,EACX,iBAAiB,MAClB;EACF,EACD,OAAO,EAAE,kBAAkB;AACzB,MAAI;AACF,iCAAW,YAAY;AAEvB,UAAO,EACL,SAAS,CACP;IACE,MAAM;IACN,MAAM;IACP,CACF,EACF;WACM,OAAO;AAGd,UAAO,EACL,SAAS,CACP;IACE,MAAM;IACN,MAAM,0BALV,iBAAiB,QAAQ,MAAM,UAAU;IAMtC,CACF,EACF;;GAGN;AAED,QAAO,aACL,kBACA;EACE,OAAO;EACP,aACE;EACF,aAAa;GACX,OAAOA,eAAE,SAAS,CAAC,UAAU,CAAC,SAAS,oBAAoB;GAC3D,SAASA,eAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,iBAAiB;GACzD,KAAKA,eAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,cAAc;GAClD,SAASA,eAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,mBAAmB;GAC3D,SAASA,eAAE,SAAS,CAAC,UAAU,CAAC,SAAS,iBAAiB;GAC1D,QAAQA,eAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,aAAa;GACrD;EACD,aAAa,EACX,iBAAiB,MAClB;EACF,EACD,OAAO,EAAE,OAAO,SAAS,KAAK,SAAS,SAAS,aAAa;AAC3D,MAAI;GACF,MAAMC,MAA0B,EAAE;AAClC,OAAI,QACF,KAAI,OAAO;AAEb,OAAI,OACF,KAAI,SAAS;AAGf,kCAAY;IACV;IACA,eAAe;KACb;KACA;KACA;KACA,UAAU,EACR,KACD;KACF;IACF,CAAC;AAEF,UAAO,EACL,SAAS,CACP;IACE,MAAM;IACN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;WACM,OAAO;AAGd,UAAO,EACL,SAAS,CACP;IACE,MAAM;IACN,MAAM,qBALV,iBAAiB,QAAQ,MAAM,UAAU;IAMtC,CACF,EACF;;GAGN"}
|
|
1
|
+
{"version":3,"file":"cli.cjs","names":["loadCLITools: LoadCLITools","z","log: Partial<LogConfig>","Locales","fillOptions: any","pushOptions: any"],"sources":["../../../src/tools/cli.ts"],"sourcesContent":["import { relative } from 'node:path';\nimport { listProjects } from '@intlayer/chokidar';\nimport {\n build,\n fill,\n init,\n listContentDeclarationRows,\n listMissingTranslations,\n pull,\n push,\n transform,\n} from '@intlayer/cli';\nimport { Locales, type LogConfig } from '@intlayer/types';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport z from 'zod/v3';\n\ntype LoadCLITools = (server: McpServer) => Promise<void>;\n\nexport const loadCLITools: LoadCLITools = async (server) => {\n server.registerTool(\n 'intlayer-init',\n {\n title: 'Initialize Intlayer',\n description: 'Initialize Intlayer in the project',\n inputSchema: {\n projectRoot: z.string().describe('Project root directory'),\n },\n annotations: {\n destructiveHint: true,\n },\n },\n async ({ projectRoot }) => {\n try {\n await init(projectRoot);\n\n return {\n content: [\n {\n type: 'text',\n text: 'Initialization successful.',\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Initialization failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-build',\n {\n title: 'Build Dictionaries',\n description:\n 'Build the dictionaries. List all content declarations files `.content.{ts,tsx,js,json,...}` to update the content callable using the `useIntlayer` hook.',\n inputSchema: {\n watch: z.boolean().optional().describe('Watch for changes'),\n baseDir: z.string().optional().describe('Base directory'),\n env: z.string().optional().describe('Environment'),\n envFile: z.string().optional().describe('Environment file'),\n verbose: z.boolean().optional().describe('Verbose output'),\n prefix: z.string().optional().describe('Log prefix'),\n },\n annotations: {\n destructiveHint: true,\n },\n },\n async ({ watch, baseDir, env, envFile, verbose, prefix }) => {\n try {\n const log: Partial<LogConfig> = {};\n if (verbose) {\n log.mode = 'verbose';\n }\n if (prefix) {\n log.prefix = prefix;\n }\n\n await build({\n watch,\n configOptions: {\n baseDir,\n env,\n envFile,\n override: {\n log,\n },\n },\n });\n\n return {\n content: [\n {\n type: 'text',\n text: 'Build successful.',\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Build failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-fill',\n {\n title: 'Fill Translations',\n description:\n 'Fill the dictionaries with missing translations / review translations using Intlayer servers',\n inputSchema: {\n sourceLocale: z\n .nativeEnum(Locales.ALL_LOCALES)\n .optional()\n .describe('Source locale'),\n outputLocales: z\n .union([\n z.nativeEnum(Locales.ALL_LOCALES),\n z.array(z.nativeEnum(Locales.ALL_LOCALES)),\n ])\n .optional()\n .describe('Output locales'),\n file: z\n .union([z.string(), z.array(z.string())])\n .optional()\n .describe('File path'),\n mode: z.enum(['complete', 'review']).optional().describe('Fill mode'),\n keys: z\n .union([z.string(), z.array(z.string())])\n .optional()\n .describe('Keys to include'),\n excludedKeys: z\n .union([z.string(), z.array(z.string())])\n .optional()\n .describe('Keys to exclude'),\n pathFilter: z\n .union([z.string(), z.array(z.string())])\n .optional()\n .describe('Path filter'),\n gitOptions: z\n .object({\n gitDiff: z.boolean().optional(),\n gitDiffBase: z.string().optional(),\n gitDiffCurrent: z.string().optional(),\n uncommitted: z.boolean().optional(),\n unpushed: z.boolean().optional(),\n untracked: z.boolean().optional(),\n })\n .optional()\n .describe('Git options'),\n aiOptions: z\n .object({\n provider: z.string().optional(),\n temperature: z.number().optional(),\n model: z.string().optional(),\n apiKey: z.string().optional(),\n customPrompt: z.string().optional(),\n applicationContext: z.string().optional(),\n })\n .optional()\n .describe('AI options'),\n },\n annotations: {\n destructiveHint: true,\n },\n },\n async (props) => {\n try {\n const { gitOptions, ...rest } = props;\n const fillOptions: any = { ...rest, gitOptions: undefined };\n\n if (gitOptions) {\n const { gitDiff, uncommitted, unpushed, untracked, ...restGit } =\n gitOptions;\n const mode = [];\n if (gitDiff) mode.push('gitDiff');\n if (uncommitted) mode.push('uncommitted');\n if (unpushed) mode.push('unpushed');\n if (untracked) mode.push('untracked');\n\n fillOptions.gitOptions = { ...restGit, mode };\n }\n\n await fill(fillOptions);\n\n return {\n content: [\n {\n type: 'text',\n text: 'Fill successful.',\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Fill failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-push',\n {\n title: 'Push Dictionaries',\n description: 'Push local dictionaries to the server',\n inputSchema: {\n deleteLocaleDictionary: z\n .boolean()\n .optional()\n .describe('Delete local dictionary after push'),\n keepLocaleDictionary: z\n .boolean()\n .optional()\n .describe('Keep local dictionary after push'),\n dictionaries: z\n .array(z.string())\n .optional()\n .describe('List of dictionaries to push'),\n gitOptions: z\n .object({\n gitDiff: z.boolean().optional(),\n gitDiffBase: z.string().optional(),\n gitDiffCurrent: z.string().optional(),\n uncommitted: z.boolean().optional(),\n unpushed: z.boolean().optional(),\n untracked: z.boolean().optional(),\n })\n .optional()\n .describe('Git options'),\n },\n annotations: {\n destructiveHint: true,\n },\n },\n async (props) => {\n try {\n const { gitOptions, ...rest } = props;\n const pushOptions: any = { ...rest, gitOptions: undefined };\n\n if (gitOptions) {\n const { gitDiff, uncommitted, unpushed, untracked, ...restGit } =\n gitOptions;\n const mode = [];\n if (gitDiff) mode.push('gitDiff');\n if (uncommitted) mode.push('uncommitted');\n if (unpushed) mode.push('unpushed');\n if (untracked) mode.push('untracked');\n\n pushOptions.gitOptions = { ...restGit, mode };\n }\n\n await push(pushOptions);\n\n return {\n content: [\n {\n type: 'text',\n text: 'Push successful.',\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Push failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-pull',\n {\n title: 'Pull Dictionaries',\n description: 'Pull dictionaries from the CMS',\n inputSchema: {\n dictionaries: z\n .array(z.string())\n .optional()\n .describe('List of dictionaries to pull'),\n newDictionariesPath: z\n .string()\n .optional()\n .describe('Path to save new dictionaries'),\n },\n annotations: {\n destructiveHint: true,\n },\n },\n async (props) => {\n try {\n await pull(props);\n\n return {\n content: [\n {\n type: 'text',\n text: 'Pull successful.',\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Pull failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-content-list',\n {\n title: 'List Content Declarations',\n description:\n 'List the content declaration (.content.{ts,tsx,js,json,...}) files present in the project. That files contain the multilingual content of the application and are used to build the dictionaries.',\n inputSchema: {\n configOptions: z\n .object({\n baseDir: z.string().optional(),\n env: z.string().optional(),\n envFile: z.string().optional(),\n override: z\n .object({\n log: z\n .object({\n prefix: z.string().optional(),\n verbose: z.boolean().optional(),\n })\n .optional(),\n })\n .optional(),\n })\n .optional()\n .describe('Configuration options'),\n absolute: z\n .boolean()\n .optional()\n .describe(\n 'Output the results as absolute paths instead of relative paths'\n ),\n json: z\n .boolean()\n .optional()\n .describe('Output the results as JSON instead of formatted text'),\n },\n annotations: {\n readOnlyHint: true,\n },\n },\n async (props) => {\n try {\n const rows = listContentDeclarationRows(props);\n return {\n content: [\n {\n type: 'text',\n text: props.json\n ? JSON.stringify(rows)\n : JSON.stringify(rows, null, 2),\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Content list failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-content-test',\n {\n title: 'Test Translations',\n description:\n 'Test if there are missing translations in the content declaration files. That files contain the multilingual content of the application and are used to build the dictionaries.',\n inputSchema: {\n configOptions: z\n .object({\n baseDir: z.string().optional(),\n env: z.string().optional(),\n envFile: z.string().optional(),\n override: z\n .object({\n log: z\n .object({\n prefix: z.string().optional(),\n verbose: z.boolean().optional(),\n })\n .optional(),\n })\n .optional(),\n })\n .optional()\n .describe('Configuration options'),\n },\n annotations: {\n readOnlyHint: true,\n },\n },\n async (props) => {\n try {\n const missingTranslations = listMissingTranslations(\n props?.configOptions\n );\n return {\n content: [\n {\n type: 'text',\n text: JSON.stringify(missingTranslations, null, 2),\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Content test failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-transform',\n {\n title: 'Transform Component',\n description:\n 'Transform an existing component to use Intlayer. Trigger this action to transform an existing component to be multilingual. If the component does not exist, create a normal React component including text in JSX, and then trigger this tool to transform it.',\n inputSchema: {\n file: z\n .union([z.string(), z.array(z.string())])\n .optional()\n .describe('List of files to transform'),\n outputContentDeclarations: z\n .string()\n .optional()\n .describe('Path to output content declaration files'),\n configOptions: z\n .object({\n baseDir: z.string().optional(),\n env: z.string().optional(),\n envFile: z.string().optional(),\n override: z\n .object({\n log: z\n .object({\n prefix: z.string().optional(),\n verbose: z.boolean().optional(),\n })\n .optional(),\n })\n .optional(),\n })\n .optional()\n .describe('Configuration options'),\n },\n annotations: {\n destructiveHint: true,\n },\n },\n async (props) => {\n try {\n await transform({\n files: Array.isArray(props.file)\n ? props.file\n : props.file\n ? [props.file]\n : undefined,\n outputContentDeclarations: props.outputContentDeclarations,\n configOptions: props.configOptions,\n });\n\n return {\n content: [\n {\n type: 'text',\n text: 'Transform successful.',\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Transform failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-projects-list',\n {\n title: 'List Projects',\n description:\n 'List all Intlayer projects in the directory. Search for configuration files to find all Intlayer projects.',\n inputSchema: {\n baseDir: z\n .string()\n .optional()\n .describe('Base directory to search from'),\n gitRoot: z\n .boolean()\n .optional()\n .describe(\n 'Search from the git root directory instead of the base directory'\n ),\n absolute: z\n .boolean()\n .optional()\n .describe(\n 'Output the results as absolute paths instead of relative paths'\n ),\n json: z\n .boolean()\n .optional()\n .describe('Output the results as JSON instead of formatted text'),\n },\n annotations: {\n readOnlyHint: true,\n },\n },\n async (props) => {\n try {\n const { searchDir, projectsPath } = await listProjects({\n baseDir: props.baseDir,\n gitRoot: props.gitRoot,\n });\n\n // Handle absolute option similar to CLI command\n const projectsRelativePath = projectsPath\n .map((projectPath) =>\n props.absolute ? projectPath : relative(searchDir, projectPath)\n )\n .map((projectPath) => (projectPath === '' ? '.' : projectPath));\n\n const outputPaths = props.absolute\n ? projectsPath\n : projectsRelativePath;\n\n return {\n content: [\n {\n type: 'text',\n text: props.json\n ? JSON.stringify(outputPaths)\n : JSON.stringify(\n { searchDir, projectsPath: outputPaths },\n null,\n 2\n ),\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Projects list failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n};\n"],"mappings":";;;;;;;;;AAkBA,MAAaA,eAA6B,OAAO,WAAW;AAC1D,QAAO,aACL,iBACA;EACE,OAAO;EACP,aAAa;EACb,aAAa,EACX,aAAaC,eAAE,QAAQ,CAAC,SAAS,yBAAyB,EAC3D;EACD,aAAa,EACX,iBAAiB,MAClB;EACF,EACD,OAAO,EAAE,kBAAkB;A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GACX,SAASA,eACN,QAAQ,CACR,UAAU,CACV,SAAS,gCAAgC;GAC5C,SAASA,eACN,SAAS,CACT,UAAU,CACV,SACC,mEACD;GACH,UAAUA,eACP,SAAS,CACT,UAAU,CACV,SACC,iEACD;GACH,MAAMA,eACH,SAAS,CACT,UAAU,CACV,SAAS,uDAAuD;GACpE;EACD,aAAa,EACX,cAAc,MACf;EACF,EACD,OAAO,UAAU;AACf,MAAI;GACF,MAAM,EAAE,WAAW,iBAAiB,2CAAmB;IACrD,SAAS,MAAM;IACf,SAAS,MAAM;IAChB,CAAC;GAGF,MAAM,uBAAuB,aAC1B,KAAK,gBACJ,MAAM,WAAW,sCAAuB,WAAW,YAAY,CAChE,CACA,KAAK,gBAAiB,gBAAgB,KAAK,MAAM,YAAa;GAEjE,MAAM,cAAc,MAAM,WACtB,eACA;AAEJ,UAAO,EACL,SAAS,CACP;IACE,MAAM;IACN,MAAM,MAAM,OACR,KAAK,UAAU,YAAY,GAC3B,KAAK,UACH;KAAE;KAAW,cAAc;KAAa,EACxC,MACA,EACD;IACN,CACF,EACF;WACM,OAAO;AAGd,UAAO,EACL,SAAS,CACP;IACE,MAAM;IACN,MAAM,yBALV,iBAAiB,QAAQ,MAAM,UAAU;IAMtC,CACF,EACF;;GAGN"}
|
package/dist/esm/tools/cli.mjs
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { relative } from "node:path";
|
|
2
|
+
import { listProjects } from "@intlayer/chokidar";
|
|
1
3
|
import { build, fill, init, listContentDeclarationRows, listMissingTranslations, pull, push, transform } from "@intlayer/cli";
|
|
2
4
|
import { Locales } from "@intlayer/types";
|
|
3
5
|
import z from "zod/v3";
|
|
@@ -193,22 +195,26 @@ const loadCLITools = async (server) => {
|
|
|
193
195
|
server.registerTool("intlayer-content-list", {
|
|
194
196
|
title: "List Content Declarations",
|
|
195
197
|
description: "List the content declaration (.content.{ts,tsx,js,json,...}) files present in the project. That files contain the multilingual content of the application and are used to build the dictionaries.",
|
|
196
|
-
inputSchema: {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
198
|
+
inputSchema: {
|
|
199
|
+
configOptions: z.object({
|
|
200
|
+
baseDir: z.string().optional(),
|
|
201
|
+
env: z.string().optional(),
|
|
202
|
+
envFile: z.string().optional(),
|
|
203
|
+
override: z.object({ log: z.object({
|
|
204
|
+
prefix: z.string().optional(),
|
|
205
|
+
verbose: z.boolean().optional()
|
|
206
|
+
}).optional() }).optional()
|
|
207
|
+
}).optional().describe("Configuration options"),
|
|
208
|
+
absolute: z.boolean().optional().describe("Output the results as absolute paths instead of relative paths"),
|
|
209
|
+
json: z.boolean().optional().describe("Output the results as JSON instead of formatted text")
|
|
210
|
+
},
|
|
205
211
|
annotations: { readOnlyHint: true }
|
|
206
212
|
}, async (props) => {
|
|
207
213
|
try {
|
|
208
214
|
const rows = listContentDeclarationRows(props);
|
|
209
215
|
return { content: [{
|
|
210
216
|
type: "text",
|
|
211
|
-
text: JSON.stringify(rows, null, 2)
|
|
217
|
+
text: props.json ? JSON.stringify(rows) : JSON.stringify(rows, null, 2)
|
|
212
218
|
}] };
|
|
213
219
|
} catch (error) {
|
|
214
220
|
return { content: [{
|
|
@@ -279,6 +285,38 @@ const loadCLITools = async (server) => {
|
|
|
279
285
|
}] };
|
|
280
286
|
}
|
|
281
287
|
});
|
|
288
|
+
server.registerTool("intlayer-projects-list", {
|
|
289
|
+
title: "List Projects",
|
|
290
|
+
description: "List all Intlayer projects in the directory. Search for configuration files to find all Intlayer projects.",
|
|
291
|
+
inputSchema: {
|
|
292
|
+
baseDir: z.string().optional().describe("Base directory to search from"),
|
|
293
|
+
gitRoot: z.boolean().optional().describe("Search from the git root directory instead of the base directory"),
|
|
294
|
+
absolute: z.boolean().optional().describe("Output the results as absolute paths instead of relative paths"),
|
|
295
|
+
json: z.boolean().optional().describe("Output the results as JSON instead of formatted text")
|
|
296
|
+
},
|
|
297
|
+
annotations: { readOnlyHint: true }
|
|
298
|
+
}, async (props) => {
|
|
299
|
+
try {
|
|
300
|
+
const { searchDir, projectsPath } = await listProjects({
|
|
301
|
+
baseDir: props.baseDir,
|
|
302
|
+
gitRoot: props.gitRoot
|
|
303
|
+
});
|
|
304
|
+
const projectsRelativePath = projectsPath.map((projectPath) => props.absolute ? projectPath : relative(searchDir, projectPath)).map((projectPath) => projectPath === "" ? "." : projectPath);
|
|
305
|
+
const outputPaths = props.absolute ? projectsPath : projectsRelativePath;
|
|
306
|
+
return { content: [{
|
|
307
|
+
type: "text",
|
|
308
|
+
text: props.json ? JSON.stringify(outputPaths) : JSON.stringify({
|
|
309
|
+
searchDir,
|
|
310
|
+
projectsPath: outputPaths
|
|
311
|
+
}, null, 2)
|
|
312
|
+
}] };
|
|
313
|
+
} catch (error) {
|
|
314
|
+
return { content: [{
|
|
315
|
+
type: "text",
|
|
316
|
+
text: `Projects list failed: ${error instanceof Error ? error.message : "An unknown error occurred"}`
|
|
317
|
+
}] };
|
|
318
|
+
}
|
|
319
|
+
});
|
|
282
320
|
};
|
|
283
321
|
|
|
284
322
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.mjs","names":["loadCLITools: LoadCLITools","log: Partial<LogConfig>","fillOptions: any","pushOptions: any"],"sources":["../../../src/tools/cli.ts"],"sourcesContent":["import {\n build,\n fill,\n init,\n listContentDeclarationRows,\n listMissingTranslations,\n pull,\n push,\n transform,\n} from '@intlayer/cli';\nimport { Locales, type LogConfig } from '@intlayer/types';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport z from 'zod/v3';\n\ntype LoadCLITools = (server: McpServer) => Promise<void>;\n\nexport const loadCLITools: LoadCLITools = async (server) => {\n server.registerTool(\n 'intlayer-init',\n {\n title: 'Initialize Intlayer',\n description: 'Initialize Intlayer in the project',\n inputSchema: {\n projectRoot: z.string().describe('Project root directory'),\n },\n annotations: {\n destructiveHint: true,\n },\n },\n async ({ projectRoot }) => {\n try {\n await init(projectRoot);\n\n return {\n content: [\n {\n type: 'text',\n text: 'Initialization successful.',\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Initialization failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-build',\n {\n title: 'Build Dictionaries',\n description:\n 'Build the dictionaries. List all content declarations files `.content.{ts,tsx,js,json,...}` to update the content callable using the `useIntlayer` hook.',\n inputSchema: {\n watch: z.boolean().optional().describe('Watch for changes'),\n baseDir: z.string().optional().describe('Base directory'),\n env: z.string().optional().describe('Environment'),\n envFile: z.string().optional().describe('Environment file'),\n verbose: z.boolean().optional().describe('Verbose output'),\n prefix: z.string().optional().describe('Log prefix'),\n },\n annotations: {\n destructiveHint: true,\n },\n },\n async ({ watch, baseDir, env, envFile, verbose, prefix }) => {\n try {\n const log: Partial<LogConfig> = {};\n if (verbose) {\n log.mode = 'verbose';\n }\n if (prefix) {\n log.prefix = prefix;\n }\n\n await build({\n watch,\n configOptions: {\n baseDir,\n env,\n envFile,\n override: {\n log,\n },\n },\n });\n\n return {\n content: [\n {\n type: 'text',\n text: 'Build successful.',\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Build failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-fill',\n {\n title: 'Fill Translations',\n description:\n 'Fill the dictionaries with missing translations / review translations using Intlayer servers',\n inputSchema: {\n sourceLocale: z\n .nativeEnum(Locales.ALL_LOCALES)\n .optional()\n .describe('Source locale'),\n outputLocales: z\n .union([\n z.nativeEnum(Locales.ALL_LOCALES),\n z.array(z.nativeEnum(Locales.ALL_LOCALES)),\n ])\n .optional()\n .describe('Output locales'),\n file: z\n .union([z.string(), z.array(z.string())])\n .optional()\n .describe('File path'),\n mode: z.enum(['complete', 'review']).optional().describe('Fill mode'),\n keys: z\n .union([z.string(), z.array(z.string())])\n .optional()\n .describe('Keys to include'),\n excludedKeys: z\n .union([z.string(), z.array(z.string())])\n .optional()\n .describe('Keys to exclude'),\n pathFilter: z\n .union([z.string(), z.array(z.string())])\n .optional()\n .describe('Path filter'),\n gitOptions: z\n .object({\n gitDiff: z.boolean().optional(),\n gitDiffBase: z.string().optional(),\n gitDiffCurrent: z.string().optional(),\n uncommitted: z.boolean().optional(),\n unpushed: z.boolean().optional(),\n untracked: z.boolean().optional(),\n })\n .optional()\n .describe('Git options'),\n aiOptions: z\n .object({\n provider: z.string().optional(),\n temperature: z.number().optional(),\n model: z.string().optional(),\n apiKey: z.string().optional(),\n customPrompt: z.string().optional(),\n applicationContext: z.string().optional(),\n })\n .optional()\n .describe('AI options'),\n },\n annotations: {\n destructiveHint: true,\n },\n },\n async (props) => {\n try {\n const { gitOptions, ...rest } = props;\n const fillOptions: any = { ...rest, gitOptions: undefined };\n\n if (gitOptions) {\n const { gitDiff, uncommitted, unpushed, untracked, ...restGit } =\n gitOptions;\n const mode = [];\n if (gitDiff) mode.push('gitDiff');\n if (uncommitted) mode.push('uncommitted');\n if (unpushed) mode.push('unpushed');\n if (untracked) mode.push('untracked');\n\n fillOptions.gitOptions = { ...restGit, mode };\n }\n\n await fill(fillOptions);\n\n return {\n content: [\n {\n type: 'text',\n text: 'Fill successful.',\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Fill failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-push',\n {\n title: 'Push Dictionaries',\n description: 'Push local dictionaries to the server',\n inputSchema: {\n deleteLocaleDictionary: z\n .boolean()\n .optional()\n .describe('Delete local dictionary after push'),\n keepLocaleDictionary: z\n .boolean()\n .optional()\n .describe('Keep local dictionary after push'),\n dictionaries: z\n .array(z.string())\n .optional()\n .describe('List of dictionaries to push'),\n gitOptions: z\n .object({\n gitDiff: z.boolean().optional(),\n gitDiffBase: z.string().optional(),\n gitDiffCurrent: z.string().optional(),\n uncommitted: z.boolean().optional(),\n unpushed: z.boolean().optional(),\n untracked: z.boolean().optional(),\n })\n .optional()\n .describe('Git options'),\n },\n annotations: {\n destructiveHint: true,\n },\n },\n async (props) => {\n try {\n const { gitOptions, ...rest } = props;\n const pushOptions: any = { ...rest, gitOptions: undefined };\n\n if (gitOptions) {\n const { gitDiff, uncommitted, unpushed, untracked, ...restGit } =\n gitOptions;\n const mode = [];\n if (gitDiff) mode.push('gitDiff');\n if (uncommitted) mode.push('uncommitted');\n if (unpushed) mode.push('unpushed');\n if (untracked) mode.push('untracked');\n\n pushOptions.gitOptions = { ...restGit, mode };\n }\n\n await push(pushOptions);\n\n return {\n content: [\n {\n type: 'text',\n text: 'Push successful.',\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Push failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-pull',\n {\n title: 'Pull Dictionaries',\n description: 'Pull dictionaries from the CMS',\n inputSchema: {\n dictionaries: z\n .array(z.string())\n .optional()\n .describe('List of dictionaries to pull'),\n newDictionariesPath: z\n .string()\n .optional()\n .describe('Path to save new dictionaries'),\n },\n annotations: {\n destructiveHint: true,\n },\n },\n async (props) => {\n try {\n await pull(props);\n\n return {\n content: [\n {\n type: 'text',\n text: 'Pull successful.',\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Pull failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-content-list',\n {\n title: 'List Content Declarations',\n description:\n 'List the content declaration (.content.{ts,tsx,js,json,...}) files present in the project. That files contain the multilingual content of the application and are used to build the dictionaries.',\n inputSchema: {\n configOptions: z\n .object({\n baseDir: z.string().optional(),\n env: z.string().optional(),\n envFile: z.string().optional(),\n override: z\n .object({\n log: z\n .object({\n prefix: z.string().optional(),\n verbose: z.boolean().optional(),\n })\n .optional(),\n })\n .optional(),\n })\n .optional()\n .describe('Configuration options'),\n },\n annotations: {\n readOnlyHint: true,\n },\n },\n async (props) => {\n try {\n const rows = listContentDeclarationRows(props);\n return {\n content: [\n {\n type: 'text',\n text: JSON.stringify(rows, null, 2),\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Content list failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-content-test',\n {\n title: 'Test Translations',\n description:\n 'Test if there are missing translations in the content declaration files. That files contain the multilingual content of the application and are used to build the dictionaries.',\n inputSchema: {\n configOptions: z\n .object({\n baseDir: z.string().optional(),\n env: z.string().optional(),\n envFile: z.string().optional(),\n override: z\n .object({\n log: z\n .object({\n prefix: z.string().optional(),\n verbose: z.boolean().optional(),\n })\n .optional(),\n })\n .optional(),\n })\n .optional()\n .describe('Configuration options'),\n },\n annotations: {\n readOnlyHint: true,\n },\n },\n async (props) => {\n try {\n const missingTranslations = listMissingTranslations(\n props?.configOptions\n );\n return {\n content: [\n {\n type: 'text',\n text: JSON.stringify(missingTranslations, null, 2),\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Content test failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-transform',\n {\n title: 'Transform Component',\n description:\n 'Transform an existing component to use Intlayer. Trigger this action to transform an existing component to be multilingual. If the component does not exist, create a normal React component including text in JSX, and then trigger this tool to transform it.',\n inputSchema: {\n file: z\n .union([z.string(), z.array(z.string())])\n .optional()\n .describe('List of files to transform'),\n outputContentDeclarations: z\n .string()\n .optional()\n .describe('Path to output content declaration files'),\n configOptions: z\n .object({\n baseDir: z.string().optional(),\n env: z.string().optional(),\n envFile: z.string().optional(),\n override: z\n .object({\n log: z\n .object({\n prefix: z.string().optional(),\n verbose: z.boolean().optional(),\n })\n .optional(),\n })\n .optional(),\n })\n .optional()\n .describe('Configuration options'),\n },\n annotations: {\n destructiveHint: true,\n },\n },\n async (props) => {\n try {\n await transform({\n files: Array.isArray(props.file)\n ? props.file\n : props.file\n ? [props.file]\n : undefined,\n outputContentDeclarations: props.outputContentDeclarations,\n configOptions: props.configOptions,\n });\n\n return {\n content: [\n {\n type: 'text',\n text: 'Transform successful.',\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Transform failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n};\n"],"mappings":";;;;;AAgBA,MAAaA,eAA6B,OAAO,WAAW;AAC1D,QAAO,aACL,iBACA;EACE,OAAO;EACP,aAAa;EACb,aAAa,EACX,aAAa,EAAE,QAAQ,CAAC,SAAS,yBAAyB,EAC3D;EACD,aAAa,EACX,iBAAiB,MAClB;EACF,EACD,OAAO,EAAE,kBAAkB;AACzB,MAAI;AACF,SAAM,KAAK,YAAY;AAEvB,UAAO,EACL,SAAS,CACP;IACE,MAAM;IACN,MAAM;IACP,CACF,EACF;WACM,OAAO;AAGd,UAAO,EACL,SAAS,CACP;IACE,MAAM;IACN,MAAM,0BALV,iBAAiB,QAAQ,MAAM,UAAU;IAMtC,CACF,EACF;;GAGN;AAED,QAAO,aACL,kBACA;EACE,OAAO;EACP,aACE;EACF,aAAa;GACX,OAAO,EAAE,SAAS,CAAC,UAAU,CAAC,SAAS,oBAAoB;GAC3D,SAAS,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,iBAAiB;GACzD,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,c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;KACN,QAAQ,EAAE,QAAQ,CAAC,UAAU;KAC7B,SAAS,EAAE,SAAS,CAAC,UAAU;KAChC,CAAC,CACD,UAAU,EACd,CAAC,CACD,UAAU;IACd,CAAC,CACD,UAAU,CACV,SAAS,wBAAwB;GACrC;EACD,aAAa,EACX,iBAAiB,MAClB;EACF,EACD,OAAO,UAAU;AACf,MAAI;AACF,SAAM,UAAU;IACd,OAAO,MAAM,QAAQ,MAAM,KAAK,GAC5B,MAAM,OACN,MAAM,OACJ,CAAC,MAAM,KAAK,GACZ;IACN,2BAA2B,MAAM;IACjC,eAAe,MAAM;IACtB,CAAC;AAEF,UAAO,EACL,SAAS,CACP;IACE,MAAM;IACN,MAAM;IACP,CACF,EACF;WACM,OAAO;AAGd,UAAO,EACL,SAAS,CACP;IACE,MAAM;IACN,MAAM,qBALV,iBAAiB,QAAQ,MAAM,UAAU;IAMtC,CACF,EACF;;GAGN"}
|
|
1
|
+
{"version":3,"file":"cli.mjs","names":["loadCLITools: LoadCLITools","log: Partial<LogConfig>","fillOptions: any","pushOptions: any"],"sources":["../../../src/tools/cli.ts"],"sourcesContent":["import { relative } from 'node:path';\nimport { listProjects } from '@intlayer/chokidar';\nimport {\n build,\n fill,\n init,\n listContentDeclarationRows,\n listMissingTranslations,\n pull,\n push,\n transform,\n} from '@intlayer/cli';\nimport { Locales, type LogConfig } from '@intlayer/types';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport z from 'zod/v3';\n\ntype LoadCLITools = (server: McpServer) => Promise<void>;\n\nexport const loadCLITools: LoadCLITools = async (server) => {\n server.registerTool(\n 'intlayer-init',\n {\n title: 'Initialize Intlayer',\n description: 'Initialize Intlayer in the project',\n inputSchema: {\n projectRoot: z.string().describe('Project root directory'),\n },\n annotations: {\n destructiveHint: true,\n },\n },\n async ({ projectRoot }) => {\n try {\n await init(projectRoot);\n\n return {\n content: [\n {\n type: 'text',\n text: 'Initialization successful.',\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Initialization failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-build',\n {\n title: 'Build Dictionaries',\n description:\n 'Build the dictionaries. List all content declarations files `.content.{ts,tsx,js,json,...}` to update the content callable using the `useIntlayer` hook.',\n inputSchema: {\n watch: z.boolean().optional().describe('Watch for changes'),\n baseDir: z.string().optional().describe('Base directory'),\n env: z.string().optional().describe('Environment'),\n envFile: z.string().optional().describe('Environment file'),\n verbose: z.boolean().optional().describe('Verbose output'),\n prefix: z.string().optional().describe('Log prefix'),\n },\n annotations: {\n destructiveHint: true,\n },\n },\n async ({ watch, baseDir, env, envFile, verbose, prefix }) => {\n try {\n const log: Partial<LogConfig> = {};\n if (verbose) {\n log.mode = 'verbose';\n }\n if (prefix) {\n log.prefix = prefix;\n }\n\n await build({\n watch,\n configOptions: {\n baseDir,\n env,\n envFile,\n override: {\n log,\n },\n },\n });\n\n return {\n content: [\n {\n type: 'text',\n text: 'Build successful.',\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Build failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-fill',\n {\n title: 'Fill Translations',\n description:\n 'Fill the dictionaries with missing translations / review translations using Intlayer servers',\n inputSchema: {\n sourceLocale: z\n .nativeEnum(Locales.ALL_LOCALES)\n .optional()\n .describe('Source locale'),\n outputLocales: z\n .union([\n z.nativeEnum(Locales.ALL_LOCALES),\n z.array(z.nativeEnum(Locales.ALL_LOCALES)),\n ])\n .optional()\n .describe('Output locales'),\n file: z\n .union([z.string(), z.array(z.string())])\n .optional()\n .describe('File path'),\n mode: z.enum(['complete', 'review']).optional().describe('Fill mode'),\n keys: z\n .union([z.string(), z.array(z.string())])\n .optional()\n .describe('Keys to include'),\n excludedKeys: z\n .union([z.string(), z.array(z.string())])\n .optional()\n .describe('Keys to exclude'),\n pathFilter: z\n .union([z.string(), z.array(z.string())])\n .optional()\n .describe('Path filter'),\n gitOptions: z\n .object({\n gitDiff: z.boolean().optional(),\n gitDiffBase: z.string().optional(),\n gitDiffCurrent: z.string().optional(),\n uncommitted: z.boolean().optional(),\n unpushed: z.boolean().optional(),\n untracked: z.boolean().optional(),\n })\n .optional()\n .describe('Git options'),\n aiOptions: z\n .object({\n provider: z.string().optional(),\n temperature: z.number().optional(),\n model: z.string().optional(),\n apiKey: z.string().optional(),\n customPrompt: z.string().optional(),\n applicationContext: z.string().optional(),\n })\n .optional()\n .describe('AI options'),\n },\n annotations: {\n destructiveHint: true,\n },\n },\n async (props) => {\n try {\n const { gitOptions, ...rest } = props;\n const fillOptions: any = { ...rest, gitOptions: undefined };\n\n if (gitOptions) {\n const { gitDiff, uncommitted, unpushed, untracked, ...restGit } =\n gitOptions;\n const mode = [];\n if (gitDiff) mode.push('gitDiff');\n if (uncommitted) mode.push('uncommitted');\n if (unpushed) mode.push('unpushed');\n if (untracked) mode.push('untracked');\n\n fillOptions.gitOptions = { ...restGit, mode };\n }\n\n await fill(fillOptions);\n\n return {\n content: [\n {\n type: 'text',\n text: 'Fill successful.',\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Fill failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-push',\n {\n title: 'Push Dictionaries',\n description: 'Push local dictionaries to the server',\n inputSchema: {\n deleteLocaleDictionary: z\n .boolean()\n .optional()\n .describe('Delete local dictionary after push'),\n keepLocaleDictionary: z\n .boolean()\n .optional()\n .describe('Keep local dictionary after push'),\n dictionaries: z\n .array(z.string())\n .optional()\n .describe('List of dictionaries to push'),\n gitOptions: z\n .object({\n gitDiff: z.boolean().optional(),\n gitDiffBase: z.string().optional(),\n gitDiffCurrent: z.string().optional(),\n uncommitted: z.boolean().optional(),\n unpushed: z.boolean().optional(),\n untracked: z.boolean().optional(),\n })\n .optional()\n .describe('Git options'),\n },\n annotations: {\n destructiveHint: true,\n },\n },\n async (props) => {\n try {\n const { gitOptions, ...rest } = props;\n const pushOptions: any = { ...rest, gitOptions: undefined };\n\n if (gitOptions) {\n const { gitDiff, uncommitted, unpushed, untracked, ...restGit } =\n gitOptions;\n const mode = [];\n if (gitDiff) mode.push('gitDiff');\n if (uncommitted) mode.push('uncommitted');\n if (unpushed) mode.push('unpushed');\n if (untracked) mode.push('untracked');\n\n pushOptions.gitOptions = { ...restGit, mode };\n }\n\n await push(pushOptions);\n\n return {\n content: [\n {\n type: 'text',\n text: 'Push successful.',\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Push failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-pull',\n {\n title: 'Pull Dictionaries',\n description: 'Pull dictionaries from the CMS',\n inputSchema: {\n dictionaries: z\n .array(z.string())\n .optional()\n .describe('List of dictionaries to pull'),\n newDictionariesPath: z\n .string()\n .optional()\n .describe('Path to save new dictionaries'),\n },\n annotations: {\n destructiveHint: true,\n },\n },\n async (props) => {\n try {\n await pull(props);\n\n return {\n content: [\n {\n type: 'text',\n text: 'Pull successful.',\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Pull failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-content-list',\n {\n title: 'List Content Declarations',\n description:\n 'List the content declaration (.content.{ts,tsx,js,json,...}) files present in the project. That files contain the multilingual content of the application and are used to build the dictionaries.',\n inputSchema: {\n configOptions: z\n .object({\n baseDir: z.string().optional(),\n env: z.string().optional(),\n envFile: z.string().optional(),\n override: z\n .object({\n log: z\n .object({\n prefix: z.string().optional(),\n verbose: z.boolean().optional(),\n })\n .optional(),\n })\n .optional(),\n })\n .optional()\n .describe('Configuration options'),\n absolute: z\n .boolean()\n .optional()\n .describe(\n 'Output the results as absolute paths instead of relative paths'\n ),\n json: z\n .boolean()\n .optional()\n .describe('Output the results as JSON instead of formatted text'),\n },\n annotations: {\n readOnlyHint: true,\n },\n },\n async (props) => {\n try {\n const rows = listContentDeclarationRows(props);\n return {\n content: [\n {\n type: 'text',\n text: props.json\n ? JSON.stringify(rows)\n : JSON.stringify(rows, null, 2),\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Content list failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-content-test',\n {\n title: 'Test Translations',\n description:\n 'Test if there are missing translations in the content declaration files. That files contain the multilingual content of the application and are used to build the dictionaries.',\n inputSchema: {\n configOptions: z\n .object({\n baseDir: z.string().optional(),\n env: z.string().optional(),\n envFile: z.string().optional(),\n override: z\n .object({\n log: z\n .object({\n prefix: z.string().optional(),\n verbose: z.boolean().optional(),\n })\n .optional(),\n })\n .optional(),\n })\n .optional()\n .describe('Configuration options'),\n },\n annotations: {\n readOnlyHint: true,\n },\n },\n async (props) => {\n try {\n const missingTranslations = listMissingTranslations(\n props?.configOptions\n );\n return {\n content: [\n {\n type: 'text',\n text: JSON.stringify(missingTranslations, null, 2),\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Content test failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-transform',\n {\n title: 'Transform Component',\n description:\n 'Transform an existing component to use Intlayer. Trigger this action to transform an existing component to be multilingual. If the component does not exist, create a normal React component including text in JSX, and then trigger this tool to transform it.',\n inputSchema: {\n file: z\n .union([z.string(), z.array(z.string())])\n .optional()\n .describe('List of files to transform'),\n outputContentDeclarations: z\n .string()\n .optional()\n .describe('Path to output content declaration files'),\n configOptions: z\n .object({\n baseDir: z.string().optional(),\n env: z.string().optional(),\n envFile: z.string().optional(),\n override: z\n .object({\n log: z\n .object({\n prefix: z.string().optional(),\n verbose: z.boolean().optional(),\n })\n .optional(),\n })\n .optional(),\n })\n .optional()\n .describe('Configuration options'),\n },\n annotations: {\n destructiveHint: true,\n },\n },\n async (props) => {\n try {\n await transform({\n files: Array.isArray(props.file)\n ? props.file\n : props.file\n ? [props.file]\n : undefined,\n outputContentDeclarations: props.outputContentDeclarations,\n configOptions: props.configOptions,\n });\n\n return {\n content: [\n {\n type: 'text',\n text: 'Transform successful.',\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Transform failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-projects-list',\n {\n title: 'List Projects',\n description:\n 'List all Intlayer projects in the directory. Search for configuration files to find all Intlayer projects.',\n inputSchema: {\n baseDir: z\n .string()\n .optional()\n .describe('Base directory to search from'),\n gitRoot: z\n .boolean()\n .optional()\n .describe(\n 'Search from the git root directory instead of the base directory'\n ),\n absolute: z\n .boolean()\n .optional()\n .describe(\n 'Output the results as absolute paths instead of relative paths'\n ),\n json: z\n .boolean()\n .optional()\n .describe('Output the results as JSON instead of formatted text'),\n },\n annotations: {\n readOnlyHint: true,\n },\n },\n async (props) => {\n try {\n const { searchDir, projectsPath } = await listProjects({\n baseDir: props.baseDir,\n gitRoot: props.gitRoot,\n });\n\n // Handle absolute option similar to CLI command\n const projectsRelativePath = projectsPath\n .map((projectPath) =>\n props.absolute ? projectPath : relative(searchDir, projectPath)\n )\n .map((projectPath) => (projectPath === '' ? '.' : projectPath));\n\n const outputPaths = props.absolute\n ? projectsPath\n : projectsRelativePath;\n\n return {\n content: [\n {\n type: 'text',\n text: props.json\n ? JSON.stringify(outputPaths)\n : JSON.stringify(\n { searchDir, projectsPath: outputPaths },\n null,\n 2\n ),\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Projects list failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n};\n"],"mappings":";;;;;;;AAkBA,MAAaA,eAA6B,OAAO,WAAW;AAC1D,QAAO,aACL,iBACA;EACE,OAAO;EACP,aAAa;EACb,aAAa,EACX,aAAa,EAAE,QAAQ,CAAC,SAAS,yBAAyB,EAC3D;EACD,aAAa,EACX,iBAAiB,MAClB;EACF,EACD,OAAO,EAAE,kBAAkB;AACzB,MAAI;AACF,SAAM,KAAK,YAAY;AAEvB,UAAO,EACL,SAAS,CACP;IACE,MAAM;IACN,MAAM;IACP,CACF,EACF;WACM,OAAO;AAGd,UAAO,EACL,SAAS,CACP;IACE,MAAM;IACN,MAAM,0BALV,iBAAiB,QAAQ,MAAM,UAAU;IAMtC,CACF,EACF;;GAGN;AAED,QAAO,aACL,kBACA;EACE,OAAO;EACP,aACE;EACF,aAAa;GACX,OAAO,EAAE,SAAS,CAAC,UAAU,CAAC,SAAS,oBAAoB;GAC3D,SAAS,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,iBAAiB;GACzD,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,cAAc;GAClD,SAAS,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,mBAAmB;GAC3D,SAAS,EAAE,SAAS,CAAC,UAAU,CAAC,SAAS,iBAAiB;GAC1D,QAAQ,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,aAAa;GACrD;EACD,aAAa,EACX,iBAAiB,MAClB;EACF,EACD,OAAO,EAAE,OAAO,SAAS,KAAK,SAAS,SAAS,aAAa;AAC3D,MAAI;GACF,MAAMC,MAA0B,EAAE;AAClC,OAAI,QACF,KAAI,OAAO;AAEb,OAAI,OACF,KAA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,"file":"cli.d.ts","names":["loadCLITools: LoadCLITools"],"sources":["../../../src/tools/cli.ts"],"sourcesContent":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"cli.d.ts","names":["loadCLITools: LoadCLITools"],"sources":["../../../src/tools/cli.ts"],"sourcesContent":[],"mappings":";;;KAgBK,YAAA,YAAwB,cAAc;cAE9BA,cAAc"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/mcp",
|
|
3
|
-
"version": "7.5.
|
|
3
|
+
"version": "7.5.12",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Intlayer MCP server. Handle MCP to help IDE to use Intlayer. It build, fill, pull, push, dictionaries",
|
|
6
6
|
"keywords": [
|
|
@@ -96,17 +96,17 @@
|
|
|
96
96
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
97
97
|
},
|
|
98
98
|
"dependencies": {
|
|
99
|
-
"@intlayer/cli": "7.5.
|
|
100
|
-
"@intlayer/config": "7.5.
|
|
101
|
-
"@intlayer/docs": "7.5.
|
|
102
|
-
"@intlayer/types": "7.5.
|
|
99
|
+
"@intlayer/cli": "7.5.12",
|
|
100
|
+
"@intlayer/config": "7.5.12",
|
|
101
|
+
"@intlayer/docs": "7.5.12",
|
|
102
|
+
"@intlayer/types": "7.5.12",
|
|
103
103
|
"@modelcontextprotocol/sdk": "1.25.1",
|
|
104
104
|
"dotenv": "16.6.1",
|
|
105
105
|
"express": "5.2.1",
|
|
106
106
|
"zod": "3.25.76"
|
|
107
107
|
},
|
|
108
108
|
"devDependencies": {
|
|
109
|
-
"@intlayer/types": "7.5.
|
|
109
|
+
"@intlayer/types": "7.5.12",
|
|
110
110
|
"@modelcontextprotocol/inspector": "0.18.0",
|
|
111
111
|
"@types/express": "5.0.6",
|
|
112
112
|
"@types/node": "25.0.3",
|