cloudcc-cli 2.3.1 → 2.3.3

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 (232) hide show
  1. package/.claude/settings.json +25 -0
  2. package/.cloudcc-cache.json +21 -4
  3. package/.cursor/skills/cloudcc-cli-dev.zip +0 -0
  4. package/.cursor/skills/cloudcc-cli-usage/SKILL.md +68 -0
  5. package/README.md +22 -0
  6. package/bin/cc.js +13 -8
  7. package/bin/index.js +9 -2
  8. package/bin/mcp.js +1 -1
  9. package/build/component-CCPlugin1774500425584.common.js +831 -0
  10. package/build/component-CCPlugin1774500425584.common.js.map +1 -0
  11. package/build/component-CCPlugin1774500425584.css +1 -0
  12. package/build/component-CCPlugin1774500425584.umd.js +874 -0
  13. package/build/component-CCPlugin1774500425584.umd.js.map +1 -0
  14. package/build/component-CCPlugin1774500425584.umd.min.js +8 -0
  15. package/build/component-CCPlugin1774500425584.umd.min.js.map +1 -0
  16. package/build/demo.html +1 -0
  17. package/{src/mcp → mcp}/tools/Class Editor Guide/handler.js +12 -4
  18. package/{src/mcp → mcp}/tools/Component Editor Guide/handler.js +15 -14
  19. package/{src/mcp → mcp}/tools/Trigger Editor Guide/handler.js +8 -2
  20. package/package.json +3 -2
  21. package/src/application/doc.js +46 -0
  22. package/src/application/docs/devguide.md +173 -0
  23. package/src/application/docs/introduction.md +81 -0
  24. package/src/application/index.js +1 -0
  25. package/src/brief/get.js +1 -1
  26. package/src/classes/create.js +6 -1
  27. package/src/classes/delete.js +7 -1
  28. package/src/classes/detail.js +8 -1
  29. package/src/classes/doc.js +49 -472
  30. package/src/classes/docs/devguide.md +541 -0
  31. package/src/classes/get.js +9 -2
  32. package/src/classes/index.js +2 -1
  33. package/src/classes/publish.js +6 -1
  34. package/src/classes/pull.js +6 -1
  35. package/src/classes/pullList.js +6 -3
  36. package/src/config/doc.js +31 -0
  37. package/src/config/docs/devguide.md +100 -0
  38. package/src/config/index.js +5 -0
  39. package/src/customPage/create.js +52 -19
  40. package/src/customPage/doc.js +46 -0
  41. package/src/customPage/docs/devguide.md +200 -0
  42. package/{.cursor/skills/cloudcc-cli-dev/docs//350/207/252/345/256/232/344/271/211/351/241/265/351/235/242.md → src/customPage/docs/introduction.md} +1 -5
  43. package/src/customPage/index.js +1 -0
  44. package/src/customSetting/create.js +9 -0
  45. package/src/customSetting/delete.js +10 -1
  46. package/src/customSetting/deleteCustomSettingField.js +43 -0
  47. package/src/customSetting/detail.js +10 -1
  48. package/src/customSetting/doc.js +22 -179
  49. package/src/customSetting/docs/devguide.md +181 -0
  50. package/src/customSetting/docs/introduction.md +3 -0
  51. package/src/customSetting/editCustomSettingField.js +34 -0
  52. package/src/customSetting/get.js +9 -0
  53. package/src/customSetting/index.js +6 -1
  54. package/src/customSetting/modify.js +30 -0
  55. package/src/customSetting/saveCustomSettingField.js +46 -0
  56. package/src/fields/doc.js +45 -0
  57. package/src/fields/docs/devguide.md +224 -0
  58. package/src/fields/docs/introduction.md +217 -0
  59. package/src/fields/index.js +1 -0
  60. package/src/globalSelectList/create.js +51 -0
  61. package/src/globalSelectList/delete.js +56 -0
  62. package/src/globalSelectList/detail.js +45 -0
  63. package/src/globalSelectList/doc.js +52 -0
  64. package/src/globalSelectList/docs/devguide.md +153 -0
  65. package/src/globalSelectList/docs/introduction.md +82 -0
  66. package/src/globalSelectList/get.js +31 -0
  67. package/src/globalSelectList/index.js +16 -0
  68. package/src/menu/create-page.js +43 -6
  69. package/src/menu/create-script.js +67 -19
  70. package/src/menu/doc.js +57 -0
  71. package/src/menu/docs/devguide.md +129 -0
  72. package/src/menu/docs/introduction.md +99 -0
  73. package/src/menu/index.js +1 -0
  74. package/src/menu/validator.js +80 -0
  75. package/src/object/doc.js +45 -0
  76. package/src/object/docs/devguide.md +112 -0
  77. package/src/object/docs/introduction.md +187 -0
  78. package/src/object/get.js +1 -23
  79. package/src/object/index.js +1 -0
  80. package/src/pagelayout/create.js +123 -0
  81. package/src/pagelayout/delete.js +57 -0
  82. package/src/pagelayout/doc.js +46 -0
  83. package/src/pagelayout/docs/devguide.md +83 -0
  84. package/src/pagelayout/docs/introduction.md +44 -0
  85. package/src/pagelayout/get.js +46 -0
  86. package/src/pagelayout/index.js +10 -0
  87. package/src/plugin/doc.js +43 -863
  88. package/src/plugin/docs/devguide.md +996 -0
  89. package/src/profile/create.js +108 -0
  90. package/src/profile/delete.js +59 -0
  91. package/src/profile/doc.js +46 -0
  92. package/src/profile/docs/devguide.md +77 -0
  93. package/src/profile/docs/introduction.md +123 -0
  94. package/src/profile/get.js +55 -0
  95. package/src/profile/index.js +14 -0
  96. package/src/project/doc.js +39 -372
  97. package/src/project/docs/devguide.md +359 -0
  98. package/src/project/docs/introduction.md +3 -0
  99. package/src/recordType/create.js +77 -0
  100. package/src/recordType/delete.js +52 -0
  101. package/src/recordType/doc.js +36 -0
  102. package/src/recordType/docs/devguide.md +160 -0
  103. package/src/recordType/docs/introduction.md +53 -0
  104. package/src/recordType/editInfo.js +39 -0
  105. package/src/recordType/editSave.js +47 -0
  106. package/src/recordType/getList.js +31 -0
  107. package/src/recordType/index.js +16 -3
  108. package/src/recordType/newInfo.js +39 -0
  109. package/src/recordType/validDelete.js +91 -0
  110. package/src/res.md +66 -0
  111. package/src/role/create.js +153 -0
  112. package/src/role/delete.js +59 -0
  113. package/src/role/doc.js +46 -0
  114. package/src/role/docs/devguide.md +81 -0
  115. package/src/role/docs/introduction.md +124 -0
  116. package/src/role/get.js +57 -0
  117. package/src/role/index.js +10 -0
  118. package/src/scheduleJob/doc.js +49 -0
  119. package/src/scheduleJob/docs/devguide.md +79 -0
  120. package/src/scheduleJob/docs/introduction.md +101 -0
  121. package/src/scheduleJob/index.js +5 -0
  122. package/src/script/delete.js +112 -0
  123. package/src/script/doc.js +31 -245
  124. package/src/script/docs/devguide.md +290 -0
  125. package/src/script/docs/introduction.md +48 -0
  126. package/src/script/index.js +1 -0
  127. package/src/staticResource/count.js +31 -10
  128. package/src/staticResource/create.js +97 -0
  129. package/src/staticResource/delete.js +30 -8
  130. package/src/staticResource/detail.js +32 -10
  131. package/src/staticResource/doc.js +21 -88
  132. package/src/staticResource/docs/devguide.md +157 -0
  133. package/src/staticResource/docs/introduction.md +3 -0
  134. package/src/staticResource/get.js +31 -8
  135. package/src/staticResource/index.js +2 -1
  136. package/src/timer/create.js +6 -1
  137. package/src/timer/delete.js +7 -1
  138. package/src/timer/detail.js +5 -5
  139. package/src/timer/doc.js +57 -0
  140. package/{.cursor/skills/cloudcc-cli-dev/docs/cloudcc/345/256/232/346/227/266/344/275/234/344/270/232.md → src/timer/docs/devguide.md} +83 -1
  141. package/src/timer/get.js +7 -1
  142. package/src/timer/index.js +3 -1
  143. package/src/timer/publish.js +6 -1
  144. package/src/timer/pull.js +6 -1
  145. package/src/timer/pullList.js +5 -3
  146. package/src/triggers/detail.js +5 -5
  147. package/src/triggers/doc.js +49 -364
  148. package/src/triggers/docs/devguide.md +442 -0
  149. package/src/triggers/get.js +7 -3
  150. package/src/triggers/index.js +1 -4
  151. package/src/triggers/pullList.js +7 -7
  152. package/src/user/create.js +50 -0
  153. package/src/user/delete.js +59 -0
  154. package/src/user/doc.js +46 -0
  155. package/src/user/docs/devguide.md +122 -0
  156. package/src/user/docs/introduction.md +124 -0
  157. package/src/user/get.js +112 -0
  158. package/src/user/index.js +12 -0
  159. package/src/user/update.js +96 -0
  160. package/src/user/view.js +60 -0
  161. package/test/classes.cli.test.js +7 -4
  162. package/test/customPage.cli.test.js +96 -0
  163. package/test/globalSelectList.cli.test.js +94 -0
  164. package/test/menu-script.cli.test.js +147 -0
  165. package/test/menu.cli.test.js +8 -1
  166. package/test/plugin.cli.test.js +5 -3
  167. package/test/timer.cli.test.js +15 -8
  168. package/test/trigger.cli.test.js +5 -3
  169. package/.cursor/skills/cloudcc-cli-dev/BACKEND_CLASS.md +0 -111
  170. package/.cursor/skills/cloudcc-cli-dev/BACKEND_SCHEDULE.md +0 -152
  171. package/.cursor/skills/cloudcc-cli-dev/BACKEND_TRIGGER.md +0 -150
  172. package/.cursor/skills/cloudcc-cli-dev/CLI_CHEATSHEET.md +0 -372
  173. package/.cursor/skills/cloudcc-cli-dev/CUSTOM-SETTING-API.md +0 -62
  174. package/.cursor/skills/cloudcc-cli-dev/INSTALL_AND_BOOTSTRAP.md +0 -62
  175. package/.cursor/skills/cloudcc-cli-dev/OBJECTS_AND_FIELDS.md +0 -214
  176. package/.cursor/skills/cloudcc-cli-dev/REQUIREMENTS_BREAKDOWN.md +0 -113
  177. package/.cursor/skills/cloudcc-cli-dev/SKILL.md +0 -66
  178. package/.cursor/skills/cloudcc-cli-dev/STATIC-RESOURCE-API.md +0 -60
  179. package/.cursor/skills/cloudcc-cli-dev/VUE_CUSTOM_COMPONENT.md +0 -151
  180. package/.cursor/skills/cloudcc-cli-dev/VUE_CUSTOM_PAGE.md +0 -216
  181. package/src/approval/approve.js +0 -105
  182. package/src/approval/get.js +0 -245
  183. package/src/approval/index.js +0 -11
  184. package/src/approval/reject.js +0 -105
  185. package/src/plugin/readme.md +0 -7
  186. /package/{src/mcp → mcp}/cliRunner.js +0 -0
  187. /package/{src/mcp → mcp}/index.js +0 -0
  188. /package/{src/mcp → mcp}/readme.md +0 -0
  189. /package/{src/mcp → mcp}/tools/Application Creator/handler.js +0 -0
  190. /package/{src/mcp → mcp}/tools/Approval/handler.js +0 -0
  191. /package/{src/mcp → mcp}/tools/Class Creator/handler.js +0 -0
  192. /package/{src/mcp → mcp}/tools/Class Detail Retriever/handler.js +0 -0
  193. /package/{src/mcp → mcp}/tools/Class List Retriever/handler.js +0 -0
  194. /package/{src/mcp → mcp}/tools/Class Publisher/handler.js +0 -0
  195. /package/{src/mcp → mcp}/tools/Class Puller/handler.js +0 -0
  196. /package/{src/mcp → mcp}/tools/Client Script Detail Retriever/handler.js +0 -0
  197. /package/{src/mcp → mcp}/tools/Client Script Editor Guide/handler.js +0 -0
  198. /package/{src/mcp → mcp}/tools/Client Script List Retriever/handler.js +0 -0
  199. /package/{src/mcp → mcp}/tools/Client Script Publisher/handler.js +0 -0
  200. /package/{src/mcp → mcp}/tools/Client Script Puller/handler.js +0 -0
  201. /package/{src/mcp → mcp}/tools/CloudCC Development Overview/handler.js +0 -0
  202. /package/{src/mcp → mcp}/tools/Component Creator/handler.js +0 -0
  203. /package/{src/mcp → mcp}/tools/Component Detail Retriever/handler.js +0 -0
  204. /package/{src/mcp → mcp}/tools/Component List Retriever/handler.js +0 -0
  205. /package/{src/mcp → mcp}/tools/Component Publisher/handler.js +0 -0
  206. /package/{src/mcp → mcp}/tools/Component Puller/handler.js +0 -0
  207. /package/{src/mcp → mcp}/tools/Dev Environment Creator/fetcher.js +0 -0
  208. /package/{src/mcp → mcp}/tools/Dev Environment Creator/handler.js +0 -0
  209. /package/{src/mcp → mcp}/tools/Dev Environment Validator/handler.js +0 -0
  210. /package/{src/mcp → mcp}/tools/Developer Key Setup Guide/fetcher.js +0 -0
  211. /package/{src/mcp → mcp}/tools/Developer Key Setup Guide/handler.js +0 -0
  212. /package/{src/mcp → mcp}/tools/JSP Migrator/handler.js +0 -0
  213. /package/{src/mcp → mcp}/tools/Menu Creator/handler.js +0 -0
  214. /package/{src/mcp → mcp}/tools/Object Creator/handler.js +0 -0
  215. /package/{src/mcp → mcp}/tools/Object Fields Creator/handler.js +0 -0
  216. /package/{src/mcp → mcp}/tools/Object Fields Retriever/handler.js +0 -0
  217. /package/{src/mcp → mcp}/tools/Object List Retriever/handler.js +0 -0
  218. /package/{src/mcp → mcp}/tools/Scheduled Class Creator/handler.js +0 -0
  219. /package/{src/mcp → mcp}/tools/Scheduled Class Detail Retriever/handler.js +0 -0
  220. /package/{src/mcp → mcp}/tools/Scheduled Class List Retriever/handler.js +0 -0
  221. /package/{src/mcp → mcp}/tools/Scheduled Class Publisher/handler.js +0 -0
  222. /package/{src/mcp → mcp}/tools/Scheduled Class Puller/handler.js +0 -0
  223. /package/{src/mcp → mcp}/tools/Trigger Creator/handler.js +0 -0
  224. /package/{src/mcp → mcp}/tools/Trigger Detail Retriever/handler.js +0 -0
  225. /package/{src/mcp → mcp}/tools/Trigger List Retriever/handler.js +0 -0
  226. /package/{src/mcp → mcp}/tools/Trigger Publisher/handler.js +0 -0
  227. /package/{src/mcp → mcp}/tools/Trigger Puller/handler.js +0 -0
  228. /package/{src/mcp → mcp}/tools/index.js +0 -0
  229. /package/{.cursor/skills/cloudcc-cli-dev/docs//350/207/252/345/256/232/344/271/211/347/261/273.md" → src/classes/docs/introduction.md} +0 -0
  230. /package/{.cursor/skills/cloudcc-cli-dev/docs/CloudCC/350/207/252/345/256/232/344/271/211/347/273/204/344/273/266/344/275/277/347/224/250/350/257/264/346/230/216.md" → src/plugin/docs/introduction.md} +0 -0
  231. /package/{.cursor/skills/cloudcc-cli-dev/docs/cloudcc/345/256/232/346/227/266/347/261/273.md" → src/timer/docs/introduction.md} +0 -0
  232. /package/{.cursor/skills/cloudcc-cli-dev/docs//350/247/246/345/217/221/345/231/250/347/261/273.md" → src/triggers/docs/introduction.md} +0 -0
@@ -0,0 +1,100 @@
1
+ # CloudCC 配置模块开发指南
2
+
3
+ ## 1. 模块定位
4
+
5
+ `config` 模块用于管理本地项目配置文件 `cloudcc-cli.config.js` 的环境切换与查看。
6
+
7
+ 当前支持:
8
+
9
+ - 切换当前环境:`cc use config <env> [projectPath]`
10
+ - 查看当前配置:`cc get config [projectPath]`
11
+ - 查看开发文档:`cc doc config devguide`
12
+
13
+ ---
14
+
15
+ ## 2. 开发前准备
16
+
17
+ 执行命令前请确认:
18
+
19
+ - 已完成 `cc doc project devguide` 的初始化流程
20
+ - 项目根目录存在 `cloudcc-cli.config.js`
21
+ - `cloudcc-cli.config.js` 中包含可切换的环境配置(如 `test`、`prod`)
22
+
23
+ ---
24
+
25
+ ## 3. 命令总览(以当前实现为准)
26
+
27
+ ```bash
28
+ cc use config <env> [projectPath]
29
+ cc get config [projectPath]
30
+ cc doc config devguide
31
+ ```
32
+
33
+ 参数约定:
34
+
35
+ - `env`:目标环境名称(例如 `test`、`prod`)
36
+ - `projectPath`:项目路径,不传时默认当前目录
37
+
38
+ ---
39
+
40
+ ## 4. 切换环境
41
+
42
+ ```bash
43
+ cc use config <env> [projectPath]
44
+ ```
45
+
46
+ 说明:
47
+
48
+ - 命令会读取 `<projectPath>/cloudcc-cli.config.js`
49
+ - 将 `use` 字段更新为传入的 `env`
50
+ - 写回配置文件后,后续命令将按新的 `use` 环境读取连接信息
51
+
52
+ 示例:
53
+
54
+ ```bash
55
+ # 在当前目录切换到 test 环境
56
+ cc use config test .
57
+ ```
58
+
59
+ ---
60
+
61
+ ## 5. 查看配置
62
+
63
+ ```bash
64
+ cc get config [projectPath]
65
+ ```
66
+
67
+ 说明:
68
+
69
+ - 命令会读取并输出当前配置对象
70
+ - 不传 `projectPath` 时默认读取当前目录
71
+
72
+ 示例:
73
+
74
+ ```bash
75
+ # 查看当前目录配置
76
+ cc get config .
77
+ ```
78
+
79
+ ---
80
+
81
+ ## 6. 常见注意事项
82
+
83
+ - 执行路径错误会导致找不到 `cloudcc-cli.config.js`
84
+ - `env` 必须是配置中可识别的环境名称,否则后续命令可能读取失败
85
+ - 切换环境后建议立即执行一次 `cc get config .` 进行确认
86
+
87
+ ---
88
+
89
+ ## 7. 推荐操作顺序
90
+
91
+ ```bash
92
+ # 1) 查看当前配置
93
+ cc get config .
94
+
95
+ # 2) 切换到目标环境
96
+ cc use config test .
97
+
98
+ # 3) 再次查看,确认已生效
99
+ cc get config .
100
+ ```
@@ -1,7 +1,12 @@
1
1
  const cc = {}
2
2
  cc.use = require("./use")
3
3
  cc.get = require("./get")
4
+ cc.doc = require("./doc")
4
5
  function main(action, argvs) {
6
+ if (action === "doc") {
7
+ cc.doc(argvs)
8
+ return
9
+ }
5
10
  cc[action](argvs[2], argvs[3])
6
11
  }
7
12
 
@@ -3,21 +3,30 @@ const { getPackageJson } = require('../../utils/config');
3
3
  const { post } = require('../../utils/http');
4
4
  const BaseUrl = 'https://developer.apis.cloudcc.cn';
5
5
 
6
+ function isEmptyArg(v) {
7
+ return v == null || String(v).trim() === '';
8
+ }
9
+
6
10
  /**
7
11
  * 新建自定义页面
8
12
  *
9
- * 用法:cc create customPage <pageLabel> <pageApi> <pluginId|compLabel> [projectPath]
13
+ * 用法:
14
+ * cc create customPage <pageLabel> <pageApi> <pluginId|compLabel> [projectPath]
15
+ * 无参数(仅 create customPage)时:拉取自定义组件列表,使用第一个组件,并自动生成 pageLabel / pageApi。
10
16
  */
11
17
  async function createCustomPage(argvs) {
12
- const pageLabel = argvs[2];
13
- const pageApi = argvs[3];
14
- const pluginIdentifier = argvs[4];
15
18
  const projectPath = argvs[5] || process.cwd();
19
+ let pageLabel = argvs[2];
20
+ let pageApi = argvs[3];
21
+ let pluginIdentifier = argvs[4];
16
22
 
17
- if (!pageLabel || !pageApi || !pluginIdentifier) {
23
+ const noPageArgs =
24
+ isEmptyArg(pageLabel) && isEmptyArg(pageApi) && isEmptyArg(pluginIdentifier);
25
+
26
+ if (!noPageArgs && (isEmptyArg(pageLabel) || isEmptyArg(pageApi) || isEmptyArg(pluginIdentifier))) {
18
27
  console.error();
19
- console.error(chalk.red('Error: pageLabel, pageApi and pluginId/compLabel are required'));
20
- console.error(chalk.yellow('Usage: cc create customPage <pageLabel> <pageApi> <pluginId|compLabel> [projectPath]'));
28
+ console.error(chalk.red('Error: pageLabelpageApipluginId/compLabel 需同时提供,或全部省略以使用第一个自定义组件'));
29
+ console.error(chalk.yellow('Usage: cc create customPage [<pageLabel> <pageApi> <pluginId|compLabel>] [projectPath]'));
21
30
  console.error();
22
31
  return;
23
32
  }
@@ -40,7 +49,6 @@ async function createCustomPage(argvs) {
40
49
  version: 'public',
41
50
  };
42
51
 
43
- // 先通过 listCustomComp 获取组件列表,再按组件标识匹配目标组件
44
52
  const listRes = await post(
45
53
  `${baseUrl}${devSvcDispatch}/custom/pc/1.0/post/listCustomComp`,
46
54
  { orgId: config.orgId || '' },
@@ -58,12 +66,31 @@ async function createCustomPage(argvs) {
58
66
  throw new Error('Create Custom Page Failed: no custom components found');
59
67
  }
60
68
 
61
- let pluginDetail = compList.find(item =>
62
- item &&
63
- (item.id === pluginIdentifier || item.compLabel === pluginIdentifier || item.compUniName === pluginIdentifier)
64
- );
65
- if (!pluginDetail) {
66
- throw new Error(`Create Custom Page Failed: component "${pluginIdentifier}" not found in custom component list`);
69
+ let pluginDetail;
70
+ if (noPageArgs) {
71
+ pluginDetail = compList[0];
72
+ const ts = Date.now();
73
+ pageLabel = `CLI自动页面_${ts}`;
74
+ pageApi = `cc_cli_page_${ts}`;
75
+ pluginIdentifier = pluginDetail.id || pluginDetail.compLabel || pluginDetail.compUniName;
76
+ console.error();
77
+ console.error(
78
+ chalk.cyan(
79
+ `未指定页面参数,使用第一个自定义组件创建:` +
80
+ `${pluginDetail.compLabel || pluginDetail.compName || pluginDetail.compUniName || pluginIdentifier} (${pluginIdentifier})`
81
+ )
82
+ );
83
+ } else {
84
+ pluginDetail = compList.find(
85
+ (item) =>
86
+ item &&
87
+ (item.id === pluginIdentifier ||
88
+ item.compLabel === pluginIdentifier ||
89
+ item.compUniName === pluginIdentifier)
90
+ );
91
+ if (!pluginDetail) {
92
+ throw new Error(`Create Custom Page Failed: component "${pluginIdentifier}" not found in custom component list`);
93
+ }
67
94
  }
68
95
 
69
96
  let vueData = {};
@@ -105,16 +132,22 @@ async function createCustomPage(argvs) {
105
132
  pageApi,
106
133
  pageContent: JSON.stringify([pageContentItem]),
107
134
  orgId: pluginDetail.orgId || config.orgId || '',
108
- compList: [{
109
- id: pluginDetail.id,
110
- compUniName,
111
- }],
135
+ compList: [
136
+ {
137
+ id: pluginDetail.id,
138
+ compUniName,
139
+ },
140
+ ],
112
141
  canvasStyleData: JSON.stringify({ width: 100, height: 100, scale: 100, unit: '%', pageApi }),
113
142
  isTemplate: 0,
114
143
  };
115
144
 
116
145
  console.error();
117
- console.error(chalk.green(`Creating custom page "${pageLabel}" (api: ${pageApi}, component: ${pluginIdentifier}), please wait...`));
146
+ console.error(
147
+ chalk.green(
148
+ `Creating custom page "${pageLabel}" (api: ${pageApi}, component: ${pluginIdentifier}), please wait...`
149
+ )
150
+ );
118
151
 
119
152
  const res = await post(
120
153
  `${baseUrl}${devSvcDispatch}/custom/pc/1.0/post/insertCustomPage`,
@@ -0,0 +1,46 @@
1
+ /**
2
+ * customPage 文档入口:正文均在 `docs/` 目录。
3
+ */
4
+ const fs = require("fs");
5
+ const path = require("path");
6
+
7
+ const DOCS_DIR = path.join(__dirname, "docs");
8
+
9
+ function readDocFile(basename) {
10
+ return fs.readFileSync(path.join(DOCS_DIR, `${basename}.md`), "utf8");
11
+ }
12
+
13
+ /** 介绍文档:自定义页面概念与能力 */
14
+ function getIntroductionDoc() {
15
+ return readDocFile("introduction");
16
+ }
17
+
18
+ /** 开发指导:搭建、集成与调试 */
19
+ function getDevGuideDoc() {
20
+ return readDocFile("devguide");
21
+ }
22
+
23
+ /**
24
+ * cc doc customPage <introduction|devguide>
25
+ * @param {string[]} argvs [doc, type, introduction|devguide, ...]
26
+ */
27
+ function doc(argvs) {
28
+ const subType = argvs[2];
29
+ const key = String(subType || "").trim().toLowerCase();
30
+ if (!key) {
31
+ throw new Error("cc doc customPage 需要子命令:introduction 或 devguide");
32
+ }
33
+ if (key === "introduction") {
34
+ const content = getIntroductionDoc();
35
+ console.log(content);
36
+ return content;
37
+ }
38
+ if (key === "devguide") {
39
+ const content = getDevGuideDoc();
40
+ console.log(content);
41
+ return content;
42
+ }
43
+ throw new Error(`doc 不支持的子命令: ${subType},请使用 introduction 或 devguide`);
44
+ }
45
+
46
+ module.exports = doc;
@@ -0,0 +1,200 @@
1
+ # CloudCC 自定义页面开发指南
2
+
3
+ ## 1. 模块定位
4
+
5
+ `customPage` 模块用于通过 CLI 管理自定义页面,当前提供:
6
+
7
+ - 创建页面:`cc create customPage ...`
8
+ - 查询页面:`cc get customPage ...`
9
+ - 删除页面:`cc delete customPage ...`
10
+ - 文档查看:`cc doc customPage introduction|devguide`
11
+
12
+ ---
13
+
14
+ ## 2. 开发前准备
15
+
16
+ 执行命令前请确认:
17
+
18
+ - 已完成 `cc doc project devguide` 的环境准备
19
+ - 项目路径下存在可用配置,且包含 `accessToken`
20
+ - 当前组织已存在至少一个自定义组件(创建页面时会依赖组件列表)
21
+
22
+ 若配置缺失,命令会报错:
23
+
24
+ ```text
25
+ Error: Configuration not found or accessToken is missing
26
+ ```
27
+
28
+ ---
29
+
30
+ ## 3. 命令总览(以代码实现为准)
31
+
32
+ ```bash
33
+ cc create customPage [<pageLabel> <pageApi> <pluginId|compLabel>] [projectPath]
34
+ cc get customPage [pageNo] [pageSize] [projectPath]
35
+ cc delete customPage <id> [projectPath]
36
+ cc doc customPage <introduction|devguide>
37
+ ```
38
+
39
+ ---
40
+
41
+ ## 4. 创建自定义页面
42
+
43
+ ## 4.1 标准创建模式
44
+
45
+ ```bash
46
+ cc create customPage <pageLabel> <pageApi> <pluginId|compLabel> [projectPath]
47
+ ```
48
+
49
+ 参数说明:
50
+
51
+ - `pageLabel`:页面名称
52
+ - `pageApi`:页面 API 名称
53
+ - `pluginId|compLabel`:组件标识,支持以下任一匹配:
54
+ - 组件 `id`
55
+ - 组件 `compLabel`
56
+ - 组件 `compUniName`
57
+ - `projectPath`:项目路径,默认当前目录
58
+
59
+ 示例:
60
+
61
+ ```bash
62
+ cc create customPage "合同助手页面" contract_assistant_page 2f9d0d6d2a ./
63
+ cc create customPage "合同助手页面" contract_assistant_page 合同助手组件
64
+ ```
65
+
66
+ ## 4.2 自动创建模式(无参数)
67
+
68
+ ```bash
69
+ cc create customPage
70
+ ```
71
+
72
+ 当不传 `pageLabel/pageApi/plugin` 三个参数时,CLI 会自动:
73
+
74
+ 1. 拉取自定义组件列表
75
+ 2. 使用列表第一个组件
76
+ 3. 生成页面名:`CLI自动页面_<timestamp>`
77
+ 4. 生成页面 API:`cc_cli_page_<timestamp>`
78
+
79
+ 这是快速验证环境是否可用的便捷方式。
80
+
81
+ ## 4.3 参数校验规则
82
+
83
+ - 三个核心参数要么**同时传入**,要么**全部省略**
84
+ - 若只传部分参数,会报错并提示正确用法:
85
+
86
+ ```text
87
+ Error: pageLabel、pageApi、pluginId/compLabel 需同时提供,或全部省略以使用第一个自定义组件
88
+ Usage: cc create customPage [<pageLabel> <pageApi> <pluginId|compLabel>] [projectPath]
89
+ ```
90
+
91
+ ## 4.4 创建过程说明
92
+
93
+ 创建命令内部会执行以下步骤:
94
+
95
+ 1. 读取项目配置(token、org 等)
96
+ 2. 请求组件列表接口:`listCustomComp`
97
+ 3. 按 `id/compLabel/compUniName` 匹配组件
98
+ 4. 读取组件 `vueData`,并拼装页面内容
99
+ 5. 调用创建接口:`insertCustomPage`
100
+
101
+ 常见失败场景:
102
+
103
+ - 组件列表为空:`no custom components found`
104
+ - 指定组件未找到:`component "<x>" not found in custom component list`
105
+ - `vueData` 非合法 JSON:`plugin vueData is not valid JSON`
106
+
107
+ ---
108
+
109
+ ## 5. 查询自定义页面
110
+
111
+ ```bash
112
+ cc get customPage [pageNo] [pageSize] [projectPath]
113
+ ```
114
+
115
+ 参数说明:
116
+
117
+ - `pageNo`:页码,默认 `1`
118
+ - `pageSize`:每页数量,默认 `20`
119
+ - `projectPath`:项目路径,默认当前目录
120
+
121
+ 示例:
122
+
123
+ ```bash
124
+ cc get customPage
125
+ cc get customPage 1 50 ./
126
+ ```
127
+
128
+ 执行成功后会输出总数,并逐条打印页面:
129
+
130
+ - `ID`
131
+ - `Label`(`pageLabel`)
132
+ - `API`(`pageApi`)
133
+
134
+ ---
135
+
136
+ ## 6. 删除自定义页面
137
+
138
+ ```bash
139
+ cc delete customPage <id> [projectPath]
140
+ ```
141
+
142
+ 参数说明:
143
+
144
+ - `id`:页面 ID(必填)
145
+ - `projectPath`:项目路径,默认当前目录
146
+
147
+ 示例:
148
+
149
+ ```bash
150
+ cc delete customPage 2f9d0d6d2a
151
+ cc delete customPage 2f9d0d6d2a ./
152
+ ```
153
+
154
+ 若缺少 `id`,会报错:
155
+
156
+ ```text
157
+ Error: Custom page ID is required
158
+ Usage: cc delete customPage <id> [projectPath]
159
+ ```
160
+
161
+ ---
162
+
163
+ ## 7. 文档命令
164
+
165
+ ```bash
166
+ cc doc customPage introduction
167
+ cc doc customPage devguide
168
+ ```
169
+
170
+ 说明:
171
+
172
+ - 仅支持 `introduction` 与 `devguide`
173
+ - 传入其他子命令会抛错
174
+
175
+ ---
176
+
177
+ ## 8. 推荐操作流程
178
+
179
+ ```bash
180
+ # 1) 先查列表,确认现有页面
181
+ cc get customPage
182
+
183
+ # 2) 创建页面(标准模式)
184
+ cc create customPage "合同助手页面" contract_assistant_page 2f9d0d6d2a
185
+
186
+ # 3) 再查列表,确认创建成功并记录 ID
187
+ cc get customPage
188
+
189
+ # 4) 如需回滚,按 ID 删除
190
+ cc delete customPage <id>
191
+ ```
192
+
193
+ ---
194
+
195
+ ## 9. 注意事项
196
+
197
+ - `create` 强依赖自定义组件,先确保组件已存在
198
+ - 建议优先使用可读性高的 `pageApi` 命名(如业务域+功能)
199
+ - 删除前先确认页面未被菜单或其他入口依赖
200
+ - 生产环境操作前,先在测试环境验证参数与组件匹配
@@ -199,11 +199,7 @@ methods: {
199
199
  5. 配置组件属性
200
200
  6. 保存页面
201
201
 
202
- ### 8.2 开发自定义组件
203
-
204
- 参考:[自定义组件开发文档](https://cloudccone.feishu.cn/wiki/AzyWwgHBPiEG2gkeDEXcb56snbb)
205
-
206
- ### 8.3 调试与发布
202
+ ### 8.4 调试与发布
207
203
 
208
204
  - 使用预览功能测试页面
209
205
  - 移动端使用 eruda 调试
@@ -2,6 +2,7 @@ const cc = {};
2
2
  cc.create = require('./create');
3
3
  cc.delete = require('./delete');
4
4
  cc.get = require('./get');
5
+ cc.doc = require('./doc');
5
6
 
6
7
  function CustomPage(action, argvs) {
7
8
  cc[action](argvs);
@@ -1,3 +1,12 @@
1
+ /**
2
+ * 自定义设置 - 新建/更新(保存主对象)
3
+ * API: POST {setupSvc}/api/customsetting/save
4
+ * CLI: cc create customSetting <projectPath> <encodedBodyJson>
5
+ * 参数说明:
6
+ * - projectPath: 项目根目录
7
+ * - encodedBodyJson: encodeURI(JSON.stringify(body))
8
+ * - body: { tpSysObjectVO: { id, label, schemetableName, dataType, accessable, remark, ... } }
9
+ */
1
10
  const chalk = require("chalk");
2
11
  const { getPackageJson } = require("../../utils/config");
3
12
  const { postClass } = require("../../utils/http");
@@ -1,3 +1,12 @@
1
+ /**
2
+ * 自定义设置 - 删除主对象
3
+ * API: POST {setupSvc}/api/customsetting/deleteobj
4
+ * CLI: cc delete customSetting <projectPath> <settingId>
5
+ * 参数说明:
6
+ * - projectPath: 项目根目录
7
+ * - id(命令参数名 settingId): 自定义设置 id
8
+ * - 请求体: { objid: id }
9
+ */
1
10
  const chalk = require("chalk");
2
11
  const { getPackageJson } = require("../../utils/config");
3
12
  const { postClass } = require("../../utils/http");
@@ -12,7 +21,7 @@ async function remove(projectPath = process.cwd(), id) {
12
21
  console.error();
13
22
  const res = await postClass(
14
23
  config.setupSvc + "/api/customsetting/deleteobj",
15
- { id },
24
+ { objid: id },
16
25
  config.accessToken
17
26
  );
18
27
  if (res && res.result) {
@@ -0,0 +1,43 @@
1
+ /**
2
+ * 自定义设置字段 - 删除字段
3
+ * API: POST {setupSvc}/api/customsetting/deletefield
4
+ * CLI: cc deleteCustomSettingField customSetting <projectPath> <fieldId> <settingId>
5
+ * 参数说明:
6
+ * - projectPath: 项目根目录
7
+ * - id(命令参数名 fieldId): 字段 id
8
+ * - objid(命令参数名 settingId): 所属自定义设置 id
9
+ * - 请求体: { id, objid }
10
+ */
11
+ const chalk = require("chalk");
12
+ const { getPackageJson } = require("../../utils/config");
13
+ const { postClass } = require("../../utils/http");
14
+
15
+ /**
16
+ * 删除自定义字段
17
+ */
18
+ async function deletefield(projectPath = process.cwd(), id, objid) {
19
+ if (!id) {
20
+ throw new Error("Custom Setting deletefield Failed: id is required");
21
+ }
22
+ if (!objid) {
23
+ throw new Error("Custom Setting deletefield Failed: objid is required");
24
+ }
25
+
26
+ const config = await getPackageJson(projectPath);
27
+ const res = await postClass(
28
+ config.setupSvc + "/api/customsetting/deletefield",
29
+ { id, objid },
30
+ config.accessToken
31
+ );
32
+
33
+ if (res && res.result) {
34
+ console.error();
35
+ console.error(chalk.green(`Success! Custom setting field deleted.`));
36
+ console.error();
37
+ return res;
38
+ }
39
+ throw new Error("Custom Setting deletefield Failed: " + (res?.returnInfo || res?.message || "Unknown error"));
40
+ }
41
+
42
+ module.exports = deletefield;
43
+
@@ -1,3 +1,12 @@
1
+ /**
2
+ * 自定义设置 - 详情(含字段列表)
3
+ * API: POST {setupSvc}/api/customsetting/detail
4
+ * CLI: cc detail customSetting <projectPath> <settingId>
5
+ * 参数说明:
6
+ * - projectPath: 项目根目录
7
+ * - id(命令参数名 settingId): 自定义设置 id
8
+ * - 请求体: { objid: id }
9
+ */
1
10
  const { getPackageJson } = require("../../utils/config");
2
11
  const { postClass } = require("../../utils/http");
3
12
 
@@ -8,7 +17,7 @@ async function detail(projectPath = process.cwd(), id, isMcp = false) {
8
17
  const config = await getPackageJson(projectPath);
9
18
  const res = await postClass(
10
19
  config.setupSvc + "/api/customsetting/detail",
11
- { id },
20
+ { objid: id },
12
21
  config.accessToken
13
22
  );
14
23
  if (res && res.result) {