cloudcc-cli 2.3.8 → 2.4.0

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 (66) hide show
  1. package/.cursor/skills/{cloudcc-cli-dev → dev-guide}/SKILL.md +5 -1
  2. package/README.md +82 -1
  3. package/bin/cc.js +2 -1
  4. package/bin/index.js +1 -0
  5. package/cloudcc-dev-skill/SKILL.md +31 -8
  6. package/cloudcc-dev-skill/cloudcc-dev-html.md +42 -0
  7. package/cloudcc-dev-skill/config.json +2 -2
  8. package/mcp/index.js +27 -3
  9. package/mcp/tools/JSP Migrator/handler.js +51 -866
  10. package/mcp/tools/Object Creator/handler.js +14 -4
  11. package/mcp/tools/Object Fields Creator/handler.js +149 -3
  12. package/package.json +1 -1
  13. package/src/classes/docs/devguide.md +758 -364
  14. package/src/classes/docs/introduction.md +279 -143
  15. package/src/fields/buildFieldData.js +692 -0
  16. package/src/fields/create.js +10 -170
  17. package/src/fields/detail.js +37 -0
  18. package/src/fields/docs/devguide.md +168 -44
  19. package/src/fields/docs/introduction.md +2 -0
  20. package/src/fields/fields/A.js +3 -2
  21. package/src/fields/fields/AD.js +4 -2
  22. package/src/fields/fields/B.js +8 -5
  23. package/src/fields/fields/C.js +13 -5
  24. package/src/fields/fields/D.js +4 -4
  25. package/src/fields/fields/E.js +10 -5
  26. package/src/fields/fields/ENC.js +27 -8
  27. package/src/fields/fields/ENCD.js +27 -8
  28. package/src/fields/fields/F.js +4 -4
  29. package/src/fields/fields/FL.js +8 -4
  30. package/src/fields/fields/H.js +4 -4
  31. package/src/fields/fields/IMG.js +23 -5
  32. package/src/fields/fields/J.js +21 -6
  33. package/src/fields/fields/L.js +32 -8
  34. package/src/fields/fields/LT.js +23 -6
  35. package/src/fields/fields/M.js +2 -2
  36. package/src/fields/fields/MR.js +2 -2
  37. package/src/fields/fields/N.js +31 -8
  38. package/src/fields/fields/P.js +13 -5
  39. package/src/fields/fields/Q.js +42 -12
  40. package/src/fields/fields/S.js +19 -7
  41. package/src/fields/fields/SCORE.js +9 -4
  42. package/src/fields/fields/T.js +4 -4
  43. package/src/fields/fields/U.js +18 -5
  44. package/src/fields/fields/X.js +20 -6
  45. package/src/fields/fields/Y.js +17 -4
  46. package/src/fields/index.js +2 -0
  47. package/src/fields/update.js +148 -0
  48. package/src/jsp/analyze.js +17 -0
  49. package/src/jsp/doc.js +18 -0
  50. package/src/jsp/docs/devguide.md +111 -0
  51. package/src/jsp/docs/introduction.md +50 -0
  52. package/src/jsp/docs.js +21 -0
  53. package/src/jsp/index.js +14 -0
  54. package/src/jsp/migration.js +871 -0
  55. package/src/jsp/split.js +17 -0
  56. package/src/object/create.js +36 -10
  57. package/src/object/docs/devguide.md +6 -3
  58. package/src/project/docs/devguide.md +1 -1
  59. package/src/timer/docs/devguide.md +849 -400
  60. package/src/timer/docs/introduction.md +343 -231
  61. package/src/triggers/docs/devguide.md +929 -352
  62. package/src/triggers/docs/introduction.md +640 -369
  63. package/src/version/listModuleCommands.js +6 -0
  64. package/test/fields.cli.test.js +3 -1
  65. package/test/jsp.cli.test.js +70 -0
  66. package/test/object.cli.test.js +9 -1
@@ -8,16 +8,26 @@ const { runCcCommand } = require('../../cliRunner');
8
8
 
9
9
  /**
10
10
  * 创建自定义对象
11
- * @param {{label: string, projectPath?: string}} params
11
+ * @param {{label: string, projectPath?: string, businessDescription: string}} params
12
12
  */
13
13
  async function createCustomObject(params = {}) {
14
- const { label, projectPath } = params;
14
+ const { label, projectPath, businessDescription } = params;
15
15
  if (!label) {
16
16
  return { content: [{ type: 'text', text: '✗ 参数缺失: label (对象标签) 必须提供' }] };
17
17
  }
18
+ if (!businessDescription || !String(businessDescription).trim()) {
19
+ return { content: [{ type: 'text', text: '✗ 参数缺失: businessDescription(业务功能描述)必填' }] };
20
+ }
18
21
 
19
22
  const resolvedPath = path.resolve(projectPath || '.');
20
- const runResult = runCcCommand(['create', 'object', resolvedPath, label], { cwd: resolvedPath });
23
+ const argv = [
24
+ 'create',
25
+ 'object',
26
+ resolvedPath,
27
+ label,
28
+ String(businessDescription).trim()
29
+ ];
30
+ const runResult = runCcCommand(argv, { cwd: resolvedPath });
21
31
 
22
32
  if (!runResult.success) {
23
33
  const detail = [runResult.error, runResult.stderr, runResult.stdout].filter(Boolean).join('\n');
@@ -32,7 +42,7 @@ async function createCustomObject(params = {}) {
32
42
  return {
33
43
  content: [{
34
44
  type: 'text',
35
- text: `✓ 自定义对象创建成功!\n\n调用命令: cloudcc create object ${resolvedPath} ${label}\n项目目录: ${resolvedPath}\n对象标签: ${label}\n\n创建过程:\n1. 生成对象的 schema 文件\n2. 配置对象权限\n3. 部署到 CloudCC 系统`
45
+ text: `✓ 自定义对象创建成功!\n\n调用命令: cloudcc create object ${resolvedPath} ${label} "${String(businessDescription).trim()}"\n项目目录: ${resolvedPath}\n对象标签: ${label}\n\n创建过程:\n1. 生成对象的 schema 文件\n2. 配置对象权限\n3. 部署到 CloudCC 系统`
36
46
  }]
37
47
  };
38
48
  }
@@ -14,6 +14,29 @@ const { runCcCommand, buildRunDetail } = require('../../cliRunner');
14
14
  * nameLabel: string,
15
15
  * ptext: string,
16
16
  * lookupObj: string,
17
+ * lookupObjDefaultField?: string,
18
+ * remark: string,
19
+ * schemefieldLength?: string,
20
+ * helps?: string,
21
+ * isrepeat?: string,
22
+ * casesensitive?: string,
23
+ * placeholder?: string,
24
+ * defaultValue?: string,
25
+ * edittype?: string,
26
+ * useGlobalSelect?: string,
27
+ * isPicklistSorted?: string,
28
+ * defPl?: string,
29
+ * globalSelectId?: string,
30
+ * visibleLines?: string,
31
+ * showalloptions?: string,
32
+ * masktype?: string,
33
+ * encrypttype?: string,
34
+ * maskcharacter?: string,
35
+ * displayType?: string,
36
+ * formulaType?: string,
37
+ * watermarkstatus?: string,
38
+ * decimalPlaces?: string,
39
+ * displayThousands?: string,
17
40
  * projectPath?: string
18
41
  * }} params
19
42
  */
@@ -21,15 +44,138 @@ async function createObjectField(params = {}) {
21
44
  try {
22
45
  const resolvedPath = path.resolve(params.projectPath || '.');
23
46
  let args = ['create', 'fields', resolvedPath];
47
+ // 统一规则:remark 固定作为 argv[6],因此 MCP 调用也要把 remark 固定插入到 nameLabel 后面
48
+ const remark = params.remark || "auto created by cloudcc-cli ai agent";
24
49
  if ("Y" == params.fieldType || "MR" == params.fieldType || "M" == params.fieldType) {
25
50
  const { objid, fieldType, nameLabel, lookupObj } = params;
26
- args.push(fieldType, objid, nameLabel, lookupObj);
51
+ args.push(fieldType, objid, nameLabel, remark);
52
+ args.push(params.helps || "");
53
+ args.push(params.defaultValue || "");
54
+ args.push(lookupObj);
55
+ if (params.fieldType === "Y") {
56
+ args.push(params.lookupObjDefaultField || "");
57
+ }
27
58
  } else if ("L" == params.fieldType || "Q" == params.fieldType) {
28
59
  const { objid, fieldType, nameLabel, ptext } = params;
29
- args.push(fieldType, objid, nameLabel, ptext);
60
+ args.push(fieldType, objid, nameLabel, remark);
61
+ args.push(params.helps || "");
62
+ args.push(params.defaultValue || "");
63
+ args.push(ptext || "");
64
+ if ("L" == params.fieldType) {
65
+ args.push(params.useGlobalSelect || "");
66
+ args.push(params.edittype || "");
67
+ args.push(params.isPicklistSorted || "");
68
+ args.push(params.defPl || "");
69
+ args.push(params.globalSelectId || "");
70
+ }
71
+ if ("Q" == params.fieldType) {
72
+ args.push(params.useGlobalSelect || "");
73
+ args.push(params.edittype || "");
74
+ args.push(params.isPicklistSorted || "");
75
+ args.push(params.defPl || "");
76
+ args.push(params.globalSelectId || "");
77
+ args.push(params.visibleLines || "");
78
+ args.push(params.showalloptions || "");
79
+ }
30
80
  } else {
31
81
  const { objid, fieldType, nameLabel } = params;
32
- args.push(fieldType, objid, nameLabel);
82
+ args.push(fieldType, objid, nameLabel, remark);
83
+ // S:argvs[7..8] helps/defaultValue,专属从 argvs[9] 起
84
+ if (fieldType === "S") {
85
+ args.push(params.helps || "");
86
+ args.push(params.defaultValue || "");
87
+ args.push(params.schemefieldLength || "255");
88
+ args.push(params.isrepeat || "true");
89
+ args.push(params.placeholder || "");
90
+ args.push(params.casesensitive || "");
91
+ }
92
+ // U:edittype 在 argvs[9]
93
+ if (fieldType === "U") {
94
+ args.push(params.helps || "");
95
+ args.push(params.defaultValue || "");
96
+ args.push(params.edittype || "");
97
+ }
98
+ // P 字段支持:helps/defaultValue/schemefieldLength(整数位)/decimalPlaces(小数位)
99
+ if (fieldType === "P") {
100
+ args.push(params.helps || "");
101
+ args.push(params.defaultValue || "");
102
+ args.push(params.schemefieldLength || "10");
103
+ args.push(params.decimalPlaces || "2");
104
+ }
105
+ // C 字段(币种):参数位置与 P 相同
106
+ if (fieldType === "C") {
107
+ args.push(params.helps || "");
108
+ args.push(params.defaultValue || "");
109
+ args.push(params.schemefieldLength || "10");
110
+ args.push(params.decimalPlaces || "2");
111
+ }
112
+ // N(数字):整数位/小数位/isrepeat/displayThousands,argvs[9..12]
113
+ if (fieldType === "N") {
114
+ args.push(params.helps || "");
115
+ args.push(params.defaultValue || "");
116
+ args.push(params.schemefieldLength || "10");
117
+ args.push(params.decimalPlaces || "0");
118
+ args.push(params.isrepeat || "true");
119
+ args.push(params.displayThousands || "0");
120
+ }
121
+ // E(电子邮件):isrepeat 在 argvs[9]
122
+ if (fieldType === "E") {
123
+ args.push(params.helps || "");
124
+ args.push(params.defaultValue || "");
125
+ args.push(params.isrepeat || "true");
126
+ }
127
+ // SCORE(评分):最大评分(星星数)在 argvs[9],1~100
128
+ if (fieldType === "SCORE") {
129
+ args.push(params.helps || "");
130
+ args.push(params.defaultValue || "");
131
+ args.push(params.schemefieldLength || "10");
132
+ }
133
+ // X(文本区):最大字符数 argvs[9]、placeholder argvs[10]
134
+ if (fieldType === "X") {
135
+ args.push(params.helps || "");
136
+ args.push(params.defaultValue || "");
137
+ args.push(params.schemefieldLength || "4000");
138
+ args.push(params.placeholder || "");
139
+ }
140
+ // J(文本区长):最大字符数 argvs[9]、placeholder argvs[10],默认 32000
141
+ if (fieldType === "J") {
142
+ args.push(params.helps || "");
143
+ args.push(params.defaultValue || "");
144
+ args.push(params.schemefieldLength || "32000");
145
+ args.push(params.placeholder || "");
146
+ }
147
+ // IMG(图片):上传数量 argvs[8]、formulaType argvs[9]、watermarkstatus argvs[10]
148
+ if (fieldType === "IMG") {
149
+ args.push(params.helps || "");
150
+ args.push(params.defaultValue || "");
151
+ args.push(params.formulaType || "");
152
+ args.push(params.watermarkstatus || "");
153
+ }
154
+ // ENC(存储加密)/ ENCD(显示加密):长度 argvs[9]、masktype/encrypttype/maskcharacter argvs[10..12]
155
+ if (fieldType === "ENC" || fieldType === "ENCD") {
156
+ args.push(params.helps || "");
157
+ args.push(params.defaultValue || "");
158
+ args.push(params.schemefieldLength || "");
159
+ args.push(params.masktype || "");
160
+ args.push(params.encrypttype || "");
161
+ args.push(params.maskcharacter || "");
162
+ }
163
+ // LT(地理定位):整数位/小数位 argvs[9..10]、displayType argvs[11]
164
+ if (fieldType === "LT") {
165
+ args.push(params.helps || "");
166
+ args.push(params.defaultValue || "");
167
+ args.push(params.schemefieldLength || "");
168
+ args.push(params.decimalPlaces || "");
169
+ args.push(params.displayType || "");
170
+ }
171
+ // 其余多数类型:仅 helps(argvs[7])与 defaultValue(argvs[8])
172
+ const helpsDefaultOnly = new Set([
173
+ "H", "B", "A", "D", "F", "T", "AD", "FL"
174
+ ]);
175
+ if (helpsDefaultOnly.has(fieldType)) {
176
+ args.push(params.helps || "");
177
+ args.push(params.defaultValue || "");
178
+ }
33
179
  }
34
180
  const runResult = runCcCommand(args, { cwd: resolvedPath });
35
181
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudcc-cli",
3
- "version": "2.3.8",
3
+ "version": "2.4.0",
4
4
  "description": "cloudcc-cli",
5
5
  "author": "cloudcc",
6
6
  "license": "ISC",