@blueking/chat-x 0.0.4 → 0.0.6
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/index.css +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/mcp/generated/docs/activity-message.md +428 -0
- package/dist/mcp/generated/docs/ai-image.md +227 -0
- package/dist/mcp/generated/docs/ai-loading.md +129 -0
- package/dist/mcp/generated/docs/ai-selection.md +436 -0
- package/dist/mcp/generated/docs/animation-text.md +199 -0
- package/dist/mcp/generated/docs/assistant-message.md +424 -0
- package/dist/mcp/generated/docs/chat-container.md +365 -0
- package/dist/mcp/generated/docs/chat-input.md +625 -0
- package/dist/mcp/generated/docs/cite-content.md +138 -0
- package/dist/mcp/generated/docs/code-content.md +199 -0
- package/dist/mcp/generated/docs/common-error-content.md +70 -0
- package/dist/mcp/generated/docs/constants.md +216 -0
- package/dist/mcp/generated/docs/content-render.md +238 -0
- package/dist/mcp/generated/docs/delete-tool.md +188 -0
- package/dist/mcp/generated/docs/desc-panel.md +139 -0
- package/dist/mcp/generated/docs/execution-summary.md +126 -0
- package/dist/mcp/generated/docs/file-content.md +300 -0
- package/dist/mcp/generated/docs/file-upload-btn.md +174 -0
- package/dist/mcp/generated/docs/flow-message.md +305 -0
- package/dist/mcp/generated/docs/highlight-keyword.md +144 -0
- package/dist/mcp/generated/docs/image-content.md +178 -0
- package/dist/mcp/generated/docs/image-preview-group.md +181 -0
- package/dist/mcp/generated/docs/image-preview.md +224 -0
- package/dist/mcp/generated/docs/info-message.md +124 -0
- package/dist/mcp/generated/docs/key-value-content.md +124 -0
- package/dist/mcp/generated/docs/latex-content.md +196 -0
- package/dist/mcp/generated/docs/loading-message.md +171 -0
- package/dist/mcp/generated/docs/markdown-content.md +186 -0
- package/dist/mcp/generated/docs/markdown-latex.md +208 -0
- package/dist/mcp/generated/docs/markdown-mermaid.md +250 -0
- package/dist/mcp/generated/docs/mermaid-content.md +185 -0
- package/dist/mcp/generated/docs/message-container.md +534 -0
- package/dist/mcp/generated/docs/message-render.md +329 -0
- package/dist/mcp/generated/docs/message-tools.md +376 -0
- package/dist/mcp/generated/docs/messages.md +472 -0
- package/dist/mcp/generated/docs/overflow-tips.md +209 -0
- package/dist/mcp/generated/docs/reasoning-message.md +233 -0
- package/dist/mcp/generated/docs/reference-content.md +132 -0
- package/dist/mcp/generated/docs/scroll-btn.md +155 -0
- package/dist/mcp/generated/docs/selection-footer.md +75 -0
- package/dist/mcp/generated/docs/shortcut-btn.md +202 -0
- package/dist/mcp/generated/docs/shortcut-btns.md +264 -0
- package/dist/mcp/generated/docs/shortcut-render.md +418 -0
- package/dist/mcp/generated/docs/text-content.md +74 -0
- package/dist/mcp/generated/docs/theme.md +388 -0
- package/dist/mcp/generated/docs/tool-btn.md +254 -0
- package/dist/mcp/generated/docs/tool-message.md +217 -0
- package/dist/mcp/generated/docs/toolcall-render.md +299 -0
- package/dist/mcp/generated/docs/use-animation-text.md +198 -0
- package/dist/mcp/generated/docs/use-clipboard.md +206 -0
- package/dist/mcp/generated/docs/use-command-selection.md +128 -0
- package/dist/mcp/generated/docs/use-container-scroll.md +56 -0
- package/dist/mcp/generated/docs/use-custom-tab.md +122 -0
- package/dist/mcp/generated/docs/use-global-config.md +154 -0
- package/dist/mcp/generated/docs/use-menu-keydown.md +164 -0
- package/dist/mcp/generated/docs/use-message-group.md +175 -0
- package/dist/mcp/generated/docs/use-observer-visible-list.md +189 -0
- package/dist/mcp/generated/docs/use-parent-scrolling.md +46 -0
- package/dist/mcp/generated/docs/user-feedback.md +229 -0
- package/dist/mcp/generated/docs/user-message.md +347 -0
- package/dist/mcp/generated/index.json +1311 -0
- package/dist/mcp/index.d.ts +2 -0
- package/dist/mcp/index.js +42 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/server.d.ts +2 -0
- package/dist/mcp/server.js +43 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/tools/get-component-doc.d.ts +19 -0
- package/dist/mcp/tools/get-component-doc.js +60 -0
- package/dist/mcp/tools/get-component-doc.js.map +1 -0
- package/dist/mcp/tools/list-components.d.ts +35 -0
- package/dist/mcp/tools/list-components.js +147 -0
- package/dist/mcp/tools/list-components.js.map +1 -0
- package/dist/mcp/tools/search-docs.d.ts +14 -0
- package/dist/mcp/tools/search-docs.js +82 -0
- package/dist/mcp/tools/search-docs.js.map +1 -0
- package/dist/mcp/utils/doc-loader.d.ts +35 -0
- package/dist/mcp/utils/doc-loader.js +64 -0
- package/dist/mcp/utils/doc-loader.js.map +1 -0
- package/package.json +5 -7
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
/*
|
|
4
|
+
* Tencent is pleased to support the open source community by making
|
|
5
|
+
* 蓝鲸智云PaaS平台 (BlueKing PaaS) available.
|
|
6
|
+
*
|
|
7
|
+
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
|
|
8
|
+
*
|
|
9
|
+
* 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.
|
|
10
|
+
*
|
|
11
|
+
* License for 蓝鲸智云PaaS平台 (BlueKing PaaS):
|
|
12
|
+
*
|
|
13
|
+
* ---------------------------------------------------
|
|
14
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
15
|
+
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
|
|
16
|
+
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
|
|
17
|
+
* to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
18
|
+
*
|
|
19
|
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of
|
|
20
|
+
* the Software.
|
|
21
|
+
*
|
|
22
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
|
23
|
+
* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
25
|
+
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
26
|
+
* IN THE SOFTWARE.
|
|
27
|
+
*/
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
30
|
+
const server_js_1 = require("./server.js");
|
|
31
|
+
async function main() {
|
|
32
|
+
const server = (0, server_js_1.createServer)();
|
|
33
|
+
const transport = new stdio_js_1.StdioServerTransport();
|
|
34
|
+
await server.connect(transport);
|
|
35
|
+
process.on('SIGINT', () => {
|
|
36
|
+
void server.close().then(() => {
|
|
37
|
+
process.exit(0);
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
main().catch(console.error);
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../mcp/src/index.ts"],"names":[],"mappings":";;AAEA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;;AAEH,wEAAiF;AAEjF,2CAA2C;AAE3C,KAAK,UAAU,IAAI;IACjB,MAAM,MAAM,GAAG,IAAA,wBAAY,GAAE,CAAC;IAC9B,MAAM,SAAS,GAAG,IAAI,+BAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEhC,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;QACxB,KAAK,MAAM,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;YAC5B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createServer = createServer;
|
|
4
|
+
/*
|
|
5
|
+
* Tencent is pleased to support the open source community by making
|
|
6
|
+
* 蓝鲸智云PaaS平台 (BlueKing PaaS) available.
|
|
7
|
+
*
|
|
8
|
+
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
|
|
9
|
+
*
|
|
10
|
+
* 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.
|
|
11
|
+
*
|
|
12
|
+
* License for 蓝鲸智云PaaS平台 (BlueKing PaaS):
|
|
13
|
+
*
|
|
14
|
+
* ---------------------------------------------------
|
|
15
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
16
|
+
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
|
|
17
|
+
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
|
|
18
|
+
* to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
19
|
+
*
|
|
20
|
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of
|
|
21
|
+
* the Software.
|
|
22
|
+
*
|
|
23
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
|
24
|
+
* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
26
|
+
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
27
|
+
* IN THE SOFTWARE.
|
|
28
|
+
*/
|
|
29
|
+
const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
30
|
+
const get_component_doc_js_1 = require("./tools/get-component-doc.js");
|
|
31
|
+
const list_components_js_1 = require("./tools/list-components.js");
|
|
32
|
+
const search_docs_js_1 = require("./tools/search-docs.js");
|
|
33
|
+
function createServer() {
|
|
34
|
+
const server = new mcp_js_1.McpServer({
|
|
35
|
+
name: 'chat-x',
|
|
36
|
+
version: '0.1.0',
|
|
37
|
+
});
|
|
38
|
+
server.tool('list_components', '列出 @blueking/chat-x 文档索引中的全部条目:原子/分子组件、composables、指令、插件、类型、工具、edix、i18n、图标、主题等;支持按文档分类与组件功能域筛选,并返回 aiSummary', list_components_js_1.listComponentsSchema, async (args) => (0, list_components_js_1.listComponents)(args));
|
|
39
|
+
server.tool('get_component_doc', '按 slug 获取对应 Wiki 文档全文(含 AI 摘要区块与清洗后的正文);覆盖组件、composable、指令、插件、类型等所有已编入索引的条目', get_component_doc_js_1.getComponentDocSchema, async (args) => (0, get_component_doc_js_1.getComponentDoc)(args));
|
|
40
|
+
server.tool('search_docs', '在 @blueking/chat-x 已生成文档中全文检索(含名称、描述、aiSummary、关联组件 relation、正文),返回匹配条目与上下文片段', search_docs_js_1.searchDocsSchema, async (args) => (0, search_docs_js_1.searchDocs)(args));
|
|
41
|
+
return server;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../mcp/src/server.ts"],"names":[],"mappings":";;AA+BA,oCA4BC;AA3DD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,oEAAoE;AAEpE,uEAAsF;AACtF,mEAAkF;AAClF,2DAAsE;AAEtE,SAAgB,YAAY;IAC1B,MAAM,MAAM,GAAG,IAAI,kBAAS,CAAC;QAC3B,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,OAAO;KACjB,CAAC,CAAC;IAEH,MAAM,CAAC,IAAI,CACT,iBAAiB,EACjB,+GAA+G,EAC/G,yCAAoB,EACpB,KAAK,EAAC,IAAI,EAAC,EAAE,CAAC,IAAA,mCAAc,EAAC,IAAI,CAAC,CACnC,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,mBAAmB,EACnB,6EAA6E,EAC7E,4CAAqB,EACrB,KAAK,EAAC,IAAI,EAAC,EAAE,CAAC,IAAA,sCAAe,EAAC,IAAI,CAAC,CACpC,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,aAAa,EACb,+EAA+E,EAC/E,iCAAgB,EAChB,KAAK,EAAC,IAAI,EAAC,EAAE,CAAC,IAAA,2BAAU,EAAC,IAAI,CAAC,CAC/B,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const getComponentDocSchema: {
|
|
3
|
+
slug: z.ZodString;
|
|
4
|
+
};
|
|
5
|
+
export declare function getComponentDoc(args: {
|
|
6
|
+
slug: string;
|
|
7
|
+
}): {
|
|
8
|
+
content: {
|
|
9
|
+
type: "text";
|
|
10
|
+
text: string;
|
|
11
|
+
}[];
|
|
12
|
+
isError: boolean;
|
|
13
|
+
} | {
|
|
14
|
+
content: {
|
|
15
|
+
type: "text";
|
|
16
|
+
text: string;
|
|
17
|
+
}[];
|
|
18
|
+
isError?: undefined;
|
|
19
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getComponentDocSchema = void 0;
|
|
4
|
+
exports.getComponentDoc = getComponentDoc;
|
|
5
|
+
/*
|
|
6
|
+
* Tencent is pleased to support the open source community by making
|
|
7
|
+
* 蓝鲸智云PaaS平台 (BlueKing PaaS) available.
|
|
8
|
+
*
|
|
9
|
+
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
|
|
10
|
+
*
|
|
11
|
+
* 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.
|
|
12
|
+
*
|
|
13
|
+
* License for 蓝鲸智云PaaS平台 (BlueKing PaaS):
|
|
14
|
+
*
|
|
15
|
+
* ---------------------------------------------------
|
|
16
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
17
|
+
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
|
|
18
|
+
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
|
|
19
|
+
* to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
20
|
+
*
|
|
21
|
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of
|
|
22
|
+
* the Software.
|
|
23
|
+
*
|
|
24
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
|
25
|
+
* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
26
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
27
|
+
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
28
|
+
* IN THE SOFTWARE.
|
|
29
|
+
*/
|
|
30
|
+
const zod_1 = require("zod");
|
|
31
|
+
const doc_loader_js_1 = require("../utils/doc-loader.js");
|
|
32
|
+
exports.getComponentDocSchema = {
|
|
33
|
+
slug: zod_1.z
|
|
34
|
+
.string()
|
|
35
|
+
.describe('文档 slug(如 chat-container、use-message-group、overflow-tips),可通过 list_components 获取任意已索引条目'),
|
|
36
|
+
};
|
|
37
|
+
function getComponentDoc(args) {
|
|
38
|
+
const entry = (0, doc_loader_js_1.findBySlug)(args.slug);
|
|
39
|
+
if (!entry) {
|
|
40
|
+
return {
|
|
41
|
+
content: [
|
|
42
|
+
{
|
|
43
|
+
type: 'text',
|
|
44
|
+
text: `未找到 slug 为 "${args.slug}" 的文档。请先调用 list_components 查看可用组件。`,
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
isError: true,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
const content = (0, doc_loader_js_1.readDocContent)(entry.docFile);
|
|
51
|
+
return {
|
|
52
|
+
content: [
|
|
53
|
+
{
|
|
54
|
+
type: 'text',
|
|
55
|
+
text: content,
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=get-component-doc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-component-doc.js","sourceRoot":"","sources":["../../../mcp/src/tools/get-component-doc.ts"],"names":[],"mappings":";;;AAqCA,0CAuBC;AA5DD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,6BAAwB;AAExB,0DAAoE;AAEvD,QAAA,qBAAqB,GAAG;IACnC,IAAI,EAAE,OAAC;SACJ,MAAM,EAAE;SACR,QAAQ,CACP,yFAAyF,CAC1F;CACJ,CAAC;AAEF,SAAgB,eAAe,CAAC,IAAsB;IACpD,MAAM,KAAK,GAAG,IAAA,0BAAU,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,eAAe,IAAI,CAAC,IAAI,oCAAoC;iBACnE;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;IAED,MAAM,OAAO,GAAG,IAAA,8BAAc,EAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC9C,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAe;gBACrB,IAAI,EAAE,OAAO;aACd;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const listComponentsSchema: {
|
|
3
|
+
category: z.ZodDefault<z.ZodEnum<{
|
|
4
|
+
all: "all";
|
|
5
|
+
atomic: "atomic";
|
|
6
|
+
molecular: "molecular";
|
|
7
|
+
composable: "composable";
|
|
8
|
+
directive: "directive";
|
|
9
|
+
plugin: "plugin";
|
|
10
|
+
type: "type";
|
|
11
|
+
util: "util";
|
|
12
|
+
edix: "edix";
|
|
13
|
+
i18n: "i18n";
|
|
14
|
+
icon: "icon";
|
|
15
|
+
theme: "theme";
|
|
16
|
+
}>>;
|
|
17
|
+
domain: z.ZodDefault<z.ZodEnum<{
|
|
18
|
+
all: "all";
|
|
19
|
+
message: "message";
|
|
20
|
+
input: "input";
|
|
21
|
+
content: "content";
|
|
22
|
+
media: "media";
|
|
23
|
+
tools: "tools";
|
|
24
|
+
helper: "helper";
|
|
25
|
+
}>>;
|
|
26
|
+
};
|
|
27
|
+
export declare function listComponents(args: {
|
|
28
|
+
category: string;
|
|
29
|
+
domain: string;
|
|
30
|
+
}): {
|
|
31
|
+
content: {
|
|
32
|
+
type: "text";
|
|
33
|
+
text: string;
|
|
34
|
+
}[];
|
|
35
|
+
};
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listComponentsSchema = void 0;
|
|
4
|
+
exports.listComponents = listComponents;
|
|
5
|
+
/*
|
|
6
|
+
* Tencent is pleased to support the open source community by making
|
|
7
|
+
* 蓝鲸智云PaaS平台 (BlueKing PaaS) available.
|
|
8
|
+
*
|
|
9
|
+
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
|
|
10
|
+
*
|
|
11
|
+
* 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.
|
|
12
|
+
*
|
|
13
|
+
* License for 蓝鲸智云PaaS平台 (BlueKing PaaS):
|
|
14
|
+
*
|
|
15
|
+
* ---------------------------------------------------
|
|
16
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
17
|
+
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
|
|
18
|
+
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
|
|
19
|
+
* to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
20
|
+
*
|
|
21
|
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of
|
|
22
|
+
* the Software.
|
|
23
|
+
*
|
|
24
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
|
25
|
+
* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
26
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
27
|
+
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
28
|
+
* IN THE SOFTWARE.
|
|
29
|
+
*/
|
|
30
|
+
const zod_1 = require("zod");
|
|
31
|
+
const doc_loader_js_1 = require("../utils/doc-loader.js");
|
|
32
|
+
exports.listComponentsSchema = {
|
|
33
|
+
category: zod_1.z
|
|
34
|
+
.enum([
|
|
35
|
+
'all',
|
|
36
|
+
'atomic',
|
|
37
|
+
'molecular',
|
|
38
|
+
'composable',
|
|
39
|
+
'directive',
|
|
40
|
+
'plugin',
|
|
41
|
+
'type',
|
|
42
|
+
'util',
|
|
43
|
+
'edix',
|
|
44
|
+
'i18n',
|
|
45
|
+
'icon',
|
|
46
|
+
'theme',
|
|
47
|
+
])
|
|
48
|
+
.default('all')
|
|
49
|
+
.describe('过滤分类:all 返回全部,或按具体分类筛选'),
|
|
50
|
+
domain: zod_1.z
|
|
51
|
+
.enum(['all', 'message', 'input', 'content', 'media', 'tools', 'helper'])
|
|
52
|
+
.default('all')
|
|
53
|
+
.describe('按功能域过滤(仅对组件生效,其他分类不受影响)'),
|
|
54
|
+
};
|
|
55
|
+
function listComponents(args) {
|
|
56
|
+
const index = (0, doc_loader_js_1.loadIndex)();
|
|
57
|
+
const { category, domain } = args;
|
|
58
|
+
const result = {
|
|
59
|
+
components: [],
|
|
60
|
+
composables: [],
|
|
61
|
+
types: [],
|
|
62
|
+
directives: [],
|
|
63
|
+
plugins: [],
|
|
64
|
+
utils: [],
|
|
65
|
+
edix: [],
|
|
66
|
+
i18n: [],
|
|
67
|
+
icons: [],
|
|
68
|
+
theme: [],
|
|
69
|
+
};
|
|
70
|
+
if (shouldIncludeGroup('components', category)) {
|
|
71
|
+
result.components = filterComponentEntries(index.components, category, domain).map(mapEntry);
|
|
72
|
+
}
|
|
73
|
+
if (shouldIncludeGroup('composables', category)) {
|
|
74
|
+
result.composables = index.composables.map(mapEntry);
|
|
75
|
+
}
|
|
76
|
+
if (shouldIncludeGroup('types', category)) {
|
|
77
|
+
result.types = index.types.map(mapEntry);
|
|
78
|
+
}
|
|
79
|
+
if (shouldIncludeGroup('directives', category)) {
|
|
80
|
+
result.directives = index.directives.map(mapEntry);
|
|
81
|
+
}
|
|
82
|
+
if (shouldIncludeGroup('plugins', category)) {
|
|
83
|
+
result.plugins = index.plugins.map(mapEntry);
|
|
84
|
+
}
|
|
85
|
+
if (shouldIncludeGroup('utils', category)) {
|
|
86
|
+
result.utils = index.utils.map(mapEntry);
|
|
87
|
+
}
|
|
88
|
+
if (shouldIncludeGroup('edix', category)) {
|
|
89
|
+
result.edix = index.edix.map(mapEntry);
|
|
90
|
+
}
|
|
91
|
+
if (shouldIncludeGroup('i18n', category)) {
|
|
92
|
+
result.i18n = index.i18n.map(mapEntry);
|
|
93
|
+
}
|
|
94
|
+
if (shouldIncludeGroup('icons', category)) {
|
|
95
|
+
result.icons = index.icons.map(mapEntry);
|
|
96
|
+
}
|
|
97
|
+
if (shouldIncludeGroup('theme', category)) {
|
|
98
|
+
result.theme = index.theme.map(mapEntry);
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
content: [
|
|
102
|
+
{
|
|
103
|
+
type: 'text',
|
|
104
|
+
text: JSON.stringify(result, null, 2),
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
function filterComponentEntries(entries, category, domain) {
|
|
110
|
+
let result = entries;
|
|
111
|
+
if (category === 'atomic')
|
|
112
|
+
result = result.filter(e => e.category === 'atomic');
|
|
113
|
+
else if (category === 'molecular')
|
|
114
|
+
result = result.filter(e => e.category === 'molecular');
|
|
115
|
+
if (domain !== 'all')
|
|
116
|
+
result = result.filter(e => (e.domain ?? 'helper') === domain);
|
|
117
|
+
return result;
|
|
118
|
+
}
|
|
119
|
+
function mapEntry(entry) {
|
|
120
|
+
return {
|
|
121
|
+
name: entry.name,
|
|
122
|
+
slug: entry.slug,
|
|
123
|
+
category: entry.category,
|
|
124
|
+
description: entry.description,
|
|
125
|
+
aiSummary: entry.aiSummary,
|
|
126
|
+
...(entry.domain !== undefined ? { domain: entry.domain } : {}),
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
function shouldIncludeGroup(groupKey, category) {
|
|
130
|
+
if (category === 'all')
|
|
131
|
+
return true;
|
|
132
|
+
const single = {
|
|
133
|
+
atomic: 'components',
|
|
134
|
+
molecular: 'components',
|
|
135
|
+
composable: 'composables',
|
|
136
|
+
directive: 'directives',
|
|
137
|
+
plugin: 'plugins',
|
|
138
|
+
type: 'types',
|
|
139
|
+
util: 'utils',
|
|
140
|
+
edix: 'edix',
|
|
141
|
+
i18n: 'i18n',
|
|
142
|
+
icon: 'icons',
|
|
143
|
+
theme: 'theme',
|
|
144
|
+
};
|
|
145
|
+
return single[category] === groupKey;
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=list-components.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-components.js","sourceRoot":"","sources":["../../../mcp/src/tools/list-components.ts"],"names":[],"mappings":";;;AAiEA,wCAwDC;AAzHD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,6BAAwB;AAExB,0DAAkE;AAErD,QAAA,oBAAoB,GAAG;IAClC,QAAQ,EAAE,OAAC;SACR,IAAI,CAAC;QACJ,KAAK;QACL,QAAQ;QACR,WAAW;QACX,YAAY;QACZ,WAAW;QACX,QAAQ;QACR,MAAM;QACN,MAAM;QACN,MAAM;QACN,MAAM;QACN,MAAM;QACN,OAAO;KACR,CAAC;SACD,OAAO,CAAC,KAAK,CAAC;SACd,QAAQ,CAAC,wBAAwB,CAAC;IACrC,MAAM,EAAE,OAAC;SACN,IAAI,CAAC,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;SACxE,OAAO,CAAC,KAAK,CAAC;SACd,QAAQ,CAAC,yBAAyB,CAAC;CACvC,CAAC;AAcF,SAAgB,cAAc,CAAC,IAA0C;IACvE,MAAM,KAAK,GAAG,IAAA,yBAAS,GAAE,CAAC;IAC1B,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAElC,MAAM,MAAM,GAAwD;QAClE,UAAU,EAAE,EAAE;QACd,WAAW,EAAE,EAAE;QACf,KAAK,EAAE,EAAE;QACT,UAAU,EAAE,EAAE;QACd,OAAO,EAAE,EAAE;QACX,KAAK,EA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KAAK,MAAM,CAAC,CAAC;IACrF,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,QAAQ,CAAC,KAAe;IAC/B,OAAO;QACL,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,GAAG,CAAC,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAChE,CAAC;AACJ,CAAC;AAED,SAAS,kBAAkB,CAAC,QAAsB,EAAE,QAAgB;IAClE,IAAI,QAAQ,KAAK,KAAK;QAAE,OAAO,IAAI,CAAC;IACpC,MAAM,MAAM,GAAiC;QAC3C,MAAM,EAAE,YAAY;QACpB,SAAS,EAAE,YAAY;QACvB,UAAU,EAAE,aAAa;QACzB,SAAS,EAAE,YAAY;QACvB,MAAM,EAAE,SAAS;QACjB,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,OAAO;KACf,CAAC;IACF,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,QAAQ,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const searchDocsSchema: {
|
|
3
|
+
query: z.ZodString;
|
|
4
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
5
|
+
};
|
|
6
|
+
export declare function searchDocs(args: {
|
|
7
|
+
limit: number;
|
|
8
|
+
query: string;
|
|
9
|
+
}): {
|
|
10
|
+
content: {
|
|
11
|
+
type: "text";
|
|
12
|
+
text: string;
|
|
13
|
+
}[];
|
|
14
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.searchDocsSchema = void 0;
|
|
4
|
+
exports.searchDocs = searchDocs;
|
|
5
|
+
/*
|
|
6
|
+
* Tencent is pleased to support the open source community by making
|
|
7
|
+
* 蓝鲸智云PaaS平台 (BlueKing PaaS) available.
|
|
8
|
+
*
|
|
9
|
+
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
|
|
10
|
+
*
|
|
11
|
+
* 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.
|
|
12
|
+
*
|
|
13
|
+
* License for 蓝鲸智云PaaS平台 (BlueKing PaaS):
|
|
14
|
+
*
|
|
15
|
+
* ---------------------------------------------------
|
|
16
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
17
|
+
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
|
|
18
|
+
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
|
|
19
|
+
* to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
20
|
+
*
|
|
21
|
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of
|
|
22
|
+
* the Software.
|
|
23
|
+
*
|
|
24
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
|
25
|
+
* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
26
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
27
|
+
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
28
|
+
* IN THE SOFTWARE.
|
|
29
|
+
*/
|
|
30
|
+
const zod_1 = require("zod");
|
|
31
|
+
const doc_loader_js_1 = require("../utils/doc-loader.js");
|
|
32
|
+
exports.searchDocsSchema = {
|
|
33
|
+
query: zod_1.z.string().describe('搜索关键词,如"消息"、"上传"、"流式"'),
|
|
34
|
+
limit: zod_1.z.number().default(5).describe('最大返回数量,默认 5'),
|
|
35
|
+
};
|
|
36
|
+
function searchDocs(args) {
|
|
37
|
+
const entries = (0, doc_loader_js_1.getAllEntries)();
|
|
38
|
+
const results = [];
|
|
39
|
+
for (const entry of entries) {
|
|
40
|
+
if (results.length >= args.limit)
|
|
41
|
+
break;
|
|
42
|
+
const content = (0, doc_loader_js_1.readDocContent)(entry.docFile);
|
|
43
|
+
const fullText = `${entry.name} ${entry.description} ${entry.aiSummary ?? ''} ${(entry.relatedComponents ?? [])
|
|
44
|
+
.map(r => r.relation)
|
|
45
|
+
.join(' ')} ${content}`;
|
|
46
|
+
if (fullText.toLowerCase().includes(args.query.toLowerCase())) {
|
|
47
|
+
results.push({
|
|
48
|
+
name: entry.name,
|
|
49
|
+
slug: entry.slug,
|
|
50
|
+
category: entry.category,
|
|
51
|
+
aiSummary: entry.aiSummary,
|
|
52
|
+
matches: extractMatchContext(content, args.query),
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
content: [
|
|
58
|
+
{
|
|
59
|
+
type: 'text',
|
|
60
|
+
text: JSON.stringify({ query: args.query, resultCount: results.length, results }, null, 2),
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function extractMatchContext(content, query, contextChars = 80) {
|
|
66
|
+
const matches = [];
|
|
67
|
+
const lowerContent = content.toLowerCase();
|
|
68
|
+
const lowerQuery = query.toLowerCase();
|
|
69
|
+
let pos = 0;
|
|
70
|
+
while (matches.length < 3) {
|
|
71
|
+
const idx = lowerContent.indexOf(lowerQuery, pos);
|
|
72
|
+
if (idx === -1)
|
|
73
|
+
break;
|
|
74
|
+
const start = Math.max(0, idx - contextChars);
|
|
75
|
+
const end = Math.min(content.length, idx + query.length + contextChars);
|
|
76
|
+
const snippet = (start > 0 ? '...' : '') + content.slice(start, end).trim() + (end < content.length ? '...' : '');
|
|
77
|
+
matches.push(snippet);
|
|
78
|
+
pos = idx + query.length;
|
|
79
|
+
}
|
|
80
|
+
return matches;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=search-docs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-docs.js","sourceRoot":"","sources":["../../../mcp/src/tools/search-docs.ts"],"names":[],"mappings":";;;AA0CA,gCA+BC;AAzED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,6BAAwB;AAExB,0DAAuE;AAE1D,QAAA,gBAAgB,GAAG;IAC9B,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uBAAuB,CAAC;IACnD,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC;CACrD,CAAC;AAUF,SAAgB,UAAU,CAAC,IAAsC;IAC/D,MAAM,OAAO,GAAG,IAAA,6BAAa,GAAE,CAAC;IAChC,MAAM,OAAO,GAAmB,EAAE,CAAC;IAEnC,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,IAAI,OAAO,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK;YAAE,MAAM;QAExC,MAAM,OAAO,GAAG,IAAA,8BAAc,EAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC9C,MAAM,QAAQ,GAAG,GAAG,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,SAAS,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,iBAAiB,IAAI,EAAE,CAAC;aAC5G,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G,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,GAAG,YAAY,CAAC,CAAC;QAC9C,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,GAAG,KAAK,CAAC,MAAM,GAAG,YAAY,CAAC,CAAC;QACxE,MAAM,OAAO,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAClH,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACtB,GAAG,GAAG,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC;IAC3B,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export interface DocEntry {
|
|
2
|
+
aiSummary: string;
|
|
3
|
+
category: string;
|
|
4
|
+
description: string;
|
|
5
|
+
docFile: string;
|
|
6
|
+
domain?: string;
|
|
7
|
+
name: string;
|
|
8
|
+
relatedComponents: Array<{
|
|
9
|
+
relation: string;
|
|
10
|
+
slug: string;
|
|
11
|
+
}>;
|
|
12
|
+
slug: string;
|
|
13
|
+
}
|
|
14
|
+
export interface DocIndex {
|
|
15
|
+
components: DocEntry[];
|
|
16
|
+
composables: DocEntry[];
|
|
17
|
+
directives: DocEntry[];
|
|
18
|
+
domains: Record<string, {
|
|
19
|
+
components: string[];
|
|
20
|
+
label: string;
|
|
21
|
+
}>;
|
|
22
|
+
edix: DocEntry[];
|
|
23
|
+
generatedAt: string;
|
|
24
|
+
i18n: DocEntry[];
|
|
25
|
+
icons: DocEntry[];
|
|
26
|
+
plugins: DocEntry[];
|
|
27
|
+
theme: DocEntry[];
|
|
28
|
+
types: DocEntry[];
|
|
29
|
+
utils: DocEntry[];
|
|
30
|
+
version: string;
|
|
31
|
+
}
|
|
32
|
+
export declare function findBySlug(slug: string): DocEntry | undefined;
|
|
33
|
+
export declare function getAllEntries(): DocEntry[];
|
|
34
|
+
export declare function loadIndex(): DocIndex;
|
|
35
|
+
export declare function readDocContent(docFile: string): string;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findBySlug = findBySlug;
|
|
4
|
+
exports.getAllEntries = getAllEntries;
|
|
5
|
+
exports.loadIndex = loadIndex;
|
|
6
|
+
exports.readDocContent = readDocContent;
|
|
7
|
+
/*
|
|
8
|
+
* Tencent is pleased to support the open source community by making
|
|
9
|
+
* 蓝鲸智云PaaS平台 (BlueKing PaaS) available.
|
|
10
|
+
*
|
|
11
|
+
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
|
|
12
|
+
*
|
|
13
|
+
* 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.
|
|
14
|
+
*
|
|
15
|
+
* License for 蓝鲸智云PaaS平台 (BlueKing PaaS):
|
|
16
|
+
*
|
|
17
|
+
* ---------------------------------------------------
|
|
18
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
19
|
+
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
|
|
20
|
+
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
|
|
21
|
+
* to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
22
|
+
*
|
|
23
|
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of
|
|
24
|
+
* the Software.
|
|
25
|
+
*
|
|
26
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
|
27
|
+
* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
28
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
29
|
+
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
30
|
+
* IN THE SOFTWARE.
|
|
31
|
+
*/
|
|
32
|
+
const node_fs_1 = require("node:fs");
|
|
33
|
+
const node_path_1 = require("node:path");
|
|
34
|
+
const GENERATED_DIR = (0, node_path_1.resolve)(__dirname, '../generated');
|
|
35
|
+
let cachedIndex = null;
|
|
36
|
+
function findBySlug(slug) {
|
|
37
|
+
return getAllEntries().find(e => e.slug === slug);
|
|
38
|
+
}
|
|
39
|
+
function getAllEntries() {
|
|
40
|
+
const index = loadIndex();
|
|
41
|
+
return [
|
|
42
|
+
...index.components,
|
|
43
|
+
...index.composables,
|
|
44
|
+
...index.types,
|
|
45
|
+
...index.directives,
|
|
46
|
+
...index.plugins,
|
|
47
|
+
...index.utils,
|
|
48
|
+
...index.edix,
|
|
49
|
+
...index.i18n,
|
|
50
|
+
...index.icons,
|
|
51
|
+
...index.theme,
|
|
52
|
+
];
|
|
53
|
+
}
|
|
54
|
+
function loadIndex() {
|
|
55
|
+
if (cachedIndex)
|
|
56
|
+
return cachedIndex;
|
|
57
|
+
const raw = (0, node_fs_1.readFileSync)((0, node_path_1.join)(GENERATED_DIR, 'index.json'), 'utf-8');
|
|
58
|
+
cachedIndex = JSON.parse(raw);
|
|
59
|
+
return cachedIndex;
|
|
60
|
+
}
|
|
61
|
+
function readDocContent(docFile) {
|
|
62
|
+
return (0, node_fs_1.readFileSync)((0, node_path_1.join)(GENERATED_DIR, docFile), 'utf-8');
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=doc-loader.js.map
|
|
@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AC,aAAa,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;AAC7D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blueking/chat-x",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"prepublishOnly": "vite --config vite.config.ts build && pnpm dts",
|
|
7
|
+
"prepublishOnly": "vite --config vite.config.ts build && pnpm dts && pnpm mcp:build",
|
|
8
8
|
"dev": "vite --config vite.config.ts",
|
|
9
9
|
"dts": "vue-tsc --project tsconfig.dts.json",
|
|
10
10
|
"build": "vitest && vite --config vite.config.ts build && pnpm dts",
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
"wiki:build": "vitepress build wikis",
|
|
19
19
|
"mcp:build:index": "tsx mcp/scripts/build-index.ts",
|
|
20
20
|
"mcp:build": "tsc -p mcp/tsconfig.json && pnpm mcp:build:index",
|
|
21
|
-
"mcp:start": "node mcp/
|
|
21
|
+
"mcp:start": "node dist/mcp/index.js",
|
|
22
22
|
"mcp:dev": "tsx mcp/src/index.ts"
|
|
23
23
|
},
|
|
24
24
|
"bin": {
|
|
25
|
-
"chat-x-mcp": "mcp/
|
|
25
|
+
"chat-x-mcp": "dist/mcp/index.js"
|
|
26
26
|
},
|
|
27
27
|
"module": "dist/index.js",
|
|
28
28
|
"publishConfig": {
|
|
@@ -37,9 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"types": "dist/index.d.ts",
|
|
39
39
|
"files": [
|
|
40
|
-
"dist"
|
|
41
|
-
"mcp/dist",
|
|
42
|
-
"mcp/generated"
|
|
40
|
+
"dist"
|
|
43
41
|
],
|
|
44
42
|
"keywords": [],
|
|
45
43
|
"author": "",
|