@stalfh233/omc-cli 0.8.13 → 0.8.15
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/dist/artifacts.js +3 -2
- package/dist/call.js +31 -0
- package/dist/cli-output.js +19 -0
- package/dist/cli.js +186 -23
- package/dist/form-support.js +3 -1
- package/dist/human-summary.js +84 -2
- package/dist/intent/capabilities/datarule.js +126 -12
- package/dist/intent/cli.js +35 -2
- package/dist/intent/compare.js +18 -0
- package/dist/intent/plan-apply.js +19 -5
- package/dist/intent/plan-file.js +38 -0
- package/dist/intent/readback.js +3 -0
- package/dist/intent/schema.js +1 -1
- package/dist/lanes/datarule-contract.js +2 -1
- package/dist/lanes/datarule.js +59 -2
- package/dist/lanes/environment.js +43 -3
- package/dist/lanes/field-contract.js +1 -1
- package/dist/lanes/field.js +17 -2
- package/dist/lanes/form.js +1 -1
- package/dist/lanes/model-references.js +29 -1
- package/dist/lanes/runtime-data-contract.js +2 -2
- package/dist/lanes/runtime-data.js +328 -31
- package/dist/lanes/workflow.js +79 -2
- package/dist/model-purge.js +2 -13
- package/dist/mojibake.js +69 -0
- package/dist/read-shapes.js +2 -1
- package/dist/recipes/datarule.js +1 -0
- package/dist/recipes/form.js +2 -2
- package/dist/recipes/runtime-data.js +4 -4
- package/dist/stdout-pipe.js +78 -0
- package/dist/tool-types.js +10 -0
- package/dist/write.js +56 -7
- package/package.json +3 -3
- package/skills/omc-business-configuration.md +1 -1
- package/skills/omc-capabilities.md +1 -1
package/dist/lanes/field.js
CHANGED
|
@@ -8,7 +8,7 @@ import { writeTool } from "../write.js";
|
|
|
8
8
|
import { decodeJsonColumn, decodeJsonObjectColumn, JSON_COLUMN_NULL_COALESCE, JSON_COLUMN_PASSTHROUGH } from "../json-column.js";
|
|
9
9
|
import { syncFormConditionDataRules } from "./datarule.js";
|
|
10
10
|
import { FORM_CONDITION_OPTION_KEYS } from "./datarule-protocol.js";
|
|
11
|
-
import { defineTool, ToolRefusalError } from "../tool-types.js";
|
|
11
|
+
import { defineTool, isRequiredAlternativePlaceholder, ToolRefusalError } from "../tool-types.js";
|
|
12
12
|
import { wireCall, wireRows, WireError, optionPublishMessages } from "../wire.js";
|
|
13
13
|
import { assertTreeSelectionOptions } from "../field-tree-options.js";
|
|
14
14
|
import { executeFormDraftWrite, executeFormPublishWrite, readFormOrNull } from "../form-support.js";
|
|
@@ -833,15 +833,30 @@ export function registerFieldLane(tools) {
|
|
|
833
833
|
...fieldListTool,
|
|
834
834
|
name: "field.get",
|
|
835
835
|
search: { intents: ["读一个字段", "单个字段", "字段详情", "这个字段配置", "字段 options", "查字段详情"] },
|
|
836
|
-
description: "
|
|
836
|
+
description: "单/多字段读(= field.list + code 或 fields[])。options/subSchema 传 full:true。",
|
|
837
837
|
inputSchema: {
|
|
838
838
|
environment: environmentArg,
|
|
839
839
|
schemaCode: z.string(),
|
|
840
840
|
code: z.string(),
|
|
841
|
+
fields: z.array(z.string()).optional().describe("(与 code 互斥)"),
|
|
841
842
|
published: z.boolean().default(false),
|
|
842
843
|
full: z.boolean().optional().describe("同 field.list.full:完整 options/subSchema(含子表原始 subSchema)"),
|
|
843
844
|
capability: capabilityArg,
|
|
844
845
|
},
|
|
846
|
+
inputRefine: (value) => {
|
|
847
|
+
const fields = value.fields;
|
|
848
|
+
if (Array.isArray(fields) && fields.length > 0 && value.code !== undefined && !isRequiredAlternativePlaceholder(value.code))
|
|
849
|
+
return { path: "fields", message: "code 与 fields 互斥:单字段用 code,多字段用 fields:[...];两者只留一个" };
|
|
850
|
+
return undefined;
|
|
851
|
+
},
|
|
852
|
+
handler: async (ctx, args, self) => {
|
|
853
|
+
// 只传 fields[] 时 tool-types 的 required-alternatives 会给 code 补占位值
|
|
854
|
+
// (保持目录必填面稳定);这里剥掉,避免占位符混进 selected 回执。
|
|
855
|
+
const next = { ...args };
|
|
856
|
+
if (isRequiredAlternativePlaceholder(next.code))
|
|
857
|
+
delete next.code;
|
|
858
|
+
return fieldListTool.handler(ctx, next, self);
|
|
859
|
+
},
|
|
845
860
|
});
|
|
846
861
|
writeTool({
|
|
847
862
|
tools,
|
package/dist/lanes/form.js
CHANGED
|
@@ -580,7 +580,7 @@ export function registerFormLane(tools) {
|
|
|
580
580
|
includeSystem: z.boolean().optional(),
|
|
581
581
|
})
|
|
582
582
|
.optional()
|
|
583
|
-
.describe("增量布局(推荐):{rows:[[\"a\",\"b\"],[\"c\"]],spans?:{a:12},includeSystem?}。以已发布(无则草稿)表单为基线,只改 rows 行分组与这些控件 span,**不必回传整包 attrs**;未列入 rows 的控件保留原行,系统控件须 includeSystem:true 才动。与 draftViewJson/draftAttributesJson/rebuild 互斥"),
|
|
583
|
+
.describe("增量布局(推荐):{rows:[[\"a\",\"b\"],[\"c\"]],spans?:{a:12},includeSystem?}。以已发布(无则草稿)表单为基线,只改 rows 行分组与这些控件 span,**不必回传整包 attrs**;未列入 rows 的控件保留原行,系统控件须 includeSystem:true 才动。与 draftViewJson/draftAttributesJson/rebuild/fieldCodes/childColumns/refreshFromFields/fromReadback 互斥"),
|
|
584
584
|
allowTypeMismatch: z.boolean().optional().describe("放行控件 type 与字段 propertyType 不匹配(默认拒 form-control-type-mismatch;仅平台模板明确要求特殊控件时用)"),
|
|
585
585
|
draftHtmlJson: z.string().optional(),
|
|
586
586
|
fieldCodes: z.array(z.string().min(1)).optional().describe("脚手架绑定的已发布字段(按此顺序);由 configure_form/intent 显式传入。子表列写「父字段.子列」等价于 childColumns"),
|
|
@@ -113,6 +113,34 @@ export async function inboundModelReferences(session, targets, treeRows, options
|
|
|
113
113
|
left.via.localeCompare(right.via) ||
|
|
114
114
|
(left.childTable?.code ?? "").localeCompare(right.childTable?.code ?? ""));
|
|
115
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* The executable dependency order derived from `deletionSteps` — one entry per
|
|
118
|
+
* distinct target, in the order the caller must execute them. A model that
|
|
119
|
+
* references itself through a child-table column therefore appears as
|
|
120
|
+
* `field.delete:<child>.<col>` / `field.publish:<model>` / `model.delete:<model>`
|
|
121
|
+
* and `model.delete:<model>` shows up ONCE.
|
|
122
|
+
*
|
|
123
|
+
* Before F5 the model.delete refusal listed `[...referencing schemaCodes, target]`
|
|
124
|
+
* — for a self reference that collapsed to a single model code (`["pb_repair"]`),
|
|
125
|
+
* which named no executable unlink step (and the target itself). The historical
|
|
126
|
+
* duplicate `["pb_repair","pb_repair"]` came from model-purge's referrers
|
|
127
|
+
* concatenation before its F9 0.8.8 fix; both receipts now share this helper so
|
|
128
|
+
* they cannot drift.
|
|
129
|
+
*/
|
|
130
|
+
export function deletionOrderFromSteps(steps) {
|
|
131
|
+
const seen = new Set();
|
|
132
|
+
const order = [];
|
|
133
|
+
for (const step of steps) {
|
|
134
|
+
const schemaCode = String(step.args.schemaCode ?? "");
|
|
135
|
+
const code = typeof step.args.code === "string" ? step.args.code : "";
|
|
136
|
+
const target = step.tool === "field.delete" ? `field.delete:${schemaCode}.${code}` : `${step.tool}:${schemaCode}`;
|
|
137
|
+
if (seen.has(target))
|
|
138
|
+
continue;
|
|
139
|
+
seen.add(target);
|
|
140
|
+
order.push(target);
|
|
141
|
+
}
|
|
142
|
+
return order;
|
|
143
|
+
}
|
|
116
144
|
/**
|
|
117
145
|
* `omc model-purge --unbind-references --apply` — the ONE command that executes
|
|
118
146
|
* the same `field.delete → field.publish` unlink steps and then lets
|
|
@@ -170,7 +198,7 @@ export function inboundReferenceRefusal(target, references, options = {}) {
|
|
|
170
198
|
blocker: "model-referenced-by",
|
|
171
199
|
referencingModels,
|
|
172
200
|
inboundReferences: [...references],
|
|
173
|
-
deletionOrder:
|
|
201
|
+
deletionOrder: deletionOrderFromSteps(steps),
|
|
174
202
|
deletionSteps: steps,
|
|
175
203
|
nextCommand: selfPurgeCommand ?? steps[0]?.command ?? `omc call model.delete --args '${JSON.stringify({ schemaCode: target })}'`,
|
|
176
204
|
nextAction: selfPurgeCommand !== undefined
|
|
@@ -144,7 +144,7 @@ export const RUNTIME_DATA_LANE_CONTRACT = Object.freeze({
|
|
|
144
144
|
}),
|
|
145
145
|
"data.delete": Object.freeze({
|
|
146
146
|
scope: "write authoritative readback form save",
|
|
147
|
-
description: desc("M2 runtime data delete (runtime/form/delete) with absence readback.
|
|
147
|
+
description: desc("M2 runtime data delete (runtime/form/delete) with absence readback. 成功判据=`undeletedIds` 与 `notInSchema` 均为空(deletionVerified:true);删前读不到该 id = 不属于此 schemaCode,默认 uncertain + delete-target-not-in-schema,幂等清理需显式 allowAlreadyAbsent:true。**没有 `present` 键**(旧版与 absent 并列会出现 present:true+absent:true,无法判断读哪条);remainingRows/modelRowsRemaining/modelClean 只描述整表状态,不用于判批量删除成败。"),
|
|
148
148
|
}),
|
|
149
149
|
"data.submit": Object.freeze({ scope: "write authoritative readback form save", description: dataSubmitDescription() }),
|
|
150
150
|
}),
|
|
@@ -158,7 +158,7 @@ export function assertRuntimeDataContract() {
|
|
|
158
158
|
assertDescriptionCarries(RUNTIME_DATA_LANE_CONTRACT, "data.aggregate", ["totalElements", "groupBy", "local-scan", "cap 1000", "draftPolicy", "report.chartdata", "sum", "avg", "NUMERICAL", "nonNullCount"]);
|
|
159
159
|
assertDescriptionCarries(RUNTIME_DATA_LANE_CONTRACT, "data.save", ["bizObjectId", "sheetCode", "bizsheet/get", "workflowCode", "sequenceStatus", "workItem", "propertyType 9", "50000", "mappings", "rowStatus", "DRAFT", "submit:true", "CHILD_TABLE"]);
|
|
160
160
|
assertDescriptionCarries(RUNTIME_DATA_LANE_CONTRACT, "data.update", ["runtime/form/save", "bizObjectId", "COMPLETED", "304001", "form/load", "rowStatus", "child-rows-upsert"]);
|
|
161
|
-
assertDescriptionCarries(RUNTIME_DATA_LANE_CONTRACT, "data.delete", ["absence", "sheetCode"]);
|
|
161
|
+
assertDescriptionCarries(RUNTIME_DATA_LANE_CONTRACT, "data.delete", ["absence", "sheetCode", "notInSchema", "allowAlreadyAbsent"]);
|
|
162
162
|
assertDescriptionCarries(RUNTIME_DATA_LANE_CONTRACT, "data.submit", ["getReplayToken", "replayToken", "bizObjectId", "objectId", "DRAFT", "COMPLETED", "10009", "100005", "NPE", "两段式", "finishStart=FALSE"]);
|
|
163
163
|
if (!RUNTIME_DATA_WIRE.workflowDraftSave.includes("finishStart=FALSE"))
|
|
164
164
|
throw new Error("runtime-data contract must pin the portal draft-save chain (finishStart=FALSE)");
|