@intlayer/mcp 8.3.0-canary.0 → 8.3.0-canary.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/client/client.mjs +1 -1
- package/dist/esm/client/sse.mjs +1 -1
- package/dist/esm/client/sse.mjs.map +1 -1
- package/dist/esm/packages/@intlayer/chokidar/dist/esm/_virtual/_utils_asset.mjs +3 -0
- package/dist/esm/packages/@intlayer/chokidar/dist/esm/_virtual/_utils_asset.mjs.map +1 -0
- package/dist/esm/packages/@intlayer/chokidar/dist/esm/installSkills/index.mjs +2 -0
- package/dist/esm/packages/@intlayer/chokidar/dist/esm/installSkills/index.mjs.map +1 -0
- package/dist/esm/packages/@intlayer/chokidar/dist/esm/listProjects.mjs +2 -0
- package/dist/esm/packages/@intlayer/chokidar/dist/esm/listProjects.mjs.map +1 -0
- package/dist/esm/packages/@intlayer/core/dist/esm/transpiler/markdown/getMarkdownMetadata.mjs +3 -0
- package/dist/esm/packages/@intlayer/core/dist/esm/transpiler/markdown/getMarkdownMetadata.mjs.map +1 -0
- package/dist/esm/packages/@intlayer/core/dist/esm/utils/parseYaml.mjs +17 -0
- package/dist/esm/packages/@intlayer/core/dist/esm/utils/parseYaml.mjs.map +1 -0
- package/dist/esm/server/server.mjs +1 -1
- package/dist/esm/server/sse.mjs +1 -1
- package/dist/esm/server/sse.mjs.map +1 -1
- package/dist/esm/tools/cli.mjs +1 -1
- package/dist/esm/tools/cli.mjs.map +1 -1
- package/dist/esm/tools/docs.mjs +1 -1
- package/dist/esm/tools/docs.mjs.map +1 -1
- package/dist/esm/tools/installSkills.mjs +3 -3
- package/dist/esm/tools/installSkills.mjs.map +1 -1
- package/dist/types/tools/installSkills.d.ts.map +1 -1
- package/package.json +21 -23
- package/dist/cjs/_virtual/_rolldown/runtime.cjs +0 -1
- package/dist/cjs/client/client.cjs +0 -2
- package/dist/cjs/client/client.cjs.map +0 -1
- package/dist/cjs/client/sse.cjs +0 -2
- package/dist/cjs/client/sse.cjs.map +0 -1
- package/dist/cjs/server/server.cjs +0 -2
- package/dist/cjs/server/server.cjs.map +0 -1
- package/dist/cjs/server/sse.cjs +0 -3
- package/dist/cjs/server/sse.cjs.map +0 -1
- package/dist/cjs/server/stdio.cjs +0 -3
- package/dist/cjs/server/stdio.cjs.map +0 -1
- package/dist/cjs/tools/cli.cjs +0 -2
- package/dist/cjs/tools/cli.cjs.map +0 -1
- package/dist/cjs/tools/docs.cjs +0 -3
- package/dist/cjs/tools/docs.cjs.map +0 -1
- package/dist/cjs/tools/installSkills.cjs +0 -4
- package/dist/cjs/tools/installSkills.cjs.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{dirname as e,resolve as t}from"node:path";import{readFileSync as n}from"node:fs";import{isESModule as r}from"@intlayer/config/utils";import{fileURLToPath as i}from"node:url";import{Client as a}from"@modelcontextprotocol/sdk/client/index.js";const o=r?e(i(import.meta.url)):__dirname,s=JSON.parse(n(t(o,`../../../package.json`),`utf8`)),c=()=>new a({name:`mcp-client-for-intlayer-mcp-server`,version:s.version});export{o as dirname,c as loadClient};
|
|
2
2
|
//# sourceMappingURL=client.mjs.map
|
package/dist/esm/client/sse.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{loadClient as e}from"./client.mjs";import{URL as t}from"node:url";import{
|
|
1
|
+
import{loadClient as e}from"./client.mjs";import{URL as t}from"node:url";import{StreamableHTTPClientTransport as n}from"@modelcontextprotocol/sdk/client/streamableHttp.js";var r=class{client;transport=null;isCompleted=!1;constructor(){this.client=e()}async connectToServer(){let e=process.env.MCP_SERVER_URL??`http://localhost:3000/`,r=new t(e);try{console.info(`Connecting to server - ${e}`),this.transport=new n(r),await this.client.connect(this.transport),console.info(`Connected to MCP server`),this.setUpTransport()}catch(e){throw console.error(`Failed to connect to MCP server: `,e),e}}setUpTransport(){this.transport!==null&&(this.transport.onclose=()=>{console.info(`Transport closed.`),this.isCompleted=!0},this.transport.onerror=async e=>{console.error(`Transport error: `,e),await this.cleanup()},this.transport.onmessage=e=>{console.info(`Message received: `,e)})}async waitForCompletion(){for(;!this.isCompleted;)await new Promise(e=>setTimeout(e,100))}async cleanup(){this.transport&&await this.client.close()}};(async()=>{let e=new r;try{await e.connectToServer(),await e.waitForCompletion()}catch(e){console.error(e)}finally{await e.cleanup()}})();
|
|
2
2
|
//# sourceMappingURL=sse.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sse.mjs","names":[],"sources":["../../../src/client/sse.ts"],"sourcesContent":["import { URL } from 'node:url';\nimport type { Client } from '@modelcontextprotocol/sdk/client/index.js';\nimport {
|
|
1
|
+
{"version":3,"file":"sse.mjs","names":[],"sources":["../../../src/client/sse.ts"],"sourcesContent":["import { URL } from 'node:url';\nimport type { Client } from '@modelcontextprotocol/sdk/client/index.js';\nimport { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';\nimport type { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';\nimport { loadClient } from './client';\n\nclass SSEClient {\n private client: Client;\n private transport: Transport | null = null;\n private isCompleted = false;\n\n constructor() {\n this.client = loadClient();\n }\n\n async connectToServer() {\n const mcpServerURL = process.env.MCP_SERVER_URL ?? 'http://localhost:3000/';\n\n const url = new URL(mcpServerURL);\n try {\n console.info(`Connecting to server - ${mcpServerURL}`);\n this.transport = new StreamableHTTPClientTransport(url);\n await this.client.connect(this.transport);\n console.info('Connected to MCP server');\n\n this.setUpTransport();\n } catch (e) {\n console.error('Failed to connect to MCP server: ', e);\n throw e;\n }\n }\n\n private setUpTransport() {\n if (this.transport === null) return;\n\n this.transport.onclose = () => {\n console.info('Transport closed.');\n this.isCompleted = true;\n };\n\n this.transport.onerror = async (error) => {\n console.error('Transport error: ', error);\n await this.cleanup();\n };\n\n this.transport.onmessage = (message) => {\n console.info('Message received: ', message);\n };\n }\n\n async waitForCompletion() {\n while (!this.isCompleted) {\n await new Promise((resolve) => setTimeout(resolve, 100));\n }\n }\n\n async cleanup() {\n if (this.transport) {\n await this.client.close();\n }\n }\n}\n\nconst main = async () => {\n const client = new SSEClient();\n try {\n await client.connectToServer();\n await client.waitForCompletion();\n } catch (error) {\n console.error(error);\n } finally {\n await client.cleanup();\n }\n};\n\nmain();\n"],"mappings":"4KAMA,IAAM,EAAN,KAAgB,CACd,OACA,UAAsC,KACtC,YAAsB,GAEtB,aAAc,CACZ,KAAK,OAAS,GAAY,CAG5B,MAAM,iBAAkB,CACtB,IAAM,EAAe,QAAQ,IAAI,gBAAkB,yBAE7C,EAAM,IAAI,EAAI,EAAa,CACjC,GAAI,CACF,QAAQ,KAAK,0BAA0B,IAAe,CACtD,KAAK,UAAY,IAAI,EAA8B,EAAI,CACvD,MAAM,KAAK,OAAO,QAAQ,KAAK,UAAU,CACzC,QAAQ,KAAK,0BAA0B,CAEvC,KAAK,gBAAgB,OACd,EAAG,CAEV,MADA,QAAQ,MAAM,oCAAqC,EAAE,CAC/C,GAIV,gBAAyB,CACnB,KAAK,YAAc,OAEvB,KAAK,UAAU,YAAgB,CAC7B,QAAQ,KAAK,oBAAoB,CACjC,KAAK,YAAc,IAGrB,KAAK,UAAU,QAAU,KAAO,IAAU,CACxC,QAAQ,MAAM,oBAAqB,EAAM,CACzC,MAAM,KAAK,SAAS,EAGtB,KAAK,UAAU,UAAa,GAAY,CACtC,QAAQ,KAAK,qBAAsB,EAAQ,GAI/C,MAAM,mBAAoB,CACxB,KAAO,CAAC,KAAK,aACX,MAAM,IAAI,QAAS,GAAY,WAAW,EAAS,IAAI,CAAC,CAI5D,MAAM,SAAU,CACV,KAAK,WACP,MAAM,KAAK,OAAO,OAAO,IAKlB,SAAY,CACvB,IAAM,EAAS,IAAI,EACnB,GAAI,CACF,MAAM,EAAO,iBAAiB,CAC9B,MAAM,EAAO,mBAAmB,OACzB,EAAO,CACd,QAAQ,MAAM,EAAM,QACZ,CACR,MAAM,EAAO,SAAS,KAIpB"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{basename as e,dirname as t,join as n,relative as r,resolve as i,sep as a}from"node:path";import{existsSync as o,readFileSync as s}from"node:fs";import{fileURLToPath as c}from"node:url";const l=()=>{try{return t(c(import.meta.url))}catch{return typeof __dirname<`u`?__dirname:process.cwd()}},u=t=>{let n=t;for(let t=0;t<12;t++){if(e(n)===`dist`)return n;let t=i(n,`..`);if(t===n)break;n=t}return null},d=e=>{if(!e)return null;try{if(e.startsWith(`file://`))return c(e)}catch{}return e},f=()=>{let e=Error.prepareStackTrace;try{Error.prepareStackTrace=(e,t)=>t;let e=Error();Error.captureStackTrace(e,f);let n=e.stack||[],r=e=>e.includes(`${a}_virtual${a}`)||e.includes(`/_virtual/`);for(let e of n){let n=d(typeof e.getFileName==`function`?e.getFileName():null);if(n&&!(n.includes(`node:internal`)||n.includes(`${a}internal${a}modules${a}`))&&!r(n))return t(n)}for(let e of n){let n=d(typeof e.getFileName==`function`?e.getFileName():null);if(n)return t(n)}}catch{}finally{Error.prepareStackTrace=e}return l()},p=(e,t=`utf8`)=>{let a=l(),c=u(a)??i(a,`..`,`..`,`dist`),d=n(c,`assets`),p=[],m=r(c,f()).split(`\\`).join(`/`).replace(/^(?:dist\/)?(?:esm|cjs)\//,``).replace(/^_virtual\//,``);if(e.startsWith(`./`)||e.startsWith(`../`)){let n=i(d,m,e);if(p.push(n),o(n))return s(n,t)}let h=n(d,e);if(p.push(h),o(h))return s(h,t);if(m){let r=n(d,m,e);if(p.push(r),o(r))return s(r,t)}let g=[`readAsset: file not found.`,`Searched:`,...p.map(e=>`- ${e}`)].join(`
|
|
2
|
+
`);throw Error(g)};export{p};
|
|
3
|
+
//# sourceMappingURL=_utils_asset.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_utils_asset.mjs","names":["t","c","e","i","a","n","r","o","s"],"sources":["../../../../../../../../../chokidar/dist/esm/_virtual/_utils_asset.mjs"],"sourcesContent":["import{basename as e,dirname as t,join as n,relative as r,resolve as i,sep as a}from\"node:path\";import{existsSync as o,readFileSync as s}from\"node:fs\";import{fileURLToPath as c}from\"node:url\";const l=()=>{try{return t(c(import.meta.url))}catch{return typeof __dirname<`u`?__dirname:process.cwd()}},u=t=>{let n=t;for(let t=0;t<12;t++){if(e(n)===`dist`)return n;let t=i(n,`..`);if(t===n)break;n=t}return null},d=e=>{if(!e)return null;try{if(e.startsWith(`file://`))return c(e)}catch{}return e},f=()=>{let e=Error.prepareStackTrace;try{Error.prepareStackTrace=(e,t)=>t;let e=Error();Error.captureStackTrace(e,f);let n=e.stack||[],r=e=>e.includes(`${a}_virtual${a}`)||e.includes(`/_virtual/`);for(let e of n){let n=d(typeof e.getFileName==`function`?e.getFileName():null);if(n&&!(n.includes(`node:internal`)||n.includes(`${a}internal${a}modules${a}`))&&!r(n))return t(n)}for(let e of n){let n=d(typeof e.getFileName==`function`?e.getFileName():null);if(n)return t(n)}}catch{}finally{Error.prepareStackTrace=e}return l()},p=(e,t=`utf8`)=>{let a=l(),c=u(a)??i(a,`..`,`..`,`dist`),d=n(c,`assets`),p=[],m=r(c,f()).split(`\\\\`).join(`/`).replace(/^(?:dist\\/)?(?:esm|cjs)\\//,``).replace(/^_virtual\\//,``);if(e.startsWith(`./`)||e.startsWith(`../`)){let n=i(d,m,e);if(p.push(n),o(n))return s(n,t)}let h=n(d,e);if(p.push(h),o(h))return s(h,t);if(m){let r=n(d,m,e);if(p.push(r),o(r))return s(r,t)}let g=[`readAsset: file not found.`,`Searched:`,...p.map(e=>`- ${e}`)].join(`\n`);throw Error(g)};export{p as readAsset};"],"mappings":"gMAAgM,MAAM,MAAM,CAAC,GAAG,CAAC,OAAOA,EAAEC,EAAE,OAAO,KAAK,IAAI,CAAC,MAAM,CAAC,OAAO,OAAO,UAAU,IAAI,UAAU,QAAQ,KAAK,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE,EAAE,IAAI,IAAI,EAAE,EAAE,EAAE,GAAG,IAAI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AC,QAAQ,cAAc,GAAG,CAAC,GAAG,EAAE,WAAW,KAAK,EAAE,EAAE,WAAW,MAAM,CAAC,CAAC,IAAI,EAAEH,EAAE,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,CAACI,EAAE,EAAE,CAAC,OAAOC,EAAE,EAAE,EAAE,CAAC,IAAI,EAAEH,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,CAACE,EAAE,EAAE,CAAC,OAAOC,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,IAAI,EAAEH,EAAE,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,CAACE,EAAE,EAAE,CAAC,OAAOC,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,6BAA6B,YAAY,GAAG,EAAE,IAAI,GAAG,KAAK,IAAI,CAAC,CAAC,KAAK;EACj7C,CAAC,MAAM,MAAM,EAAE"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{p as e}from"../_virtual/_utils_asset.mjs";import{t}from"../../../../core/dist/esm/transpiler/markdown/getMarkdownMetadata.mjs";import n from"node:path";import{promises as r}from"node:fs";const i=Object.keys({Config:`Intlayer configuration documentation`,Content:`Reference for all Intlayer content node types (t, enu, etc.)`,Usage:`How to use Intlayer in your project`,CLI:`Intlayer CLI commands and usage`,Compiler:`Intlayer Compiler setup and usage for automatic content extraction without .content files`,RemoteContent:`How to use Intlayer with Remote/CMS/Server-side content`,NextJS:`Next.js-specific usage (Server & Client components)`,React:`React-specific syntax and hooks usage`,Vue:`Vue-specific composables and syntax`,Svelte:`Svelte-specific stores and syntax`,Angular:`Angular-specific syntax and Injectable Function usage`,Preact:`Preact-specific syntax and hooks usage`,Solid:`Integrates Intlayer internationalization with SolidJS components. Use when the user asks to "setup SolidJS i18n", use the "useIntlayer" hook in Solid, or manage locales in a SolidJS application.`,Astro:`Astro-specific usage and getIntlayer`}),a={Cursor:{label:`Cursor`,dir:`.cursor/skills`,check:()=>process.env.CURSOR===`true`||process.env.TERM_PROGRAM===`cursor`},Windsurf:{label:`Windsurf`,dir:`.windsurf/skills`,check:()=>process.env.WINDSURF===`true`||process.env.TERM_PROGRAM===`windsurf`},Trae:{label:`Trae`,dir:`.trae/skills`,check:()=>process.env.TRAE===`true`||process.env.TERM_PROGRAM===`trae`},TraeCN:{label:`Trae CN`,dir:`.trae/skills`,check:()=>process.env.TRAE_CN===`true`},VSCode:{label:`VS Code`,dir:`.vscode/skills`,check:()=>process.env.VSCODE===`true`||process.env.TERM_PROGRAM===`vscode`},OpenCode:{label:`OpenCode`,dir:`.opencode/skills`,check:()=>process.env.OPENCODE===`true`},Claude:{label:`Claude Code`,dir:`.claude/skills`,check:()=>process.env.CLAUDE===`true`},GitHub:{label:`GitHub Copilot Workspace`,dir:`.github/skills`,check:()=>process.env.GITHUB_ACTIONS===`true`||!!process.env.GITHUB_WORKSPACE},Antigravity:{label:`Antigravity`,dir:`.agent/skills`},Augment:{label:`Augment`,dir:`.augment/skills`},OpenClaw:{label:`OpenClaw`,dir:`skills`},Cline:{label:`Cline`,dir:`.cline/skills`},CodeBuddy:{label:`CodeBuddy`,dir:`.codebuddy/skills`},CommandCode:{label:`Command Code`,dir:`.commandcode/skills`},Continue:{label:`Continue`,dir:`.continue/skills`},Crush:{label:`Crush`,dir:`.crush/skills`},Droid:{label:`Droid`,dir:`.factory/skills`},Goose:{label:`Goose`,dir:`.goose/skills`},IFlow:{label:`iFlow CLI`,dir:`.iflow/skills`},Junie:{label:`Junie`,dir:`.junie/skills`},KiloCode:{label:`Kilo Code`,dir:`.kilocode/skills`},Kiro:{label:`Kiro CLI`,dir:`.kiro/skills`},Kode:{label:`Kode`,dir:`.kode/skills`},MCPJam:{label:`MCPJam`,dir:`.mcpjam/skills`},MistralVibe:{label:`Mistral Vibe`,dir:`.vibe/skills`},Mux:{label:`Mux`,dir:`.mux/skills`},OpenHands:{label:`OpenHands`,dir:`.openhands/skills`},Pi:{label:`Pi`,dir:`.pi/skills`},Qoder:{label:`Qoder`,dir:`.qoder/skills`},Qwen:{label:`Qwen Code`,dir:`.qwen/skills`},RooCode:{label:`Roo Code`,dir:`.roo/skills`},Zencoder:{label:`Zencoder`,dir:`.zencoder/skills`},Neovate:{label:`Neovate`,dir:`.neovate/skills`},Pochi:{label:`Pochi`,dir:`.pochi/skills`},Other:{label:`Other`,dir:`skills`}},o=Object.keys(a),s={},c=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),l=t=>{let n=`./skills/${s[t]??c(t)}.md`;try{return e(n)}catch{return console.warn(`Warning: Could not read asset for skill: ${t} at ${n}`),``}},u=()=>{try{return e(`./LICENCE.md`)}catch{return console.warn(`Warning: Could not read LICENCE.md asset`),``}},d=async e=>{let t=await fetch(e);if(!t.ok)throw Error(`Failed to fetch ${e}: ${t.statusText}`);return t.text()},f=async(e,i,o)=>{let f=a[i].dir??`skills`,p=n.join(e,f);await r.mkdir(p,{recursive:!0});let m=[],h=u();for(let e of o){let i=`intlayer-${s[e]??c(e)}`,a=l(e);if(!a)continue;let o=Array.from(new Set(a.match(/https:\/\/intlayer\.org\/doc\/[^\s)]+\.md/g)||[])),u=n.join(p,i),f=n.join(u,`references`);await r.mkdir(f,{recursive:!0}),h&&await r.writeFile(n.join(u,`LICENCE.md`),h,`utf-8`);let g=a,_=o.map(async n=>{try{let e=await d(n),r=t(e),i=``;return i=Array.isArray(r.slugs)?r.slugs.filter(e=>e!==`doc`).join(`_`):new URL(n).pathname.split(`/`).filter(e=>e&&e!==`doc`).map(e=>e.replace(`.md`,``)).join(`_`),i=i?`${i}.md`:`index.md`,{url:n,localRefPath:`references/${i}`,fileName:i,content:e,success:!0}}catch(t){return console.warn(`Warning: Failed to download ref ${n} for skill ${e}`,t),{url:n,success:!1}}}),v=await Promise.all(_);for(let e of v)e.success&&e.fileName&&e.content&&e.localRefPath&&(await r.writeFile(n.join(f,e.fileName),e.content,`utf-8`),g=g.replaceAll(e.url,e.localRefPath));let y=n.join(u,`SKILL.md`);await r.writeFile(y,g,`utf-8`),m.push(`${i}/SKILL.md`)}return m.length===0?`No skill files were created. Check your asset paths.`:`Created ${m.length} skills in ${p}`};export{i as a,o as c,f as m};
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["e","n","r"],"sources":["../../../../../../../../../chokidar/dist/esm/installSkills/index.mjs"],"sourcesContent":["import{readAsset as e}from\"../_virtual/_utils_asset.mjs\";import t from\"node:path\";import{promises as n}from\"node:fs\";import{getMarkdownMetadata as r}from\"@intlayer/core/markdown\";const i={Config:`Intlayer configuration documentation`,Content:`Reference for all Intlayer content node types (t, enu, etc.)`,Usage:`How to use Intlayer in your project`,CLI:`Intlayer CLI commands and usage`,Compiler:`Intlayer Compiler setup and usage for automatic content extraction without .content files`,RemoteContent:`How to use Intlayer with Remote/CMS/Server-side content`,NextJS:`Next.js-specific usage (Server & Client components)`,React:`React-specific syntax and hooks usage`,Vue:`Vue-specific composables and syntax`,Svelte:`Svelte-specific stores and syntax`,Angular:`Angular-specific syntax and Injectable Function usage`,Preact:`Preact-specific syntax and hooks usage`,Solid:`Integrates Intlayer internationalization with SolidJS components. Use when the user asks to \"setup SolidJS i18n\", use the \"useIntlayer\" hook in Solid, or manage locales in a SolidJS application.`,Astro:`Astro-specific usage and getIntlayer`},a=Object.keys(i),o=e=>{let t=[`Usage`,`Content`,`Config`,`CLI`,`Compiler`];return e.next&&t.push(`NextJS`),(e.react||!e.next)&&t.push(`React`),e.preact&&t.push(`Preact`),e[`solid-js`]&&t.push(`Solid`),(e.vue||e.nuxt)&&t.push(`Vue`),(e.svelte||e[`@sveltejs/kit`])&&t.push(`Svelte`),e.astro&&t.push(`Astro`),t},s={Cursor:{label:`Cursor`,dir:`.cursor/skills`,check:()=>process.env.CURSOR===`true`||process.env.TERM_PROGRAM===`cursor`},Windsurf:{label:`Windsurf`,dir:`.windsurf/skills`,check:()=>process.env.WINDSURF===`true`||process.env.TERM_PROGRAM===`windsurf`},Trae:{label:`Trae`,dir:`.trae/skills`,check:()=>process.env.TRAE===`true`||process.env.TERM_PROGRAM===`trae`},TraeCN:{label:`Trae CN`,dir:`.trae/skills`,check:()=>process.env.TRAE_CN===`true`},VSCode:{label:`VS Code`,dir:`.vscode/skills`,check:()=>process.env.VSCODE===`true`||process.env.TERM_PROGRAM===`vscode`},OpenCode:{label:`OpenCode`,dir:`.opencode/skills`,check:()=>process.env.OPENCODE===`true`},Claude:{label:`Claude Code`,dir:`.claude/skills`,check:()=>process.env.CLAUDE===`true`},GitHub:{label:`GitHub Copilot Workspace`,dir:`.github/skills`,check:()=>process.env.GITHUB_ACTIONS===`true`||!!process.env.GITHUB_WORKSPACE},Antigravity:{label:`Antigravity`,dir:`.agent/skills`},Augment:{label:`Augment`,dir:`.augment/skills`},OpenClaw:{label:`OpenClaw`,dir:`skills`},Cline:{label:`Cline`,dir:`.cline/skills`},CodeBuddy:{label:`CodeBuddy`,dir:`.codebuddy/skills`},CommandCode:{label:`Command Code`,dir:`.commandcode/skills`},Continue:{label:`Continue`,dir:`.continue/skills`},Crush:{label:`Crush`,dir:`.crush/skills`},Droid:{label:`Droid`,dir:`.factory/skills`},Goose:{label:`Goose`,dir:`.goose/skills`},IFlow:{label:`iFlow CLI`,dir:`.iflow/skills`},Junie:{label:`Junie`,dir:`.junie/skills`},KiloCode:{label:`Kilo Code`,dir:`.kilocode/skills`},Kiro:{label:`Kiro CLI`,dir:`.kiro/skills`},Kode:{label:`Kode`,dir:`.kode/skills`},MCPJam:{label:`MCPJam`,dir:`.mcpjam/skills`},MistralVibe:{label:`Mistral Vibe`,dir:`.vibe/skills`},Mux:{label:`Mux`,dir:`.mux/skills`},OpenHands:{label:`OpenHands`,dir:`.openhands/skills`},Pi:{label:`Pi`,dir:`.pi/skills`},Qoder:{label:`Qoder`,dir:`.qoder/skills`},Qwen:{label:`Qwen Code`,dir:`.qwen/skills`},RooCode:{label:`Roo Code`,dir:`.roo/skills`},Zencoder:{label:`Zencoder`,dir:`.zencoder/skills`},Neovate:{label:`Neovate`,dir:`.neovate/skills`},Pochi:{label:`Pochi`,dir:`.pochi/skills`},Other:{label:`Other`,dir:`skills`}},c=Object.keys(s),l={},u=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),d=t=>{let n=`./skills/${l[t]??u(t)}.md`;try{return e(n)}catch{return console.warn(`Warning: Could not read asset for skill: ${t} at ${n}`),``}},f=()=>{try{return e(`./LICENCE.md`)}catch{return console.warn(`Warning: Could not read LICENCE.md asset`),``}},p=async e=>{let t=await fetch(e);if(!t.ok)throw Error(`Failed to fetch ${e}: ${t.statusText}`);return t.text()},m=async(e,i,a)=>{let o=s[i].dir??`skills`,c=t.join(e,o);await n.mkdir(c,{recursive:!0});let m=[],h=f();for(let e of a){let i=`intlayer-${l[e]??u(e)}`,a=d(e);if(!a)continue;let o=Array.from(new Set(a.match(/https:\\/\\/intlayer\\.org\\/doc\\/[^\\s)]+\\.md/g)||[])),s=t.join(c,i),f=t.join(s,`references`);await n.mkdir(f,{recursive:!0}),h&&await n.writeFile(t.join(s,`LICENCE.md`),h,`utf-8`);let g=a,_=o.map(async t=>{try{let e=await p(t),n=r(e),i=``;return i=Array.isArray(n.slugs)?n.slugs.filter(e=>e!==`doc`).join(`_`):new URL(t).pathname.split(`/`).filter(e=>e&&e!==`doc`).map(e=>e.replace(`.md`,``)).join(`_`),i=i?`${i}.md`:`index.md`,{url:t,localRefPath:`references/${i}`,fileName:i,content:e,success:!0}}catch(n){return console.warn(`Warning: Failed to download ref ${t} for skill ${e}`,n),{url:t,success:!1}}}),v=await Promise.all(_);for(let e of v)e.success&&e.fileName&&e.content&&e.localRefPath&&(await n.writeFile(t.join(f,e.fileName),e.content,`utf-8`),g=g.replaceAll(e.url,e.localRefPath));let y=t.join(s,`SKILL.md`);await n.writeFile(y,g,`utf-8`),m.push(`${i}/SKILL.md`)}return m.length===0?`No skill files were created. Check your asset paths.`:`Created ${m.length} skills in ${c}`};export{c as PLATFORMS,s as PLATFORMS_METADATA,a as SKILLS,i as SKILLS_METADATA,o as getInitialSkills,m as installSkills};\n//# sourceMappingURL=index.mjs.map"],"mappings":"kMAAmL,MAAs6B,EAAE,OAAO,KAAv6B,CAAC,OAAO,uCAAuC,QAAQ,+DAA+D,MAAM,sCAAsC,IAAI,kCAAkC,SAAS,4FAA4F,cAAc,0DAA0D,OAAO,sDAAsD,MAAM,wCAAwC,IAAI,sCAAsC,OAAO,oCAAoC,QAAQ,wDAAwD,OAAO,yCAAyC,MAAM,qMAAqM,MAAM,uCAAuC,CAAiB,CAAqS,EAAE,CAAC,OAAO,CAAC,MAAM,SAAS,IAAI,iBAAiB,UAAU,QAAQ,IAAI,SAAS,QAAQ,QAAQ,IAAI,eAAe,SAAS,CAAC,SAAS,CAAC,MAAM,WAAW,IAAI,mBAAmB,UAAU,QAAQ,IAAI,WAAW,QAAQ,QAAQ,IAAI,eAAe,WAAW,CAAC,KAAK,CAAC,MAAM,OAAO,IAAI,eAAe,UAAU,QAAQ,IAAI,OAAO,QAAQ,QAAQ,IAAI,eAAe,OAAO,CAAC,OAAO,CAAC,MAAM,UAAU,IAAI,eAAe,UAAU,QAAQ,IAAI,UAAU,OAAO,CAAC,OAAO,CAAC,MAAM,UAAU,IAAI,iBAAiB,UAAU,QAAQ,IAAI,SAAS,QAAQ,QAAQ,IAAI,eAAe,SAAS,CAAC,SAAS,CAAC,MAAM,WAAW,IAAI,mBAAmB,UAAU,QAAQ,IAAI,WAAW,OAAO,CAAC,OAAO,CAAC,MAAM,cAAc,IAAI,iBAAiB,UAAU,QAAQ,IAAI,SAAS,OAAO,CAAC,OAAO,CAAC,MAAM,2BAA2B,IAAI,iBAAiB,UAAU,QAAQ,IAAI,iBAAiB,QAAQ,CAAC,CAAC,QAAQ,IAAI,iBAAiB,CAAC,YAAY,CAAC,MAAM,cAAc,IAAI,gBAAgB,CAAC,QAAQ,C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,MAAM,QAAQ,EAAE,MAAM,CAAC,EAAE,MAAM,OAAO,GAAG,IAAI,MAAM,CAAC,KAAK,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC,SAAS,MAAM,IAAI,CAAC,OAAO,GAAG,GAAG,IAAI,MAAM,CAAC,IAAI,GAAG,EAAE,QAAQ,MAAM,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,KAAK,WAAW,CAAC,IAAI,EAAE,aAAa,cAAc,IAAI,SAAS,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,OAAO,QAAQ,KAAK,mCAAmC,EAAE,aAAa,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,QAAQ,IAAI,EAAE,CAAC,IAAI,IAAI,KAAK,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe,MAAMD,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,SAAS,CAAC,EAAE,QAAQ,QAAQ,CAAC,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,WAAW,CAAC,MAAMA,EAAE,UAAU,EAAE,EAAE,QAAQ,CAAC,EAAE,KAAK,GAAG,EAAE,WAAW,CAAC,OAAO,EAAE,SAAS,EAAE,uDAAuD,WAAW,EAAE,OAAO,aAAa"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{dirname as e}from"node:path";import t from"/Users/aymericpineau/Documents/intlayer_/node_modules/.bun/fast-glob@3.3.3/node_modules/fast-glob/out/index.js";import{configurationFilesCandidates as n}from"@intlayer/config/node";import r from"/Users/aymericpineau/Documents/intlayer_/node_modules/.bun/simple-git@3.32.3/node_modules/simple-git/dist/esm/index.js";const i=async e=>{try{return(await(e?r(e):r()).revparse([`--show-toplevel`])).trim()}catch{return null}},a=async r=>{let a=r?.baseDir??process.cwd();if(r?.gitRoot){let e=await i(a);e&&(a=e)}let o=await t(n.map(e=>`**/${e}`),{cwd:a,absolute:!0,ignore:[`**/node_modules/**`,`**/.git/**`],dot:!0}),s=[...new Set(o.map(t=>e(t)))];return{searchDir:a,projectsPath:s.sort()}};export{a};
|
|
2
|
+
//# sourceMappingURL=listProjects.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listProjects.mjs","names":["t","n","e"],"sources":["../../../../../../../../chokidar/dist/esm/listProjects.mjs"],"sourcesContent":["import{dirname as e}from\"node:path\";import t from\"fast-glob\";import{configurationFilesCandidates as n}from\"@intlayer/config/node\";import r from\"simple-git\";const i=async e=>{try{return(await(e?r(e):r()).revparse([`--show-toplevel`])).trim()}catch{return null}},a=async r=>{let a=r?.baseDir??process.cwd();if(r?.gitRoot){let e=await i(a);e&&(a=e)}let o=await t(n.map(e=>`**/${e}`),{cwd:a,absolute:!0,ignore:[`**/node_modules/**`,`**/.git/**`],dot:!0}),s=[...new Set(o.map(t=>e(t)))];return{searchDir:a,projectsPath:s.sort()}};export{a as listProjects};\n//# sourceMappingURL=listProjects.mjs.map"],"mappings":"6WAA4J,MAAM,EAAE,KAAM,IAAG,CAAC,GAAG,CAAC,OAAO,MAAM,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,SAAS,CAAC,kBAAkB,CAAC,EAAE,MAAM,MAAM,CAAC,OAAO,OAAO,EAAE,KAAM,IAAG,CAAC,IAAI,EAAE,GAAG,SAAS,QAAQ,KAAK,CAAC,GAAG,GAAG,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,IAAI,EAAE,GAAG,IAAI,EAAE,MAAMA,EAAEC,EAAE,IAAI,GAAG,MAAM,IAAI,CAAC,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,OAAO,CAAC,qBAAqB,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,IAAI,EAAE,IAAI,GAAGC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,EAAE,aAAa,EAAE,MAAM,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{e}from"../../utils/parseYaml.mjs";const t=t=>{try{let n=t.split(/\r?\n/),r=n.find(e=>e.trim()!==``);if(!r||r.trim()!==`---`)return{};let i=-1;for(let e=1;e<n.length;e++)if(n[e].trim()===`---`){i=e;break}return i===-1?{}:e(n.slice(1,i).join(`
|
|
2
|
+
`))??{}}catch{return{}}};export{t};
|
|
3
|
+
//# sourceMappingURL=getMarkdownMetadata.mjs.map
|
package/dist/esm/packages/@intlayer/core/dist/esm/transpiler/markdown/getMarkdownMetadata.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getMarkdownMetadata.mjs","names":[],"sources":["../../../../../../../../../../core/dist/esm/transpiler/markdown/getMarkdownMetadata.mjs"],"sourcesContent":["import{parseYaml as e}from\"../../utils/parseYaml.mjs\";const t=t=>{try{let n=t.split(/\\r?\\n/),r=n.find(e=>e.trim()!==``);if(!r||r.trim()!==`---`)return{};let i=-1;for(let e=1;e<n.length;e++)if(n[e].trim()===`---`){i=e;break}return i===-1?{}:e(n.slice(1,i).join(`\n`))??{}}catch{return{}}};export{t as getMarkdownMetadata};\n//# sourceMappingURL=getMarkdownMetadata.mjs.map"],"mappings":"yCAAsD,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,MAAM,QAAQ,CAAC,EAAE,EAAE,KAAK,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,MAAM,EAAE,CAAC,IAAI,EAAE,GAAG,IAAI,IAAI,EAAE,EAAE,EAAE,EAAE,OAAO,IAAI,GAAG,EAAE,GAAG,MAAM,GAAG,MAAM,CAAC,EAAE,EAAE,MAAM,OAAO,IAAI,GAAG,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,KAAK;EAClQ,CAAC,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const e=e=>{let t=e.trim();if(!t)return null;let n=0,r=e=>e===` `||e===`
|
|
2
|
+
`||e===` `||e===`\r`,i=()=>t[n],a=()=>t[n++],o=()=>n>=t.length,s=()=>{for(;!o()&&r(i());)n++},c=e=>{a();let t=``;for(;!o();){let n=a();if(n===e)return t;if(n===`\\`&&!o()){let e=a();t+=e}else t+=n}throw SyntaxError(`Unterminated string`)},l=(e,t)=>!!e&&t.includes(e),u=e=>{let t=``;for(;!o()&&!l(i(),e);)t+=a();return t.trim()},d=e=>e===`true`||e===`false`||e===`null`||e===`undefined`||e===`yes`||e===`no`||e===`on`||e===`off`||e===`NaN`||e===`Infinity`||e===`-Infinity`||/^0x[0-9a-fA-F]+$/.test(e)||/^#/.test(e)?e:/^-?\d+(?:\.\d+)?(?:e[+-]?\d+)?$/i.test(e)?e===`3.14159265359`?Math.PI:Number(e):e,f=e=>{if(s(),o())throw SyntaxError(`Unexpected end of input`);let t=i();if(t===`[`)return p();if(t===`{`)return y();if(t===`"`||t===`'`)return c(t);let n=u(e);if(n===``)throw SyntaxError(`Empty token`);return d(n)},p=()=>{a();let e=[];if(s(),i()===`]`)return a(),e;for(;;){s(),e.push(f([`,`,`]`])),s();let t=a();if(t===`]`)break;if(t!==`,`)throw SyntaxError(`Expected ',' or ']' after array element`);if(s(),i()===`]`)throw SyntaxError(`Trailing comma in array`)}return e},m=()=>{if(a(),s(),i()===`{`)return y();let e=i();if(e===`"`||e===`'`)return c(e);let r=!1,o=n;for(;o<t.length&&t[o]!==`
|
|
3
|
+
`;){if(t[o]===`:`&&o+1<t.length&&t[o+1]===` `){r=!0;break}o++}return r?h():d(u([`
|
|
4
|
+
`]))},h=()=>{let e={},r=g();for(;!o();){let l=n,f=t[l-1];s();let p=g();if((l===0||f===`
|
|
5
|
+
`)&&p<=r){n=l;break}let m=i();if(m===`-`||o()){n=l;break}let h=``;if(m===`"`||m===`'`)h=c(m);else{for(;!o()&&i()!==`:`;)h+=a();h=h.trim()}if(o()||a()!==`:`)break;if(s(),i()===`
|
|
6
|
+
`&&(a(),s(),i()===`-`)){e[h]=_();continue}e[h]=d(u([`
|
|
7
|
+
`])),i()===`
|
|
8
|
+
`&&a()}return e},g=()=>{let e=0,r=n;for(;r>0&&t[r-1]!==`
|
|
9
|
+
`;)r--;for(;r<t.length&&t[r]===` `;)e++,r++;return e},_=()=>{let e=[],t=g();for(;!o();){for(;!o()&&r(i())&&(a(),i()!==`-`););if(o()||g()<t||i()!==`-`)break;e.push(m())}return e},v=e=>{let t={};for(s();;){if(s(),o()||l(i(),e))return t;let r=``,u=i();if(u===`"`||u===`'`)r=c(u);else{for(;!o();){let t=i();if(t===`:`||t===`
|
|
10
|
+
`)break;if(l(t,e))throw SyntaxError(`Expected ':' in object entry`);r+=a()}r=r.trim()}if(!r)return t;if(o()||a()!==`:`)throw SyntaxError(`Expected ':' after key`);for(!o()&&i()===` `&&a();!o()&&(i()===` `||i()===` `);)a();if(o())return t[r]=``,t;if(i()===`
|
|
11
|
+
`){a();let c=n;if(s(),i()===`-`){t[r]=_(),s();continue}else{if(n=c,s(),!o()){let n=i();if(n&&!l(n,e)&&n!==`-`){t[r]=``;continue}}return t[r]=``,t}}if(t[r]=f(e.includes(`}`)?[`,`,`
|
|
12
|
+
`,...e]:[`
|
|
13
|
+
`,...e]),o())return t;let d=i();if(d===`,`){a(),s();continue}if(d===`
|
|
14
|
+
`){a(),s();continue}if(d===` `||d===` `){for(;!o()&&(i()===` `||i()===` `);)a();if(d=i(),d===`
|
|
15
|
+
`){a(),s();continue}if(o()||l(d,e))return t;continue}if(l(d,e)||o())return t}},y=()=>{if(a(),s(),i()===`}`)return a(),{};let e=v([`}`]);if(i()!==`}`)throw SyntaxError(`Expected '}' at end of object`);return a(),e},b=e=>{let t=0,n=0,r=null;for(;t<e.length;){let i=e[t];if(r){if(i===`\\`&&t+1<e.length){t+=2;continue}if(i===r){r=null,t++;continue}t++;continue}if(i===`"`||i===`'`){r=i,t++;continue}if(i===`[`||i===`{`){n++,t++;continue}if(i===`]`||i===`}`){n=Math.max(0,n-1),t++;continue}if(n===0&&i===`:`){let n=e[t+1];if(n===` `||n===`
|
|
16
|
+
`||n===void 0)return!0}t++}return!1};if(t.startsWith(`]`)||t.startsWith(`}`))throw SyntaxError(`Unexpected closing bracket`);if(t.startsWith(`[`)){let e=p();if(s(),!o())throw SyntaxError(`Unexpected trailing characters`);return e}if(t.startsWith(`{`)){let e=y();if(s(),!o())throw SyntaxError(`Unexpected trailing characters`);return e}if(b(t)){let e=v([]);if(s(),!o())throw SyntaxError(`Unexpected trailing characters`);return e}let x=f([]);if(s(),!o())throw SyntaxError(`Unexpected trailing characters`);return x};export{e};
|
|
17
|
+
//# sourceMappingURL=parseYaml.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseYaml.mjs","names":[],"sources":["../../../../../../../../../core/dist/esm/utils/parseYaml.mjs"],"sourcesContent":["const e=e=>{let t=e.trim();if(!t)return null;let n=0,r=e=>e===` `||e===`\n`||e===`\t`||e===`\\r`,i=()=>t[n],a=()=>t[n++],o=()=>n>=t.length,s=()=>{for(;!o()&&r(i());)n++},c=e=>{a();let t=``;for(;!o();){let n=a();if(n===e)return t;if(n===`\\\\`&&!o()){let e=a();t+=e}else t+=n}throw SyntaxError(`Unterminated string`)},l=(e,t)=>!!e&&t.includes(e),u=e=>{let t=``;for(;!o()&&!l(i(),e);)t+=a();return t.trim()},d=e=>e===`true`||e===`false`||e===`null`||e===`undefined`||e===`yes`||e===`no`||e===`on`||e===`off`||e===`NaN`||e===`Infinity`||e===`-Infinity`||/^0x[0-9a-fA-F]+$/.test(e)||/^#/.test(e)?e:/^-?\\d+(?:\\.\\d+)?(?:e[+-]?\\d+)?$/i.test(e)?e===`3.14159265359`?Math.PI:Number(e):e,f=e=>{if(s(),o())throw SyntaxError(`Unexpected end of input`);let t=i();if(t===`[`)return p();if(t===`{`)return y();if(t===`\"`||t===`'`)return c(t);let n=u(e);if(n===``)throw SyntaxError(`Empty token`);return d(n)},p=()=>{a();let e=[];if(s(),i()===`]`)return a(),e;for(;;){s(),e.push(f([`,`,`]`])),s();let t=a();if(t===`]`)break;if(t!==`,`)throw SyntaxError(`Expected ',' or ']' after array element`);if(s(),i()===`]`)throw SyntaxError(`Trailing comma in array`)}return e},m=()=>{if(a(),s(),i()===`{`)return y();let e=i();if(e===`\"`||e===`'`)return c(e);let r=!1,o=n;for(;o<t.length&&t[o]!==`\n`;){if(t[o]===`:`&&o+1<t.length&&t[o+1]===` `){r=!0;break}o++}return r?h():d(u([`\n`]))},h=()=>{let e={},r=g();for(;!o();){let l=n,f=t[l-1];s();let p=g();if((l===0||f===`\n`)&&p<=r){n=l;break}let m=i();if(m===`-`||o()){n=l;break}let h=``;if(m===`\"`||m===`'`)h=c(m);else{for(;!o()&&i()!==`:`;)h+=a();h=h.trim()}if(o()||a()!==`:`)break;if(s(),i()===`\n`&&(a(),s(),i()===`-`)){e[h]=_();continue}e[h]=d(u([`\n`])),i()===`\n`&&a()}return e},g=()=>{let e=0,r=n;for(;r>0&&t[r-1]!==`\n`;)r--;for(;r<t.length&&t[r]===` `;)e++,r++;return e},_=()=>{let e=[],t=g();for(;!o();){for(;!o()&&r(i())&&(a(),i()!==`-`););if(o()||g()<t||i()!==`-`)break;e.push(m())}return e},v=e=>{let t={};for(s();;){if(s(),o()||l(i(),e))return t;let r=``,u=i();if(u===`\"`||u===`'`)r=c(u);else{for(;!o();){let t=i();if(t===`:`||t===`\n`)break;if(l(t,e))throw SyntaxError(`Expected ':' in object entry`);r+=a()}r=r.trim()}if(!r)return t;if(o()||a()!==`:`)throw SyntaxError(`Expected ':' after key`);for(!o()&&i()===` `&&a();!o()&&(i()===` `||i()===`\t`);)a();if(o())return t[r]=``,t;if(i()===`\n`){a();let c=n;if(s(),i()===`-`){t[r]=_(),s();continue}else{if(n=c,s(),!o()){let n=i();if(n&&!l(n,e)&&n!==`-`){t[r]=``;continue}}return t[r]=``,t}}if(t[r]=f(e.includes(`}`)?[`,`,`\n`,...e]:[`\n`,...e]),o())return t;let d=i();if(d===`,`){a(),s();continue}if(d===`\n`){a(),s();continue}if(d===` `||d===`\t`){for(;!o()&&(i()===` `||i()===`\t`);)a();if(d=i(),d===`\n`){a(),s();continue}if(o()||l(d,e))return t;continue}if(l(d,e)||o())return t}},y=()=>{if(a(),s(),i()===`}`)return a(),{};let e=v([`}`]);if(i()!==`}`)throw SyntaxError(`Expected '}' at end of object`);return a(),e},b=e=>{let t=0,n=0,r=null;for(;t<e.length;){let i=e[t];if(r){if(i===`\\\\`&&t+1<e.length){t+=2;continue}if(i===r){r=null,t++;continue}t++;continue}if(i===`\"`||i===`'`){r=i,t++;continue}if(i===`[`||i===`{`){n++,t++;continue}if(i===`]`||i===`}`){n=Math.max(0,n-1),t++;continue}if(n===0&&i===`:`){let n=e[t+1];if(n===` `||n===`\n`||n===void 0)return!0}t++}return!1};if(t.startsWith(`]`)||t.startsWith(`}`))throw SyntaxError(`Unexpected closing bracket`);if(t.startsWith(`[`)){let e=p();if(s(),!o())throw SyntaxError(`Unexpected trailing characters`);return e}if(t.startsWith(`{`)){let e=y();if(s(),!o())throw SyntaxError(`Unexpected trailing characters`);return e}if(b(t)){let e=v([]);if(s(),!o())throw SyntaxError(`Unexpected trailing characters`);return e}let x=f([]);if(s(),!o())throw SyntaxError(`Unexpected trailing characters`);return x};export{e as parseYaml};\n//# sourceMappingURL=parseYaml.mjs.map"],"mappings":"AAAA,MAAM,EAAE,GAAG,CAAC,IAAI,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,OAAO,KAAK,IAAI,EAAE,EAAE,EAAE,GAAG,IAAI,KAAK,IAAI;GACpE,IAAI,KAAK,IAAI,KAAK,MAAM,EAAE,GAAG,MAAM,EAAE,KAAK,MAAM,GAAG,EA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killsTool as t}from"../tools/installSkills.mjs";import{loadDocsTools as n}from"../tools/docs.mjs";import{
|
|
1
|
+
import{loadCLITools as e}from"../tools/cli.mjs";import{loadInstallSkillsTool as t}from"../tools/installSkills.mjs";import{loadDocsTools as n}from"../tools/docs.mjs";import{dirname as r,resolve as i}from"node:path";import{readFileSync as a}from"node:fs";import{isESModule as o}from"@intlayer/config/utils";import{fileURLToPath as s}from"node:url";import{McpServer as c}from"@modelcontextprotocol/sdk/server/mcp.js";const l=o?r(s(import.meta.url)):__dirname,u=JSON.parse(a(i(l,`../../../package.json`),`utf8`)),d=({isLocal:r})=>{let i=new c({name:`intlayer`,version:u.version});if(r)try{e(i),t(i)}catch(e){console.error(`Error loading CLI tools:`,e)}try{n(i)}catch(e){console.error(`Error loading docs tools:`,e)}return i};export{l as dirname,d as loadServer};
|
|
2
2
|
//# sourceMappingURL=server.mjs.map
|
package/dist/esm/server/sse.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{loadServer as e}from"./server.mjs";import{
|
|
2
|
+
import{loadServer as e}from"./server.mjs";import{randomUUID as t}from"node:crypto";import{StreamableHTTPServerTransport as n}from"@modelcontextprotocol/sdk/server/streamableHttp.js";import r from"dotenv";import i from"express";const a=i(),o=a.get(`env`);r.config({path:[`.env.${o}.local`,`.env.${o}`,`.env.local`,`.env`],quiet:!0}),a.use((e,t,n)=>{if(t.header(`Access-Control-Allow-Origin`,`*`),t.header(`Access-Control-Allow-Methods`,`GET, POST, OPTIONS`),t.header(`Access-Control-Allow-Headers`,`Content-Type, mcp-session-id`),e.method===`OPTIONS`){t.sendStatus(200);return}n()}),a.use(i.json());const s=i.Router(),c={};s.post(`/`,async(r,i)=>{let a=r.headers[`mcp-session-id`],o;if(a&&c[a])o=c[a];else if(!a)o=new n({sessionIdGenerator:()=>t()}),o.onclose=()=>{o.sessionId&&delete c[o.sessionId]},await e({isLocal:!1}).connect(o);else{i.status(400).send({messages:`Bad session id.`});return}await o.handleRequest(r,i,r.body);let s=o.sessionId;s&&!c[s]&&(c[s]=o)}),s.get(`/`,async(e,t)=>{let n=e.headers[`mcp-session-id`];if(!n||!c[n]){t.status(400).send({messages:`Bad session id.`});return}await c[n].handleRequest(e,t)}),s.delete(`/`,async(e,t)=>{let n=e.headers[`mcp-session-id`];if(!n||!c[n]){t.status(400).send({messages:`Bad session id.`});return}await c[n].handleRequest(e,t)}),a.use(`/`,s),a.use(`/health`,(e,t)=>{t.send(`OK`)});const l=process.env.PORT??3e3;a.listen(l,()=>{console.info(`MCP Streamable HTTP Server listening on port ${l}`)});
|
|
3
3
|
//# sourceMappingURL=sse.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sse.mjs","names":[],"sources":["../../../src/server/sse.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';\nimport dotenv from 'dotenv';\nimport express, { type Request, type Response } from 'express';\nimport { loadServer } from './server';\n\nconst
|
|
1
|
+
{"version":3,"file":"sse.mjs","names":[],"sources":["../../../src/server/sse.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { randomUUID } from 'node:crypto';\nimport { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';\nimport dotenv from 'dotenv';\nimport express, { type Request, type Response } from 'express';\nimport { loadServer } from './server';\n\nconst app = express();\nconst env = app.get('env');\n\ndotenv.config({\n path: [`.env.${env}.local`, `.env.${env}`, '.env.local', '.env'],\n quiet: true,\n});\n\napp.use((req, res, next) => {\n res.header('Access-Control-Allow-Origin', '*');\n res.header('Access-Control-Allow-Methods', 'GET, POST, OPTIONS');\n res.header('Access-Control-Allow-Headers', 'Content-Type, mcp-session-id');\n if (req.method === 'OPTIONS') {\n res.sendStatus(200);\n return;\n }\n next();\n});\n\napp.use(express.json());\nconst router = express.Router();\n\nconst transports: { [sessionId: string]: StreamableHTTPServerTransport } = {};\n\nrouter.post('/', async (req: Request, res: Response) => {\n const sessionId = req.headers['mcp-session-id'] as string | undefined;\n\n let transport: StreamableHTTPServerTransport;\n\n if (sessionId && transports[sessionId]) {\n transport = transports[sessionId];\n } else if (!sessionId) {\n transport = new StreamableHTTPServerTransport({\n sessionIdGenerator: () => randomUUID(),\n });\n transport.onclose = () => {\n if (transport.sessionId) {\n delete transports[transport.sessionId];\n }\n };\n const server = loadServer({ isLocal: false });\n await server.connect(transport);\n } else {\n res.status(400).send({ messages: 'Bad session id.' });\n return;\n }\n\n await transport.handleRequest(req, res, req.body);\n\n const newSessionId = transport.sessionId;\n if (newSessionId && !transports[newSessionId]) {\n transports[newSessionId] = transport;\n }\n});\n\nrouter.get('/', async (req: Request, res: Response) => {\n const sessionId = req.headers['mcp-session-id'] as string | undefined;\n\n if (!sessionId || !transports[sessionId]) {\n res.status(400).send({ messages: 'Bad session id.' });\n return;\n }\n\n await transports[sessionId].handleRequest(req, res);\n});\n\nrouter.delete('/', async (req: Request, res: Response) => {\n const sessionId = req.headers['mcp-session-id'] as string | undefined;\n\n if (!sessionId || !transports[sessionId]) {\n res.status(400).send({ messages: 'Bad session id.' });\n return;\n }\n\n await transports[sessionId].handleRequest(req, res);\n});\n\napp.use('/', router);\napp.use('/health', (_req: Request, res: Response) => {\n res.send('OK');\n});\n\nconst PORT = process.env.PORT ?? 3000;\napp.listen(PORT, () => {\n console.info(`MCP Streamable HTTP Server listening on port ${PORT}`);\n});\n"],"mappings":";mOAQA,MAAM,EAAM,GAAS,CACf,EAAM,EAAI,IAAI,MAAM,CAE1B,EAAO,OAAO,CACZ,KAAM,CAAC,QAAQ,EAAI,QAAS,QAAQ,IAAO,aAAc,OAAO,CAChE,MAAO,GACR,CAAC,CAEF,EAAI,KAAK,EAAK,EAAK,IAAS,CAI1B,GAHA,EAAI,OAAO,8BAA+B,IAAI,CAC9C,EAAI,OAAO,+BAAgC,qBAAqB,CAChE,EAAI,OAAO,+BAAgC,+BAA+B,C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,KAAK,EACd,CAEF,MAAM,EAAO,QAAQ,IAAI,MAAQ,IACjC,EAAI,OAAO,MAAY,CACrB,QAAQ,KAAK,gDAAgD,IAAO,EACpE"}
|
package/dist/esm/tools/cli.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a as e}from"../packages/@intlayer/chokidar/dist/esm/listProjects.mjs";import{relative as t}from"node:path";import{build as n,extract as r,fill as i,init as a,listContentDeclarationRows as o,listMissingTranslations as s,pull as c,push as l}from"@intlayer/cli";import{ALL_LOCALES as u}from"@intlayer/types/allLocales";import d from"zod";const f=async f=>{f.registerTool(`intlayer-init`,{title:`Initialize Intlayer`,description:`Initialize Intlayer in the project`,inputSchema:{projectRoot:d.string().describe(`Project root directory`)},annotations:{destructiveHint:!0}},async({projectRoot:e})=>{try{return await a(e),{content:[{type:`text`,text:`Initialization successful.`}]}}catch(e){return{content:[{type:`text`,text:`Initialization failed: ${e instanceof Error?e.message:`An unknown error occurred`}`}]}}}),f.registerTool(`intlayer-build`,{title:`Build Dictionaries`,description:"Build the dictionaries. List all content declarations files `.content.{ts,tsx,js,json,...}` to update the content callable using the `useIntlayer` hook.",inputSchema:{watch:d.boolean().optional().describe(`Watch for changes`),baseDir:d.string().optional().describe(`Base directory`),env:d.string().optional().describe(`Environment`),envFile:d.string().optional().describe(`Environment file`),verbose:d.boolean().optional().describe(`Verbose output`),prefix:d.string().optional().describe(`Log prefix`)},annotations:{destructiveHint:!0}},async({watch:e,baseDir:t,env:r,envFile:i,verbose:a,prefix:o})=>{try{let s={};return a&&(s.mode=`verbose`),o&&(s.prefix=o),await n({watch:e,configOptions:{baseDir:t,env:r,envFile:i,override:{log:s}}}),{content:[{type:`text`,text:`Build successful.`}]}}catch(e){return{content:[{type:`text`,text:`Build failed: ${e instanceof Error?e.message:`An unknown error occurred`}`}]}}}),f.registerTool(`intlayer-fill`,{title:`Fill Translations`,description:`Fill the dictionaries with missing translations / review translations using Intlayer servers`,inputSchema:{sourceLocale:d.nativeEnum(u).optional().describe(`Source locale`),outputLocales:d.union([d.nativeEnum(u),d.array(d.nativeEnum(u))]).optional().describe(`Output locales`),file:d.union([d.string(),d.array(d.string())]).optional().describe(`File path`),mode:d.enum([`complete`,`review`]).optional().describe(`Fill mode`),keys:d.union([d.string(),d.array(d.string())]).optional().describe(`Keys to include`),excludedKeys:d.union([d.string(),d.array(d.string())]).optional().describe(`Keys to exclude`),pathFilter:d.union([d.string(),d.array(d.string())]).optional().describe(`Path filter`),gitOptions:d.object({gitDiff:d.boolean().optional(),gitDiffBase:d.string().optional(),gitDiffCurrent:d.string().optional(),uncommitted:d.boolean().optional(),unpushed:d.boolean().optional(),untracked:d.boolean().optional()}).optional().describe(`Git options`),aiOptions:d.object({provider:d.string().optional(),temperature:d.number().optional(),model:d.string().optional(),apiKey:d.string().optional(),customPrompt:d.string().optional(),applicationContext:d.string().optional()}).optional().describe(`AI options`)},annotations:{destructiveHint:!0}},async e=>{try{let{gitOptions:t,...n}=e,r={...n,gitOptions:void 0};if(t){let{gitDiff:e,uncommitted:n,unpushed:i,untracked:a,...o}=t,s=[];e&&s.push(`gitDiff`),n&&s.push(`uncommitted`),i&&s.push(`unpushed`),a&&s.push(`untracked`),r.gitOptions={...o,mode:s}}return await i(r),{content:[{type:`text`,text:`Fill successful.`}]}}catch(e){return{content:[{type:`text`,text:`Fill failed: ${e instanceof Error?e.message:`An unknown error occurred`}`}]}}}),f.registerTool(`intlayer-push`,{title:`Push Dictionaries`,description:`Push local dictionaries to the server`,inputSchema:{deleteLocaleDictionary:d.boolean().optional().describe(`Delete local dictionary after push`),keepLocaleDictionary:d.boolean().optional().describe(`Keep local dictionary after push`),dictionaries:d.array(d.string()).optional().describe(`List of dictionaries to push`),gitOptions:d.object({gitDiff:d.boolean().optional(),gitDiffBase:d.string().optional(),gitDiffCurrent:d.string().optional(),uncommitted:d.boolean().optional(),unpushed:d.boolean().optional(),untracked:d.boolean().optional()}).optional().describe(`Git options`)},annotations:{destructiveHint:!0}},async e=>{try{let{gitOptions:t,...n}=e,r={...n,gitOptions:void 0};if(t){let{gitDiff:e,uncommitted:n,unpushed:i,untracked:a,...o}=t,s=[];e&&s.push(`gitDiff`),n&&s.push(`uncommitted`),i&&s.push(`unpushed`),a&&s.push(`untracked`),r.gitOptions={...o,mode:s}}return await l(r),{content:[{type:`text`,text:`Push successful.`}]}}catch(e){return{content:[{type:`text`,text:`Push failed: ${e instanceof Error?e.message:`An unknown error occurred`}`}]}}}),f.registerTool(`intlayer-pull`,{title:`Pull Dictionaries`,description:`Pull dictionaries from the CMS`,inputSchema:{dictionaries:d.array(d.string()).optional().describe(`List of dictionaries to pull`),newDictionariesPath:d.string().optional().describe(`Path to save new dictionaries`)},annotations:{destructiveHint:!0}},async e=>{try{return await c(e),{content:[{type:`text`,text:`Pull successful.`}]}}catch(e){return{content:[{type:`text`,text:`Pull failed: ${e instanceof Error?e.message:`An unknown error occurred`}`}]}}}),f.registerTool(`intlayer-content-list`,{title:`List Content Declarations`,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.`,inputSchema:{configOptions:d.object({baseDir:d.string().optional(),env:d.string().optional(),envFile:d.string().optional(),override:d.object({log:d.object({prefix:d.string().optional(),verbose:d.boolean().optional()}).optional()}).optional()}).optional().describe(`Configuration options`),absolute:d.boolean().optional().describe(`Output the results as absolute paths instead of relative paths`),json:d.boolean().optional().describe(`Output the results as JSON instead of formatted text`)},annotations:{readOnlyHint:!0}},async e=>{try{let t=o(e);return{content:[{type:`text`,text:e.json?JSON.stringify(t):JSON.stringify(t,null,2)}]}}catch(e){return{content:[{type:`text`,text:`Content list failed: ${e instanceof Error?e.message:`An unknown error occurred`}`}]}}}),f.registerTool(`intlayer-content-test`,{title:`Test Translations`,description:`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.`,inputSchema:{configOptions:d.object({baseDir:d.string().optional(),env:d.string().optional(),envFile:d.string().optional(),override:d.object({log:d.object({prefix:d.string().optional(),verbose:d.boolean().optional()}).optional()}).optional()}).optional().describe(`Configuration options`)},annotations:{readOnlyHint:!0}},async e=>{try{let t=s(e?.configOptions);return{content:[{type:`text`,text:JSON.stringify(t,null,2)}]}}catch(e){return{content:[{type:`text`,text:`Content test failed: ${e instanceof Error?e.message:`An unknown error occurred`}`}]}}}),f.registerTool(`intlayer-extract`,{title:`Extract strings from Component`,description:`Extract strings from an existing component to be placed in a .content file close to the component. Trigger this action to make an existing component multilingual. If the component does not exist, create a normal component including text in JSX, and then trigger this tool to extract it.`,inputSchema:{file:d.union([d.string(),d.array(d.string())]).optional().describe(`List of files to extract`),outputContentDeclarations:d.string().optional().describe(`Path to output content declaration files`),configOptions:d.object({baseDir:d.string().optional(),env:d.string().optional(),envFile:d.string().optional(),override:d.object({log:d.object({prefix:d.string().optional(),verbose:d.boolean().optional()}).optional()}).optional()}).optional().describe(`Configuration options`)},annotations:{destructiveHint:!0}},async e=>{try{return await r({files:Array.isArray(e.file)?e.file:e.file?[e.file]:void 0,configOptions:e.configOptions}),{content:[{type:`text`,text:`Extract successful.`}]}}catch(e){return{content:[{type:`text`,text:`Extract failed: ${e instanceof Error?e.message:`An unknown error occurred`}`}]}}}),f.registerTool(`intlayer-projects-list`,{title:`List Projects`,description:`List all Intlayer projects in the directory. Search for configuration files to find all Intlayer projects.`,inputSchema:{baseDir:d.string().optional().describe(`Base directory to search from`),gitRoot:d.boolean().optional().describe(`Search from the git root directory instead of the base directory`),absolute:d.boolean().optional().describe(`Output the results as absolute paths instead of relative paths`),json:d.boolean().optional().describe(`Output the results as JSON instead of formatted text`)},annotations:{readOnlyHint:!0}},async n=>{try{let{searchDir:r,projectsPath:i}=await e({baseDir:n.baseDir,gitRoot:n.gitRoot}),a=i.map(e=>n.absolute?e:t(r,e)).map(e=>e===``?`.`:e),o=n.absolute?i:a;return{content:[{type:`text`,text:n.json?JSON.stringify(o):JSON.stringify({searchDir:r,projectsPath:o},null,2)}]}}catch(e){return{content:[{type:`text`,text:`Projects list failed: ${e instanceof Error?e.message:`An unknown error occurred`}`}]}}})};export{f as loadCLITools};
|
|
2
2
|
//# sourceMappingURL=cli.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.mjs","names":[],"sources":["../../../src/tools/cli.ts"],"sourcesContent":["import { relative } from 'node:path';\nimport {\n build,\n extract,\n fill,\n init,\n listContentDeclarationRows,\n listMissingTranslations,\n listProjects,\n pull,\n push,\n} from '@intlayer/cli';\nimport { ALL_LOCALES } from '@intlayer/types/allLocales';\nimport type { LogConfig } from '@intlayer/types/config';;\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(ALL_LOCALES)\n .optional()\n .describe('Source locale'),\n outputLocales: z\n .union([\n z.nativeEnum(ALL_LOCALES),\n z.array(z.nativeEnum(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-extract',\n {\n title: 'Extract strings from Component',\n description:\n 'Extract strings from an existing component to be placed in a .content file close to the component. Trigger this action to make an existing component multilingual. If the component does not exist, create a normal component including text in JSX, and then trigger this tool to extract it.',\n inputSchema: {\n file: z\n .union([z.string(), z.array(z.string())])\n .optional()\n .describe('List of files to extract'),\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 extract({\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: 'Extract 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: `Extract 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":"8RAmBA,MAAa,EAA6B,KAAO,IAAW,CAC1D,EAAO,aACL,gBACA,CACE,MAAO,sBACP,YAAa,qCACb,YAAa,CACX,YAAa,EAAE,QAAQ,CAAC,SAAS,yBAAyB,CAC3D,CACD,YAAa,CACX,gBAAiB,GAClB,CACF,CACD,MAAO,CAAE,iBAAkB,CACzB,GAAI,CAGF,OAFA,MAA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SACC,iEACD,CACH,KAAM,EACH,SAAS,CACT,UAAU,CACV,SAAS,uDAAuD,CACpE,CACD,YAAa,CACX,aAAc,GACf,CACF,CACD,KAAO,IAAU,CACf,GAAI,CACF,GAAM,CAAE,YAAW,gBAAiB,MAAM,EAAa,CACrD,QAAS,EAAM,QACf,QAAS,EAAM,QAChB,CAAC,CAGI,EAAuB,EAC1B,IAAK,GACJ,EAAM,SAAW,EAAc,EAAS,EAAW,EAAY,CAChE,CACA,IAAK,GAAiB,IAAgB,GAAK,IAAM,EAAa,CAE3D,EAAc,EAAM,SACtB,EACA,EAEJ,MAAO,CACL,QAAS,CACP,CACE,KAAM,OACN,KAAM,EAAM,KACR,KAAK,UAAU,EAAY,CAC3B,KAAK,UACH,CAAE,YAAW,aAAc,EAAa,CACxC,KACA,EACD,CACN,CACF,CACF,OACM,EAAO,CAGd,MAAO,CACL,QAAS,CACP,CACE,KAAM,OACN,KAAM,yBALV,aAAiB,MAAQ,EAAM,QAAU,8BAMtC,CACF,CACF,GAGN"}
|
|
1
|
+
{"version":3,"file":"cli.mjs","names":["listProjects"],"sources":["../../../src/tools/cli.ts"],"sourcesContent":["import { relative } from 'node:path';\nimport { listProjects } from '@intlayer/chokidar/cli';\nimport {\n build,\n extract,\n fill,\n init,\n listContentDeclarationRows,\n listMissingTranslations,\n pull,\n push,\n} from '@intlayer/cli';\nimport { ALL_LOCALES } from '@intlayer/types/allLocales';\nimport type { LogConfig } from '@intlayer/types/config';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport z from 'zod';\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(ALL_LOCALES)\n .optional()\n .describe('Source locale'),\n outputLocales: z\n .union([\n z.nativeEnum(ALL_LOCALES),\n z.array(z.nativeEnum(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-extract',\n {\n title: 'Extract strings from Component',\n description:\n 'Extract strings from an existing component to be placed in a .content file close to the component. Trigger this action to make an existing component multilingual. If the component does not exist, create a normal component including text in JSX, and then trigger this tool to extract it.',\n inputSchema: {\n file: z\n .union([z.string(), z.array(z.string())])\n .optional()\n .describe('List of files to extract'),\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 extract({\n files: Array.isArray(props.file)\n ? props.file\n : props.file\n ? [props.file]\n : undefined,\n configOptions: props.configOptions,\n });\n\n return {\n content: [\n {\n type: 'text',\n text: 'Extract 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: `Extract 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":"sVAmBA,MAAa,EAA6B,KAAO,IAAW,CAC1D,EAAO,aACL,gBACA,CACE,MAAO,sBACP,YAAa,qCACb,YAAa,CACX,YAAa,EAAE,QAAQ,CAAC,SAAS,yBAAyB,CAC3D,CACD,YAAa,CACX,gBAAiB,GAClB,CACF,CACD,MAAO,CAAE,iBAAkB,CACzB,GAAI,CAGF,OAFA,MAAM,EAAK,EAAY,CAEhB,CACL,QAAS,CACP,CACE,KAAM,OACN,KAAM,6BACP,CACF,CACF,OACM,EAAO,CAGd,MAAO,CACL,QAAS,CACP,CACE,KAAM,OACN,KAAM,0BALV,aAAiB,MAAQ,EAAM,QAAU,8BAMtC,CACF,CACF,GAGN,CAED,EAAO,aACL,iBACA,CACE,MAAO,qBACP,YACE,2JACF,YAAa,CACX,MAAO,EAAE,SAAS,CAAC,UAAU,CAAC,SAAS,oBAAoB,CAC3D,QAAS,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,iBAAiB,CACzD,IAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,cAAc,CAClD,QAAS,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,mBAAmB,CAC3D,QAAS,EAAE,SAAS,CAAC,UAAU,CAAC,SAAS,iBAAiB,CAC1D,OAAQ,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,aAAa,CACrD,CACD,YAAa,CACX,gBAAiB,GAClB,CACF,CACD,MAAO,CAAE,QAAO,UAAS,MAAK,UAAS,UAAS,YAAa,CAC3D,GAAI,CACF,IAAM,EAA0B,EAAE,CAoBlC,OAnBI,IACF,EAAI,KAAO,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B,EAAM,KACN,EAAM,KACJ,CAAC,EAAM,KAAK,CACZ,IAAA,GACN,cAAe,EAAM,cACtB,CAAC,CAEK,CACL,QAAS,CACP,CACE,KAAM,OACN,KAAM,sBACP,CACF,CACF,OACM,EAAO,CAGd,MAAO,CACL,QAAS,CACP,CACE,KAAM,OACN,KAAM,mBALV,aAAiB,MAAQ,EAAM,QAAU,8BAMtC,CACF,CACF,GAGN,CAED,EAAO,aACL,yBACA,CACE,MAAO,gBACP,YACE,6GACF,YAAa,CACX,QAAS,EACN,QAAQ,CACR,UAAU,CACV,SAAS,gCAAgC,CAC5C,QAAS,EACN,SAAS,CACT,UAAU,CACV,SACC,mEACD,CACH,SAAU,EACP,SAAS,CACT,UAAU,CACV,SACC,iEACD,CACH,KAAM,EACH,SAAS,CACT,UAAU,CACV,SAAS,uDAAuD,CACpE,CACD,YAAa,CACX,aAAc,GACf,CACF,CACD,KAAO,IAAU,CACf,GAAI,CACF,GAAM,CAAE,YAAW,gBAAiB,MAAMA,EAAa,CACrD,QAAS,EAAM,QACf,QAAS,EAAM,QAChB,CAAC,CAGI,EAAuB,EAC1B,IAAK,GACJ,EAAM,SAAW,EAAc,EAAS,EAAW,EAAY,CAChE,CACA,IAAK,GAAiB,IAAgB,GAAK,IAAM,EAAa,CAE3D,EAAc,EAAM,SACtB,EACA,EAEJ,MAAO,CACL,QAAS,CACP,CACE,KAAM,OACN,KAAM,EAAM,KACR,KAAK,UAAU,EAAY,CAC3B,KAAK,UACH,CAAE,YAAW,aAAc,EAAa,CACxC,KACA,EACD,CACN,CACF,CACF,OACM,EAAO,CAGd,MAAO,CACL,QAAS,CACP,CACE,KAAM,OACN,KAAM,yBALV,aAAiB,MAAQ,EAAM,QAAU,8BAMtC,CACF,CACF,GAGN"}
|
package/dist/esm/tools/docs.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import e from"zod
|
|
1
|
+
import e from"zod";import{getSearchAPI as t}from"@intlayer/api";import{getDoc as n,getDocBySlug as r,getDocMetadataRecord as i,getDocsKeys as a}from"@intlayer/docs";const o=async o=>{let s=a();o.registerTool(`get-doc-list`,{title:`Get Doc List`,description:`Get the list of docs names and their metadata to get more details about what doc to retrieve`,inputSchema:{},annotations:{readOnlyHint:!0}},async()=>{try{let e=await i();return{content:[{type:`text`,text:JSON.stringify(e,null,2)}]}}catch(e){return{content:[{type:`text`,text:`Get doc list failed: ${e instanceof Error?e.message:`An unknown error occurred`}`}]}}}),o.registerTool(`get-doc`,{title:`Get Doc by Key`,description:"Get a doc by his key. Example: `./docs/en/getting-started.md`. List all docs metadata first to get more details about what doc key to retrieve.",inputSchema:{docKey:e.enum(s)},annotations:{readOnlyHint:!0}},async({docKey:e})=>{try{return{content:[{type:`text`,text:await n(e)}]}}catch(e){return{content:[{type:`text`,text:`Get doc failed: ${e instanceof Error?e.message:`An unknown error occurred`}`}]}}}),o.registerTool(`get-doc-by-slug`,{title:`Get Doc by Slug`,description:`Get an array of docs by their slugs. If not slug is provided, return all docs (1.2Mb). List all docs metadata first to get more details about what doc to retrieve.`,inputSchema:{slug:e.union([e.string(),e.array(e.string())]).optional().describe(`Slug of the docs. If not provided, return all docs. If not provided, return all docs.`),strict:e.boolean().optional().describe(`Strict mode - only return docs that match all slugs, by excluding additional slugs`)},annotations:{readOnlyHint:!0}},async({slug:e,strict:t})=>{try{return{content:(await r(e??[],void 0,t)).map(e=>({type:`text`,text:e}))}}catch(e){return{content:[{type:`text`,text:`Get doc by slug failed: ${e instanceof Error?e.message:`An unknown error occurred`}`}]}}}),o.registerTool(`fetch-doc-chunks`,{title:`Fetch Doc Chunks`,description:`Fetch related doc chunks using keywords or questions. This tool will return the most relevant chunks of documentation based on the input query.`,inputSchema:{query:e.string().describe(`The keywords or question to search for`),limit:e.number().optional().describe(`The number of chunks to retrieve (default: 10)`)},annotations:{readOnlyHint:!0}},async({query:e,limit:n})=>{try{let{searchDoc:r}=t(),i=await r({input:e,limit:n?.toString(),returnContent:`true`});return!i.data||!Array.isArray(i.data)?{content:[{type:`text`,text:`No relevant chunks found.`}]}:{content:i.data.map(e=>({type:`text`,text:[`File: ${e.fileKey}`,`Title: ${e.docName}`,`URL: ${e.docUrl}`,`Chunk: ${e.chunkNumber}`,`Content:`,e.content].join(`
|
|
2
2
|
`)}))}}catch(e){return{content:[{type:`text`,text:`Fetch doc chunks failed: ${e instanceof Error?e.message:`An unknown error occurred`}`}]}}})};export{o as loadDocsTools};
|
|
3
3
|
//# sourceMappingURL=docs.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.mjs","names":[],"sources":["../../../src/tools/docs.ts"],"sourcesContent":["import { getSearchAPI } from '@intlayer/api';\nimport type { DocKey } from '@intlayer/docs';\nimport {\n getDoc,\n getDocBySlug,\n getDocMetadataRecord,\n getDocsKeys,\n} from '@intlayer/docs';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport z from 'zod
|
|
1
|
+
{"version":3,"file":"docs.mjs","names":[],"sources":["../../../src/tools/docs.ts"],"sourcesContent":["import { getSearchAPI } from '@intlayer/api';\nimport type { DocKey } from '@intlayer/docs';\nimport {\n getDoc,\n getDocBySlug,\n getDocMetadataRecord,\n getDocsKeys,\n} from '@intlayer/docs';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport z from 'zod';\n\ntype LoadDocsTools = (server: McpServer) => Promise<void>;\n\nexport const loadDocsTools: LoadDocsTools = async (server) => {\n const docsKeys = getDocsKeys();\n\n server.registerTool(\n 'get-doc-list',\n {\n title: 'Get Doc List',\n description:\n 'Get the list of docs names and their metadata to get more details about what doc to retrieve',\n inputSchema: {},\n annotations: {\n readOnlyHint: true,\n },\n },\n async () => {\n try {\n const docsMetadataRecord = await getDocMetadataRecord();\n\n return {\n content: [\n {\n type: 'text',\n text: JSON.stringify(docsMetadataRecord, 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 { type: 'text', text: `Get doc list failed: ${errorMessage}` },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'get-doc',\n {\n title: 'Get Doc by Key',\n description:\n 'Get a doc by his key. Example: `./docs/en/getting-started.md`. List all docs metadata first to get more details about what doc key to retrieve.',\n inputSchema: {\n docKey: z.enum(docsKeys as [string, ...string[]]),\n },\n annotations: {\n readOnlyHint: true,\n },\n },\n async ({ docKey }) => {\n try {\n const doc = await getDoc(docKey as DocKey);\n return {\n content: [{ type: 'text', text: doc }],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [{ type: 'text', text: `Get doc failed: ${errorMessage}` }],\n };\n }\n }\n );\n\n server.registerTool(\n 'get-doc-by-slug',\n {\n title: 'Get Doc by Slug',\n description:\n 'Get an array of docs by their slugs. If not slug is provided, return all docs (1.2Mb). List all docs metadata first to get more details about what doc to retrieve.',\n inputSchema: {\n slug: z\n .union([z.string(), z.array(z.string())])\n .optional()\n .describe(\n 'Slug of the docs. If not provided, return all docs. If not provided, return all docs.'\n ),\n strict: z\n .boolean()\n .optional()\n .describe(\n 'Strict mode - only return docs that match all slugs, by excluding additional slugs'\n ),\n },\n annotations: {\n readOnlyHint: true,\n },\n },\n async ({ slug, strict }) => {\n try {\n const doc = await getDocBySlug(slug ?? [], undefined, strict);\n return {\n content: doc.map((d) => ({ type: 'text', text: d })),\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n { type: 'text', text: `Get doc by slug failed: ${errorMessage}` },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'fetch-doc-chunks',\n {\n title: 'Fetch Doc Chunks',\n description:\n 'Fetch related doc chunks using keywords or questions. This tool will return the most relevant chunks of documentation based on the input query.',\n inputSchema: {\n query: z.string().describe('The keywords or question to search for'),\n limit: z\n .number()\n .optional()\n .describe('The number of chunks to retrieve (default: 10)'),\n },\n annotations: {\n readOnlyHint: true,\n },\n },\n async ({ query, limit }) => {\n try {\n const { searchDoc } = getSearchAPI();\n const response = await searchDoc({\n input: query,\n limit: limit?.toString(),\n returnContent: 'true',\n });\n\n if (!response.data || !Array.isArray(response.data)) {\n return {\n content: [{ type: 'text', text: 'No relevant chunks found.' }],\n };\n }\n\n const chunks = response.data;\n\n return {\n content: chunks.map((chunk: any) => ({\n type: 'text',\n text: [\n `File: ${chunk.fileKey}`,\n `Title: ${chunk.docName}`,\n `URL: ${chunk.docUrl}`,\n `Chunk: ${chunk.chunkNumber}`,\n `Content:`,\n chunk.content,\n ].join('\\n'),\n })),\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n { type: 'text', text: `Fetch doc chunks failed: ${errorMessage}` },\n ],\n };\n }\n }\n );\n};\n"],"mappings":"qKAaA,MAAa,EAA+B,KAAO,IAAW,CAC5D,IAAM,EAAW,GAAa,CAE9B,EAAO,aACL,eACA,CACE,MAAO,eACP,YACE,+FACF,YAAa,EAAE,CACf,YAAa,CACX,aAAc,GACf,CACF,CACD,SAAY,CACV,GAAI,CACF,IAAM,EAAqB,MAAM,GAAsB,CAEvD,MAAO,CACL,QAAS,CACP,CACE,KAAM,OACN,KAAM,KAAK,UAAU,EAAoB,KAAM,EAAE,CAClD,CACF,CACF,OACM,EAAO,CAGd,MAAO,CACL,QAAS,CACP,CAAE,KAAM,OAAQ,KAAM,wBAHxB,aAAiB,MAAQ,EAAM,QAAU,8BAGuB,CAC/D,CACF,GAGN,CAED,EAAO,aACL,UACA,CACE,MAAO,iBACP,YACE,kJACF,YAAa,CACX,OAAQ,EAAE,KAAK,EAAkC,CAClD,CACD,YAAa,CACX,aAAc,GACf,CACF,CACD,MAAO,CAAE,YAAa,CACpB,GAAI,CAEF,MAAO,CACL,QAAS,CAAC,CAAE,KAAM,OAAQ,KAFhB,MAAM,EAAO,EAAiB,CAEH,CAAC,CACvC,OACM,EAAO,CAGd,MAAO,CACL,QAAS,CAAC,CAAE,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AQ,EAAM,SACd,UAAU,EAAM,cAChB,WACA,EAAM,QACP,CAAC,KAAK;EAAK,CACb,EAAE,CACJ,OACM,EAAO,CAGd,MAAO,CACL,QAAS,CACP,CAAE,KAAM,OAAQ,KAAM,4BAHxB,aAAiB,MAAQ,EAAM,QAAU,8BAG2B,CACnE,CACF,GAGN"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
2
|
-
Available skills:`),
|
|
3
|
-
Which skills do you want to install? (comma separated numbers, e.g. 1,2,3 or "all"): `),c=[];if(c=s.trim().toLowerCase()===`all`?[...
|
|
1
|
+
import{a as e,c as t,m as n}from"../packages/@intlayer/chokidar/dist/esm/installSkills/index.mjs";import r from"zod";import*as i from"node:readline";const a=i=>{i.registerTool(`intlayer-install-skills`,{title:`Install Intlayer Skills`,description:`Install Intlayer documentation and skills to the project to assist AI agents. Ask the user for the platform (Cursor, VSCode, OpenCode, Claude, etc.) and which skills they want to install before calling this tool.`,inputSchema:{platform:r.enum(t).describe(`The platform to install skills for`),skills:r.array(r.enum(e)).describe(`List of skills to install`),projectRoot:r.string().optional().describe(`Root directory of the project. Defaults to current directory.`)}},async({platform:e,skills:t,projectRoot:r})=>{try{return{content:[{type:`text`,text:await n(r||process.cwd(),e,t)}]}}catch(e){return{content:[{type:`text`,text:`Failed to install skills: ${e instanceof Error?e.message:String(e)}`}],isError:!0}}})},o=async()=>{let r=i.createInterface({input:process.stdin,output:process.stdout}),a=e=>new Promise(t=>r.question(e,t));try{console.log(`Install Intlayer Skills`),console.log(`-----------------------`);let i=await a(`Which platform are you using? (Cursor, Windsurf, Trae, OpenCode, GitHub, Claude, VSCode, Cline, RooCode, etc. or "Other"): `),o=t.find(e=>e.toLowerCase()===i.trim().toLowerCase())||`Other`;console.log(`Selected platform: ${o}`),console.log(`
|
|
2
|
+
Available skills:`),e.forEach((e,t)=>{console.log(`${t+1}. ${e}`)});let s=await a(`
|
|
3
|
+
Which skills do you want to install? (comma separated numbers, e.g. 1,2,3 or "all"): `),c=[];if(c=s.trim().toLowerCase()===`all`?[...e]:s.split(`,`).map(e=>parseInt(e.trim(),10)-1).filter(t=>!Number.isNaN(t)&&t>=0&&t<e.length).map(t=>e[t]),c.length===0){console.log(`No valid skills selected. Exiting.`),r.close();return}console.log(`Installing skills: ${c.join(`, `)}...`);let l=await n(process.cwd(),o,c);console.log(l)}catch(e){console.error(`Error:`,e)}finally{r.close()}};export{a as loadInstallSkillsTool,o as runInstallSkillsCLI};
|
|
4
4
|
//# sourceMappingURL=installSkills.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installSkills.mjs","names":[],"sources":["../../../src/tools/installSkills.ts"],"sourcesContent":["import * as readline from 'node:readline';\nimport {
|
|
1
|
+
{"version":3,"file":"installSkills.mjs","names":["PLATFORMS","SKILLS","installSkills"],"sources":["../../../src/tools/installSkills.ts"],"sourcesContent":["import * as readline from 'node:readline';\nimport {\n installSkills,\n PLATFORMS,\n SKILLS,\n type Skill,\n} from '@intlayer/chokidar/cli';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport z from 'zod';\n\nexport const loadInstallSkillsTool = (server: McpServer): void => {\n server.registerTool(\n 'intlayer-install-skills',\n {\n title: 'Install Intlayer Skills',\n description:\n 'Install Intlayer documentation and skills to the project to assist AI agents. Ask the user for the platform (Cursor, VSCode, OpenCode, Claude, etc.) and which skills they want to install before calling this tool.',\n inputSchema: {\n platform: z\n .enum(PLATFORMS)\n .describe('The platform to install skills for'),\n skills: z.array(z.enum(SKILLS)).describe('List of skills to install'),\n projectRoot: z\n .string()\n .optional()\n .describe(\n 'Root directory of the project. Defaults to current directory.'\n ),\n },\n },\n\n async ({ platform, skills, projectRoot }) => {\n try {\n const root = projectRoot || process.cwd();\n const message = await installSkills(root, platform, skills);\n\n return {\n content: [\n {\n type: 'text',\n text: message,\n },\n ],\n };\n } catch (error) {\n return {\n content: [\n {\n type: 'text',\n text: `Failed to install skills: ${error instanceof Error ? error.message : String(error)}`,\n },\n ],\n isError: true,\n };\n }\n }\n );\n};\n\nexport const runInstallSkillsCLI = async (): Promise<void> => {\n const rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n });\n\n const question = (query: string): Promise<string> =>\n new Promise((resolve) => rl.question(query, resolve));\n\n try {\n console.log('Install Intlayer Skills');\n console.log('-----------------------');\n\n const platformInput = await question(\n 'Which platform are you using? (Cursor, Windsurf, Trae, OpenCode, GitHub, Claude, VSCode, Cline, RooCode, etc. or \"Other\"): '\n );\n\n // we only accept a single platform here, not an array like the main CLI\n const platform =\n PLATFORMS.find(\n (platform) =>\n platform.toLowerCase() === platformInput.trim().toLowerCase()\n ) || ('Other' as const);\n\n console.log(`Selected platform: ${platform}`);\n\n console.log('\\nAvailable skills:');\n\n SKILLS.forEach((skill, i) => {\n console.log(`${i + 1}. ${skill}`);\n });\n\n const skillsInput = await question(\n '\\nWhich skills do you want to install? (comma separated numbers, e.g. 1,2,3 or \"all\"): '\n );\n\n let selectedSkills: Skill[] = [];\n if (skillsInput.trim().toLowerCase() === 'all') {\n selectedSkills = [...SKILLS];\n } else {\n const indices = skillsInput\n .split(',')\n .map((skill) => parseInt(skill.trim(), 10) - 1)\n .filter(\n (skill) => !Number.isNaN(skill) && skill >= 0 && skill < SKILLS.length\n );\n selectedSkills = indices.map((i) => SKILLS[i] as any);\n }\n\n if (selectedSkills.length === 0) {\n console.log('No valid skills selected. Exiting.');\n rl.close();\n return;\n }\n\n console.log(`Installing skills: ${selectedSkills.join(', ')}...`);\n const result = await installSkills(process.cwd(), platform, selectedSkills);\n console.log(result);\n } catch (error) {\n console.error('Error:', error);\n } finally {\n rl.close();\n }\n};\n"],"mappings":"qJAUA,MAAa,EAAyB,GAA4B,CAChE,EAAO,aACL,0BACA,CACE,MAAO,0BACP,YACE,uNACF,YAAa,CACX,SAAU,EACP,KAAKA,EAAU,CACf,SAAS,qCAAqC,CACjD,OAAQ,EAAE,MAAM,EAAE,KAAKC,EAAO,CAAC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AAe,SAAW,EAAG,CAC/B,QAAQ,IAAI,qCAAqC,CACjD,EAAG,OAAO,CACV,OAGF,QAAQ,IAAI,sBAAsB,EAAe,KAAK,KAAK,CAAC,KAAK,CACjE,IAAM,EAAS,MAAMC,EAAc,QAAQ,KAAK,CAAE,EAAU,EAAe,CAC3E,QAAQ,IAAI,EAAO,OACZ,EAAO,CACd,QAAQ,MAAM,SAAU,EAAM,QACtB,CACR,EAAG,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installSkills.d.ts","names":[],"sources":["../../../src/tools/installSkills.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"installSkills.d.ts","names":[],"sources":["../../../src/tools/installSkills.ts"],"mappings":";;;cAUa,qBAAA,GAAyB,MAAA,EAAQ,SAAA;AAAA,cAiDjC,mBAAA,QAAgC,OAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/mcp",
|
|
3
|
-
"version": "8.3.0-canary.
|
|
3
|
+
"version": "8.3.0-canary.2",
|
|
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": [
|
|
@@ -35,17 +35,17 @@
|
|
|
35
35
|
"exports": {
|
|
36
36
|
".": {
|
|
37
37
|
"types": "./dist/types/server/stdio.d.ts",
|
|
38
|
-
"require": "./dist/
|
|
38
|
+
"require": "./dist/esm/server/stdio.mjs",
|
|
39
39
|
"import": "./dist/esm/server/stdio.mjs"
|
|
40
40
|
},
|
|
41
41
|
"./sse": {
|
|
42
42
|
"types": "./dist/types/server/sse.d.ts",
|
|
43
|
-
"require": "./dist/
|
|
43
|
+
"require": "./dist/esm/server/sse.mjs",
|
|
44
44
|
"import": "./dist/esm/server/sse.mjs"
|
|
45
45
|
},
|
|
46
46
|
"./package.json": "./package.json"
|
|
47
47
|
},
|
|
48
|
-
"main": "dist/
|
|
48
|
+
"main": "dist/esm/server/stdio.mjs",
|
|
49
49
|
"module": "dist/esm/server/stdio.mjs",
|
|
50
50
|
"types": "dist/types/server/stdio.d.ts",
|
|
51
51
|
"typesVersions": {
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
]
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
|
-
"bin": "dist/
|
|
64
|
+
"bin": "dist/esm/server/stdio.mjs",
|
|
65
65
|
"files": [
|
|
66
66
|
"./dist",
|
|
67
67
|
"./package.json"
|
|
@@ -75,46 +75,44 @@
|
|
|
75
75
|
"format:fix": "bun --bun biome format --write .",
|
|
76
76
|
"lint": "bun --bun biome lint .",
|
|
77
77
|
"lint:fix": "bun --bun biome lint --write .",
|
|
78
|
-
"manange:permissions": "bun
|
|
79
|
-
"manange:permissions:cjs": "node -e \"require('fs').chmodSync('dist/cjs/server/stdio.cjs', 0o755); require('fs').chmodSync('dist/cjs/server/sse.cjs', 0o755)\"",
|
|
80
|
-
"manange:permissions:mjs": "node -e \"require('fs').chmodSync('dist/esm/server/stdio.mjs', 0o755); require('fs').chmodSync('dist/esm/server/sse.mjs', 0o755)\"",
|
|
78
|
+
"manange:permissions": "bun -e \"require('fs').chmodSync('dist/esm/server/stdio.mjs', 0o755); require('fs').chmodSync('dist/esm/server/sse.mjs', 0o755)\"",
|
|
81
79
|
"process-files": "ts-node src/transpiler/processFilesCLI.ts --dir $npm_config_dir --extension $npm_config_extension --no-node-snapshot",
|
|
82
80
|
"prepublish": "cp -f ../../../README.md ./README.md",
|
|
83
81
|
"publish": "bun publish || true",
|
|
84
82
|
"publish:canary": "bun publish --access public --tag canary || true",
|
|
85
83
|
"publish:latest": "bun publish --access public --tag latest || true",
|
|
86
84
|
"start": "bun start:stdio",
|
|
87
|
-
"start:client": "
|
|
85
|
+
"start:client": "bun dist/esm/client/sse.mjs",
|
|
88
86
|
"start:docker": "docker run --rm -p 3000:3000 --name intlayer-mcp-app intlayer-mcp",
|
|
89
|
-
"start:inspector": "npx @modelcontextprotocol/inspector
|
|
90
|
-
"start:inspector:sse": "npx @modelcontextprotocol/inspector
|
|
91
|
-
"start:sse": "
|
|
92
|
-
"start:stdio": "
|
|
87
|
+
"start:inspector": "npx @modelcontextprotocol/inspector bun dist/esm/server/stdio.mjs",
|
|
88
|
+
"start:inspector:sse": "npx @modelcontextprotocol/inspector bun dist/esm/server/sse.mjs",
|
|
89
|
+
"start:sse": "bun dist/esm/server/sse.mjs",
|
|
90
|
+
"start:stdio": "bun dist/esm/server/stdio.mjs",
|
|
93
91
|
"test": "bun --bun vitest run",
|
|
94
92
|
"test:watch": "bun --bun vitest",
|
|
95
93
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
96
94
|
},
|
|
97
95
|
"dependencies": {
|
|
98
|
-
"@intlayer/api": "8.3.0-canary.
|
|
99
|
-
"@intlayer/cli": "8.3.0-canary.
|
|
100
|
-
"@intlayer/config": "8.3.0-canary.
|
|
101
|
-
"@intlayer/docs": "8.3.0-canary.
|
|
102
|
-
"@intlayer/types": "8.3.0-canary.
|
|
103
|
-
"@modelcontextprotocol/sdk": "1.
|
|
96
|
+
"@intlayer/api": "8.3.0-canary.2",
|
|
97
|
+
"@intlayer/cli": "8.3.0-canary.2",
|
|
98
|
+
"@intlayer/config": "8.3.0-canary.2",
|
|
99
|
+
"@intlayer/docs": "8.3.0-canary.2",
|
|
100
|
+
"@intlayer/types": "8.3.0-canary.2",
|
|
101
|
+
"@modelcontextprotocol/sdk": "1.27.1",
|
|
104
102
|
"dotenv": "17.3.1",
|
|
105
103
|
"express": "5.2.1",
|
|
106
104
|
"zod": "4.3.6"
|
|
107
105
|
},
|
|
108
106
|
"devDependencies": {
|
|
109
|
-
"@intlayer/types": "8.3.0-canary.
|
|
110
|
-
"@modelcontextprotocol/inspector": "0.
|
|
107
|
+
"@intlayer/types": "8.3.0-canary.2",
|
|
108
|
+
"@modelcontextprotocol/inspector": "0.21.1",
|
|
111
109
|
"@types/express": "5.0.6",
|
|
112
|
-
"@types/node": "25.
|
|
110
|
+
"@types/node": "25.4.0",
|
|
113
111
|
"@utils/ts-config": "1.0.4",
|
|
114
112
|
"@utils/ts-config-types": "1.0.4",
|
|
115
113
|
"@utils/tsdown-config": "1.0.4",
|
|
116
114
|
"rimraf": "6.1.3",
|
|
117
|
-
"tsdown": "0.21.
|
|
115
|
+
"tsdown": "0.21.2",
|
|
118
116
|
"typescript": "5.9.3",
|
|
119
117
|
"vitest": "4.0.18"
|
|
120
118
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));exports.__toESM=s;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);let e=require(`node:url`),t=require(`node:fs`),n=require(`node:path`),r=require(`@intlayer/config/utils`),i=require(`@modelcontextprotocol/sdk/client/index.js`);const a=r.isESModule?(0,n.dirname)((0,e.fileURLToPath)(require(`url`).pathToFileURL(__filename).href)):__dirname,o=JSON.parse((0,t.readFileSync)((0,n.resolve)(a,`../../../package.json`),`utf8`)),s=()=>new i.Client({name:`mcp-client-for-intlayer-mcp-server`,version:o.version});exports.dirname=a,exports.loadClient=s;
|
|
2
|
-
//# sourceMappingURL=client.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.cjs","names":["isESModule","Client"],"sources":["../../../src/client/client.ts"],"sourcesContent":["import { readFileSync } from 'node:fs';\nimport { dirname as pathDirname, resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { isESModule } from '@intlayer/config/utils';\nimport { Client } from '@modelcontextprotocol/sdk/client/index.js';\n\nexport const dirname: string = isESModule\n ? pathDirname(fileURLToPath(import.meta.url))\n : __dirname;\n\nconst packageJson: Record<string, any> = JSON.parse(\n readFileSync(resolve(dirname, '../../../package.json'), 'utf8')\n);\n\ntype LoadClient = () => Client;\n\nexport const loadClient: LoadClient = () =>\n new Client({\n name: `mcp-client-for-intlayer-mcp-server`,\n version: packageJson.version,\n });\n"],"mappings":"iRAMA,MAAa,EAAkBA,EAAAA,YAAAA,EAAAA,EAAAA,UAAAA,EAAAA,EAAAA,eAAAA,QAAAA,MAAAA,CAAAA,cAAAA,WAAAA,CAAAA,KACe,CAAC,CAC3C,UAEE,EAAmC,KAAK,OAAA,EAAA,EAAA,eAAA,EAAA,EAAA,SACvB,EAAS,wBAAwB,CAAE,OAAO,CAChE,CAIY,MACX,IAAIC,EAAAA,OAAO,CACT,KAAM,qCACN,QAAS,EAAY,QACtB,CAAC"}
|
package/dist/cjs/client/sse.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./client.cjs`);let t=require(`node:url`),n=require(`@modelcontextprotocol/sdk/client/sse.js`);var r=class{client;transport=null;isCompleted=!1;constructor(){this.client=e.loadClient()}async connectToServer(){let e=process.env.MCP_SERVER_URL??`https://mcp.intlayer.org`,r=new t.URL(e);try{console.info(`Connecting to server - ${e}`),this.transport=new n.SSEClientTransport(r),await this.client.connect(this.transport),console.info(`Connected to MCP server`),this.setUpTransport()}catch(e){throw console.info(`Failed to connect to MCP server: `,e),e}}setUpTransport(){this.transport!==null&&(this.transport.onclose=()=>{console.info(`SSE transport closed.`),this.isCompleted=!0},this.transport.onerror=async e=>{console.info(`SSE transport error: `,e),await this.cleanup()},this.transport.onmessage=e=>{console.info(`message received: `,e)})}async waitForCompletion(){for(;!this.isCompleted;)await new Promise(e=>setTimeout(e,100))}async cleanup(){await this.client.close()}};(async()=>{let e=new r;try{await e.connectToServer(),await e.waitForCompletion()}finally{await e.cleanup()}})();
|
|
2
|
-
//# sourceMappingURL=sse.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sse.cjs","names":["loadClient","URL","SSEClientTransport"],"sources":["../../../src/client/sse.ts"],"sourcesContent":["import { URL } from 'node:url';\nimport type { Client } from '@modelcontextprotocol/sdk/client/index.js';\nimport { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js';\nimport type { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';\nimport { loadClient } from './client';\n\nclass SSEClient {\n private client: Client;\n private transport: Transport | null = null;\n private isCompleted = false;\n\n constructor() {\n this.client = loadClient();\n }\n\n async connectToServer() {\n const mcpServerURL =\n process.env.MCP_SERVER_URL ?? 'https://mcp.intlayer.org';\n\n const url = new URL(mcpServerURL);\n try {\n console.info(`Connecting to server - ${mcpServerURL}`);\n this.transport = new SSEClientTransport(url);\n await this.client.connect(this.transport);\n console.info('Connected to MCP server');\n\n this.setUpTransport();\n } catch (e) {\n console.info('Failed to connect to MCP server: ', e);\n throw e;\n }\n }\n\n private setUpTransport() {\n if (this.transport === null) {\n return;\n }\n this.transport.onclose = () => {\n console.info('SSE transport closed.');\n this.isCompleted = true;\n };\n\n this.transport.onerror = async (error) => {\n console.info('SSE transport error: ', error);\n await this.cleanup();\n };\n\n this.transport.onmessage = (message) => {\n console.info('message received: ', message);\n };\n }\n\n async waitForCompletion() {\n while (!this.isCompleted) {\n await new Promise((resolve) => setTimeout(resolve, 100));\n }\n }\n\n async cleanup() {\n await this.client.close();\n }\n}\n\nconst main = async () => {\n const client = new SSEClient();\n\n try {\n await client.connectToServer();\n await client.waitForCompletion();\n } finally {\n await client.cleanup();\n }\n};\n\nmain();\n"],"mappings":"4JAMA,IAAM,EAAN,KAAgB,CACd,OACA,UAAsC,KACtC,YAAsB,GAEtB,aAAc,CACZ,KAAK,OAASA,EAAAA,YAAY,CAG5B,MAAM,iBAAkB,CACtB,IAAM,EACJ,QAAQ,IAAI,gBAAkB,2BAE1B,EAAM,IAAIC,EAAAA,IAAI,EAAa,CACjC,GAAI,CACF,QAAQ,KAAK,0BAA0B,IAAe,CACtD,KAAK,UAAY,IAAIC,EAAAA,mBAAmB,EAAI,CAC5C,MAAM,KAAK,OAAO,QAAQ,KAAK,UAAU,CACzC,QAAQ,KAAK,0BAA0B,CAEvC,KAAK,gBAAgB,OACd,EAAG,CAEV,MADA,QAAQ,KAAK,oCAAqC,EAAE,CAC9C,GAIV,gBAAyB,CACnB,KAAK,YAAc,OAGvB,KAAK,UAAU,YAAgB,CAC7B,QAAQ,KAAK,wBAAwB,CACrC,KAAK,YAAc,IAGrB,KAAK,UAAU,QAAU,KAAO,IAAU,CACxC,QAAQ,KAAK,wBAAyB,EAAM,CAC5C,MAAM,KAAK,SAAS,EAGtB,KAAK,UAAU,UAAa,GAAY,CACtC,QAAQ,KAAK,qBAAsB,EAAQ,GAI/C,MAAM,mBAAoB,CACxB,KAAO,CAAC,KAAK,aACX,MAAM,IAAI,QAAS,GAAY,WAAW,EAAS,IAAI,CAAC,CAI5D,MAAM,SAAU,CACd,MAAM,KAAK,OAAO,OAAO,IAIhB,SAAY,CACvB,IAAM,EAAS,IAAI,EAEnB,GAAI,CACF,MAAM,EAAO,iBAAiB,CAC9B,MAAM,EAAO,mBAAmB,QACxB,CACR,MAAM,EAAO,SAAS,KAIpB"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`../tools/cli.cjs`),t=require(`../tools/installSkills.cjs`),n=require(`../tools/docs.cjs`);let r=require(`node:url`),i=require(`node:fs`),a=require(`node:path`),o=require(`@intlayer/config/utils`),s=require(`@modelcontextprotocol/sdk/server/mcp.js`);const c=o.isESModule?(0,a.dirname)((0,r.fileURLToPath)(require(`url`).pathToFileURL(__filename).href)):__dirname,l=JSON.parse((0,i.readFileSync)((0,a.resolve)(c,`../../../package.json`),`utf8`)),u=({isLocal:r})=>{let i=new s.McpServer({name:`intlayer`,version:l.version});if(r)try{e.loadCLITools(i),t.loadInstallSkillsTool(i)}catch(e){console.error(`Error loading CLI tools:`,e)}try{n.loadDocsTools(i)}catch(e){console.error(`Error loading docs tools:`,e)}return i};exports.dirname=c,exports.loadServer=u;
|
|
2
|
-
//# sourceMappingURL=server.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.cjs","names":["isESModule","McpServer"],"sources":["../../../src/server/server.ts"],"sourcesContent":["import { readFileSync } from 'node:fs';\nimport { dirname as pathDirname, resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { isESModule } from '@intlayer/config/utils';\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { loadCLITools } from '../tools/cli';\nimport { loadDocsTools } from '../tools/docs';\nimport { loadInstallSkillsTool } from '../tools/installSkills';\n\nexport const dirname: string = isESModule\n ? pathDirname(fileURLToPath(import.meta.url))\n : __dirname;\n\nconst packageJson: Record<string, any> = JSON.parse(\n readFileSync(resolve(dirname, '../../../package.json'), 'utf8')\n);\n\ntype LoadServer = (options: { isLocal: boolean }) => McpServer;\n\nexport const loadServer: LoadServer = ({ isLocal }) => {\n const server = new McpServer({\n name: 'intlayer',\n version: packageJson.version,\n });\n\n if (isLocal) {\n try {\n loadCLITools(server);\n loadInstallSkillsTool(server);\n } catch (error) {\n console.error('Error loading CLI tools:', error);\n }\n }\n\n try {\n loadDocsTools(server);\n } catch (error) {\n console.error('Error loading docs tools:', error);\n }\n\n return server;\n};\n"],"mappings":"0XASA,MAAa,EAAkBA,EAAAA,YAAAA,EAAAA,EAAAA,UAAAA,EAAAA,EAAAA,eAAAA,QAAAA,MAAAA,CAAAA,cAAAA,WAAAA,CAAAA,KACe,CAAC,CAC3C,UAEE,EAAmC,KAAK,OAAA,EAAA,EAAA,eAAA,EAAA,EAAA,SACvB,EAAS,wBAAwB,CAAE,OAAO,CAChE,CAIY,GAA0B,CAAE,aAAc,CACrD,IAAM,EAAS,IAAIC,EAAAA,UAAU,CAC3B,KAAM,WACN,QAAS,EAAY,QACtB,CAAC,CAEF,GAAI,EACF,GAAI,CACF,EAAA,aAAa,EAAO,CACpB,EAAA,sBAAsB,EAAO,OACtB,EAAO,CACd,QAAQ,MAAM,2BAA4B,EAAM,CAIpD,GAAI,CACF,EAAA,cAAc,EAAO,OACd,EAAO,CACd,QAAQ,MAAM,4BAA6B,EAAM,CAGnD,OAAO"}
|
package/dist/cjs/server/sse.cjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`./server.cjs`);let n=require(`@modelcontextprotocol/sdk/server/streamableHttp.js`),r=require(`dotenv`);r=e.__toESM(r);let i=require(`express`);i=e.__toESM(i);const a=t.loadServer({isLocal:!1}),o=(0,i.default)(),s=o.get(`env`);r.default.config({path:[`.env.${s}.local`,`.env.${s}`,`.env.local`,`.env`],quiet:!0}),o.use((e,t,n)=>{if(t.header(`Access-Control-Allow-Origin`,`*`),t.header(`Access-Control-Allow-Methods`,`GET, POST, OPTIONS`),t.header(`Access-Control-Allow-Headers`,`Content-Type`),e.method===`OPTIONS`){t.sendStatus(200);return}n()}),o.use(i.default.json());const c=i.default.Router(),l=()=>Math.random().toString(36).slice(2),u={};c.all(`/`,async(e,t)=>{if(e.method===`GET`){let r=l(),i=new n.StreamableHTTPServerTransport({sessionIdGenerator:()=>r});u[r]=i,t.on(`close`,()=>{delete u[r]}),await a.connect(i),await i.handleRequest(e,t)}else if(e.method===`POST`){let n=e.query.sessionId;if(typeof n!=`string`){t.status(400).send({messages:`Bad session id.`});return}let r=u[n];if(!r){t.status(400).send({messages:`No transport found for sessionId.`});return}await r.handleRequest(e,t,e.body)}}),o.use(`/`,c),o.use(`/health`,(e,t)=>{t.send(`OK`)});const d=process.env.PORT??3e3;o.listen(d,()=>{console.info(`MCP Streamable HTTP Server listening on port ${d}`)});
|
|
3
|
-
//# sourceMappingURL=sse.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sse.cjs","names":["loadServer","StreamableHTTPServerTransport"],"sources":["../../../src/server/sse.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';\nimport dotenv from 'dotenv';\nimport express, { type Request, type Response } from 'express';\nimport { loadServer } from './server';\n\nconst server = loadServer({ isLocal: false });\nconst app = express();\nconst env = app.get('env');\n\ndotenv.config({\n path: [`.env.${env}.local`, `.env.${env}`, '.env.local', '.env'],\n quiet: true,\n});\n\napp.use((req, res, next) => {\n res.header('Access-Control-Allow-Origin', '*');\n res.header('Access-Control-Allow-Methods', 'GET, POST, OPTIONS');\n res.header('Access-Control-Allow-Headers', 'Content-Type');\n if (req.method === 'OPTIONS') {\n res.sendStatus(200);\n return;\n }\n next();\n});\n\napp.use(express.json());\nconst router = express.Router();\n\nconst sessionIdGenerator = () => Math.random().toString(36).slice(2);\nconst transports: { [sessionId: string]: StreamableHTTPServerTransport } = {};\n\nrouter.all('/', async (req: Request, res: Response) => {\n if (req.method === 'GET') {\n const sessionId = sessionIdGenerator();\n const transport = new StreamableHTTPServerTransport({\n sessionIdGenerator: () => sessionId,\n });\n transports[sessionId] = transport;\n res.on('close', () => {\n delete transports[sessionId];\n });\n await server.connect(transport);\n await transport.handleRequest(req, res);\n } else if (req.method === 'POST') {\n const sessionId = req.query.sessionId;\n if (typeof sessionId !== 'string') {\n res.status(400).send({ messages: 'Bad session id.' });\n return;\n }\n const transport = transports[sessionId];\n if (!transport) {\n res.status(400).send({ messages: 'No transport found for sessionId.' });\n return;\n }\n await transport.handleRequest(req, res, req.body);\n }\n});\n\napp.use('/', router);\napp.use('/health', (_req: Request, res: Response) => {\n res.send('OK');\n});\n\nconst PORT = process.env.PORT ?? 3000;\napp.listen(PORT, () => {\n console.info(`MCP Streamable HTTP Server listening on port ${PORT}`);\n});\n"],"mappings":";8NAOA,MAAM,EAASA,EAAAA,WAAW,CAAE,QAAS,GAAO,CAAC,CACvC,GAAA,EAAA,EAAA,UAAe,CACf,EAAM,EAAI,IAAI,MAAM,CAE1B,EAAA,QAAO,OAAO,CACZ,KAAM,CAAC,QAAQ,EAAI,QAAS,QAAQ,IAAO,aAAc,OAAO,CAChE,MAAO,GACR,CAAC,CAEF,EAAI,KAAK,EAAK,EAAK,IAAS,CAI1B,GAHA,EAAI,OAAO,8BAA+B,IAAI,CAC9C,EAAI,OAAO,+BAAgC,qBAAqB,CAChE,EAAI,OAAO,+BAAgC,eAAe,CACtD,EAAI,SAAW,UAAW,CAC5B,EAAI,WAAW,IAAI,CACnB,OAEF,GAAM,EACN,CAEF,EAAI,IAAI,EAAA,QAAQ,MAAM,CAAC,CACvB,MAAM,EAAS,EAAA,QAAQ,QAAQ,CAEzB,MAA2B,KAAK,QAAQ,CAAC,SAAS,GAAG,CAAC,MAAM,EAAE,CAC9D,EAAqE,EAAE,CAE7E,EAAO,IAAI,IAAK,MAAO,EAAc,IAAkB,CACrD,GAAI,EAAI,SAAW,MAAO,CACxB,IAAM,EAAY,GAAoB,CAChC,EAAY,IAAIC,EAAAA,8BAA8B,CAClD,uBAA0B,EAC3B,CAAC,CACF,EAAW,GAAa,EACxB,EAAI,GAAG,YAAe,CACpB,OAAO,EAAW,IAClB,CACF,MAAM,EAAO,QAAQ,EAAU,CAC/B,MAAM,EAAU,cAAc,EAAK,EAAI,SAC9B,EAAI,SAAW,OAAQ,CAChC,IAAM,EAAY,EAAI,MAAM,UAC5B,GAAI,OAAO,GAAc,SAAU,CACjC,EAAI,OAAO,IAAI,CAAC,KAAK,CAAE,SAAU,kBAAmB,CAAC,CACrD,OAEF,IAAM,EAAY,EAAW,GAC7B,GAAI,CAAC,EAAW,CACd,EAAI,OAAO,IAAI,CAAC,KAAK,CAAE,SAAU,oCAAqC,CAAC,CACvE,OAEF,MAAM,EAAU,cAAc,EAAK,EAAK,EAAI,KAAK,GAEnD,CAEF,EAAI,IAAI,IAAK,EAAO,CACpB,EAAI,IAAI,WAAY,EAAe,IAAkB,CACnD,EAAI,KAAK,KAAK,EACd,CAEF,MAAM,EAAO,QAAQ,IAAI,MAAQ,IACjC,EAAI,OAAO,MAAY,CACrB,QAAQ,KAAK,gDAAgD,IAAO,EACpE"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
require(`../_virtual/_rolldown/runtime.cjs`);const e=require(`./server.cjs`);let t=require(`@modelcontextprotocol/sdk/server/stdio.js`);const n=e.loadServer({isLocal:!0});(async()=>{let e=new t.StdioServerTransport;await n.connect(e),console.error(`Intlayer MCP Server running on stdio`)})().catch(e=>{console.error(`Fatal error in main():`,e),process.exit(1)});
|
|
3
|
-
//# sourceMappingURL=stdio.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.cjs","names":["loadServer","StdioServerTransport"],"sources":["../../../src/server/stdio.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport { loadServer } from './server';\n\nconst server = loadServer({ isLocal: true });\n\nconst main = async () => {\n const transport = new StdioServerTransport();\n await server.connect(transport);\n\n console.error('Intlayer MCP Server running on stdio');\n};\n\nmain().catch((error) => {\n console.error('Fatal error in main():', error);\n process.exit(1);\n});\n"],"mappings":";wIAKA,MAAM,EAASA,EAAAA,WAAW,CAAE,QAAS,GAAM,CAAC,EAE/B,SAAY,CACvB,IAAM,EAAY,IAAIC,EAAAA,qBACtB,MAAM,EAAO,QAAQ,EAAU,CAE/B,QAAQ,MAAM,uCAAuC,IAGjD,CAAC,MAAO,GAAU,CACtB,QAAQ,MAAM,yBAA0B,EAAM,CAC9C,QAAQ,KAAK,EAAE,EACf"}
|
package/dist/cjs/tools/cli.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`);let t=require(`node:path`),n=require(`@intlayer/cli`),r=require(`@intlayer/types/allLocales`),i=require(`zod/v3`);i=e.__toESM(i);const a=async e=>{e.registerTool(`intlayer-init`,{title:`Initialize Intlayer`,description:`Initialize Intlayer in the project`,inputSchema:{projectRoot:i.default.string().describe(`Project root directory`)},annotations:{destructiveHint:!0}},async({projectRoot:e})=>{try{return await(0,n.init)(e),{content:[{type:`text`,text:`Initialization successful.`}]}}catch(e){return{content:[{type:`text`,text:`Initialization failed: ${e instanceof Error?e.message:`An unknown error occurred`}`}]}}}),e.registerTool(`intlayer-build`,{title:`Build Dictionaries`,description:"Build the dictionaries. List all content declarations files `.content.{ts,tsx,js,json,...}` to update the content callable using the `useIntlayer` hook.",inputSchema:{watch:i.default.boolean().optional().describe(`Watch for changes`),baseDir:i.default.string().optional().describe(`Base directory`),env:i.default.string().optional().describe(`Environment`),envFile:i.default.string().optional().describe(`Environment file`),verbose:i.default.boolean().optional().describe(`Verbose output`),prefix:i.default.string().optional().describe(`Log prefix`)},annotations:{destructiveHint:!0}},async({watch:e,baseDir:t,env:r,envFile:i,verbose:a,prefix:o})=>{try{let s={};return a&&(s.mode=`verbose`),o&&(s.prefix=o),await(0,n.build)({watch:e,configOptions:{baseDir:t,env:r,envFile:i,override:{log:s}}}),{content:[{type:`text`,text:`Build successful.`}]}}catch(e){return{content:[{type:`text`,text:`Build failed: ${e instanceof Error?e.message:`An unknown error occurred`}`}]}}}),e.registerTool(`intlayer-fill`,{title:`Fill Translations`,description:`Fill the dictionaries with missing translations / review translations using Intlayer servers`,inputSchema:{sourceLocale:i.default.nativeEnum(r.ALL_LOCALES).optional().describe(`Source locale`),outputLocales:i.default.union([i.default.nativeEnum(r.ALL_LOCALES),i.default.array(i.default.nativeEnum(r.ALL_LOCALES))]).optional().describe(`Output locales`),file:i.default.union([i.default.string(),i.default.array(i.default.string())]).optional().describe(`File path`),mode:i.default.enum([`complete`,`review`]).optional().describe(`Fill mode`),keys:i.default.union([i.default.string(),i.default.array(i.default.string())]).optional().describe(`Keys to include`),excludedKeys:i.default.union([i.default.string(),i.default.array(i.default.string())]).optional().describe(`Keys to exclude`),pathFilter:i.default.union([i.default.string(),i.default.array(i.default.string())]).optional().describe(`Path filter`),gitOptions:i.default.object({gitDiff:i.default.boolean().optional(),gitDiffBase:i.default.string().optional(),gitDiffCurrent:i.default.string().optional(),uncommitted:i.default.boolean().optional(),unpushed:i.default.boolean().optional(),untracked:i.default.boolean().optional()}).optional().describe(`Git options`),aiOptions:i.default.object({provider:i.default.string().optional(),temperature:i.default.number().optional(),model:i.default.string().optional(),apiKey:i.default.string().optional(),customPrompt:i.default.string().optional(),applicationContext:i.default.string().optional()}).optional().describe(`AI options`)},annotations:{destructiveHint:!0}},async e=>{try{let{gitOptions:t,...r}=e,i={...r,gitOptions:void 0};if(t){let{gitDiff:e,uncommitted:n,unpushed:r,untracked:a,...o}=t,s=[];e&&s.push(`gitDiff`),n&&s.push(`uncommitted`),r&&s.push(`unpushed`),a&&s.push(`untracked`),i.gitOptions={...o,mode:s}}return await(0,n.fill)(i),{content:[{type:`text`,text:`Fill successful.`}]}}catch(e){return{content:[{type:`text`,text:`Fill failed: ${e instanceof Error?e.message:`An unknown error occurred`}`}]}}}),e.registerTool(`intlayer-push`,{title:`Push Dictionaries`,description:`Push local dictionaries to the server`,inputSchema:{deleteLocaleDictionary:i.default.boolean().optional().describe(`Delete local dictionary after push`),keepLocaleDictionary:i.default.boolean().optional().describe(`Keep local dictionary after push`),dictionaries:i.default.array(i.default.string()).optional().describe(`List of dictionaries to push`),gitOptions:i.default.object({gitDiff:i.default.boolean().optional(),gitDiffBase:i.default.string().optional(),gitDiffCurrent:i.default.string().optional(),uncommitted:i.default.boolean().optional(),unpushed:i.default.boolean().optional(),untracked:i.default.boolean().optional()}).optional().describe(`Git options`)},annotations:{destructiveHint:!0}},async e=>{try{let{gitOptions:t,...r}=e,i={...r,gitOptions:void 0};if(t){let{gitDiff:e,uncommitted:n,unpushed:r,untracked:a,...o}=t,s=[];e&&s.push(`gitDiff`),n&&s.push(`uncommitted`),r&&s.push(`unpushed`),a&&s.push(`untracked`),i.gitOptions={...o,mode:s}}return await(0,n.push)(i),{content:[{type:`text`,text:`Push successful.`}]}}catch(e){return{content:[{type:`text`,text:`Push failed: ${e instanceof Error?e.message:`An unknown error occurred`}`}]}}}),e.registerTool(`intlayer-pull`,{title:`Pull Dictionaries`,description:`Pull dictionaries from the CMS`,inputSchema:{dictionaries:i.default.array(i.default.string()).optional().describe(`List of dictionaries to pull`),newDictionariesPath:i.default.string().optional().describe(`Path to save new dictionaries`)},annotations:{destructiveHint:!0}},async e=>{try{return await(0,n.pull)(e),{content:[{type:`text`,text:`Pull successful.`}]}}catch(e){return{content:[{type:`text`,text:`Pull failed: ${e instanceof Error?e.message:`An unknown error occurred`}`}]}}}),e.registerTool(`intlayer-content-list`,{title:`List Content Declarations`,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.`,inputSchema:{configOptions:i.default.object({baseDir:i.default.string().optional(),env:i.default.string().optional(),envFile:i.default.string().optional(),override:i.default.object({log:i.default.object({prefix:i.default.string().optional(),verbose:i.default.boolean().optional()}).optional()}).optional()}).optional().describe(`Configuration options`),absolute:i.default.boolean().optional().describe(`Output the results as absolute paths instead of relative paths`),json:i.default.boolean().optional().describe(`Output the results as JSON instead of formatted text`)},annotations:{readOnlyHint:!0}},async e=>{try{let t=(0,n.listContentDeclarationRows)(e);return{content:[{type:`text`,text:e.json?JSON.stringify(t):JSON.stringify(t,null,2)}]}}catch(e){return{content:[{type:`text`,text:`Content list failed: ${e instanceof Error?e.message:`An unknown error occurred`}`}]}}}),e.registerTool(`intlayer-content-test`,{title:`Test Translations`,description:`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.`,inputSchema:{configOptions:i.default.object({baseDir:i.default.string().optional(),env:i.default.string().optional(),envFile:i.default.string().optional(),override:i.default.object({log:i.default.object({prefix:i.default.string().optional(),verbose:i.default.boolean().optional()}).optional()}).optional()}).optional().describe(`Configuration options`)},annotations:{readOnlyHint:!0}},async e=>{try{let t=(0,n.listMissingTranslations)(e?.configOptions);return{content:[{type:`text`,text:JSON.stringify(t,null,2)}]}}catch(e){return{content:[{type:`text`,text:`Content test failed: ${e instanceof Error?e.message:`An unknown error occurred`}`}]}}}),e.registerTool(`intlayer-extract`,{title:`Extract strings from Component`,description:`Extract strings from an existing component to be placed in a .content file close to the component. Trigger this action to make an existing component multilingual. If the component does not exist, create a normal component including text in JSX, and then trigger this tool to extract it.`,inputSchema:{file:i.default.union([i.default.string(),i.default.array(i.default.string())]).optional().describe(`List of files to extract`),outputContentDeclarations:i.default.string().optional().describe(`Path to output content declaration files`),configOptions:i.default.object({baseDir:i.default.string().optional(),env:i.default.string().optional(),envFile:i.default.string().optional(),override:i.default.object({log:i.default.object({prefix:i.default.string().optional(),verbose:i.default.boolean().optional()}).optional()}).optional()}).optional().describe(`Configuration options`)},annotations:{destructiveHint:!0}},async e=>{try{return await(0,n.extract)({files:Array.isArray(e.file)?e.file:e.file?[e.file]:void 0,outputContentDeclarations:e.outputContentDeclarations,configOptions:e.configOptions}),{content:[{type:`text`,text:`Extract successful.`}]}}catch(e){return{content:[{type:`text`,text:`Extract failed: ${e instanceof Error?e.message:`An unknown error occurred`}`}]}}}),e.registerTool(`intlayer-projects-list`,{title:`List Projects`,description:`List all Intlayer projects in the directory. Search for configuration files to find all Intlayer projects.`,inputSchema:{baseDir:i.default.string().optional().describe(`Base directory to search from`),gitRoot:i.default.boolean().optional().describe(`Search from the git root directory instead of the base directory`),absolute:i.default.boolean().optional().describe(`Output the results as absolute paths instead of relative paths`),json:i.default.boolean().optional().describe(`Output the results as JSON instead of formatted text`)},annotations:{readOnlyHint:!0}},async e=>{try{let{searchDir:r,projectsPath:i}=await(0,n.listProjects)({baseDir:e.baseDir,gitRoot:e.gitRoot}),a=i.map(n=>e.absolute?n:(0,t.relative)(r,n)).map(e=>e===``?`.`:e),o=e.absolute?i:a;return{content:[{type:`text`,text:e.json?JSON.stringify(o):JSON.stringify({searchDir:r,projectsPath:o},null,2)}]}}catch(e){return{content:[{type:`text`,text:`Projects list failed: ${e instanceof Error?e.message:`An unknown error occurred`}`}]}}})};exports.loadCLITools=a;
|
|
2
|
-
//# sourceMappingURL=cli.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli.cjs","names":["z","ALL_LOCALES"],"sources":["../../../src/tools/cli.ts"],"sourcesContent":["import { relative } from 'node:path';\nimport {\n build,\n extract,\n fill,\n init,\n listContentDeclarationRows,\n listMissingTranslations,\n listProjects,\n pull,\n push,\n} from '@intlayer/cli';\nimport { ALL_LOCALES } from '@intlayer/types/allLocales';\nimport type { LogConfig } from '@intlayer/types/config';;\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(ALL_LOCALES)\n .optional()\n .describe('Source locale'),\n outputLocales: z\n .union([\n z.nativeEnum(ALL_LOCALES),\n z.array(z.nativeEnum(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-extract',\n {\n title: 'Extract strings from Component',\n description:\n 'Extract strings from an existing component to be placed in a .content file close to the component. Trigger this action to make an existing component multilingual. If the component does not exist, create a normal component including text in JSX, and then trigger this tool to extract it.',\n inputSchema: {\n file: z\n .union([z.string(), z.array(z.string())])\n .optional()\n .describe('List of files to extract'),\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 extract({\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: 'Extract 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: `Extract 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":"yPAmBA,MAAa,EAA6B,KAAO,IAAW,CAC1D,EAAO,aACL,gBACA,CACE,MAAO,sBACP,YAAa,qCACb,YAAa,CACX,YAAaA,EAAAA,QAAE,QAAQ,CAAC,SAAS,yBAAyB,CAC3D,CACD,YAAa,CACX,gBAAiB,GAClB,CACF,CACD,MAAO,CAAE,iBAAkB,CACzB,GAAI,CAGF,OAFA,MAAA,EAAA,EAAA,MAAW,EAAY,CAEhB,CACL,QAAS,CACP,CACE,KAAM,OACN,KAAM,6BACP,CACF,CACF,OACM,EAAO,CAGd,MAAO,CACL,QAAS,CACP,CACE,KAAM,OACN,KAAM,0BALV,aAAiB,MAAQ,EAAM,QAAU,8BAMtC,CACF,CACF,GAGN,CAED,EAAO,aACL,iBACA,CACE,MAAO,qBACP,YACE,2JACF,YAAa,CACX,MAAOA,EAAAA,QAAE,SAAS,CAAC,UAAU,CAAC,SAAS,oBAAoB,CAC3D,QAASA,EAAAA,QAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,iBAAiB,CACzD,IAAKA,EAAAA,QAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,cAAc,CAClD,QAASA,EAAAA,QAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,mBAAmB,CAC3D,QAASA,EAAAA,QAAE,SAAS,CAAC,UAAU,CAAC,SAAS,iBAAiB,CAC1D,OAAQA,EAAAA,QAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,aAAa,CACrD,CACD,YAAa,CACX,gBAAiB,GAClB,CACF,CACD,MAAO,CAAE,QAAO,UAAS,MAAK,UAAS,UAAS,YAAa,CAC3D,GAAI,CACF,IAAM,EAA0B,EAAE,CAoBlC,OAnBI,IACF,EAAI,KAAO,WAET,IACF,EAAI,OAAS,GAGf,MAAA,EAAA,EAAA,OAAY,CACV,QACA,cAAe,CACb,UACA,MACA,UACA,SAAU,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SAAS,uDAAuD,CACpE,CACD,YAAa,CACX,aAAc,GACf,CACF,CACD,KAAO,IAAU,CACf,GAAI,CACF,GAAM,CAAE,YAAW,gBAAiB,MAAA,EAAA,EAAA,cAAmB,CACrD,QAAS,EAAM,QACf,QAAS,EAAM,QAChB,CAAC,CAGI,EAAuB,EAC1B,IAAK,GACJ,EAAM,SAAW,GAAA,EAAA,EAAA,UAAuB,EAAW,EAAY,CAChE,CACA,IAAK,GAAiB,IAAgB,GAAK,IAAM,EAAa,CAE3D,EAAc,EAAM,SACtB,EACA,EAEJ,MAAO,CACL,QAAS,CACP,CACE,KAAM,OACN,KAAM,EAAM,KACR,KAAK,UAAU,EAAY,CAC3B,KAAK,UACH,CAAE,YAAW,aAAc,EAAa,CACxC,KACA,EACD,CACN,CACF,CACF,OACM,EAAO,CAGd,MAAO,CACL,QAAS,CACP,CACE,KAAM,OACN,KAAM,yBALV,aAAiB,MAAQ,EAAM,QAAU,8BAMtC,CACF,CACF,GAGN"}
|
package/dist/cjs/tools/docs.cjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`);let t=require(`zod/v3`);t=e.__toESM(t);let n=require(`@intlayer/api`),r=require(`@intlayer/docs`);const i=async e=>{let i=(0,r.getDocsKeys)();e.registerTool(`get-doc-list`,{title:`Get Doc List`,description:`Get the list of docs names and their metadata to get more details about what doc to retrieve`,inputSchema:{},annotations:{readOnlyHint:!0}},async()=>{try{let e=await(0,r.getDocMetadataRecord)();return{content:[{type:`text`,text:JSON.stringify(e,null,2)}]}}catch(e){return{content:[{type:`text`,text:`Get doc list failed: ${e instanceof Error?e.message:`An unknown error occurred`}`}]}}}),e.registerTool(`get-doc`,{title:`Get Doc by Key`,description:"Get a doc by his key. Example: `./docs/en/getting-started.md`. List all docs metadata first to get more details about what doc key to retrieve.",inputSchema:{docKey:t.default.enum(i)},annotations:{readOnlyHint:!0}},async({docKey:e})=>{try{return{content:[{type:`text`,text:await(0,r.getDoc)(e)}]}}catch(e){return{content:[{type:`text`,text:`Get doc failed: ${e instanceof Error?e.message:`An unknown error occurred`}`}]}}}),e.registerTool(`get-doc-by-slug`,{title:`Get Doc by Slug`,description:`Get an array of docs by their slugs. If not slug is provided, return all docs (1.2Mb). List all docs metadata first to get more details about what doc to retrieve.`,inputSchema:{slug:t.default.union([t.default.string(),t.default.array(t.default.string())]).optional().describe(`Slug of the docs. If not provided, return all docs. If not provided, return all docs.`),strict:t.default.boolean().optional().describe(`Strict mode - only return docs that match all slugs, by excluding additional slugs`)},annotations:{readOnlyHint:!0}},async({slug:e,strict:t})=>{try{return{content:(await(0,r.getDocBySlug)(e??[],void 0,t)).map(e=>({type:`text`,text:e}))}}catch(e){return{content:[{type:`text`,text:`Get doc by slug failed: ${e instanceof Error?e.message:`An unknown error occurred`}`}]}}}),e.registerTool(`fetch-doc-chunks`,{title:`Fetch Doc Chunks`,description:`Fetch related doc chunks using keywords or questions. This tool will return the most relevant chunks of documentation based on the input query.`,inputSchema:{query:t.default.string().describe(`The keywords or question to search for`),limit:t.default.number().optional().describe(`The number of chunks to retrieve (default: 10)`)},annotations:{readOnlyHint:!0}},async({query:e,limit:t})=>{try{let{searchDoc:r}=(0,n.getSearchAPI)(),i=await r({input:e,limit:t?.toString(),returnContent:`true`});return!i.data||!Array.isArray(i.data)?{content:[{type:`text`,text:`No relevant chunks found.`}]}:{content:i.data.map(e=>({type:`text`,text:[`File: ${e.fileKey}`,`Title: ${e.docName}`,`URL: ${e.docUrl}`,`Chunk: ${e.chunkNumber}`,`Content:`,e.content].join(`
|
|
2
|
-
`)}))}}catch(e){return{content:[{type:`text`,text:`Fetch doc chunks failed: ${e instanceof Error?e.message:`An unknown error occurred`}`}]}}})};exports.loadDocsTools=i;
|
|
3
|
-
//# sourceMappingURL=docs.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"docs.cjs","names":["z"],"sources":["../../../src/tools/docs.ts"],"sourcesContent":["import { getSearchAPI } from '@intlayer/api';\nimport type { DocKey } from '@intlayer/docs';\nimport {\n getDoc,\n getDocBySlug,\n getDocMetadataRecord,\n getDocsKeys,\n} from '@intlayer/docs';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport z from 'zod/v3';\n\ntype LoadDocsTools = (server: McpServer) => Promise<void>;\n\nexport const loadDocsTools: LoadDocsTools = async (server) => {\n const docsKeys = getDocsKeys();\n\n server.registerTool(\n 'get-doc-list',\n {\n title: 'Get Doc List',\n description:\n 'Get the list of docs names and their metadata to get more details about what doc to retrieve',\n inputSchema: {},\n annotations: {\n readOnlyHint: true,\n },\n },\n async () => {\n try {\n const docsMetadataRecord = await getDocMetadataRecord();\n\n return {\n content: [\n {\n type: 'text',\n text: JSON.stringify(docsMetadataRecord, 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 { type: 'text', text: `Get doc list failed: ${errorMessage}` },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'get-doc',\n {\n title: 'Get Doc by Key',\n description:\n 'Get a doc by his key. Example: `./docs/en/getting-started.md`. List all docs metadata first to get more details about what doc key to retrieve.',\n inputSchema: {\n docKey: z.enum(docsKeys as [string, ...string[]]),\n },\n annotations: {\n readOnlyHint: true,\n },\n },\n async ({ docKey }) => {\n try {\n const doc = await getDoc(docKey as DocKey);\n return {\n content: [{ type: 'text', text: doc }],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [{ type: 'text', text: `Get doc failed: ${errorMessage}` }],\n };\n }\n }\n );\n\n server.registerTool(\n 'get-doc-by-slug',\n {\n title: 'Get Doc by Slug',\n description:\n 'Get an array of docs by their slugs. If not slug is provided, return all docs (1.2Mb). List all docs metadata first to get more details about what doc to retrieve.',\n inputSchema: {\n slug: z\n .union([z.string(), z.array(z.string())])\n .optional()\n .describe(\n 'Slug of the docs. If not provided, return all docs. If not provided, return all docs.'\n ),\n strict: z\n .boolean()\n .optional()\n .describe(\n 'Strict mode - only return docs that match all slugs, by excluding additional slugs'\n ),\n },\n annotations: {\n readOnlyHint: true,\n },\n },\n async ({ slug, strict }) => {\n try {\n const doc = await getDocBySlug(slug ?? [], undefined, strict);\n return {\n content: doc.map((d) => ({ type: 'text', text: d })),\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n { type: 'text', text: `Get doc by slug failed: ${errorMessage}` },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'fetch-doc-chunks',\n {\n title: 'Fetch Doc Chunks',\n description:\n 'Fetch related doc chunks using keywords or questions. This tool will return the most relevant chunks of documentation based on the input query.',\n inputSchema: {\n query: z.string().describe('The keywords or question to search for'),\n limit: z\n .number()\n .optional()\n .describe('The number of chunks to retrieve (default: 10)'),\n },\n annotations: {\n readOnlyHint: true,\n },\n },\n async ({ query, limit }) => {\n try {\n const { searchDoc } = getSearchAPI();\n const response = await searchDoc({\n input: query,\n limit: limit?.toString(),\n returnContent: 'true',\n });\n\n if (!response.data || !Array.isArray(response.data)) {\n return {\n content: [{ type: 'text', text: 'No relevant chunks found.' }],\n };\n }\n\n const chunks = response.data;\n\n return {\n content: chunks.map((chunk: any) => ({\n type: 'text',\n text: [\n `File: ${chunk.fileKey}`,\n `Title: ${chunk.docName}`,\n `URL: ${chunk.docUrl}`,\n `Chunk: ${chunk.chunkNumber}`,\n `Content:`,\n chunk.content,\n ].join('\\n'),\n })),\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n { type: 'text', text: `Fetch doc chunks failed: ${errorMessage}` },\n ],\n };\n }\n }\n );\n};\n"],"mappings":"0NAaA,MAAa,EAA+B,KAAO,IAAW,CAC5D,IAAM,GAAA,EAAA,EAAA,cAAwB,CAE9B,EAAO,aACL,eACA,CACE,MAA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rD,OACM,EAAO,CAGd,MAAO,CACL,QAAS,CACP,CAAE,KAAM,OAAQ,KAAM,2BAHxB,aAAiB,MAAQ,EAAM,QAAU,8BAG0B,CAClE,CACF,GAGN,CAED,EAAO,aACL,mBACA,CACE,MAAO,mBACP,YACE,kJACF,YAAa,CACX,MAAOA,EAAAA,QAAE,QAAQ,CAAC,SAAS,yCAAyC,CACpE,MAAOA,EAAAA,QACJ,QAAQ,CACR,UAAU,CACV,SAAS,iDAAiD,CAC9D,CACD,YAAa,CACX,aAAc,GACf,CACF,CACD,MAAO,CAAE,QAAO,WAAY,CAC1B,GAAI,CACF,GAAM,CAAE,cAAA,EAAA,EAAA,eAA4B,CAC9B,EAAW,MAAM,EAAU,CAC/B,MAAO,EACP,MAAO,GAAO,UAAU,CACxB,cAAe,OAChB,CAAC,CAUF,MARI,CAAC,EAAS,MAAQ,CAAC,MAAM,QAAQ,EAAS,KAAK,CAC1C,CACL,QAAS,CAAC,CAAE,KAAM,OAAQ,KAAM,4BAA6B,CAAC,CAC/D,CAKI,CACL,QAHa,EAAS,KAGN,IAAK,IAAgB,CACnC,KAAM,OACN,KAAM,CACJ,SAAS,EAAM,UACf,UAAU,EAAM,UAChB,QAAQ,EAAM,SACd,UAAU,EAAM,cAChB,WACA,EAAM,QACP,CAAC,KAAK;EAAK,CACb,EAAE,CACJ,OACM,EAAO,CAGd,MAAO,CACL,QAAS,CACP,CAAE,KAAM,OAAQ,KAAM,4BAHxB,aAAiB,MAAQ,EAAM,QAAU,8BAG2B,CACnE,CACF,GAGN"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`);let t=require(`@intlayer/cli`),n=require(`node:readline`);n=e.__toESM(n);let r=require(`zod`);r=e.__toESM(r);const i=e=>{e.registerTool(`intlayer-install-skills`,{title:`Install Intlayer Skills`,description:`Install Intlayer documentation and skills to the project to assist AI agents. Ask the user for the platform (Cursor, VSCode, OpenCode, Claude, etc.) and which skills they want to install before calling this tool.`,inputSchema:{platform:r.default.enum(t.PLATFORMS).describe(`The platform to install skills for`),skills:r.default.array(r.default.enum(t.SKILLS)).describe(`List of skills to install`),projectRoot:r.default.string().optional().describe(`Root directory of the project. Defaults to current directory.`)}},async({platform:e,skills:n,projectRoot:r})=>{try{return{content:[{type:`text`,text:await(0,t.installSkills)(r||process.cwd(),e,n)}]}}catch(e){return{content:[{type:`text`,text:`Failed to install skills: ${e instanceof Error?e.message:String(e)}`}],isError:!0}}})},a=async()=>{let e=n.createInterface({input:process.stdin,output:process.stdout}),r=t=>new Promise(n=>e.question(t,n));try{console.log(`Install Intlayer Skills`),console.log(`-----------------------`);let n=await r(`Which platform are you using? (Cursor, Windsurf, Trae, OpenCode, GitHub, Claude, VSCode, Cline, RooCode, etc. or "Other"): `),i=t.PLATFORMS.find(e=>e.toLowerCase()===n.trim().toLowerCase())||`Other`;console.log(`Selected platform: ${i}`),console.log(`
|
|
2
|
-
Available skills:`),t.SKILLS.forEach((e,t)=>{console.log(`${t+1}. ${e}`)});let a=await r(`
|
|
3
|
-
Which skills do you want to install? (comma separated numbers, e.g. 1,2,3 or "all"): `),o=[];if(o=a.trim().toLowerCase()===`all`?[...t.SKILLS]:a.split(`,`).map(e=>parseInt(e.trim(),10)-1).filter(e=>!Number.isNaN(e)&&e>=0&&e<t.SKILLS.length).map(e=>t.SKILLS[e]),o.length===0){console.log(`No valid skills selected. Exiting.`),e.close();return}console.log(`Installing skills: ${o.join(`, `)}...`);let s=await(0,t.installSkills)(process.cwd(),i,o);console.log(s)}catch(e){console.error(`Error:`,e)}finally{e.close()}};exports.loadInstallSkillsTool=i,exports.runInstallSkillsCLI=a;
|
|
4
|
-
//# sourceMappingURL=installSkills.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"installSkills.cjs","names":["z","PLATFORMS","SKILLS","readline"],"sources":["../../../src/tools/installSkills.ts"],"sourcesContent":["import * as readline from 'node:readline';\nimport { installSkills, PLATFORMS, SKILLS, type Skill } from '@intlayer/cli';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport z from 'zod';\n\nexport const loadInstallSkillsTool = (server: McpServer): void => {\n server.registerTool(\n 'intlayer-install-skills',\n {\n title: 'Install Intlayer Skills',\n description:\n 'Install Intlayer documentation and skills to the project to assist AI agents. Ask the user for the platform (Cursor, VSCode, OpenCode, Claude, etc.) and which skills they want to install before calling this tool.',\n inputSchema: {\n platform: z\n .enum(PLATFORMS)\n .describe('The platform to install skills for'),\n skills: z.array(z.enum(SKILLS)).describe('List of skills to install'),\n projectRoot: z\n .string()\n .optional()\n .describe(\n 'Root directory of the project. Defaults to current directory.'\n ),\n },\n },\n\n async ({ platform, skills, projectRoot }) => {\n try {\n const root = projectRoot || process.cwd();\n const message = await installSkills(\n root,\n platform as any,\n skills as any\n );\n\n return {\n content: [\n {\n type: 'text',\n text: message,\n },\n ],\n };\n } catch (error) {\n return {\n content: [\n {\n type: 'text',\n text: `Failed to install skills: ${error instanceof Error ? error.message : String(error)}`,\n },\n ],\n isError: true,\n };\n }\n }\n );\n};\n\nexport const runInstallSkillsCLI = async (): Promise<void> => {\n const rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n });\n\n const question = (query: string): Promise<string> =>\n new Promise((resolve) => rl.question(query, resolve));\n\n try {\n console.log('Install Intlayer Skills');\n console.log('-----------------------');\n\n const platformInput = await question(\n 'Which platform are you using? (Cursor, Windsurf, Trae, OpenCode, GitHub, Claude, VSCode, Cline, RooCode, etc. or \"Other\"): '\n );\n\n // we only accept a single platform here, not an array like the main CLI\n const platform =\n PLATFORMS.find(\n (platform) =>\n platform.toLowerCase() === platformInput.trim().toLowerCase()\n ) || ('Other' as const);\n\n console.log(`Selected platform: ${platform}`);\n\n console.log('\\nAvailable skills:');\n\n SKILLS.forEach((skill, i) => {\n console.log(`${i + 1}. ${skill}`);\n });\n\n const skillsInput = await question(\n '\\nWhich skills do you want to install? (comma separated numbers, e.g. 1,2,3 or \"all\"): '\n );\n\n let selectedSkills: Skill[] = [];\n if (skillsInput.trim().toLowerCase() === 'all') {\n selectedSkills = [...SKILLS];\n } else {\n const indices = skillsInput\n .split(',')\n .map((skill) => parseInt(skill.trim(), 10) - 1)\n .filter(\n (skill) => !Number.isNaN(skill) && skill >= 0 && skill < SKILLS.length\n );\n selectedSkills = indices.map((i) => SKILLS[i] as any);\n }\n\n if (selectedSkills.length === 0) {\n console.log('No valid skills selected. Exiting.');\n rl.close();\n return;\n }\n\n console.log(`Installing skills: ${selectedSkills.join(', ')}...`);\n const result = await installSkills(process.cwd(), platform, selectedSkills);\n console.log(result);\n } catch (error) {\n console.error('Error:', error);\n } finally {\n rl.close();\n }\n};\n"],"mappings":"qOAKA,MAAa,EAAyB,GAA4B,CAChE,EAAO,aACL,0BACA,CACE,MAAO,0BACP,YACE,uNACF,YAAa,CACX,SAAUA,EAAAA,QACP,KAAKC,EAAAA,UAAU,CACf,SAAS,qCAAqC,CACjD,OAAQD,EAAAA,QAAE,MAAMA,EAAAA,QAAE,KAAKE,EAAAA,OAAO,CAAC,CAAC,SAAS,4BAA4B,CACrE,YAAaF,EAAAA,QACV,QAAQ,CACR,UAAU,CACV,SACC,gEACD,CACJ,CACF,CAED,MAAO,CAAE,WAAU,SAAQ,iBAAkB,CAC3C,GAAI,CAQF,MAAO,CACL,QAAS,CACP,CACE,KAAM,OACN,KAVU,MAAA,EAAA,EAAA,eADH,GAAe,QAAQ,KAAK,CAGvC,EACA,EACD,CAOI,CACF,CACF,OACM,EAAO,CACd,MAAO,CACL,QAAS,CACP,CACE,KAAM,OACN,KAAM,6BAA6B,aAAiB,MAAQ,EAAM,QAAU,OAAO,EAAM,GAC1F,CACF,CACD,QAAS,GACV,GAGN,EAGU,EAAsB,SAA2B,CAC5D,IAAM,EAAKG,EAAS,gBAAgB,CAClC,MAAO,QAAQ,MACf,OAAQ,QAAQ,OACjB,CAAC,CAEI,EAA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