cloudcc-cli 2.3.4 → 2.3.5
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.
- package/.claude/settings.json +22 -1
- package/.cursor/skills/cloudcc-cli-dev/SKILL.md +175 -0
- package/.cursor/skills/cloudcc-dev-skill/SKILL.md +71 -0
- package/README.md +54 -7
- package/bin/cc.js +106 -28
- package/bin/index.js +54 -55
- package/mcp/cliRunner.js +11 -4
- package/mcp/index.js +12 -2
- package/mcp/tools/CloudCC Development Overview/handler.js +1 -1
- package/mcp/tools/JSP Migrator/handler.js +46 -0
- package/package.json +3 -4
- package/src/button/create.js +169 -0
- package/src/button/delete.js +35 -0
- package/src/button/doc.js +36 -0
- package/src/button/docs/devguide.md +133 -0
- package/src/button/docs/introduction.md +60 -0
- package/src/button/get.js +60 -0
- package/src/button/index.js +20 -0
- package/src/classes/docs/introduction.md +0 -20
- package/src/identityProvider/create.js +78 -0
- package/src/identityProvider/delete.js +61 -0
- package/src/identityProvider/doc.js +46 -0
- package/src/identityProvider/docs/devguide.md +107 -0
- package/src/identityProvider/docs/introduction.md +31 -0
- package/src/identityProvider/download.js +105 -0
- package/src/identityProvider/get.js +70 -0
- package/src/identityProvider/index.js +12 -0
- package/src/permission/add.js +164 -0
- package/src/permission/assign.js +84 -0
- package/src/permission/docs/devguide.md +238 -0
- package/src/permission/docs/introduction.md +200 -0
- package/src/permission/get.js +107 -0
- package/src/permission/index.js +10 -0
- package/src/permission/remove.js +145 -0
- package/src/project/docs/devguide.md +7 -6
- package/src/singleSignOn/delete.js +61 -0
- package/src/singleSignOn/doc.js +46 -0
- package/src/singleSignOn/docs/devguide.md +61 -0
- package/src/singleSignOn/docs/introduction.md +3 -0
- package/src/singleSignOn/get.js +70 -0
- package/src/singleSignOn/index.js +10 -0
- package/src/staticResource/docs/introduction.md +44 -1
- package/src/validationRule/create.js +2 -2
- package/src/version/actionHelp.js +25 -0
- package/src/version/docs.js +26 -0
- package/src/version/doctor.js +25 -0
- package/src/version/get.js +7 -1
- package/src/version/help.js +47 -0
- package/src/version/index.js +9 -2
- package/src/version/initHelp.js +13 -0
- package/src/version/listModuleCommands.js +241 -0
- package/src/version/stats.js +44 -0
- package/src/version/uninstall.js +30 -0
- package/src/version/update.js +13 -0
- package/utils/checkVersion.js +31 -2
- package/utils/commandStats.js +94 -0
- package/utils/formatReleaseNotes.js +312 -0
- package/utils/readmeReleases.js +69 -0
- package/.cloudcc-cache.json +0 -54
- package/.cursor/skills/cloudcc-cli-dev.zip +0 -0
- package/.cursor/skills/cloudcc-dev-usage/SKILL.md +0 -68
- package/build/component-cc-cc-dd.common.js +0 -831
- package/build/component-cc-cc-dd.common.js.map +0 -1
- package/build/component-cc-cc-dd.css +0 -1
- package/build/component-cc-cc-dd.umd.js +0 -874
- package/build/component-cc-cc-dd.umd.js.map +0 -1
- package/build/component-cc-cc-dd.umd.min.js +0 -8
- package/build/component-cc-cc-dd.umd.min.js.map +0 -1
- package/build/demo.html +0 -1
- package/plugins/cc-cc-dd/cc-cc-dd.vue +0 -32
- package/plugins/cc-cc-dd/components/HelloWorld.vue +0 -11
- package/plugins/cc-cc-dd/config.json +0 -6
package/.claude/settings.json
CHANGED
|
@@ -20,7 +20,28 @@
|
|
|
20
20
|
"Bash(node src/index.js profile --help)",
|
|
21
21
|
"Bash(node src/index.js --help)",
|
|
22
22
|
"Bash(echo \"Exit code: $?\")",
|
|
23
|
-
"Bash(ls -la *.json)"
|
|
23
|
+
"Bash(ls -la *.json)",
|
|
24
|
+
"Bash(node -c src/permission/index.js)",
|
|
25
|
+
"Bash(node -c src/permission/get.js)",
|
|
26
|
+
"Bash(node -c src/permission/assign.js)",
|
|
27
|
+
"Bash(node -c src/permission/add.js)",
|
|
28
|
+
"Bash(node -c src/permission/remove.js)",
|
|
29
|
+
"Bash(cc assign permission:*)",
|
|
30
|
+
"Bash(cc add permission:*)",
|
|
31
|
+
"Bash(cc remove permission:*)",
|
|
32
|
+
"Bash(\\))",
|
|
33
|
+
"Bash(:)",
|
|
34
|
+
"Bash(node bin/index.js get identityProvider)",
|
|
35
|
+
"Bash(/Users/chenwencai/Desktop/codeup/cloudcc-cli/cc get:*)",
|
|
36
|
+
"Bash(/Users/chenwencai/Desktop/codeup/cloudcc-cli/bin/cc.js)",
|
|
37
|
+
"Bash(/usr/local/bin/node bin/cc.js get identityProvider .)",
|
|
38
|
+
"Bash(/usr/local/bin/node bin/cc.js --help)",
|
|
39
|
+
"Bash(/usr/local/bin/node bin/cc.js token get .)",
|
|
40
|
+
"Bash(/Users/chenwencai/Desktop/codeup/cloudcc-cli/bin/cc.js get:*)",
|
|
41
|
+
"Bash(: true,)",
|
|
42
|
+
"Bash(CLOUDCC_USE=cdev node bin/cc.js get identityProvider)",
|
|
43
|
+
"Bash(: null,)",
|
|
44
|
+
"Bash(: null:*)"
|
|
24
45
|
]
|
|
25
46
|
},
|
|
26
47
|
"askForConfirmation": false,
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cloudcc-cli-dev
|
|
3
|
+
description: >-
|
|
4
|
+
Defines how cloudcc-cli extends the `cc` command: argv shape, `bin/cc.js` entry
|
|
5
|
+
(global flags, doctor/docs/init, action-level `-h`), `bin/index.js` Proxy routing,
|
|
6
|
+
`src/version/listModuleCommands.js` for `--help`, per-resource `src/<resource>/index.js`
|
|
7
|
+
dispatch, and MCP via `node` + `bin/mcp.js` (no `cc-mcp` bin). Release / changelog:
|
|
8
|
+
ask whether to bump version; if not, only edit the existing `# ReleaseV…` for the
|
|
9
|
+
current version in `README.md`. Use when adding or modifying CLI commands,
|
|
10
|
+
subcommands, or modules in this repo, or when the user mentions cloudcc-cli
|
|
11
|
+
structure, `cc` routing, new CLI features, or releases/changelog.
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# cloudcc-cli 开发约定
|
|
15
|
+
|
|
16
|
+
## 命令行结构(须保持一致)
|
|
17
|
+
|
|
18
|
+
全局约定:
|
|
19
|
+
|
|
20
|
+
```text
|
|
21
|
+
cc <动作 action> <资源 resource> <其余参数 ...>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
- `argvs[0]` = 动作(如 `get`、`create`、`doc`、`assign` 等,随业务扩展)
|
|
25
|
+
- `argvs[1]` = 资源名,必须与 `bin/index.js` 里 `modules` 对象的 **key** 一致(如 `object`、`permission`、`pagelayout`)
|
|
26
|
+
- `argvs[2]` 起 = 传给该资源子命令的参数
|
|
27
|
+
|
|
28
|
+
示例:
|
|
29
|
+
|
|
30
|
+
- `cc get object …` → `modules.object('get', argvs)`
|
|
31
|
+
- `cc assign permission …` → `modules.permission('assign', argvs)`
|
|
32
|
+
- `cc doc menu …` → `modules.menu('doc', argvs)`
|
|
33
|
+
|
|
34
|
+
权限模块曾使用旧写法 `cc permission assign …`(资源不在第二位),已废弃,见下文「历史调整摘要」。
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## `bin/cc.js`(入口)
|
|
39
|
+
|
|
40
|
+
职责:
|
|
41
|
+
|
|
42
|
+
1. 从 `process.argv` 取出 `argvs`(已 `splice(2)`)。
|
|
43
|
+
2. **全局/维护命令**(**不**走 `bin/index.js` 的 `action + resource`):在加载 `./index` 之前分支处理,见下节「全局命令与特例」。
|
|
44
|
+
3. **主流程**:`await cc[action](argvs)`,其中 `cc` 来自 `./index`(`Proxy` 按 `argvs[1]` 选资源)。
|
|
45
|
+
|
|
46
|
+
不要求在 `cc.js` 里为单个**业务**资源写分支;特例应消化在对应资源的 `index.js` 或 HTTP 层。与「帮助、自检、别名」相关的入口例外见下文。
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## 全局命令与特例(`bin/cc.js`)
|
|
51
|
+
|
|
52
|
+
下列命令在 **`modules` 路由之前** 处理,避免占用 `argvs[1]` 作为 resource:
|
|
53
|
+
|
|
54
|
+
| 形式 | 行为 |
|
|
55
|
+
|------|------|
|
|
56
|
+
| `--help` / `-h` / `--h` | 调用 `src/version/help.js` 打印完整帮助 |
|
|
57
|
+
| `help`(且无第二参数) | 同上 |
|
|
58
|
+
| `-version` / `-v` / `--version` / `--v` | `src/version/get.js` 打印 CLI 版本 |
|
|
59
|
+
| `update`(且无第二参数) | `src/version/update.js` 全局升级 |
|
|
60
|
+
| `uninstall`(且无第二参数) | `src/version/uninstall.js` 全局卸载 |
|
|
61
|
+
| `doctor`(且无第二参数) | `src/version/doctor.js` 环境自检(Node、配置、版本) |
|
|
62
|
+
| `docs`(且无第二参数) | `src/version/docs.js` 打开帮助中心浏览器页 |
|
|
63
|
+
| `init …` | **等价** `cc create project …`(重写 `argvs` 后走主流程) |
|
|
64
|
+
| `init` + `-h` / `--help` | `src/version/initHelp.js` 简短说明 |
|
|
65
|
+
| 任意 `action` + 第二参数为 `-h` / `--help` | `src/version/actionHelp.js`:列出支持该 **action** 的 **resource**(数据来自 `listModuleCommands`) |
|
|
66
|
+
|
|
67
|
+
**无参 / 缺 resource**:仅输入 `cc` 时提示用法并指向 `cc --help`;仅输入 `cc <action>`(缺 `argvs[1]`)时提示补全 `resource`,并提示可用 `cc <action> -h`。
|
|
68
|
+
|
|
69
|
+
**注意**:`doctor`、`docs`、`actionHelp`、`initHelp` **不要**挂到 `src/version/index.js` 的 `cc.*` 上,否则 `cc --help` 里通过解析 `index.js` 会误出现 `cc doctor version` 等行。它们由 `cc.js` **直接 `require`** 对应文件执行。
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## `--help` 与模块清单(`src/version/`)
|
|
74
|
+
|
|
75
|
+
- **`help.js`**:打印 Usage、Global 区、**按模块罗列** `cc <action> <resource>`;模块与顺序与 `bin/index.js` 的 `modules` 一致(见 `listModuleCommands.js`)。
|
|
76
|
+
- **`listModuleCommands.js`**:
|
|
77
|
+
- 从各资源目录 `index.js` **正则解析** `cc.<action> =` 得到 action 列表(与实现同步)。
|
|
78
|
+
- **`MODULE_HINT`**:模块一句话说明;`schedule` / `timer` 合并为一组展示。
|
|
79
|
+
- **`describeActionLine(resource, action)`**:行尾中文说明(替代省略号)。
|
|
80
|
+
- **`getResourcesForAction(action)`**:供 `cc <action> -h` 列出 resource。
|
|
81
|
+
- 新增 **resource** 时:除改 `bin/index.js` 外,须在 `listModuleCommands.js` 中维护 **`MODULE_KEYS_ORDER`** 与 **`MODULE_FOLDER`**(及必要时 **`MODULE_HINT`**、**`RESOURCE_CN`**)。
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## MCP 与 `package.json` bin
|
|
86
|
+
|
|
87
|
+
- **`package.json` 的 `bin`** 仅注册 `cc`(及 `cloudccCreate`、`cloudccBuild` 等),**不**注册 `cc-mcp`。
|
|
88
|
+
- MCP 启动使用 **`node`** + **`cloudcc-cli` 包内 `bin/mcp.js` 的绝对路径**(全局安装路径可用 `$(npm root -g)/cloudcc-cli/bin/mcp.js` 拼接)。详见仓库 `README.md` / `src/project/docs/devguide.md`。
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## `bin/index.js`(按「动作」代理到「资源」)
|
|
93
|
+
|
|
94
|
+
**必须**使用 `modules` 映射 + **`Proxy`** 导出,使任意合法 `action` 都对应一个函数 `(argvs) => …`,并在内部根据 **`argvs[1]`** 选择资源模块:
|
|
95
|
+
|
|
96
|
+
- 对 `action === 'doc'`:若 `modules[type]` 不存在,抛出 `doc 不支持的类型: …`。
|
|
97
|
+
- 其它动作:若 `modules[type]` 不存在,抛出 `不支持的类型: …`。
|
|
98
|
+
- 否则调用:`modules[type](action, argvs)`。
|
|
99
|
+
|
|
100
|
+
**禁止**仅 `module.exports = cc` 且只挂 `cc.object`、`cc.plugin` 等——那样 **`cc['get']` 不存在**,`await cc[action](argvs)` 会在 `get` 等动作上失败。
|
|
101
|
+
|
|
102
|
+
新增资源时:在 `modules` 中增加一行,例如 `featureX: require("../src/featureX/index")`,并保证 CLI 上第二段参数与该 key 一致。
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## `src/<resource>/index.js`(单资源入口)
|
|
107
|
+
|
|
108
|
+
参照 `src/permission/index.js` / `src/pagelayout/index.js` 的写法:
|
|
109
|
+
|
|
110
|
+
- 使用局部对象挂具体实现:`cc.get = require("./get")` 等。
|
|
111
|
+
- `async function main(action, argvs) { await cc[action](argvs) }`(若子命令需返回值,可改为 `return await`)。
|
|
112
|
+
- `module.exports = main`。
|
|
113
|
+
|
|
114
|
+
子文件(`get.js`、`create.js` …)从 **`argvs`** 解析路径与业务参数(通常从 `argvs[2]` 开始,依各命令文档)。
|
|
115
|
+
|
|
116
|
+
新增动作时:增加 `cc.<新动作> = require("./新文件")`,并保证与全局 `cc <动作> <资源>` 一致。
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## 新增功能检查清单
|
|
121
|
+
|
|
122
|
+
1. 在 `bin/index.js` 的 **`modules`** 中注册资源(key = CLI 第二段单词)。
|
|
123
|
+
2. 新建或扩展 `src/<resource>/`,实现 `index.js` 及所需 `get`/`create`/… 子文件。
|
|
124
|
+
3. 若有 `doc`,在 `src/<resource>/doc.js` 与 `docs/` 中维护说明;通过 `cc doc <resource>` 可读。
|
|
125
|
+
4. 更新 `src/version/listModuleCommands.js`:**`MODULE_KEYS_ORDER`**、**`MODULE_FOLDER`**,必要时 **`MODULE_HINT`**、**`RESOURCE_CN`**、**`describeActionLine`** 中的映射,保证 `cc --help` 与 `cc <action> -h` 正确。
|
|
126
|
+
5. 自测:`node bin/cc.js <动作> <resource> …`、`cc --help`、`cc <action> -h`;若 MCP 通过 `cliRunner` 调 `cc`,确认参数顺序与文档一致。
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## 发版:版本号与 README 变更日志(固定流程)
|
|
131
|
+
|
|
132
|
+
在**写入或更新开发日志**(`README.md` 中的 `# ReleaseV…`)时,**以后均照此执行**:
|
|
133
|
+
|
|
134
|
+
### 必须先确认:是否升级版本号
|
|
135
|
+
|
|
136
|
+
- **向用户询问**:本次是否需要**升级 `package.json` / `package-lock.json` 的版本号**(新一次发版)?
|
|
137
|
+
- **若不需要升版**:**不要**修改 `package.json` 与 `package-lock.json` 的 `version`;只在 **`README.md` 里与当前 `package.json.version` 一致**的那一节 `# ReleaseV…`(例如已是 `# ReleaseV2.3.5`)中**增补或修订** `#### Release Content`(及必要时同一节内的日期说明),把新变更写进**现有版本**的日志里。
|
|
138
|
+
- **若需要升版**:再执行下面的「升版 + 新节」流程。
|
|
139
|
+
|
|
140
|
+
### 升版 + 新 Release 节(仅在用户确认要发版时)
|
|
141
|
+
|
|
142
|
+
1. **版本号**(与 `cc --version` / `package.json` 一致)
|
|
143
|
+
- 在 **`package.json`** 中将 **`version`** 升为下一号(通常 patch `x.y.(z+1)`;破坏性变更再升 minor/major)。
|
|
144
|
+
- 同步 **`package-lock.json`** 根包 **`""`** 的 **`version`**(以及文件最顶部 `name`/`version` 字段,若存在),避免锁文件与 `package.json` 不一致。
|
|
145
|
+
|
|
146
|
+
2. **README.md 变更日志**
|
|
147
|
+
- 在 **`README.md`** 中、**紧接「Usage Guide / CLI overview / MCP」等说明之后**、**旧版 Release 区块之上**,**插入新的** `# ReleaseV<主版本>.<次版本>.<补丁>` 一节(版本号与新的 `package.json` 一致)。
|
|
148
|
+
- **新发布节全文使用英文**(标题、Release Date、Scope、Content 列表)。
|
|
149
|
+
- 结构建议:
|
|
150
|
+
- `# ReleaseVx.y.z`
|
|
151
|
+
- `#### Release Date: YYYY-M-D`
|
|
152
|
+
- `#### Release Scope: Full`(或按实际填写)
|
|
153
|
+
- `#### Release Content` 下用列表概括 CLI、文档、依赖等变更。
|
|
154
|
+
- **不要删除**已有历史 `# ReleaseV…` 区块;新节始终在**时间顺序上最新**的位置(当前约定为文档前部、旧节整体下移)。
|
|
155
|
+
|
|
156
|
+
3. **可选**
|
|
157
|
+
- 若本次变更影响使用方式,同步更新 **Usage / CLI overview / MCP** 等 README 顶部英文说明。
|
|
158
|
+
- `src/version/get.js` 从 `package.json` 读版本,**无需**单独改(除非改为硬编码,不推荐)。
|
|
159
|
+
|
|
160
|
+
用户若**明确说**「发版」「升版本号」「新版本」,且未反对升版,可执行 **升版 + 新节**;若只说「更新日志」「记一下」「补 readme」等**未明确发版**,须**先问是否升版**,未确认则**只改当前版本对应的那一节 Release**。
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## 历史调整摘要(架构演进)
|
|
165
|
+
|
|
166
|
+
以下为本仓库 CLI 层曾做过、与上述约定相关的变更,便于排查旧文档或脚本:
|
|
167
|
+
|
|
168
|
+
1. **`bin/cc.js`**:业务命令仍统一为 `await cc[action](argvs)`(`cc` 来自 `./index`);**全局/帮助类**(`--help`、`doctor`、`init` 等)在加载 `./index` **之前**分支;旧版在入口为 `permission` 单独写 `if` 的方式已废弃。
|
|
169
|
+
2. **`bin/index.js`**:由「直接导出 `cc` 对象」改为 **`modules` + `Proxy`**,以支持以 **第一个单词为动作** 的路由;`doc` 对资源名做存在性校验。
|
|
170
|
+
3. **`permission` 命令语义**:由旧的 `cc permission assign|add|remove`(资源不在第二位)改为符合全局约定的 **`cc assign permission`、`cc add permission`、`cc remove permission`**;`cc get permission` 保持不变。
|
|
171
|
+
4. **`src/permission/index.js`**:与 `pagelayout` 等资源对齐,使用 **`cc` 子对象 + `main(action, argvs)`** 分发,去掉仅服务于旧写法的单参数 argv 分支。
|
|
172
|
+
5. **`.claude/settings.json`** 等:允许/bash 规则从 `cc permission:*` 调整为 `cc assign permission:*` 等新模式(若仍使用 Claude 相关自动化)。
|
|
173
|
+
6. **`bin/cc.js` 全局能力**:`--help`/`help`、`doctor`、`docs`、`init`(别名 `create project`)、`cc <action> -h`;`package.json` **不**注册 `cc-mcp`,MCP 用 `node` + `bin/mcp.js` 路径。
|
|
174
|
+
|
|
175
|
+
实现新功能时,**以本节与上文「命令行结构」为准**,勿再引入「首词为资源名」的并行体系。
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cloudcc-dev-skill
|
|
3
|
+
description: CloudCC CRM 二次开发设计,实现工具 。用于在设计方案和实际开发时使用,优先通过各模块的 `cc doc <module> introduction` 与 `cc doc <module> devguide` 获取文档。用户提到 CloudCC、cloudcc-cli、`cc doc`、模块文档、设计方案、开发文档、项目初始化、开发环境、对象、字段、菜单、应用、类、定时类、触发器、自定义组件、自定义页面、自定义设置、客户端脚本、静态资源 时应优先使用。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# CloudCC CLI skill
|
|
7
|
+
|
|
8
|
+
- 使用前必须检查npm全局包,是否安装了cloudcc-cli ,如果没有,那么先全局安装 npm
|
|
9
|
+
i -g cloudcc-cli@latest
|
|
10
|
+
|
|
11
|
+
## 模块命令
|
|
12
|
+
|
|
13
|
+
### 基础与环境
|
|
14
|
+
|
|
15
|
+
- 开发环境设置:`cc doc project introduction`、`cc doc project devguide`
|
|
16
|
+
- 开发环境密钥配置:`cc doc config devguide`
|
|
17
|
+
|
|
18
|
+
### 元数据与模型设计
|
|
19
|
+
|
|
20
|
+
- 对象:`cc doc object introduction`、`cc doc object devguide`
|
|
21
|
+
- 对象字段:`cc doc fields introduction`、`cc doc fields devguide`
|
|
22
|
+
- 对象记录类型:`cc doc recordType introduction`、`cc doc recordType devguide`
|
|
23
|
+
- 全局选项列表:`cc doc globalSelectList introduction`、`cc doc globalSelectList devguide`
|
|
24
|
+
|
|
25
|
+
### 权限与组织管理
|
|
26
|
+
|
|
27
|
+
- 用户:`cc doc user introduction`、`cc doc user devguide`
|
|
28
|
+
- 角色:`cc doc role introduction`、`cc doc role devguide`
|
|
29
|
+
- 简档:`cc doc profile introduction`、`cc doc profile devguide`
|
|
30
|
+
|
|
31
|
+
### 业务扩展(后端)
|
|
32
|
+
|
|
33
|
+
- 后端类:`cc doc classes introduction`、`cc doc classes devguide`
|
|
34
|
+
- 触发器:`cc doc triggers introduction`、`cc doc triggers devguide`
|
|
35
|
+
- 定时类:`cc doc timer introduction`、`cc doc timer devguide`
|
|
36
|
+
- 定时作业:`cc doc scheduleJob introduction`、`cc doc scheduleJob devguide`
|
|
37
|
+
|
|
38
|
+
### 业务扩展(前端)
|
|
39
|
+
|
|
40
|
+
- 自定义组件:`cc doc plugin introduction`、`cc doc plugin devguide`
|
|
41
|
+
- 自定义页面:`cc doc customPage introduction`、`cc doc customPage devguide`
|
|
42
|
+
- 客户端脚本:`cc doc script introduction`、`cc doc script devguide`
|
|
43
|
+
- 静态资源:`cc doc staticResource introduction`、`cc doc staticResource devguide`
|
|
44
|
+
|
|
45
|
+
### 平台配置与导航
|
|
46
|
+
|
|
47
|
+
- 菜单:`cc doc menu introduction`、`cc doc menu devguide`
|
|
48
|
+
- 应用:`cc doc application introduction`、`cc doc application devguide`
|
|
49
|
+
- 自定义设置:`cc doc customSetting introduction`、`cc doc customSetting devguide`
|
|
50
|
+
|
|
51
|
+
## 使用场景
|
|
52
|
+
|
|
53
|
+
### 1. 快速了解CloudCC CRM每个模块的定义信息
|
|
54
|
+
|
|
55
|
+
- 比如做方案设计、实现设计、模块选型时,优先调用每个模块的`introduction`文档。
|
|
56
|
+
- 命令格式:`cc doc <module> introduction`
|
|
57
|
+
- 目标:先理解模块定位、适用场景、能力边界。
|
|
58
|
+
|
|
59
|
+
### 2. 要了解某个CloudCC CRM 环境状态
|
|
60
|
+
|
|
61
|
+
- 先创建模版项目`cc create project demo`
|
|
62
|
+
- 配置开发者密钥
|
|
63
|
+
- 调用每个模块的 `devguide`
|
|
64
|
+
文档,命令格式:`cc doc <module> devguide`,了解如何查询系统数据
|
|
65
|
+
|
|
66
|
+
### 3. 要进行二开实施
|
|
67
|
+
|
|
68
|
+
- 先创建模版项目`cc create project demo`
|
|
69
|
+
- 配置开发者密钥
|
|
70
|
+
- 调用每个模块的 `devguide`
|
|
71
|
+
文档,命令格式:`cc doc <module> devguide`,了解如何创建,修改数据
|
package/README.md
CHANGED
|
@@ -1,26 +1,73 @@
|
|
|
1
1
|
# Usage Guide
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Global installation
|
|
4
4
|
|
|
5
|
-
```
|
|
6
|
-
|
|
5
|
+
```bash
|
|
6
|
+
# Windows
|
|
7
7
|
npm i -g cloudcc-cli
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
# macOS
|
|
10
10
|
sudo npm i -g cloudcc-cli
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
## CLI overview
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
The `cc` entry point (`bin/cc.js`) has two layers:
|
|
16
|
+
|
|
17
|
+
1. **Global / maintenance commands** (handled before the `action + resource` router): `--help` / `-h` / `cc help`, `--version` / `-v`, `update`, `uninstall`, `doctor`, `docs`, `stats` (local command usage statistics), `init` (equivalent to `cc create project`), and `cc <action> -h` or `cc <action> --help` to list **resources** that support the given **action**.
|
|
18
|
+
2. **Business commands**: `cc <action> <resource> [...]` dispatched through `bin/index.js` (Proxy) to `src/<resource>/index.js`.
|
|
19
|
+
|
|
20
|
+
Run **`cc --help`** for the full command list: modules follow `bin/index.js` `modules` keys, with short module hints and per-line descriptions maintained in `src/version/listModuleCommands.js`. When you add a resource, update **`MODULE_KEYS_ORDER`** and **`MODULE_FOLDER`** (and optional **`MODULE_HINT`** / **`RESOURCE_CN`** / **`describeActionLine`**) so `--help` and `cc <action> -h` stay accurate.
|
|
21
|
+
|
|
22
|
+
**Implementation note:** `doctor`, `docs`, `stats`, `actionHelp`, and `initHelp` are **not** attached to `src/version/index.js` as `cc.*` handlers; `cc.js` loads them directly so the generated help does not show misleading lines such as `cc doctor version`.
|
|
23
|
+
|
|
24
|
+
## Version output and changelog
|
|
25
|
+
|
|
26
|
+
When you run **`cc --version`** / **`-v`** or when the built-in **version check** compares your install to the npm registry (e.g. during `cc update` / `checkUpdate`), the CLI prints the relevant **`# ReleaseV…`** sections from the package **`README.md`** (parsed at runtime via `utils/readmeReleases.js`). Output is rendered with **`utils/formatReleaseNotes.js`**: terminal-width wrapping, continuation lines aligned under the bullet text, and inline `` `code` `` spans kept intact so styling does not break across lines.
|
|
27
|
+
|
|
28
|
+
## MCP configuration
|
|
29
|
+
|
|
30
|
+
`package.json` **does not** publish a `cc-mcp` binary. Start the MCP server with **Node** and the path to the bundled script:
|
|
31
|
+
|
|
32
|
+
```json
|
|
16
33
|
{
|
|
17
34
|
"mcpServers": {
|
|
18
35
|
"cloudcc-cli": {
|
|
19
|
-
"command": "
|
|
36
|
+
"command": "node",
|
|
37
|
+
"args": ["<absolute-path-to-global-install>/cloudcc-cli/bin/mcp.js"]
|
|
20
38
|
}
|
|
21
39
|
}
|
|
22
40
|
}
|
|
23
41
|
```
|
|
42
|
+
|
|
43
|
+
After a global install, resolve the script path on macOS/Linux with:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
echo "$(npm root -g)/cloudcc-cli/bin/mcp.js"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
# ReleaseV2.3.5
|
|
50
|
+
|
|
51
|
+
#### Release Date: 2026-4-1
|
|
52
|
+
|
|
53
|
+
#### Release Scope: Full
|
|
54
|
+
|
|
55
|
+
#### Release Content
|
|
56
|
+
|
|
57
|
+
- CLI
|
|
58
|
+
- Global commands: `doctor`, `docs`, `cc help`, `init` (alias for `cc create project`), clearer empty-argv / missing-resource hints, and `cc <action> -h` to list resources for an action
|
|
59
|
+
- Richer `cc --help`: grouped modules, hints, and per-command descriptions via `src/version/listModuleCommands.js`
|
|
60
|
+
- Removed `cc-mcp` from `package.json` `bin`; MCP is documented to use `node` and `bin/mcp.js`
|
|
61
|
+
- Version checks and **`cc --version`** show **`# ReleaseV…`** blocks from **`README.md`** (`utils/readmeReleases.js`); `utils/checkVersion.js` prints notes when comparing to the registry
|
|
62
|
+
- Terminal-friendly release notes: width-aware wrapping, aligned continuation lines, **`utils/formatReleaseNotes.js`** styling, and safe handling of inline `` `code` `` when wrapping
|
|
63
|
+
- **Command usage statistics** (default on): records `cc <action> <resource>`-style keys (e.g. `` `cc doc classes` `` for `` `cc doc classes devguide` ``) in `` `~/.cloudcc-cli/command-stats.json` `` via **`utils/commandStats.js`** and **`bin/cc.js`**; run **`cc stats`** to view; set **`CLOUDCC_CLI_STATS=0`** / **`false`** / **`off`** to disable
|
|
64
|
+
- MCP
|
|
65
|
+
- New tool **`get_jsp_migration_rules`**: returns fixed JSP migration rules (resolve JSP under `customize` from `name=` URLs, suggested batch flow, **`PageClsInvoker`** invocation patterns); **`analyze_jsp_migration`** / **`split_jsp_to_cloudcc`** descriptions updated to recommend calling it before batch migration
|
|
66
|
+
- Documentation
|
|
67
|
+
- README and Cursor skill (`cloudcc-cli-dev`) updated to match the above
|
|
68
|
+
- README: “Version output and changelog” section (version output, README-based release notes, and formatting behavior)
|
|
69
|
+
- **`cloudcc-cli-dev` SKILL**: when editing the dev log, **ask whether to bump version**; if not, only update the existing **`# ReleaseV…`** for the current `package.json` version (no automatic version bump)
|
|
70
|
+
|
|
24
71
|
# ReleaseV2.3.4
|
|
25
72
|
|
|
26
73
|
#### Release Date: 2026-3-26
|
package/bin/cc.js
CHANGED
|
@@ -1,47 +1,125 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
const chalk = require("chalk")
|
|
3
|
+
const commandStats = require("../utils/commandStats")
|
|
3
4
|
|
|
4
|
-
let argvs = process.argv.splice(2)
|
|
5
|
+
let argvs = process.argv.splice(2)
|
|
5
6
|
let action = argvs[0]
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
|
|
8
|
+
function recordStats(actionKey, resourceKey) {
|
|
9
|
+
try {
|
|
10
|
+
commandStats.record(actionKey, resourceKey)
|
|
11
|
+
} catch (_e) {}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function runVersion(subAction, argvSlice) {
|
|
15
|
+
const version = require("../src/version/index")
|
|
16
|
+
return version(subAction, argvSlice).catch((e) => {
|
|
17
|
+
console.error(e)
|
|
18
|
+
process.exit(1)
|
|
19
|
+
})
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function hintCcHelp() {
|
|
23
|
+
console.error()
|
|
24
|
+
console.error(chalk.yellow("用法:") + chalk.green(" cc ") + chalk.gray("<action> <resource> [args...]"))
|
|
25
|
+
console.error(chalk.gray("完整帮助:") + chalk.green("cc --help") + chalk.gray(" 或 ") + chalk.green("cc -h") + chalk.gray(" 或 ") + chalk.green("cc help"))
|
|
26
|
+
console.error()
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function hintMissingResource(act) {
|
|
30
|
+
console.error()
|
|
31
|
+
console.error(chalk.yellow("缺少 resource:") + chalk.green(`cc ${act} <resource> ...`))
|
|
32
|
+
console.error(chalk.gray("查看该 action 下可用的 resource:") + chalk.green(`cc ${act} -h`))
|
|
33
|
+
console.error(chalk.gray("查看全部命令:") + chalk.green("cc --help"))
|
|
34
|
+
console.error()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// 版本与全局维护命令(走 src/version,不参与 action + resource 路由)
|
|
38
|
+
if (action === "-version" || action === "-v" || action === "--version" || action === "--v") {
|
|
39
|
+
recordStats(action, "_")
|
|
40
|
+
runVersion("get", argvs)
|
|
41
|
+
return
|
|
42
|
+
}
|
|
43
|
+
if (action === "--help" || action === "-h" || action === "--h") {
|
|
44
|
+
recordStats(action, "_")
|
|
45
|
+
runVersion("help", argvs)
|
|
46
|
+
return
|
|
47
|
+
}
|
|
48
|
+
if (action === "update" && !argvs[1]) {
|
|
49
|
+
recordStats("update", "_")
|
|
50
|
+
runVersion("update", argvs)
|
|
51
|
+
return
|
|
52
|
+
}
|
|
53
|
+
if (action === "uninstall" && !argvs[1]) {
|
|
54
|
+
recordStats("uninstall", "_")
|
|
55
|
+
runVersion("uninstall", argvs)
|
|
56
|
+
return
|
|
11
57
|
}
|
|
12
58
|
|
|
13
59
|
if (!action) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
console.error()
|
|
17
|
-
return;
|
|
60
|
+
hintCcHelp()
|
|
61
|
+
return
|
|
18
62
|
}
|
|
19
63
|
|
|
64
|
+
if (action === "help" && !argvs[1]) {
|
|
65
|
+
recordStats("help", "_")
|
|
66
|
+
runVersion("help", argvs)
|
|
67
|
+
return
|
|
68
|
+
}
|
|
20
69
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
70
|
+
if (action === "stats" && !argvs[1]) {
|
|
71
|
+
recordStats("stats", "_")
|
|
72
|
+
require("../src/version/stats")()
|
|
73
|
+
return
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (action === "doctor" && !argvs[1]) {
|
|
77
|
+
recordStats("doctor", "_")
|
|
78
|
+
require("../src/version/doctor")()
|
|
79
|
+
return
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (action === "docs" && !argvs[1]) {
|
|
83
|
+
recordStats("docs", "_")
|
|
84
|
+
require("../src/version/docs")()
|
|
85
|
+
return
|
|
27
86
|
}
|
|
28
|
-
const cc = require("./index")
|
|
29
87
|
|
|
30
|
-
|
|
88
|
+
if (action === "init") {
|
|
89
|
+
if (argvs[1] === "-h" || argvs[1] === "--help") {
|
|
90
|
+
recordStats("init", "_help")
|
|
91
|
+
require("../src/version/initHelp")()
|
|
92
|
+
return
|
|
93
|
+
}
|
|
94
|
+
runWithArgvs(["create", "project", ...argvs.slice(1)])
|
|
95
|
+
return
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (argvs[1] === "-h" || argvs[1] === "--help") {
|
|
99
|
+
recordStats(action, "-h")
|
|
100
|
+
require("../src/version/actionHelp")(argvs)
|
|
101
|
+
return
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (!argvs[1]) {
|
|
105
|
+
hintMissingResource(action)
|
|
106
|
+
return
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
async function runWithArgvs(argv) {
|
|
110
|
+
const act = argv[0]
|
|
111
|
+
const resource = argv[1]
|
|
112
|
+
if (act && resource) {
|
|
113
|
+
recordStats(act, resource)
|
|
114
|
+
}
|
|
115
|
+
const cc = require("./index")
|
|
31
116
|
try {
|
|
32
|
-
|
|
33
|
-
if (!cc[type]) {
|
|
34
|
-
throw new Error(`doc 不支持的类型: ${type}`);
|
|
35
|
-
}
|
|
36
|
-
await cc[type]("doc", argvs);
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
await cc[argvs[1]](argvs[0], argvs);
|
|
117
|
+
await cc[act](argv)
|
|
40
118
|
} catch (e) {
|
|
41
119
|
console.error()
|
|
42
|
-
console.error(chalk.yellow("
|
|
120
|
+
console.error(chalk.yellow("请查看帮助:cc --help"), e)
|
|
43
121
|
console.error()
|
|
44
122
|
}
|
|
45
123
|
}
|
|
46
124
|
|
|
47
|
-
|
|
125
|
+
runWithArgvs(argvs)
|
package/bin/index.js
CHANGED
|
@@ -1,55 +1,54 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
cc.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
module.exports = cc;
|
|
1
|
+
const modules = {
|
|
2
|
+
project: require("../src/project/index"),
|
|
3
|
+
plugin: require("../src/plugin/index"),
|
|
4
|
+
classes: require("../src/classes/index"),
|
|
5
|
+
customSetting: require("../src/customSetting/index"),
|
|
6
|
+
globalSelectList: require("../src/globalSelectList/index"),
|
|
7
|
+
button: require("../src/button/index"),
|
|
8
|
+
staticResource: require("../src/staticResource/index"),
|
|
9
|
+
customPage: require("../src/customPage/index"),
|
|
10
|
+
schedule: require("../src/timer/index"),
|
|
11
|
+
triggers: require("../src/triggers/index"),
|
|
12
|
+
timer: require("../src/timer/index"),
|
|
13
|
+
script: require("../src/script/index"),
|
|
14
|
+
token: require("../src/token/index"),
|
|
15
|
+
object: require("../src/object/index"),
|
|
16
|
+
recordType: require("../src/recordType/index"),
|
|
17
|
+
config: require("../src/config/index"),
|
|
18
|
+
version: require("../src/version/index"),
|
|
19
|
+
brief: require("../src/brief/index"),
|
|
20
|
+
fields: require("../src/fields/index"),
|
|
21
|
+
menu: require("../src/menu/index"),
|
|
22
|
+
application: require("../src/application/index"),
|
|
23
|
+
scheduleJob: require("../src/scheduleJob/index"),
|
|
24
|
+
profile: require("../src/profile/index"),
|
|
25
|
+
user: require("../src/user/index"),
|
|
26
|
+
role: require("../src/role/index"),
|
|
27
|
+
identityProvider: require("../src/identityProvider/index"),
|
|
28
|
+
singleSignOn: require("../src/singleSignOn/index"),
|
|
29
|
+
pagelayout: require("../src/pagelayout/index"),
|
|
30
|
+
validationRule: require("../src/validationRule/index"),
|
|
31
|
+
permission: require("../src/permission/index"),
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* 对外导出供 `bin/cc.js` 使用:`await cc[action](argvs)`。
|
|
36
|
+
* argv 约定:action(动作) + resource(资源名,与 modules 的 key 一致) + 其余参数。
|
|
37
|
+
*/
|
|
38
|
+
module.exports = new Proxy(
|
|
39
|
+
{},
|
|
40
|
+
{
|
|
41
|
+
get(_, action) {
|
|
42
|
+
return function routed(argvs) {
|
|
43
|
+
const type = argvs[1];
|
|
44
|
+
if (action === "doc" && !modules[type]) {
|
|
45
|
+
throw new Error(`doc 不支持的类型: ${type}`);
|
|
46
|
+
}
|
|
47
|
+
if (!modules[type]) {
|
|
48
|
+
throw new Error(`不支持的类型: ${type}`);
|
|
49
|
+
}
|
|
50
|
+
return modules[type](action, argvs);
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
}
|
|
54
|
+
);
|
package/mcp/cliRunner.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
const path = require("path");
|
|
2
1
|
const { spawnSync } = require("child_process");
|
|
3
2
|
|
|
3
|
+
const CC_NOT_FOUND_HINT =
|
|
4
|
+
"未找到 cc 命令。请将 cloudcc-cli 全局安装并确保 PATH 可用:npm install -g cloudcc-cli";
|
|
5
|
+
|
|
4
6
|
function runCcCommand(args, options = {}) {
|
|
5
7
|
const { cwd = process.cwd(), timeoutMs = 120000 } = options;
|
|
6
|
-
const
|
|
8
|
+
const ccCommand = process.platform === "win32" ? "cc.cmd" : "cc";
|
|
7
9
|
|
|
8
|
-
const result = spawnSync(
|
|
10
|
+
const result = spawnSync(ccCommand, args, {
|
|
9
11
|
cwd,
|
|
10
12
|
encoding: "utf8",
|
|
11
13
|
timeout: timeoutMs,
|
|
@@ -17,12 +19,17 @@ function runCcCommand(args, options = {}) {
|
|
|
17
19
|
const hasError = Boolean(result.error);
|
|
18
20
|
const code = typeof result.status === "number" ? result.status : -1;
|
|
19
21
|
|
|
22
|
+
let errorMsg = hasError ? result.error.message : "";
|
|
23
|
+
if (result.error && result.error.code === "ENOENT") {
|
|
24
|
+
errorMsg = CC_NOT_FOUND_HINT;
|
|
25
|
+
}
|
|
26
|
+
|
|
20
27
|
return {
|
|
21
28
|
success: !hasError && code === 0,
|
|
22
29
|
code,
|
|
23
30
|
stdout,
|
|
24
31
|
stderr,
|
|
25
|
-
error:
|
|
32
|
+
error: errorMsg
|
|
26
33
|
};
|
|
27
34
|
}
|
|
28
35
|
|