bpmax-cli 0.2.1-beta.31 → 0.2.1-beta.33
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/dist/bin.js +483 -36
- package/dist/bin.js.map +1 -1
- package/package.json +1 -1
- package/skills/bpmax-cli/SKILL.md +2 -0
- package/skills/bpmax-form-template-editor/SKILL.md +14 -2
- package/skills/bpmax-form-template-editor/references/dynamic-field-state.md +164 -0
- package/skills/bpmax-shared/SKILL.md +8 -0
package/package.json
CHANGED
|
@@ -15,6 +15,8 @@ metadata:
|
|
|
15
15
|
## Agent 基础行为
|
|
16
16
|
|
|
17
17
|
- 先应用 `../bpmax-shared/SKILL.md` 的命令发现、profile/auth 检查、全局参数、JSON 输出、URL 生成和原始 API 降级规则。
|
|
18
|
+
- 每次读取 CLI JSON 对象时都必须检查 `_notice`。出现 `_notice.update` 或 `_notice.skills` 时,先向用户简要说明当前版本、目标版本和更新渠道,再逐字执行其中的 `next_command`;更新失败则停止后续 BPMAX 配置或正式 E2E,不得继续混用旧 CLI 与旧 Skills。JSON 数组、NDJSON、table 和错误输出中的通知会写到 stderr,也必须读取。
|
|
19
|
+
- beta 版本只跟踪 npm `beta` 渠道,稳定版本只跟踪 `latest` 渠道。不要把 beta 与 stable 的比较结果混在一起,也不要自行改写通知返回的更新命令。
|
|
18
20
|
- 未初始化时,不要直接编造 profile、config-dir 或 API Key;先要求用户提供 BPMAX workspace 页面 URL。Agent 多用户环境必须从可信 runtime metadata 读取稳定用户/会话 scope,优先使用 channel + peer/user,至少使用 user id,再运行:
|
|
19
21
|
|
|
20
22
|
```bash
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: "bpmax-form-template-editor"
|
|
3
|
-
description: "用于通过 bpmax-cli typed config 创建、编辑、校验或美化 BPMAX
|
|
3
|
+
description: "用于通过 bpmax-cli typed config 创建、编辑、校验或美化 BPMAX 表单模板。只要用户提到“新建表单模板”“编辑表单模板”“动态显隐/只读/必填”“优化表单布局”“补字段校验”“sub_form”“lambda/customeValidate”“提交表单模板配置”或等价表达,就应使用这个 skill。"
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# BPMAX Form Template Editor
|
|
@@ -43,7 +43,7 @@ description: "用于通过 bpmax-cli typed config 创建、编辑、校验或美
|
|
|
43
43
|
- `bpmax-cli config form-template submit --id <id> --payload <submit-file> --profile <profile> --confirm "submit form-template <id>" --format json`
|
|
44
44
|
11. 新建表单模板时,`work.mode` 与 `meta.mode` 都必须是 `create`,`meta.id` 使用 `create` 占位:
|
|
45
45
|
- `bpmax-cli config form-template submit --id create --payload <submit-file> --profile <profile> --confirm "submit form-template create" --format json`
|
|
46
|
-
12. 提交后必须运行 `bpmax-cli config form-template verify --id <id> --expect <work-file> --profile <profile> --format json
|
|
46
|
+
12. 提交后必须运行 `bpmax-cli config form-template verify --id <draft-id> --expect <work-file> --ignore-server-fields --profile <profile> --format json`,忽略 `form_rule_id/template_id/visibility` 等平台回填字段后比较业务结构;并刷新表单编辑器页面确认布局生效。若页面打不开、空白或字段缺失,优先检查浏览器 Console 和 Network。
|
|
47
47
|
|
|
48
48
|
## 草稿、发布和基线门禁
|
|
49
49
|
- 修改已有模板前必须拿到当前线上详情、`base_hash`、草稿/发布态身份和最近回读时间;若远端在 work 生成后变化,必须停止并重新导出。
|
|
@@ -63,6 +63,7 @@ description: "用于通过 bpmax-cli typed config 创建、编辑、校验或美
|
|
|
63
63
|
| 本地临时目录、work/submit 双确认闭环 | `references/local-temp-workflow.md` |
|
|
64
64
|
| submit payload 自检和字段级门禁 | `references/payload-checklist.md` |
|
|
65
65
|
| 子表单、明细表、预填和父子模板绑定 | `references/sub-form-patterns.md` |
|
|
66
|
+
| 动态显隐、动态只读、动态必填 | `references/dynamic-field-state.md` |
|
|
66
67
|
| 控件选型、真实样例、`field_type` 目录 | `../form-control-library/SKILL.md` |
|
|
67
68
|
| 脚本位点矩阵和最小脚本模板 | `../bpmax-builder-shared/runtime-script-site-matrix.md`, `../bpmax-builder-shared/runtime-script-template-catalog.md` |
|
|
68
69
|
|
|
@@ -71,9 +72,19 @@ description: "用于通过 bpmax-cli typed config 创建、编辑、校验或美
|
|
|
71
72
|
- 前端创建页 `i_form_create.setValue()` 会读取 `validateMap.required`;缺失时页面可能显示字段标题,但初始化校验、回填或提交会抛异常。
|
|
72
73
|
- `bpmax-cli config form-template lint` 已把缺少 `value.validateMap` / `value.validateMap.required` 作为 hard error;`build` 会复用同一门禁,不得跳过 lint 直接依赖 build 兜底。
|
|
73
74
|
- `form_rule_id`、`form_template_id`、`template_id`、字段持久化 `id` 等后端持久化 ID 不得出现在 create submit payload 中。
|
|
75
|
+
- `rule.field` 最长 20 字符;超长会在平台先创建空模板后写字段失败。CLI lint/build 必须在远端请求前以 `[form.field.max_length]` 阻断,较长业务含义放在 `key` 或 `title`。
|
|
74
76
|
- `field` 是平台字段标识,`key` 才承载业务语义;脚本、数据集、条件判断优先按稳定业务 `key` 设计。
|
|
75
77
|
- 线上回读优先于本地 `think_*` 镜像;本地镜像只用于检索候选结构和差异线索。
|
|
76
78
|
|
|
79
|
+
## 动态字段状态硬门禁
|
|
80
|
+
- 配置动态显隐、动态只读或动态必填前必须读取 `references/dynamic-field-state.md`;三类能力统一使用字段 `rule` 上的 `has*Condition + *Condition`。
|
|
81
|
+
- 标准配置必须是 `{ condition: { logic: "AND|OR", conditions: [...] }, action: boolean }`。旧的单条件 `condition: { leftValueType, ... }` 会被当前运行时误当空条件,禁止继续生成。
|
|
82
|
+
- `visibilityCondition.action=true` 表示条件成立时隐藏,`disabledCondition.action=true` 表示禁用,`requiredCondition.action=true` 表示必填;不得把极性写反。
|
|
83
|
+
- 字段引用必须使用真实 `rule.field`,不能用业务 `key`;引用 `$formField` / `$formDisplayField` 的变量必须提供 `leftValueRef` / `rightValueRef` 订阅依赖。
|
|
84
|
+
- 禁止字段自引用、间接循环依赖、同一条件下隐藏且必填、同一条件下禁用且必填,以及静态必填字段被动态隐藏/禁用但没有配套 `requiredCondition`。
|
|
85
|
+
- 动态隐藏只改变前端显示状态,不会自动清空旧值;动态禁用和 `$userInfo` 条件也不是服务端字段 ACL,不得用于敏感字段保密或防止绕过页面写入。
|
|
86
|
+
- `lint`、`build` 和 typed submit 主路径必须复用 TypeScript 动态条件门禁;通过 readback 后仍要在真实页面验证初始、触发、恢复、重复切换、保存重开和动态必填提交阻断。
|
|
87
|
+
|
|
77
88
|
## 脚本与运行态门禁
|
|
78
89
|
- `lambda`、`customeValidate.content`、`es_project_selector.props.template` 等脚本位点不得整段重写后直接提交,必须执行 extract -> patch -> writeback。
|
|
79
90
|
- 多语句 `lambda` 必须写成块字符串 `{ ... }`;单表达式才可直接返回表达式,避免运行时 `eval fn parsed failed`。
|
|
@@ -86,6 +97,7 @@ description: "用于通过 bpmax-cli typed config 创建、编辑、校验或美
|
|
|
86
97
|
|
|
87
98
|
## 控件专项门禁
|
|
88
99
|
- 涉及控件类型、控件是否存在或某个 `field_type` 怎么配,必须联动 `form-control-library`。
|
|
100
|
+
- `radio` 不能只写 `type=radio` 和 options;`_fc_drag_tag=radio`、`name=radio` 是运行态控件身份,缺失时必须硬阻断。新建模板还必须使用 `defaultValueType=option` 和 `{ type: "radio", value?: <option> }`;历史 edit 模板的 `defaultValueType=string` 或标量默认值只提示迁移 warning,不得阻断无关字段修改,也不得由 build 静默改写。
|
|
89
101
|
- `sub_form` 不是父表单中的占位对象;必须有父字段配置、已发布子表单模板 ID、运行态保存/展示验证。父表单绑定的 `form_template.id` 必须是已发布模板 ID,不要绑定草稿 ID。
|
|
90
102
|
- `es_project_selector` 必须以当前环境源码或真实接口验证为准;若存在非空 `lambda`,`quickValue` 必须显式为 `true`。
|
|
91
103
|
- `sn_number` 需要验证发起项目和审批提交链路中的后端生成结果,模板保存成功不等于单号已生成。
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# 动态显隐、动态只读与动态必填
|
|
2
|
+
|
|
3
|
+
本页定义 BPMAX 表单字段的前端动态状态配置。配置写在字段 `rule` 上,只控制运行态页面呈现、交互和前端校验,不等同于服务端字段读取权限或写入权限。
|
|
4
|
+
|
|
5
|
+
## 三类标准字段
|
|
6
|
+
|
|
7
|
+
| 能力 | 启用字段 | 配置字段 | `action=true` 的含义 |
|
|
8
|
+
| --- | --- | --- | --- |
|
|
9
|
+
| 动态显隐 | `hasVisibilityCondition` | `visibilityCondition` | 条件成立时隐藏 |
|
|
10
|
+
| 动态只读 | `hasDisabledCondition` | `disabledCondition` | 条件成立时禁用 |
|
|
11
|
+
| 动态必填 | `hasRequiredCondition` | `requiredCondition` | 条件成立时必填 |
|
|
12
|
+
|
|
13
|
+
`action=false` 会反转结果:条件成立时显示、启用或非必填;条件不成立时执行对应动作。不要把 `visibilityCondition.action=true` 理解成“显示”。
|
|
14
|
+
|
|
15
|
+
## 标准结构
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"hasVisibilityCondition": true,
|
|
20
|
+
"visibilityCondition": {
|
|
21
|
+
"condition": {
|
|
22
|
+
"logic": "AND",
|
|
23
|
+
"conditions": [
|
|
24
|
+
{
|
|
25
|
+
"leftValueType": "field",
|
|
26
|
+
"leftValue": "is_temporary",
|
|
27
|
+
"operator": "eq",
|
|
28
|
+
"rightValueType": "constant",
|
|
29
|
+
"rightValue": "是"
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
"action": true
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
- `condition` 必须是条件组,包含 `logic: AND|OR` 和非空 `conditions[]`。
|
|
39
|
+
- `conditions[]` 可以继续嵌套条件组。
|
|
40
|
+
- 旧结构 `condition: { leftValueType, ... }` 不能继续使用。当前运行时会把它当作空条件,可能造成字段始终隐藏或始终禁用。
|
|
41
|
+
- `action` 必须是 boolean。
|
|
42
|
+
|
|
43
|
+
## 条件项
|
|
44
|
+
|
|
45
|
+
左侧:
|
|
46
|
+
|
|
47
|
+
- `leftValueType` 仅允许 `field` 或 `variable`。
|
|
48
|
+
- `field` 模式的 `leftValue` 必须填写真实 `rule.field`,不能填写业务 `key`。
|
|
49
|
+
- 对对象字段取子属性时使用 `leftSubField`。
|
|
50
|
+
- 非空旧字段 `subField` 不会被当前表单运行时读取,必须迁移为 `leftSubField` 或 `rightSubField`。
|
|
51
|
+
|
|
52
|
+
右侧:
|
|
53
|
+
|
|
54
|
+
- `rightValueType` 允许 `field`、`variable`、`constant`。
|
|
55
|
+
- `field` 模式可使用 `rightSubField`。
|
|
56
|
+
- `constant` 模式必须显式提供 `rightValue`;`null` 也是显式值。
|
|
57
|
+
- `isEmpty`、`isNotEmpty` 是单目操作符,不要求右值。
|
|
58
|
+
|
|
59
|
+
允许的操作符:
|
|
60
|
+
|
|
61
|
+
```text
|
|
62
|
+
eq ne gt gte lt lte contains isEmpty isNotEmpty
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## 运行变量
|
|
66
|
+
|
|
67
|
+
允许使用:
|
|
68
|
+
|
|
69
|
+
- `$MOMENT`
|
|
70
|
+
- `$userInfo`
|
|
71
|
+
- `$formField`
|
|
72
|
+
- `$formDisplayField`
|
|
73
|
+
- `$RANGE`
|
|
74
|
+
|
|
75
|
+
引用表单字段的变量必须提供对应的 `leftValueRef` 或 `rightValueRef`,否则运行时不会订阅字段变化:
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"leftValueType": "variable",
|
|
80
|
+
"leftValue": "$RANGE($formField['service_period'], 'days')",
|
|
81
|
+
"leftValueRef": "$formField['service_period']",
|
|
82
|
+
"operator": "gt",
|
|
83
|
+
"rightValueType": "constant",
|
|
84
|
+
"rightValue": 30
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
`$userInfo.id` 可用于页面状态判断,但它仍然只是前端条件。不得用它替代服务端权限、敏感字段保密或防篡改控制。
|
|
89
|
+
|
|
90
|
+
## 冲突门禁
|
|
91
|
+
|
|
92
|
+
- 动态条件不得引用不存在的字段,不得自引用或形成间接循环依赖。
|
|
93
|
+
- 同一条件和同一 `action` 不能同时让字段隐藏并必填。
|
|
94
|
+
- 同一条件和同一 `action` 不能同时让字段禁用并必填。
|
|
95
|
+
- 静态隐藏字段启用动态必填时,必须同时有动态显隐恢复路径。
|
|
96
|
+
- 静态禁用字段启用动态必填时,必须同时有动态只读恢复路径。
|
|
97
|
+
- 静态必填字段只要可能动态隐藏或禁用,就必须改为配套的 `requiredCondition`,不能永久保持必填。
|
|
98
|
+
- `raw`、标签、分隔线、按钮等展示或命令控件不得配置动态必填。
|
|
99
|
+
|
|
100
|
+
推荐成对配置:触发条件成立时显示并必填,可写成互斥动作。
|
|
101
|
+
|
|
102
|
+
```json
|
|
103
|
+
{
|
|
104
|
+
"hasVisibilityCondition": true,
|
|
105
|
+
"visibilityCondition": {
|
|
106
|
+
"condition": {
|
|
107
|
+
"logic": "AND",
|
|
108
|
+
"conditions": [
|
|
109
|
+
{
|
|
110
|
+
"leftValueType": "field",
|
|
111
|
+
"leftValue": "need_detail",
|
|
112
|
+
"operator": "ne",
|
|
113
|
+
"rightValueType": "constant",
|
|
114
|
+
"rightValue": "是"
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
},
|
|
118
|
+
"action": true
|
|
119
|
+
},
|
|
120
|
+
"hasRequiredCondition": true,
|
|
121
|
+
"requiredCondition": {
|
|
122
|
+
"condition": {
|
|
123
|
+
"logic": "AND",
|
|
124
|
+
"conditions": [
|
|
125
|
+
{
|
|
126
|
+
"leftValueType": "field",
|
|
127
|
+
"leftValue": "need_detail",
|
|
128
|
+
"operator": "eq",
|
|
129
|
+
"rightValueType": "constant",
|
|
130
|
+
"rightValue": "是"
|
|
131
|
+
}
|
|
132
|
+
]
|
|
133
|
+
},
|
|
134
|
+
"action": true
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## 子表单
|
|
140
|
+
|
|
141
|
+
`TableForm` 会按当前子表单行分别初始化动态条件。子表单字段条件应引用同一行内的字段;必须回测新增行、复制行、多行切换和保存重开,不能只验证第一行。
|
|
142
|
+
|
|
143
|
+
## CLI 与运行态验收
|
|
144
|
+
|
|
145
|
+
提交前必须通过:
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
bpmax-cli config form-template lint --work <work-file> --profile <profile> --format json
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
lint/build 会阻断:旧单条件结构、空条件组、非法操作符、错误字段引用、缺少变量订阅、循环依赖和必填冲突。关闭 `has*Condition` 但保留配置时只提示 stale warning,不执行该配置。
|
|
152
|
+
|
|
153
|
+
提交和 readback 只能证明配置被正确持久化。真实页面还必须覆盖:
|
|
154
|
+
|
|
155
|
+
1. 初始状态。
|
|
156
|
+
2. 条件成立后的隐藏、禁用或必填状态。
|
|
157
|
+
3. 条件不成立后的恢复状态。
|
|
158
|
+
4. 连续来回切换,不出现状态残留。
|
|
159
|
+
5. 保存并重新打开后配置仍生效。
|
|
160
|
+
6. 动态必填必须真实触发提交校验。
|
|
161
|
+
7. 动态必填恢复为非必填后,已经出现的必填错误必须消失,不能残留“请填写”状态。
|
|
162
|
+
8. 子表单场景验证新增、复制和多行隔离。
|
|
163
|
+
|
|
164
|
+
动态隐藏不会自动清空字段旧值。除非平台另有经过源码和运行态验证的业务逻辑,不得假设隐藏时会删除已填写数据。
|
|
@@ -41,6 +41,14 @@ node "$BPMAX_CLI_HOME/scripts/run-source-cli.mjs" ...
|
|
|
41
41
|
|
|
42
42
|
禁止在同一次迁移中混用源码 CLI、旧全局 CLI 和不同版本 Skills。开始迁移前必须确认 `--version` 与 `$BPMAX_CLI_HOME/package.json` 一致,且命令输出不再出现 Skills out-of-sync notice。
|
|
43
43
|
|
|
44
|
+
## Agent 更新通知
|
|
45
|
+
|
|
46
|
+
- 所有 Agent、OpenClaw、Aily、Codex 和自动化调用都必须读取 CLI 返回的 `_notice`,不能只读取业务字段。
|
|
47
|
+
- `_notice.update` 表示当前安装渠道存在更高版本;beta 安装跟踪 `beta`,稳定安装跟踪 `latest`。先展示 `current/latest/channel`,再执行返回的 `next_command`。
|
|
48
|
+
- `_notice.skills` 表示 bundled Skills 未安装或与 CLI 不匹配;必须先执行返回的 `next_command` 完成同步。
|
|
49
|
+
- JSON 对象中的通知位于 `_notice`;JSON 数组、NDJSON、table、pretty 和命令错误中的通知通过 stderr 输出。Agent 必须同时读取 stdout 和 stderr。
|
|
50
|
+
- 更新失败时停止后续配置提交和正式 E2E,并向用户展示结构化错误;不得静默忽略更新提示或继续使用旧 lint/Skill。
|
|
51
|
+
|
|
44
52
|
## 开始前检查
|
|
45
53
|
|
|
46
54
|
任何 BPMAX CLI 场景都先做两步。本地终端可直接运行;Agent/飞书/OpenClaw/Aily 等多用户运行时必须使用 `init` 返回的 `next_commands.profile_list` 和 `next_commands.auth_status`,不要裸跑共享配置命令:
|