@stalfh233/omc-cli 0.0.0-stage → 0.4.0
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/LICENSE +21 -0
- package/README.md +304 -3
- package/coverage/m1-coverage-manifest-v1.json +1278 -0
- package/dist/approval-token.js +102 -0
- package/dist/args.js +25 -0
- package/dist/artifacts.js +119 -0
- package/dist/bench/call-face-eval.js +256 -0
- package/dist/bench/context-attribution.js +151 -0
- package/dist/bench/discovery-cost-eval.js +230 -0
- package/dist/bench/driver.js +81 -0
- package/dist/bench/evals.js +236 -0
- package/dist/bench/fake-http-server.js +65 -0
- package/dist/bench/instrument.js +87 -0
- package/dist/bench/intent-face-eval.js +343 -0
- package/dist/bench/run.js +166 -0
- package/dist/bench/scenario.js +343 -0
- package/dist/bench/types.js +76 -0
- package/dist/bi-wire.js +41 -0
- package/dist/bizservice-config.js +581 -0
- package/dist/call.js +153 -0
- package/dist/capability-absences.js +23 -0
- package/dist/capability-overview.js +492 -0
- package/dist/capability-shape.js +154 -0
- package/dist/cli-contract.js +70 -0
- package/dist/cli-output.js +73 -0
- package/dist/cli.js +1418 -0
- package/dist/code-rules.js +69 -0
- package/dist/command-transport.js +155 -0
- package/dist/config-store.js +195 -0
- package/dist/context.js +21 -0
- package/dist/contract-consistency.js +66 -0
- package/dist/contract-resources.js +62 -0
- package/dist/coverage-consistency.js +62 -0
- package/dist/coverage-registry.js +76 -0
- package/dist/coverage.js +130 -0
- package/dist/data-list-filter.js +114 -0
- package/dist/discovery.js +390 -0
- package/dist/endpoints.js +154 -0
- package/dist/environment-policy.js +26 -0
- package/dist/execution-metadata.js +1092 -0
- package/dist/fake/app.js +45 -0
- package/dist/fake/b2-registration.js +594 -0
- package/dist/fake/businessrule.js +242 -0
- package/dist/fake/datarule.js +72 -0
- package/dist/fake/dictionary.js +108 -0
- package/dist/fake/environment.js +30 -0
- package/dist/fake/field.js +167 -0
- package/dist/fake/form.js +101 -0
- package/dist/fake/index.js +121 -0
- package/dist/fake/list-view.js +289 -0
- package/dist/fake/model.js +136 -0
- package/dist/fake/online-js.js +18 -0
- package/dist/fake/report.js +253 -0
- package/dist/fake/routes.js +47 -0
- package/dist/fake/rule-lifecycle.js +37 -0
- package/dist/fake/runtime-data.js +367 -0
- package/dist/fake/state.js +67 -0
- package/dist/fake/workflow.js +364 -0
- package/dist/field-change.js +200 -0
- package/dist/field-families.js +896 -0
- package/dist/form-layout.js +111 -0
- package/dist/form-support.js +821 -0
- package/dist/goal-routes.js +468 -0
- package/dist/governed-execution.js +87 -0
- package/dist/human-summary.js +212 -0
- package/dist/identity.js +62 -0
- package/dist/intent/baseline.js +57 -0
- package/dist/intent/capabilities/bizservice.js +274 -0
- package/dist/intent/capabilities/businessrule.js +493 -0
- package/dist/intent/capabilities/datarule.js +187 -0
- package/dist/intent/capabilities/field.js +545 -0
- package/dist/intent/capabilities/form.js +136 -0
- package/dist/intent/capabilities/index.js +64 -0
- package/dist/intent/capabilities/listview.js +157 -0
- package/dist/intent/capabilities/model.js +100 -0
- package/dist/intent/capabilities/onlinejs.js +108 -0
- package/dist/intent/capabilities/report.js +355 -0
- package/dist/intent/capabilities/workflow.js +458 -0
- package/dist/intent/capability.js +6 -0
- package/dist/intent/cli.js +91 -0
- package/dist/intent/compare.js +56 -0
- package/dist/intent/compiler.js +79 -0
- package/dist/intent/dsl.js +129 -0
- package/dist/intent/plan-file.js +63 -0
- package/dist/intent/readback.js +65 -0
- package/dist/intent/schema.js +158 -0
- package/dist/intent/validation.js +30 -0
- package/dist/intent/yaml.js +315 -0
- package/dist/json-column.js +68 -0
- package/dist/lanes/app-contract.js +95 -0
- package/dist/lanes/app-coverage.js +16 -0
- package/dist/lanes/app.js +174 -0
- package/dist/lanes/apply-changes.js +231 -0
- package/dist/lanes/b2-registration-contract.js +292 -0
- package/dist/lanes/b2-registration-coverage.js +48 -0
- package/dist/lanes/b2-registration.js +1187 -0
- package/dist/lanes/businessrule-contract.js +232 -0
- package/dist/lanes/businessrule-coverage.js +16 -0
- package/dist/lanes/businessrule.js +221 -0
- package/dist/lanes/contract-support.js +65 -0
- package/dist/lanes/coverage-declaration.js +9 -0
- package/dist/lanes/datarule-contract.js +155 -0
- package/dist/lanes/datarule-coverage.js +19 -0
- package/dist/lanes/datarule-protocol.js +308 -0
- package/dist/lanes/datarule.js +818 -0
- package/dist/lanes/dictionary-contract.js +78 -0
- package/dist/lanes/dictionary-coverage.js +24 -0
- package/dist/lanes/dictionary.js +235 -0
- package/dist/lanes/environment-contract.js +70 -0
- package/dist/lanes/environment-coverage.js +14 -0
- package/dist/lanes/environment.js +163 -0
- package/dist/lanes/field-contract.js +223 -0
- package/dist/lanes/field-coverage.js +27 -0
- package/dist/lanes/field.js +374 -0
- package/dist/lanes/form-contract.js +97 -0
- package/dist/lanes/form-coverage.js +16 -0
- package/dist/lanes/form.js +185 -0
- package/dist/lanes/lane-ids.js +34 -0
- package/dist/lanes/list-view-contract.js +175 -0
- package/dist/lanes/list-view-coverage.js +20 -0
- package/dist/lanes/list-view-shapes.js +1207 -0
- package/dist/lanes/list-view.js +578 -0
- package/dist/lanes/meta-contract.js +85 -0
- package/dist/lanes/meta.js +255 -0
- package/dist/lanes/model-contract.js +168 -0
- package/dist/lanes/model-coverage.js +20 -0
- package/dist/lanes/model.js +986 -0
- package/dist/lanes/online-js-contract.js +99 -0
- package/dist/lanes/online-js-coverage.js +28 -0
- package/dist/lanes/online-js.js +127 -0
- package/dist/lanes/report-contract.js +144 -0
- package/dist/lanes/report-coverage.js +21 -0
- package/dist/lanes/report.js +476 -0
- package/dist/lanes/rule-graph.js +1846 -0
- package/dist/lanes/rule-lifecycle-contract.js +92 -0
- package/dist/lanes/rule-lifecycle-coverage.js +20 -0
- package/dist/lanes/rule-lifecycle.js +176 -0
- package/dist/lanes/runtime-data-contract.js +264 -0
- package/dist/lanes/runtime-data-coverage.js +25 -0
- package/dist/lanes/runtime-data.js +1054 -0
- package/dist/lanes/workflow-contract.js +223 -0
- package/dist/lanes/workflow-coverage.js +40 -0
- package/dist/lanes/workflow.js +1813 -0
- package/dist/online-js-layout.js +58 -0
- package/dist/online-js-source.js +276 -0
- package/dist/package-tool.js +51 -0
- package/dist/package.js +73 -0
- package/dist/plan.js +73 -0
- package/dist/read.js +144 -0
- package/dist/redact.js +28 -0
- package/dist/rule-support.js +587 -0
- package/dist/runtime-support.js +134 -0
- package/dist/server.js +92 -0
- package/dist/session-manager.js +30 -0
- package/dist/session.js +149 -0
- package/dist/skills.js +112 -0
- package/dist/support.js +98 -0
- package/dist/tool-types.js +127 -0
- package/dist/tools.js +59 -0
- package/dist/usage-log.js +197 -0
- package/dist/wire.js +287 -0
- package/dist/workflow-support.js +99 -0
- package/dist/write-lease.js +26 -0
- package/dist/write-lock.js +109 -0
- package/dist/write.js +176 -0
- package/dist/zip.js +156 -0
- package/docs/tool-surface-map.md +42 -0
- package/package.json +71 -6
- package/skills/omc-acceptance-criteria.md +47 -0
- package/skills/omc-business-configuration.md +257 -0
- package/skills/omc-capabilities.md +197 -0
- package/skills/omc-capability-scouting.md +55 -0
- package/skills/omc-config-draft-review.md +171 -0
- package/skills/omc-five-piece-flow.md +35 -0
- package/skills/omc-glossary.md +86 -0
- package/skills/omc-refusals.md +110 -0
- package/skills/omc-requirement-analysis.md +161 -0
- package/skills/omc-requirement-vocabulary.md +51 -0
- package/skills/omc-start-here.md +82 -0
- package/skills/omc-tool-selection.md +119 -0
- package/skills/omc-write-hazards.md +87 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: omc-requirement-vocabulary
|
|
3
|
+
description: Chinese cue → OMC capability lookup. Disclosed reference for requirement-analysis steps 1–2.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Requirement Vocabulary (需求线索词表)
|
|
7
|
+
|
|
8
|
+
Reference for `omc-requirement-analysis.md` step 1. A flat peer-set: match each
|
|
9
|
+
Chinese cue in the requirement to the OMC capability it implies, then read that
|
|
10
|
+
capability's coverage/tools/boundaries from `omc-capabilities`.
|
|
11
|
+
|
|
12
|
+
## 结构面 — structure
|
|
13
|
+
|
|
14
|
+
| 中文线索 | Domain / Capability |
|
|
15
|
+
| --- | --- |
|
|
16
|
+
| 客户、联系人、供应商 | Customer |
|
|
17
|
+
| 项目、合同、金额 | Project |
|
|
18
|
+
| 产出、申报、月度、累计 | Output declaration / Cumulative amount |
|
|
19
|
+
| 模型、对象、表、主数据 | Model |
|
|
20
|
+
| 字段、属性、列 | Field |
|
|
21
|
+
| 文本、长文本、数字、日期、时间、人员、部门、地址、附件、字典、关联、公式 | Field family (text-extension / numeric-logical / date-time / people-department / address-attachment / dictionary-enum / relevance / formula EXPRESSION-only) |
|
|
22
|
+
| 表单、页面、布局、控件、必填、只读、显示 | Default form + form control binding |
|
|
23
|
+
| 列表、视图、查询、筛选列 | List view |
|
|
24
|
+
|
|
25
|
+
## 行为面 — behavior
|
|
26
|
+
|
|
27
|
+
| 中文线索 | Capability |
|
|
28
|
+
| --- | --- |
|
|
29
|
+
| 规则、自动、校验、触发、事件 | businessrule graph (B 平面) |
|
|
30
|
+
| create / update / delete 事件、按钮、定时任务 | Business-rule trigger |
|
|
31
|
+
| 通知、站内通知、站内信、消息、提醒、报警、告警、ANDON | Business-rule **MESSAGE** 动作节点(站内通知,配置能力,非二开) |
|
|
32
|
+
| 流程、审批、工作流、节点、待办 | Workflow template |
|
|
33
|
+
| 脚本、联动、前端行为、onLoad、onValidate、预览 | Online JS (form-level) |
|
|
34
|
+
|
|
35
|
+
## 集成面 — integration
|
|
36
|
+
|
|
37
|
+
| 中文线索 | Capability |
|
|
38
|
+
| --- | --- |
|
|
39
|
+
| 集成、接口、服务、回调、对接外部系统 | B2 业务集成服务 (`service.register`);二开接口 = 扩展模块写 REST 接口 + RESTFUL 服务指向它;自定义协议适配器 SPI 非常规、不在支持面 |
|
|
40
|
+
| 数据、提交、保存、删除、查记录 | M2 runtime data |
|
|
41
|
+
|
|
42
|
+
## 横切面 — landscape and boundaries
|
|
43
|
+
|
|
44
|
+
Coverage status and boundaries for every capability (including 权限/子表/聚合/
|
|
45
|
+
上线/内联/OCR) live in **`omc-capabilities`** — its 能力索引 table and
|
|
46
|
+
[边界] section are the authority; read the relevant section there rather than a
|
|
47
|
+
copy here. In particular, **跨模型/子表聚合、汇总、求和是配置能力**(表单「计算」
|
|
48
|
+
FORMULA),不要当二开。
|
|
49
|
+
|
|
50
|
+
Cue → capability is a starting point, never a substitute for 定面. A cue that
|
|
51
|
+
could name two faces is resolved by the 定面表 in the parent skill.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: omc-start-here
|
|
3
|
+
description: Onboarding router — use on first contact with the OMC CLI, or when unsure which methodology topic and command ladder a task needs. Maps a task to its topic sequence and the first commands to run.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Start Here (从这里开始)
|
|
7
|
+
|
|
8
|
+
Router for the `omc` CLI. Two jobs: the **first-contact command ladder**, and the
|
|
9
|
+
**task → topic map**. This package's `skills/` directory is the authoritative
|
|
10
|
+
shipped copy; a downstream distribution snapshot is only a mirror and must not
|
|
11
|
+
be treated as a second source. Read this, then follow the topics it names.
|
|
12
|
+
|
|
13
|
+
## 最小路径(先读这段就能开始)
|
|
14
|
+
|
|
15
|
+
1. `omc next "<目标>"`:先看返回的 `mode` 决定读/写与路径——
|
|
16
|
+
- `read`(读回/盘点/查询/检查)→ 只给**读工具**(`field.list`/`rule.get`/`workflow.get_draft`/`data.load`…),`write:false`;这是「读回现状、为下一步或写代码取证据」的入口,别回写工具。**读全一个模型用 `model.inspect <schemaCode>`(一次拿字段/表单/列表/规则/数据规则/流程摘要),别逐面 6 次调用**;`field.list` 默认只返业务字段(`all:true` 取全)。
|
|
17
|
+
- `whole-package`(做应用/系统、从零搭)→ 带 `intent` 块:写声明式意图文件,`omc intent validate/plan/apply/readback` 按依赖顺序合成原生结构,比逐能力拼装更省、更不易漂移;`intent: partial` 未覆盖的(应用/字典/集成/运行数据)再用 `call` 补。
|
|
18
|
+
- `build`/`modify` → 按阶梯内联的**写工具 + 必填参数**执行。
|
|
19
|
+
- `scout`(能不能/怎么写/是否支持)→ 先探边界(`omc-capability-scouting`),别直接写。若 `next` 返回 **`boundary`**(`match.kind:"boundary"`,如 `ocr-e-signature`/`release-prod`/`inline-coding`),说明需求**不在覆盖内**(`write:false`):如实报告、用 `omc capabilities` 核对,**不要**用相近能力伪造实现。
|
|
20
|
+
阶梯步骤已内联工具必填参数(`route.ladder[].tools`/`readTools`)与命中 recipe 的 `describe <tool> --example <id>`;据此直接执行——**不要再逐能力 `commands --lane`**,也不要先扫 `commands --json`/全部 `contract`/全部 `describe --full`。
|
|
21
|
+
方法论按 `route.readSections` 逐节读:对每条 `{topic, section}` 执行 `omc help <topic> --section "<section>"`(单节 0.4–3.4KB)。**不要 `omc help <topic>` 读整篇**(5–14KB,读一次就留在后续每一轮窗口)。
|
|
22
|
+
2. 写前只需读 `omc-config-draft-review`(人审门)与 `omc-five-piece-flow`(发现→草稿→权限→执行→回读);`omc-business-configuration` 按命中的能力分节读(见 `next` 的 `readSections`),不要整篇预取。
|
|
23
|
+
3. 环境名以 `omc doctor` 的「环境=」或 `.omc-env` 为准;工具不确定先用默认 `describe`/`--example`,只有单个工具缺形状才用 `--full`;`describe` 带 `exampleHint`/`recipeHint` 时优先 `--example`。
|
|
24
|
+
4. 只有工具不在 `next` 命中能力内、或要看 purpose/枚举时,才补一次 `commands --json --compact --lane <lane>`。非显然形状(规则图、流程模板、表单布局、RESTFUL)才单独 `describe --example`。
|
|
25
|
+
5. 键名按对象不同:模型 `schemaCode`、默认表单 `sheetCode`(可省略,默认 == 模型 code)、流程 `workflowCode`/`code`——报错会提示同义键;字段族名认不出会给「最接近的族」。
|
|
26
|
+
6. **写操作串行**:同一环境不要并发写;`write-lock-held` 是瞬态,等几秒重试一次即可。
|
|
27
|
+
7. **单个对象优先高阶编排工具**:模型+字段用 `configure_model`(一次含全部字段),表单用 `configure_form`,列表用 `listview.configure`(**默认视图已存在,省略 code 即配置它,不要 `listview.create`**)。原子工具留给单点修改。
|
|
28
|
+
8. 拿到 `detailArtifactId` 先 `artifact get <id> --summary` 看结构,再 `--keys/--jq` 取所需;`field.list`/`workflow.*` 默认面已给清单与节点摘要;`workflow.get_draft` 默认面已含 `edges`,改流程只需传 `activities`+`routes`。
|
|
29
|
+
9. 每个 section 读一次即可;同一 topic 不要反复读。
|
|
30
|
+
10. **复杂流程先预检角色**:读 `org.role.list`/`org.user.search`,用真实可解析对象;缺独立角色就报告阻塞,不伪造。主子表条件按规则行 `schemaCode` 回所属子模型验证。
|
|
31
|
+
11. **验收不只看回读**:配置后用 opt-in `npm run test:live`(`OMC_LIVE=1`),验设计器控件/条件 Set、门户字段/列表列/选项/流程;业务规则走 `data.save(workflowCode)`→`workitem.list`→`data.submit`→`data.load`。门户断言硬重载≥2次。
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
Run in a **clean project directory** (not the OMC dev repo). Start from the goal:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
omc next "<目标>" # goal → ordered route (offline)
|
|
38
|
+
omc doctor # environment name and readiness
|
|
39
|
+
omc call discover_environment --env <env> --args '{}'
|
|
40
|
+
omc capability <selected-id> # only the selected capability
|
|
41
|
+
omc describe <tool> --example <recipe-id> # recipe first; default describe otherwise
|
|
42
|
+
omc help <topic> --section "<heading>" # one methodology section, not all
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Discovery precedes every write. 预算档位见 `omc-tool-selection` 的「Discovery 成本档位」;裸 `omc commands` 是有界索引,全量目录须显式 `commands --json`。
|
|
46
|
+
|
|
47
|
+
Fallback faces: `omc capabilities`, `omc capability <id-or-alias> --executable`, `omc commands --json --compact`, `omc contract <lane>`, `omc describe <tool>`.
|
|
48
|
+
|
|
49
|
+
## 1. Task → topic map
|
|
50
|
+
|
|
51
|
+
| Your task | Read, in order |
|
|
52
|
+
| --- | --- |
|
|
53
|
+
| "能不能做 X" / 某能力覆盖什么 | `omc-capabilities`(能力总表;判"是否二开"前先自证) |
|
|
54
|
+
| Fuzzy Chinese requirement, unknown scope | `omc-requirement-analysis` → `omc-requirement-vocabulary` |
|
|
55
|
+
| Configure a business model end to end | `omc-config-draft-review` → `omc-business-configuration` → `omc-write-hazards` |
|
|
56
|
+
| Unsure which tool / atom vs orchestration | `omc-tool-selection` |
|
|
57
|
+
| About to write anything | `omc-config-draft-review` (human gate) → `omc-five-piece-flow` |
|
|
58
|
+
| A write was refused / a status looks wrong | `omc-refusals` |
|
|
59
|
+
| Cover a face the manifest doesn't have yet | `omc-capability-scouting` |
|
|
60
|
+
| Decide whether the work is accepted | `omc-acceptance-criteria` |
|
|
61
|
+
| A term is unclear | `omc-glossary` |
|
|
62
|
+
|
|
63
|
+
The core loop behind all of them: **discover → draft → permission check →
|
|
64
|
+
execute → readback/cleanup** (`omc-five-piece-flow`).
|
|
65
|
+
|
|
66
|
+
## 2. The two gates every write passes
|
|
67
|
+
|
|
68
|
+
1. **Human gate (conversational)** — `omc-config-draft-review`: present the
|
|
69
|
+
change package in plain language and get explicit approval.
|
|
70
|
+
2. **Machine gate (environment)** — the profile's `writable` permission; a
|
|
71
|
+
production environment additionally requires `confirmProduction:true` per
|
|
72
|
+
write.
|
|
73
|
+
|
|
74
|
+
There is no approval token, no `--yes`, and no self-approval switch. If a call
|
|
75
|
+
refuses, work out which gate or boundary produced it from `omc-refusals`.
|
|
76
|
+
|
|
77
|
+
## 3. Boundaries
|
|
78
|
+
|
|
79
|
+
Out-of-coverage, blocked, or unsupported faces refuse with a manifest citation —
|
|
80
|
+
that refusal is the answer, not an obstacle to route around with another tool.
|
|
81
|
+
Non-8.6 (or missing version evidence) fails writes closed. `uncertain` is never
|
|
82
|
+
`ok`.
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: omc-tool-selection
|
|
3
|
+
description: Choose the right OMC CLI tool for a goal. Use when unsure whether a task needs a high-level orchestration or a low-level atom.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Which Tool When (何时用哪个工具)
|
|
7
|
+
|
|
8
|
+
## Discovery 成本档位(按量级选,别一上来就点大档)
|
|
9
|
+
|
|
10
|
+
实测:一条重难业务里,agent 对**发现面**的重复读占了任务上下文的大头。先走小档,缺形状再逐级放大。
|
|
11
|
+
(round14 已把各面瘦身,下表为当前实测。)
|
|
12
|
+
|
|
13
|
+
| Face | ~size | 用途 |
|
|
14
|
+
| --- | ---: | --- |
|
|
15
|
+
| `omc next "<goal>"` | 2–5 KB | 目标→路线(首选) |
|
|
16
|
+
| `omc commands --json --compact --lane <lane>` | ~1 KB | 单能力工具行(最省的枚举面) |
|
|
17
|
+
| `omc describe <tool>` / `--example <id>` | 1.5–2.5 KB | 单工具形状 |
|
|
18
|
+
| `omc commands` | ~8 KB | 有界索引(name/lane/kind) |
|
|
19
|
+
| `omc commands --json --compact` | ~13 KB | 全量紧凑行 |
|
|
20
|
+
| `omc capabilities` | ~6 KB | 14 能力总览;`next` 已给路线时可省 |
|
|
21
|
+
| `omc commands --json` | ~20 KB | 全量目录(回退面,尽量避免) |
|
|
22
|
+
| `omc describe <tool> --full` | 7–19 KB | 仅当 schema 需要;不再重发 recipes(用 `--example` 取可运行参数) |
|
|
23
|
+
|
|
24
|
+
裸 `omc commands` 只是索引;**全量目录必须显式 `--json`**。同一 face 不要反复读。
|
|
25
|
+
|
|
26
|
+
## Minimal-path cheat sheet(最小路径速查)
|
|
27
|
+
|
|
28
|
+
一条需求先问"它属于哪一类",直接走对应的最小调用,别一上来铺工具:
|
|
29
|
+
|
|
30
|
+
| 你要做的事 | 一次调用(最小路径) |
|
|
31
|
+
| --- | --- |
|
|
32
|
+
| 读全**一个模型**的配置(字段/表单/列表/规则/数据规则/流程摘要) | `omc call model.inspect --args '{"schemaCode":"<m>"}'`(`all:true` 含系统字段) |
|
|
33
|
+
| **列模型** | `omc call model.list --args '{"filter":"<词>"}'` |
|
|
34
|
+
| 读**某条业务规则**的图 | `omc call rule.get --args '{"schemaCode":"<m>","ruleCode":"Create"}'`(不必先 list 取 id) |
|
|
35
|
+
| 读某模型的**流程**(只知模型码) | `omc call workflow.get_draft --args '{"schemaCode":"<m>"}'` |
|
|
36
|
+
| **改规则一个节点/分支阈值** | `omc call rule.node.update --args '{"schemaCode":"<m>","ruleCode":"Create","nodeCode":"Branch_1","patch":{...}}'`(改完 `rule.enable` 生效) |
|
|
37
|
+
| 从零**建一个流程**并发布 | `omc call configure_workflow --args '{"schemaCode":"<m>","name":"…","code":"<wf>","template":{...}}'` |
|
|
38
|
+
| **建模型+字段+表单+列表** | `omc call configure_model --args '{"name":"…","code":"<m>","fields":[...],"publishForm":true,"listview":{"fieldCodes":[...]}}'` |
|
|
39
|
+
| publish 流程前**只读预检** | `omc call workflow.validate --args '{"schemaCode":"<m>"}'` |
|
|
40
|
+
| **批量停用**某模型规则 | `omc call rule.disableMany --args '{"schemaCode":"<m>"}'`(默认含预置行;`customOnly:true` 只停自定义) |
|
|
41
|
+
| 字段清单(去噪) | `omc call field.list --args '{"schemaCode":"<m>","published":true}'`(默认业务字段,`all:true` 取全) |
|
|
42
|
+
|
|
43
|
+
**业务键优先**:`rule.get`/`datarule.update`/`datarule.delete`/`workflow.get_*` 接受业务键
|
|
44
|
+
(schemaCode+ruleCode / schemaCode+propertyCode / schemaCode),免去先 list 取 id。
|
|
45
|
+
|
|
46
|
+
**先看 `omc next` 的 `mode`**:`read` 只给读工具;`whole-package` 给 intent 声明式指引;
|
|
47
|
+
`build`/`modify` 给写工具;`scout`(能不能/怎么写)先探边界。
|
|
48
|
+
|
|
49
|
+
**纯读不必先发现**:已知读哪一面就直接 `omc call <读工具>`(上表),省掉 `next`/`discover_environment`;只有选不出工具时才用 `next`。发现仪式(`next`/`capabilities`/`discover_environment`)是写前与选不出工具时的路径。
|
|
50
|
+
|
|
51
|
+
## High layer — orchestrated CLI calls
|
|
52
|
+
|
|
53
|
+
| Goal | Tool |
|
|
54
|
+
| --- | --- |
|
|
55
|
+
| Inspect environment health | `get_status` |
|
|
56
|
+
| Full first look | `discover_environment` |
|
|
57
|
+
| New model to usable state (model → field → field.publish → form.draft → form.publish) | `configure_model`(+ `listview` 参数到列表) |
|
|
58
|
+
| Bind fields into the default form and publish | `configure_form` |
|
|
59
|
+
| Business rule saved and enabled | `configure_rule` |
|
|
60
|
+
| New workflow: create → update → publish (+ bind rules) | `configure_workflow` |
|
|
61
|
+
| Health chain (config → credential → login → version family → fingerprint) | `doctor` |
|
|
62
|
+
| Configure in-session with the human | `setup.start` → `setup.commit` |
|
|
63
|
+
|
|
64
|
+
## Low layer — atoms for fine control
|
|
65
|
+
|
|
66
|
+
Reads: `environment.fingerprint`, `field.list`, `form.get`, `rule.list`,
|
|
67
|
+
`data.list`, `data.load`, `service.get`, `app.list`, `coverage.manifest`,
|
|
68
|
+
`workflow.get_draft`, `workflow.get_published`.
|
|
69
|
+
|
|
70
|
+
Writes:
|
|
71
|
+
|
|
72
|
+
- Model: `model.create`, `model.delete`
|
|
73
|
+
- Applications: `app.create`, `app.delete` (deleting cascades its models)
|
|
74
|
+
- Fields: `field.create`, `field.update`, `field.publish`, `field.delete`
|
|
75
|
+
- Forms: `form.draft`, `form.publish`
|
|
76
|
+
- Rules: `rule.save`, `rule.enable`, `rule.disable`, `rule.delete`
|
|
77
|
+
- Workflow templates: `workflow.create`, `workflow.update`, `workflow.publish`, `workflow.bindRule`, `workflow.delete`
|
|
78
|
+
- Online JS: 本 CLI 只**发布/回读**(`onlinejs.compose`,平台模板保真);脚本**编写**不在 CLI 范围——遵循当前项目自带的在线 JS 编写规范(若有),否则向用户/设计者索取已定稿 `source`。后端的在线开发(Java 源码)用二开扩展包,也不在本 CLI 范围
|
|
79
|
+
- M2 data: `data.save`, `data.submit`, `data.delete`
|
|
80
|
+
- B2 services: `service.register`, `service.delete`
|
|
81
|
+
- List views: `listview.create`, `listview.configure`, `listview.delete`
|
|
82
|
+
|
|
83
|
+
## Decision rules
|
|
84
|
+
|
|
85
|
+
1. Default to the high layer; drop to atoms only to compose what the orchestration doesn't cover.
|
|
86
|
+
2. Preview any write with `dryRun:true`; it returns the plan and executes nothing.
|
|
87
|
+
3. `writable:false` refuses before any wire. A production write additionally requires `confirmProduction:true`.
|
|
88
|
+
4. Out-of-coverage desire (permissions, nested child tables, OCR, app publish)? The refusal cites the manifest entry — that is the answer. Check `coverage.manifest`.
|
|
89
|
+
5. If any call returns `uncertain`, stop writing and re-run discovery before the next write.
|
|
90
|
+
|
|
91
|
+
## Key-name table (同一对象在不同工具里的键名)
|
|
92
|
+
|
|
93
|
+
The same object is addressed under different keys. A wrong key is dropped silently
|
|
94
|
+
by the Tool-input gate and then reported only as `X: Required` — it never says
|
|
95
|
+
"the field you sent was ignored". Check here first.
|
|
96
|
+
|
|
97
|
+
| Object | Tools | Key |
|
|
98
|
+
| --- | --- | --- |
|
|
99
|
+
| Model | `model.*`, `field.*`, `form.*`, `datarule.*`, `rule.*` | `schemaCode` |
|
|
100
|
+
| Workflow template | `workflow.get_draft`, `workflow.get_published`, `workflow.bindRule` | `workflowCode`(或 `schemaCode`,工具内部解析) |
|
|
101
|
+
| Workflow template | `workflow.create`, `workflow.update`, `workflow.publish`, `workflow.delete` | `code`(+ `schemaCode`) |
|
|
102
|
+
| Default form | `form.get`, `form.draft`, `form.publish`, `configure_form` | `schemaCode`(必填)+ `sheetCode`(可选,默认=schemaCode) |
|
|
103
|
+
| Field | `field.create`, `field.update`, `field.delete` | `code` |
|
|
104
|
+
|
|
105
|
+
**业务键优先(identity seam)**:多个只读/改写工具现在接受业务键,免去先 list 取 id:
|
|
106
|
+
|
|
107
|
+
- `rule.get` 接受 `schemaCode + ruleCode`(返回**当前生效行**,不用先 `rule.list` 拿 id)。
|
|
108
|
+
- `datarule.update` / `datarule.delete` 接受 `schemaCode + propertyCode(+dataRuleType)`(同一字段多条规则时必须带 `dataRuleType` 去歧义)。
|
|
109
|
+
- `workflow.get_draft` / `workflow.get_published` 接受 `schemaCode`(不是每个模型都有流程;没有则 `exists:false`)。
|
|
110
|
+
|
|
111
|
+
**按工具别名(同一对象换个键名也收)**:`workflow.create/update/publish/delete` 的 `code`
|
|
112
|
+
也接受 `workflowCode`;`field.create/update/delete` 的 `code` 也接受 `propertyCode`。
|
|
113
|
+
别名只在规范键缺失时补入,不会覆盖;它**按工具声明**(不是全局),因为同一个 `code`
|
|
114
|
+
在不同工具里可能指不同对象。
|
|
115
|
+
|
|
116
|
+
精确 `id` 仍然可用,旧调用不受影响。`workflowCode` 与 `code` 指同一流程:读/绑定工具用
|
|
117
|
+
`workflowCode`,写工具用 `code`(写工具现已同时接受 `workflowCode`);读工具现在也可直接给 `schemaCode`。
|
|
118
|
+
|
|
119
|
+
Fixture discipline: one-shot `omc_mcp_*` fixtures, cleaned up in reverse order, zero residue.
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: omc-write-hazards
|
|
3
|
+
description: 分发版 CLI 的底层写面安全形状。配置表单、视图、按钮、子表、关联、规则或在线 JS 时使用;CLI dry-lint 是主防线,浏览器不是常规验收步骤。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# CLI 写面安全形状
|
|
7
|
+
|
|
8
|
+
本技能随 `omc-cli` 包分发,可用:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
omc help omc-write-hazards
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
优先依赖 CLI 的 schema、contract、dry-lint、writable/生产确认和权威读回。浏览器只在用户报告明确的 UI 回归时使用。
|
|
15
|
+
|
|
16
|
+
## 表单与 Sheet201
|
|
17
|
+
|
|
18
|
+
- 控件 `options` 必须是 **object**,不能是 JSON 字符串。8.6.34 渲染器会写 `options.name_i18n`;字符串会抛 `Cannot create property 'name_i18n' on string` 并白屏。
|
|
19
|
+
- 子表父控件是 `type: 201`,业务子列放 `columns`;子列 key 不得进入 `viewJson`。
|
|
20
|
+
- 调用方显式传 `draftAttributesJson`/`draftViewJson` 时,CLI 会在写前拒绝字符串 options、非字符串 viewJson 单元、子列混入 viewJson。
|
|
21
|
+
- `form.draft rebuild:true` 会重建布局,但会保留已存在的非结构性控件 options;Sheet201 columns 以最新 subSchema 为准。
|
|
22
|
+
- 空布局 `[]`/`{}` 默认拒绝;只有显式 `allowEmptyLayout:true` 才能清空。
|
|
23
|
+
|
|
24
|
+
## 模型字段与关联
|
|
25
|
+
|
|
26
|
+
- **code 定位写前先核在册**:`field.update` / `rule.node.update` 等按 code 定位的精确写,先 `model.inspect` / `field.list` 确认 code 在册;缺码即停并报"目标不存在 + 当前字段清单"——**别凭用户措辞假定 code 正确**(用户可能记错字段名),**也别擅自替换成语义相近的字段**(改错对象比不改更糟)。缺码 `field.update` 本就拒 301001,但写前先核能省一轮失败往返,并在草稿阶段就把"字段不存在"与"需求理解偏差"分清。
|
|
27
|
+
- **改名核对以字段读为准**:`field.update` 改名后,`model.inspect` 聚合面的 `fields[].name` 可能仍是旧值(发布态快照/聚合缓存);核对显示名、options 一律用 `field.list` / `field.get` 或 `form.publish` 回读——两处读数不一致时以字段读为准,别误判"写入没生效"而重复写。
|
|
28
|
+
- `propertyEmpty` 默认 `false`。模型层保持可空;必填、只读、可见性在表单和流程节点配置。
|
|
29
|
+
- 无映射关联单选 `WORK_SHEET` 使用 `mappings: ""`,不要用 `"[]"`。`"[]"` 是非空字符串,设计器会显示“已设置”,但弹窗没有映射行。
|
|
30
|
+
- 有映射时传非空 JSON 数组字符串,并在 draft/published 两面读回。
|
|
31
|
+
- **运行时写关联值是另一种形状**(`data.save`/`data.update` 的 formData):单选关联(`propertyType 9`)传 **id 字符串或 `{ id }`**,传**数组会稳定 50000**;多选关联(11)才用数组;**人员/组织(50/51/60/61)传 `[{"id","type","name"}]`,`type` 必填**(缺它稳定 50000)——`type` 是 UnitType 索引:**用户=3、部门=1**。用错形状只会拿到一个不透明的 50000。
|
|
32
|
+
- **`mappings` 由表单运行时在用户选择时套用**,服务端 `data.save` **不会**自动回填映射目标字段。API 侧要自己写被映射字段,否则读回为空——别把它误判成“映射配置失败”。
|
|
33
|
+
- **运行时写值的最小形状**(组合出错只会得到一个不透明的 `50000`/NPE,逐一最小化再合):单选关联(9) → id 字符串 `"<id>"`;**人员/组织(50/51/60/61) → `[{"id":"<id>","type":3,"name":"<名>"}]`,`type` 必填且为整数**(缺/非整数 → `BizField.parseFromClient` 拆箱 NPE→50000;用户=3、部门=1);日期(3) → 字符串 `"2026-09-30 10:00:00"`;子表(8) → 行对象数组 `[{"<子列code>":<值>, ...}]`。先各写一条最小行通过,再组合。
|
|
34
|
+
- **DATE(3) 字段的 `options.format` 必须是平台大写枚举**(`YYYY-MM-DD`、`YYYY-MM-DD HH:mm:ss`、`YYYY年MM月DD日`…),**不是 Java 的 `yyyy-MM-dd`**:平台 `DateBizField` 按字面比较,Java 写法能创建字段但**首次运行时 save 稳定 `50000`(`不支持的format`)**(2026-09-30 R5 实测)。`field.create`/`intent` 会就地拒绝非枚举值。
|
|
35
|
+
|
|
36
|
+
## 视图
|
|
37
|
+
|
|
38
|
+
- `conditions[].visible` 未传时 CLI 默认 `true`;只有需求明确隐藏时传 `false`。
|
|
39
|
+
- `fieldCodes` 不要加入系统字段。平台可能在最终查询面保留默认系统列,那不是 agent 配置的业务列。
|
|
40
|
+
- 新模型先配列表视图再依赖 `data.list`。部分 8.6.26 读面在没有 query/view 配置时会把业务列投影为 null;单行核对可用 `data.load`。
|
|
41
|
+
- **默认列表视图不能单独 `listview.delete`**(平台回 `303025 列表是默认列表`);要清掉它就删模型(`model.delete` 级联)。清理时别把它当失败。
|
|
42
|
+
|
|
43
|
+
## 按钮
|
|
44
|
+
|
|
45
|
+
- 列表按钮用 `listview.configure` 的 `buttons`(传 `code`/`name`/`useLocation`/`bindAction`/`targetModel`/`targetForm`…);**不要因为没找到就叫「CLI 无列表按钮能力」**(dogfood 实测该误判会假阻塞整条需求)。配完 `listview.get --full` 回读 `customButtons`。
|
|
46
|
+
- `BUSINESS_RULE` 按钮需要 target rule 和 actionConfig 对象。
|
|
47
|
+
- `FLOW`/`FORM`/`ADD_DATA` 的 actionConfig 必须有 `configureList: []`;FLOW 还需要 `WorkflowListData[0].workflowCode` 与 `schemaCodeVal`。CLI 只给 FLOW 的 targetCode 时会自动展开。
|
|
48
|
+
- `WITH_VIEW` 是打开表单;`WITH_OUT_VIEW` 才是直接执行。行级按钮要用 `useLocation: ROW` 才能拿到当前行上下文。
|
|
49
|
+
|
|
50
|
+
## 子表
|
|
51
|
+
|
|
52
|
+
- 一个主表可以有多个 `CHILD_TABLE`,子表不能嵌套 `CHILD_TABLE`。
|
|
53
|
+
- 子列是子表字段 code 对应 schema 上的普通字段:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
omc call field.create --env local --args '{"schemaCode":"expense_items","code":"item_note","name":"明细备注","propertyType":"LONG_TEXT"}'
|
|
57
|
+
omc call field.update --env local --args '{"schemaCode":"expense_items","code":"item_note","name":"备注"}'
|
|
58
|
+
omc call field.delete --env local --args '{"schemaCode":"expense_items","code":"item_note"}'
|
|
59
|
+
omc call field.publish --env local --args '{"schemaCode":"expense"}'
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
父 `CHILD_TABLE` 行不接受 `options/choices/subFields` 更新;子列直接走上面的 CRUD 面。
|
|
63
|
+
|
|
64
|
+
## 规则与业务集成
|
|
65
|
+
|
|
66
|
+
- 规则节点缺 `nodeName` 时 CLI 按平台 `RuleNodeType` 补默认名并给 warning;业务节点优先显式命名。
|
|
67
|
+
- BIZ_ACTION 先 `service.get` 读取现存方法参数面,再写 methodMapping。PROPERTY 输入使用 `codeType: 1`、`bizCode` 为业务字段 code、`propertyName` 为显示名、`serviceMethodParameterCode` 命中方法参数。
|
|
68
|
+
- **`codeType:1` 映射的 `bizCode` 必须是该模型上**已创建且已发布**的字段 code**:指向不存在/未发布的字段时,平台 publish 只回一个**无明细的 `550018 保存规则失败,规则存在异常`**(真因只经设计器「检测」/`POST /api/app/businessrule/node_run_map → notExistPropertyObjectList` 可见)。`rule.save` 现已本地前置校验并拒绝(`rule-graph-bizaction-mapping-field-missing`);改字段族类型也要同步映射。
|
|
69
|
+
- **把 BIZ_ACTION 挂到预置数据事件规则(`Create`/`Update`)上时**:映射的 `bizCode` 数据项必须真实存在于该模型,否则发布被拒 `550010 业务规则使用的数据项不存在`(典型:REST 短文本入参要映射一个关联字段——先在模型加一个短文本「快照」字段承接,再映射它)。若预置规则仍不接受,改挂**自定义按钮触发规则**(`customTrigger:true`)或 `Update` 规则,更稳;不要因此判定“平台不支持 BIZ_ACTION”。
|
|
70
|
+
- **BIZ_ACTION 的 `outputMappings` 按“响应 JSON 根级路径”取值**(源码 `MapOps.toMapByBizServiceJson`/`convertJsonObject`:keyMap 以 `serviceMethodParameterCode` 为键,与响应体**根级**各键匹配)。所以 `serviceMethodParameterCode` 必须等于 REST 响应**根级**的键名:
|
|
71
|
+
- **扩展接口若返回信封 `ResponseResult{errcode,data:{x}}`,平铺出参 `x` 在根级找不到 → 静默空回写**(真机 2026-10-01 实证:`h_log_biz_service` 显示 invoke SUCCESS、`data.amount:300`,目标字段仍空)。**正解:扩展接口在根级返回业务负载**(`GET` handler 直接 `return Map.of("amount", n)`,不分信封),出参 code=根键 `amount`。
|
|
72
|
+
- 也**不要**试图用输出参数的 `subParameters` 下沉取值:实测把出参声明为父 `data`+`subParameters[value]` 会把整个 `{value:99}` 子对象赋给标量字段,触发 `数据项【x】的值是未知的类型:com.alibaba.JSONObject`(50000)。嵌套出参结构只用于 OBJECT/子表类的整体赋值,不能用来“取 `data.x` 这个标量”。
|
|
73
|
+
- 对照:平台自带 `skb_risk_service` 出参平铺 `riskLevel` ↔ 响应根级键;真机三态验证:平铺根级→回写 42 ✓;信封+平铺出参→不回写 ✗;信封+嵌套出参→50000 ✗。
|
|
74
|
+
- `method.test` 的 `externalSuccess:true` **不代表**回写成功——回写要另看目标字段实际值(`data.submit` 读回)。
|
|
75
|
+
- 流程结束新增目标表单必须运行验证;配置发布不等于映射成功。检查目标记录的每个字段。
|
|
76
|
+
- **`model.delete` 不物理清理 `h_business_rule`**:预置规则(Create/Update/GetList/Load/Delete/Available/Cancel)与历史版本行会残留在规则表(`rule.list` 对已删 schema 也读不到,属物理孤儿)。平台写面没有“按 schema 物理清规则”的手段;验收“零残留”以**可见面**为准(`model.list`/`rule.list`/`service.get`/列表/按钮),物理行需 DB 侧清理。清理顺序让规则先于模型删能减少、但不消除预置规则行。
|
|
77
|
+
|
|
78
|
+
## 在线 JS
|
|
79
|
+
|
|
80
|
+
- **本 CLI 只负责发布,不负责写 JS**。脚本内容的创作与增量合并不在本 CLI:若当前项目自带在线 JS 编写规范(例如其 `.cpdocs`/技能或项目文档),遵循它;否则向用户/设计者索取已定稿 `source`。不要在 omc 技能里手写/臆造 JS 逻辑。
|
|
81
|
+
- 经 omc 发布时用 `onlinejs.compose`:把已定稿的 `source` 组合进平台 skeleton 的 `customScript`,再 `publish`,并回读 `publishedHtmlJson` + SHA-256。不要用裸脚本覆盖平台 skeleton。
|
|
82
|
+
- **`replace:true` 对裸代码被拒是设计**:`replace` 必须传完整的 `(function(form){…})`,否则会写坏脚本槽让表单空白;同样,`merge` 传完整带外层的脚本也会被拒(避免嵌套丢内容)。远端 `customScript` 为空时,定稿脚本带外层 + `replace:true` 即可,不要把它当成缺陷。
|
|
83
|
+
- 源码不能有 import/export,事件名必须在支持集合内;compose 后读回 draft/published HTML,浏览器不是默认步骤。
|
|
84
|
+
|
|
85
|
+
## 固定验收顺序
|
|
86
|
+
|
|
87
|
+
执行阶段以 `omc-five-piece-flow` 为准;写面安全只额外强调两点:写前先 `commands/describe/contract` + dry-run 静态校验,写后权威 readback,必要时再用 CLI 触发运行验证。
|