m8-mcp-server 1.0.6 → 1.0.7

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.
Files changed (67) hide show
  1. package/dist/cli.d.ts +1 -1
  2. package/dist/cli.js +1 -13
  3. package/dist/docs/apis.d.ts +1 -1
  4. package/dist/docs/apis.js +9 -326
  5. package/dist/docs/components.d.ts +1 -1
  6. package/dist/docs/components.js +2 -186
  7. package/dist/docs/index.d.ts +1 -1
  8. package/dist/docs/index.js +18 -177
  9. package/dist/docs/loader.d.ts +1 -1
  10. package/dist/docs/loader.js +1 -165
  11. package/dist/docs/search.d.ts +1 -1
  12. package/dist/docs/search.js +2 -196
  13. package/dist/docs/standards.d.ts +1 -1
  14. package/dist/docs/standards.js +3 -134
  15. package/dist/docs/utils.d.ts +1 -1
  16. package/dist/docs/utils.js +3 -129
  17. package/dist/generator/header.d.ts +1 -1
  18. package/dist/generator/header.js +3 -83
  19. package/dist/generator/index.d.ts +1 -1
  20. package/dist/generator/index.js +283 -648
  21. package/dist/generator/vue-template.d.ts +1 -1
  22. package/dist/generator/vue-template.js +336 -1016
  23. package/dist/index.d.ts +1 -1
  24. package/dist/index.js +1 -73
  25. package/dist/recommend/index.d.ts +1 -1
  26. package/dist/recommend/index.js +2 -412
  27. package/dist/tools/generate-code.d.ts +1 -1
  28. package/dist/tools/generate-code.js +39 -211
  29. package/dist/tools/get-api-info.d.ts +1 -1
  30. package/dist/tools/get-api-info.js +1 -65
  31. package/dist/tools/get-coding-standard.d.ts +1 -1
  32. package/dist/tools/get-coding-standard.js +1 -66
  33. package/dist/tools/get-component-info.d.ts +1 -1
  34. package/dist/tools/get-component-info.js +1 -60
  35. package/dist/tools/get-util-info.d.ts +1 -1
  36. package/dist/tools/get-util-info.js +1 -65
  37. package/dist/tools/index.d.ts +1 -1
  38. package/dist/tools/index.js +3 -101
  39. package/dist/tools/recommend-solution.d.ts +1 -1
  40. package/dist/tools/recommend-solution.js +1 -67
  41. package/dist/tools/search-docs.d.ts +1 -1
  42. package/dist/tools/search-docs.js +1 -71
  43. package/dist/types/index.d.ts +1 -1
  44. package/dist/types/index.js +0 -8
  45. package/package.json +4 -2
  46. package/dist/cli.js.map +0 -1
  47. package/dist/docs/apis.js.map +0 -1
  48. package/dist/docs/components.js.map +0 -1
  49. package/dist/docs/index.js.map +0 -1
  50. package/dist/docs/loader.js.map +0 -1
  51. package/dist/docs/search.js.map +0 -1
  52. package/dist/docs/standards.js.map +0 -1
  53. package/dist/docs/utils.js.map +0 -1
  54. package/dist/generator/header.js.map +0 -1
  55. package/dist/generator/index.js.map +0 -1
  56. package/dist/generator/vue-template.js.map +0 -1
  57. package/dist/index.js.map +0 -1
  58. package/dist/recommend/index.js.map +0 -1
  59. package/dist/tools/generate-code.js.map +0 -1
  60. package/dist/tools/get-api-info.js.map +0 -1
  61. package/dist/tools/get-coding-standard.js.map +0 -1
  62. package/dist/tools/get-component-info.js.map +0 -1
  63. package/dist/tools/get-util-info.js.map +0 -1
  64. package/dist/tools/index.js.map +0 -1
  65. package/dist/tools/recommend-solution.js.map +0 -1
  66. package/dist/tools/search-docs.js.map +0 -1
  67. package/dist/types/index.js.map +0 -1
@@ -1,211 +1,39 @@
1
- /**
2
- * generate_code 工具实现
3
- * @作者 li peng
4
- * @创建时间 2024-12-29
5
- * @描述 根据需求生成符合 M8 框架规范的代码,严格遵循内置规范
6
- */
7
- import { codeGenerator } from '../generator/index.js';
8
- /**
9
- * 工具定义
10
- */
11
- export const generateCodeDefinition = {
12
- name: 'generate_code',
13
- description: `根据需求生成符合 M8 框架规范的代码,严格遵循内置规范。
14
-
15
- ## 必须遵循的规范
16
-
17
- ### 1. 组件使用规范
18
- - **只能使用 M8 组件库中的组件**:如 em-field(输入框)、em-button(按钮)、em-cell(单元格)等
19
- - **不存在的组件会被自动过滤**:如 em-input 会自动修正为 em-field
20
- - 常见组件映射:
21
- - em-input/em-textarea → em-field
22
- - em-select → em-picker
23
- - em-date/em-time → em-datepicker
24
-
25
- ### 2. API 调用规范
26
- - **Toast/提示**:必须使用 \`ejs.ui.toast({ message: "提示内容" })\` 而非 uni.showToast
27
- - **Loading**:必须使用 \`ejs.ui.showWaiting({ message: "加载中..." })\` 和 \`ejs.ui.closeWaiting()\`
28
- - **确认框**:必须使用 \`ejs.ui.confirm({ title: "标题", message: "内容" })\`
29
- - **选择器**:优先使用 \`ejs.ui.picker\`、\`ejs.ui.pickDate\` 等 API
30
-
31
- ### 3. 请求规范
32
- - **必须使用** \`Util.ajax + Config.serverUrl\` 发送请求
33
- - **禁止使用** fetch、axios、uni.request
34
- - Mock 路径格式:\`/rest/mock/[模块名]/[接口名]\`
35
-
36
- ### 4. 文件结构规范
37
- - **Vue 样式必须剥离**:样式放在 \`css/[模块名].scss\`,通过 \`@import\` 引入
38
- - **路径固定**:页面默认生成在 \`src/pages/[模块名]/\`
39
- - **full-page 类型**:自动生成 index.vue + css/[模块名].scss + router.js + mock.js
40
-
41
- ### 5. 生成的文件
42
- \`\`\`
43
- src/pages/[模块名]/
44
- ├── index.vue # Vue 页面组件
45
- ├── router.js # 路由配置
46
- ├── mock.js # Mock 数据
47
- └── css/
48
- └── [模块名].scss # 样式文件
49
- \`\`\``,
50
- inputSchema: {
51
- type: 'object',
52
- properties: {
53
- type: {
54
- oneOf: [
55
- {
56
- type: 'string',
57
- enum: ['vue-component', 'javascript', 'scss', 'api-call', 'full-page'],
58
- description: '单一代码类型,full-page 会生成完整页面(Vue + SCSS + Router + Mock)'
59
- },
60
- {
61
- type: 'array',
62
- items: {
63
- type: 'string',
64
- enum: ['vue-component', 'javascript', 'scss', 'api-call', 'router', 'mock']
65
- },
66
- description: '多选代码类型数组,一次生成多种代码'
67
- }
68
- ],
69
- description: '代码类型:单选字符串或多选数组。推荐使用 full-page 一次生成完整页面'
70
- },
71
- requirement: {
72
- type: 'string',
73
- description: '需求描述,如"登录页面,包含用户名、密码输入框和登录按钮"'
74
- },
75
- vueVersion: {
76
- type: 'number',
77
- enum: [2, 3],
78
- description: 'Vue 版本,2 使用 Options API (M8.3),3 使用 Composition API (M8.4),默认 2'
79
- },
80
- components: {
81
- type: 'array',
82
- items: { type: 'string' },
83
- description: '使用的组件列表,只能使用 M8 组件库中的组件(如 em-field、em-button)。如不指定会根据需求自动推荐'
84
- },
85
- modulePath: {
86
- type: 'string',
87
- description: '模块路径,默认为 src/pages/[模块名]。通常无需指定'
88
- },
89
- useMock: {
90
- type: 'boolean',
91
- description: '是否使用 Mock 数据,默认 true'
92
- }
93
- },
94
- required: ['type', 'requirement']
95
- }
96
- };
97
- /**
98
- * 执行代码生成工具
99
- * @param args 工具参数
100
- * @returns 工具执行结果
101
- */
102
- export async function executeGenerateCode(args) {
103
- try {
104
- const type = args.type;
105
- const requirement = args.requirement;
106
- const vueVersion = args.vueVersion || 2;
107
- const components = args.components || [];
108
- const modulePath = args.modulePath;
109
- const useMock = args.useMock !== false; // 默认 true
110
- if (!type) {
111
- return {
112
- content: [{
113
- type: 'text',
114
- text: '错误:代码类型不能为空'
115
- }],
116
- isError: true
117
- };
118
- }
119
- if (!requirement || requirement.trim().length === 0) {
120
- return {
121
- content: [{
122
- type: 'text',
123
- text: '错误:需求描述不能为空'
124
- }],
125
- isError: true
126
- };
127
- }
128
- // 处理 full-page 类型:转换为完整页面生成
129
- let typesToGenerate;
130
- if (type === 'full-page') {
131
- typesToGenerate = ['vue-component', 'scss', 'router', 'mock'];
132
- }
133
- else if (Array.isArray(type)) {
134
- typesToGenerate = type;
135
- }
136
- else {
137
- // 单一类型,使用原有逻辑
138
- const result = codeGenerator.generateCode({
139
- type,
140
- requirement,
141
- vueVersion,
142
- components,
143
- useMock
144
- });
145
- const output = [
146
- '# 生成的代码',
147
- '',
148
- `**语言**: ${result.language}`,
149
- `**Vue 版本**: ${vueVersion}`,
150
- `**使用 Mock**: ${useMock ? '是' : '否'}`,
151
- '',
152
- '```' + result.language,
153
- result.code,
154
- '```',
155
- '',
156
- '## 说明',
157
- '',
158
- result.explanation
159
- ].join('\n');
160
- return {
161
- content: [{
162
- type: 'text',
163
- text: output
164
- }]
165
- };
166
- }
167
- // 多类型生成
168
- const results = codeGenerator.generateMultipleCode({
169
- types: typesToGenerate,
170
- requirement,
171
- vueVersion,
172
- components,
173
- modulePath,
174
- useMock
175
- });
176
- // 格式化多文件输出
177
- const outputParts = [
178
- '# 生成的代码',
179
- '',
180
- `**模块路径**: ${results.modulePath}`,
181
- `**Vue 版本**: ${vueVersion}`,
182
- `**使用 Mock**: ${useMock ? '是' : '否'}`,
183
- ''
184
- ];
185
- for (const file of results.files) {
186
- outputParts.push(`## ${file.relativePath || file.filename}`);
187
- outputParts.push('');
188
- outputParts.push('```' + file.language);
189
- outputParts.push(file.code);
190
- outputParts.push('```');
191
- outputParts.push('');
192
- }
193
- outputParts.push(results.explanation);
194
- return {
195
- content: [{
196
- type: 'text',
197
- text: outputParts.join('\n')
198
- }]
199
- };
200
- }
201
- catch (error) {
202
- return {
203
- content: [{
204
- type: 'text',
205
- text: `代码生成失败: ${error instanceof Error ? error.message : '未知错误'}`
206
- }],
207
- isError: true
208
- };
209
- }
210
- }
211
- //# sourceMappingURL=generate-code.js.map
1
+ import{codeGenerator as a}from"../generator/index.js";const y={name:"generate_code",description:`\u6839\u636E\u9700\u6C42\u751F\u6210\u7B26\u5408 M8 \u6846\u67B6\u89C4\u8303\u7684\u4EE3\u7801\uFF0C\u4E25\u683C\u9075\u5FAA\u5185\u7F6E\u89C4\u8303\u3002
2
+
3
+ ## \u5FC5\u987B\u9075\u5FAA\u7684\u89C4\u8303
4
+
5
+ ### 1. \u7EC4\u4EF6\u4F7F\u7528\u89C4\u8303
6
+ - **\u53EA\u80FD\u4F7F\u7528 M8 \u7EC4\u4EF6\u5E93\u4E2D\u7684\u7EC4\u4EF6**\uFF1A\u5982 em-field\uFF08\u8F93\u5165\u6846\uFF09\u3001em-button\uFF08\u6309\u94AE\uFF09\u3001em-cell\uFF08\u5355\u5143\u683C\uFF09\u7B49
7
+ - **\u4E0D\u5B58\u5728\u7684\u7EC4\u4EF6\u4F1A\u88AB\u81EA\u52A8\u8FC7\u6EE4**\uFF1A\u5982 em-input \u4F1A\u81EA\u52A8\u4FEE\u6B63\u4E3A em-field
8
+ - \u5E38\u89C1\u7EC4\u4EF6\u6620\u5C04\uFF1A
9
+ - em-input/em-textarea \u2192 em-field
10
+ - em-select \u2192 em-picker
11
+ - em-date/em-time \u2192 em-datepicker
12
+
13
+ ### 2. API \u8C03\u7528\u89C4\u8303
14
+ - **Toast/\u63D0\u793A**\uFF1A\u5FC5\u987B\u4F7F\u7528 \`ejs.ui.toast({ message: "\u63D0\u793A\u5185\u5BB9" })\` \u800C\u975E uni.showToast
15
+ - **Loading**\uFF1A\u5FC5\u987B\u4F7F\u7528 \`ejs.ui.showWaiting({ message: "\u52A0\u8F7D\u4E2D..." })\` \u548C \`ejs.ui.closeWaiting()\`
16
+ - **\u786E\u8BA4\u6846**\uFF1A\u5FC5\u987B\u4F7F\u7528 \`ejs.ui.confirm({ title: "\u6807\u9898", message: "\u5185\u5BB9" })\`
17
+ - **\u9009\u62E9\u5668**\uFF1A\u4F18\u5148\u4F7F\u7528 \`ejs.ui.picker\`\u3001\`ejs.ui.pickDate\` \u7B49 API
18
+
19
+ ### 3. \u8BF7\u6C42\u89C4\u8303
20
+ - **\u5FC5\u987B\u4F7F\u7528** \`Util.ajax + Config.serverUrl\` \u53D1\u9001\u8BF7\u6C42
21
+ - **\u7981\u6B62\u4F7F\u7528** fetch\u3001axios\u3001uni.request
22
+ - Mock \u8DEF\u5F84\u683C\u5F0F\uFF1A\`/rest/mock/[\u6A21\u5757\u540D]/[\u63A5\u53E3\u540D]\`
23
+
24
+ ### 4. \u6587\u4EF6\u7ED3\u6784\u89C4\u8303
25
+ - **Vue \u6837\u5F0F\u5FC5\u987B\u5265\u79BB**\uFF1A\u6837\u5F0F\u653E\u5728 \`css/[\u6A21\u5757\u540D].scss\`\uFF0C\u901A\u8FC7 \`@import\` \u5F15\u5165
26
+ - **\u8DEF\u5F84\u56FA\u5B9A**\uFF1A\u9875\u9762\u9ED8\u8BA4\u751F\u6210\u5728 \`src/pages/[\u6A21\u5757\u540D]/\` \u4E0B
27
+ - **full-page \u7C7B\u578B**\uFF1A\u81EA\u52A8\u751F\u6210 index.vue + css/[\u6A21\u5757\u540D].scss + router.js + mock.js
28
+
29
+ ### 5. \u751F\u6210\u7684\u6587\u4EF6
30
+ \`\`\`
31
+ src/pages/[\u6A21\u5757\u540D]/
32
+ \u251C\u2500\u2500 index.vue # Vue \u9875\u9762\u7EC4\u4EF6
33
+ \u251C\u2500\u2500 router.js # \u8DEF\u7531\u914D\u7F6E
34
+ \u251C\u2500\u2500 mock.js # Mock \u6570\u636E
35
+ \u2514\u2500\u2500 css/
36
+ \u2514\u2500\u2500 [\u6A21\u5757\u540D].scss # \u6837\u5F0F\u6587\u4EF6
37
+ \`\`\``,inputSchema:{type:"object",properties:{type:{oneOf:[{type:"string",enum:["vue-component","javascript","scss","api-call","full-page"],description:"\u5355\u4E00\u4EE3\u7801\u7C7B\u578B\uFF0Cfull-page \u4F1A\u751F\u6210\u5B8C\u6574\u9875\u9762\uFF08Vue + SCSS + Router + Mock\uFF09"},{type:"array",items:{type:"string",enum:["vue-component","javascript","scss","api-call","router","mock"]},description:"\u591A\u9009\u4EE3\u7801\u7C7B\u578B\u6570\u7EC4\uFF0C\u4E00\u6B21\u751F\u6210\u591A\u79CD\u4EE3\u7801"}],description:"\u4EE3\u7801\u7C7B\u578B\uFF1A\u5355\u9009\u5B57\u7B26\u4E32\u6216\u591A\u9009\u6570\u7EC4\u3002\u63A8\u8350\u4F7F\u7528 full-page \u4E00\u6B21\u751F\u6210\u5B8C\u6574\u9875\u9762"},requirement:{type:"string",description:'\u9700\u6C42\u63CF\u8FF0\uFF0C\u5982"\u767B\u5F55\u9875\u9762\uFF0C\u5305\u542B\u7528\u6237\u540D\u3001\u5BC6\u7801\u8F93\u5165\u6846\u548C\u767B\u5F55\u6309\u94AE"'},vueVersion:{type:"number",enum:[2,3],description:"Vue \u7248\u672C\uFF0C2 \u4F7F\u7528 Options API (M8.3)\uFF0C3 \u4F7F\u7528 Composition API (M8.4)\uFF0C\u9ED8\u8BA4 2"},components:{type:"array",items:{type:"string"},description:"\u4F7F\u7528\u7684\u7EC4\u4EF6\u5217\u8868\uFF0C\u53EA\u80FD\u4F7F\u7528 M8 \u7EC4\u4EF6\u5E93\u4E2D\u7684\u7EC4\u4EF6\uFF08\u5982 em-field\u3001em-button\uFF09\u3002\u5982\u4E0D\u6307\u5B9A\u4F1A\u6839\u636E\u9700\u6C42\u81EA\u52A8\u63A8\u8350"},modulePath:{type:"string",description:"\u6A21\u5757\u8DEF\u5F84\uFF0C\u9ED8\u8BA4\u4E3A src/pages/[\u6A21\u5757\u540D]\u3002\u901A\u5E38\u65E0\u9700\u6307\u5B9A"},useMock:{type:"boolean",description:"\u662F\u5426\u4F7F\u7528 Mock \u6570\u636E\uFF0C\u9ED8\u8BA4 true"}},required:["type","requirement"]}};async function f(s){try{const t=s.type,n=s.requirement,r=s.vueVersion||2,c=s.components||[],m=s.modulePath,i=s.useMock!==!1;if(!t)return{content:[{type:"text",text:"\u9519\u8BEF\uFF1A\u4EE3\u7801\u7C7B\u578B\u4E0D\u80FD\u4E3A\u7A7A"}],isError:!0};if(!n||n.trim().length===0)return{content:[{type:"text",text:"\u9519\u8BEF\uFF1A\u9700\u6C42\u63CF\u8FF0\u4E0D\u80FD\u4E3A\u7A7A"}],isError:!0};let u;if(t==="full-page")u=["vue-component","scss","router","mock"];else if(Array.isArray(t))u=t;else{const e=a.generateCode({type:t,requirement:n,vueVersion:r,components:c,useMock:i});return{content:[{type:"text",text:["# \u751F\u6210\u7684\u4EE3\u7801","",`**\u8BED\u8A00**: ${e.language}`,`**Vue \u7248\u672C**: ${r}`,`**\u4F7F\u7528 Mock**: ${i?"\u662F":"\u5426"}`,"","```"+e.language,e.code,"```","","## \u8BF4\u660E","",e.explanation].join(`
38
+ `)}]}}const p=a.generateMultipleCode({types:u,requirement:n,vueVersion:r,components:c,modulePath:m,useMock:i}),o=["# \u751F\u6210\u7684\u4EE3\u7801","",`**\u6A21\u5757\u8DEF\u5F84**: ${p.modulePath}`,`**Vue \u7248\u672C**: ${r}`,`**\u4F7F\u7528 Mock**: ${i?"\u662F":"\u5426"}`,""];for(const e of p.files)o.push(`## ${e.relativePath||e.filename}`),o.push(""),o.push("```"+e.language),o.push(e.code),o.push("```"),o.push("");return o.push(p.explanation),{content:[{type:"text",text:o.join(`
39
+ `)}]}}catch(t){return{content:[{type:"text",text:`\u4EE3\u7801\u751F\u6210\u5931\u8D25: ${t instanceof Error?t.message:"\u672A\u77E5\u9519\u8BEF"}`}],isError:!0}}}export{f as executeGenerateCode,y as generateCodeDefinition};
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * get_api_info 工具实现
3
3
  * @作者 li peng
4
- * @创建时间 2024-12-29
4
+ * @创建时间 2025-12-20
5
5
  * @描述 获取 EJS 原生 API 的详细信息
6
6
  */
7
7
  import type { ToolDefinition, ToolResult } from '../types/index.js';
@@ -1,65 +1 @@
1
- /**
2
- * get_api_info 工具实现
3
- * @作者 li peng
4
- * @创建时间 2024-12-29
5
- * @描述 获取 EJS 原生 API 的详细信息
6
- */
7
- import { documentManager } from '../docs/index.js';
8
- /**
9
- * 工具定义
10
- */
11
- export const getApiInfoDefinition = {
12
- name: 'get_api_info',
13
- description: '获取 EJS 原生 API 的详细信息,包括参数、返回值、平台支持、使用示例等。',
14
- inputSchema: {
15
- type: 'object',
16
- properties: {
17
- module: {
18
- type: 'string',
19
- description: 'API 模块名称,如 ui, page, storage, device'
20
- },
21
- method: {
22
- type: 'string',
23
- description: 'API 方法名称(可选),如 toast, alert, open'
24
- }
25
- },
26
- required: ['module']
27
- }
28
- };
29
- /**
30
- * 执行获取 API 信息工具
31
- * @param args 工具参数
32
- * @returns 工具执行结果
33
- */
34
- export async function executeGetApiInfo(args) {
35
- try {
36
- const moduleName = args.module;
37
- const methodName = args.method;
38
- if (!moduleName || moduleName.trim().length === 0) {
39
- return {
40
- content: [{
41
- type: 'text',
42
- text: '错误:API 模块名称不能为空'
43
- }],
44
- isError: true
45
- };
46
- }
47
- const result = documentManager.getApiInfoFormatted(moduleName, methodName);
48
- return {
49
- content: [{
50
- type: 'text',
51
- text: result
52
- }]
53
- };
54
- }
55
- catch (error) {
56
- return {
57
- content: [{
58
- type: 'text',
59
- text: `获取 API 信息失败: ${error instanceof Error ? error.message : '未知错误'}`
60
- }],
61
- isError: true
62
- };
63
- }
64
- }
65
- //# sourceMappingURL=get-api-info.js.map
1
+ import{documentManager as n}from"../docs/index.js";const s={name:"get_api_info",description:"\u83B7\u53D6 EJS \u539F\u751F API \u7684\u8BE6\u7EC6\u4FE1\u606F\uFF0C\u5305\u62EC\u53C2\u6570\u3001\u8FD4\u56DE\u503C\u3001\u5E73\u53F0\u652F\u6301\u3001\u4F7F\u7528\u793A\u4F8B\u7B49\u3002",inputSchema:{type:"object",properties:{module:{type:"string",description:"API \u6A21\u5757\u540D\u79F0\uFF0C\u5982 ui, page, storage, device"},method:{type:"string",description:"API \u65B9\u6CD5\u540D\u79F0\uFF08\u53EF\u9009\uFF09\uFF0C\u5982 toast, alert, open"}},required:["module"]}};async function p(e){try{const t=e.module,o=e.method;return!t||t.trim().length===0?{content:[{type:"text",text:"\u9519\u8BEF\uFF1AAPI \u6A21\u5757\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A"}],isError:!0}:{content:[{type:"text",text:n.getApiInfoFormatted(t,o)}]}}catch(t){return{content:[{type:"text",text:`\u83B7\u53D6 API \u4FE1\u606F\u5931\u8D25: ${t instanceof Error?t.message:"\u672A\u77E5\u9519\u8BEF"}`}],isError:!0}}}export{p as executeGetApiInfo,s as getApiInfoDefinition};
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * get_coding_standard 工具实现
3
3
  * @作者 li peng
4
- * @创建时间 2024-12-29
4
+ * @创建时间 2025-12-20
5
5
  * @描述 获取编码规范
6
6
  */
7
7
  import type { ToolDefinition, ToolResult } from '../types/index.js';
@@ -1,66 +1 @@
1
- /**
2
- * get_coding_standard 工具实现
3
- * @作者 li peng
4
- * @创建时间 2024-12-29
5
- * @描述 获取编码规范
6
- */
7
- import { documentManager } from '../docs/index.js';
8
- /**
9
- * 工具定义
10
- */
11
- export const getCodingStandardDefinition = {
12
- name: 'get_coding_standard',
13
- description: '获取编码规范,包括 CSS、JavaScript、Vue、项目结构等规范。',
14
- inputSchema: {
15
- type: 'object',
16
- properties: {
17
- type: {
18
- type: 'string',
19
- enum: ['css', 'javascript', 'vue', 'project-structure', 'all'],
20
- description: '规范类型'
21
- },
22
- keyword: {
23
- type: 'string',
24
- description: '具体规则关键词(可选)'
25
- }
26
- },
27
- required: ['type']
28
- }
29
- };
30
- /**
31
- * 执行获取编码规范工具
32
- * @param args 工具参数
33
- * @returns 工具执行结果
34
- */
35
- export async function executeGetCodingStandard(args) {
36
- try {
37
- const type = args.type;
38
- const keyword = args.keyword;
39
- if (!type) {
40
- return {
41
- content: [{
42
- type: 'text',
43
- text: '错误:规范类型不能为空'
44
- }],
45
- isError: true
46
- };
47
- }
48
- const result = documentManager.getCodingStandardFormatted(type, keyword);
49
- return {
50
- content: [{
51
- type: 'text',
52
- text: result
53
- }]
54
- };
55
- }
56
- catch (error) {
57
- return {
58
- content: [{
59
- type: 'text',
60
- text: `获取编码规范失败: ${error instanceof Error ? error.message : '未知错误'}`
61
- }],
62
- isError: true
63
- };
64
- }
65
- }
66
- //# sourceMappingURL=get-coding-standard.js.map
1
+ import{documentManager as n}from"../docs/index.js";const s={name:"get_coding_standard",description:"\u83B7\u53D6\u7F16\u7801\u89C4\u8303\uFF0C\u5305\u62EC CSS\u3001JavaScript\u3001Vue\u3001\u9879\u76EE\u7ED3\u6784\u7B49\u89C4\u8303\u3002",inputSchema:{type:"object",properties:{type:{type:"string",enum:["css","javascript","vue","project-structure","all"],description:"\u89C4\u8303\u7C7B\u578B"},keyword:{type:"string",description:"\u5177\u4F53\u89C4\u5219\u5173\u952E\u8BCD\uFF08\u53EF\u9009\uFF09"}},required:["type"]}};async function d(e){try{const t=e.type,r=e.keyword;return t?{content:[{type:"text",text:n.getCodingStandardFormatted(t,r)}]}:{content:[{type:"text",text:"\u9519\u8BEF\uFF1A\u89C4\u8303\u7C7B\u578B\u4E0D\u80FD\u4E3A\u7A7A"}],isError:!0}}catch(t){return{content:[{type:"text",text:`\u83B7\u53D6\u7F16\u7801\u89C4\u8303\u5931\u8D25: ${t instanceof Error?t.message:"\u672A\u77E5\u9519\u8BEF"}`}],isError:!0}}}export{d as executeGetCodingStandard,s as getCodingStandardDefinition};
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * get_component_info 工具实现
3
3
  * @作者 li peng
4
- * @创建时间 2024-12-29
4
+ * @创建时间 2025-12-20
5
5
  * @描述 获取 M8 UI 组件的详细信息
6
6
  */
7
7
  import type { ToolDefinition, ToolResult } from '../types/index.js';
@@ -1,60 +1 @@
1
- /**
2
- * get_component_info 工具实现
3
- * @作者 li peng
4
- * @创建时间 2024-12-29
5
- * @描述 获取 M8 UI 组件的详细信息
6
- */
7
- import { documentManager } from '../docs/index.js';
8
- /**
9
- * 工具定义
10
- */
11
- export const getComponentInfoDefinition = {
12
- name: 'get_component_info',
13
- description: '获取 M8 UI 组件的详细信息,包括 Props、Events、使用示例等。',
14
- inputSchema: {
15
- type: 'object',
16
- properties: {
17
- componentName: {
18
- type: 'string',
19
- description: '组件名称,如 em-button, em-field, button, field'
20
- }
21
- },
22
- required: ['componentName']
23
- }
24
- };
25
- /**
26
- * 执行获取组件信息工具
27
- * @param args 工具参数
28
- * @returns 工具执行结果
29
- */
30
- export async function executeGetComponentInfo(args) {
31
- try {
32
- const componentName = args.componentName;
33
- if (!componentName || componentName.trim().length === 0) {
34
- return {
35
- content: [{
36
- type: 'text',
37
- text: '错误:组件名称不能为空'
38
- }],
39
- isError: true
40
- };
41
- }
42
- const result = documentManager.getComponentInfoFormatted(componentName);
43
- return {
44
- content: [{
45
- type: 'text',
46
- text: result
47
- }]
48
- };
49
- }
50
- catch (error) {
51
- return {
52
- content: [{
53
- type: 'text',
54
- text: `获取组件信息失败: ${error instanceof Error ? error.message : '未知错误'}`
55
- }],
56
- isError: true
57
- };
58
- }
59
- }
60
- //# sourceMappingURL=get-component-info.js.map
1
+ import{documentManager as o}from"../docs/index.js";const i={name:"get_component_info",description:"\u83B7\u53D6 M8 UI \u7EC4\u4EF6\u7684\u8BE6\u7EC6\u4FE1\u606F\uFF0C\u5305\u62EC Props\u3001Events\u3001\u4F7F\u7528\u793A\u4F8B\u7B49\u3002",inputSchema:{type:"object",properties:{componentName:{type:"string",description:"\u7EC4\u4EF6\u540D\u79F0\uFF0C\u5982 em-button, em-field, button, field"}},required:["componentName"]}};async function m(e){try{const t=e.componentName;return!t||t.trim().length===0?{content:[{type:"text",text:"\u9519\u8BEF\uFF1A\u7EC4\u4EF6\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A"}],isError:!0}:{content:[{type:"text",text:o.getComponentInfoFormatted(t)}]}}catch(t){return{content:[{type:"text",text:`\u83B7\u53D6\u7EC4\u4EF6\u4FE1\u606F\u5931\u8D25: ${t instanceof Error?t.message:"\u672A\u77E5\u9519\u8BEF"}`}],isError:!0}}}export{m as executeGetComponentInfo,i as getComponentInfoDefinition};
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * get_util_info 工具实现
3
3
  * @作者 li peng
4
- * @创建时间 2024-12-29
4
+ * @创建时间 2025-12-20
5
5
  * @描述 获取 M8 Util 工具方法的详细信息
6
6
  */
7
7
  import type { ToolDefinition, ToolResult } from '../types/index.js';
@@ -1,65 +1 @@
1
- /**
2
- * get_util_info 工具实现
3
- * @作者 li peng
4
- * @创建时间 2024-12-29
5
- * @描述 获取 M8 Util 工具方法的详细信息
6
- */
7
- import { documentManager } from '../docs/index.js';
8
- /**
9
- * 工具定义
10
- */
11
- export const getUtilInfoDefinition = {
12
- name: 'get_util_info',
13
- description: '获取 M8 Util 工具方法的详细信息,包括参数、返回值、使用示例等。',
14
- inputSchema: {
15
- type: 'object',
16
- properties: {
17
- category: {
18
- type: 'string',
19
- description: 'Util 分类,如 string, date, base64, ajax'
20
- },
21
- method: {
22
- type: 'string',
23
- description: '方法名称(可选)'
24
- }
25
- },
26
- required: ['category']
27
- }
28
- };
29
- /**
30
- * 执行获取 Util 信息工具
31
- * @param args 工具参数
32
- * @returns 工具执行结果
33
- */
34
- export async function executeGetUtilInfo(args) {
35
- try {
36
- const category = args.category;
37
- const methodName = args.method;
38
- if (!category || category.trim().length === 0) {
39
- return {
40
- content: [{
41
- type: 'text',
42
- text: '错误:Util 分类不能为空'
43
- }],
44
- isError: true
45
- };
46
- }
47
- const result = documentManager.getUtilInfoFormatted(category, methodName);
48
- return {
49
- content: [{
50
- type: 'text',
51
- text: result
52
- }]
53
- };
54
- }
55
- catch (error) {
56
- return {
57
- content: [{
58
- type: 'text',
59
- text: `获取 Util 信息失败: ${error instanceof Error ? error.message : '未知错误'}`
60
- }],
61
- isError: true
62
- };
63
- }
64
- }
65
- //# sourceMappingURL=get-util-info.js.map
1
+ import{documentManager as r}from"../docs/index.js";const s={name:"get_util_info",description:"\u83B7\u53D6 M8 Util \u5DE5\u5177\u65B9\u6CD5\u7684\u8BE6\u7EC6\u4FE1\u606F\uFF0C\u5305\u62EC\u53C2\u6570\u3001\u8FD4\u56DE\u503C\u3001\u4F7F\u7528\u793A\u4F8B\u7B49\u3002",inputSchema:{type:"object",properties:{category:{type:"string",description:"Util \u5206\u7C7B\uFF0C\u5982 string, date, base64, ajax"},method:{type:"string",description:"\u65B9\u6CD5\u540D\u79F0\uFF08\u53EF\u9009\uFF09"}},required:["category"]}};async function c(e){try{const t=e.category,o=e.method;return!t||t.trim().length===0?{content:[{type:"text",text:"\u9519\u8BEF\uFF1AUtil \u5206\u7C7B\u4E0D\u80FD\u4E3A\u7A7A"}],isError:!0}:{content:[{type:"text",text:r.getUtilInfoFormatted(t,o)}]}}catch(t){return{content:[{type:"text",text:`\u83B7\u53D6 Util \u4FE1\u606F\u5931\u8D25: ${t instanceof Error?t.message:"\u672A\u77E5\u9519\u8BEF"}`}],isError:!0}}}export{c as executeGetUtilInfo,s as getUtilInfoDefinition};
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Tool Manager - 工具管理器
3
3
  * @作者 li peng
4
- * @创建时间 2024-12-29
4
+ * @创建时间 2025-12-20
5
5
  * @描述 管理所有 MCP 工具的注册和调用
6
6
  */
7
7
  import type { ToolDefinition, ToolResult } from '../types/index.js';