cloudcc-cli 2.4.0 → 2.4.2

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 (49) hide show
  1. package/README.md +60 -0
  2. package/bin/index.js +5 -0
  3. package/cloudcc-dev-skill/SKILL.md +6 -12
  4. package/cloudcc-dev-skill/config.json +2 -2
  5. package/mcp/index.js +9 -4
  6. package/mcp/tools/Trigger List Retriever/handler.js +24 -8
  7. package/package.json +2 -2
  8. package/src/classes/create.js +1 -1
  9. package/src/classes/docs/devguide.md +138 -25
  10. package/src/config/use.js +20 -5
  11. package/src/dupeCatcher/create.js +76 -0
  12. package/src/dupeCatcher/delete.js +69 -0
  13. package/src/dupeCatcher/detail.js +57 -0
  14. package/src/dupeCatcher/doc.js +11 -0
  15. package/src/dupeCatcher/docs/devguide.md +125 -0
  16. package/src/dupeCatcher/docs/introduction.md +21 -0
  17. package/src/dupeCatcher/get.js +88 -0
  18. package/src/dupeCatcher/index.js +14 -0
  19. package/src/html/doc.js +35 -0
  20. package/src/html/docs/devguide.md +67 -0
  21. package/src/html/docs/introduction.md +4 -0
  22. package/src/html/index.js +11 -0
  23. package/src/openapi/cloudcc-openapi-sdk.js +1085 -0
  24. package/src/openapi/doc.js +30 -0
  25. package/src/openapi/docs/devguide.md +65 -0
  26. package/src/openapi/docs/introduction.md +43 -0
  27. package/src/openapi/get.js +45 -0
  28. package/src/openapi/index.js +12 -0
  29. package/src/plugin/publish1.js +1 -1
  30. package/src/plugin/pull.js +2 -2
  31. package/src/script/docs/devguide.md +22 -2
  32. package/src/sharingRule/doc.js +46 -0
  33. package/src/sharingRule/docs/devguide.md +28 -0
  34. package/src/sharingRule/docs/introduction.md +7 -0
  35. package/src/sharingRule/get.js +48 -0
  36. package/src/sharingRule/index.js +9 -0
  37. package/src/site/doc.js +35 -0
  38. package/src/site/docs/devguide.md +209 -0
  39. package/src/site/docs/introduction.md +4 -0
  40. package/src/site/index.js +11 -0
  41. package/src/timer/docs/devguide.md +218 -29
  42. package/src/triggers/docs/devguide.md +247 -127
  43. package/src/triggers/get.js +7 -0
  44. package/src/version/doctor.js +11 -4
  45. package/src/version/listModuleCommands.js +20 -0
  46. package/template/index.js +2 -2
  47. package/utils/config.js +129 -21
  48. package/cloudcc-dev-skill/cloudcc-dev-html.md +0 -42
  49. package/template/cloudcc-cli.configjs +0 -7
@@ -0,0 +1,125 @@
1
+ # CloudCC 查重过滤器(Dupe Catcher)CLI 命令说明
2
+
3
+ > 对应 one-setup-web 的接口前缀:`{setupSvc}/api/duplication/*`
4
+
5
+ ## 1. 功能范围
6
+
7
+ - 过滤器(Filter):列表、详情、保存(新建/编辑)、删除
8
+ - 规则(Rule):回显详情、保存(新建/编辑)、删除
9
+ - 辅助查询:可选对象、可选字段、条件面板字段列表
10
+
11
+ ## 2. 命令总览
12
+
13
+ ```bash
14
+ # 过滤器列表
15
+ cloudcc get dupeCatcher [projectPath]
16
+
17
+ # 过滤器详情(含规则列表)
18
+ cloudcc detail dupeCatcher <projectPath> <filterid>
19
+
20
+ # 保存过滤器(新建/编辑)
21
+ cloudcc create dupeCatcher <projectPath> filter <encodedBodyJson>
22
+
23
+ # 删除过滤器
24
+ cloudcc delete dupeCatcher <projectPath> filter <filterid>
25
+
26
+ # 规则详情(回显)
27
+ cloudcc detail dupeCatcher <projectPath> rule <ruleid>
28
+
29
+ # 保存规则(新建/编辑)
30
+ cloudcc create dupeCatcher <projectPath> rule <encodedBodyJson>
31
+
32
+ # 删除规则
33
+ cloudcc delete dupeCatcher <projectPath> rule <ruleid>
34
+
35
+ # 新建过滤器前:查询可选对象
36
+ cloudcc get dupeCatcher objects [projectPath]
37
+
38
+ # 新建规则前:查询可选字段
39
+ cloudcc get dupeCatcher <projectPath> fields <filterid>
40
+
41
+ # 条件面板字段列表(复用工作流接口)
42
+ cloudcc get dupeCatcher <projectPath> workflowFields <targetobjectid>
43
+ ```
44
+
45
+ ## 3. 参数说明
46
+
47
+ ### 3.1 projectPath
48
+
49
+ - **可选**,项目根目录(默认当前目录)。
50
+
51
+ ### 3.2 encodedBodyJson
52
+
53
+ - **必须**:`encodeURI(JSON.stringify(body))`
54
+
55
+ ### 3.3 命令参数一览
56
+
57
+ | 命令 | 参数 |
58
+ | :--- | :--- |
59
+ | `cloudcc get dupeCatcher [projectPath]` | `projectPath` 可选 |
60
+ | `cloudcc detail dupeCatcher <projectPath> <filterid>` | `projectPath` 可选(默认当前目录),`filterid` 必填 |
61
+ | `cloudcc create dupeCatcher <projectPath> filter <encodedBodyJson>` | `projectPath` 可选(默认当前目录),`encodedBodyJson` 必填 |
62
+ | `cloudcc delete dupeCatcher <projectPath> filter <filterid>` | `projectPath` 可选(默认当前目录),`filterid` 必填 |
63
+ | `cloudcc detail dupeCatcher <projectPath> rule <ruleid>` | `projectPath` 可选(默认当前目录),`ruleid` 必填 |
64
+ | `cloudcc create dupeCatcher <projectPath> rule <encodedBodyJson>` | `projectPath` 可选(默认当前目录),`encodedBodyJson` 必填 |
65
+ | `cloudcc delete dupeCatcher <projectPath> rule <ruleid>` | `projectPath` 可选(默认当前目录),`ruleid` 必填 |
66
+ | `cloudcc get dupeCatcher objects [projectPath]` | `projectPath` 可选 |
67
+ | `cloudcc get dupeCatcher <projectPath> fields <filterid>` | `projectPath` 可选(默认当前目录),`filterid` 必填 |
68
+ | `cloudcc get dupeCatcher <projectPath> workflowFields <targetobjectid>` | `projectPath` 可选(默认当前目录),`targetobjectid` 必填 |
69
+
70
+ ### 3.4 `create dupeCatcher filter` 的 body 字段
71
+
72
+ | 字段 | 类型 | 是否必须 | 说明 |
73
+ | :--- | :--- | :--- | :--- |
74
+ | `id` | string | 否 | 编辑时传;新建可不传 |
75
+ | `name` | string | 是 | 过滤器名称 |
76
+ | `objid` | string | 是 | 目标对象 id |
77
+ | `errormessage` | string | 否 | 错误提示文案 |
78
+ | `insertoperation` | string | 是 | 新增策略:`check` / `nothing` |
79
+ | `insertIsSave` | string/null | 条件必填 | `insertoperation=check` 时建议传 `"1"`/`"0"`,否则传 `null` |
80
+ | `insertIsTips` | string/null | 条件必填 | `insertoperation=check` 时建议传 `"1"`/`"0"`,否则传 `null` |
81
+ | `updateoperation` | string | 是 | 更新策略:`check` / `nothing` |
82
+ | `updateIsSave` | string/null | 条件必填 | `updateoperation=check` 时建议传 `"1"`/`"0"`,否则传 `null` |
83
+ | `updateIsTips` | string/null | 条件必填 | `updateoperation=check` 时建议传 `"1"`/`"0"`,否则传 `null` |
84
+ | `isprofile` | boolean | 否 | 是否简档 |
85
+ | `isactive` | boolean | 否 | 是否启用 |
86
+ | `conditionVals` | string | 是 | 条件面板产出的 JSON 字符串 |
87
+
88
+ ### 3.5 `create dupeCatcher rule` 的 body 字段
89
+
90
+ | 字段 | 类型 | 是否必须 | 说明 |
91
+ | :--- | :--- | :--- | :--- |
92
+ | `id` | string | 否 | 编辑时传;新建可不传 |
93
+ | `filterid` | string | 是 | 所属过滤器 id |
94
+ | `fieldid` | string | 是 | 匹配字段 id |
95
+ | `matchoption` | string | 是 | `exact` / `contains` / `firstNletters` / `lastNletters` |
96
+ | `firstletters` | string | 条件必填 | `matchoption` 为 `firstNletters/lastNletters` 时传字母数 |
97
+ | `isblank` | number | 否 | 空值是否参与匹配,常用 `1/0` |
98
+
99
+ ## 4. 示例
100
+
101
+ ### 4.1 查询过滤器列表
102
+
103
+ ```bash
104
+ cloudcc get dupeCatcher .
105
+ ```
106
+
107
+ ### 4.2 保存过滤器(新建)
108
+
109
+ > 关键字段(与页面一致):`name`、`objid`、`insertoperation`、`updateoperation`、`conditionVals` 等。
110
+
111
+ ```bash
112
+ cloudcc create dupeCatcher . filter "$(node -e "console.log(encodeURI(JSON.stringify({name:'测试过滤器',objid:'<objid>',errormessage:'',insertoperation:'check',insertIsSave:'1',insertIsTips:'1',updateoperation:'check',updateIsSave:'1',updateIsTips:'1',isprofile:false,isactive:true,conditionVals:'{}'})))")"
113
+ ```
114
+
115
+ ### 4.3 保存规则(新建)
116
+
117
+ ```bash
118
+ cloudcc create dupeCatcher . rule "$(node -e "console.log(encodeURI(JSON.stringify({filterid:'<filterid>',fieldid:'<fieldid>',matchoption:'exact',firstletters:'',isblank:0})))")"
119
+ ```
120
+
121
+ ## 5. 注意事项
122
+
123
+ - `filterid` / `ruleid` / `objid` / `fieldid` 都来自平台返回数据,请先通过列表/详情接口获取。
124
+ - `conditionVals` 是页面条件面板产出的 **json 字符串**(不是对象),请按接口要求传入字符串。
125
+
@@ -0,0 +1,21 @@
1
+ # CloudCC 查重过滤器(Dupe Catcher)介绍
2
+
3
+ 查重过滤器用于在**新建或编辑业务数据**时,按配置的**对象、字段与条件**检测是否与已有记录重复,从而提示或阻断保存。平台侧通过 **过滤器(Filter)** 与 **规则(Rule)** 两层建模:过滤器绑定目标对象与启用范围,规则描述具体匹配字段与逻辑。
4
+
5
+ ## 适用场景
6
+
7
+ - 客户、联系人、线索等主数据**去重**(姓名 + 手机、邮箱等组合)。
8
+ - 同一业务对象下**多套查重策略**(不同过滤器、不同规则集)。
9
+ - 与 **one-setup-web** 中查重配置能力一致,CLI 面向**导出配置、脚本化维护、与本地工程联调**。
10
+
11
+ ## 能力边界(与开发指南的关系)
12
+
13
+ - **介绍(本文)**:说明是什么、何时用、与平台概念对应关系。
14
+ - **开发指南**:`cloudcc doc dupeCatcher devguide` — 列出 `get` / `detail` / `create` / `delete` 等 CLI 命令、参数与接口前缀 `{setupSvc}/api/duplication/*`。
15
+
16
+ ## 相关命令入口
17
+
18
+ ```bash
19
+ cloudcc doc dupeCatcher introduction # 本文
20
+ cloudcc doc dupeCatcher devguide # CLI 与接口说明
21
+ ```
@@ -0,0 +1,88 @@
1
+ const { getPackageJson } = require("../../utils/config")
2
+ const { postClass } = require("../../utils/http")
3
+
4
+ /**
5
+ * Dupe Catcher (Duplication) queries.
6
+ *
7
+ * Supported:
8
+ * - cloudcc get dupeCatcher [projectPath]
9
+ * -> /api/duplication/getList
10
+ *
11
+ * - cloudcc get dupeCatcher objects [projectPath]
12
+ * -> /api/duplication/insetNewfilter
13
+ *
14
+ * - cloudcc get dupeCatcher fields <filterid> [projectPath]
15
+ * -> /api/duplication/insetNewrule
16
+ *
17
+ * - cloudcc get dupeCatcher workflowFields <targetobjectid> [projectPath]
18
+ * -> /api/workFlowSetup/newWorkflow
19
+ */
20
+ function isPathLikeToken(v) {
21
+ if (typeof v !== "string" || !v) return false
22
+ return v === "." || v === ".." || /[\\/]/.test(v) || /:/.test(v)
23
+ }
24
+
25
+ async function request(projectPath, apiPath, body) {
26
+ const config = await getPackageJson(projectPath)
27
+ return await postClass(config.setupSvc + apiPath, body || {}, config.accessToken)
28
+ }
29
+
30
+ async function get(projectPath = process.cwd(), sub, subArg, isMcp = false) {
31
+ // compatibility: cloudcc get dupeCatcher objects [projectPath]
32
+ if (!isPathLikeToken(projectPath) && (projectPath === "objects" || projectPath === "fields" || projectPath === "workflowFields")) {
33
+ subArg = sub
34
+ sub = projectPath
35
+ projectPath = process.cwd()
36
+ }
37
+
38
+ if (!sub) {
39
+ const res = await request(projectPath, "/api/duplication/getList", {})
40
+ if (res && res.result) {
41
+ const list = res.data || res.list || []
42
+ if (!isMcp) console.log(JSON.stringify(list))
43
+ return list
44
+ }
45
+ throw new Error("Get DupeCatcher filter list failed: " + (res?.returnInfo || res?.message || "Unknown error"))
46
+ }
47
+
48
+ if (sub === "objects") {
49
+ const res = await request(projectPath, "/api/duplication/insetNewfilter", {})
50
+ if (res && res.result) {
51
+ const data = res.data || res
52
+ if (!isMcp) console.log(JSON.stringify(data))
53
+ return data
54
+ }
55
+ throw new Error("Get DupeCatcher objects failed: " + (res?.returnInfo || res?.message || "Unknown error"))
56
+ }
57
+
58
+ if (sub === "fields") {
59
+ const filterid = subArg
60
+ if (!filterid) throw new Error("Missing filterid. Usage: cloudcc get dupeCatcher fields <filterid> [projectPath]")
61
+ const res = await request(projectPath, "/api/duplication/insetNewrule", { filterid })
62
+ if (res && res.result) {
63
+ const data = res.data || res
64
+ if (!isMcp) console.log(JSON.stringify(data))
65
+ return data
66
+ }
67
+ throw new Error("Get DupeCatcher fields failed: " + (res?.returnInfo || res?.message || "Unknown error"))
68
+ }
69
+
70
+ if (sub === "workflowFields") {
71
+ const targetobjectid = subArg
72
+ if (!targetobjectid) {
73
+ throw new Error("Missing targetobjectid. Usage: cloudcc get dupeCatcher workflowFields <targetobjectid> [projectPath]")
74
+ }
75
+ const res = await request(projectPath, "/api/workFlowSetup/newWorkflow", { targetobjectid })
76
+ if (res && res.result) {
77
+ const data = res.data || res
78
+ if (!isMcp) console.log(JSON.stringify(data))
79
+ return data
80
+ }
81
+ throw new Error("Get DupeCatcher workflowFields failed: " + (res?.returnInfo || res?.message || "Unknown error"))
82
+ }
83
+
84
+ throw new Error(`Unknown subcommand for get dupeCatcher: ${sub}`)
85
+ }
86
+
87
+ module.exports = get
88
+
@@ -0,0 +1,14 @@
1
+ const cc = {}
2
+
3
+ cc.get = require("./get")
4
+ cc.detail = require("./detail")
5
+ cc.create = require("./create")
6
+ cc.delete = require("./delete")
7
+ cc.doc = require("./doc")
8
+
9
+ function main(action, argvs) {
10
+ cc[action](argvs[2], argvs[3], argvs[4], argvs[5])
11
+ }
12
+
13
+ module.exports = main
14
+
@@ -0,0 +1,35 @@
1
+ const fs = require("fs");
2
+ const path = require("path");
3
+
4
+ const DOCS_DIR = path.join(__dirname, "docs");
5
+
6
+ function getIntroductionDoc() {
7
+ return fs.readFileSync(path.join(DOCS_DIR, "introduction.md"), "utf8");
8
+ }
9
+
10
+ function getDevGuideDoc() {
11
+ return fs.readFileSync(path.join(DOCS_DIR, "devguide.md"), "utf8");
12
+ }
13
+
14
+ function doc(argvs) {
15
+ const subType = argvs[2];
16
+ const key = String(subType || "").trim().toLowerCase();
17
+ if (!key) {
18
+ throw new Error("cloudcc doc html 需要子命令:introduction 或 devguide");
19
+ }
20
+ if (key === "introduction") {
21
+ const content = getIntroductionDoc();
22
+ console.log(content);
23
+ return content;
24
+ }
25
+ if (key === "devguide") {
26
+ const content = getDevGuideDoc();
27
+ console.log(content);
28
+ return content;
29
+ }
30
+ throw new Error(
31
+ `doc 不支持的子命令: ${subType},请使用 introduction 或 devguide`
32
+ );
33
+ }
34
+
35
+ module.exports = doc;
@@ -0,0 +1,67 @@
1
+ # CloudCC 自定义 HTML 组件开发指南
2
+
3
+ ## 1. 适用范围
4
+
5
+ - 本文用于在 CloudCC 相关项目中编写单个 HTML 入口页(通常为 `html/index.html`),适合 CloudCC 内嵌页面或独立打开的轻量页面场景。
6
+ - 静态依赖(样式、脚本、字体等)优先使用线上绝对地址(`https://...`)引入;公有云推荐使用中国大陆可稳定访问的源(如 BootCDN)。
7
+ - 私有云或内网环境可先下载依赖并上传为组织静态资源,再替换为静态资源 URL。
8
+
9
+ ## 2. 推荐前端依赖组合
10
+
11
+ 推荐组合:Tailwind CSS + Alpine.js + ECharts。
12
+
13
+ ### 2.1 Tailwind CSS(浏览器端编译)
14
+
15
+ ```html
16
+ <script src="https://cdn.bootcdn.net/ajax/libs/tailwindcss-browser/4.1.13/index.global.min.js"></script>
17
+ ```
18
+
19
+ ### 2.2 Alpine.js(交互层)
20
+
21
+ ```html
22
+ <script defer src="https://cdn.bootcdn.net/ajax/libs/alpinejs/3.15.0/cdn.min.js"></script>
23
+ ```
24
+
25
+ 建议放在 `head`,并在同页组合时保持 Tailwind 在前、Alpine 在后。
26
+
27
+ ### 2.3 ECharts(图表)
28
+
29
+ ```html
30
+ <script src="https://cdn.bootcdn.net/ajax/libs/echarts/6.0.0/echarts.min.js"></script>
31
+ ```
32
+
33
+ 建议在 Tailwind 与 Alpine 之后加载,并在图表初始化脚本之前引入。
34
+
35
+ ## 3. CloudCC 运行环境能力(CCDK)
36
+
37
+ - 在 CloudCC 运行环境(如自定义页面、内嵌 HTML)中,可通过 `window.$CCDK` 使用平台能力。
38
+ - 本地直接用浏览器打开 HTML 文件时通常不存在 `$CCDK`,请先做存在性判断,避免运行时报错。
39
+ - 业务接口与平台能力细节以各模块文档为准:`cloudcc doc <module> introduction|devguide`。
40
+
41
+ ## 4. 最小可用模板
42
+
43
+ ```html
44
+ <!doctype html>
45
+ <html lang="zh-CN">
46
+ <head>
47
+ <meta charset="UTF-8" />
48
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
49
+ <title>CloudCC HTML Page</title>
50
+ <script src="https://cdn.bootcdn.net/ajax/libs/tailwindcss-browser/4.1.13/index.global.min.js"></script>
51
+ <script defer src="https://cdn.bootcdn.net/ajax/libs/alpinejs/3.15.0/cdn.min.js"></script>
52
+ </head>
53
+ <body class="p-4">
54
+ <div x-data="{ ready: true }">
55
+ <h1 class="text-xl font-semibold">CloudCC HTML 页面</h1>
56
+ <p class="mt-2 text-gray-600" x-show="ready">页面已初始化</p>
57
+ </div>
58
+
59
+ <script>
60
+ const cc = window.$CCDK || null;
61
+ if (!cc) {
62
+ console.warn("$CCDK 不可用,当前可能是本地浏览器环境。");
63
+ }
64
+ </script>
65
+ </body>
66
+ </html>
67
+ ```
@@ -0,0 +1,4 @@
1
+ # CloudCC HTML 组件开发简介
2
+
3
+ - HTML 组件开发必须使用单 HTML 文件作为入口(建议 `html/index.html`)。
4
+ - 页面中引用的 JS、CSS、图片等资源,可以放入 CloudCC 静态资源后再通过静态资源 URL 引用。
@@ -0,0 +1,11 @@
1
+ const cc = {};
2
+ cc.doc = require("./doc");
3
+
4
+ async function main(action, argvs) {
5
+ if (!cc[action]) {
6
+ throw new Error(`html 不支持的动作: ${action}`);
7
+ }
8
+ return cc[action](argvs);
9
+ }
10
+
11
+ module.exports = main;