@stalfh233/omc-cli 0.8.8 → 0.8.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.
@@ -132,7 +132,7 @@ const numericPercent = Object.freeze({
132
132
  conditionalRequirements: [
133
133
  "`options.format` 必须是平台常量:百分比 `ratio`(20%)/`ratio.tenths`(20.0%)/`ratio.percentile`(20.00%),普通数字 `integer/tenths/percentile…`,货币 `RMB./dollar./euro./HK.` 前缀,`none`=裸值;`percentile` 是两位小数**不是**百分比。全表见 `omc contract field-families` 的 numericalFormat。",
134
134
  "`scale` 与小数据对齐(两位百分比 = `scale:2`+`ratio.percentile`);只写 scale 门户显示 `2,000.00` 普通数字。别名 percent/currency/¥ 由 CLI 归一为常量再落库;**别绕过 CLI 把 `percent` 写进字段行**——平台字面读不懂,门户跌回裸值(真机 r64b:format:\"percent\" → `0.5`)。",
135
- "生效:字段行 format 优先于表单控件 format,`field.publish` 后即生效(无需重建表单);列表是另一套列枚举,配完看一眼列表列。",
135
+ "生效:字段行 format 优先于表单控件,`field.publish` 即生效(无需重建表单);列表另是一套列枚举。",
136
136
  ],
137
137
  priorToolReferences: [
138
138
  { tool: "field.list", args: { environment, schemaCode: model, code: "completionRate", full: true }, purpose: "确认 code 未占用(默认清单面不回 options)" },
@@ -236,6 +236,11 @@ const childTable = Object.freeze({
236
236
  * source=关联目标(本例=父模型)字段,target=本模型(子表)字段;
237
237
  * `WorkSheetMappingServiceImpl` 只在表单映射链里 `assignChildData`,CLI
238
238
  * `data.save` 走的 `/api/runtime/form/save` 不调用 mappingList(探针 C F4)。
239
+ *
240
+ * 探针 D(0.8.9):F2 发布必须发**父模型** code(子表 schema 发布 → 300004,
241
+ * `BizPropertyController.java:1138-1146` 用 `getAppFunctionByCodeIgnoreDelete`
242
+ * 取顶层 app function,子表没有该行);F9 映射正确性读面在 `field.get` 的
243
+ * `options.mappings` 与 `mappingRuntimeNote`,不必等到 `data.save`。
239
244
  */
240
245
  const childTableParentFieldFill = Object.freeze({
241
246
  id: "child-map-fill",
@@ -259,15 +264,16 @@ const childTableParentFieldFill = Object.freeze({
259
264
  },
260
265
  preconditions: [
261
266
  "子表 code 全局唯一;先建并发布快照标量列,再建关联列。",
262
- "映射只在门户选值时回填:CLI data.save 不跑映射,API 写入须自带快照值。",
267
+ "**发布用父模型 code**:`field.publish {\"schemaCode\":\"<父模型>\"}`——子表 code 会被拒(300004 → `field-publish-child-schema`);模型级一次发全部草稿字段,子表列随父模型发。",
263
268
  ],
264
269
  conditionalRequirements: [
270
+ "映射只在门户选值时回填:CLI data.save(/api/runtime/form/save)不跑 options.mappings,快照列需调用方自填;配置正确性以字段行 options.mappings 为准。",
265
271
  "关联列必须带 relativeCode(=options.schemaCode=主模型);source=主模型字段、target=本子表列,均裸 code。",
266
- "关联列不能是 CHILD_TABLE/OCR/ELECTRONIC_SIGN/MULT_WORK_SHEET/RELEVANCE_DATA/FORMULA;field.publish 后 field.get 读回 options.mappings。",
272
+ "关联列不能是 CHILD_TABLE/OCR/ELECTRONIC_SIGN/MULT_WORK_SHEET/RELEVANCE_DATA/FORMULA。",
267
273
  ],
268
274
  priorToolReferences: [],
269
275
  dryRun: { supported: true, command: `omc call field.create --env ${environment} --dry-run --args '<args>'`, notes: "" },
270
- expectedReadback: { readback: { fieldPresent: true }, next: ["field.publish", "field.get 读回映射"] },
276
+ expectedReadback: { readback: { fieldPresent: true }, next: ["field.publish {schemaCode:<父模型>}", "field.get 读回 options.mappings"] },
271
277
  refusalRecovery: [{ code: "relation-mapping-field-not-found", action: "source 用主模型字段、target 用本子表列,均裸 code" }],
272
278
  requiresEnvironmentDerivedIds: true,
273
279
  });
@@ -317,7 +323,7 @@ const businessModelDropdown = Object.freeze({
317
323
  });
318
324
  const formulaAggregationCrossModel = Object.freeze({
319
325
  id: "formula-aggregation-cross-model",
320
- title: "跨模型汇总:FORMULA 字段 + AGGREGATION + DYNAMIC 条件(API 可回算,r17 真机 100→105 实测)",
326
+ title: "跨模型汇总:FORMULA + AGGREGATION + DYNAMIC 条件(API 可回算,r17 真机)",
321
327
  aliases: ["跨模型汇总", "跨模型聚合", "另一个模型", "其它模型", "其他模型", "另一张表", "统计合计写入", "汇总到本模型", "API 回填聚合"],
322
328
  status: "offline-valid",
323
329
  tool: "field.create",
@@ -343,7 +349,7 @@ const formulaAggregationCrossModel = Object.freeze({
343
349
  },
344
350
  },
345
351
  preconditions: [
346
- "**只能汇总「别的模型」**:同模型(含自己的子表)聚合在 field.publish 必抛 305003(平台 publishFormula 把相对码改写成子表父模型 = 本模型,checkCycleOfAggregation:1032 判成环)。工具已写前拒绝 `aggregation-self-schema-cycle`。",
352
+ "**只能汇总「别的模型」**:同模型(含自己的子表)聚合在 field.publish 必抛 305003(平台 publishFormula 把相对码改写成子表父模型 = 本模型,checkCycleOfAggregation:1032 判成环);工具拒 `aggregation-self-schema-cycle`。",
347
353
  "目标字段用 FORMULA(100)(不是普通字段 + 计算规则——type2 计算规则在 REST 路径永不执行)。",
348
354
  "`schemaCode` 是被汇总的**来源模型**;`dataItemCode` 是来源模型的**主表标量列**(不带 schema 前缀);`queryConditions` **不能为空**,否则反向过滤器为空、找不到要回算的目标行(真机:空条件时 recalc 日志照常打印但目标字段恒为 0)。",
349
355
  "**不要指向子表 schema**(r18 2026-10-26 真机):`schemaCode:\"<子表>\"` 能发布,但目标模型从此**整个不可写** —— `data.submit`/`data.update` 一律回 40000「调用数据库发生异常」且无明细;而且子表 schema 没有父单单号列,按父单匹配恒为 0。`dataItemCode` 写成 `<子表>.<子列>` 则在 publish 直接 309004「使用的聚合数据项不存在」。要汇总子表:先在来源**主模型**上物化一个数值字段(门户计算规则或写入方维护),再聚合该标量。OMC 已写前拒绝 `aggregation-target-is-child-schema` / `aggregation-data-item-not-scalar`。",
@@ -393,7 +399,7 @@ const formulaExpressionSameModel = Object.freeze({
393
399
  preconditions: ["目标模型已存在;amount 是同一模型上已存在并已发布的数值字段;total 尚不存在"],
394
400
  conditionalRequirements: [
395
401
  "formulaConfig 是 JSON 字符串,内层 expression 仍是 JSON 字符串:CLI recipe 已代做两层序列化,直接把 args 传给 field.create,不要再手工转义。",
396
- "这是同模型的基础 EXPRESSION;跨模型汇总请改用 formula-aggregation-cross-model。",
402
+ "跨模型汇总改用 formula-aggregation-cross-model。",
397
403
  ],
398
404
  priorToolReferences: [
399
405
  { tool: "field.list", args: { environment, schemaCode: model, published: true }, purpose: "确认 amount 已发布并确认目标 code 未占用" },
@@ -443,10 +449,10 @@ const externalLookupModel = Object.freeze({
443
449
  "数据段已通:接口数据已能落进映射模型表(见 conditionalRequirements 第 1 条的三个已验证组合)",
444
450
  ],
445
451
  conditionalRequirements: [
446
- "**数据段首选(平台标准模式,2026-10-29 playwright 门户实证定案)**:映射模型的 GetList/Load 规则挂 BIZ_ACTION 实时调接口(接口方法配 frontEndExtensionEnable:true)——门户关联控件**打开即触发**前端查询链→GetList 规则→BIZ_ACTION 实时调外部接口(引擎日志 bizBusService.invoke + 外部网关日志双侧铁证)。**验证必须走门户填表;data.list 后端查询不反映此链,别用它判死**(r29 曾据此误判不成立)。配置侧三个收尾点:① WORK_SHEET 字段必须带 relativeCode(仅 options.schemaCode 发布表单会 301015 关联业务模型为空);② GetList 规则的 BIZ_ACTION 入参映射要接前端搜索词(实测未配词时 invoke 参数为空 {});③ 出参→列表行的映射配完候选才回显(未配时弹窗 Total 0 但接口已调)。「下拉框形态(输关键字回车查询)」是表单 attributes 层的控件形态设置,默认弹窗形态。备选(不需要实时时):预置 Create/Update 规则落映射表 / TIMING 定时同步。图内「BIZ_ACTION→CREATE 落表→再查」回环在 1.1.25 不可表达,不要走这条岔路。",
452
+ "**数据段首选(平台标准模式)**:映射模型的 GetList/Load 规则挂 BIZ_ACTION 实时调接口(接口方法配 frontEndExtensionEnable:true)——门户关联控件**打开即触发**前端查询链→GetList 规则→BIZ_ACTION 实时调外部接口(引擎日志 bizBusService.invoke + 外部网关日志双侧铁证)。**验证必须走门户填表;data.list 不反映此链**(r29 曾误判)。配置侧三个收尾点:① WORK_SHEET 字段必须带 relativeCode(仅 options.schemaCode 发布表单会 301015 关联业务模型为空);② GetList 规则的 BIZ_ACTION 入参映射要接前端搜索词(实测未配词时 invoke 参数为空 {});③ 出参→列表行的映射配完候选才回显(未配时弹窗 Total 0 但接口已调)。「下拉框形态(输关键字回车查询)」是表单 attributes 层的控件形态设置,默认弹窗形态。备选(不需要实时时):预置 Create/Update 规则落映射表 / TIMING 定时同步。图内「BIZ_ACTION→CREATE 落表→再查」回环在 1.1.25 不可表达,不要走这条岔路。",
447
453
  "**表单段是平台原生能力**:关联单选指向映射模型后,门户上输入关键字回车即查映射表、选中即 mappings 带出——前台填表时映射自然出现,无需按钮/脚本。",
448
454
  "下拉框形态在 form.draft 控件层配置;映射表要有数据下拉才有选项。",
449
- "**关联填充映射的事实源是字段行 `options.mappings`**:改表单控件属性里的 mappings 会被平台按字段重算覆盖、回读不生效(真机 2026-10-14 中冶实证)。改映射走 `field.update` 按完整 options 提交(只改 mappings,其余键 queryCode/displayField/schemaCode/conditions… 原值保留)→ `field.publish` → `form.draft`(**rebuild:false**,保留现有布局与已挂在线JS)重存 → `form.publish` → 回读核对。**不要用 field.update 的 cascadeRepublish 刷已带自定义布局/在线JS 的表单**——它会 rebuild 脚手架(rebuild:false 手动链才安全)。",
455
+ "**关联填充映射的事实源是字段行 `options.mappings`**:改表单控件属性里的 mappings 会被平台按字段重算覆盖、回读不生效(真机 2026-10-14 中冶实证)。改映射走 `field.update` 按完整 options 提交(只改 mappings,其余键 queryCode/displayField/schemaCode/conditions… 原值保留)→ `field.publish` → `form.draft`(**rebuild:false**,保留现有布局与已挂在线JS)重存 → `form.publish` → 回读核对。**别用 cascadeRepublish 刷已带布局/在线JS 的表单**(会 rebuild 脚手架)。",
450
456
  ],
451
457
  priorToolReferences: [
452
458
  { tool: "model.create", args: { environment }, purpose: "建映射模型(字段与接口返回一一对应;mappings 的 source/target 只填裸字段 code,不带模型前缀)" },
package/dist/reserved.js CHANGED
@@ -25,4 +25,52 @@ export function reservedCodeReport() {
25
25
  nextCommand: "omc help omc-write-hazards",
26
26
  };
27
27
  }
28
+ /**
29
+ * F13(0.8.9 探针 D):`omc reserved <code...>` 按候选 code 只回命中项。查的是
30
+ * **同一张表**(`RESERVED_CODE_GROUPS`,与写门同源),大小写不敏感——本地判据
31
+ * 就是 `code.toLowerCase()` 比对,所以这里也只做 lower-case 比对,不另造规则。
32
+ * 一个 code 可能落在多组(`id` 同时在 system 与 subtable),逐条 `group` 给首个,
33
+ * 顶层 `groups` 列全命中组,避免静默丢掉第二个归属。
34
+ */
35
+ const RESERVED_CODE_LOOKUP = (() => {
36
+ const map = new Map();
37
+ for (const group of RESERVED_CODE_GROUPS) {
38
+ for (const entry of group.codes) {
39
+ const key = entry.toLowerCase();
40
+ const list = map.get(key) ?? [];
41
+ list.push({ group, entry });
42
+ map.set(key, list);
43
+ }
44
+ }
45
+ return map;
46
+ })();
47
+ /** Per-candidate verdict for `omc reserved <code...>`; never touches an environment. */
48
+ export function reservedCodeLookup(rawCodes) {
49
+ const checked = rawCodes.map((raw) => {
50
+ const code = String(raw).trim();
51
+ const matches = RESERVED_CODE_LOOKUP.get(code.toLowerCase()) ?? [];
52
+ const first = matches[0];
53
+ return {
54
+ code,
55
+ reserved: matches.length > 0,
56
+ ...(first === undefined ? {} : { group: first.group.id, matched: first.entry }),
57
+ };
58
+ });
59
+ const hits = checked.filter((entry) => entry.reserved);
60
+ const groups = RESERVED_CODE_GROUPS.map((group) => ({
61
+ id: group.id,
62
+ title: group.title,
63
+ codes: hits.filter((hit) => (RESERVED_CODE_LOOKUP.get(hit.code.toLowerCase()) ?? []).some((match) => match.group.id === group.id)).map((hit) => hit.code),
64
+ })).filter((group) => group.codes.length > 0);
65
+ return {
66
+ status: "ok",
67
+ scope: "本地 code dry-lint(model.create / field.create / configure_model 使用同一张表);不是平台全量保留字清单",
68
+ rule: "reserved:true 的 code 不要用于业务模型 / 字段;平台最终门:属性冲突 301014、SQL 关键字 10033。命中不是错误(退出码 0)",
69
+ checked,
70
+ hits,
71
+ total: hits.length,
72
+ ...(groups.length > 0 ? { groups } : {}),
73
+ ...(hits.length > 0 ? { nextCommand: "omc reserved" } : {}),
74
+ };
75
+ }
28
76
  //# sourceMappingURL=reserved.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stalfh233/omc-cli",
3
- "version": "0.8.8",
3
+ "version": "0.8.9",
4
4
  "description": "CloudPivot 8.6 configuration capability CLI — governed, fail-closed, coverage-manifest bounded.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -58,7 +58,7 @@
58
58
  },
59
59
  "dependencies": {
60
60
  "commander": "14.0.3",
61
- "omc-core": "0.8.8",
61
+ "omc-core": "0.8.9",
62
62
  "proper-lockfile": "4.1.2",
63
63
  "write-file-atomic": "6.0.0",
64
64
  "zod": "^3.23.8",
@@ -76,6 +76,6 @@
76
76
  "directory": "packages/omc-cli"
77
77
  },
78
78
  "optionalDependencies": {
79
- "@stalfh233/omc-fake-platform": "0.8.8"
79
+ "@stalfh233/omc-fake-platform": "0.8.9"
80
80
  }
81
81
  }
@@ -13,7 +13,7 @@ description: 一页纸业务场景步骤清单(采购申请 / 请假审批 /
13
13
 
14
14
  1. `omc next "从零做采购申请:主子表、合计、条件审批、列表、按钮"` → `omc intent schema`
15
15
  2. `omc model-scaffold --app <app> --code <code> --name 采购申请 --fields '<JSON数组>' --apply`(字段含 `amount` NUMERICAL scale=2、`<主表code>_details` CHILD_TABLE 及 item/qty/price/lineAmount 子列;子表 code 必须全局唯一)
16
- 3. (`model-scaffold` 已在第 2 步完成字段发布与表单发布;无需另起命令)
16
+ 3. (第 2 步已含字段/表单发布,无需另起命令)
17
17
  4. `omc compute --schema <code> --target amount --formula 'SUM({<主表code>_details.lineAmount})' --apply`(⚠️ 只在门户算,REST 不回填)
18
18
  5. 条件审批(金额>50000 两级):**不要** `approval-flow --condition`(无此参数)。线性先:`omc approval-flow --schema <code> --steps '经理@role:<mgr>' --steps '总监@role:<dir>' --apply`;条件分流改 `omc describe workflow.update --example workflow-conditional-branch` 后 `workflow.update`。
19
19
  6. 发起权限:`omc call workflow.addPermission --args '{"workflowCode":"<code>_wf","unitId":"<deptOrRoleId>","unitType":1}'`(这是**谁能发起**,不是行级可见范围)
@@ -48,7 +48,7 @@ description: 一页纸业务场景步骤清单(采购申请 / 请假审批 /
48
48
  ## 清理顺序(cleanup)
49
49
 
50
50
  - 数据 → 流程 → 模型:先 `data.delete`;删流程前清列表 `add` 绑定(首次 publish 自动绑;303024 用 `listviewBinding.unbindCommand`)。
51
- - 视图随模型级联(末条不可删);删模型看 `deleteTask.taskStatus`。
51
+ - 视图随模型级联,最后一条不可单删;不单列清理步骤,删模型看 `deleteTask.taskStatus`。
52
52
 
53
53
  ## 读法
54
54