@stalfh233/omc-cli 0.8.25 → 0.8.26
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/approval-flow.js +35 -4
- package/dist/cli.js +19 -4
- package/dist/lanes/field.js +22 -0
- package/dist/lanes/runtime-data.js +10 -2
- package/dist/model-scaffold.js +10 -0
- package/dist/recipes/field.js +1 -1
- package/dist/residue.js +46 -10
- package/package.json +3 -3
- package/skills/omc-business-configuration.md +10 -9
package/dist/approval-flow.js
CHANGED
|
@@ -220,6 +220,8 @@ export async function cmdApprovalFlow(args) {
|
|
|
220
220
|
const steps = multi("--steps");
|
|
221
221
|
const environment = flag("--env") ?? flag("--environment");
|
|
222
222
|
const apply = args.includes("--apply");
|
|
223
|
+
const dryRunRequested = args.includes("--dry-run");
|
|
224
|
+
const allowEmptyRole = args.includes("--allow-empty-role");
|
|
223
225
|
const originatorNode = !args.includes("--no-originator-node");
|
|
224
226
|
const rawOriginatorName = flag("--originator-name");
|
|
225
227
|
const originatorName = rawOriginatorName?.trim();
|
|
@@ -227,8 +229,9 @@ export async function cmdApprovalFlow(args) {
|
|
|
227
229
|
// r31c F5:本拼装器只做线性审批。条件分支必须退回 workflow.update;行级数据
|
|
228
230
|
// 可见范围当前工具面不支持——别把「申请人只看自己」误当成 permissions。
|
|
229
231
|
const usage = [
|
|
230
|
-
'用法:omc approval-flow --schema <模型> --steps "节点名@role:<角色code>" [--steps ...多级] [--no-originator-node] [--originator-name <填写节点显示名>] [--no-reject-to-start] [--apply]',
|
|
231
|
-
"步骤也可用 名称@user:<用户id>
|
|
232
|
+
'用法:omc approval-flow --schema <模型> --steps "节点名@role:<角色code>" [--steps ...多级] [--no-originator-node] [--originator-name <填写节点显示名>] [--no-reject-to-start] [--dry-run|--apply] [--allow-empty-role]',
|
|
233
|
+
"步骤也可用 名称@user:<用户id> 绑定具体审批人。**不加 --apply(或显式 --dry-run)即编译预览**;--apply 建/改流程+字段权限+发布。",
|
|
234
|
+
"--apply 前会逐条预检 @role 成员数:0 成员默认 refused、零写入(blocker approval-role-has-no-members),改用 名称@user:<userId>;确知发布后没人能审仍要发布,显式加 --allow-empty-role。dry-run 仍只给 participantChecks 警告。",
|
|
232
235
|
`--originator-name 只改发起/填写节点的**显示名**(默认「${DEFAULT_ORIGINATOR_NAME}」,与平台自动草稿一致);participant 仍是 {Originator}、类型仍是 PARTICIPANT,语义不变。既有 Activity2 的 activityName 平台钉在首建值,显示名写 name_i18n——读回看 workflowSummary.activities[].name / renamedInPlace.displayName。`,
|
|
233
236
|
"user 参与者的 corpId 是 CLI 生成的本地占位(平台按 id 解析用户,id 命中时 corpId 不参与);dry-run 的 participantNotes 会逐条说明,无需手改 corpId。",
|
|
234
237
|
"⚠️ 本工具只做线性流程(START→填写→N 级审批→END),没有 --condition。",
|
|
@@ -242,6 +245,8 @@ export async function cmdApprovalFlow(args) {
|
|
|
242
245
|
};
|
|
243
246
|
if (!schema)
|
|
244
247
|
return invalid("--schema 必填");
|
|
248
|
+
if (dryRunRequested && apply)
|
|
249
|
+
return invalid("--apply 与 --dry-run 互斥:--dry-run 等价于省略 --apply(预览)");
|
|
245
250
|
if (rawOriginatorName !== undefined && originatorName === undefined)
|
|
246
251
|
return invalid("--originator-name 不能为空(省略该参数则保持默认「填写申请单」)");
|
|
247
252
|
if (originatorName !== undefined && !originatorNode)
|
|
@@ -289,6 +294,33 @@ export async function cmdApprovalFlow(args) {
|
|
|
289
294
|
}, request));
|
|
290
295
|
return 0;
|
|
291
296
|
}
|
|
297
|
+
// 探针 R F3(0.8.26,P1):`@role` 0 成员时旧实现只在 publish 前给 warning,
|
|
298
|
+
// create/update 已经落库——「已发布=可用」是假象。apply 必须在**任何 workflow
|
|
299
|
+
// 写入之前**做同一成员预检;0 成员默认 refuse(零写入),--allow-empty-role 才放行。
|
|
300
|
+
const roleChecks = await roleMemberChecks(steps, environment, request, roleMemberLookup, schema, true);
|
|
301
|
+
const emptyRoles = roleChecks.filter((check) => check.memberCount === 0);
|
|
302
|
+
if (emptyRoles.length > 0 && !allowEmptyRole) {
|
|
303
|
+
const names = emptyRoles.map((check) => `@role:${String(check.roleCode)}(节点「${String(check.activity)}」)`).join("、");
|
|
304
|
+
const firstNext = emptyRoles.find((check) => typeof check.nextCommand === "string")?.nextCommand;
|
|
305
|
+
const escapeSteps = steps.map((raw) => {
|
|
306
|
+
const detail = parseStepDetail(raw);
|
|
307
|
+
return `--steps ${JSON.stringify(`${detail.name}@${detail.kind}:${detail.code}`)}`;
|
|
308
|
+
}).join(" ");
|
|
309
|
+
const retry = ["omc approval-flow", "--schema", schema, escapeSteps, "--env", environment ?? "<env>", "--allow-empty-role", "--apply"].filter(Boolean).join(" ");
|
|
310
|
+
const message = `${names} 当前 0 个成员:FindUserByRole 解析不出审批人,--apply 会在 workflow.create/update 前拒绝(零写入)。改用 名称@user:<userId> 绑定具体审批人(org.user.search / org.role.users 取 id);确知发布后没人能审、仍要发布,显式加 --allow-empty-role 重发。`;
|
|
311
|
+
writeEnvelope(envelope("refused", {
|
|
312
|
+
status: "refused",
|
|
313
|
+
blocker: "approval-role-has-no-members",
|
|
314
|
+
schemaCode: schema,
|
|
315
|
+
written: false,
|
|
316
|
+
participantChecks: roleChecks,
|
|
317
|
+
emptyRoles: emptyRoles.map((check) => ({ activity: check.activity, roleCode: check.roleCode, memberCount: 0 })),
|
|
318
|
+
...(firstNext !== undefined ? { nextCommand: firstNext } : {}),
|
|
319
|
+
escapeHatch: retry,
|
|
320
|
+
message,
|
|
321
|
+
}, request, { code: "policy-refused", message, retryable: false }));
|
|
322
|
+
return CLI_EXIT_CODES.policyRefused;
|
|
323
|
+
}
|
|
292
324
|
// 1) 确保流程存在(一个模型只能有一个:已存在则直接 update)
|
|
293
325
|
const createOutcome = await runToolCall("workflow.create", { args: { schemaCode: schema, code: compiled.workflowCode, name: `${schema} 审批流`, ...(environment ? { environment } : {}) }, requestId: request, environment, print: () => undefined });
|
|
294
326
|
if (createOutcome.exitCode !== 0) {
|
|
@@ -332,8 +364,7 @@ export async function cmdApprovalFlow(args) {
|
|
|
332
364
|
writeEnvelope(envelope(classifyResult(updateOutcome.result).status, updateOutcome.result, request, classifyResult(updateOutcome.result).error));
|
|
333
365
|
return updateOutcome.exitCode;
|
|
334
366
|
}
|
|
335
|
-
// 4) publish
|
|
336
|
-
const roleChecks = await roleMemberChecks(steps, environment, request, roleMemberLookup, schema, true);
|
|
367
|
+
// 4) publish(roleChecks 已在任何写之前预检并复用)
|
|
337
368
|
const publishOutcome = await runToolCall("workflow.publish", { args: { schemaCode: schema, code: compiled.workflowCode, ...(environment ? { environment } : {}) }, requestId: request, environment, print: () => undefined });
|
|
338
369
|
const classified = classifyResult(publishOutcome.result);
|
|
339
370
|
// 与 `omc call` 一致:结果顶层带生产者 status(成功 ok / 被拒 refused / 部分
|
package/dist/cli.js
CHANGED
|
@@ -1163,6 +1163,13 @@ function applyReadArgAliases(toolName, schemaKeys, input) {
|
|
|
1163
1163
|
const pageSize = move("pageSize", "size", (value) => (typeof value === "number" && Number.isFinite(value) ? value : undefined), (next) => `size=${String(next)}`);
|
|
1164
1164
|
if (pageSize !== undefined)
|
|
1165
1165
|
return pageSize;
|
|
1166
|
+
// 探针 R F2(0.8.26):org.role.list 的行把角色主键叫 `id`,相邻的
|
|
1167
|
+
// org.role.users 却只收 roleId——同一概念两个名字。仅在目标键真实存在时换算。
|
|
1168
|
+
if (toolName === "org.role.users") {
|
|
1169
|
+
const roleId = move("id", "roleId", (value) => (typeof value === "string" && value.trim().length > 0 ? value : undefined), (next) => `roleId=${String(next)}(org.role.list 的 id)`);
|
|
1170
|
+
if (roleId !== undefined)
|
|
1171
|
+
return roleId;
|
|
1172
|
+
}
|
|
1166
1173
|
if (ONLY_CUSTOM_TO_ALL_TOOLS.has(toolName)) {
|
|
1167
1174
|
const onlyCustom = move("onlyCustom", "all", (value) => (typeof value === "boolean" ? !value : undefined), (next) => `all=${String(next)}`);
|
|
1168
1175
|
if (onlyCustom !== undefined)
|
|
@@ -2619,7 +2626,15 @@ function intentDigest(intent) {
|
|
|
2619
2626
|
...(model.absent ? { absent: true } : {}),
|
|
2620
2627
|
fieldCodes: model.fields.map((field) => field.code),
|
|
2621
2628
|
...(model.fields.some((field) => field.subFields !== undefined)
|
|
2622
|
-
? {
|
|
2629
|
+
? {
|
|
2630
|
+
subFieldCodes: Object.fromEntries(model.fields.filter((field) => field.subFields !== undefined).map((field) => [field.code, (field.subFields ?? []).map((sub) => sub.code)])),
|
|
2631
|
+
// 探针 R F4(0.8.26,P1):子表 schema code = 父 CHILD_TABLE 字段 code,
|
|
2632
|
+
// 不是 `<模型>_items`。任务书常按后者命名,读回前面给出映射与改写法。
|
|
2633
|
+
childSchemas: model.fields
|
|
2634
|
+
.filter((field) => field.subFields !== undefined)
|
|
2635
|
+
.map((field) => ({ fieldCode: field.code, schemaCode: field.code })),
|
|
2636
|
+
childSchemaNote: "子表 schema code = 父 CHILD_TABLE 字段 code:subFieldCodes 的键就是 schemaCode(如 items),不是 <模型>_items;要 pb_repair_items 就把字段 code 命名为 pb_repair_items。",
|
|
2637
|
+
}
|
|
2623
2638
|
: {}),
|
|
2624
2639
|
...(model.datarules !== undefined ? { datarulePropertyCodes: model.datarules.map((rule) => rule.propertyCode) } : {}),
|
|
2625
2640
|
...(model.rules !== undefined ? { ruleCodes: model.rules.map((rule) => rule.code) } : {}),
|
|
@@ -3837,8 +3852,8 @@ async function main() {
|
|
|
3837
3852
|
const rest = ["rule-when", ...(options.schema ? ["--schema", options.schema] : []), ...(options.schemaCode ? ["--schema-code", options.schemaCode] : []), ...(options.on ? ["--on", options.on] : []), ...(Array.isArray(options.when) ? options.when.flatMap((w) => ["--when", w]) : []), ...(Array.isArray(options.then) ? options.then.flatMap((a) => ["--then", a]) : []), ...(options.name ? ["--name", options.name] : []), ...(options.env ? ["--env", options.env] : []), ...(options.environment ? ["--environment", options.environment] : []), ...(options.apply ? ["--apply"] : [])];
|
|
3838
3853
|
commandExitCode = await cmdRuleWhen(rest);
|
|
3839
3854
|
});
|
|
3840
|
-
command.command("approval-flow").option("--schema <schemaCode>").option("--schema-code <schemaCode>").addOption(new Option("--steps <step>", "审批步骤,可重复;`节点名@role:<角色code>` 或 `节点名@user:<userId>`(user 参与者的 corpId 是 CLI 本地占位,平台按 id 解析用户,无需手改)").argParser(collectValues).default([])).option("--env <environment>").option("--environment <environment>").option("--apply").option("--no-originator-node").option("--originator-name <displayName>", "发起/填写节点的显示名(默认「填写申请单」)。只改显示名,participant 仍是 {Originator},语义仍是发起节点;既有节点的 activityName 保留平台首建值,显示名落在 name_i18n").option("--no-reject-to-start").addHelpText("after", "\n审批流拼装器:--steps 名称@role:<角色code> 或 节点名@user:<userId>(多级给多个)。编译为验证模板(START→填写→审批链→END,审批节点字段只读),--apply
|
|
3841
|
-
const rest = ["approval-flow", ...(options.schema ? ["--schema", options.schema] : []), ...(options.schemaCode ? ["--schema-code", options.schemaCode] : []), ...(Array.isArray(options.steps) ? options.steps.flatMap((s) => ["--steps", s]) : []), ...(options.env ? ["--env", options.env] : []), ...(options.environment ? ["--environment", options.environment] : []), ...(options.apply ? ["--apply"] : []), ...(options.originatorNode === false ? ["--no-originator-node"] : []), ...(options.originatorName ? ["--originator-name", options.originatorName] : []), ...(options.rejectToStart === false ? ["--no-reject-to-start"] : [])];
|
|
3855
|
+
command.command("approval-flow").option("--schema <schemaCode>").option("--schema-code <schemaCode>").addOption(new Option("--steps <step>", "审批步骤,可重复;`节点名@role:<角色code>` 或 `节点名@user:<userId>`(user 参与者的 corpId 是 CLI 本地占位,平台按 id 解析用户,无需手改)").argParser(collectValues).default([])).option("--env <environment>").option("--environment <environment>").option("--apply").option("--dry-run", "等价于省略 --apply(编译预览);与 --apply 互斥").option("--allow-empty-role", "apply 时放行 @role 0 成员的流程(默认写前拒绝 approval-role-has-no-members)").option("--no-originator-node").option("--originator-name <displayName>", "发起/填写节点的显示名(默认「填写申请单」)。只改显示名,participant 仍是 {Originator},语义仍是发起节点;既有节点的 activityName 保留平台首建值,显示名落在 name_i18n").option("--no-reject-to-start").addHelpText("after", "\n审批流拼装器:--steps 名称@role:<角色code> 或 节点名@user:<userId>(多级给多个)。编译为验证模板(START→填写→审批链→END,审批节点字段只读),--apply 建流+权限+发布;不加 --apply(或显式 --dry-run)即预览。\n**@role 0 成员**:--apply 会在任何 workflow.create/update 之前拒绝(零写入,blocker approval-role-has-no-members),改用 名称@user:<userId>;确知发布后没人能审仍要发布,加 --allow-empty-role。预览仍只给 participantChecks 警告。\n发起/填写节点默认显示名「填写申请单」(平台自动草稿同名);`--originator-name <名>` 只改显示名(任务书按「发起 → 审批」写时用它对齐),语义仍是发起节点(participant={Originator})。平台把既有 Activity2 的 activityName 钉在首建值,显示名写入 name_i18n——读回看 workflow.get_published 的 workflowSummary.activities[].name(或 update.renamedInPlace.displayName)。\n`@user:` 适合单账号/角色无成员环境;参与者对象的 corpId 由 CLI 写成本地占位 \"other\",平台先按 id 解析用户、id 命中时 corpId 不参与(8.6.26 ParticipleServiceImplCompanion.java:171-174),dry-run 的 participantNotes 会逐条说明,无需替换。role 参与者按 OU 解析,先 `org.role.users` 复核。\n边界:非发起人身份的审批无法在单会话 CLI 内推进(单 token);若要验跨账号审批,用第二账号另建环境,或把参与人设为 {Originator}。\n").action(async (options) => {
|
|
3856
|
+
const rest = ["approval-flow", ...(options.schema ? ["--schema", options.schema] : []), ...(options.schemaCode ? ["--schema-code", options.schemaCode] : []), ...(Array.isArray(options.steps) ? options.steps.flatMap((s) => ["--steps", s]) : []), ...(options.env ? ["--env", options.env] : []), ...(options.environment ? ["--environment", options.environment] : []), ...(options.apply ? ["--apply"] : []), ...(options.dryRun ? ["--dry-run"] : []), ...(options.allowEmptyRole ? ["--allow-empty-role"] : []), ...(options.originatorNode === false ? ["--no-originator-node"] : []), ...(options.originatorName ? ["--originator-name", options.originatorName] : []), ...(options.rejectToStart === false ? ["--no-reject-to-start"] : [])];
|
|
3842
3857
|
commandExitCode = await cmdApprovalFlow(rest);
|
|
3843
3858
|
});
|
|
3844
3859
|
command
|
|
@@ -4146,7 +4161,7 @@ async function main() {
|
|
|
4146
4161
|
}));
|
|
4147
4162
|
});
|
|
4148
4163
|
command.command("bench").option("--live-sample").option("--env <environment>").action(async (options) => { commandExitCode = await cmdBench([...(options.liveSample ? ["--live-sample"] : []), ...(options.env ? ["--env", options.env] : [])]); });
|
|
4149
|
-
command.command("residue <prefix>").description("跨面前缀残留扫描(model 全租户/folder/custompage;默认 deep 再查命中模型的 rule/datarule/onlinejs
|
|
4164
|
+
command.command("residue <prefix>").description("跨面前缀残留扫描(model 全租户/folder/custompage;默认 deep 再查命中模型的 rule/datarule/onlinejs,**并扫 report 面**(应用树 type=Report,code/name 前缀))——收尾「删净」一次证明;clean/complete 同义(report 已扫)。--no-report 恢复旧的 scanned-faces 口径。清理入口:omc model-purge --code <schemaCode>(按依赖倒序,默认 dry-run)。只读零写入").option("--env <environment>", "环境名(默认按 cwd 的 .omc-env 解析)").option("--apps <codes>", "all(默认,全租户)或逗号分隔应用码").option("--no-deep", "只扫 model/folder/custompage,不深查命中模型").option("--no-report", "不扫 report 面(回退旧口径:complete:false + mandatoryChecks)").option("--all-faces", "列出全部应用×面(含 count:0;默认只回非零面+byFace/userResidues 紧凑形)").option("--max-output-bytes <bytes>").addOption(new Option("--jq [path]", "--jq 不是 jq,仅路径选择器(与 call --jq 同 DSL;可逗号多路径;裸 --jq 列顶层键)").argParser((value, previous = []) => [...previous, value]).default([])).action(async (prefix, options) => { commandExitCode = await withTransport(options, request, (transport) => cmdResidue(prefix, { env: options.env, apps: options.apps, ...(options.deep === false ? { noDeep: true } : {}), ...(options.report === false ? { noReport: true } : {}), ...(options.allFaces ? { allFaces: true } : {}), ...(options.jq !== undefined ? { jq: options.jq } : {}) }, transport)); });
|
|
4150
4165
|
command.command("track <schemaCode> <bizObjectId>").description("读取单条业务数据的行级变更留痕(只读;平台来源枚举含 BUSINESS_RULE 时原样回传)").option("--env <environment>").option("--property-code <code>").option("--max-output-bytes <bytes>").action(async (schemaCode, bizObjectId, options) => { commandExitCode = await withTransport(options, request, (transport) => cmdTrack(schemaCode, bizObjectId, { env: options.env, propertyCode: options.propertyCode }, transport)); });
|
|
4151
4166
|
const jqOption = () => new Option("--jq [path]", "--jq 不是 jq,仅路径选择器(与 call --jq 同 DSL;可逗号多路径;裸 --jq 列顶层键)").argParser((value, previous = []) => [...previous, value]).default([]);
|
|
4152
4167
|
// C6(0.8.4):--jq 的 miss 默认只回结论;排查载荷(available/correctPath/
|
package/dist/lanes/field.js
CHANGED
|
@@ -1032,11 +1032,22 @@ export function registerFieldLane(tools) {
|
|
|
1032
1032
|
String(args.propertyType) === "SELECTION";
|
|
1033
1033
|
const createdRow = rows.find((row) => (row.code ?? row.propertyCode) === args.code);
|
|
1034
1034
|
const createdOptions = createdRow?.options !== undefined && createdRow.options !== null ? parseFieldOptionsForReadback(createdRow.options) : undefined;
|
|
1035
|
+
// 探针 R F4(0.8.26,P1):CHILD_TABLE 的子表 schema code **就是**父字段
|
|
1036
|
+
// code(BizPropertyFacadeImpl.save:87-89 → ensureBizObjectSchema(property.getCode())
|
|
1037
|
+
// .addProperty(subProperties))。任务书常写 `<模型>_items`,而工具默认按字段
|
|
1038
|
+
// code 命名;不提前说清会让整套交付命名错。这里在创建回执直接给出映射与改写法。
|
|
1039
|
+
const isChildTable = String(args.propertyType) === "CHILD_TABLE" || Number(args.propertyType) === FIELD_PROPERTY_TYPES.CHILD_TABLE;
|
|
1035
1040
|
return {
|
|
1036
1041
|
performed: { errcode: performed.errcode },
|
|
1037
1042
|
readback: {
|
|
1038
1043
|
face: "draft",
|
|
1039
1044
|
draftFieldPresent: createdRow !== undefined,
|
|
1045
|
+
...(isChildTable
|
|
1046
|
+
? {
|
|
1047
|
+
childSchema: { fieldCode: args.code, schemaCode: args.code },
|
|
1048
|
+
childSchemaNote: "子表 schema code = 父 CHILD_TABLE 字段 code(平台规则,不接受另起 subSchemaCode):要 `pb_repair_items` 就把字段 code 命名为 `pb_repair_items`,子列建在 schemaCode=该 code 上。",
|
|
1049
|
+
}
|
|
1050
|
+
: {}),
|
|
1040
1051
|
// 探针 P F5(0.8.22):写回执回显**生效值**(scale/format/mappings 等只在
|
|
1041
1052
|
// options 里的语义),省掉一次 field.get 才能核对单位/精度/映射方向。
|
|
1042
1053
|
...(createdOptions !== undefined ? { options: createdOptions } : {}),
|
|
@@ -1052,6 +1063,17 @@ export function registerFieldLane(tools) {
|
|
|
1052
1063
|
},
|
|
1053
1064
|
};
|
|
1054
1065
|
},
|
|
1066
|
+
dryRunPayload: async (_session, args) => {
|
|
1067
|
+
// 探针 R F4(0.8.26):命名后果必须在**写前**暴露,dry-run 与 model-scaffold
|
|
1068
|
+
// 的 childSchemas 同口径。零 wire。
|
|
1069
|
+
const isChildTable = String(args.propertyType) === "CHILD_TABLE" || Number(args.propertyType) === FIELD_PROPERTY_TYPES.CHILD_TABLE;
|
|
1070
|
+
return isChildTable
|
|
1071
|
+
? {
|
|
1072
|
+
childSchema: { fieldCode: String(args.code), schemaCode: String(args.code) },
|
|
1073
|
+
childSchemaNote: "子表 schema code = 父 CHILD_TABLE 字段 code(平台规则,不接受另起 subSchemaCode):要 `pb_repair_items` 就把字段 code 命名为 `pb_repair_items`。",
|
|
1074
|
+
}
|
|
1075
|
+
: {};
|
|
1076
|
+
},
|
|
1055
1077
|
preflight: (args) => {
|
|
1056
1078
|
assertSelectionChoicesAllowed(args);
|
|
1057
1079
|
assertFieldFamilyAllowed(args);
|
|
@@ -943,6 +943,11 @@ function compactRuntimeRecord(record) {
|
|
|
943
943
|
for (const [key, value] of Object.entries(record)) {
|
|
944
944
|
if (key.endsWith("_"))
|
|
945
945
|
continue;
|
|
946
|
+
// 探针 R F13(0.8.26):`*_key` 是平台给单选/字典字段铸的孪生列,值为 null
|
|
947
|
+
// 时既不在模型字段里也没有来源说明,读回会让人误判「漏配字段」;非 null 保留
|
|
948
|
+
// (它携带真实字典 key)。只丢 null/undefined 的伴生键。
|
|
949
|
+
if (key.endsWith("_key") && (value === null || value === undefined))
|
|
950
|
+
continue;
|
|
946
951
|
if (RUNTIME_ENGINE_RECORD_KEYS.has(key))
|
|
947
952
|
continue;
|
|
948
953
|
compact[key] = compactRuntimeValue(value);
|
|
@@ -2567,7 +2572,7 @@ export function registerRuntimeDataLane(tools) {
|
|
|
2567
2572
|
return String(data.sequenceStatus ?? record.sequenceStatus ?? "") === "DRAFT";
|
|
2568
2573
|
}).length;
|
|
2569
2574
|
return draftRows > 0
|
|
2570
|
-
? { draftPolicy: "included", draftRows, hint: `本次结果含 ${draftRows} 条 DRAFT 行——total 含草稿,不要当"已提交数据量";判定状态读 data.load 的 sequenceStatus` }
|
|
2575
|
+
? { draftPolicy: "included", draftRows, ...(typeof total === "number" && collected.length >= total ? { submittedTotal: Math.max(0, total - draftRows) } : {}), hint: `本次结果含 ${draftRows} 条 DRAFT 行——total 含草稿,不要当"已提交数据量"${typeof total === "number" && collected.length >= total ? `(可用 submittedTotal=${Math.max(0, total - draftRows)})` : ""};判定状态读 data.load 的 sequenceStatus` }
|
|
2571
2576
|
: { draftPolicy: "unspecified", hint: "本次结果无 DRAFT 行;判定状态以 data.load 的 sequenceStatus 为准" };
|
|
2572
2577
|
})(),
|
|
2573
2578
|
// 形状常量:脚本按 result.items 取数(与内联态一致),itemsCount 与
|
|
@@ -2835,7 +2840,10 @@ export function registerRuntimeDataLane(tools) {
|
|
|
2835
2840
|
? {
|
|
2836
2841
|
draftPolicy: "included",
|
|
2837
2842
|
draftRows,
|
|
2838
|
-
|
|
2843
|
+
// 只有本次把全部行取回时,total-draftRows 才是准确的「已提交量」;
|
|
2844
|
+
// 分页/截断场景 draftRows 只统计当前页,给数会误导。
|
|
2845
|
+
...(typeof total === "number" && items.length >= total ? { submittedTotal: Math.max(0, total - draftRows) } : {}),
|
|
2846
|
+
hint: `本次结果含 ${draftRows} 条 DRAFT 行(total 也计入)——**不要**把 total 当"已提交数据量"${typeof total === "number" && items.length >= total ? `(可用 submittedTotal=${Math.max(0, total - draftRows)})` : ""},判定状态读 data.load 的 sequenceStatus`,
|
|
2839
2847
|
}
|
|
2840
2848
|
: condition !== undefined
|
|
2841
2849
|
? { draftPolicy: "excluded", hint: "本次结果无 DRAFT 行;判定状态仍以 data.load 的 sequenceStatus 为准" }
|
package/dist/model-scaffold.js
CHANGED
|
@@ -375,6 +375,9 @@ export async function cmdModelScaffold(args) {
|
|
|
375
375
|
const failedSteps = steps.filter((step) => step.status === "failed");
|
|
376
376
|
const status = failedSteps.length > 0 ? "partial" : "ok";
|
|
377
377
|
const childColumnCount = fields.reduce((sum, field) => sum + scaffoldChildrenOf(field).length, 0);
|
|
378
|
+
const childSchemas = fields
|
|
379
|
+
.filter((field) => scaffoldChildrenOf(field).length > 0)
|
|
380
|
+
.map((field) => ({ fieldCode: field.code, schemaCode: field.code, columnCount: scaffoldChildrenOf(field).length }));
|
|
378
381
|
// `fieldCount` 是历史键,语义是「最终业务字段总数」(顶层声明 + 子列);
|
|
379
382
|
// 落库计数改用显式键名(F3,0.8.8):created/skipped 旧键保留为别名,但取值
|
|
380
383
|
// 以「本次真的写入」为准,不再把 attach 一起建出的子列记成 skipped。
|
|
@@ -395,6 +398,9 @@ export async function cmdModelScaffold(args) {
|
|
|
395
398
|
alreadyPresentFieldCount,
|
|
396
399
|
childColumnCount,
|
|
397
400
|
childColumnsCreated,
|
|
401
|
+
...(childSchemas.length > 0
|
|
402
|
+
? { childSchemas, childSchemaNote: "子表 schema code = 父 CHILD_TABLE 字段 code(平台规则):要 `pb_repair_items` 就把字段 code 命名为 `pb_repair_items`。" }
|
|
403
|
+
: {}),
|
|
398
404
|
failedFieldCount: failedFields.length,
|
|
399
405
|
countsNote: "declaredFieldCount = 本次 --fields 声明的顶层字段数;createdFieldCount = 本次真正新写入的业务字段数(子表 attach 一并建出的子列计入 created,不记 skipped);alreadyPresentFieldCount = 本次开始前就已存在的字段数;fieldCount = 最终业务字段总数(declaredFieldCount + childColumnCount)。旧键 created/skipped 分别是 createdFieldCount/alreadyPresentFieldCount 的别名。",
|
|
400
406
|
created: createdFieldCount,
|
|
@@ -415,6 +421,7 @@ export async function cmdModelScaffold(args) {
|
|
|
415
421
|
}
|
|
416
422
|
function describeScaffoldPlan(options) {
|
|
417
423
|
const childTables = options.fields.filter((field) => scaffoldChildrenOf(field).length > 0);
|
|
424
|
+
const childSchemas = childTables.map((field) => ({ fieldCode: field.code, schemaCode: field.code, columnCount: scaffoldChildrenOf(field).length }));
|
|
418
425
|
const declaredFieldCount = options.fields.length;
|
|
419
426
|
const childColumnCount = options.fields.reduce((sum, field) => sum + scaffoldChildrenOf(field).length, 0);
|
|
420
427
|
// F11(0.8.17,探针 K):dry-run 与 --apply 必须同键同值。旧 dry-run 只给
|
|
@@ -431,6 +438,9 @@ function describeScaffoldPlan(options) {
|
|
|
431
438
|
code: field.code,
|
|
432
439
|
childFields: scaffoldChildrenOf(field).map((entry) => entry.code),
|
|
433
440
|
})),
|
|
441
|
+
...(childSchemas.length > 0
|
|
442
|
+
? { childSchemas, childSchemaNote: "子表 schema code = 父 CHILD_TABLE 字段 code(平台规则):要 `pb_repair_items` 就把字段 code 命名为 `pb_repair_items`。" }
|
|
443
|
+
: {}),
|
|
434
444
|
countsNote: "dry-run 与 --apply 同键同义:declaredFieldCount = --fields 声明的顶层字段数;childColumnCount = 子列总数(子表自身不计数);fieldCount = 最终业务字段总数(declaredFieldCount + childColumnCount)。",
|
|
435
445
|
publishForm: options.publishForm,
|
|
436
446
|
steps: [
|
package/dist/recipes/field.js
CHANGED
|
@@ -268,7 +268,7 @@ const childTableParentFieldFill = Object.freeze({
|
|
|
268
268
|
},
|
|
269
269
|
},
|
|
270
270
|
preconditions: [
|
|
271
|
-
"**子表子 schema code = 父模型 CHILD_TABLE(8) 字段的 code**(父字段 code 为 `items` 时 schemaCode 就是 `items`),不是 `<model>_items` 约定名:`omc call field.list --args '{\"schemaCode\":\"<父模型>\"}'` 找 type:8 字段的 code;同一口径见 `omc contract field-families` 的 `childTableSubSchema
|
|
271
|
+
"**子表子 schema code = 父模型 CHILD_TABLE(8) 字段的 code**(父字段 code 为 `items` 时 schemaCode 就是 `items`),不是 `<model>_items` 约定名:`omc call field.list --args '{\"schemaCode\":\"<父模型>\"}'` 找 type:8 字段的 code;同一口径见 `omc contract field-families` 的 `childTableSubSchema`。**任务书要 `<model>_items` 时,直接把父字段 code 命名成 `<model>_items`**;平台不接受另起 subSchemaCode,`field.create` 回执的 childSchema 会回显实际 schemaCode。",
|
|
272
272
|
"子表 code 全局唯一;先建并发布快照标量列,再建关联列。",
|
|
273
273
|
"**发布用父模型 code**:`field.publish {\"schemaCode\":\"<父模型>\"}`——子表 code 会被拒(300004 → `field-publish-child-schema`);模型级一次发全部草稿字段,子表列随父模型发。",
|
|
274
274
|
],
|
package/dist/residue.js
CHANGED
|
@@ -98,6 +98,24 @@ export async function scanResidues(session, prefix, options = {}) {
|
|
|
98
98
|
faces.push(face("model", matchingModels.map((row) => ({ code: codeOf(row), name: nameOf(row, codeOf(row)) })), { app }));
|
|
99
99
|
faces.push(face("folder", rows.filter((row) => row.type === "Folder" && folderStarts(row, prefix)).map((row) => ({ code: codeOf(row), name: nameOf(row, codeOf(row)) })), { app }));
|
|
100
100
|
}
|
|
101
|
+
// 探针 R F10(0.8.26):report 面的权威源是应用树 type=Report 节点(同 report.tree)。
|
|
102
|
+
// 单独一遍 best-effort:失败时不写入任何命中,保持 report 为「未扫描」面,
|
|
103
|
+
// 让 complete:false + mandatoryChecks 如实披露(绝不把读失败当零残留)。
|
|
104
|
+
let reportScanned = false;
|
|
105
|
+
if (options.reportScan === true) {
|
|
106
|
+
try {
|
|
107
|
+
for (const app of selected) {
|
|
108
|
+
const rows = await tree(session, app);
|
|
109
|
+
faces.push(face("report", rows
|
|
110
|
+
.filter((row) => String(row.type ?? "") === "Report" && folderStarts(row, prefix))
|
|
111
|
+
.map((row) => ({ code: codeOf(row), name: nameOf(row, codeOf(row)) })), { app }));
|
|
112
|
+
}
|
|
113
|
+
reportScanned = selected.length > 0;
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
reportScanned = false;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
101
119
|
const pages = (await customPages(session, appSet)).filter((row) => codeStarts(row, prefix));
|
|
102
120
|
for (const app of selected) {
|
|
103
121
|
faces.push(face("custompage", pages.filter((row) => String(row.appCode ?? "") === app).map((row) => ({ code: codeOf(row), name: nameOf(row, codeOf(row)) })), { app }));
|
|
@@ -116,17 +134,21 @@ export async function scanResidues(session, prefix, options = {}) {
|
|
|
116
134
|
const nonZeroFaces = faces.filter((item) => item.count > 0);
|
|
117
135
|
// r69 探针 F26:--all-faces 连 report 面占位都不列——「全量清单」缺未扫面会显得
|
|
118
136
|
// 覆盖完整。占位行 count 置 -1 语义化 not-scanned(不并入 totalResidues)。
|
|
119
|
-
|
|
137
|
+
// 0.8.26(探针 R F10):report 已实际扫描时不再放占位行(真实 face 已在上方)。
|
|
138
|
+
if (options.allFaces === true && !reportScanned) {
|
|
120
139
|
faces.push({ face: "report", count: -1, items: [], note: "not-scanned——报表残留判定用 report.tree(树)+ report.get(BI 残留看 readback.biResidue)" });
|
|
121
140
|
}
|
|
122
141
|
const compact = options.allFaces === true ? faces : nonZeroFaces;
|
|
123
|
-
// 探针 J F9 + 探针
|
|
124
|
-
//
|
|
125
|
-
|
|
126
|
-
// 真正扫过之后再让 complete 变 true。
|
|
127
|
-
const unscanned = UNSCANNED_FACE_CHECKS;
|
|
142
|
+
// 探针 J/L F9 + 探针 R F10:report 面默认由 CLI 扫描(应用树 type=Report);
|
|
143
|
+
// 只有未扫(--no-report / 库函数默认)或读失败时,才保留未扫描面与补扫命令。
|
|
144
|
+
const unscanned = reportScanned ? [] : UNSCANNED_FACE_CHECKS;
|
|
128
145
|
const unscannedFaces = unscanned.map((check) => check.face);
|
|
129
146
|
const complete = unscannedFaces.length === 0;
|
|
147
|
+
const scannedFaceNames = [
|
|
148
|
+
"model", "folder", "custompage",
|
|
149
|
+
...(options.deep !== false ? ["rule", "datarule", "onlinejs"] : []),
|
|
150
|
+
...(reportScanned ? ["report"] : []),
|
|
151
|
+
];
|
|
130
152
|
return {
|
|
131
153
|
prefix,
|
|
132
154
|
faces: compact,
|
|
@@ -148,7 +170,9 @@ export async function scanResidues(session, prefix, options = {}) {
|
|
|
148
170
|
: "residues",
|
|
149
171
|
// r70 探针01-F7:真残留存在时顶层 clean:true 仍误导(coverage 在深处,首屏只看
|
|
150
172
|
// clean)——caveat 常驻顶层,紧贴 clean 键。
|
|
151
|
-
cleanCaveat:
|
|
173
|
+
cleanCaveat: reportScanned
|
|
174
|
+
? "clean 覆盖本次全部扫描面(含 report:应用树 type=Report 节点);报表的 BI 图/数据源残留仍看 report.get 的 readback.biResidue"
|
|
175
|
+
: "clean 仅指已扫描面(scanned faces only);report 面未扫描(报表资源残留用 report.tree + report.get 判)",
|
|
152
176
|
...(unscanned.length > 0
|
|
153
177
|
? {
|
|
154
178
|
cleanScope: "scanned-faces",
|
|
@@ -159,12 +183,22 @@ export async function scanResidues(session, prefix, options = {}) {
|
|
|
159
183
|
mandatoryChecks: unscanned,
|
|
160
184
|
}
|
|
161
185
|
: {}),
|
|
162
|
-
coverage: {
|
|
186
|
+
coverage: {
|
|
187
|
+
report: reportScanned
|
|
188
|
+
? "scanned(应用树 type=Report,code/name 前缀过滤;BI 残留看 report.get 的 readback.biResidue)"
|
|
189
|
+
: "not-scanned(用 report.tree + report.get 判,BI 残留看 readback.biResidue)",
|
|
190
|
+
workflow: "模板跟模型走(模型删即删)",
|
|
191
|
+
},
|
|
163
192
|
...(systemPresetCount > 0 ? { systemPresetCount } : {}),
|
|
164
193
|
...(pendingCascade ? { pendingCascade: true } : {}),
|
|
194
|
+
...(options.deep === false && reportScanned
|
|
195
|
+
? { completeScopeNote: "complete 仅表示 report 面已扫;--no-deep 未深查命中模型的 rule/datarule/onlinejs" }
|
|
196
|
+
: {}),
|
|
165
197
|
note: pendingCascade
|
|
166
198
|
? "scanned faces only——模型已不存在但仍有级联面命中:平台删除为异步任务、时长不定,稍后重跑,幂等"
|
|
167
|
-
:
|
|
199
|
+
: reportScanned
|
|
200
|
+
? `本次扫描覆盖 ${scannedFaceNames.join("/")}${options.deep === false ? "(--no-deep:未深查 rule/datarule/onlinejs)" : ""};clean=true 即已扫描面零残留,BI 图/数据源残留另看 report.get 的 readback.biResidue`
|
|
201
|
+
: `scanned faces only;report 面需另行核对——本次扫描覆盖 ${scannedFaceNames.join("/")}${options.deep === false ? "(--no-deep:未深查 rule/datarule/onlinejs)" : ""};clean 仅指已扫描面,全局零残留看 complete + mandatoryChecks`,
|
|
168
202
|
};
|
|
169
203
|
}
|
|
170
204
|
export async function cmdResidue(prefix, options, transport) {
|
|
@@ -173,7 +207,9 @@ export async function cmdResidue(prefix, options, transport) {
|
|
|
173
207
|
try {
|
|
174
208
|
const context = makeToolContext({ sessions: new SessionManager(new ConfigStore(defaultPaths())) });
|
|
175
209
|
const session = await context.sessions.session(options.env);
|
|
176
|
-
|
|
210
|
+
// 探针 R F10(0.8.26):CLI 默认把 report 面一起扫(一条命令 clean+complete);
|
|
211
|
+
// --no-report 恢复旧的「只扫已扫描面」口径。库函数默认仍 false(既有测试不变)。
|
|
212
|
+
const result = await scanResidues(session, prefix, { apps: options.apps, deep: options.noDeep !== true, allFaces: options.allFaces, reportScan: options.noReport !== true });
|
|
177
213
|
// r49 F12:Commander 的 optional-value 裸 --jq 传 true(不经 argParser)——归一为数组。
|
|
178
214
|
// 类型声明是数组,但 Commander 运行时对裸 optional value 会给布尔 true,断言放开比较。
|
|
179
215
|
const jqRaw = Array.isArray(options.jq) ? options.jq : options.jq === true ? [true] : options.jq !== undefined && options.jq !== null ? [String(options.jq)] : [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stalfh233/omc-cli",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.26",
|
|
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.
|
|
61
|
+
"omc-core": "0.8.26",
|
|
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.
|
|
79
|
+
"@stalfh233/omc-fake-platform": "0.8.26"
|
|
80
80
|
}
|
|
81
81
|
}
|
|
@@ -10,16 +10,17 @@ description: 中文 CloudPivot 业务配置 runbook。用于把模型、字段
|
|
|
10
10
|
## 入口
|
|
11
11
|
|
|
12
12
|
```bash
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
node "$CLI" help omc-five-piece-flow
|
|
13
|
+
omc commands --capability <id> # 单能力族工具面
|
|
14
|
+
omc commands --json # 全量目录(回退面)
|
|
15
|
+
omc describe <tool>
|
|
16
|
+
omc contract <lane>
|
|
17
|
+
omc call discover_environment --env <env> --args '{}'
|
|
18
|
+
omc help omc-config-draft-review
|
|
19
|
+
omc help omc-five-piece-flow
|
|
21
20
|
```
|
|
22
21
|
|
|
22
|
+
> 全局安装后用 `omc`。只有在源码仓库里才用本地构建:`node packages/omc-cli/dist/cli.js …`(任意业务目录没有这个文件,照抄会 `MODULE_NOT_FOUND`)。
|
|
23
|
+
|
|
23
24
|
## 需求五维
|
|
24
25
|
|
|
25
26
|
把需求拆成五个维度(注意:这是**需求维度**,不同于 `omc-five-piece-flow` 的"五件套"执行五阶段):
|
|
@@ -53,7 +54,7 @@ node "$CLI" help omc-five-piece-flow
|
|
|
53
54
|
|
|
54
55
|
## 子表
|
|
55
56
|
|
|
56
|
-
|
|
57
|
+
一个主表可以有多个子表,但子表不能嵌套子表。**子表 schema code = 父 CHILD_TABLE 字段的 code**(下面 `code:"expenseItems"` 时子表 schema 就是 `expenseItems`);任务书要 `expense_items` 就把字段 code 直接命名成 `expense_items`——平台不接受另起 subSchemaCode,创建回执的 `readback.childSchema` 会回显实际映射。
|
|
57
58
|
|
|
58
59
|
创建父字段:
|
|
59
60
|
|