cloudcc-cli 2.3.9 → 2.4.1

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 (53) hide show
  1. package/README.md +48 -0
  2. package/bin/cc.js +2 -1
  3. package/bin/index.js +1 -0
  4. package/cloudcc-dev-skill/SKILL.md +31 -8
  5. package/cloudcc-dev-skill/cloudcc-dev-html.md +42 -0
  6. package/cloudcc-dev-skill/config.json +2 -2
  7. package/mcp/index.js +10 -4
  8. package/mcp/tools/JSP Migrator/handler.js +51 -866
  9. package/mcp/tools/Object Creator/handler.js +14 -4
  10. package/mcp/tools/Trigger List Retriever/handler.js +24 -8
  11. package/package.json +1 -1
  12. package/src/classes/docs/devguide.md +863 -356
  13. package/src/classes/docs/introduction.md +279 -143
  14. package/src/jsp/analyze.js +17 -0
  15. package/src/jsp/doc.js +18 -0
  16. package/src/jsp/docs/devguide.md +111 -0
  17. package/src/jsp/docs/introduction.md +50 -0
  18. package/src/jsp/docs.js +21 -0
  19. package/src/jsp/index.js +14 -0
  20. package/src/jsp/migration.js +871 -0
  21. package/src/jsp/split.js +17 -0
  22. package/src/object/create.js +36 -10
  23. package/src/object/docs/devguide.md +6 -3
  24. package/src/project/docs/devguide.md +1 -1
  25. package/src/script/docs/devguide.md +22 -2
  26. package/src/timer/docs/devguide.md +1038 -400
  27. package/src/timer/docs/introduction.md +343 -231
  28. package/src/triggers/docs/devguide.md +1027 -329
  29. package/src/triggers/docs/introduction.md +640 -369
  30. package/src/triggers/get.js +8 -0
  31. package/src/version/listModuleCommands.js +6 -0
  32. package/target/classes/com/cloudcc/core/BaseException.class +0 -0
  33. package/target/classes/com/cloudcc/core/BusiException.class +0 -0
  34. package/target/classes/com/cloudcc/core/CCObject.class +0 -0
  35. package/target/classes/com/cloudcc/core/CCSchedule.class +0 -0
  36. package/target/classes/com/cloudcc/core/CCService.class +0 -0
  37. package/target/classes/com/cloudcc/core/CCTrigger.class +0 -0
  38. package/target/classes/com/cloudcc/core/CCTriggerHandler.class +0 -0
  39. package/target/classes/com/cloudcc/core/DevLogger.class +0 -0
  40. package/target/classes/com/cloudcc/core/OperatationEnum.class +0 -0
  41. package/target/classes/com/cloudcc/core/PeakInterf.class +0 -0
  42. package/target/classes/com/cloudcc/core/SendEmail.class +0 -0
  43. package/target/classes/com/cloudcc/core/ServiceResult.class +0 -0
  44. package/target/classes/com/cloudcc/core/StringUtils.class +0 -0
  45. package/target/classes/com/cloudcc/core/TimeUtil.class +0 -0
  46. package/target/classes/com/cloudcc/core/Tool$1.class +0 -0
  47. package/target/classes/com/cloudcc/core/Tool.class +0 -0
  48. package/target/classes/com/cloudcc/core/TriggerInvoker.class +0 -0
  49. package/target/classes/com/cloudcc/core/TriggerMethod.class +0 -0
  50. package/target/classes/com/cloudcc/core/TriggerTimeEnum.class +0 -0
  51. package/target/classes/com/cloudcc/core/UserInfo.class +0 -0
  52. package/test/jsp.cli.test.js +70 -0
  53. package/test/object.cli.test.js +9 -1
@@ -3,6 +3,14 @@ const { postClass } = require("../../utils/http")
3
3
 
4
4
  /**
5
5
  * cloudcc get triggers <listQueryJson> [projectPath]
6
+ * listQueryJson 字段说明:
7
+ * - shownum: 每页条数
8
+ * - showpage: 页码
9
+ * - sname: 触发器名字
10
+ * - fid: 触发器作用对象 ID(兼容字段)
11
+ * - objId: 触发器作用对象 ID(会自动映射到 fid)
12
+ * - rptcond: 额外筛选条件
13
+ * - rptorder: 排序条件
6
14
  * @param {string[]} argvs
7
15
  */
8
16
  async function get(argvs, isMcp = false) {
@@ -18,6 +18,7 @@ const MODULE_KEYS_ORDER = [
18
18
  "triggers",
19
19
  "timer",
20
20
  "script",
21
+ "jsp",
21
22
  "token",
22
23
  "object",
23
24
  "recordType",
@@ -53,6 +54,7 @@ const MODULE_HINT = {
53
54
  schedule: "定时类(Scheduled Class):与平台同步 Java 与配置(resource 亦可用 timer)。",
54
55
  triggers: "触发器:本地 Java 与平台同步。",
55
56
  script: "客户端脚本:创建、发布、拉取等。",
57
+ jsp: "JSP 迁移:规则查看、分析与拆分生成。",
56
58
  token: "访问令牌/凭证。",
57
59
  object: "标准对象与自定义对象。",
58
60
  recordType: "记录类型。",
@@ -86,6 +88,7 @@ const MODULE_FOLDER = {
86
88
  triggers: "triggers",
87
89
  timer: "timer",
88
90
  script: "script",
91
+ jsp: "jsp",
89
92
  token: "token",
90
93
  object: "object",
91
94
  recordType: "recordType",
@@ -160,6 +163,7 @@ const RESOURCE_CN = {
160
163
  timer: "定时类",
161
164
  triggers: "触发器",
162
165
  script: "客户端脚本",
166
+ jsp: "JSP 迁移",
163
167
  token: "访问令牌",
164
168
  object: "对象",
165
169
  recordType: "记录类型",
@@ -204,6 +208,8 @@ function describeActionLine(resource, action) {
204
208
  modify: () => `修改${n}`,
205
209
  download: () => `下载${n}相关文件`,
206
210
  getList: () => `获取${n}列表`,
211
+ analyze: () => `分析${n}`,
212
+ split: () => `拆分${n}`,
207
213
  newInfo: () => `获取新建${n}所需信息`,
208
214
  editInfo: () => `获取编辑${n}前信息`,
209
215
  editSave: () => `保存${n}编辑`,
@@ -0,0 +1,70 @@
1
+ const test = require("node:test")
2
+ const assert = require("node:assert/strict")
3
+ const fs = require("node:fs")
4
+ const os = require("node:os")
5
+ const path = require("node:path")
6
+ const { execFile } = require("node:child_process")
7
+ const { promisify } = require("node:util")
8
+
9
+ const execFileAsync = promisify(execFile)
10
+ const repoRoot = path.resolve(__dirname, "..")
11
+
12
+ async function runCc(args, cwd = repoRoot) {
13
+ return execFileAsync(
14
+ process.execPath,
15
+ [path.join(repoRoot, "bin", "cc.js"), ...args],
16
+ { cwd }
17
+ )
18
+ }
19
+
20
+ test("jsp doc/analyze/split CLI workflow", async () => {
21
+ const tmpRoot = fs.mkdtempSync(path.join(os.tmpdir(), "cloudcc-jsp-"))
22
+ const customizeDir = path.join(tmpRoot, "customize")
23
+ fs.mkdirSync(customizeDir, { recursive: true })
24
+
25
+ const jspPath = path.join(customizeDir, "wt_ly.jsp")
26
+ fs.writeFileSync(
27
+ jspPath,
28
+ `<cc>
29
+ </cc>
30
+ <div>legacy page</div>
31
+ <cc!>
32
+ if ("save".equals(reason)) {
33
+ cs.cquery("Account");
34
+ Object result = new PageClsInvoker(userInfo).invoker("FooService", "saveData", argList);
35
+ }
36
+ </cc>`,
37
+ "utf8"
38
+ )
39
+
40
+ const { stdout: docStdout } = await runCc(["doc", "jsp", "devguide"], tmpRoot)
41
+ assert.match(docStdout, /## 6\. JSP 迁移规则/)
42
+ assert.match(docStdout, /customize/)
43
+
44
+ const analyzePayload = encodeURI(JSON.stringify({
45
+ jspPath: "customize/wt_ly.jsp",
46
+ projectPath: tmpRoot,
47
+ }))
48
+ const { stdout: analyzeStdout } = await runCc(["analyze", "jsp", analyzePayload], tmpRoot)
49
+ assert.match(analyzeStdout, /JSP 迁移分析完成/)
50
+ assert.match(analyzeStdout, /reason分支: 1/)
51
+
52
+ const splitPayload = encodeURI(JSON.stringify({
53
+ jspPath: "customize/wt_ly.jsp",
54
+ projectPath: tmpRoot,
55
+ overwrite: true,
56
+ }))
57
+ const { stdout: splitStdout } = await runCc(["split", "jsp", splitPayload], tmpRoot)
58
+ assert.match(splitStdout, /JSP 迁移生成完成/)
59
+
60
+ const classDir = path.join(tmpRoot, "classes", "WtLyMigratedService")
61
+ const pluginDir = path.join(tmpRoot, "plugins", "wt-ly-migrated")
62
+ const reportPath = path.join(tmpRoot, "migration-report", "wt_ly.migration.md")
63
+
64
+ assert.ok(fs.existsSync(path.join(classDir, "WtLyMigratedService.java")))
65
+ assert.ok(fs.existsSync(path.join(classDir, "WtLyMigratedServiceTest.java")))
66
+ assert.ok(fs.existsSync(path.join(classDir, "config.json")))
67
+ assert.ok(fs.existsSync(path.join(pluginDir, "wt-ly-migrated.vue")))
68
+ assert.ok(fs.existsSync(path.join(pluginDir, "config.json")))
69
+ assert.ok(fs.existsSync(reportPath))
70
+ })
@@ -23,7 +23,15 @@ test("对象管理流程:get 对象列表→create 对象→get 列表校验
23
23
  let createdObjId = null;
24
24
 
25
25
  t.test("1) create 创建自定义对象", async () => {
26
- await assert.doesNotReject(() => runCc(["create", "object", repoRoot, objectLabel]));
26
+ await assert.doesNotReject(() =>
27
+ runCc([
28
+ "create",
29
+ "object",
30
+ repoRoot,
31
+ objectLabel,
32
+ "CLI 集成测试用对象业务说明",
33
+ ])
34
+ );
27
35
  console.error(`\n[object-test] 已创建自定义对象 label: ${objectLabel}`);
28
36
  });
29
37