cloudcc-cli 2.2.3 → 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.
- package/.vscode/settings.json +3 -0
- package/README.md +35 -0
- package/bin/cc.js +11 -36
- package/bin/index.js +33 -0
- package/bin/mcp-svc.js +13 -0
- package/java/com/cloudcc/core/TriggerInvoker.java +17 -1
- package/package.json +3 -2
- package/pom.xml +1 -0
- package/prompt/DevelopmentEnvironmentConstruction.ts +133 -0
- package/prompt/ccdk.ts +1190 -0
- package/prompt/ccprompt.ts +8 -0
- package/prompt/cloudccdev.ts +109 -0
- package/prompt/index.ts +52 -0
- package/prompt/objectInfo.ts +94 -0
- package/prompt/objectList.ts +25 -0
- package/prompt/openapi.ts +310 -0
- package/prompt/system.ts +14 -0
- package/prompt/vscodeExtension.ts +27 -0
- package/src/approval/approve.js +105 -0
- package/src/approval/get.js +245 -0
- package/src/approval/index.js +11 -0
- package/src/approval/reject.js +105 -0
- package/src/brief/get.js +51 -0
- package/src/brief/index.js +7 -0
- package/src/config/get.js +1 -1
- package/src/fields/create.js +204 -0
- package/src/fields/fields/A.js +23 -0
- package/src/fields/fields/AD.js +25 -0
- package/src/fields/fields/B.js +28 -0
- package/src/fields/fields/C.js +28 -0
- package/src/fields/fields/D.js +27 -0
- package/src/fields/fields/E.js +28 -0
- package/src/fields/fields/ENC.js +28 -0
- package/src/fields/fields/ENCD.js +28 -0
- package/src/fields/fields/F.js +27 -0
- package/src/fields/fields/FL.js +25 -0
- package/src/fields/fields/H.js +27 -0
- package/src/fields/fields/IMG.js +27 -0
- package/src/fields/fields/J.js +26 -0
- package/src/fields/fields/L.js +32 -0
- package/src/fields/fields/LT.js +28 -0
- package/src/fields/fields/M.js +29 -0
- package/src/fields/fields/MR.js +24 -0
- package/src/fields/fields/N.js +30 -0
- package/src/fields/fields/P.js +28 -0
- package/src/fields/fields/Q.js +35 -0
- package/src/fields/fields/S.js +30 -0
- package/src/fields/fields/SCORE.js +24 -0
- package/src/fields/fields/T.js +27 -0
- package/src/fields/fields/U.js +28 -0
- package/src/fields/fields/X.js +28 -0
- package/src/fields/fields/Y.js +33 -0
- package/src/fields/get.js +36 -0
- package/src/fields/index.js +9 -0
- package/src/mcp/MCP/345/234/272/346/231/257/346/250/241/346/213/237.md +8 -0
- package/src/mcp/index-sse-svc.js +126 -0
- package/src/mcp/index-streamable-svc.js +180 -0
- package/src/mcp/index.js +519 -115
- package/src/mcp/readme.md +75 -70
- package/src/mcp/tools/Approval/handler.js +349 -0
- package/src/mcp/tools/Class Creator/handler.js +37 -0
- package/src/mcp/tools/Class Detail Retriever/handler.js +33 -0
- package/src/mcp/tools/Class Detail Retriever/prompt.js +37 -0
- package/src/mcp/tools/Class Editor Guide/handler.js +72 -0
- package/src/mcp/tools/Class Editor Guide/prompt.js +468 -0
- package/src/mcp/tools/Class List Retriever/handler.js +36 -0
- package/src/mcp/tools/Class Publisher/handler.js +29 -0
- package/src/mcp/tools/Class Publisher/prompt.js +40 -0
- package/src/mcp/tools/Class Puller/handler.js +86 -0
- package/src/mcp/tools/Class Puller/prompt.js +49 -0
- package/src/mcp/tools/Client Script Creator/handler.js +179 -0
- package/src/mcp/tools/Client Script Detail Retriever/handler.js +53 -0
- package/src/mcp/tools/Client Script Editor Guide/handler.js +633 -0
- package/src/mcp/tools/Client Script List Retriever/handler.js +68 -0
- package/src/mcp/tools/Client Script Publisher/handler.js +54 -0
- package/src/mcp/tools/Client Script Puller/handler.js +73 -0
- package/src/mcp/tools/CloudCC Development Overview/handler.js +48 -0
- package/src/mcp/tools/CloudCC Development Overview/prompt.js +870 -0
- package/src/mcp/tools/Component Creator/handler.js +44 -0
- package/src/mcp/tools/Component Detail Retriever/handler.js +38 -0
- package/src/mcp/tools/Component Editor Guide/handler.js +76 -0
- package/src/mcp/tools/Component Editor Guide/prompt.js +519 -0
- package/src/mcp/tools/Component List Retriever/handler.js +43 -0
- package/src/mcp/tools/Component Publisher/handler.js +18 -0
- package/src/mcp/tools/Component Puller/handler.js +63 -0
- package/src/mcp/tools/{dev-env/fetcher.js → Dev Environment Creator/fetcher.js } +8 -8
- package/src/mcp/tools/{dev-env/prompt.js → Dev Environment Creator/prompt.js } +19 -2
- package/src/mcp/tools/Dev Environment Validator/handler.js +88 -0
- package/src/mcp/tools/Dev Environment Validator/prompt.js +193 -0
- package/src/mcp/tools/{key-guide/fetcher.js → Developer Key Setup Guide/fetcher.js } +7 -7
- package/src/mcp/tools/{key-guide/prompt.js → Developer Key Setup Guide/prompt.js } +3 -3
- package/src/mcp/tools/Object Creator/handler.js +34 -0
- package/src/mcp/tools/Object Fields Creator/handler.js +64 -0
- package/src/mcp/tools/Object Fields Retriever/handler.js +37 -0
- package/src/mcp/tools/Object Fields Retriever/prompt.js +10 -0
- package/src/mcp/tools/Object List Retriever/handler.js +43 -0
- package/src/mcp/tools/Object List Retriever/prompt.js +10 -0
- package/src/mcp/tools/Scheduled Class Creator/handler.js +37 -0
- package/src/mcp/tools/Scheduled Class Detail Retriever/handler.js +34 -0
- package/src/mcp/tools/Scheduled Class List Retriever/handler.js +52 -0
- package/src/mcp/tools/Scheduled Class Publisher/handler.js +30 -0
- package/src/mcp/tools/Scheduled Class Puller/handler.js +92 -0
- package/src/mcp/tools/Trigger Creator/handler.js +53 -0
- package/src/mcp/tools/Trigger Detail Retriever/handler.js +33 -0
- package/src/mcp/tools/Trigger Editor Guide/handler.js +58 -0
- package/src/mcp/tools/Trigger List Retriever/handler.js +49 -0
- package/src/mcp/tools/Trigger Publisher/handler.js +34 -0
- package/src/mcp/tools/Trigger Puller/handler.js +40 -0
- package/src/mcp/tools/ccdk/fetcher.js +3 -3
- package/src/mcp/tools/ccdk/prompt.js +2 -2
- package/src/mcp/tools/index.js +23 -0
- package/src/object/create.js +105 -0
- package/src/object/get.js +43 -4
- package/src/object/index.js +2 -1
- package/src/plugin/create1.js +8 -7
- package/src/plugin/detail.js +91 -0
- package/src/plugin/get.js +79 -0
- package/src/plugin/index.js +4 -1
- package/src/plugin/publish.js +13 -13
- package/src/plugin/publish1.js +30 -22
- package/src/plugin/pull.js +173 -0
- package/src/project/create.js +9 -9
- package/src/project/create1.js +31 -17
- package/src/recordType/get.js +4 -2
- package/src/script/create.js +7 -7
- package/src/script/detail.js +95 -0
- package/src/script/get.js +4 -2
- package/src/script/index.js +1 -0
- package/src/script/publish.js +14 -14
- package/src/script/pull.js +12 -12
- package/src/script/pullList.js +5 -3
- package/src/timer/create.js +7 -7
- package/src/timer/detail.js +84 -0
- package/src/timer/get.js +6 -3
- package/src/timer/publish.js +7 -7
- package/src/timer/pull.js +8 -8
- package/src/timer/pullList.js +5 -3
- package/src/token/get.js +1 -1
- package/src/triggers/create.js +7 -7
- package/src/triggers/detail.js +90 -0
- package/src/triggers/get.js +4 -2
- package/src/triggers/index.js +1 -0
- package/src/triggers/publish.js +7 -7
- package/src/triggers/pull.js +8 -8
- package/src/triggers/pullList.js +5 -3
- package/src/version/get.js +3 -3
- package/target/ccopenapi-0.0.3-classes.jar +0 -0
- package/target/ccopenapi-0.0.3.jar +0 -0
- package/target/maven-archiver/pom.properties +3 -0
- package/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst +18 -0
- package/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +19 -0
- package/template/Appvue +2 -2
- package/template/index.js +30 -19
- package/tool/branch/index.js +1 -1
- package/tool/checkLange/checkLang.js +6 -6
- package/tool/checkLange/clearLang.js +1 -1
- package/utils/accessClass.js +23 -0
- package/utils/checkVersion.js +22 -20
- package/utils/config.js +18 -3
- package/utils/http.js +10 -10
- package/utils/utils.js +97 -32
- package/java/com/cloudcc/core/CCTriggerDemo.java +0 -25
- package/src/classes/create.js +0 -66
- package/src/classes/get.js +0 -22
- package/src/classes/index.js +0 -11
- package/src/classes/publish.js +0 -51
- package/src/classes/pull.js +0 -55
- package/src/classes/pullList.js +0 -44
- package/src/mcp/tools/classes/handler.js +0 -358
- package/src/mcp/tools/classes/prompt.js +0 -1261
- package/src/mcp/tools/plugin/handler.js +0 -92
- /package/src/mcp/tools/{plugin → Component Publisher}/prompt.js +0 -0
- /package/src/mcp/tools/{dev-env → Dev Environment Creator}/handler.js +0 -0
- /package/src/mcp/tools/{key-guide → Developer Key Setup Guide}/handler.js +0 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Component List Retriever 工具处理器
|
|
3
|
+
* 提供自定义组件列表查询功能
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const getPluginModule = require('../../../plugin/get');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 获取自定义组件列表
|
|
10
|
+
*/
|
|
11
|
+
async function listCustomComponents({ projectPath = process.cwd() }) {
|
|
12
|
+
try {
|
|
13
|
+
const originalCwd = process.cwd();
|
|
14
|
+
process.chdir(projectPath);
|
|
15
|
+
|
|
16
|
+
try {
|
|
17
|
+
const componentList = await getPluginModule(['get', projectPath]);
|
|
18
|
+
|
|
19
|
+
if (!componentList || componentList.length === 0) {
|
|
20
|
+
return {
|
|
21
|
+
content: [{
|
|
22
|
+
type: 'text',
|
|
23
|
+
text: '未找到任何自定义组件\n\n提示:使用 create_plugin 创建新组件'
|
|
24
|
+
}]
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
return { content: [{ type: 'text', text: JSON.stringify(componentList, null, 2) }] };
|
|
28
|
+
} finally {
|
|
29
|
+
process.chdir(originalCwd);
|
|
30
|
+
}
|
|
31
|
+
} catch (error) {
|
|
32
|
+
return {
|
|
33
|
+
content: [{
|
|
34
|
+
type: 'text',
|
|
35
|
+
text: `✗ 查询失败: ${error.message}\n\n可能的原因:\n- 项目路径不正确\n- 网络连接问题\n- 服务器API不可用`
|
|
36
|
+
}]
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
module.exports = {
|
|
42
|
+
listCustomComponents
|
|
43
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 发布插件/自定义组件到服务器
|
|
3
|
+
* 返回命令给智能体执行,而不是在工具中执行
|
|
4
|
+
*/
|
|
5
|
+
async function publishCustomComponent({ componentName, projectPath = process.cwd() }) {
|
|
6
|
+
const command = `npx cc publish plugin ${componentName}`;
|
|
7
|
+
|
|
8
|
+
return {
|
|
9
|
+
content: [{
|
|
10
|
+
type: 'text',
|
|
11
|
+
text: `请执行以下命令发布自定义组件:\n\n\`\`\`bash\n${command}\n\`\`\`\n\n组件名称: ${componentName}\n项目路径: ${projectPath}\n\n执行此命令将:\n1. 编译 Vue 组件\n2. 收集依赖文件\n3. 上传到 CloudCC 服务器`
|
|
12
|
+
}]
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
module.exports = {
|
|
17
|
+
publishCustomComponent
|
|
18
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Component Puller 工具处理器
|
|
3
|
+
* 从服务器拉取自定义组件到本地
|
|
4
|
+
* 支持通过组件名或ID拉取
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const pullPluginModule = require('../../../plugin/pull');
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* 从服务器拉取自定义组件
|
|
11
|
+
* @param {Object} params - 参数对象
|
|
12
|
+
* @param {string} params.componentName - 组件名称(可选,如果本地存在会从 config.json 读取 id)
|
|
13
|
+
* @param {string} params.componentId - 组件ID(可选)
|
|
14
|
+
* @param {string} params.projectPath - 项目根目录路径
|
|
15
|
+
*/
|
|
16
|
+
async function pullCustomComponent({ componentName, componentId, projectPath = process.cwd() }) {
|
|
17
|
+
try {
|
|
18
|
+
// 确定输入:优先使用 componentId,否则使用 componentName
|
|
19
|
+
const input = componentId || componentName;
|
|
20
|
+
|
|
21
|
+
if (!input) {
|
|
22
|
+
return {
|
|
23
|
+
content: [{
|
|
24
|
+
type: 'text',
|
|
25
|
+
text: '✗ 拉取失败: 必须提供组件名称或组件ID'
|
|
26
|
+
}]
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const originalCwd = process.cwd();
|
|
31
|
+
process.chdir(projectPath);
|
|
32
|
+
|
|
33
|
+
try {
|
|
34
|
+
// pull.js 已经支持组件名和ID的自动判断
|
|
35
|
+
// 如果传入组件名且本地存在 config.json,会自动读取 id
|
|
36
|
+
// 如果传入 ID,直接通过 ID 拉取
|
|
37
|
+
await pullPluginModule([null, null, input, projectPath]);
|
|
38
|
+
|
|
39
|
+
// 从输入推断组件名(用于显示)
|
|
40
|
+
const displayName = componentName || input;
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
content: [{
|
|
44
|
+
type: 'text',
|
|
45
|
+
text: `✓ 拉取成功!组件已从服务器拉取到本地\n\n本地路径: plugins/${displayName}/`
|
|
46
|
+
}]
|
|
47
|
+
};
|
|
48
|
+
} finally {
|
|
49
|
+
process.chdir(originalCwd);
|
|
50
|
+
}
|
|
51
|
+
} catch (error) {
|
|
52
|
+
return {
|
|
53
|
+
content: [{
|
|
54
|
+
type: 'text',
|
|
55
|
+
text: `✗ 拉取失败: ${error.message}`
|
|
56
|
+
}]
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
module.exports = {
|
|
62
|
+
pullCustomComponent
|
|
63
|
+
};
|
|
@@ -19,7 +19,7 @@ const path = require('path');
|
|
|
19
19
|
|
|
20
20
|
// ======================== 配置 ========================
|
|
21
21
|
const CONFIG = {
|
|
22
|
-
SOURCE_URL: 'https://
|
|
22
|
+
SOURCE_URL: 'https://help.cloudcc.cn/devlearn01/huan-jing-da-jian/',
|
|
23
23
|
OUTPUT_FILE: path.join(__dirname, './prompt.js'),
|
|
24
24
|
TIMEOUT: 10000,
|
|
25
25
|
MAX_RETRIES: 3,
|
|
@@ -38,11 +38,11 @@ function escapeHtml(text) {
|
|
|
38
38
|
|
|
39
39
|
// ======================== 日志工具 ========================
|
|
40
40
|
const logger = {
|
|
41
|
-
log: (msg) => console.
|
|
42
|
-
success: (msg) => console.
|
|
41
|
+
log: (msg) => console.error(`ℹ️ ${msg}`),
|
|
42
|
+
success: (msg) => console.error(`✅ ${msg}`),
|
|
43
43
|
error: (msg) => console.error(`❌ ${msg}`),
|
|
44
44
|
warn: (msg) => console.warn(`⚠️ ${msg}`),
|
|
45
|
-
info: (msg) => console.
|
|
45
|
+
info: (msg) => console.error(`📝 ${msg}`),
|
|
46
46
|
};
|
|
47
47
|
|
|
48
48
|
// ======================== HTTP 请求 ========================
|
|
@@ -483,10 +483,10 @@ async function main() {
|
|
|
483
483
|
const totalReferences = steps.reduce((sum, s) => sum + s.references.length, 0);
|
|
484
484
|
|
|
485
485
|
logger.log('📊 爬取统计:');
|
|
486
|
-
console.
|
|
487
|
-
console.
|
|
488
|
-
console.
|
|
489
|
-
console.
|
|
486
|
+
console.error(` - 步骤数: ${steps.length}`);
|
|
487
|
+
console.error(` - 命令数: ${totalCommands}`);
|
|
488
|
+
console.error(` - 参考链接: ${totalReferences}`);
|
|
489
|
+
console.error(` - 文件大小: ${(jsCode.length / 1024).toFixed(2)} KB`);
|
|
490
490
|
|
|
491
491
|
logger.success('✨ 爬取完成!');
|
|
492
492
|
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
*
|
|
4
4
|
* 自动生成的文件,请勿手动修改
|
|
5
5
|
* 生成时间: 2025-12-04T11:10:21.433Z
|
|
6
|
-
* 来源: https://
|
|
6
|
+
* 来源: https://help.cloudcc.cn/devlearn01/huan-jing-da-jian/
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
const metadata = {
|
|
10
10
|
"title": "CloudCC 开发环境搭建指南",
|
|
11
11
|
"description": "详细的开发环境配置教程,涵盖 Node.js、npm、VS Code 等必要工具的安装与配置",
|
|
12
|
-
"sourceUrl": "https://
|
|
12
|
+
"sourceUrl": "https://help.cloudcc.cn/devlearn01/huan-jing-da-jian/",
|
|
13
13
|
"generatedAt": "2025-12-04T11:10:21.433Z",
|
|
14
14
|
"version": "1.0.0"
|
|
15
15
|
};
|
|
@@ -172,6 +172,23 @@ const steps = [
|
|
|
172
172
|
"difficulty": "medium",
|
|
173
173
|
"estimatedTime": 5
|
|
174
174
|
}
|
|
175
|
+
,
|
|
176
|
+
{
|
|
177
|
+
"number": 7,
|
|
178
|
+
"title": "配置开发者密钥",
|
|
179
|
+
"description": "环境搭建完成后,需要配置开发者密钥以便进行 API 调用和插件开发。可调用MCP工具 `get_developer_key_setup_guide` 获取详细的密钥配置步骤。",
|
|
180
|
+
"content": "<p>环境搭建完成后,下一步是配置开发者密钥(Developer Key)。建议调用工具 <code>get_developer_key_setup_guide</code> 来获取交互式的引导和具体命令。</p>\n<pre><code>示例:请运行工具 get_developer_key_setup_guide 来查看并完成密钥配置。</code></pre>",
|
|
181
|
+
"keywords": [
|
|
182
|
+
"developer key",
|
|
183
|
+
"密钥",
|
|
184
|
+
"key",
|
|
185
|
+
"开发者密钥"
|
|
186
|
+
],
|
|
187
|
+
"commands": [],
|
|
188
|
+
"references": [],
|
|
189
|
+
"difficulty": "easy",
|
|
190
|
+
"estimatedTime": 5
|
|
191
|
+
}
|
|
175
192
|
];
|
|
176
193
|
|
|
177
194
|
const guide = {
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dev Environment Validator 工具处理器
|
|
3
|
+
* 读取同目录下的 prompt.js(知识库),并根据请求参数返回格式化的文本内容
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const prompt = require('./prompt.js');
|
|
7
|
+
const { searchSteps, getCommandsByPlatform, getStep, getAllSteps } = require('./prompt.js');
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* 获取开发环境验证提示
|
|
11
|
+
* 支持参数:step, search, difficulty, platform, command
|
|
12
|
+
* 返回结构与其他 MCP 工具一致:{ content: [{ type: 'text', text: '...' }] }
|
|
13
|
+
*/
|
|
14
|
+
async function getDevEnvSetup(params = {}) {
|
|
15
|
+
const { step, search, difficulty, platform, command } = params;
|
|
16
|
+
try {
|
|
17
|
+
if (search) {
|
|
18
|
+
const results = searchSteps(search);
|
|
19
|
+
if (!results || results.length === 0) {
|
|
20
|
+
return { content: [{ type: 'text', text: `未找到包含 "${search}" 的步骤。` }] };
|
|
21
|
+
}
|
|
22
|
+
let content = `# 搜索结果: "${search}"\n\n找到 ${results.length} 个相关步骤\n\n`;
|
|
23
|
+
results.forEach(s => {
|
|
24
|
+
content += `## ${s.number}. ${s.title}\n**难度**: ${s.difficulty}\n\n`;
|
|
25
|
+
});
|
|
26
|
+
return { content: [{ type: 'text', text: content }] };
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (difficulty) {
|
|
30
|
+
const results = prompt.steps.filter(s => s.difficulty === difficulty);
|
|
31
|
+
let content = `# ${difficulty} 难度步骤 (共 ${results.length} 个)\n\n`;
|
|
32
|
+
results.forEach(s => {
|
|
33
|
+
content += `${s.number}. ${s.title}\n`;
|
|
34
|
+
});
|
|
35
|
+
return { content: [{ type: 'text', text: content }] };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (platform) {
|
|
39
|
+
const commands = getCommandsByPlatform(platform);
|
|
40
|
+
let content = `# ${platform} 平台命令 (共 ${commands.length} 个)\n\n`;
|
|
41
|
+
commands.forEach((cmd, idx) => {
|
|
42
|
+
content += `${idx + 1}. ${cmd.description}\n\n\`\`\`bash\n${cmd.command}\n\`\`\`\n\n`;
|
|
43
|
+
});
|
|
44
|
+
return { content: [{ type: 'text', text: content }] };
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (step) {
|
|
48
|
+
const targetStep = getStep(step);
|
|
49
|
+
if (!targetStep) {
|
|
50
|
+
return { content: [{ type: 'text', text: `无效的步骤编号 ${step}` }] };
|
|
51
|
+
}
|
|
52
|
+
let content = `# 步骤 ${targetStep.number}: ${targetStep.title}\n\n**难度**: ${targetStep.difficulty}\n**耗时**: ${targetStep.estimatedTime} 分钟\n\n${targetStep.description}`;
|
|
53
|
+
if (targetStep.commands && targetStep.commands.length > 0) {
|
|
54
|
+
content += `\n\n## 命令 (共 ${targetStep.commands.length} 个)\n\n`;
|
|
55
|
+
targetStep.commands.forEach((cmd, idx) => {
|
|
56
|
+
content += `${idx + 1}. ${cmd.description}\n\`\`\`bash\n${cmd.command}\n\`\`\`\n\n`;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return { content: [{ type: 'text', text: content }] };
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (command) {
|
|
63
|
+
const steps = getAllSteps();
|
|
64
|
+
let content = `# 所有命令 (共 ${steps.reduce((sum, s) => sum + (s.commands ? s.commands.length : 0), 0)} 个)\n\n`;
|
|
65
|
+
steps.forEach(s => {
|
|
66
|
+
if (s.commands && s.commands.length > 0) {
|
|
67
|
+
content += `## ${s.title}\n`;
|
|
68
|
+
s.commands.forEach(cmd => {
|
|
69
|
+
content += `\`\`\`bash\n${cmd.command}\n\`\`\`\n`;
|
|
70
|
+
});
|
|
71
|
+
content += `\n`;
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
return { content: [{ type: 'text', text: content }] };
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// 默认概览
|
|
78
|
+
const allSteps = getAllSteps();
|
|
79
|
+
let content = `# ${prompt.title}\n\n${prompt.description}\n\n**版本**: ${prompt.version}\n**步骤数**: ${allSteps.length}`;
|
|
80
|
+
return { content: [{ type: 'text', text: content }] };
|
|
81
|
+
} catch (error) {
|
|
82
|
+
return { content: [{ type: 'text', text: `错误: ${error.message}` }] };
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
module.exports = {
|
|
87
|
+
getDevEnvSetup
|
|
88
|
+
};
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 开发环境验证提示词
|
|
3
|
+
*
|
|
4
|
+
* 自动生成的文件,请勿手动修改(可覆盖)
|
|
5
|
+
* 生成时间: 2025-12-11T00:00:00.000Z
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const metadata = {
|
|
9
|
+
title: "开发环境检查 - CloudCC",
|
|
10
|
+
description: "在开始使用 cloudcc-cli 之前的本地开发环境检查提示",
|
|
11
|
+
generatedAt: "2025-12-11T00:00:00.000Z",
|
|
12
|
+
version: "1.0.0"
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const steps = [
|
|
16
|
+
{
|
|
17
|
+
number: 1,
|
|
18
|
+
title: "安装 Node.js",
|
|
19
|
+
description: "本地需要安装 Node.js。推荐使用版本 v20.19.5。",
|
|
20
|
+
content: "<p>请确保本地安装了 Node.js,推荐使用 <strong>v20.19.5</strong> 以保证与项目依赖兼容。</p>\n<pre><code>下载地址: https://nodejs.org/download/release/v20.19.5/\n# 或使用 nvm 安装并切换版本(推荐)\nnvm install 20.19.5\nnvm use 20.19.5</code></pre>",
|
|
21
|
+
keywords: ["node", "nodejs", "v20.19.5"],
|
|
22
|
+
commands: [
|
|
23
|
+
{
|
|
24
|
+
command: "node -v",
|
|
25
|
+
platform: "all",
|
|
26
|
+
description: "检查已安装的 Node.js 版本"
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
difficulty: "easy",
|
|
30
|
+
estimatedTime: 5
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
number: 2,
|
|
34
|
+
title: "切换 npm 源以加速安装",
|
|
35
|
+
description: "建议将 npm 源切换为国内镜像以加速依赖安装。",
|
|
36
|
+
content: "<p>将 npm 源切换到淘宝/npmmirror 镜像可以显著加快包安装速度:</p>\n<pre><code>npm config set registry https://registry.npmmirror.com\n# 验证当前 registry 设置\nnpm config get registry</code></pre>",
|
|
37
|
+
keywords: ["npm", "registry", "npmmirror"],
|
|
38
|
+
commands: [
|
|
39
|
+
{
|
|
40
|
+
command: "npm config set registry https://registry.npmmirror.com",
|
|
41
|
+
platform: "all",
|
|
42
|
+
description: "设置 npm registry 为 npmmirror"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
command: "npm config get registry",
|
|
46
|
+
platform: "all",
|
|
47
|
+
description: "验证当前 npm registry"
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
difficulty: "easy",
|
|
51
|
+
estimatedTime: 2
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
number: 3,
|
|
55
|
+
title: "全局安装 cloudcc-cli 脚手架",
|
|
56
|
+
description: "安装并验证全局可用的 `cloudcc-cli` 命令。",
|
|
57
|
+
content: "<p>通过 npm 全局安装 cloudcc-cli,以便在命令行中使用相关脚手架命令:</p>\n<pre><code>npm install -g cloudcc-cli\n# 如遇权限问题(macOS),可使用 sudo 或配置 npm 全局安装路径\nsudo npm install -g cloudcc-cli\n# 验证安装是否成功\ncloudcc --version || cc --version</code></pre>",
|
|
58
|
+
keywords: ["cloudcc-cli", "global", "npm"],
|
|
59
|
+
commands: [
|
|
60
|
+
{
|
|
61
|
+
command: "npm install -g cloudcc-cli",
|
|
62
|
+
platform: "all",
|
|
63
|
+
description: "全局安装 cloudcc-cli"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
command: "npm ls -g --depth=0",
|
|
67
|
+
platform: "all",
|
|
68
|
+
description: "查看已安装的全局包,确认 cloudcc-cli 是否存在"
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
difficulty: "easy",
|
|
72
|
+
estimatedTime: 5
|
|
73
|
+
}
|
|
74
|
+
,
|
|
75
|
+
{
|
|
76
|
+
number: 4,
|
|
77
|
+
title: "检查 Java 开发环境(建议 JDK 17)",
|
|
78
|
+
description: "如果你的项目或后端组件使用 Java,需要在本机安装并配置 JDK。推荐使用 JDK 17(LTS)以获得最佳兼容性与长期支持。",
|
|
79
|
+
content: "<p>请检查本地是否安装 Java(JDK),并尽量使用 <strong>JDK 17</strong>。</p>\n<pre><code># 检查 Java 运行时版本\njava -version\n# 检查 Java 编译器版本\njavac -version</code></pre>\n<p>在 macOS 上,推荐通过 Homebrew 或 SDKMAN 安装 JDK 17:</p>\n<pre><code># Homebrew 安装(macOS)\nbrew install openjdk@17\n# 然后按提示将路径加入到环境变量,例如:\n# sudo ln -sfn /usr/local/opt/openjdk@17/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-17.jdk\n# 或者使用 SDKMAN(跨平台)\ncurl -s \"https://get.sdkman.io\" | bash\nsource \"$HOME/.sdkman/bin/sdkman-init.sh\"\nsdk install java 17.0.##-open\n</code></pre>",
|
|
80
|
+
keywords: ["java", "jdk", "jdk17", "java17"],
|
|
81
|
+
commands: [
|
|
82
|
+
{
|
|
83
|
+
command: "java -version",
|
|
84
|
+
platform: "all",
|
|
85
|
+
description: "检查 Java 运行时版本"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
command: "javac -version",
|
|
89
|
+
platform: "all",
|
|
90
|
+
description: "检查 Java 编译器版本"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
command: "brew install openjdk@17",
|
|
94
|
+
platform: "macos",
|
|
95
|
+
description: "在 macOS 上通过 Homebrew 安装 JDK 17(如已安装 Homebrew)"
|
|
96
|
+
}
|
|
97
|
+
],
|
|
98
|
+
references: [],
|
|
99
|
+
difficulty: "medium",
|
|
100
|
+
estimatedTime: 10
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
number: 5,
|
|
104
|
+
title: "检查 VS Code 及必要扩展",
|
|
105
|
+
description: "如果安装了 VS Code,需要安装 CloudCC 和 Extension Pack for Java 两个扩展以支持 CloudCC 开发和 Java 开发。",
|
|
106
|
+
content: "<p>请检查本地是否安装了 <strong>Visual Studio Code</strong>,以及是否已安装以下两个扩展:</p>\n<ul><li><strong>CloudCC</strong> - 用于 CloudCC 平台开发支持</li><li><strong>Extension Pack for Java</strong> - 微软官方 Java 开发工具集,包含 Language Support for Java、Debugger for Java 等</li></ul>\n<p>安装 VS Code 扩展的方式:</p>\n<ol><li>打开 VS Code,点击左侧的<strong>扩展</strong>图标(或按 Ctrl+Shift+X / Cmd+Shift+X)</li><li>在搜索框中分别搜索 \"CloudCC\" 和 \"Extension Pack for Java\"</li><li>点击 \"安装\" 按钮</li></ol>\n<p>或使用命令行安装:</p>\n<pre><code># 安装 CloudCC 扩展\ncode --install-extension cloudcc.cloudcc\n# 安装 Extension Pack for Java\ncode --install-extension vscjava.vscode-java-pack</code></pre>",
|
|
107
|
+
keywords: ["vscode", "vs code", "extension", "cloudcc", "java"],
|
|
108
|
+
commands: [
|
|
109
|
+
{
|
|
110
|
+
command: "code --version",
|
|
111
|
+
platform: "all",
|
|
112
|
+
description: "检查 VS Code 是否已安装"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
command: "code --install-extension cloudcc.cloudcc",
|
|
116
|
+
platform: "all",
|
|
117
|
+
description: "安装 CloudCC 扩展"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
command: "code --install-extension vscjava.vscode-java-pack",
|
|
121
|
+
platform: "all",
|
|
122
|
+
description: "安装 Extension Pack for Java"
|
|
123
|
+
}
|
|
124
|
+
],
|
|
125
|
+
references: [],
|
|
126
|
+
difficulty: "easy",
|
|
127
|
+
estimatedTime: 5
|
|
128
|
+
}
|
|
129
|
+
];
|
|
130
|
+
|
|
131
|
+
const guide = {
|
|
132
|
+
...metadata,
|
|
133
|
+
steps,
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* 在步骤中按关键词搜索(大小写不敏感)。
|
|
138
|
+
*
|
|
139
|
+
* @param {string} keyword - 要搜索的关键词,会被转为小写再匹配。
|
|
140
|
+
* @returns {Array<Object>} 匹配到的步骤数组,每项为 steps 中的 step 对象。
|
|
141
|
+
*/
|
|
142
|
+
function searchSteps(keyword) {
|
|
143
|
+
const lower = keyword.toLowerCase();
|
|
144
|
+
return guide.steps.filter(step =>
|
|
145
|
+
step.title.toLowerCase().includes(lower) ||
|
|
146
|
+
step.description.toLowerCase().includes(lower) ||
|
|
147
|
+
step.keywords.some(k => k.toLowerCase().includes(lower))
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* 按平台收集可执行命令列表。
|
|
153
|
+
*
|
|
154
|
+
* @param {string} platform - 目标平台标识(例如 'all', 'macos', 'windows' 等)。
|
|
155
|
+
* @returns {Array<Object>} 命令对象数组,每个对象包含 `command`, `platform`, `description`。
|
|
156
|
+
*/
|
|
157
|
+
function getCommandsByPlatform(platform) {
|
|
158
|
+
const commands = [];
|
|
159
|
+
guide.steps.forEach(step => {
|
|
160
|
+
step.commands.forEach(cmd => {
|
|
161
|
+
if (cmd.platform === 'all' || cmd.platform === platform) {
|
|
162
|
+
commands.push(cmd);
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
return commands;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* 根据步骤号获取单个步骤详情。
|
|
171
|
+
*
|
|
172
|
+
* @param {number} stepNumber - 步骤编号(整数)。
|
|
173
|
+
* @returns {Object|undefined} 匹配的步骤对象,未找到时返回 undefined。
|
|
174
|
+
*/
|
|
175
|
+
function getStep(stepNumber) {
|
|
176
|
+
return guide.steps.find(s => s.number === stepNumber);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* 获取所有步骤列表。
|
|
181
|
+
*
|
|
182
|
+
* @returns {Array<Object>} 当前 guide 中定义的全部步骤数组。
|
|
183
|
+
*/
|
|
184
|
+
function getAllSteps() {
|
|
185
|
+
return guide.steps;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
module.exports = guide;
|
|
189
|
+
module.exports.searchSteps = searchSteps;
|
|
190
|
+
module.exports.getCommandsByPlatform = getCommandsByPlatform;
|
|
191
|
+
module.exports.getStep = getStep;
|
|
192
|
+
module.exports.getAllSteps = getAllSteps;
|
|
193
|
+
|
|
@@ -19,7 +19,7 @@ const path = require('path');
|
|
|
19
19
|
|
|
20
20
|
// ======================== 配置 ========================
|
|
21
21
|
const CONFIG = {
|
|
22
|
-
SOURCE_URL: 'https://
|
|
22
|
+
SOURCE_URL: 'https://help.cloudcc.cn/devlearn01/huo-qu-an-quan-biao-ji/',
|
|
23
23
|
OUTPUT_FILE: path.join(__dirname, './prompt.js'),
|
|
24
24
|
TIMEOUT: 10000,
|
|
25
25
|
MAX_RETRIES: 3,
|
|
@@ -38,11 +38,11 @@ function escapeHtml(text) {
|
|
|
38
38
|
|
|
39
39
|
// ======================== 日志工具 ========================
|
|
40
40
|
const logger = {
|
|
41
|
-
log: (msg) => console.
|
|
42
|
-
success: (msg) => console.
|
|
41
|
+
log: (msg) => console.error(`ℹ️ ${msg}`),
|
|
42
|
+
success: (msg) => console.error(`✅ ${msg}`),
|
|
43
43
|
error: (msg) => console.error(`❌ ${msg}`),
|
|
44
44
|
warn: (msg) => console.warn(`⚠️ ${msg}`),
|
|
45
|
-
info: (msg) => console.
|
|
45
|
+
info: (msg) => console.error(`📝 ${msg}`),
|
|
46
46
|
};
|
|
47
47
|
|
|
48
48
|
// ======================== HTTP 请求 ========================
|
|
@@ -262,9 +262,9 @@ async function main() {
|
|
|
262
262
|
const totalContent = guides.reduce((sum, g) => sum + g.content.length, 0);
|
|
263
263
|
|
|
264
264
|
logger.log('📊 爬取统计:');
|
|
265
|
-
console.
|
|
266
|
-
console.
|
|
267
|
-
console.
|
|
265
|
+
console.error(` - 指南数: ${guides.length}`);
|
|
266
|
+
console.error(` - 总内容大小: ${(totalContent / 1024).toFixed(2)} KB`);
|
|
267
|
+
console.error(` - 文件大小: ${(jsCode.length / 1024).toFixed(2)} KB`);
|
|
268
268
|
|
|
269
269
|
logger.success('✨ 爬取完成!');
|
|
270
270
|
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
*
|
|
4
4
|
* 自动生成的文件,请勿手动修改
|
|
5
5
|
* 生成时间: 2025-12-04T12:06:58.620Z
|
|
6
|
-
* 来源: https://
|
|
6
|
+
* 来源: https://help.cloudcc.cn/devlearn01/huo-qu-an-quan-biao-ji/
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
const metadata = {
|
|
10
10
|
"title": "CloudCC 安全标记知识库",
|
|
11
11
|
"description": "详细的安全标记使用指南,涵盖开发者密钥、安全标记配置等安全相关主题",
|
|
12
|
-
"sourceUrl": "https://
|
|
12
|
+
"sourceUrl": "https://help.cloudcc.cn/devlearn01/huo-qu-an-quan-biao-ji/",
|
|
13
13
|
"generatedAt": "2025-12-04T12:06:58.620Z",
|
|
14
14
|
"version": "1.0.0"
|
|
15
15
|
};
|
|
@@ -17,7 +17,7 @@ const metadata = {
|
|
|
17
17
|
const guides = [
|
|
18
18
|
{
|
|
19
19
|
"title": "获取开发者密钥",
|
|
20
|
-
"description": "
|
|
20
|
+
"description": "获取开发者密钥,包括:safetyMark,CloudCCDev",
|
|
21
21
|
"content": ""
|
|
22
22
|
},
|
|
23
23
|
{
|
|
@@ -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
|
+
};
|