cloudcc-cli 2.2.2 → 2.2.4

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 (174) hide show
  1. package/.vscode/settings.json +3 -0
  2. package/README.md +47 -0
  3. package/bin/cc.js +11 -35
  4. package/bin/index.js +33 -0
  5. package/bin/mcp-svc.js +13 -0
  6. package/bin/mcp.js +18 -0
  7. package/java/com/cloudcc/core/TriggerInvoker.java +17 -1
  8. package/package.json +16 -7
  9. package/pom.xml +1 -0
  10. package/prompt/DevelopmentEnvironmentConstruction.ts +133 -0
  11. package/prompt/ccdk.ts +1190 -0
  12. package/prompt/ccprompt.ts +8 -0
  13. package/prompt/cloudccdev.ts +109 -0
  14. package/prompt/index.ts +52 -0
  15. package/prompt/objectInfo.ts +94 -0
  16. package/prompt/objectList.ts +25 -0
  17. package/prompt/openapi.ts +310 -0
  18. package/prompt/system.ts +14 -0
  19. package/prompt/vscodeExtension.ts +27 -0
  20. package/src/approval/approve.js +105 -0
  21. package/src/approval/get.js +245 -0
  22. package/src/approval/index.js +11 -0
  23. package/src/approval/reject.js +105 -0
  24. package/src/brief/get.js +51 -0
  25. package/src/brief/index.js +7 -0
  26. package/src/config/get.js +1 -1
  27. package/src/fields/create.js +204 -0
  28. package/src/fields/fields/A.js +23 -0
  29. package/src/fields/fields/AD.js +25 -0
  30. package/src/fields/fields/B.js +28 -0
  31. package/src/fields/fields/C.js +28 -0
  32. package/src/fields/fields/D.js +27 -0
  33. package/src/fields/fields/E.js +28 -0
  34. package/src/fields/fields/ENC.js +28 -0
  35. package/src/fields/fields/ENCD.js +28 -0
  36. package/src/fields/fields/F.js +27 -0
  37. package/src/fields/fields/FL.js +25 -0
  38. package/src/fields/fields/H.js +27 -0
  39. package/src/fields/fields/IMG.js +27 -0
  40. package/src/fields/fields/J.js +26 -0
  41. package/src/fields/fields/L.js +32 -0
  42. package/src/fields/fields/LT.js +28 -0
  43. package/src/fields/fields/M.js +29 -0
  44. package/src/fields/fields/MR.js +24 -0
  45. package/src/fields/fields/N.js +30 -0
  46. package/src/fields/fields/P.js +28 -0
  47. package/src/fields/fields/Q.js +35 -0
  48. package/src/fields/fields/S.js +30 -0
  49. package/src/fields/fields/SCORE.js +24 -0
  50. package/src/fields/fields/T.js +27 -0
  51. package/src/fields/fields/U.js +28 -0
  52. package/src/fields/fields/X.js +28 -0
  53. package/src/fields/fields/Y.js +33 -0
  54. package/src/fields/get.js +36 -0
  55. package/src/fields/index.js +9 -0
  56. package/src/mcp/MCP/345/234/272/346/231/257/346/250/241/346/213/237.md +8 -0
  57. package/src/mcp/index-sse-svc.js +126 -0
  58. package/src/mcp/index-streamable-svc.js +180 -0
  59. package/src/mcp/index.js +631 -0
  60. package/src/mcp/readme.md +137 -0
  61. package/src/mcp/tools/Approval/handler.js +349 -0
  62. package/src/mcp/tools/Class Creator/handler.js +37 -0
  63. package/src/mcp/tools/Class Detail Retriever/handler.js +33 -0
  64. package/src/mcp/tools/Class Detail Retriever/prompt.js +37 -0
  65. package/src/mcp/tools/Class Editor Guide/handler.js +72 -0
  66. package/src/mcp/tools/Class Editor Guide/prompt.js +468 -0
  67. package/src/mcp/tools/Class List Retriever/handler.js +36 -0
  68. package/src/mcp/tools/Class Publisher/handler.js +29 -0
  69. package/src/mcp/tools/Class Publisher/prompt.js +40 -0
  70. package/src/mcp/tools/Class Puller/handler.js +86 -0
  71. package/src/mcp/tools/Class Puller/prompt.js +49 -0
  72. package/src/mcp/tools/Client Script Creator/handler.js +179 -0
  73. package/src/mcp/tools/Client Script Detail Retriever/handler.js +53 -0
  74. package/src/mcp/tools/Client Script Editor Guide/handler.js +633 -0
  75. package/src/mcp/tools/Client Script List Retriever/handler.js +68 -0
  76. package/src/mcp/tools/Client Script Publisher/handler.js +54 -0
  77. package/src/mcp/tools/Client Script Puller/handler.js +73 -0
  78. package/src/mcp/tools/CloudCC Development Overview/handler.js +48 -0
  79. package/src/mcp/tools/CloudCC Development Overview/prompt.js +870 -0
  80. package/src/mcp/tools/Component Creator/handler.js +44 -0
  81. package/src/mcp/tools/Component Detail Retriever/handler.js +38 -0
  82. package/src/mcp/tools/Component Editor Guide/handler.js +76 -0
  83. package/src/mcp/tools/Component Editor Guide/prompt.js +519 -0
  84. package/src/mcp/tools/Component List Retriever/handler.js +43 -0
  85. package/src/mcp/tools/Component Publisher/handler.js +18 -0
  86. package/src/mcp/tools/Component Publisher/prompt.js +659 -0
  87. package/src/mcp/tools/Component Puller/handler.js +63 -0
  88. package/src/mcp/tools/Dev Environment Creator/fetcher.js +500 -0
  89. package/src/mcp/tools/Dev Environment Creator/handler.js +92 -0
  90. package/src/mcp/tools/Dev Environment Creator/prompt.js +273 -0
  91. package/src/mcp/tools/Dev Environment Validator/handler.js +88 -0
  92. package/src/mcp/tools/Dev Environment Validator/prompt.js +193 -0
  93. package/src/mcp/tools/Developer Key Setup Guide/fetcher.js +278 -0
  94. package/src/mcp/tools/Developer Key Setup Guide/handler.js +43 -0
  95. package/src/mcp/tools/Developer Key Setup Guide/prompt.js +71 -0
  96. package/src/mcp/tools/Object Creator/handler.js +34 -0
  97. package/src/mcp/tools/Object Fields Creator/handler.js +64 -0
  98. package/src/mcp/tools/Object Fields Retriever/handler.js +37 -0
  99. package/src/mcp/tools/Object Fields Retriever/prompt.js +10 -0
  100. package/src/mcp/tools/Object List Retriever/handler.js +43 -0
  101. package/src/mcp/tools/Object List Retriever/prompt.js +10 -0
  102. package/src/mcp/tools/Scheduled Class Creator/handler.js +37 -0
  103. package/src/mcp/tools/Scheduled Class Detail Retriever/handler.js +34 -0
  104. package/src/mcp/tools/Scheduled Class List Retriever/handler.js +52 -0
  105. package/src/mcp/tools/Scheduled Class Publisher/handler.js +30 -0
  106. package/src/mcp/tools/Scheduled Class Puller/handler.js +92 -0
  107. package/src/mcp/tools/Trigger Creator/handler.js +53 -0
  108. package/src/mcp/tools/Trigger Detail Retriever/handler.js +33 -0
  109. package/src/mcp/tools/Trigger Editor Guide/handler.js +58 -0
  110. package/src/mcp/tools/Trigger List Retriever/handler.js +49 -0
  111. package/src/mcp/tools/Trigger Publisher/handler.js +34 -0
  112. package/src/mcp/tools/Trigger Puller/handler.js +40 -0
  113. package/src/mcp/tools/ccdk/fetcher.js +18 -0
  114. package/src/mcp/tools/ccdk/handler.js +98 -0
  115. package/src/mcp/tools/ccdk/prompt.js +453 -0
  116. package/src/mcp/tools/index.js +23 -0
  117. package/src/object/create.js +105 -0
  118. package/src/object/get.js +43 -4
  119. package/src/object/index.js +2 -1
  120. package/src/plugin/create.js +1 -2
  121. package/src/plugin/create1.js +9 -9
  122. package/src/plugin/detail.js +91 -0
  123. package/src/plugin/get.js +79 -0
  124. package/src/plugin/index.js +4 -1
  125. package/src/plugin/publish.js +13 -13
  126. package/src/plugin/publish1.js +33 -24
  127. package/src/plugin/pull.js +173 -0
  128. package/src/project/create.js +9 -9
  129. package/src/project/create1.js +31 -17
  130. package/src/recordType/get.js +4 -2
  131. package/src/script/create.js +7 -7
  132. package/src/script/detail.js +95 -0
  133. package/src/script/get.js +4 -2
  134. package/src/script/index.js +1 -0
  135. package/src/script/publish.js +14 -14
  136. package/src/script/pull.js +12 -12
  137. package/src/script/pullList.js +5 -3
  138. package/src/timer/create.js +7 -7
  139. package/src/timer/detail.js +84 -0
  140. package/src/timer/get.js +6 -3
  141. package/src/timer/publish.js +7 -7
  142. package/src/timer/pull.js +8 -8
  143. package/src/timer/pullList.js +5 -3
  144. package/src/token/get.js +1 -1
  145. package/src/triggers/create.js +7 -7
  146. package/src/triggers/detail.js +90 -0
  147. package/src/triggers/get.js +4 -2
  148. package/src/triggers/index.js +1 -0
  149. package/src/triggers/publish.js +7 -7
  150. package/src/triggers/pull.js +8 -8
  151. package/src/triggers/pullList.js +5 -3
  152. package/src/version/get.js +3 -3
  153. package/target/ccopenapi-0.0.3-classes.jar +0 -0
  154. package/target/ccopenapi-0.0.3.jar +0 -0
  155. package/target/maven-archiver/pom.properties +3 -0
  156. package/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst +18 -0
  157. package/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +19 -0
  158. package/template/Appvue +452 -12
  159. package/template/index.js +30 -19
  160. package/tool/branch/index.js +1 -1
  161. package/tool/checkLange/checkLang.js +6 -6
  162. package/tool/checkLange/clearLang.js +1 -1
  163. package/utils/accessClass.js +23 -0
  164. package/utils/checkVersion.js +22 -20
  165. package/utils/config.js +18 -3
  166. package/utils/http.js +10 -10
  167. package/utils/utils.js +128 -40
  168. package/java/com/cloudcc/core/CCTriggerDemo.java +0 -25
  169. package/src/classes/create.js +0 -65
  170. package/src/classes/get.js +0 -21
  171. package/src/classes/index.js +0 -11
  172. package/src/classes/publish.js +0 -50
  173. package/src/classes/pull.js +0 -54
  174. package/src/classes/pullList.js +0 -44
@@ -0,0 +1,278 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * CloudCC 安全标记知识库爬取脚本
5
+ * 功能:从官方文档网页爬取安全标记使用指南,生成结构化 JavaScript 知识库
6
+ *
7
+ * 特性:
8
+ * - 自动网页爬取和 HTML 解析
9
+ * - 安全标记分类和详细说明
10
+ * - 错误重试和容错机制
11
+ * - 元数据管理(版本、更新时间、来源)
12
+ */
13
+
14
+ const https = require('https');
15
+ const http = require('http');
16
+ const cheerio = require('cheerio');
17
+ const fs = require('fs').promises;
18
+ const path = require('path');
19
+
20
+ // ======================== 配置 ========================
21
+ const CONFIG = {
22
+ SOURCE_URL: 'https://help.cloudcc.cn/devlearn01/huo-qu-an-quan-biao-ji/',
23
+ OUTPUT_FILE: path.join(__dirname, './prompt.js'),
24
+ TIMEOUT: 10000,
25
+ MAX_RETRIES: 3,
26
+ CACHE_DURATION: 7 * 24 * 60 * 60 * 1000, // 7 天
27
+ };
28
+
29
+ // HTML 转义工具
30
+ function escapeHtml(text) {
31
+ return String(text)
32
+ .replace(/&/g, '&')
33
+ .replace(/</g, '&lt;')
34
+ .replace(/>/g, '&gt;')
35
+ .replace(/"/g, '&quot;')
36
+ .replace(/'/g, '&#039;');
37
+ }
38
+
39
+ // ======================== 日志工具 ========================
40
+ const logger = {
41
+ log: (msg) => console.error(`ℹ️ ${msg}`),
42
+ success: (msg) => console.error(`✅ ${msg}`),
43
+ error: (msg) => console.error(`❌ ${msg}`),
44
+ warn: (msg) => console.warn(`⚠️ ${msg}`),
45
+ info: (msg) => console.error(`📝 ${msg}`),
46
+ };
47
+
48
+ // ======================== HTTP 请求 ========================
49
+ async function fetchPage(url, retries = 0) {
50
+ return new Promise((resolve, reject) => {
51
+ try {
52
+ logger.log(`正在获取 ${url}...`);
53
+
54
+ const urlObj = new URL(url);
55
+ const protocol = urlObj.protocol === 'https:' ? https : http;
56
+
57
+ const options = {
58
+ hostname: urlObj.hostname,
59
+ port: urlObj.port,
60
+ path: urlObj.pathname + urlObj.search,
61
+ method: 'GET',
62
+ headers: {
63
+ 'User-Agent': 'Mozilla/5.0 (Node.js MCP Bot) CloudCC-Key-Guide/1.0',
64
+ },
65
+ timeout: CONFIG.TIMEOUT,
66
+ };
67
+
68
+ const req = protocol.request(options, (res) => {
69
+ // 处理重定向
70
+ if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
71
+ const redirectUrl = new URL(res.headers.location, url).href;
72
+ logger.info(`重定向到: ${redirectUrl}`);
73
+ return fetchPage(redirectUrl, retries).then(resolve).catch(reject);
74
+ }
75
+
76
+ if (res.statusCode !== 200) {
77
+ return reject(new Error(`HTTP ${res.statusCode}: ${res.statusMessage}`));
78
+ }
79
+
80
+ let html = '';
81
+ res.setEncoding('utf8');
82
+ res.on('data', (chunk) => {
83
+ html += chunk;
84
+ });
85
+ res.on('end', () => {
86
+ logger.success(`网页获取成功 (${html.length} 字节)`);
87
+ resolve(html);
88
+ });
89
+ });
90
+
91
+ req.on('error', (error) => {
92
+ reject(error);
93
+ });
94
+
95
+ req.on('timeout', () => {
96
+ req.destroy();
97
+ reject(new Error('请求超时'));
98
+ });
99
+
100
+ req.end();
101
+ } catch (error) {
102
+ reject(error);
103
+ }
104
+ }).catch(async (error) => {
105
+ if (retries < CONFIG.MAX_RETRIES) {
106
+ logger.warn(`请求失败: ${error.message},${retries + 1}/${CONFIG.MAX_RETRIES} 重试...`);
107
+ await new Promise(r => setTimeout(r, 1000 * (retries + 1)));
108
+ return fetchPage(url, retries + 1);
109
+ }
110
+ throw new Error(`获取网页失败(已重试 ${CONFIG.MAX_RETRIES} 次): ${error.message}`);
111
+ });
112
+ }
113
+
114
+ // ======================== HTML 解析 ========================
115
+ function parseKeyGuideContent(html) {
116
+ const $ = cheerio.load(html);
117
+ const guides = [];
118
+
119
+ logger.log('开始解析 HTML...');
120
+
121
+ // 提取所有主要内容块(h2 为标题)
122
+ const h2Elements = $('h2').toArray();
123
+
124
+ h2Elements.forEach((elem, idx) => {
125
+ const title = $(elem).text().trim();
126
+
127
+ if (!title) return;
128
+
129
+ let content = '';
130
+ let description = '';
131
+ const examples = [];
132
+ const tags = [];
133
+ const references = [];
134
+
135
+ let currentElem = $(elem).next();
136
+ const nextH2Idx = h2Elements.findIndex((e, i) => i > idx);
137
+ const nextH2 = nextH2Idx >= 0 ? h2Elements[nextH2Idx] : null;
138
+
139
+ while (currentElem.length && (!nextH2 || !currentElem.is(nextH2))) {
140
+ const tag = currentElem[0]?.name;
141
+
142
+ // 处理段落(描述文本)
143
+ if (tag === 'p') {
144
+ const text = currentElem.text().trim();
145
+ if (description.length < 300) {
146
+ description += (description ? ' ' : '') + text;
147
+ }
148
+ content += `<p>${$(currentElem).html()}</p>\n`;
149
+ }
150
+
151
+ // 处理代码块/示例
152
+ if (tag === 'pre' || tag === 'code') {
153
+ const codeText = currentElem.text().trim();
154
+ if (codeText) {
155
+ content += `<pre><code>${escapeHtml(codeText)}</code></pre>\n`;
156
+ }
157
+ }
158
+
159
+ // 处理列表
160
+ if (tag === 'ul' || tag === 'ol') {
161
+ content += `<${tag}>${$(currentElem).html()}</${tag}>\n`;
162
+ }
163
+
164
+ // 处理强调文本
165
+ if (tag === 'strong' || tag === 'em') {
166
+ content += currentElem.html();
167
+ }
168
+
169
+ currentElem = currentElem.next();
170
+ }
171
+
172
+ // 清理描述文本
173
+ description = description
174
+ .replace(/[💡⚠️✅❌📝ℹ️📥📊🎯]/g, '')
175
+ .trim()
176
+ .substring(0, 300);
177
+
178
+ // 构建指南对象(简化版)
179
+ const guide = {
180
+ title: title,
181
+ description: description || title,
182
+ content: content.trim(),
183
+ };
184
+
185
+ guides.push(guide);
186
+ logger.info(`✓ 指南: ${title}`);
187
+ });
188
+
189
+ return guides;
190
+ }
191
+
192
+ // ======================== 辅助函数 ========================
193
+ // 已移除,简化解析逻辑
194
+
195
+ // ======================== JavaScript 代码生成 ========================
196
+
197
+ function generateJavaScriptCode(guides) {
198
+ const now = new Date().toISOString();
199
+ const metadata = {
200
+ title: 'CloudCC 安全标记知识库',
201
+ description: '详细的安全标记使用指南,涵盖开发者密钥、安全标记配置等安全相关主题',
202
+ sourceUrl: CONFIG.SOURCE_URL,
203
+ generatedAt: now,
204
+ version: '1.0.0',
205
+ };
206
+
207
+ const guidesJson = JSON.stringify(guides, null, 2);
208
+ const metadataJson = JSON.stringify(metadata, null, 2);
209
+
210
+ const code = `/**
211
+ * CloudCC 安全标记知识库
212
+ *
213
+ * 自动生成的文件,请勿手动修改
214
+ * 生成时间: ${now}
215
+ * 来源: ${CONFIG.SOURCE_URL}
216
+ */
217
+
218
+ const metadata = ${metadataJson};
219
+
220
+ const guides = ${guidesJson};
221
+
222
+ const knowledge = {
223
+ ...metadata,
224
+ guides,
225
+ };
226
+
227
+ // 导出知识库
228
+ module.exports = knowledge;
229
+ `;
230
+
231
+ return code;
232
+ }
233
+
234
+ // ======================== 主函数 ========================
235
+
236
+ async function main() {
237
+ try {
238
+ logger.log('🚀 CloudCC 安全标记知识库爬取脚本启动');
239
+ logger.info(`源 URL: ${CONFIG.SOURCE_URL}`);
240
+ logger.info(`输出文件: ${CONFIG.OUTPUT_FILE}`);
241
+
242
+ // 1. 获取网页
243
+ const html = await fetchPage(CONFIG.SOURCE_URL);
244
+
245
+ // 2. 解析网页
246
+ const guides = parseKeyGuideContent(html);
247
+
248
+ if (guides.length === 0) {
249
+ throw new Error('未能解析到任何指南,请检查网页结构');
250
+ }
251
+
252
+ logger.success(`成功解析 ${guides.length} 个指南`);
253
+
254
+ // 3. 生成 JavaScript 代码
255
+ const jsCode = generateJavaScriptCode(guides);
256
+
257
+ // 4. 写入文件
258
+ await fs.writeFile(CONFIG.OUTPUT_FILE, jsCode, 'utf-8');
259
+ logger.success(`成功生成 ${CONFIG.OUTPUT_FILE}`);
260
+
261
+ // 5. 统计信息
262
+ const totalContent = guides.reduce((sum, g) => sum + g.content.length, 0);
263
+
264
+ logger.log('📊 爬取统计:');
265
+ console.error(` - 指南数: ${guides.length}`);
266
+ console.error(` - 总内容大小: ${(totalContent / 1024).toFixed(2)} KB`);
267
+ console.error(` - 文件大小: ${(jsCode.length / 1024).toFixed(2)} KB`);
268
+
269
+ logger.success('✨ 爬取完成!');
270
+
271
+ } catch (error) {
272
+ logger.error(error.message);
273
+ process.exit(1);
274
+ }
275
+ }
276
+
277
+ // 执行
278
+ main();
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Key Guide Handler
3
+ * 处理安全标记知识库相关的查询
4
+ * 通过关键词匹配返回所有相关内容
5
+ */
6
+
7
+ const knowledge = require('./prompt.js');
8
+
9
+ /**
10
+ * 获取安全标记知识库的完整指南
11
+ * @returns {Object}
12
+ */
13
+ function getKeyGuide() {
14
+ // 格式化输出所有指南
15
+ let output = `# ${knowledge.title}\n\n`;
16
+ output += `${knowledge.description}\n\n`;
17
+ output += `**来源**: ${knowledge.sourceUrl}\n`;
18
+ output += `**更新时间**: ${knowledge.generatedAt}\n\n`;
19
+ output += `---\n\n`;
20
+
21
+ // 输出每个指南
22
+ knowledge.guides.forEach((guide, index) => {
23
+ if (guide.title && guide.content) {
24
+ output += `## ${index + 1}. ${guide.title}\n\n`;
25
+ if (guide.description && guide.description !== guide.title) {
26
+ output += `${guide.description}\n\n`;
27
+ }
28
+ output += `${guide.content}\n\n`;
29
+ output += `---\n\n`;
30
+ }
31
+ });
32
+
33
+ return {
34
+ content: [{
35
+ type: 'text',
36
+ text: output
37
+ }]
38
+ };
39
+ }
40
+
41
+ module.exports = {
42
+ getKeyGuide
43
+ };
@@ -0,0 +1,71 @@
1
+ /**
2
+ * CloudCC 安全标记知识库
3
+ *
4
+ * 自动生成的文件,请勿手动修改
5
+ * 生成时间: 2025-12-04T12:06:58.620Z
6
+ * 来源: https://help.cloudcc.cn/devlearn01/huo-qu-an-quan-biao-ji/
7
+ */
8
+
9
+ const metadata = {
10
+ "title": "CloudCC 安全标记知识库",
11
+ "description": "详细的安全标记使用指南,涵盖开发者密钥、安全标记配置等安全相关主题",
12
+ "sourceUrl": "https://help.cloudcc.cn/devlearn01/huo-qu-an-quan-biao-ji/",
13
+ "generatedAt": "2025-12-04T12:06:58.620Z",
14
+ "version": "1.0.0"
15
+ };
16
+
17
+ const guides = [
18
+ {
19
+ "title": "获取开发者密钥",
20
+ "description": "获取开发者密钥,包括:safetyMark,CloudCCDev",
21
+ "content": ""
22
+ },
23
+ {
24
+ "title": "创建开发者账号",
25
+ "description": "1:访问CRM登录地址,使用系统管理账号登录到CRM系统,点击右上角齿轮,进入后台设置 2:选择菜单中的:用户管理——新建 3:重点:新建用户时,要分配具有开发者权限的简档 4:访问路径:管理用户——>简档——>对应的简档——>普通用户权限——>代码管理。确认此权限已经开启。",
26
+ "content": "<p>1:访问CRM登录地址,使用系统管理账号登录到CRM系统,点击右上角齿轮,进入后台设置</p>\n<p>2:选择菜单中的:用户管理——新建</p>\n<p>3:重点:新建用户时,要分配具有开发者权限的简档</p>\n<p>4:访问路径:管理用户——&gt;简档——&gt;对应的简档——&gt;普通用户权限——&gt;代码管理。确认此权限已经开启。</p>"
27
+ },
28
+ {
29
+ "title": "获取密钥",
30
+ "description": "1:访问CRM登录地址,使用开发者账号登录CRM系统,点击右上角齿轮,访问后台设置 2:选择用户及控制——安全性控制——连接的应用程序——新建 3:按要求填写:连接的应用程序名称,API名称,联系人电子邮件 4:创建好之后,进入详情页,点击CloudCC Dev后面的复制按钮,保留备用。",
31
+ "content": "<p>1:访问CRM登录地址,使用开发者账号登录CRM系统,点击右上角齿轮,访问后台设置</p>\n<p>2:选择用户及控制——安全性控制——连接的应用程序——新建</p>\n<p>3:按要求填写:连接的应用程序名称,API名称,联系人电子邮件</p>\n<p>4:创建好之后,进入详情页,点击CloudCC Dev后面的复制按钮,保留备用。</p>"
32
+ },
33
+ {
34
+ "title": "获取安全标记",
35
+ "description": "1:访问CRM登录地址,使用开发者账号,登录CRM,访问后台设置 2:访问 常规 → 个人设置 → 重置我的安全标记。点击后,安全标记将发送到个人信息中所配置的邮箱。。",
36
+ "content": "<p>1:访问CRM登录地址,使用开发者账号,登录CRM,访问后台设置</p>\n<p>2:访问 <strong>常规 → 个人设置 → 重置我的安全标记</strong>。点击后,安全标记将发送到个人信息中所配置的邮箱。。</p>"
37
+ },
38
+ {
39
+ "title": "配置密钥",
40
+ "description": "1:打开模版项目,打开根目录中的cloudcc-cli.config.js文件,将刚刚获取的2个密钥配置到对应的变量上。",
41
+ "content": "<p>1:打开模版项目,打开根目录中的cloudcc-cli.config.js文件,将刚刚获取的2个密钥配置到对应的变量上。</p>\n<pre><code>module.exports =\n{ // 使用dev环境\n &quot;use&quot;: &quot;dev&quot;,\n // dev环境密钥\n &quot;dev&quot;: {\n &quot;safetyMark&quot;: &quot;安全标记&quot;,\n &quot;CloudCCDev&quot;: &quot;开发者密钥&quot;\n },\n // prod环境密钥\n &quot;prod&quot;: {\n &quot;safetyMark&quot;: &quot;安全标记&quot;,\n &quot;CloudCCDev&quot;: &quot;开发者密钥&quot;\n },\n}</code></pre>"
42
+ },
43
+ {
44
+ "title": "私有云特殊配置",
45
+ "description": "私有云特殊配置",
46
+ "content": "<ul><li>私有云除了以上2个配置还需要加入一个配置,用户标记为私有云环境</li></ul>\n<pre><code>module.exports =\n{ // 使用dev环境\n &quot;use&quot;: &quot;dev&quot;,\n // dev环境密钥\n &quot;dev&quot;: {\n &quot;safetyMark&quot;: &quot;安全标记&quot;,\n &quot;CloudCCDev&quot;: &quot;开发者密钥&quot;,\n &quot;version&quot;:&quot;private&quot;\n },\n // prod环境密钥\n &quot;prod&quot;: {\n &quot;safetyMark&quot;: &quot;安全标记&quot;,\n &quot;CloudCCDev&quot;: &quot;开发者密钥&quot;,\n &quot;version&quot;:&quot;private&quot;\n },\n}</code></pre>"
47
+ },
48
+ {
49
+ "title": "特殊配置",
50
+ "description": "特殊配置",
51
+ "content": "<pre><code>&quot;dev&quot;: {\n // 服务访问地址:\n // 国内默认:https://developer.apis.cloudcc.cn\n // 海外默认:https://developer.apis.cloudcc.com\n // 私有云:登录CRM系统,页面鼠标右键,选择检查,选择控制台,输入以下代码获取:$CCDK.CCConfig.getBaseUrl()\n &quot;baseUrl&quot;: &quot;http://xxx&quot;,\n // 组件进入后台,销毁时间,设置10分钟销毁10*60*1000\n &quot;destroyTimeout&quot;: 600000,\n // 开发者平台在网关配置的前缀名,注意url不要以/结尾\n &quot;devSvcDispatch&quot;:&quot;/devconsole&quot;,\n // api-service-svc访问网关前缀地址,注意url不要以/结尾\n &quot;apiSvcPrefix&quot;:&quot;/xxx&quot;,\n // setup-svc访问网关前缀地址,注意url不要以/结尾\n &quot;setupSvcPrefix&quot;:&quot;/xxx&quot;\n},</code></pre>"
52
+ },
53
+ {
54
+ "title": "多环境配置",
55
+ "description": "cloudcc-cli.config.js支持配置多个环境信息,use用于区分使用哪个环境。",
56
+ "content": "<p>cloudcc-cli.config.js支持配置多个环境信息,use用于区分使用哪个环境。</p>\n<pre><code>module.exports = { \n // 使用dev环境密钥,与dev连接\n &quot;use&quot;: &quot;dev&quot;, \n // dev环境密钥\n &quot;dev&quot;: { &quot;safetyMark&quot;: &quot;xxx&quot;, &quot;CloudCCDev&quot;: &quot;xxx&quot; }, \n // prod环境密钥\n &quot;prod&quot;: { &quot;safetyMark&quot;: &quot;xxx&quot;, &quot;CloudCCDev&quot;: &quot;xxx&quot; } \n}</code></pre>"
57
+ },
58
+ {
59
+ "title": "On this page",
60
+ "description": "On this page",
61
+ "content": ""
62
+ }
63
+ ];
64
+
65
+ const knowledge = {
66
+ ...metadata,
67
+ guides,
68
+ };
69
+
70
+ // 导出知识库
71
+ module.exports = knowledge;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Custom Object Creator Handler
3
+ * 提供创建自定义对象的 MCP 工具实现
4
+ */
5
+
6
+ const path = require('path');
7
+
8
+ /**
9
+ * 创建自定义对象
10
+ * @param {{label: string, projectPath?: string}} params
11
+ */
12
+ async function createCustomObject(params = {}) {
13
+ const { label, projectPath } = params;
14
+ if (!label) {
15
+ return { content: [{ type: 'text', text: '✗ 参数缺失: label (对象标签) 必须提供' }] };
16
+ }
17
+
18
+ const targetPath = projectPath || '.';
19
+ const resolvedPath = path.resolve(targetPath);
20
+ // 如果 label 包含空格或特殊字符,加双引号保护
21
+ const safeLabel = /\s/.test(label) ? `"${label}"` : label;
22
+ const command = `npx cc create object ${targetPath} ${safeLabel}`;
23
+
24
+ return {
25
+ content: [{
26
+ type: 'text',
27
+ text: `✓ 自定义对象创建命令已生成!\n\n对象标签: ${label}\n项目目录(解析后): ${resolvedPath}\n\n请运行以下命令以创建对象:\n\n${command}\n\n创建过程:\n1. 生成对象的 schema 文件\n2. 配置对象权限\n3. 部署到 CloudCC 系统`
28
+ }]
29
+ };
30
+ }
31
+
32
+ module.exports = {
33
+ createCustomObject
34
+ };
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Field Creator Handler
3
+ * 提供创建对象字段的 MCP 工具实现
4
+ */
5
+
6
+ const path = require('path');
7
+ const fieldsCreate = require('../../../fields/create');
8
+
9
+ /**
10
+ * 创建对象字段
11
+ * @param {{
12
+ * objid: string,
13
+ * fieldType: string,
14
+ * nameLabel: string,
15
+ * ptext: string,
16
+ * lookupObj: string,
17
+ * projectPath?: string
18
+ * }} params
19
+ */
20
+ async function createObjectField(params = {}) {
21
+ try {
22
+ let result = null;
23
+ const resolvedPath = path.resolve(params.projectPath);
24
+ let argv = null;
25
+ if ("Y" == params.fieldType || "MR" == params.fieldType || "M" == params.fieldType) {
26
+ const { objid, fieldType, nameLabel, lookupObj } = params;
27
+ argv = [null, null, resolvedPath, fieldType, objid, nameLabel, lookupObj];
28
+ } else if ("L" == params.fieldType || "Q" == params.fieldType) {
29
+ const { objid, fieldType, nameLabel, ptext } = params;
30
+ argv = [null, null, resolvedPath, fieldType, objid, nameLabel, ptext];
31
+ } else {
32
+ const { objid, fieldType, nameLabel } = params;
33
+ argv = [null, null, resolvedPath, fieldType, objid, nameLabel];
34
+ }
35
+ result = await fieldsCreate(argv);
36
+
37
+ if (result) {
38
+ return {
39
+ content: [{
40
+ type: 'text',
41
+ text: `✓ 字段创建成功!`
42
+ }]
43
+ };
44
+ } else {
45
+ return {
46
+ content: [{
47
+ type: 'text',
48
+ text: `⚠ 字段创建遇到问题\n\n请检查:\n1. 对象ID是否正确\n2. 字段名称是否符合规范\n3. CloudCC服务器连接是否正常\n4. 项目配置是否正确`
49
+ }]
50
+ };
51
+ }
52
+ } catch (error) {
53
+ return {
54
+ content: [{
55
+ type: 'text',
56
+ text: `✗ 字段创建失败: ${error.message}\n\n错误详情:\n${error.stack || '无详细信息'}`
57
+ }]
58
+ };
59
+ }
60
+ }
61
+
62
+ module.exports = {
63
+ createObjectField
64
+ };
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Object Fields Retriever Handler
3
+ * 查询某个对象的字段列表(通过 objprefix 或 JSON 对象)
4
+ */
5
+
6
+ const path = require('path');
7
+ const fieldsGet = require('../../../fields/get');
8
+
9
+ /**
10
+ * 获取对象字段
11
+ * @param {{ objprefix?: string, projectPath?: string, object?: object|string }} params
12
+ */
13
+ async function getFields(params = {}) {
14
+ try {
15
+ const { objprefix, projectPath = process.cwd() } = params;
16
+ const resolvedPath = path.resolve(projectPath);
17
+
18
+ // Support both object JSON and raw prefix paramters. Prefer explicit object when provided.
19
+ let arg = objprefix
20
+ if (!arg) {
21
+ return { content: [{ type: 'text', text: '✗ 缺少参数: 需要 objprefix' }] };
22
+ }
23
+
24
+ const argv = [null, null, resolvedPath, objprefix];
25
+ const res = await fieldsGet(argv, true);
26
+
27
+ if (!res || (Array.isArray(res) && res.length === 0)) {
28
+ return { content: [{ type: 'text', text: '未找到任何字段' }] };
29
+ }
30
+
31
+ return { content: [{ type: 'text', text: JSON.stringify(res) }] };
32
+ } catch (error) {
33
+ return { content: [{ type: 'text', text: `✗ 查询失败: ${error.message}` }] };
34
+ }
35
+ }
36
+
37
+ module.exports = { getFields };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Object Fields Retriever prompt / knowledge metadata
3
+ */
4
+ const metadata = {
5
+ title: '查询对象字段 - CloudCC',
6
+ description: '通过对象前缀或对象描述 JSON 查询对象字段列表(包括字段名称和 API 名称)',
7
+ version: '1.0.0'
8
+ }
9
+
10
+ module.exports = metadata;
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Object List Retriever Handler
3
+ * 用于查询 CloudCC 中的对象:标准对象、自定义对象或两者
4
+ */
5
+
6
+ const path = require('path');
7
+ const objectGet = require('../../../object/get');
8
+ /**
9
+ * 列出对象
10
+ * @param {{ type?: 'standard'|'custom'|'both', projectPath?: string }} params
11
+ */
12
+ async function listObjects(params = {}) {
13
+ try {
14
+ const { type = 'both', projectPath = process.cwd() } = params;
15
+ const resolvedPath = path.resolve(projectPath);
16
+
17
+ // Map our 'both' to no explicit type to get the combined list
18
+ const getType = type === 'both' ? undefined : type;
19
+
20
+ const argv = [null, null, resolvedPath, getType];
21
+ const objList = await objectGet(argv, true);
22
+ if (!objList || objList.length === 0) {
23
+ return { content: [{ type: 'text', text: '未找到任何对象' }] };
24
+ }
25
+ // no limit: list all objects
26
+ return { content: [{ type: 'text', text: JSON.stringify(objList) }] };
27
+ } catch (error) {
28
+ return { content: [{ type: 'text', text: `✗ 查询失败: ${error.message}` }] };
29
+ }
30
+ }
31
+
32
+ module.exports = {
33
+ listObjects
34
+ };
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Object List Retriever prompt / knowledge metadata
3
+ */
4
+ const metadata = {
5
+ title: '查询对象列表 - CloudCC',
6
+ description: '查询 CloudCC 中的对象列表,支持标准对象、自定义对象或两者。',
7
+ version: '1.0.0'
8
+ }
9
+
10
+ module.exports = metadata;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Scheduled Class Creator 工具处理器
3
+ * 创建定时类
4
+ */
5
+
6
+ const path = require('path');
7
+ const createScheduleModule = require('../../../timer/create');
8
+
9
+ /**
10
+ * 创建定时类
11
+ */
12
+ async function createSchedule({ scheduleName, projectPath = process.cwd() }) {
13
+ try {
14
+ // 临时改变工作目录以兼容原有模块
15
+ const originalCwd = process.cwd();
16
+ process.chdir(projectPath);
17
+
18
+ try {
19
+ await createScheduleModule(scheduleName);
20
+ const schedulePath = path.resolve(projectPath, `schedule/${scheduleName}`);
21
+ return {
22
+ content: [{
23
+ type: 'text',
24
+ text: `✓ 创建成功!\n\n定时类路径: ${schedulePath}\n生成的文件:\n - ${scheduleName}.java (主类文件,继承 CCSchedule)\n - config.json (配置文件)\n\n定时类与自定义类的区别:\n - 定时类继承 CCSchedule,用于定时任务执行\n - 代码写在构造函数中,系统会按设定的时间调度执行`
25
+ }]
26
+ };
27
+ } finally {
28
+ process.chdir(originalCwd);
29
+ }
30
+ } catch (error) {
31
+ return { content: [{ type: 'text', text: `✗ 创建失败: ${error.message}` }] };
32
+ }
33
+ }
34
+
35
+ module.exports = {
36
+ createSchedule
37
+ };
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Scheduled Class Detail Retriever 工具处理器
3
+ * 获取定时类的详细信息
4
+ */
5
+
6
+ const detailModule = require('../../../timer/detail');
7
+
8
+ /**
9
+ * 获取定时类详细信息
10
+ * @param {Object} params - 参数对象
11
+ * @param {string} params.scheduleName - 定时类名(可选,优先使用)
12
+ * @param {string} params.scheduleId - 定时类ID(可选,当没有scheduleName时使用)
13
+ * @param {string} params.projectPath - 项目路径(可选,默认为当前工作目录)
14
+ */
15
+ async function getScheduleDetail({ scheduleName, scheduleId, projectPath = process.cwd() }) {
16
+ try {
17
+ const originalCwd = process.cwd();
18
+ process.chdir(projectPath);
19
+
20
+ try {
21
+ const detail = await detailModule(scheduleName, scheduleId);
22
+ return { content: [{ type: 'text', text: JSON.stringify(detail, null, 2) }] };
23
+ } finally {
24
+ process.chdir(originalCwd);
25
+ }
26
+ } catch (error) {
27
+ return { content: [{ type: 'text', text: `✗ 获取失败: ${error.message}` }] };
28
+ }
29
+ }
30
+
31
+ module.exports = {
32
+ getScheduleDetail
33
+ };
34
+