@stalfh233/omc-cli 0.6.71 → 0.6.72

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.
@@ -806,6 +806,65 @@ function controlCount(face) {
806
806
  return 0;
807
807
  }
808
808
  }
809
+ /**
810
+ * R75-B 续(2026-11-18):发布降级守卫(草稿控件数 < 已发布面 → 拒绝提拔)的
811
+ * **唯一实现**。真写与 `form.publish --dry-run` 共用本函数:此前该门只活在
812
+ * execute 里,空/残草稿的 dry-run 是绿灯,真写才拒 form-publish-degrade。
813
+ */
814
+ export function assertPublishNotDegrading(draftAttributesJson, publishedAttributesJson, args) {
815
+ if (args.allowDegrade === true)
816
+ return;
817
+ const draftControls = controlCount(draftAttributesJson);
818
+ const publishedControls = controlCount(publishedAttributesJson);
819
+ if (draftControls >= publishedControls)
820
+ return;
821
+ throw new ToolRefusalError({
822
+ status: "refused",
823
+ blocker: "form-publish-degrade",
824
+ schemaCode: args.schemaCode,
825
+ sheetCode: args.sheetCode,
826
+ draftControlCount: draftControls,
827
+ publishedControlCount: publishedControls,
828
+ message: `草稿面控件数(${draftControls})少于已发布面(${publishedControls})——拒绝降级提拔。平台设计器 Save 会清空草稿(非无损);恢复路径是表单版本历史 /api/api/app/bizsheet/history/list 取回完好版本的 view/attributes 原文重写草稿后再发布。确要减少控件请显式传 allowDegrade:true`,
829
+ });
830
+ }
831
+ /**
832
+ * `form.publish --dry-run` 的只读预览:不建草稿、不提拔,只回答两件事——
833
+ * ① 当前草稿会不会被降级门拒(与真写同一函数);② 这次发布是否真的会改东西。
834
+ * 无草稿 / rebuild:true 时真写会先造/重建草稿,预览无法模拟其控件数,如实标注。
835
+ */
836
+ export async function lintFormPublishReadOnly(session, args) {
837
+ const sheetCode = args.sheetCode ?? args.schemaCode;
838
+ const sheet = await readFormOrNull(session, args.schemaCode, sheetCode);
839
+ const publishedControls = sheet === null ? 0 : controlCount(sheet.publishedAttributesJson);
840
+ if (sheet === null)
841
+ return { wouldChange: true, sheetPresent: false, note: "表单不存在:真写会先按已发布字段造默认表单再提拔(预览不建表单)" };
842
+ const hasDraft = typeof sheet.draftViewJson === "string" && typeof sheet.draftAttributesJson === "string";
843
+ if (args.rebuild === true)
844
+ return {
845
+ wouldChange: true,
846
+ sheetPresent: true,
847
+ draftPresent: hasDraft,
848
+ publishedControlCount: publishedControls,
849
+ note: "rebuild:true 会先丢弃草稿并按已发布字段重建——重建后的控件数预览无法模拟,降级门留给真写(本地其余门与真写同源)",
850
+ };
851
+ if (!hasDraft)
852
+ return { wouldChange: true, sheetPresent: true, draftPresent: false, publishedControlCount: publishedControls, note: "当前无草稿:真写会先按已发布字段造草稿再提拔(预览不建草稿)" };
853
+ assertPublishNotDegrading(sheet.draftAttributesJson, sheet.publishedAttributesJson, { schemaCode: args.schemaCode, sheetCode, ...(args.allowDegrade !== undefined ? { allowDegrade: args.allowDegrade } : {}) });
854
+ const draftEqualsPublished = sheet.draftViewJson === sheet.publishedViewJson &&
855
+ sheet.draftAttributesJson === sheet.publishedAttributesJson &&
856
+ (sheet.draftHtmlJson === undefined || sheet.draftHtmlJson === sheet.publishedHtmlJson);
857
+ return {
858
+ wouldChange: !(sheet.published === true && draftEqualsPublished && args.force !== true),
859
+ sheetPresent: true,
860
+ draftPresent: true,
861
+ draftControlCount: controlCount(sheet.draftAttributesJson),
862
+ publishedControlCount: publishedControls,
863
+ draftEqualsPublished,
864
+ alreadyPublished: sheet.published === true && draftEqualsPublished,
865
+ note: "降级门与真写同一函数;alreadyPublished:true 时真写会短路(不改发布面)",
866
+ };
867
+ }
809
868
  /**
810
869
  * Shared form.draft write body — read the current sheet, compose a scaffold
811
870
  * from published fields when the form is empty, and POST the proven payload
@@ -1670,21 +1729,7 @@ export async function executeFormPublishWrite(session, args) {
1670
1729
  // controls than the already-published face. The platform designer's Save
1671
1730
  // clears the draft faces to "[]"/"{}" (non-lossless); promoting that empty
1672
1731
  // draft is exactly how the 13-control loss happened. Escape: allowDegrade:true.
1673
- if (args.allowDegrade !== true) {
1674
- const draftControls = controlCount(pre.draftAttributesJson);
1675
- const publishedControls = controlCount(pre.publishedAttributesJson);
1676
- if (draftControls < publishedControls) {
1677
- throw new ToolRefusalError({
1678
- status: "refused",
1679
- blocker: "form-publish-degrade",
1680
- schemaCode: args.schemaCode,
1681
- sheetCode: args.sheetCode,
1682
- draftControlCount: draftControls,
1683
- publishedControlCount: publishedControls,
1684
- message: `草稿面控件数(${draftControls})少于已发布面(${publishedControls})——拒绝降级提拔。平台设计器 Save 会清空草稿(非无损);恢复路径是表单版本历史 /api/api/app/bizsheet/history/list 取回完好版本的 view/attributes 原文重写草稿后再发布。确要减少控件请显式传 allowDegrade:true`,
1685
- });
1686
- }
1687
- }
1732
+ assertPublishNotDegrading(pre.draftAttributesJson, pre.publishedAttributesJson, { schemaCode: args.schemaCode, sheetCode: args.sheetCode, ...(args.allowDegrade !== undefined ? { allowDegrade: args.allowDegrade } : {}) });
1688
1733
  // Buttons ride `options.customButtonJson`; the platform converts them into
1689
1734
  // h_biz_button(triggerType=FORM) rows during THIS publish call
1690
1735
  // (ModelManagementFacadeImpl.publishBizForm:1022). Passing them here is the
@@ -725,6 +725,24 @@ export function registerFieldLane(tools) {
725
725
  codes: z.array(z.string().min(1)).optional().describe("optional list of fields to verify; publishing is model-scoped, do NOT call once per field"),
726
726
  },
727
727
  execute: async (session, args) => executeFieldPublish(session, args),
728
+ // R75-B 续:dry-run 与真写共用关系目标悬空诊断(关系字段指向已删模型时
729
+ // 真写必拒 relation-target-not-found;此前 dry-run 看不出来)。
730
+ dryRunPayload: async (session, args) => {
731
+ const candidates = await assertFieldPublishRelations(session, args.schemaCode);
732
+ const requested = [...(args.code ? [args.code] : []), ...(args.codes ?? [])];
733
+ const publishedRows = wireRows((await wireCall(session, { path: ENDPOINTS.fieldList, query: { schemaCode: args.schemaCode, isPublish: "true" } })).data);
734
+ const published = publishedRows.map((row) => String(row.code ?? row.propertyCode ?? "")).filter((code) => code !== "");
735
+ return {
736
+ wouldChange: requested.length === 0 || !requested.every((code) => published.includes(code)),
737
+ schemaCode: args.schemaCode,
738
+ ...(requested.length > 0 ? { requested } : {}),
739
+ alreadyPublished: requested.length > 0 ? requested.filter((code) => published.includes(code)) : undefined,
740
+ relationTargetsChecked: candidates.length,
741
+ note: "关系目标悬空已按真写同门检查;发布是模型级(一次发布该模型全部草稿字段),alreadyPublished 只说明这些 code 已在发布面。",
742
+ };
743
+ },
744
+ lintScope: "full",
745
+ lintUnchecked: ["platform-publish-self-check", "post-write-readback"],
728
746
  });
729
747
  writeTool({
730
748
  tools,
@@ -1639,6 +1657,22 @@ function signPartialDelivery(missing, nonexistent, stillDraft) {
1639
1657
  parts.push(`${stillDraft.join("、")} 模型里有但发布后仍不在发布面:按发布失败排查(查看平台日志后重试本工具,模型级发布可重复执行)`);
1640
1658
  return `部分交付(unpublishedRequested: ${missing.join("、")}):已发布的字段确实已发布,但这些请求的 code 不在发布面。${parts.join(";")}`;
1641
1659
  }
1660
+ /**
1661
+ * R75-B 续(2026-11-18):field.publish 的关系目标悬空诊断(只读)。
1662
+ *
1663
+ * 旧行为只在真写前跑:`field.publish --dry-run` 绿灯、真写拒
1664
+ * relation-target-not-found(尤其是「级联链第二跳」——关联字段指向的模型
1665
+ * 已被删)。dry-run 与真写共用本函数,答案同源。
1666
+ *
1667
+ * 返回 relationCandidates 供调用方回执引用(哪些模型 code 可作为目标)。
1668
+ */
1669
+ async function assertFieldPublishRelations(session, schemaCode) {
1670
+ const relationCandidates = await modelSchemaCodes(session);
1671
+ const relationFailure = relationPublishFailureMessage(wireRows((await wireCall(session, { path: ENDPOINTS.fieldList, query: { schemaCode, isPublish: "false" } })).data), relationCandidates);
1672
+ if (relationFailure)
1673
+ throw new ToolRefusalError({ status: "refused", blocker: "relation-target-not-found", schemaCode, message: relationFailure, candidates: relationCandidates.slice(0, 5) });
1674
+ return relationCandidates;
1675
+ }
1642
1676
  export async function executeFieldPublish(session, args) {
1643
1677
  // bizproperty/publish is MODEL-SCOPED: one call publishes every draft
1644
1678
  // field of the schema. `code`/`codes` only select which fields to verify
@@ -1693,10 +1727,7 @@ export async function executeFieldPublish(session, args) {
1693
1727
  // Older servers accept a dangling relation row and only reveal it as the
1694
1728
  // misleading 300010 at model publish. Inspect the draft before POST so an
1695
1729
  // existing poisoned model gets the same field-specific diagnosis as create.
1696
- const relationCandidates = await modelSchemaCodes(session);
1697
- const relationFailure = relationPublishFailureMessage(wireRows((await wireCall(session, { path: ENDPOINTS.fieldList, query: { schemaCode: args.schemaCode, isPublish: "false" } })).data), relationCandidates);
1698
- if (relationFailure)
1699
- throw new ToolRefusalError({ status: "refused", blocker: "relation-target-not-found", schemaCode: args.schemaCode, message: relationFailure, candidates: relationCandidates.slice(0, 5) });
1730
+ const relationCandidates = await assertFieldPublishRelations(session, args.schemaCode);
1700
1731
  // r29e F10/F11:旧短路只看「code 在发布面存在」,改了 options 仍报
1701
1732
  // already-published + verification.ok(假绿)。再比草稿/发布 options 指纹;
1702
1733
  // 不一致就真发布。name/type 仍由 verifyFieldDetails 核对。
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { ENDPOINTS } from "../endpoints.js";
3
3
  import { decodeButtonScript } from "./list-view.js";
4
- import { executeFormDraftWrite, executeFormPublishWrite, executeFormRunButtonWrite, readFormButtons, readFormOrNull, refuseEmptyCallerLayout, validateHtmlRender, customButtonJsonStoredShape, CUSTOM_BUTTON_JSON_STRING_SHAPE_WARNING } from "../form-support.js";
4
+ import { executeFormDraftWrite, executeFormPublishWrite, executeFormRunButtonWrite, lintFormPublishReadOnly, readFormButtons, readFormOrNull, refuseEmptyCallerLayout, validateHtmlRender, customButtonJsonStoredShape, CUSTOM_BUTTON_JSON_STRING_SHAPE_WARNING } from "../form-support.js";
5
5
  import { capabilityArg, environmentArg } from "../args.js";
6
6
  import { governedRead } from "../read.js";
7
7
  import { writeTool } from "../write.js";
@@ -368,6 +368,18 @@ export function registerFormLane(tools) {
368
368
  buttonScripts: z.array(z.object({ code: z.string().min(1), script: z.string() })).optional().describe("直接改已有表单按钮的脚本(actionConfig.scriptData),按 code 逐字替换;未知 code 拒绝。不必重发整表"),
369
369
  },
370
370
  execute: async (session, args) => executeFormPublishWrite(session, { ...args, sheetCode: resolveSheetCode(args.schemaCode, args.sheetCode) }),
371
+ // R75-B 续:降级守卫(草稿控件数 < 发布面)此前只在真写里——空/残草稿的
372
+ // dry-run 是绿灯,真写才拒(设计器 Save 清空草稿时最易踩)。预览跑同一个
373
+ // assertPublishNotDegrading;rebuild/无草稿时如实标注「未模拟重建后形状」。
374
+ dryRunPayload: async (session, args) => lintFormPublishReadOnly(session, {
375
+ schemaCode: args.schemaCode,
376
+ sheetCode: resolveSheetCode(args.schemaCode, args.sheetCode),
377
+ ...(args.allowDegrade !== undefined ? { allowDegrade: args.allowDegrade } : {}),
378
+ ...(args.rebuild !== undefined ? { rebuild: args.rebuild } : {}),
379
+ ...(args.force !== undefined ? { force: args.force } : {}),
380
+ }),
381
+ lintScope: "partial",
382
+ lintUnchecked: ["rebuild-rebuilt-draft-shape", "draft-materialisation", "platform-publish-self-check", "post-write-readback"],
371
383
  });
372
384
  registerPackageTool(tools, {
373
385
  name: "configure_form",
@@ -931,6 +931,93 @@ export function registerModelLane(tools) {
931
931
  lintUnchecked: ["platform-side-validation", "post-write-readback"],
932
932
  rollback: modelRollbackSpec("model.delete"),
933
933
  });
934
+ /**
935
+ * R75-B 续(2026-11-18):model.deleteMany 的**只读前置门**——逐目标解析、
936
+ * 缺席判定、以及整批入站引用扫描(破坏性批量删此前 dry-run 全盲,调查 B 的
937
+ * P0 候选)。dry-run 与真写共用本函数:批里被别的模型引用时,两边同拒
938
+ * model-referenced-by,且零副作用。
939
+ */
940
+ async function lintModelDeleteMany(session, args) {
941
+ const readRecord = (schemaCode) => readModelRecord(session, schemaCode);
942
+ const applicationCode = await resolveApplicationCode(session, args.applicationCode).catch(() => "");
943
+ const targets = [...new Set(args.schemaCodes)];
944
+ const alreadyAbsent = [];
945
+ const entries = [];
946
+ const unresolved = [];
947
+ // Ticket 68: resolve each model's app-tree node across applications; the
948
+ // tree id (AppFunction id) is what physically_delete needs. Collect the
949
+ // resolved trees for the sibling scan (cross-application references too).
950
+ const resolvedTrees = [];
951
+ const seenTrees = new Set();
952
+ const appsToScan = new Set();
953
+ for (const code of targets) {
954
+ const resolved = await resolveModelTreeNode(session, code, args.applicationCode);
955
+ appsToScan.add(resolved.applicationCode);
956
+ if (!seenTrees.has(resolved.applicationCode) && resolved.treeRows.length > 0) {
957
+ seenTrees.add(resolved.applicationCode);
958
+ resolvedTrees.push(...resolved.treeRows);
959
+ }
960
+ if (resolved.node?.id) {
961
+ entries.push({ id: resolved.node.id, code, type: "BizModel" });
962
+ }
963
+ else if ((await readRecord(code)) === null) {
964
+ alreadyAbsent.push(code);
965
+ }
966
+ else {
967
+ unresolved.push(code);
968
+ }
969
+ }
970
+ if (unresolved.length > 0) {
971
+ throw new ToolRefusalError({
972
+ status: "refused",
973
+ blocker: "model-application-unresolved",
974
+ unresolved,
975
+ message: `批量删除被拒(零副作用):${unresolved.join("、")} 的业务模型记录仍存在但在任何应用树中都找不到节点(AppFunction)——physically_delete 需要 AppFunction id,不能拿业务模型记录 id 猜测。请显式传 applicationCode,或先用 discover_environment 确认归属应用。`,
976
+ });
977
+ }
978
+ const treeRowList = resolvedTrees;
979
+ // Per-target inbound-reference precheck (ticket 23 semantics, scanned
980
+ // once per sibling across all batch targets). Siblings INSIDE the batch
981
+ // are being deleted together and therefore do not block.
982
+ const batchSet = new Set(targets);
983
+ const siblings = treeRowList
984
+ .filter((row) => row.type === "BizModel" && typeof row.code === "string" && !batchSet.has(String(row.code)))
985
+ .map((row) => ({ schemaCode: String(row.code), name: typeof row.name === "string" && row.name ? row.name : String(row.code) }));
986
+ const blockedTargets = [];
987
+ for (const sibling of siblings) {
988
+ const hitsByTarget = new Map();
989
+ for (const isPublish of ["false", "true"]) {
990
+ const listed = await wireCall(session, { path: ENDPOINTS.fieldList, query: { schemaCode: sibling.schemaCode, isPublish } });
991
+ for (const row of wireRows(listed.data)) {
992
+ const target = relationTargetOf(row);
993
+ if (target === undefined || !batchSet.has(target))
994
+ continue;
995
+ const code = row.code ?? row.propertyCode;
996
+ if (typeof code !== "string")
997
+ continue;
998
+ const hits = hitsByTarget.get(target) ?? [];
999
+ if (!hits.some((field) => field.code === code))
1000
+ hits.push({ code, type: row.type ?? row.propertyType });
1001
+ hitsByTarget.set(target, hits);
1002
+ }
1003
+ }
1004
+ for (const [target, fields] of hitsByTarget) {
1005
+ const blocked = blockedTargets.find((entry) => entry.schemaCode === target) ?? { schemaCode: target, referencingModels: [] };
1006
+ blocked.referencingModels.push({ schemaCode: sibling.schemaCode, name: sibling.name, fields });
1007
+ if (!blockedTargets.includes(blocked))
1008
+ blockedTargets.push(blocked);
1009
+ }
1010
+ }
1011
+ if (blockedTargets.length > 0) {
1012
+ throw new ToolRefusalError({
1013
+ status: "refused",
1014
+ blocker: "model-referenced-by",
1015
+ blockedTargets,
1016
+ message: `批量删除被拒(零副作用):${blockedTargets.map((blocked) => `${blocked.schemaCode} 被模型 ${blocked.referencingModels.map((model) => model.schemaCode).join("、")} 的关联字段引用`).join(";")}。依赖倒序清理:把引用方模型一并纳入 schemaCodes(或先删其关联字段);引用方物理删除的逐列异步级联需 40-60s,完成后再删被引用模型。`,
1017
+ });
1018
+ }
1019
+ return { targets, alreadyAbsent, entries, treeRowList, appsToScan, applicationCode };
1020
+ }
934
1021
  writeTool({
935
1022
  tools,
936
1023
  name: "model.deleteMany",
@@ -946,84 +1033,10 @@ export function registerModelLane(tools) {
946
1033
  // every existing model in that single request after prechecking each
947
1034
  // target's inbound references — a referenced model refuses the whole
948
1035
  // batch with per-target evidence and ZERO side effects.
1036
+ // R75-B 续:解析/缺席判定/整批引用扫描全部在 lintModelDeleteMany(与
1037
+ // dry-run 同源),这里只做「已经过门」之后的写。
1038
+ const { targets, alreadyAbsent, entries, appsToScan, applicationCode } = await lintModelDeleteMany(session, args);
949
1039
  const readRecord = (schemaCode) => readModelRecord(session, schemaCode);
950
- const applicationCode = await resolveApplicationCode(session, args.applicationCode).catch(() => "");
951
- const targets = [...new Set(args.schemaCodes)];
952
- const alreadyAbsent = [];
953
- const entries = [];
954
- const unresolved = [];
955
- // Ticket 68: resolve each model's app-tree node across applications; the
956
- // tree id (AppFunction id) is what physically_delete needs. Collect the
957
- // resolved trees for the sibling scan (cross-application references too).
958
- const resolvedTrees = [];
959
- const seenTrees = new Set();
960
- const appsToScan = new Set();
961
- for (const code of targets) {
962
- const resolved = await resolveModelTreeNode(session, code, args.applicationCode);
963
- appsToScan.add(resolved.applicationCode);
964
- if (!seenTrees.has(resolved.applicationCode) && resolved.treeRows.length > 0) {
965
- seenTrees.add(resolved.applicationCode);
966
- resolvedTrees.push(...resolved.treeRows);
967
- }
968
- if (resolved.node?.id) {
969
- entries.push({ id: resolved.node.id, code, type: "BizModel" });
970
- }
971
- else if ((await readRecord(code)) === null) {
972
- alreadyAbsent.push(code);
973
- }
974
- else {
975
- unresolved.push(code);
976
- }
977
- }
978
- if (unresolved.length > 0) {
979
- throw new ToolRefusalError({
980
- status: "refused",
981
- blocker: "model-application-unresolved",
982
- unresolved,
983
- message: `批量删除被拒(零副作用):${unresolved.join("、")} 的业务模型记录仍存在但在任何应用树中都找不到节点(AppFunction)——physically_delete 需要 AppFunction id,不能拿业务模型记录 id 猜测。请显式传 applicationCode,或先用 discover_environment 确认归属应用。`,
984
- });
985
- }
986
- const treeRowList = resolvedTrees;
987
- // Per-target inbound-reference precheck (ticket 23 semantics, scanned
988
- // once per sibling across all batch targets). Siblings INSIDE the batch
989
- // are being deleted together and therefore do not block.
990
- const batchSet = new Set(targets);
991
- const siblings = treeRowList
992
- .filter((row) => row.type === "BizModel" && typeof row.code === "string" && !batchSet.has(String(row.code)))
993
- .map((row) => ({ schemaCode: String(row.code), name: typeof row.name === "string" && row.name ? row.name : String(row.code) }));
994
- const blockedTargets = [];
995
- for (const sibling of siblings) {
996
- const hitsByTarget = new Map();
997
- for (const isPublish of ["false", "true"]) {
998
- const listed = await wireCall(session, { path: ENDPOINTS.fieldList, query: { schemaCode: sibling.schemaCode, isPublish } });
999
- for (const row of wireRows(listed.data)) {
1000
- const target = relationTargetOf(row);
1001
- if (target === undefined || !batchSet.has(target))
1002
- continue;
1003
- const code = row.code ?? row.propertyCode;
1004
- if (typeof code !== "string")
1005
- continue;
1006
- const hits = hitsByTarget.get(target) ?? [];
1007
- if (!hits.some((field) => field.code === code))
1008
- hits.push({ code, type: row.type ?? row.propertyType });
1009
- hitsByTarget.set(target, hits);
1010
- }
1011
- }
1012
- for (const [target, fields] of hitsByTarget) {
1013
- const blocked = blockedTargets.find((entry) => entry.schemaCode === target) ?? { schemaCode: target, referencingModels: [] };
1014
- blocked.referencingModels.push({ schemaCode: sibling.schemaCode, name: sibling.name, fields });
1015
- if (!blockedTargets.includes(blocked))
1016
- blockedTargets.push(blocked);
1017
- }
1018
- }
1019
- if (blockedTargets.length > 0) {
1020
- throw new ToolRefusalError({
1021
- status: "refused",
1022
- blocker: "model-referenced-by",
1023
- blockedTargets,
1024
- message: `批量删除被拒(零副作用):${blockedTargets.map((blocked) => `${blocked.schemaCode} 被模型 ${blocked.referencingModels.map((model) => model.schemaCode).join("、")} 的关联字段引用`).join(";")}。依赖倒序清理:把引用方模型一并纳入 schemaCodes(或先删其关联字段);引用方物理删除的逐列异步级联需 40-60s,完成后再删被引用模型。`,
1025
- });
1026
- }
1027
1040
  if (entries.length === 0) {
1028
1041
  return { performed: { skipped: "already-absent", alreadyAbsent }, readback: { perCode: Object.fromEntries(targets.map((code) => [code, { absent: true }])), allAbsent: true } };
1029
1042
  }
@@ -1075,6 +1088,24 @@ export function registerModelLane(tools) {
1075
1088
  throw new ToolRefusalError({ status: "refused", blocker: "model-delete-many-invalid", message: "schemaCodes 必须是非空、去重的模型 code 数组" });
1076
1089
  }
1077
1090
  },
1091
+ // R75-B 续:破坏性批量删的 dry-run 此前全盲(调查 B 的 P0 候选)。现在与
1092
+ // 真写共用 lintModelDeleteMany:解析失败 / 批内被引用都会在预览里同拒,
1093
+ // 而不是「wouldChange:true」后真写 refused。
1094
+ dryRunPayload: async (session, args) => {
1095
+ const { targets, alreadyAbsent, entries } = await lintModelDeleteMany(session, args);
1096
+ if (entries.length === 0) {
1097
+ return { wouldChange: false, alreadyAbsent, targets, note: "上述模型已缺席(幂等:真写会 skipped already-absent,零副作用)" };
1098
+ }
1099
+ return {
1100
+ wouldChange: true,
1101
+ targets,
1102
+ deleteIds: entries.length,
1103
+ ...(alreadyAbsent.length > 0 ? { alreadyAbsent } : {}),
1104
+ cascadeNote: "每个模型的字段/表单/列表视图/数据规则/平台预置规则与运行数据都会随之级联清除;批内互相引用的模型可以一起删,批外引用方会整批拒绝。",
1105
+ };
1106
+ },
1107
+ lintScope: "full",
1108
+ lintUnchecked: ["platform-async-cascade", "post-write-readback"],
1078
1109
  });
1079
1110
  writeTool({
1080
1111
  tools,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stalfh233/omc-cli",
3
- "version": "0.6.71",
3
+ "version": "0.6.72",
4
4
  "description": "CloudPivot 8.6 configuration capability CLI — governed, fail-closed, coverage-manifest bounded.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -56,7 +56,7 @@
56
56
  },
57
57
  "dependencies": {
58
58
  "commander": "14.0.3",
59
- "omc-core": "0.6.71",
59
+ "omc-core": "0.6.72",
60
60
  "proper-lockfile": "4.1.2",
61
61
  "write-file-atomic": "6.0.0",
62
62
  "zod": "^3.23.8",
@@ -74,6 +74,6 @@
74
74
  "directory": "packages/omc-cli"
75
75
  },
76
76
  "optionalDependencies": {
77
- "@stalfh233/omc-fake-platform": "0.6.71"
77
+ "@stalfh233/omc-fake-platform": "0.6.72"
78
78
  }
79
79
  }