@stalfh233/omc-cli 0.0.0-stage → 0.4.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +293 -3
  3. package/coverage/m1-coverage-manifest-v1.json +1278 -0
  4. package/dist/approval-token.js +102 -0
  5. package/dist/args.js +25 -0
  6. package/dist/artifacts.js +119 -0
  7. package/dist/bench/call-face-eval.js +256 -0
  8. package/dist/bench/context-attribution.js +151 -0
  9. package/dist/bench/discovery-cost-eval.js +230 -0
  10. package/dist/bench/driver.js +81 -0
  11. package/dist/bench/evals.js +236 -0
  12. package/dist/bench/fake-http-server.js +65 -0
  13. package/dist/bench/instrument.js +87 -0
  14. package/dist/bench/intent-face-eval.js +343 -0
  15. package/dist/bench/run.js +166 -0
  16. package/dist/bench/scenario.js +343 -0
  17. package/dist/bench/types.js +76 -0
  18. package/dist/bi-wire.js +41 -0
  19. package/dist/bizservice-config.js +581 -0
  20. package/dist/call.js +153 -0
  21. package/dist/capability-absences.js +23 -0
  22. package/dist/capability-overview.js +492 -0
  23. package/dist/capability-shape.js +154 -0
  24. package/dist/cli-contract.js +70 -0
  25. package/dist/cli-output.js +73 -0
  26. package/dist/cli.js +1418 -0
  27. package/dist/code-rules.js +69 -0
  28. package/dist/command-transport.js +155 -0
  29. package/dist/config-store.js +195 -0
  30. package/dist/context.js +21 -0
  31. package/dist/contract-consistency.js +66 -0
  32. package/dist/contract-resources.js +62 -0
  33. package/dist/coverage-consistency.js +62 -0
  34. package/dist/coverage-registry.js +76 -0
  35. package/dist/coverage.js +130 -0
  36. package/dist/data-list-filter.js +114 -0
  37. package/dist/discovery.js +390 -0
  38. package/dist/endpoints.js +154 -0
  39. package/dist/environment-policy.js +26 -0
  40. package/dist/execution-metadata.js +1092 -0
  41. package/dist/fake/app.js +45 -0
  42. package/dist/fake/b2-registration.js +594 -0
  43. package/dist/fake/businessrule.js +242 -0
  44. package/dist/fake/datarule.js +72 -0
  45. package/dist/fake/dictionary.js +108 -0
  46. package/dist/fake/environment.js +30 -0
  47. package/dist/fake/field.js +167 -0
  48. package/dist/fake/form.js +101 -0
  49. package/dist/fake/index.js +121 -0
  50. package/dist/fake/list-view.js +289 -0
  51. package/dist/fake/model.js +136 -0
  52. package/dist/fake/online-js.js +18 -0
  53. package/dist/fake/report.js +253 -0
  54. package/dist/fake/routes.js +47 -0
  55. package/dist/fake/rule-lifecycle.js +37 -0
  56. package/dist/fake/runtime-data.js +367 -0
  57. package/dist/fake/state.js +67 -0
  58. package/dist/fake/workflow.js +364 -0
  59. package/dist/field-change.js +200 -0
  60. package/dist/field-families.js +896 -0
  61. package/dist/form-layout.js +111 -0
  62. package/dist/form-support.js +821 -0
  63. package/dist/goal-routes.js +468 -0
  64. package/dist/governed-execution.js +87 -0
  65. package/dist/human-summary.js +212 -0
  66. package/dist/identity.js +62 -0
  67. package/dist/intent/baseline.js +57 -0
  68. package/dist/intent/capabilities/bizservice.js +274 -0
  69. package/dist/intent/capabilities/businessrule.js +493 -0
  70. package/dist/intent/capabilities/datarule.js +187 -0
  71. package/dist/intent/capabilities/field.js +545 -0
  72. package/dist/intent/capabilities/form.js +136 -0
  73. package/dist/intent/capabilities/index.js +64 -0
  74. package/dist/intent/capabilities/listview.js +157 -0
  75. package/dist/intent/capabilities/model.js +100 -0
  76. package/dist/intent/capabilities/onlinejs.js +108 -0
  77. package/dist/intent/capabilities/report.js +355 -0
  78. package/dist/intent/capabilities/workflow.js +458 -0
  79. package/dist/intent/capability.js +6 -0
  80. package/dist/intent/cli.js +91 -0
  81. package/dist/intent/compare.js +56 -0
  82. package/dist/intent/compiler.js +79 -0
  83. package/dist/intent/dsl.js +129 -0
  84. package/dist/intent/plan-file.js +63 -0
  85. package/dist/intent/readback.js +65 -0
  86. package/dist/intent/schema.js +158 -0
  87. package/dist/intent/validation.js +30 -0
  88. package/dist/intent/yaml.js +315 -0
  89. package/dist/json-column.js +68 -0
  90. package/dist/lanes/app-contract.js +95 -0
  91. package/dist/lanes/app-coverage.js +16 -0
  92. package/dist/lanes/app.js +174 -0
  93. package/dist/lanes/apply-changes.js +231 -0
  94. package/dist/lanes/b2-registration-contract.js +292 -0
  95. package/dist/lanes/b2-registration-coverage.js +48 -0
  96. package/dist/lanes/b2-registration.js +1187 -0
  97. package/dist/lanes/businessrule-contract.js +232 -0
  98. package/dist/lanes/businessrule-coverage.js +16 -0
  99. package/dist/lanes/businessrule.js +221 -0
  100. package/dist/lanes/contract-support.js +65 -0
  101. package/dist/lanes/coverage-declaration.js +9 -0
  102. package/dist/lanes/datarule-contract.js +155 -0
  103. package/dist/lanes/datarule-coverage.js +19 -0
  104. package/dist/lanes/datarule-protocol.js +308 -0
  105. package/dist/lanes/datarule.js +818 -0
  106. package/dist/lanes/dictionary-contract.js +78 -0
  107. package/dist/lanes/dictionary-coverage.js +24 -0
  108. package/dist/lanes/dictionary.js +235 -0
  109. package/dist/lanes/environment-contract.js +70 -0
  110. package/dist/lanes/environment-coverage.js +14 -0
  111. package/dist/lanes/environment.js +163 -0
  112. package/dist/lanes/field-contract.js +223 -0
  113. package/dist/lanes/field-coverage.js +27 -0
  114. package/dist/lanes/field.js +374 -0
  115. package/dist/lanes/form-contract.js +97 -0
  116. package/dist/lanes/form-coverage.js +16 -0
  117. package/dist/lanes/form.js +185 -0
  118. package/dist/lanes/lane-ids.js +34 -0
  119. package/dist/lanes/list-view-contract.js +175 -0
  120. package/dist/lanes/list-view-coverage.js +20 -0
  121. package/dist/lanes/list-view-shapes.js +1207 -0
  122. package/dist/lanes/list-view.js +578 -0
  123. package/dist/lanes/meta-contract.js +85 -0
  124. package/dist/lanes/meta.js +255 -0
  125. package/dist/lanes/model-contract.js +168 -0
  126. package/dist/lanes/model-coverage.js +20 -0
  127. package/dist/lanes/model.js +986 -0
  128. package/dist/lanes/online-js-contract.js +99 -0
  129. package/dist/lanes/online-js-coverage.js +28 -0
  130. package/dist/lanes/online-js.js +127 -0
  131. package/dist/lanes/report-contract.js +144 -0
  132. package/dist/lanes/report-coverage.js +21 -0
  133. package/dist/lanes/report.js +476 -0
  134. package/dist/lanes/rule-graph.js +1846 -0
  135. package/dist/lanes/rule-lifecycle-contract.js +92 -0
  136. package/dist/lanes/rule-lifecycle-coverage.js +20 -0
  137. package/dist/lanes/rule-lifecycle.js +176 -0
  138. package/dist/lanes/runtime-data-contract.js +264 -0
  139. package/dist/lanes/runtime-data-coverage.js +25 -0
  140. package/dist/lanes/runtime-data.js +1054 -0
  141. package/dist/lanes/workflow-contract.js +223 -0
  142. package/dist/lanes/workflow-coverage.js +40 -0
  143. package/dist/lanes/workflow.js +1813 -0
  144. package/dist/online-js-layout.js +58 -0
  145. package/dist/online-js-source.js +276 -0
  146. package/dist/package-tool.js +51 -0
  147. package/dist/package.js +73 -0
  148. package/dist/plan.js +73 -0
  149. package/dist/read.js +144 -0
  150. package/dist/redact.js +28 -0
  151. package/dist/rule-support.js +587 -0
  152. package/dist/runtime-support.js +134 -0
  153. package/dist/server.js +92 -0
  154. package/dist/session-manager.js +30 -0
  155. package/dist/session.js +149 -0
  156. package/dist/skills.js +112 -0
  157. package/dist/support.js +98 -0
  158. package/dist/tool-types.js +127 -0
  159. package/dist/tools.js +59 -0
  160. package/dist/usage-log.js +197 -0
  161. package/dist/wire.js +287 -0
  162. package/dist/workflow-support.js +99 -0
  163. package/dist/write-lease.js +26 -0
  164. package/dist/write-lock.js +109 -0
  165. package/dist/write.js +176 -0
  166. package/dist/zip.js +156 -0
  167. package/docs/tool-surface-map.md +42 -0
  168. package/package.json +71 -6
  169. package/skills/omc-acceptance-criteria.md +47 -0
  170. package/skills/omc-business-configuration.md +257 -0
  171. package/skills/omc-capabilities.md +197 -0
  172. package/skills/omc-capability-scouting.md +55 -0
  173. package/skills/omc-config-draft-review.md +171 -0
  174. package/skills/omc-five-piece-flow.md +35 -0
  175. package/skills/omc-glossary.md +86 -0
  176. package/skills/omc-refusals.md +110 -0
  177. package/skills/omc-requirement-analysis.md +161 -0
  178. package/skills/omc-requirement-vocabulary.md +51 -0
  179. package/skills/omc-start-here.md +82 -0
  180. package/skills/omc-tool-selection.md +119 -0
  181. package/skills/omc-write-hazards.md +87 -0
@@ -0,0 +1,55 @@
1
+ ---
2
+ name: omc-capability-scouting
3
+ description: Scout a NEW CloudPivot config face honestly. Use when a capability isn't in the coverage manifest yet and you must prove it before promising it.
4
+ ---
5
+
6
+ # Capability Scouting (扒配置方法论)
7
+
8
+ How to scout a new CloudPivot configuration face honestly: the output feeds the
9
+ coverage manifest, and a manifest promise is always evidence-backed.
10
+
11
+ ## Phase 0 — 定面
12
+
13
+ Name the face first. The same Chinese/English word often names two engines
14
+ (businessrule B-plane vs field-level dataRuleType; app-tree node id vs schema
15
+ record id). The wrong face wastes everything after it.
16
+
17
+ ## Phase 1 — 静态三角定位
18
+
19
+ 1. **Enum scan** — the platform is enum-driven. The `*Type.java` enums are the
20
+ complete universe of a concept.
21
+ 2. **Endpoint chain** — Controller → FacadeImpl → Service along the lifecycle
22
+ (save/publish/delete/get_*). The gate methods ("when is this refused") are
23
+ half the contract.
24
+ 3. **DTO archaeology** — decompiled model fields and defaults are the request
25
+ shape; chase nested options JSON to leaf types.
26
+ 4. **Designer cross-check** — search the admin dist chunks by control code,
27
+ label, or write-mapping. The UI's write-mapping is the true wire contract.
28
+ 5. **DB persistence face** — the `h_*` tables are final truth; the API face
29
+ leaks. A dbsweep once caught orphans invisible to every API.
30
+
31
+ ## Phase 2 — 合同成形
32
+
33
+ 6. Grade every fact: `observed` (from source lines) vs `inferred` (from chunk
34
+ reverse-engineering). Keep the confidence tiers apart.
35
+ 7. Split open points into statically-closeable vs live-only.
36
+ 8. Design negative controls — a contract has discriminative power only when a
37
+ forged payload is refused for the right reason.
38
+
39
+ ## Phase 3 — live 收口
40
+
41
+ 9. Treat the static contract as a hypothesis and interrogate it live, item by
42
+ item — half the wire facts in this project came from live corrections
43
+ (gateway double-prefix, int enums, Void envelope, tree-node ids,
44
+ form/load as authoritative readback).
45
+ 10. Prefer a real traffic sample; capture designer requests when possible.
46
+ 11. Guard against false PASS: read the full green chain; "called" ≠ "passed".
47
+ 12. Before blaming the platform, retry with a different authoritative id
48
+ source and compare against designer traffic.
49
+
50
+ ## Output
51
+
52
+ Per open point: evidence (file+lines / chunk anchor) → conclusion
53
+ (observed/inferred) → verdict; close with a go/no-go and the residual
54
+ human-decision list. A capability enters the coverage manifest only with live
55
+ evidence; everything else stays `blocked` / `static-only` / `unsupported`.
@@ -0,0 +1,171 @@
1
+ ---
2
+ name: omc-config-draft-review
3
+ description: Draft-before-write protocol — use before ANY CLI write (model, field, form, view, data rule, business rule, workflow, service, data). Present the intended design in plain language and get explicit human approval first; revise the draft freely while it is unapproved. This is the human gate; the environment writable permission is the machine gate.
4
+ ---
5
+
6
+ # Draft Review (草稿确认) — the human gate before every write
7
+
8
+ The agent owns the design; the CLI materialises it. **Before any write call**,
9
+ present a plain-language draft of exactly what will be written and wait for
10
+ explicit approval. An unapproved draft is free to revise; nothing touches the
11
+ environment until the human says write.
12
+
13
+ This skill is the conversational human gate. The machine-side permission check
14
+ comes after it: `writable:false` refuses, and a production write additionally
15
+ requires `confirmProduction:true`:
16
+
17
+ ```
18
+ 先定参数 → 由参数生成草稿 → 人工确认 → 写入 → 读回核对
19
+ (写前你已确认的,就是即将发出的那份参数)
20
+ ```
21
+
22
+ ## 0. Approval lifecycle — package granularity, interruption, one notice
23
+
24
+ - **粒度 = 变更包(master approval)**:一份草稿枚举本包全部增删改(含清理),逐条列出;
25
+ 人工一次批准授权**整包**顺序执行。批一次 ≠ 看不清 —— 每一条都必须在草稿里可见。
26
+ - **中断作废**:执行中断(断网、会话重启、停损保留)后,已获的批准**随之作废**;
27
+ 恢复执行剩余步骤前必须**重新出草稿、重新获准**。看不见的时段里不得有旧批准继续生效。
28
+ - **一次收口报告(run completion notice)**:一个 run 只在结束(或最后动作完成)时发
29
+ 一条结构化收口报告(做了什么/结果/残留);中间步骤不打扰用户。执行过程中的说明是
30
+ 协调信息,不是通知。
31
+
32
+ ## 1. Unit — one coherent change per draft
33
+
34
+ One draft per coherent change (e.g. "build the inspection model + its form").
35
+ A single draft may cover **several** designs; group them by **design surface**:
36
+
37
+ | 节 | 设计域 | 对应写工具 |
38
+ | --- | --- | --- |
39
+ | 模型 | 模型设计 | `model.create` / `model.delete` |
40
+ | 字段 | 表单字段设计 | `field.create` / `field.update` / `field.publish` |
41
+ | 表单 | 表单设计 | `form.draft` / `form.publish` |
42
+ | 数据规则 | 字段级数据规则 | `datarule.create` / `update` / `delete` |
43
+ | 业务规则 | 业务规则配置(触发器+图) | `rule.save` / `rule.enable` / `configure_rule` |
44
+ | 视图 | 列表视图设计 | `listview.create` / `configure` / `delete` |
45
+ | 流程 | 流程设计 | `workflow.create` / `update` / `publish` / `bindRule` |
46
+ | 在线JS | 表单脚本 | `onlinejs.compose`(唯一可用;`draft`/`publish` 已冻结、调用即拒) |
47
+ | 服务 | 后端服务注册 | `service.register` / `service.delete` |
48
+ | 数据 | 运行时数据(夹具) | `data.save` / `submit` / `update` / `delete` |
49
+
50
+ **Every write entry point takes this gate — low-level atoms and the high-level
51
+ `configure_model` / `configure_form` / `configure_rule` alike.**
52
+
53
+ ## 2. Language — Chinese design prose, codes on identity keys
54
+
55
+ - Field/control **types in Chinese**: 短文本、长文本、数值、日期、单选、多选、
56
+ 下拉、复选、关联单选、关联多选、人员单选、部门单选、附件、地址、超链接、布尔、公式…
57
+ - Relations say **what maps where**, e.g.
58
+ `设备(device) 关联单选 → 设备台账(eq_device),带出 设备名称(deviceName)`.
59
+ - **Attach the code for identity keys** (model schemaCode, field code, choice
60
+ values, relation target code) — these are written verbatim and can collide.
61
+ Pure display labels may omit the code.
62
+ - Each section is headed with its design surface + the tool it maps to, so the
63
+ reviewer can point at one section precisely.
64
+
65
+ ## 3. Draft template
66
+
67
+ ```
68
+ 目标:<一句话业务目的>
69
+ 环境:<environment> 应用:<application code>
70
+
71
+ > 选应用前先 `discover_environment` 看它的门户分组归属:若 `portalHidden:true`
72
+ > (落在兜底分组 code=all,或分组解析不到),门户按具名分组渲染、该应用不可见——
73
+ > 先用 `app.update {code, groupId}` 迁入具名分组,再动工。别只在接口里确认应用存在。
74
+
75
+ 【模型设计】 (model.create)
76
+ · OMC走查(omc_mcp_walk) 类型:列表
77
+
78
+ 【表单字段设计】 (field.create → field.publish)
79
+ · 编号(walk_no) 短文本 列表显示
80
+ · 数量(walk_qty) 数值
81
+ · 类别(walk_cat) 单选 选项:一类 / 二类 / 三类
82
+ · 备注(walk_remark) 长文本 非必填
83
+
84
+ 【表单设计】 (form.draft → form.publish)
85
+ · 默认表单,编码 = 模型 code(omc_mcp_walk)
86
+ · 布局:标题 + 系统行(创建人/创建时间/单据号)+ 业务分组
87
+ · 控件:类别 必填;其他默认;字段按上序一行一个
88
+
89
+ 【业务规则配置】 (rule.save → rule.enable)
90
+ · 触发:数据事件 新增(提交后)
91
+ · 图:开始 → 完成态守卫(guardProjectEditable) → 计算实际产出(actualOutput) → 系统新增 → 结束
92
+ · 入映射:申报金额(declaredAmount) → declaredAmount,信用等级(creditLevel) → creditLevel
93
+ · 出映射:actualOutput → actualOutput
94
+ · 铁律:动作节点排在系统节点之前(否则输出不落库)
95
+
96
+ 【视图设计】 (listview.configure)
97
+ · 列:编号 / 数量 / 类别
98
+ · 条件:类别 下拉;排序:编号 倒序
99
+ · 按钮:沿用平台默认(新增 / 删除)
100
+
101
+ 【流程设计】 (workflow.create → update → publish → bindRule)
102
+ · 模板:开始 → 审批节点(审批人:<角色>)→ 结束
103
+ · 绑定:提交事件 → <ruleCode>
104
+
105
+ 【清理授权】 (data.delete / rule.delete / model.delete)
106
+ · 验收后删除:本条数据、该规则、模型 omc_mcp_walk(清单外对象另行报备)
107
+ ```
108
+
109
+ ## 4. Review flow
110
+
111
+ 1. Agent posts the draft(s) and asks **“确认写入 / 需要修改?”**
112
+ 2. Reviewer answers:
113
+ - **确认** (nothing named) → the whole batch is approved → write.
114
+ - **点名要改第 N 张** → **整批挂起**,只改那张,改完重新全批过。
115
+ 3. **先定参数 → 由参数生成草稿**:草稿里的类型/code/目标/映射,必须就是要发出的
116
+ 参数值;不要先写一段话、执行时另拼参数。
117
+ 4. After writing: **read back and compare**. If the readback differs from the
118
+ approved draft, **stop and report** — never silently accept or auto-retry.
119
+
120
+ ## 5. Fingerprint re-check
121
+
122
+ A draft carries the environment fingerprint captured when it was written.
123
+ **Before executing an approved draft, re-check that fingerprint**; if it
124
+ changed, the draft is void — re-discover and re-present. No machine token
125
+ enforces this anymore, so the check is an explicit agent step, not a refusal
126
+ you can wait for.
127
+
128
+ ## 6. Exemptions
129
+
130
+ - **空转写**(读回证明本次写不会改变任何字段/结构,如重复发布已发布表单)免草稿,
131
+ 报一行「无变更」即可。**只要任一处会变,就回到完整草稿。**
132
+ - **免草稿开关只由人工主动说**(如「本轮免草稿」)才生效;agent 不得自行提议或默认。
133
+ 豁免仅限**本轮新建的 `omc_mcp_*` 夹具**;**删除既有对象、改真实域,永不豁免**。
134
+ 豁免期间每步仍报一行「做了什么」。
135
+ - **预授权任务书(自治执行)**:当你在**非交互**上下文运行(被委派的子代理 / 批处理 / 一次
136
+ 性任务),且任务书本身就是一份完整变更包、并声明已批准(如项目 `AGENTS.md` 写明
137
+ 「本基准任务书即已批准的需求草稿,可直接执行」)时——**任务书即草稿即批准**:执行前按
138
+ §3 粒度把变更包原样列一遍作为记录,然后**直接写入**。**不要停下来问「确认写入」**:
139
+ 非交互上下文没有人类回合会回答,等待 = 永久停滞(实测:子代理因此空转到任务失败)。
140
+ 范围以任务书为界,任务书之外的增删改仍需新草稿。指纹重核与写后读回照旧。
141
+ 此豁免**要求任务书显式声明预授权**;agent 不得自行把交互会话当成自治上下文。
142
+
143
+ ## 7. Cleanup
144
+
145
+ 清理授权捆在创建授权里:创建草稿写明「验收后删除这些」,确认即一并授权。
146
+ **清单外的对象仍要单独出草稿。** 清理只碰自有 `omc_mcp_*` 夹具。
147
+
148
+ ## 8. Canonical configuration order(规范配置顺序)
149
+
150
+ ```
151
+ 0. 选定应用并确认门户分组可见(discover_environment 的 portalHidden)
152
+ 1. model.create (被引用的目标模型最先建)
153
+ 2. field.create (全部字段;关联字段带 displayField + displayFieldType)
154
+ 3. field.publish (模型级:一次发布该模型全部草稿字段)
155
+ 4. form.draft → form.publish (脚手架依赖已发布字段;重跑必须带 fieldCodes)
156
+ 5. listview.create/configure (依赖已发布字段;query/update 自动 publish=TRUE,无 draft→publish 两态)
157
+ 6. rule.save → rule.enable (保存 ≠ 发布 ≠ 可见;enable 才 publish+启用,或 rule.save 传 publish:true)
158
+ 7. workflow(依赖模型与字段就绪)
159
+ ```
160
+
161
+ 视图与表单脚手架都从**发布面**读字段元数据——字段未发布,列/控件就生成不出来。
162
+ `data.list` 对未配列的自定义字段投影为 null(显示面缺配置,不是数据缺失);核值用 `data.load`。
163
+ 字段级变更(如关联展示字段)改完后,必须重走 `form.draft` → `form.publish` 运行时才生效(表单控件快照字段 options)。
164
+
165
+ ## Invariants
166
+
167
+ - 未确认不写入;改任何一张 = 整批暂停,重新全批通过才写。
168
+ - 批准跟着变更包走:一次批准一整包;中断后批准作废,恢复需重新草稿、重新确认。
169
+ - 草稿里的身份键带 code;类型用中文;关联写明映射目标。
170
+ - 执行前重核环境指纹,变了就重出草稿;写后读回核对。
171
+ - 一个 run 只发一次收口报告;生产环境可写但每笔必须显式带 `confirmProduction:true`。
@@ -0,0 +1,35 @@
1
+ ---
2
+ name: omc-five-piece-flow
3
+ description: The CLI governed change process — use for any CloudPivot write (model, field, form, rule, workflow, data, service). discover → draft → permission check → execute → readback/cleanup.
4
+ ---
5
+
6
+ # Five-Piece Flow (五件套流程)
7
+
8
+ **五件套** — every governed change runs the same five pieces. High-level tools
9
+ orchestrate them; low-level tools expose each piece as one atom.
10
+
11
+ 1. **Discover (发现)** — `discover_environment` / `environment.fingerprint`.
12
+ Applications, models, fields, forms; the environment fingerprint. Discovery
13
+ precedes every write.
14
+ 2. **Draft (草稿)** — present the design as plain-language change package and
15
+ get explicit human approval through `omc-config-draft-review`.
16
+ 3. **Permission check (权限检查)** — `writable:false` refuses before wire;
17
+ `production:true` additionally requires the write call to carry
18
+ `confirmProduction:true`. `dryRun` previews the exact plan without writing.
19
+ 4. **Execute (执行)** — call the write tool once. The governance chain runs
20
+ (semantic gate → coverage gate → environment permission → version gate →
21
+ production confirmation → write lease), then authoritative readback. Success
22
+ records `deliveryState: DELIVERED`.
23
+ 5. **Read back & clean up (读回与清理)** — prove the state with read tools;
24
+ delete owned fixtures and confirm exact absence. The delivery ends CLEANED
25
+ only when absence is proven.
26
+
27
+ ## Invariants
28
+
29
+ - `writable` is the only environment write permission; no approval token or
30
+ self-approval setting exists.
31
+ - `uncertain` ≠ `ok`. A transport failure freezes; re-discover before retrying.
32
+ - Production is writable when `writable:true`, but every production write must
33
+ carry `confirmProduction:true` and records `productionConfirmed:true`.
34
+ - Cleanup touches owned fixtures only (prefix `omc_mcp_`) and exits with zero
35
+ residue.
@@ -0,0 +1,86 @@
1
+ ---
2
+ name: omc-glossary
3
+ description: OMC and CloudPivot terminology. Consult when a term is unclear — 环境指纹, 覆盖清单, 交付态, bizsheet, Void envelope, or a result status.
4
+ ---
5
+
6
+ # OMC Glossary (术语表)
7
+
8
+ Terminology for the `omc` configuration CLI. Built on CloudPivot 8.6 (anchor
9
+ 8.6.26); other versions/product lines are accepted in compatibility mode with a
10
+ `versionNotice`.
11
+
12
+ ## Core nouns
13
+
14
+ - **CloudPivot (云枢)** — the low-code platform being configured. The CLI
15
+ drives its design-time and runtime APIs over HTTPS.
16
+ - **Environment profile (命名环境)** — a named CloudPivot connection record
17
+ (baseUrl + applicationCode + optional engineCode, default marker, production
18
+ risk label, writable permission) in `omc.config.json`. Non-default
19
+ environments must be selected explicitly (`environment` argument, `OMC_ENV`,
20
+ or project `.omc-env`).
21
+ - **Multi-tenant engineCode (多租户租户码)** — the profile's optional
22
+ `engineCode`. On a multi-tenant deployment
23
+ (`systemConfig.options.multiTenancy === true`) the gateway routes by the
24
+ `x-lowcode-enginecode` header, which OMC sends on every request; without it
25
+ the gateway answers 404 (even for `/api/public/system/config`). Leave it unset
26
+ on single-tenant deployments.
27
+ - **Environment write permission (环境写权限)** — the profile's `writable`
28
+ boolean. False refuses every write before wire; true permits writes subject to
29
+ coverage, version, semantic, and production-confirmation gates.
30
+ - **Production confirmation (生产确认)** — the per-write `confirmProduction:true`
31
+ acknowledgement required when the selected profile is marked production. It
32
+ records `productionConfirmed:true`; it is not a second configuration key.
33
+ - **Credential store (凭据存储)** — `~/.config/omc/credentials`, mode 0600.
34
+ Never packaged, never echoed, never logged. `OMC_CLOUDPIVOT_CREDENTIAL`
35
+ (JSON) takes priority.
36
+ - **Environment fingerprint** — canonical sha256 of (environment name,
37
+ authoritative origin, application code, enterprise id). Identifies the
38
+ environment in plans and audit artifacts; it is not an approval-token binding.
39
+ - **Coverage manifest (覆盖清单)** — the machine-readable M1 manifest vendored
40
+ at `coverage/m1-coverage-manifest-v1.json`. The tool surface is bounded by
41
+ it; out-of-coverage calls reject citing the entry.
42
+ - **Write lease (写租约)** — per-environment serialization of write
43
+ operations inside one server process.
44
+ - **Delivery state (交付态)** — DELIVERED (write + authoritative readback
45
+ recorded) → VERIFIED (agent verified readback) → CLEANED (fixture
46
+ removed, exact absence proven).
47
+
48
+ ## CloudPivot domain nouns
49
+
50
+ - **Model (.bizmodels)** — design-time schema; LIST or TREE. Physical
51
+ delete is proven; there is no separate model-publish wire call (a model
52
+ reaches its usable state via field/form publication).
53
+ - **Field (bizproperty)** — model property. Draft → publish two-face
54
+ lifecycle; draft face `isPublish=false`, published face `isPublish=true`.
55
+ - **Field families (字段族)** — live-accepted types: text-extension,
56
+ people-department, address-attachment, dictionary-enum, relevance,
57
+ numeric-logical, date-time (+ formula EXPRESSION-only).
58
+ - **Default form (bizsheet)** — the model's own sheet. Draft-first:
59
+ `bizsheet/update` saves the draft (publishedHtmlJson carried explicitly),
60
+ then `bizsheet/publish` publishes.
61
+ - **Business rule (businessrule)** — B-plane rule graph. B1 dead-state
62
+ rules and B1.2 CRUD/conditional node graphs; enable = publish by rule id.
63
+ - **Online JS** — form-level custom script embedded in the published form:
64
+ compose (preserves the platform skeleton) → publish; the authoritative
65
+ readback is `onlinejs.compose` returning the read-back publishedHtmlJson
66
+ with a SHA-256 fingerprint. (There is no `get_source`/programming tool —
67
+ that removed face authored backend Java, not form Online JS.)
68
+ - **M2 runtime data** — `runtime/form/save|load|delete`, `query/list` (CLI
69
+ tools `data.save` / `data.load` / `data.submit` / `data.update` / `data.list`).
70
+ `data.load` is the authoritative custom-field readback; list projection
71
+ is a pinned boundary (custom fields keys-present-values-null).
72
+ - **B2 service (bizservice)** — service + method registration face.
73
+ - **List view (query)** — design-time list-view header lifecycle with
74
+ forced LIST/showOnPc/unpublished defaults.
75
+ - **Void envelope** — CloudPivot responses are `{errcode, errmsg, data}`;
76
+ errcode 0 with `data: null` is a success with no payload.
77
+
78
+ ## Result vocabulary
79
+
80
+ - `ok` — performed and authoritatively read back.
81
+ - `refused` — governance or coverage refusal; nothing executed. Citations
82
+ name the manifest entry.
83
+ - `uncertain` + `frozen: true` — transport outcome cannot be established
84
+ (outage/timeout). Never treated as success; re-discover before retrying.
85
+ - `dry-run` — a validated plan is returned with zero environment writes; rerun without dry-run to execute when the environment permits it.
86
+ - `production-confirmation-required` — a writable production environment refused a write because the call omitted `confirmProduction:true`.
@@ -0,0 +1,110 @@
1
+ ---
2
+ name: omc-refusals
3
+ description: Decode a refused or uncertain OMC result. Use when a call returns refused/uncertain, or a status looks wrong, to find what the blocker means and the correct next action. Grouped by family, not enumerated per code.
4
+ ---
5
+
6
+ # Refusals & Recovery (拒绝与恢复)
7
+
8
+ Grouped by family. For a specific tool's exact wire and valid shapes, follow the
9
+ `contract`/`describe` pointers; this page is the **meaning + next action**.
10
+
11
+ Read `result.blocker` (refused) or `result.status`+`result.reason` (uncertain).
12
+ `result.retryable` is advisory only — the family decides what to do.
13
+
14
+ ## 1. Write permission declined
15
+
16
+ - `environment-write-disabled` — the environment profile has `writable:false`.
17
+ **Do not retry the same call.** Either the operator turns writes on in
18
+ `omc setup`, or the write is out of bounds. Zero wire was sent.
19
+ - `production-confirmation-required` — the target is production and the call
20
+ omitted `confirmProduction:true`. If the human approved a production write,
21
+ re-send with `confirmProduction:true`; otherwise **stop**. Zero wire was sent.
22
+
23
+ ## 2. Boundary — the capability is not covered
24
+
25
+ - `capability-out-of-coverage` — `result.citation` names the manifest entry and
26
+ its status (`blocked` / `unsupported` / `static-only`). **The refusal is the
27
+ answer.** Do not route around it with a lower-level tool; the boundary is the
28
+ same. If it should be covered, use `omc-capability-scouting`.
29
+ - `version-family-evidence-missing` — no version evidence could be parsed at all;
30
+ writes fail closed. (A version that simply isn't 8.6 is **not** a refusal any
31
+ more: OMC is built on 8.6 but accepts other versions/product lines in
32
+ compatibility mode, surfacing a `versionNotice`; only truly absent evidence
33
+ still fails closed.) Verify the environment's version before retrying.
34
+
35
+ ## 3. Semantic preflight — the payload is malformed
36
+
37
+ Refused **before any wire call**; fix the payload, don't retry as-is. The refusal
38
+ usually carries `validation` entries to fix one by one.
39
+
40
+ - `business-code-invalid`, `duplicate-field`, `duplicate-service`,
41
+ `dictionary-create-duplicate`, `app-create-duplicate`, `model-create-duplicate`
42
+ - `field-*` family gates (unaccepted family, missing relation `relativeCode`,
43
+ nested child table, OCR/ELECTRONIC_SIGN)
44
+ - `form-layout-invalid`, `form-fieldcodes-unknown`, `form-html-render-invalid`
45
+ - `rule-graph-validation-failed`, `rule-graph-*` (node-graph dry lint)
46
+ - `datarule-options-invalid`, `datarule-property-not-published`, `datarule-duplicate-property-type`
47
+ - `listview-*` (columns/buttons/sorts/gantt/presentation)
48
+ - `configure-model-*`, `apply-changes-tool-not-atomic`, `apply-changes-step-failed`
49
+ - `bizservice-*` (required field, name length, config invalid, category/dbconnpool)
50
+ - `model-type-immutable`, `model-referenced-by`
51
+
52
+ ### 3b. A platform `errcode` is a SHAPE error, never a boundary
53
+
54
+ `blocker:"wire-business"` + non-zero `errcode` means the payload's shape (or a
55
+ referenced dependency) is wrong — **not** that the capability is unavailable.
56
+ Fix the shape; never conclude 「配置表达不了 → 必须二开」 from an errcode.
57
+ Known shape codes: `300010` a node resolves its input schema from `inputParam`
58
+ and it is missing (BRANCH/UPDATE/CREATE/DELETE/ASSIGN/BIZ_ACTION/MESSAGE/QUERY;
59
+ `prepareRuleGraph` defaults `"_input"`) or a node names a non-existent schema;
60
+ `550018` a referenced field/out-param/mapping key is absent; `50000` a
61
+ condition/expression/query shape is off. Compare against
62
+ `omc describe <tool> --example …` and the node-graph prose, then re-save.
63
+ Escalate to 二开 **only** for a real `capability-out-of-coverage` (§2).
64
+
65
+ ## 4. Readback mismatch — the write landed but does not match
66
+
67
+ `*-readback-failed`, `*-readback-mismatch`, `cleanup-absence-readback`,
68
+ `intent-readback-mismatch`, `workflow-render-readback-invalid`.
69
+
70
+ **Stop and report.** Never auto-retry, never assume success. Inspect
71
+ `result.readback` / `result.verification.differences`, compare against the
72
+ approved draft, and decide with the human. A second write may duplicate.
73
+
74
+ ## 5. Dependency & async convergence
75
+
76
+ - `model-referenced-by` — inbound relation references block the delete. Clean up
77
+ **dependency-inverted**: delete referencing models first, then the referenced
78
+ one.
79
+ - `absent:false` + `treeNodePending:true` with `nextAction:"wait-and-recheck"` —
80
+ the platform's per-column cascade is still running (40–60s). **Not a failure.**
81
+ Wait ~60s and re-run; the call is idempotent and `already-absent` short-circuits.
82
+
83
+ ## 6. Idempotency & replay
84
+
85
+ - A repeated `requestId` with identical args returns `replay:"already-completed"`
86
+ — the first write stands; treat as success, do not re-execute.
87
+ - `intent-plan-tampered` — the plan file changed after planning. Re-run
88
+ `intent plan`.
89
+ - `intent-baseline-drifted` — the environment moved after planning. Re-run
90
+ `intent plan` against the fresh baseline.
91
+ - `intent-plan-environment-mismatch` — the plan targets a different environment.
92
+
93
+ ## 7. Transport uncertainty — outcome unknown
94
+
95
+ `status:"uncertain"` with `frozen:true` (`cli-timeout`, `batch-timeout-budget`,
96
+ `wire-transport:*`). The write **may** be in flight.
97
+
98
+ 1. Read back the affected resource (or `artifact get <id>` / the `requestId`).
99
+ 2. Only after the outcome is established, decide whether to retry.
100
+ 3. Never blind-retry — that risks a second write.
101
+
102
+ `write-lock-held` — another write holds the environment lock; `owner` and
103
+ `recovery` are included. Wait for it to clear (it auto-recovers when the holding
104
+ process exits), then retry. This guards concurrency, not approval.
105
+
106
+ ## 8. Input / target
107
+
108
+ - `tool-input-invalid` — schema violation (exit 10); fix the arguments.
109
+ - `dictionary-target-required`, `intent-plan-invalid` — a required selector or
110
+ shape is missing; see `describe <tool>`.
@@ -0,0 +1,161 @@
1
+ ---
2
+ name: omc-requirement-analysis
3
+ description: Turn a fuzzy Chinese requirement into a platform-independent Configuration Intent. Use before discovery when the ask is vague or spans domains.
4
+ ---
5
+
6
+ # Requirement Analysis (需求分析)
7
+
8
+ Turn a fuzzy Chinese requirement into a platform-independent **Configuration
9
+ Intent** before any discovery, plan, or draft.
10
+
11
+ This is reasoning, not a governed tool: it reads no environment, prints no
12
+ credential, and writes nothing.
13
+
14
+ **Leading word: 定面** — name the face. The same Chinese word names several
15
+ OMC surfaces (规则, 表单, 字段, 集成, 在线, 数据). 定面 first; everything after
16
+ depends on it. This word is shared with `omc-capability-scouting`.
17
+
18
+ ## Process
19
+
20
+ Five moves, in order. Each ends on a completion criterion.
21
+
22
+ ### 1. 定面 — name the face
23
+
24
+ For every noun in the requirement, assign exactly one OMC face from the 定面表.
25
+
26
+ **Done when** every ambiguous noun carries exactly one face, and every noun
27
+ with no face is marked a boundary.
28
+
29
+ ### 2. 归类 — capability and lane
30
+
31
+ Map each face to its capability, lane, and status in the 能力表.
32
+
33
+ **Done when** every face has a capability, its lane, and one status
34
+ (`executable` / `partial` / `blocked` / `unsupported`).
35
+
36
+ ### 3. 选路 — implementation path
37
+
38
+ Choose one path per behavior, in preference order: **native** →
39
+ **configuration + Online JS** → **configuration + backend extension**.
40
+
41
+ **Done when** each behavior carries a path, and every non-native path names
42
+ the code owner and why native cannot carry it.
43
+
44
+ ### 4. 澄清 — risk-driven
45
+
46
+ Ask only about unresolved details that change behavior, data, environment
47
+ impact, or acceptance (see 澄清触发). A blocked or unsupported face is a
48
+ **boundary** — stated, not asked. All other detail takes the established
49
+ project convention.
50
+
51
+ **Done when** the open-question list is emitted, or empty.
52
+
53
+ ### 5. 出意图 — emit Configuration Intent
54
+
55
+ Emit the intent object (see Configuration Intent).
56
+
57
+ **Done when** every field is populated and `nextStep` is set.
58
+
59
+ ## 定面表 — disambiguate before classifying
60
+
61
+ | 需求里的词 | 面 A | 面 B | 判别 |
62
+ | --- | --- | --- | --- |
63
+ | 规则 | cross-model **businessrule** graph (B 平面) | 字段级控件规则 `dataRuleType` 3/4/5 | 跨模型/触发/动作 → businessrule;单字段随值必填/只读/显示 → 表单控件绑定 |
64
+ | 表单 | default form **(`bizsheet`)** | list view **(`query`)** | 录入/详情/布局/控件 → default form;列表/视图/筛选列 → list view |
65
+ | 字段 | model property **(`bizproperty`)** | form control binding | 结构/类型 → model field;可见/只读/必填 → form binding |
66
+ | 集成 | B2 业务集成服务 **(`bizservice`,`service.register`)** | 方法体来源:原生适配器(RESTFUL→外部 API)/ 二开扩展接口(也用 RESTFUL 指向扩展端点) | 对接接口/外部系统、或需自定义 Java 方法体 → **一律用 RESTFUL 业务集成服务**(二开接口 = 扩展模块写 REST 接口 + RESTFUL 服务指向它);自定义协议适配器 SPI 是「新增一种协议类型」,非常规、且不在工具支持面 |
67
+ | 在线 | form **Online JS** | 在线后端编码 | 表单脚本 → Online JS;内联后端代码 → boundary (unsupported) |
68
+ | 数据 | M2 runtime data | model/field 定义 | 记录读写 → M2 data;结构 → model/field |
69
+
70
+ ## 归类 — face → capability
71
+
72
+ Each face maps to a capability; **read the capability's coverage, tools,
73
+ recipes, and boundaries from `omc-capabilities`** — that catalogue is the prose
74
+ authority (this section is a pointer, not a second copy). Read only the section
75
+ you need: `omc help omc-capabilities --section "<能力>"`. At call time the
76
+ coverage manifest is authoritative and the tool gate rejects out-of-coverage
77
+ calls.
78
+
79
+ > `blocked` / `unsupported` are **native-config** verdicts. They route the
80
+ > behavior to another code owner (`config + backend extension`), they do NOT
81
+ > mean the requirement is undeliverable. Compiling a blocked face into "can't
82
+ > do it, leave it manual" is a failure mode — see 选路.
83
+
84
+ Full Chinese cue vocabulary lives in `omc-requirement-vocabulary.md` — reach
85
+ for it when a cue in step 1 is not obvious from 定面表.
86
+
87
+ ## 选路 — path rules
88
+
89
+ > 落点判据(配置 vs 二开、组合观)的唯一权威源是 `cpdocs-guide` 的「落点」;本节只列 OMC 侧的落点执行。
90
+
91
+ - **Native configuration** owns structure and lifecycle: models, fields,
92
+ forms, list views, rule graphs, workflow templates.
93
+ - **Online JS** owns form interaction and presentation: visibility, labels,
94
+ field linkage, preview. It *previews* a computed value; the saved value
95
+ comes from native config or a backend extension.
96
+ - **Backend extension** is the method-BODY source when native config cannot
97
+ express the logic. Expose it the normal way: **write an interface (a REST
98
+ endpoint) in the extension package, then register a `RESTFUL` service pointing
99
+ at it** (`service.register`, `adapterCode:RESTFUL`, `methodConfig.url` → the
100
+ extension endpoint). Do NOT use `INTERNAL` / `custom_protocol` adapters — those
101
+ are platform-internal protocol mechanisms, not the way a 二开 interface is
102
+ registered, and they are outside the write face. A RESTFUL service pointing at
103
+ an external API is the same face.
104
+ - **Business-rule action dual path**: a rule's action nodes use product-native
105
+ CRUD/query nodes (no code) **or** bind an already-released BizMethod. Surface
106
+ both paths; the clarification decides.
107
+ - **Cannot express declaratively ⇒ `config + backend extension`, do not stop** —
108
+ the code owner is a backend extension (interface in the extension package +
109
+ `RESTFUL` service + BIZ_ACTION/button binding). **Do not report "blocked" and
110
+ leave the value unbuilt, and do not substitute an external throwaway script.**
111
+
112
+ ## 澄清触发 — ask only when
113
+
114
+ - the business domain is unknown, or a noun in 定面表 stays ambiguous;
115
+ - money, cumulative values, or concurrency are involved;
116
+ - the requirement is environment-impacting (上线 / 发布 / 生产 / 释放冻结);
117
+ - two capabilities could satisfy it and the choice changes behavior.
118
+
119
+ Proceed with the convention when the detail is cosmetic (label wording,
120
+ layout polish) or already implied by an established project pattern.
121
+
122
+ ## Configuration Intent
123
+
124
+ ```jsonc
125
+ {
126
+ "domains": ["customer", "project"],
127
+ "capabilities": ["model", "field", "form", "businessrule", "workflow"],
128
+ "intent": {
129
+ "entities": [{ "name": "…", "fields": [{ "name": "…", "type": "…" }] }],
130
+ "behaviors": [{ "trigger": "create|update|delete|button|system|timed|…", "action": "…" }],
131
+ "integrations": [{ "kind": "native-crud|bizmethod|b2-service", "target": "…" }]
132
+ },
133
+ "implementationPath": "native | config+onlinejs | config+backend-extension",
134
+ "risks": ["…"],
135
+ "clarifications": ["…"],
136
+ "acceptanceScenarios": ["…"],
137
+ "nextStep": "discover_and_plan | clarify | boundary"
138
+ }
139
+ ```
140
+
141
+ `clarify` whenever 澄清触发 fires; `boundary` when a face is out of coverage;
142
+ otherwise `discover_and_plan`.
143
+
144
+ ## 反模式
145
+
146
+ - Classifying a noun before 定面 — e.g. mapping 规则 to `dataRuleType` when a
147
+ cross-model graph was meant.
148
+ - Treating 对接外部系统 as a cue to develop a custom protocol adapter SPI — that
149
+ is a rare NEW PROTOTYPE, not integration. The normal path is a
150
+ business-integration service (`service.register`).
151
+ - Routing a saved value through Online JS.
152
+ - Inventing a capability for a blocked face. Cite the boundary instead.
153
+ - Emitting a plan or DTO payload here — intent stays platform-independent
154
+ until discovery.
155
+
156
+ ## 接续
157
+
158
+ Intent feeds, in order: `discover_environment` (fingerprint + existing
159
+ resources) → configuration baseline → `omc-five-piece-flow`. For a face not
160
+ yet proven, use `omc-capability-scouting`. For the concrete tool to call, use
161
+ `omc-tool-selection`.