cloudcc-cli 2.3.7 → 2.3.9
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/.cursor/skills/{cloudcc-cli-dev → dev-guide}/SKILL.md +5 -1
- package/README.md +65 -1
- package/cloudcc-dev-skill/SKILL.md +78 -0
- package/cloudcc-dev-skill/config.json +4 -0
- package/mcp/index.js +25 -2
- package/mcp/tools/Object Fields Creator/handler.js +149 -3
- package/package.json +1 -1
- package/src/classes/create.js +10 -0
- package/src/fields/buildFieldData.js +692 -0
- package/src/fields/create.js +10 -170
- package/src/fields/detail.js +37 -0
- package/src/fields/docs/devguide.md +168 -44
- package/src/fields/docs/introduction.md +2 -0
- package/src/fields/fields/A.js +3 -2
- package/src/fields/fields/AD.js +4 -2
- package/src/fields/fields/B.js +8 -5
- package/src/fields/fields/C.js +13 -5
- package/src/fields/fields/D.js +4 -4
- package/src/fields/fields/E.js +10 -5
- package/src/fields/fields/ENC.js +27 -8
- package/src/fields/fields/ENCD.js +27 -8
- package/src/fields/fields/F.js +4 -4
- package/src/fields/fields/FL.js +8 -4
- package/src/fields/fields/H.js +4 -4
- package/src/fields/fields/IMG.js +23 -5
- package/src/fields/fields/J.js +21 -6
- package/src/fields/fields/L.js +32 -8
- package/src/fields/fields/LT.js +23 -6
- package/src/fields/fields/M.js +2 -2
- package/src/fields/fields/MR.js +2 -2
- package/src/fields/fields/N.js +31 -8
- package/src/fields/fields/P.js +13 -5
- package/src/fields/fields/Q.js +42 -12
- package/src/fields/fields/S.js +19 -7
- package/src/fields/fields/SCORE.js +9 -4
- package/src/fields/fields/T.js +4 -4
- package/src/fields/fields/U.js +18 -5
- package/src/fields/fields/X.js +20 -6
- package/src/fields/fields/Y.js +17 -4
- package/src/fields/index.js +2 -0
- package/src/fields/update.js +148 -0
- package/test/fields.cli.test.js +3 -1
- package/utils/config.js +9 -0
- package/utils/utils.js +12 -5
- package/.cursor/skills/cloudcc-dev-skill/SKILL.md +0 -71
- package/target/classes/com/cloudcc/core/BaseException.class +0 -0
- package/target/classes/com/cloudcc/core/BusiException.class +0 -0
- package/target/classes/com/cloudcc/core/CCObject.class +0 -0
- package/target/classes/com/cloudcc/core/CCSchedule.class +0 -0
- package/target/classes/com/cloudcc/core/CCService.class +0 -0
- package/target/classes/com/cloudcc/core/CCTrigger.class +0 -0
- package/target/classes/com/cloudcc/core/CCTriggerHandler.class +0 -0
- package/target/classes/com/cloudcc/core/DevLogger.class +0 -0
- package/target/classes/com/cloudcc/core/OperatationEnum.class +0 -0
- package/target/classes/com/cloudcc/core/PeakInterf.class +0 -0
- package/target/classes/com/cloudcc/core/SendEmail.class +0 -0
- package/target/classes/com/cloudcc/core/ServiceResult.class +0 -0
- package/target/classes/com/cloudcc/core/StringUtils.class +0 -0
- package/target/classes/com/cloudcc/core/TimeUtil.class +0 -0
- package/target/classes/com/cloudcc/core/Tool$1.class +0 -0
- package/target/classes/com/cloudcc/core/Tool.class +0 -0
- package/target/classes/com/cloudcc/core/TriggerInvoker.class +0 -0
- package/target/classes/com/cloudcc/core/TriggerMethod.class +0 -0
- package/target/classes/com/cloudcc/core/TriggerTimeEnum.class +0 -0
- package/target/classes/com/cloudcc/core/UserInfo.class +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
2
|
+
name: dev-guide
|
|
3
3
|
description: >-
|
|
4
4
|
Defines how cloudcc-cli extends the `cc` command: argv shape, `bin/cc.js` entry
|
|
5
5
|
(global flags, doctor/docs/init, action-level `-h`), `bin/index.js` Proxy routing,
|
|
@@ -124,6 +124,10 @@ cloudcc <动作 action> <资源 resource> <其余参数 ...>
|
|
|
124
124
|
3. 若有 `doc`,在 `src/<resource>/doc.js` 与 `docs/` 中维护说明;通过 `cloudcc doc <resource>` 可读。
|
|
125
125
|
4. 更新 `src/version/listModuleCommands.js`:**`MODULE_KEYS_ORDER`**、**`MODULE_FOLDER`**,必要时 **`MODULE_HINT`**、**`RESOURCE_CN`**、**`describeActionLine`** 中的映射,保证 `cloudcc --help` 与 `cloudcc <action> -h` 正确。
|
|
126
126
|
5. 自测:`node bin/cc.js <动作> <resource> …`、`cloudcc --help` / `cc --help`、`cloudcc <action> -h`;若 MCP 通过 `cliRunner` 调 **`cloudcc`**,确认参数顺序与文档一致。
|
|
127
|
+
6. 若涉及 `fields` 模块的 `create` 参数扩展:保持“固定参数位置 + 空占位”约定,并同步更新实现、`src/fields/docs/devguide.md` 以及 MCP “Object Fields Creator” 参数透传。
|
|
128
|
+
- `cloudcc create fields`:`argvs[6]` 固定为 `remark`(写入 `obj.remark`)。
|
|
129
|
+
- 新增字段类型特殊参数时:按类型把参数按固定顺序追加到 `argvs` 后面(无值时调用方用空字符串占位),避免下标错位。
|
|
130
|
+
- 如有联动参数(如 `casesensitive` 依赖 `isrepeat=false`):以实现为准,并在文档里明确“何时生效”。
|
|
127
131
|
|
|
128
132
|
---
|
|
129
133
|
|
package/README.md
CHANGED
|
@@ -71,9 +71,73 @@ Resolve the script path on macOS/Linux with:
|
|
|
71
71
|
echo "$(npm root -g)/cloudcc-cli/bin/mcp.js"
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
+
# ReleaseV2.3.9
|
|
75
|
+
|
|
76
|
+
#### Release Date: 2026-4-3
|
|
77
|
+
|
|
78
|
+
#### Release Scope: Full
|
|
79
|
+
|
|
80
|
+
#### Release Content
|
|
81
|
+
|
|
82
|
+
- Fields
|
|
83
|
+
- Added unified `remark` input for `cloudcc create fields` (writes to `obj.remark`)
|
|
84
|
+
- Extended `S` field creation with `schemefieldLength`, `helps`, `isrepeat`, `casesensitive`, `placeholder`, and `defaultValue`
|
|
85
|
+
- Extended `U` (URL) field creation with optional `helps`, `edittype` (`_blank` / `_self`), and `defaultValue` (fixed argv positions after `remark`)
|
|
86
|
+
- Updated the MCP “Object Fields Creator” tool to pass the new `S` parameters, optional `U` parameters, and optional `remark`; expanded `create_object_field` input schema to include these fields
|
|
87
|
+
- Extended `P` (percent) field creation with optional `helps`, `defaultValue`, `schemefieldLength` (digits left of the decimal point), and `decimalPlaces` (digits right of the decimal point); defaults remain `10` / `2` when omitted; MCP `create_object_field` and schema pass `P` parameters and document `decimalPlaces` / per-type `schemefieldLength` semantics
|
|
88
|
+
- Enforced percent (`P`) precision rule: `schemefieldLength` + `decimalPlaces` must be non-negative integers and their sum must not exceed **18**
|
|
89
|
+
- Added `cloudcc update fields` (POST `/api/fieldSetup/saveField`) to update existing fields; requires field id on `obj`; refactored shared payload building into `src/fields/buildFieldData.js` with argv shift for create vs update
|
|
90
|
+
- `update fields` / `saveField`: when merging server field metadata from `queryField`, also copy `apiname` from `schemefieldName` or `apiname` so the save payload stays aligned with the platform field definition
|
|
91
|
+
- Added `cloudcc detail fields` (POST `/api/fieldSetup/editField`) to load field edit-page data (`fieldId`, `fdtype`, `objid`)
|
|
92
|
+
- Extended `C` (currency) field creation with optional `helps`, `defaultValue`, `schemefieldLength`, and `decimalPlaces` (same argv layout and **≤ 18** total-digit rule as `P`)
|
|
93
|
+
- Extended `N` (number) field creation with optional `schemefieldLength` (integer digits left of the decimal), `decimalPlaces` (fraction digits), `isrepeat` (allow duplicate values; default `true`), and `displayThousands` (platform flag: `"1"` disallows repeats, `"0"` allows repeats per current CloudCC mapping; argv slots `argvs[9..12]` on **create**); **≤ 18** total digits enforced like `P`/`C`; MCP passes the same parameters
|
|
94
|
+
- Simple field templates (`U`, `D`, `T`, `F`, `B`, `H`, `E`, `IMG`, `AD`) now set default `obj.schemefieldLength` where missing (e.g. **phone `H`=`15`**, **email `E`=`254`**, **URL `U`=`2000`**, **date/time `D`/`T`/`F`=`20`/`20`/`30`**, **checkbox `B`=`10`**, **image `IMG`=`255`**, **address `AD`=`500`**) so save payloads align with platform length fields
|
|
95
|
+
- `B` (checkbox): `defaultValue` is coerced to **`"0"`** (unchecked) or **`"1"`** (checked) only; any other value falls back to **`"0"`**
|
|
96
|
+
- `E` (email): optional `isrepeat` at `argvs[9]` (**`"true"`** allows duplicate values, **`"false"`** disallows; default **`"true"`**); MCP passes the same parameter
|
|
97
|
+
- `SCORE` (rating): optional `schemefieldLength` at `argvs[9]` as **max score** (number of star icons), integer **1–100**, default **`10`**; MCP passes the same parameter
|
|
98
|
+
- `X` (multiline text area): optional `schemefieldLength` at `argvs[9]` (**max characters 1–4000**, default **`4000`**) and optional `placeholder` at `argvs[10]`; MCP passes the same parameters
|
|
99
|
+
- `J` (long multiline text): same argv layout as `X` with **max characters 1–32000** (default **`32000`**); platform limits **10 `J` fields per object** (not enforced by CLI); MCP passes the same parameters
|
|
100
|
+
- `IMG` (image): `defaultValue` at `argvs[8]` is **max upload count** (integer **1–100**, default **`3`** when omitted); optional `formulaType` (`url` / `input`) at `argvs[9]` (default **`input`**); optional `watermarkstatus` (`"0"` / `"1"`) at `argvs[10]` (default **`"0"`**); MCP passes `formulaType` and `watermarkstatus`
|
|
101
|
+
- `FL` (file): **`obj.defaultValue`** and **`obj.isrepeat`** are both set to the **max file upload count** (integer **1–100**, default **`1`** when omitted); `buildFieldData` validates the count like **`IMG`**
|
|
102
|
+
- `L` (picklist): optional **`useGlobalSelect`** / **`edittype`** (**`radio`** or **`select`** on **`obj`**) / **`isPicklistSorted`** / **`defPl`** / **`globalSelectId`** at **`argvs[10..14]`** (create); **`ptext`** required when **`useGlobalSelect`** is **`"0"`**; **`globalSelectId`** required when **`useGlobalSelect`** is **`"1"`**; defaults **`useGlobalSelect`=`"0"`**, **`edittype`=`select`**, sorted/defPl **`"0"`**; MCP **`create_object_field`** adds the same **`L`**-only arguments after **`ptext`**
|
|
103
|
+
- `Q` (multi-select picklist): same argv layout as **`L`** through **`argvs[14]`**, plus **`visibleLines`** (**`obj.visibleLines`**, integer **1–100**, default **`4`**) and **`showalloptions`** (**`obj.showalloptions`**, **`"0"`**/**`"1"`**, default **`"0"`**) at **`argvs[15..16]`**; **`ptext`** / **`globalSelectId`** rules match **`L`**; MCP passes **`visibleLines`** and **`showalloptions`**
|
|
104
|
+
- `Y` (lookup): **`lookupObj`** at **`argvs[9]`**; optional **`lookupObjDefaultField`** (**`obj.lookupObjDefaultField`**, search/display helper when searching) at **`argvs[10]`**; **`MR`** / **`M`** unchanged (**`lookupObj`** only); MCP passes **`lookupObjDefaultField`** only for **`Y`**
|
|
105
|
+
- **`Y`** / **`MR`** / **`M`**: save payload **`obj`** no longer includes **`defaultValue`** (CLI **`argvs[8]`** unchanged for **`helps`** / **`defaultValue`** position; platform lookup/master-detail fields do not use **`obj.defaultValue`** in these templates)
|
|
106
|
+
- **`ENC`** / **`ENCD` (encrypted text)**: **`obj.schemefieldLength`** (**1–255**, **`argvs[9]`**); top-level **`masktype`** (**`all`** / **`4`** / **`card`** / **`custom`**, **`argvs[10]`**), **`encrypttype`** (when **`masktype`=`custom`**, **`argvs[11]`**), **`maskcharacter`** (**`*`**/**`X`**, **`argvs[12]`**); same argv layout for both types
|
|
107
|
+
- **`LT` (geolocation)**: **`obj.schemefieldLength`** / **`obj.decimalPlaces`** (integer + fractional digits, **≤ 18** total like **`P`**/**`C`**/**`N`**, default **`8`**/**`10`**, **`argvs[9]`**/**`argvs[10]`**); **`displayType`** (**`"1"`** numeric / **`"2"`** DMS, **`argvs[11]`**); MCP passes **`schemefieldLength`**, **`decimalPlaces`**, **`displayType`**
|
|
108
|
+
- Most field templates wire **`helps`** and, where applicable, **`defaultValue`** on **`obj`**; `buildFieldData` uses a unified argv layout (`helps` / `defaultValue` at fixed indices after `remark`, then type-specific args from the next slot—e.g. `ptext` / `lookupObj` at `argvs[9]` for `L`/`Q`/`Y`/`MR`/`M` on **create**); MCP **Object Fields Creator** follows the same order
|
|
109
|
+
- **Argv contract (create, after `remark`=`argvs[6]`)**: `helps`=`argvs[7]`, `defaultValue`=`argvs[8]`; type-specific extras start at `argvs[9]` (`S`: length / `isrepeat` / `placeholder` / `casesensitive`; `U`: `edittype`; `P`/`C`: integer digits / `decimalPlaces`; `N`: integer digits / `decimalPlaces` / `isrepeat` / `displayThousands`; `E`: `isrepeat`; `SCORE`: `schemefieldLength` (max score / stars, 1–100); `X`: `schemefieldLength` (max chars, 1–4000) / `placeholder`; `J`: `schemefieldLength` (max chars, 1–32000) / `placeholder`; `IMG`: `formulaType` / `watermarkstatus`; `L`: `ptext` then `useGlobalSelect` / `edittype` (`radio`/`select`) / `isPicklistSorted` / `defPl` / `globalSelectId` at `argvs[10..14]`; `Q`: same as `L` through `argvs[14]`, then `visibleLines` / `showalloptions` at `argvs[15..16]`; `Y`: `lookupObj` at `argvs[9]`, optional `lookupObjDefaultField` at `argvs[10]`; `MR`/`M`: `lookupObj` at `argvs[9]`; `ENC`/`ENCD`: `schemefieldLength` (1–255) at `argvs[9]`, `masktype` / `encrypttype` / `maskcharacter` at `argvs[10..12]`; `LT`: `schemefieldLength` / `decimalPlaces` at `argvs[9..10]`, `displayType` at `argvs[11]`). **`update fields`** shifts those indices by **+1** (`remark`=`argvs[7]`, so `helps`=`argvs[8]`, `defaultValue`=`argvs[9]`, extras from `argvs[10]`).
|
|
110
|
+
- **Implementation**: `src/fields/buildFieldData.js` parses `S`, `U`, `P`, `C`, `N`, `E`, `SCORE`, `X`, `J`, `IMG`, `L`, `Q`, `Y`, `MR`, `M`, `ENC`, `ENCD`, and `LT` using the above layout (single `readHelpsDefault` helper for `helps`/`defaultValue`); MCP `create_object_field` pushes arguments in the same order as the CLI.
|
|
111
|
+
- Documentation
|
|
112
|
+
- Updated `src/fields/docs/devguide.md` and `introduction.md` (`S`/`remark`, `U`, `L`/`Q` with **CRLF** `\r\n` for picklists, `P`, `C`, universal `helps`/`defaultValue`, `detail` / `update`, API notes)
|
|
113
|
+
- **`devguide`**: “Field-specific parameters” section rewritten to match the unified argv rule; shell examples for `L`/`Q`/`Y`/`MR`/`M` now show `[helps] [defaultValue]` before `ptext` / `lookupObj`; `N` documents `schemefieldLength` / `decimalPlaces` / `isrepeat` / `displayThousands` at `argvs[9..12]` (create); `B` documents checkbox `defaultValue` **`"0"`**/**`"1"`** only; `E` documents `isrepeat` at `argvs[9]`; `SCORE` documents max score (stars) **`1`–`100`** at `argvs[9]`; `X` documents max chars **`1`–`4000`** and `placeholder` at `argvs[9]` / `argvs[10]`; `J` documents **`1`–`32000`**, **10 fields per object** (platform), same argv slots as `X`; `IMG` documents upload count **`1`–`100`** at `argvs[8]` (default **`3`**), `formulaType` / `watermarkstatus` at `argvs[9]` / `argvs[10]`.
|
|
114
|
+
- **`IMG` / `FL`**: JSDoc on `src/fields/fields/IMG.js` and `FL.js` documents `defaultValue` (max images / max files), plus `IMG` `formulaType` (`url` / `input`) and `watermarkstatus` (`"0"` / `"1"`); **`devguide.md`** adds a **`FL`** subsection and table row (`defaultValue` = max file count, default **`1`**) and lists `FL` separately from types that only share generic `helps` / `defaultValue`
|
|
115
|
+
- **`FL` (follow-up)**: **`devguide.md`** updated so **`FL`** upload count (**1–100**) is written to both **`obj.defaultValue`** and **`obj.isrepeat`**; **`buildFieldData`** adds **`validateFlUploadCount`**; **`mcp/index.js`** `create_object_field` **`defaultValue`** schema documents **`FL`** (saved **`isrepeat`** matches the count)
|
|
116
|
+
- **`L` (picklist)**: **`src/fields/fields/L.js`** and **`buildFieldData`** support **`useGlobalSelect`**, **`obj.edittype`** (**`radio`**/**`select`**), **`isPicklistSorted`**, **`defPl`**, **`globalSelectId`**; **`devguide.md`** and MCP **`create_object_field`** (schema + **Object Fields Creator** argv) document **`argvs[10..14]`** after **`ptext`**
|
|
117
|
+
- **`Q` (multi-select picklist)**: **`src/fields/fields/Q.js`** aligns with **`L`** for global/sort options and adds **`obj.visibleLines`** / **`obj.showalloptions`**; **`buildFieldData`** **`normalizeQVisibleLines`**; **`devguide`** / MCP document **`argvs[15..16]`**
|
|
118
|
+
- **`devguide` (`L`/`Q`)**: shell placeholder wording for optional **`ptext`**-after slots now starts at **`argvs[10]`** (matches **`useGlobalSelect`** first), not **`argvs[12]`**
|
|
119
|
+
- **`Y` (lookup)**: optional **`lookupObjDefaultField`** (**`obj.lookupObjDefaultField`**, search/display helper) at **`argvs[10]`** (create); MCP **`create_object_field`** passes **`lookupObjDefaultField`** after **`lookupObj`**
|
|
120
|
+
- **`Y` / `MR` / `M`**: **`src/fields/fields/Y.js`**, **`MR.js`**, **`M.js`** drop **`obj.defaultValue`** from the create/save payload (aligned with platform lookup / master-detail field definitions)
|
|
121
|
+
- **`ENC` / `ENCD`**: **`ENC.js`** / **`ENCD.js`** + **`buildFieldData`** share **`schemefieldLength`** (≤255), **`masktype`**, **`encrypttype`**, **`maskcharacter`**; **`devguide`** / MCP document **`argvs[9..12]`**
|
|
122
|
+
- **`LT` (geolocation)**: **`LT.js`** + **`buildFieldData`** **`validateCurrencyLikePrecision`** for **`obj`** length fields; **`displayType`**; **`devguide`** / MCP **`argvs[9..11]`**
|
|
123
|
+
- Refreshed **`package.json` / npm** version to **2.3.12** (patch-line **2.3.9–2.3.12** changelog is consolidated in this **ReleaseV2.3.9** section); this README supplement documents **`C` + universal `helps`/`defaultValue`** without a new npm version bump
|
|
124
|
+
|
|
125
|
+
# ReleaseV2.3.8
|
|
126
|
+
|
|
127
|
+
#### Release Date:
|
|
128
|
+
|
|
129
|
+
#### Release Scope: Full
|
|
130
|
+
|
|
131
|
+
#### Release Content
|
|
132
|
+
|
|
133
|
+
- CLI
|
|
134
|
+
- Moved the **`cloudcc-dev-skill`** folder to the updated location used by the current skill delivery flow
|
|
135
|
+
- Documentation
|
|
136
|
+
- Updated release notes and aligned **`package.json` / npm** version to **2.3.8**
|
|
137
|
+
|
|
74
138
|
# ReleaseV2.3.7
|
|
75
139
|
|
|
76
|
-
#### Release Date:
|
|
140
|
+
#### Release Date:
|
|
77
141
|
|
|
78
142
|
#### Release Scope: Full
|
|
79
143
|
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cloudcc-dev-skill
|
|
3
|
+
description: 用于 CloudCC CRM 二次开发设计与实施。优先通过 `cloudcc doc <module> introduction|devguide` 获取官方模块文档,再给出方案与代码。用户提到 CloudCC、cloudcc-cli、模块文档、对象/字段、权限、触发器、类、组件、页面、脚本、静态资源、菜单、应用、单点登录、身份提供方、校验规则时应优先使用。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# CloudCC CRM 二开技能
|
|
7
|
+
|
|
8
|
+
## 必须保留
|
|
9
|
+
|
|
10
|
+
- 使用前必须检查npm全局包,是否安装了cloudcc-cli ,如果没有,那么先全局安装 npm
|
|
11
|
+
i -g cloudcc-cli@latest
|
|
12
|
+
|
|
13
|
+
## 快速规则
|
|
14
|
+
|
|
15
|
+
- 先确认 CLI 可用:优先检查 `cloudcc --version`。
|
|
16
|
+
- 若未安装,执行:`npm i -g cloudcc-cli@latest`。
|
|
17
|
+
- 只要涉及 CloudCC 设计或开发,先查文档再回答:优先 `introduction`,落地时看 `devguide`。
|
|
18
|
+
- 命令统一格式:`cloudcc doc <module> <introduction|devguide>`。
|
|
19
|
+
- 特例:`config` 仅支持 `devguide`,不支持 `introduction`。
|
|
20
|
+
|
|
21
|
+
## 模块指令清单(按仓库当前实现)
|
|
22
|
+
|
|
23
|
+
### 基础与环境
|
|
24
|
+
|
|
25
|
+
- 项目:`cloudcc doc project introduction`、`cloudcc doc project devguide`
|
|
26
|
+
- 配置:`cloudcc doc config devguide`(仅该子命令)
|
|
27
|
+
|
|
28
|
+
### 元数据与模型
|
|
29
|
+
|
|
30
|
+
- 对象:`cloudcc doc object introduction`、`cloudcc doc object devguide`
|
|
31
|
+
- 字段:`cloudcc doc fields introduction`、`cloudcc doc fields devguide`
|
|
32
|
+
- 记录类型:`cloudcc doc recordType introduction`、`cloudcc doc recordType devguide`
|
|
33
|
+
- 全局选项:`cloudcc doc globalSelectList introduction`、`cloudcc doc globalSelectList devguide`
|
|
34
|
+
- 按钮:`cloudcc doc button introduction`、`cloudcc doc button devguide`
|
|
35
|
+
- 页面布局:`cloudcc doc pagelayout introduction`、`cloudcc doc pagelayout devguide`
|
|
36
|
+
- 校验规则:`cloudcc doc validationRule introduction`、`cloudcc doc validationRule devguide`
|
|
37
|
+
|
|
38
|
+
### 组织与权限
|
|
39
|
+
|
|
40
|
+
- 用户:`cloudcc doc user introduction`、`cloudcc doc user devguide`
|
|
41
|
+
- 角色:`cloudcc doc role introduction`、`cloudcc doc role devguide`
|
|
42
|
+
- 简档:`cloudcc doc profile introduction`、`cloudcc doc profile devguide`
|
|
43
|
+
- 权限:`cloudcc doc permission introduction`、`cloudcc doc permission devguide`
|
|
44
|
+
|
|
45
|
+
### 后端扩展
|
|
46
|
+
|
|
47
|
+
- 类:`cloudcc doc classes introduction`、`cloudcc doc classes devguide`
|
|
48
|
+
- 触发器:`cloudcc doc triggers introduction`、`cloudcc doc triggers devguide`
|
|
49
|
+
- 定时类:`cloudcc doc timer introduction`、`cloudcc doc timer devguide`
|
|
50
|
+
- 定时任务:`cloudcc doc scheduleJob introduction`、`cloudcc doc scheduleJob devguide`
|
|
51
|
+
|
|
52
|
+
### 前端扩展
|
|
53
|
+
|
|
54
|
+
- 组件:`cloudcc doc plugin introduction`、`cloudcc doc plugin devguide`
|
|
55
|
+
- 自定义页面:`cloudcc doc customPage introduction`、`cloudcc doc customPage devguide`
|
|
56
|
+
- 客户端脚本:`cloudcc doc script introduction`、`cloudcc doc script devguide`
|
|
57
|
+
- 静态资源:`cloudcc doc staticResource introduction`、`cloudcc doc staticResource devguide`
|
|
58
|
+
|
|
59
|
+
### 平台导航与系统能力
|
|
60
|
+
|
|
61
|
+
- 菜单:`cloudcc doc menu introduction`、`cloudcc doc menu devguide`
|
|
62
|
+
- 应用:`cloudcc doc application introduction`、`cloudcc doc application devguide`
|
|
63
|
+
- 自定义设置:`cloudcc doc customSetting introduction`、`cloudcc doc customSetting devguide`
|
|
64
|
+
- 身份提供方:`cloudcc doc identityProvider introduction`、`cloudcc doc identityProvider devguide`
|
|
65
|
+
- 单点登录:`cloudcc doc singleSignOn introduction`、`cloudcc doc singleSignOn devguide`
|
|
66
|
+
|
|
67
|
+
## 使用流程(执行顺序)
|
|
68
|
+
|
|
69
|
+
1. 方案阶段:先调用 `cloudcc doc <module> introduction`,确认能力边界与适用场景。
|
|
70
|
+
2. 实施阶段:再调用 `cloudcc doc <module> devguide`,按文档落地 CLI 命令与配置。
|
|
71
|
+
3. 环境阶段:涉及项目初始化或鉴权问题时,优先查看 `project devguide` 与 `config devguide`。
|
|
72
|
+
|
|
73
|
+
## 响应要求
|
|
74
|
+
|
|
75
|
+
- 给方案或代码前,先明确引用了哪些 `cloudcc doc` 模块文档。
|
|
76
|
+
- 若用户没有指定模块,先反问业务对象(如对象、权限、触发器、页面)或先给一个最小可行模块列表。
|
|
77
|
+
- 输出命令时保持可直接复制执行,不混用过时命令格式。
|
|
78
|
+
- **发布日志/Release Notes 规则(强制)**:凡是更新发布记录、版本日志、README 中 `Release`/`Release Notes` 区块,内容必须使用英文(标题、日期标签、条目描述均不得使用中文)。
|
package/mcp/index.js
CHANGED
|
@@ -158,8 +158,31 @@ mcpServer.registerTool(
|
|
|
158
158
|
fieldType: z.enum(['S', 'U', 'SCORE', 'IMG', 'P', 'C', 'J', 'H', 'E', 'B', 'A', 'D', 'F', 'T', 'N', 'ENC', 'ENCD', 'X', 'L', 'Q', 'AD', 'LT', 'FL', 'Y', 'MR', 'M']).describe('字段类型:S(文本),U(URL),SCORE(评分),IMG(图片),P(百分比),C(币种),J(文本区-长,最长32000字符),H(电话),E(电子邮件),B(复选框),A(富文本),D(日期),F(日期/时间),T(时间),N(数字),ENC(加密文本-存储加密),ENCD(加密文本-显示加密),X(文本区,最多4000字符),L(选项列表-单选),Q(选项列表-多选),AD(地址),LT(地理定位,用于录入经纬度),FL(文件),Y(查找关系),MR(查找多选),M(主详信息关系)'),
|
|
159
159
|
nameLabel: z.string().min(1).describe('字段名称,必填字段'),
|
|
160
160
|
projectPath: z.string().optional().describe('项目根路径,默认为当前工作目录'),
|
|
161
|
-
ptext: z.string().optional().describe('选项列表文本,多个选项用\\r\\n
|
|
162
|
-
lookupObj: z.string().optional().describe('
|
|
161
|
+
ptext: z.string().optional().describe('选项列表文本,多个选项用\\r\\n分隔;L/Q 在 useGlobalSelect=0 时必填,全局列表时可空,对应 CLI argvs[9](create)'),
|
|
162
|
+
lookupObj: z.string().optional().describe('查找关系目标对象;Y/MR/M 必填,对应 CLI argvs[9](create)'),
|
|
163
|
+
lookupObjDefaultField: z.string().optional().describe('Y(查找关系):搜索辅助字段,写入 obj.lookupObjDefaultField;搜索时展示;对应 CLI argvs[10](create),可空'),
|
|
164
|
+
remark: z.string().optional().describe('字段业务功能描述,写入 obj.remark;对应 CLI argvs[6]'),
|
|
165
|
+
schemefieldLength: z.string().optional().describe('S 长度 argvs[9];P/C/N 整数位 argvs[9];LT 小数点左侧位数 argvs[9] 默认8(与 decimalPlaces 之和≤18);SCORE 1~100 默认10;X 1~4000 默认4000;J 长文本区 1~32000 默认32000;ENC/ENCD 1~255 默认255,argvs[9](create)'),
|
|
166
|
+
helps: z.string().optional().describe('帮助文本,统一 argvs[7](create);update 为 argvs[8]'),
|
|
167
|
+
isrepeat: z.string().optional().describe('S argvs[10];N argvs[11];E(电子邮件) argvs[9]:true 允许重复,false 不允许,默认 true'),
|
|
168
|
+
casesensitive: z.string().optional().describe('S(文本) 区分大小写,argvs[12],仅 isrepeat=false 时生效'),
|
|
169
|
+
placeholder: z.string().optional().describe('S 输入框提示 argvs[11];X 文本区 argvs[10];J 长文本区 argvs[10]'),
|
|
170
|
+
defaultValue: z.string().optional().describe('默认值,统一 argvs[8](create);update 为 argvs[9];B(复选框) 仅 "0"/"1"(未选中/选中),其它按 "0";IMG(图片) 为可上传图片数量 1~100,空则 3;FL(文件) 为可上传文件数量 1~100(保存时与 obj.isrepeat 同步为同一数值),空则 1'),
|
|
171
|
+
formulaType: z.string().optional().describe('IMG(图片):录入方式 url 或 input,argvs[9](create),空则 input'),
|
|
172
|
+
watermarkstatus: z.string().optional().describe('IMG(图片):水印拍照 "0" 不支持 "1" 支持,argvs[10](create),空则 0'),
|
|
173
|
+
edittype: z.string().optional().describe('U(URL):_blank 或 _self,argvs[9](create),空则 _blank。L/Q(选项列表):radio 或 select,argvs[11](create),空则 select'),
|
|
174
|
+
useGlobalSelect: z.string().optional().describe('L/Q(选项列表):是否使用全局选项列表 "0" 否 "1" 是,argvs[10](create),空则 0'),
|
|
175
|
+
isPicklistSorted: z.string().optional().describe('L/Q:按字母顺序排序 "0" 否 "1" 是,argvs[12](create),空则 0'),
|
|
176
|
+
defPl: z.string().optional().describe('L/Q:将第一个值作为默认值 "0" 否 "1" 是,argvs[13](create),空则 0'),
|
|
177
|
+
globalSelectId: z.string().optional().describe('L/Q:全局选项列表 id;useGlobalSelect=1 时必填,argvs[14](create)'),
|
|
178
|
+
visibleLines: z.string().optional().describe('Q(多选):下拉最多展示行数 1~100,写入 obj.visibleLines,argvs[15](create),空则 4'),
|
|
179
|
+
showalloptions: z.string().optional().describe('Q(多选):是否显示全部选项 "0" 否 "1" 是,写入 obj.showalloptions,argvs[16](create),空则 0'),
|
|
180
|
+
masktype: z.string().optional().describe('ENC/ENCD:掩码类型 all | 4 | card | custom,argvs[10](create),空则 all'),
|
|
181
|
+
encrypttype: z.string().optional().describe('ENC/ENCD:masktype=custom 时自定义规则,如 {AAAA}{****}{AAAA};argvs[11](create);非 custom 可空'),
|
|
182
|
+
maskcharacter: z.string().optional().describe('ENC/ENCD:掩码字符 * 或 X,argvs[12](create),空则 *'),
|
|
183
|
+
decimalPlaces: z.string().optional().describe('P/C 小数点右侧 argvs[10] 默认2;N 小数点右侧 argvs[10] 默认0;LT 小数点右侧 argvs[10] 默认10'),
|
|
184
|
+
displayType: z.string().optional().describe('LT(地理定位):经纬度显示 "1" 数字 "2" 度分秒,顶层 displayType,argvs[11](create),空则 1'),
|
|
185
|
+
displayThousands: z.string().optional().describe('N(数字) argvs[12],默认0; "1"不允许重复,"0"允许重复(平台字段名 displayThousands)'),
|
|
163
186
|
})
|
|
164
187
|
},
|
|
165
188
|
fieldCreatorHandler.createObjectField
|
|
@@ -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,
|
|
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,
|
|
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
package/src/classes/create.js
CHANGED
|
@@ -13,6 +13,16 @@ async function create(argvs) {
|
|
|
13
13
|
let res = await checkUpdate();
|
|
14
14
|
if (!res) {
|
|
15
15
|
let config = await getPackageJson();
|
|
16
|
+
if (!config) {
|
|
17
|
+
console.error()
|
|
18
|
+
console.error(
|
|
19
|
+
chalk.yellow(
|
|
20
|
+
"No valid cloudcc-cli config for this project. Create or fix cloudcc-cli.config.js (see cloudcc doc project devguide)."
|
|
21
|
+
)
|
|
22
|
+
)
|
|
23
|
+
console.error()
|
|
24
|
+
return
|
|
25
|
+
}
|
|
16
26
|
const classesPath = path.join(process.cwd(), "classes/" + name);
|
|
17
27
|
try {
|
|
18
28
|
fs.mkdirSync(classesPath, { recursive: true })
|