@stalfh233/omc-cli 0.8.33 → 0.8.34

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.
@@ -255,7 +255,7 @@ export const FIELD_LANE_CONTRACT = Object.freeze({
255
255
  wire: Object.freeze({
256
256
  acceptedFamilies: FIELD_FAMILY_LIST,
257
257
  blockedFamilies: "OCR, ELECTRONIC_SIGN, nested CHILD_TABLE",
258
- childTableSubSchema: '{"code":"<父字段 code>","properties":[{"code","name","schemaCode":"<父字段 code>","propertyType","propertyEmpty","sortKey"}]}',
258
+ childTableSubSchema: '{"code":"<父字段 code>","properties":[{"code","name","schemaCode":"<父字段 code>","propertyType","propertyEmpty","sortKey"}]}(这是写面形状;field.list full:true 回的是平台未装配壳,code/name/published 可能为空,不是子表不存在——父字段 code 即子 schema code)',
259
259
  childTableFormControl: "Sheet(201) with columns[{type,width,key,parentKey,options}]; child column keys never enter viewJson",
260
260
  dateDefaultOptions: JSON.stringify(FIELD_DATE_DEFAULT_OPTIONS),
261
261
  dateFormat: JSON.stringify({
@@ -387,6 +387,76 @@ function parseFieldOptionsForReadback(options) {
387
387
  return decoded;
388
388
  }
389
389
  }
390
+ /**
391
+ * F1/F2(探针 Y,0.8.34):全文面(`full:true`)的子表 `subSchema` 是平台原始载荷。
392
+ * 2.1.5 `BizPropertyController.java:440` / `BizPropertyVO.java:19-20` /
393
+ * `BizPropertyModel.java:105,779` 把 `options` 当 String 存,子列 `options` 因此
394
+ * 是 JSON 字符串(`mappings` 也是串);读面复用顶层字段的解码,原文留在
395
+ * `optionsRaw`(与 `mappingsRaw` 同款)。壳检测只看 code:2.1.5 的 list 只
396
+ * `setVoproperties`(`BizPropertyController.java:453,458`),真机 code/name/
397
+ * published/parentSchema 全空——此时补 `subSchemaCode`/`subSchemaShell`/note,
398
+ * 但不改原载荷。
399
+ */
400
+ function decodeSubSchemaForReadback(subSchema) {
401
+ let parsed = subSchema;
402
+ if (typeof parsed === "string") {
403
+ try {
404
+ parsed = JSON.parse(parsed);
405
+ }
406
+ catch {
407
+ return { subSchema, shell: false };
408
+ }
409
+ }
410
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed))
411
+ return { subSchema: parsed, shell: false };
412
+ const record = parsed;
413
+ const rawProperties = record.properties;
414
+ let changed = false;
415
+ const properties = Array.isArray(rawProperties)
416
+ ? rawProperties.map((child) => {
417
+ if (child === null || typeof child !== "object" || Array.isArray(child))
418
+ return child;
419
+ const row = child;
420
+ if (row.options === undefined || row.options === null)
421
+ return child;
422
+ const decoded = parseFieldOptionsForReadback(row.options);
423
+ const optionsRaw = typeof row.options === "string" ? row.options : undefined;
424
+ // 非 JSON 串按 passthrough 保留原值;`optionsRaw` 仍记录平台原文
425
+ // (GPT 复审 2026-12-02:不能因为解不开就丢掉「原文是什么」)。
426
+ if (decoded === row.options && optionsRaw === undefined)
427
+ return child;
428
+ changed = true;
429
+ return { ...row, options: decoded, ...(optionsRaw !== undefined ? { optionsRaw } : {}) };
430
+ })
431
+ : rawProperties;
432
+ return {
433
+ subSchema: changed ? { ...record, properties } : record,
434
+ shell: String(record.code ?? "").trim() === "",
435
+ };
436
+ }
437
+ /**
438
+ * F4(探针 Y,0.8.34):字段行 published:true 但选项级 `published:false`。
439
+ * `field-families` 生成 custom 选项时固定 `published:false`(8.1 兼容形态),
440
+ * 字段/表单发布不会重写这个标记;运行时 REST 按 code/value 接受。门户 UI 是否
441
+ * 使用该标记未验证——只给读数与边界,不断言门户也忽略。
442
+ */
443
+ function hasUnpublishedCustomOptions(options) {
444
+ if (options === null || typeof options !== "object" || Array.isArray(options))
445
+ return false;
446
+ let optionsSet = options.optionsSet;
447
+ if (typeof optionsSet === "string") {
448
+ try {
449
+ optionsSet = JSON.parse(optionsSet);
450
+ }
451
+ catch {
452
+ return false;
453
+ }
454
+ }
455
+ if (optionsSet === null || typeof optionsSet !== "object" || Array.isArray(optionsSet))
456
+ return false;
457
+ const custom = optionsSet.custom;
458
+ return Array.isArray(custom) && custom.some((entry) => entry !== null && typeof entry === "object" && entry.published === false);
459
+ }
390
460
  /**
391
461
  * 探针 D F9(0.8.9):字段行 `options.mappings` 存在 = 关联填充配置。
392
462
  * 平台存储形态是 options.mappings 的 **JSON 字符串**(`WorkSheetPropertyMapping[]`,
@@ -717,7 +787,19 @@ export function registerFieldLane(tools) {
717
787
  // 37.6 KB for a 5-code answer).
718
788
  ...(row.subSchema !== undefined && row.subSchema !== null
719
789
  ? args.full === true
720
- ? { subSchema: row.subSchema }
790
+ ? (() => {
791
+ const decoded = decodeSubSchemaForReadback(row.subSchema);
792
+ return {
793
+ subSchema: decoded.subSchema,
794
+ ...(decoded.shell
795
+ ? {
796
+ subSchemaCode: String(fieldCode),
797
+ subSchemaShell: true,
798
+ subSchemaNote: "平台 2.1.5 的 bizproperty/list 只装配父 CHILD_TABLE 行的 subSchema 壳(code/name/published/parentSchema 为空/缺省),不是「子表不存在」:子表 schema code = 本父字段 code;发布态看父字段行 published 与子列行(schemaCode=该 code 的 field.list)。",
799
+ }
800
+ : {}),
801
+ };
802
+ })()
721
803
  : (() => {
722
804
  const subColumns = childColumnsOf(row.subSchema);
723
805
  const businessColumns = subColumns.filter((column) => column.system !== true).length;
@@ -761,6 +843,14 @@ export function registerFieldLane(tools) {
761
843
  const mappingRuntimeNote = detailed && visible.some((field) => hasRelationMappings(field.options))
762
844
  ? FIELD_MAPPING_RUNTIME_NOTE
763
845
  : undefined;
846
+ // F4(探针 Y):只在实际把 options 送到调用方的详情面给读数——默认清单面
847
+ // 不带 options,在那里报告会变成「凭一次没读到的详情下结论」。
848
+ const optionPublishedFalseFields = detailed
849
+ ? visible
850
+ .filter((field) => field.published === true && hasUnpublishedCustomOptions(field.options))
851
+ .map((field) => String(field.code))
852
+ .filter((code) => code !== "")
853
+ : [];
764
854
  const projected = detailed
765
855
  ? visible
766
856
  : visible.map((field) => {
@@ -833,6 +923,12 @@ export function registerFieldLane(tools) {
833
923
  ...(selector.length > 0 ? { selected: selector } : {}),
834
924
  ...(args.all !== true ? { businessOnly: true } : {}),
835
925
  ...(mappingRuntimeNote !== undefined ? { mappingRuntimeNote } : {}),
926
+ ...(optionPublishedFalseFields.length > 0
927
+ ? {
928
+ optionPublishedFalseFields,
929
+ optionPublishedNote: "这些字段行 published:true,但 custom 选项带 published:false:字段/表单发布不重写选项级标记;2.1.5 REST 按 code/value 接受该选项(运行期 data.save/data.load 可用);字段是否生效看行级 published。门户 UI 是否使用该选项标记未验证——不要据此断言门户会/不会显示。",
930
+ }
931
+ : {}),
836
932
  ...(mappingRuntimeNote !== undefined
837
933
  ? {
838
934
  verification: verificationConfigOnly("portal", "仅证明字段映射配置已读回(字段行 options.mappings),未证明 REST 写会回填——data.save(/api/runtime/form/save)不跑 options.mappings,快照列需调用方自填。", { manual: "门户表单选择关联值,核对映射是否回填;REST data.save 不跑 options.mappings" }),
@@ -1231,11 +1231,22 @@ export function registerDataSubmit(tools) {
1231
1231
  }
1232
1232
  : {}),
1233
1233
  ...(startNote ? { startNote } : {}),
1234
- // P1(探针 H F3,复核 2026-11-27):
1234
+ // P1(探针 H F3,复核 2026-11-27)/ F6(探针 Y,0.8.34):
1235
1235
  // - 读失败 → dataRulesExecution:"unknown" + reason(与「无规则」可区分);
1236
- // - 有规则 → dataRulesNotExecuted(自动长度规则单列、hidden 行只分类不吞);
1237
- // - 无规则 → dataRulesExecution:"checked" 且不加提示键。
1238
- dataRulesExecution: dataRulesScan.kind === "unknown" ? "unknown" : "checked",
1236
+ // - 有规则但有条目本次不会执行 → "checked-with-skips" + dataRulesSkipped:true
1237
+ // (不再让 "checked" 与「未执行 N 条」同现自相矛盾);
1238
+ // - hidden 行按 hiddenSubmitCheck 扣除:2.1.x/8.8 的 submit 会执行它们,
1239
+ // 8.6.x/8.7/1.1.x 不执行;
1240
+ // - 无规则 → "checked" 且不加提示键。
1241
+ ...(() => {
1242
+ if (dataRulesScan.kind === "unknown")
1243
+ return { dataRulesExecution: "unknown" };
1244
+ const hiddenExecuted = dataRulesScan.context.hiddenSubmitCheck === "yes" ? dataRulesScan.hiddenRulesPresent : 0;
1245
+ const skipped = dataRulesScan.count - hiddenExecuted;
1246
+ return skipped > 0
1247
+ ? { dataRulesExecution: "checked-with-skips", dataRulesSkipped: true }
1248
+ : { dataRulesExecution: "checked" };
1249
+ })(),
1239
1250
  ...(dataRulesScan.kind === "unknown"
1240
1251
  ? { dataRulesExecutionReason: `bizdatarule/list 读取失败:${dataRulesScan.reason}——本次提交未执行门户数据规则校验(读面不可用,不代表没有规则)` }
1241
1252
  : {}),
@@ -409,6 +409,10 @@ export async function cmdModelScaffold(args) {
409
409
  name,
410
410
  fieldCount,
411
411
  declaredFieldCount: fields.length,
412
+ // F3(探针 Y,0.8.34):fieldCount/publishedFields 是「父模型业务字段 + 子表列」
413
+ // 的合计口径。父子拆开给读数,避免把「子表列也算成父模型业务字段」。
414
+ publishedParentFieldCount: fields.length,
415
+ publishedChildColumnCount: childColumnCount,
412
416
  createdFieldCount,
413
417
  alreadyPresentFieldCount,
414
418
  childColumnCount,
@@ -417,14 +421,14 @@ export async function cmdModelScaffold(args) {
417
421
  ? { childSchemas, childSchemaNote: "子表 schema code = 父 CHILD_TABLE 字段 code(平台规则):要 `pb_repair_items` 就把字段 code 命名为 `pb_repair_items`。" }
418
422
  : {}),
419
423
  failedFieldCount: failedFields.length,
420
- countsNote: "declaredFieldCount = 本次 --fields 声明的顶层字段数;createdFieldCount = 本次真正新写入的业务字段数(子表 attach 一并建出的子列计入 created,不记 skipped);alreadyPresentFieldCount = 本次开始前就已存在的字段数;fieldCount = 最终业务字段总数(declaredFieldCount + childColumnCount)。旧键 created/skipped 分别是 createdFieldCount/alreadyPresentFieldCount 的别名。",
424
+ countsNote: "declaredFieldCount = 本次 --fields 声明的顶层字段数;publishedParentFieldCount = 父模型业务字段数(=declaredFieldCount);publishedChildColumnCount = 子表列数(=childColumnCount);createdFieldCount = 本次真正新写入的业务字段数(子表 attach 一并建出的子列计入 created,不记 skipped);alreadyPresentFieldCount = 本次开始前就已存在的字段数;fieldCount = 最终业务字段总数(declaredFieldCount + childColumnCount)——**publishedFields 是同一合计口径,别把它当成父模型业务字段数**,父字段数看 declaredFieldCount/publishedParentFieldCount。旧键 created/skipped 分别是 createdFieldCount/alreadyPresentFieldCount 的别名。",
421
425
  created: createdFieldCount,
422
426
  skipped: alreadyPresentFieldCount,
423
427
  failed: failedFields.length,
424
428
  ...publishCounts,
425
429
  publishNote: publishingBlocked || fieldPublishFailed
426
430
  ? "未发布字段(有失败或被跳过);精确状态用 field.list"
427
- : `已执行 ${publishActions} 次模型级 field.publish(本次新建 ${publishCounts.fieldsPublishedEstimate} 个字段随发布覆盖;模型当前业务字段 ${fieldCount} 个都在发布面;精确清单用 field.list --published)`,
431
+ : `已执行 ${publishActions} 次模型级 field.publish(本次新建 ${publishCounts.fieldsPublishedEstimate} 个字段随发布覆盖;父模型业务字段 ${fields.length} 个 + 子表列 ${childColumnCount} 个(合计 ${fieldCount})都在发布面;精确清单用 field.list --published)`,
428
432
  ...(failedFields.length > 0 ? { failedFields } : {}),
429
433
  ...(failedSteps.length > 0 ? { failedSteps } : {}),
430
434
  ...(lastSummaries.length > 0 ? { summaries: lastSummaries } : {}),
package/dist/plan.js CHANGED
@@ -49,6 +49,17 @@ function smallStringPreview(value) {
49
49
  }
50
50
  return Object.keys(out).length > 0 ? out : undefined;
51
51
  }
52
+ /**
53
+ * F5(探针 Y,0.8.34):`formData` 的子表值是数组,`smallStringPreview` 只收标量,
54
+ * 于是 dry-run 静默省略子表行——调用方在提交前看不到「子表到底带了几行」。
55
+ * 只给 `{count, firstRow(标量, 400B 预算), omittedRows}`,不内联全部行;首行不是
56
+ * 对象/没有标量时不给 `firstRow`(不编造空对象)。
57
+ */
58
+ function childRowsPreview(rows) {
59
+ const first = rows[0];
60
+ const firstRow = smallStringPreview(first);
61
+ return { count: rows.length, ...(firstRow !== undefined ? { firstRow } : {}), omittedRows: Math.max(0, rows.length - (firstRow !== undefined ? 1 : 0)) };
62
+ }
52
63
  function summarizedArgs(tool, args) {
53
64
  if (typeof args.summary === "string" && typeof args.fingerprint === "string")
54
65
  return { ...args };
@@ -61,7 +72,18 @@ function summarizedArgs(tool, args) {
61
72
  }
62
73
  else if (Array.isArray(value) || (value && typeof value === "object") || typeof value === "string") {
63
74
  summary[`${key}Summary`] = summarizeValue(value);
64
- const preview = smallStringPreview(value);
75
+ let preview = smallStringPreview(value);
76
+ // F5:formData 的子表行是数组;只给行数和首行标量,别静默吞掉。
77
+ if (key === "formData" && value !== null && typeof value === "object" && !Array.isArray(value)) {
78
+ const childArrays = Object.entries(value).filter((entry) => Array.isArray(entry[1]));
79
+ if (childArrays.length > 0) {
80
+ preview ??= {};
81
+ for (const [childCode, rows] of childArrays.slice(0, 5))
82
+ preview[childCode] = childRowsPreview(rows);
83
+ if (childArrays.length > 5)
84
+ preview.omittedChildTables = childArrays.length - 5;
85
+ }
86
+ }
65
87
  if (preview !== undefined) {
66
88
  // 探针 O F4(0.8.21):关联映射的方向是「写反即配置错」的核心,dry-run 的
67
89
  // optionsPreview 必须能自查 source→target(原先只给 sha256 + 标量键)。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stalfh233/omc-cli",
3
- "version": "0.8.33",
3
+ "version": "0.8.34",
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.33",
61
+ "omc-core": "0.8.34",
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.33"
79
+ "@stalfh233/omc-fake-platform": "0.8.34"
80
80
  }
81
81
  }