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,273 @@
1
+ /**
2
+ * CloudCC 开发环境搭建知识库
3
+ *
4
+ * 自动生成的文件,请勿手动修改
5
+ * 生成时间: 2025-12-04T11:10:21.433Z
6
+ * 来源: https://help.cloudcc.cn/devlearn01/huan-jing-da-jian/
7
+ */
8
+
9
+ const metadata = {
10
+ "title": "CloudCC 开发环境搭建指南",
11
+ "description": "详细的开发环境配置教程,涵盖 Node.js、npm、VS Code 等必要工具的安装与配置",
12
+ "sourceUrl": "https://help.cloudcc.cn/devlearn01/huan-jing-da-jian/",
13
+ "generatedAt": "2025-12-04T11:10:21.433Z",
14
+ "version": "1.0.0"
15
+ };
16
+
17
+ const steps = [
18
+ {
19
+ "number": 1,
20
+ "title": "安装node",
21
+ "description": "版本检查,打开控制台,输入以下命令:",
22
+ "content": "<pre><code>下载地址 https://nodejs.org/download/release/v20.19.5/\n\n推荐使用:nvm node多版本管理工具</code></pre>\n<p>版本检查,打开控制台,输入以下命令:</p>\n<pre><code>node -v</code></pre>",
23
+ "keywords": [
24
+ "node"
25
+ ],
26
+ "commands": [
27
+ {
28
+ "command": "下载地址 https://nodejs.org/download/release/v20.19.5/\n\n推荐使用:nvm node多版本管理工具",
29
+ "platform": "all",
30
+ "description": "执行命令"
31
+ },
32
+ {
33
+ "command": "node -v",
34
+ "platform": "all",
35
+ "description": "检查 Node.js 版本"
36
+ }
37
+ ],
38
+ "references": [],
39
+ "difficulty": "medium",
40
+ "estimatedTime": 10
41
+ },
42
+ {
43
+ "number": 2,
44
+ "title": "切换npm源",
45
+ "description": "为了加速安装依赖,将npm源地址切换为阿里源,打开控制台,输入以下命令: 检查是否设置成功,在控制台中输入以下命令:",
46
+ "content": "<p>为了加速安装依赖,将npm源地址切换为阿里源,打开控制台,输入以下命令:</p>\n<pre><code>npm config set registry https://registry.npmmirror.com</code></pre>\n<p>检查是否设置成功,在控制台中输入以下命令:</p>\n<pre><code>npm config get registry</code></pre>",
47
+ "keywords": [
48
+ "npm",
49
+ "registry"
50
+ ],
51
+ "commands": [
52
+ {
53
+ "command": "npm config set registry https://registry.npmmirror.com",
54
+ "platform": "all",
55
+ "description": "设置 npm 源地址"
56
+ },
57
+ {
58
+ "command": "npm config get registry",
59
+ "platform": "all",
60
+ "description": "验证 npm 源设置"
61
+ }
62
+ ],
63
+ "references": [],
64
+ "difficulty": "easy",
65
+ "estimatedTime": 5
66
+ },
67
+ {
68
+ "number": 3,
69
+ "title": "安装全局依赖",
70
+ "description": "检查是否安装成功,控制台输入以下命令: 检查是否安装成功,控制台输入以下命令:",
71
+ "content": "<pre><code>npm install -g cloudcc-cli</code></pre>\n<p>检查是否安装成功,控制台输入以下命令:</p>\n<pre><code>npm ls -g --depth=0</code></pre>\n<pre><code>sudo npm install -g cloudcc-cli</code></pre>\n<p>检查是否安装成功,控制台输入以下命令:</p>\n<pre><code>sudo npm ls -g --depth=0</code></pre>",
72
+ "keywords": [
73
+ "dependencies"
74
+ ],
75
+ "commands": [
76
+ {
77
+ "command": "npm install -g cloudcc-cli",
78
+ "platform": "all",
79
+ "description": "安装全局依赖包"
80
+ },
81
+ {
82
+ "command": "npm ls -g --depth=0",
83
+ "platform": "all",
84
+ "description": "检查全局安装的包"
85
+ },
86
+ {
87
+ "command": "sudo npm install -g cloudcc-cli",
88
+ "platform": "macos",
89
+ "description": "安装全局依赖包"
90
+ },
91
+ {
92
+ "command": "sudo npm ls -g --depth=0",
93
+ "platform": "macos",
94
+ "description": "检查全局安装的包"
95
+ }
96
+ ],
97
+ "references": [],
98
+ "difficulty": "medium",
99
+ "estimatedTime": 15,
100
+ "subSteps": [
101
+ {
102
+ "title": "3.1 window用户:打开控制台输入以下命令",
103
+ "description": "",
104
+ "commands": [],
105
+ "notes": []
106
+ },
107
+ {
108
+ "title": "3.2 MacOS用户:打开控制台输入以下命令",
109
+ "description": "",
110
+ "commands": [],
111
+ "notes": []
112
+ }
113
+ ]
114
+ },
115
+ {
116
+ "number": 4,
117
+ "title": "安装vs-code",
118
+ "description": "安装vs-code",
119
+ "content": "<pre><code>下载地址:https://code.visualstudio.com/download</code></pre>",
120
+ "keywords": [
121
+ "vscode"
122
+ ],
123
+ "commands": [
124
+ {
125
+ "command": "下载地址:https://code.visualstudio.com/download",
126
+ "platform": "all",
127
+ "description": "执行命令"
128
+ }
129
+ ],
130
+ "references": [],
131
+ "difficulty": "medium",
132
+ "estimatedTime": 5
133
+ },
134
+ {
135
+ "number": 5,
136
+ "title": "安装vs-code插件:CloudCC",
137
+ "description": "安装vs-code插件:CloudCC",
138
+ "content": "<ul><li>打开安装完成的vs code,点击扩展图标</li></ul>\n<ul><li>输入CloudCC,选择安装</li></ul>",
139
+ "keywords": [
140
+ "vscode",
141
+ "plugin"
142
+ ],
143
+ "commands": [],
144
+ "references": [],
145
+ "difficulty": "easy",
146
+ "estimatedTime": 5
147
+ },
148
+ {
149
+ "number": 6,
150
+ "title": "创建模版项目",
151
+ "description": "打开控制台,进入您的开发目录,比如Docments,运行创建项目命令: 浏览器访问:http://localhost:8080/,可以看到以下页面",
152
+ "content": "<p>打开控制台,进入您的开发目录,比如Docments,运行创建项目命令:</p>\n<pre><code>cc create project demo1</code></pre>\n<ul><li>使用vs code打开项目</li></ul>\n<ul><li>选择菜单里中的:终端——新建终端</li></ul>\n<ul><li>安装依赖:在打开的终端里输入以下命令:</li></ul>\n<pre><code>npm i</code></pre>\n<ul><li>安装完成后,运行项目,在终端中执行命令</li></ul>\n<pre><code>npm run serve</code></pre>\n<p>浏览器访问:http://localhost:8080/,可以看到以下页面</p>",
153
+ "keywords": [],
154
+ "commands": [
155
+ {
156
+ "command": "cc create project demo1",
157
+ "platform": "all",
158
+ "description": "执行命令"
159
+ },
160
+ {
161
+ "command": "npm i",
162
+ "platform": "all",
163
+ "description": "执行命令"
164
+ },
165
+ {
166
+ "command": "npm run serve",
167
+ "platform": "all",
168
+ "description": "执行命令"
169
+ }
170
+ ],
171
+ "references": [],
172
+ "difficulty": "medium",
173
+ "estimatedTime": 5
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
+ }
192
+ ];
193
+
194
+ const guide = {
195
+ ...metadata,
196
+ steps,
197
+ };
198
+
199
+ /**
200
+ * 按关键词搜索步骤
201
+ */
202
+ function searchSteps(keyword) {
203
+ const lower = keyword.toLowerCase();
204
+ return guide.steps.filter(step =>
205
+ step.title.toLowerCase().includes(lower) ||
206
+ step.description.toLowerCase().includes(lower) ||
207
+ step.keywords.some(k => k.toLowerCase().includes(lower))
208
+ );
209
+ }
210
+
211
+ /**
212
+ * 按平台获取命令
213
+ */
214
+ function getCommandsByPlatform(platform) {
215
+ const commands = [];
216
+ guide.steps.forEach(step => {
217
+ step.commands.forEach(cmd => {
218
+ if (cmd.platform === 'all' || cmd.platform === platform) {
219
+ commands.push(cmd);
220
+ }
221
+ });
222
+ });
223
+ return commands;
224
+ }
225
+
226
+ /**
227
+ * 按步骤号获取步骤详情
228
+ */
229
+ function getStep(stepNumber) {
230
+ return guide.steps.find(s => s.number === stepNumber);
231
+ }
232
+
233
+ /**
234
+ * 获取所有步骤
235
+ */
236
+ function getAllSteps() {
237
+ return guide.steps;
238
+ }
239
+
240
+ /**
241
+ * 获取指定难度的步骤
242
+ */
243
+ function getStepsByDifficulty(difficulty) {
244
+ return guide.steps.filter(s => s.difficulty === difficulty);
245
+ }
246
+
247
+ /**
248
+ * 获取所有参考链接
249
+ */
250
+ function getAllReferences() {
251
+ const refs = [];
252
+ guide.steps.forEach(step => {
253
+ refs.push(...step.references);
254
+ });
255
+ return refs;
256
+ }
257
+
258
+ /**
259
+ * 按分类获取参考链接
260
+ */
261
+ function getReferencesByCategory(category) {
262
+ return getAllReferences().filter(r => r.category === category);
263
+ }
264
+
265
+ // 导出所有函数和对象
266
+ module.exports = guide;
267
+ module.exports.searchSteps = searchSteps;
268
+ module.exports.getCommandsByPlatform = getCommandsByPlatform;
269
+ module.exports.getStep = getStep;
270
+ module.exports.getAllSteps = getAllSteps;
271
+ module.exports.getStepsByDifficulty = getStepsByDifficulty;
272
+ module.exports.getAllReferences = getAllReferences;
273
+ module.exports.getReferencesByCategory = getReferencesByCategory;
@@ -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
+