@stalfh233/omc-cli 0.8.20 → 0.8.22

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.
@@ -88,6 +88,50 @@ export function parseStep(raw) {
88
88
  const detail = parseStepDetail(raw);
89
89
  return { name: detail.name, participant: detail.participant };
90
90
  }
91
+ /**
92
+ * 默认查询:读 `org.role.users`(只读)。测试可注入替身(CLI 级嵌套调用无法共享
93
+ * harness 的进程内 session)。
94
+ */
95
+ const roleMemberLookup = async (roleCode, environment, request) => runToolCall("org.role.users", { args: { roleCode, ...(environment ? { environment } : {}) }, requestId: request, environment, print: () => undefined });
96
+ export async function roleMemberChecks(steps, environment, request, lookup = roleMemberLookup, schemaCode = "<schema>",
97
+ /** apply 路径:未给 --env 时 runToolCall 会落到默认环境,仍可预检。dry-run 不碰环境。 */
98
+ probeDefaultEnv = false) {
99
+ const checks = [];
100
+ // 没有 --env 时 dry-run 不访问环境(既有契约);apply 走默认环境仍预检。
101
+ if (environment === undefined && !probeDefaultEnv)
102
+ return checks;
103
+ for (const raw of steps) {
104
+ const detail = parseStepDetail(raw);
105
+ if (detail.kind !== "role")
106
+ continue;
107
+ const outcome = await lookup(detail.code, environment, request);
108
+ const result = (outcome.result ?? {});
109
+ const count = typeof result.count === "number" ? result.count : Array.isArray(result.members) ? result.members.length : undefined;
110
+ if (outcome.exitCode !== 0 || count === undefined) {
111
+ checks.push({
112
+ activity: detail.name,
113
+ kind: "role",
114
+ roleCode: detail.code,
115
+ memberCount: "unknown",
116
+ warning: `@role:${detail.code} 的成员数读取失败(${String(result.blocker ?? result.status ?? "unknown")}):发布后审批人能否解析未知;可用 org.role.users 复核,或改用 名称@user:<userId>。`,
117
+ });
118
+ continue;
119
+ }
120
+ checks.push({
121
+ activity: detail.name,
122
+ kind: "role",
123
+ roleCode: detail.code,
124
+ memberCount: count,
125
+ ...(count === 0
126
+ ? {
127
+ warning: `@role:${detail.code} 当前 0 个成员:FindUserByRole 解析不出审批人——流程可以发布,但没人能审(回执看起来是「已发布=可用」)。改用 名称@user:<userId> 绑定具体审批人(org.user.search / org.role.users 取 id)。`,
128
+ nextCommand: `omc approval-flow --schema ${schemaCode} --steps "${detail.name}@user:<userId>" --env ${environment ?? "<env>"}`,
129
+ }
130
+ : {}),
131
+ });
132
+ }
133
+ return checks;
134
+ }
91
135
  /**
92
136
  * F11(0.8.7 探针 B):dry-run 回执里 user 参与者的 `corpId:"other"` 是 **CLI
93
137
  * 自己**为 `--steps 名称@user:<id>` 生成的占位(见 parseStepDetail),不是平台
@@ -219,6 +263,7 @@ export async function cmdApprovalFlow(args) {
219
263
  "workflow.permissions 只设谁能发起,不是行级可见范围(行级数据权限当前工具面不支持)。";
220
264
  if (!apply) {
221
265
  const compiledParticipantNotes = participantNotes(steps, environment);
266
+ const roleChecks = await roleMemberChecks(steps, environment, request, roleMemberLookup, schema);
222
267
  writeEnvelope(envelope("ok", {
223
268
  // 等同于 `omc call` 契约:结果顶层必须有 status。预览未写环境 → dry-run
224
269
  // (与 model-scaffold/field-add 的预览口径一致),信封仍是 ok/exit 0。
@@ -229,6 +274,7 @@ export async function cmdApprovalFlow(args) {
229
274
  dryRun: true,
230
275
  crossAccountApproval,
231
276
  ...(compiledParticipantNotes.length > 0 ? { participantNotes: compiledParticipantNotes } : {}),
277
+ ...(roleChecks.length > 0 ? { participantChecks: roleChecks } : {}),
232
278
  linearOnly: true,
233
279
  rowLevelDataPermission: "unsupported",
234
280
  note: `dry-run 仅编译预览;--apply 执行 workflow.create(无流程时)→update(模板+字段权限)→publish。边界:非发起人身份的审批无法在单会话 CLI 内推进(单 token);若要验跨账号审批,用第二账号另建环境,或把参与人设为 {Originator}。${linearOnlyNote}`,
@@ -287,13 +333,25 @@ export async function cmdApprovalFlow(args) {
287
333
  return updateOutcome.exitCode;
288
334
  }
289
335
  // 4) publish
336
+ const roleChecks = await roleMemberChecks(steps, environment, request, roleMemberLookup, schema, true);
290
337
  const publishOutcome = await runToolCall("workflow.publish", { args: { schemaCode: schema, code: compiled.workflowCode, ...(environment ? { environment } : {}) }, requestId: request, environment, print: () => undefined });
291
338
  const classified = classifyResult(publishOutcome.result);
292
339
  // 与 `omc call` 一致:结果顶层带生产者 status(成功 ok / 被拒 refused / 部分
293
340
  // partial…),publish 的原始回执继续留在 publish 下。ok 与 status 因此不会
294
341
  // 出现「ok:false + status:ok」。
295
342
  const publishStatus = String(publishOutcome.result?.status ?? "ok");
296
- writeEnvelope(envelope(classified.status, { status: publishStatus, schemaCode: schema, workflowCode: compiled.workflowCode, steps: steps.length, ...(originatorName !== undefined ? { originatorName, originatorNameNote: ORIGINATOR_NAME_NOTE } : {}), crossAccountApproval, ...preexistingSection, publish: publishOutcome.result }, request, classified.error));
343
+ writeEnvelope(envelope(classified.status, {
344
+ status: publishStatus,
345
+ schemaCode: schema,
346
+ workflowCode: compiled.workflowCode,
347
+ steps: steps.length,
348
+ // 探针 O F7(0.8.21):apply 回执直接给本次提交的节点显示名,并给一条读回命令;
349
+ // 显示名是否被平台改写以 workflow.get_published 为准(不在写回执里假装已验)。
350
+ activities: compiled.activities.map((activity) => ({ code: activity.activityCode, name: activity.activityName, type: activity.activityType })),
351
+ activityNamesNote: `name 是本次提交的编译值;apply 后以 workflow.get_published 的 activities[].name 为准(平台可能把发起节点钉回首建名${originatorName !== undefined ? ",见 originatorNameNote" : ""})。`,
352
+ verifyCommand: `omc call workflow.get_published --env ${environment ?? "<env>"} --args '${JSON.stringify({ schemaCode: schema, workflowCode: compiled.workflowCode })}'`,
353
+ ...(originatorName !== undefined ? { originatorName, originatorNameNote: ORIGINATOR_NAME_NOTE } : {}), ...(roleChecks.length > 0 ? { participantChecks: roleChecks } : {}), crossAccountApproval, ...preexistingSection, publish: publishOutcome.result
354
+ }, request, classified.error));
297
355
  if (publishOutcome.exitCode === 0)
298
356
  process.stderr.write("[omc] 前台生效验证清单:1) 造一条数据提交走流程;2) 每级审批人在门户有待办(角色用 FindUserByRole 需审批人挂在发起人同部门,否则 PENDING 不来);3) 审批节点字段只读(不可改单);4) 驳回退发起人核对;5) 设计器打开流程确认节点链显示正常。边界:非发起人身份的审批无法在单会话 CLI 内推进(单 token);跨账号请另建环境或把参与人设为 {Originator}。\n");
299
357
  return publishOutcome.exitCode;
package/dist/cli.js CHANGED
@@ -3159,7 +3159,7 @@ function shellQuote(value) {
3159
3159
  for (const requested of requestedSections) {
3160
3160
  const sliced = readSkillSection(topic, requested);
3161
3161
  if (sliced?.section)
3162
- found.push({ section: sliced.heading ?? requested, ...(sliced.heading !== requested ? { requested } : {}), ...(sliced.matchType === "partial" ? { matchType: "partial" } : {}), content: sliced.section, chars: sliced.section.length, bytes: Buffer.byteLength(sliced.section, "utf8") });
3162
+ found.push({ section: sliced.heading ?? requested, ...(sliced.heading !== requested ? { requested } : {}), ...(sliced.matchType === "partial" ? { matchType: "partial" } : {}), ...(sliced.sectionHint !== undefined ? { sectionHint: sliced.sectionHint } : {}), content: sliced.section, chars: sliced.section.length, bytes: Buffer.byteLength(sliced.section, "utf8") });
3163
3163
  else
3164
3164
  missing.push(requested);
3165
3165
  }
@@ -3196,6 +3196,7 @@ function shellQuote(value) {
3196
3196
  section: sliced.heading ?? singleSection,
3197
3197
  ...(sliced.heading !== singleSection || sliced.matchType === "partial" ? { requested: singleSection } : {}),
3198
3198
  ...(sliced.matchType === "partial" ? { matchType: "partial" } : {}),
3199
+ ...(sliced.sectionHint !== undefined ? { sectionHint: sliced.sectionHint } : {}),
3199
3200
  chars: sliced.section.length,
3200
3201
  bytes: Buffer.byteLength(sliced.section, "utf8"),
3201
3202
  complete: true,
package/dist/coverage.js CHANGED
@@ -125,10 +125,9 @@ function citationFor(item, requestedScope) {
125
125
  export function versionFamilyNotice(manifest, detectedVersion) {
126
126
  if (detectedVersion.startsWith(manifest.version_family + "."))
127
127
  return undefined;
128
- return (`兼容模式:检测到 CloudPivot ${detectedVersion},不在 OMC 锚定的 ${manifest.version_family} 族` +
129
- `(锚点 ${manifest.anchor_version})。OMC 基于 8.6 构建,非 8.6 环境按兼容支持,部分能力面可能不适用。` +
130
- `取证口径:以本环境真机实测为准,8.6 文档与反编译结论仅作参考。` +
131
- `族差异清单见 docs/platform-contracts/2.1-delta.md(逐条带 file:line;未登记的条目按实测,不臆断同形或不同形)。`);
128
+ // 探针 P F9(0.8.22):每次回执约 400B 的固定噪声压到一句;细节留在族差异文档。
129
+ return (`兼容模式:检测到 CloudPivot ${detectedVersion}(不在锚定的 ${manifest.version_family} 族,锚点 ${manifest.anchor_version});` +
130
+ `按兼容支持放行,以本环境真机实测为准,族差异见 docs/platform-contracts/2.1-delta.md。`);
132
131
  }
133
132
  /**
134
133
  * 无版本证据时的兼容提示(2026-11-24 产品口径)。
@@ -1114,12 +1114,22 @@ function dataruleHintFor(goal) {
1114
1114
  const codes = [...new Set(goal.match(GRAPH_OBJECT_RE) ?? [])];
1115
1115
  const schemaCode = codes.length === 1 ? codes[0] : "<schemaCode>";
1116
1116
  const firstCommand = `omc call datarule.list --args '{"schemaCode":"${schemaCode}"}'`;
1117
+ // 计算/汇总类词优先:`金额大于0时自动计算汇总` 是 type2,不是提交校验;
1118
+ // 只有「计算词缺席 + 校验词/阈值词在场」才判校验(阈值词本身两类都常见)。
1119
+ const computeAsk = /(计算|汇总|求和|赋值|公式|联动|自动填|带出|算总|平均|占比|合计)/.test(goal);
1120
+ const validateAsk = /(校验|必填|重复|正则|长度|不早于|不晚于|不能|不得)/.test(goal);
1121
+ const comparisonAsk = /(大于|小于|超过|低于|>=?|<=?)/.test(goal);
1122
+ const validationAsk = !computeAsk && (validateAsk || comparisonAsk);
1117
1123
  return {
1118
1124
  why: codes.length === 1 ? `问到「${codes[0]}」的数据规则` : "问到数据规则(未给出唯一 schemaCode)",
1119
1125
  firstCommand,
1120
1126
  commands: [
1121
1127
  `${firstCommand} # 只读:该模型全部数据规则(type/字段/条件/启用状态)`,
1122
- `omc describe datarule.create --example field-compute-rule # 字段计算/赋值/校验的创建形状`,
1128
+ // 探针 O F13(0.8.21):校验类需求(金额>0/必填/重复…)给 type1 示例;
1129
+ // 计算/赋值才给 type2——原先一律给 field-compute-rule,方向反了。
1130
+ validationAsk
1131
+ ? `omc describe datarule.create --example submit-field-vs-constant # 提交校验(type1+checkType2)的创建形状`
1132
+ : `omc describe datarule.create --example field-compute-rule # 字段计算/赋值(type2)的创建形状`,
1123
1133
  ],
1124
1134
  note: "数据规则按字段/记录条件触发,与业务规则(rule)和流程绑定是不同面;入口是 datarule.list(只读),写入走 datarule.create/update/delete。",
1125
1135
  };
@@ -1030,11 +1030,16 @@ export function registerFieldLane(tools) {
1030
1030
  String(args.propertyType) === "RADIO" ||
1031
1031
  String(args.propertyType) === "CHECKBOX" ||
1032
1032
  String(args.propertyType) === "SELECTION";
1033
+ const createdRow = rows.find((row) => (row.code ?? row.propertyCode) === args.code);
1034
+ const createdOptions = createdRow?.options !== undefined && createdRow.options !== null ? parseFieldOptionsForReadback(createdRow.options) : undefined;
1033
1035
  return {
1034
1036
  performed: { errcode: performed.errcode },
1035
1037
  readback: {
1036
1038
  face: "draft",
1037
- draftFieldPresent: rows.some((row) => (row.code ?? row.propertyCode) === args.code),
1039
+ draftFieldPresent: createdRow !== undefined,
1040
+ // 探针 P F5(0.8.22):写回执回显**生效值**(scale/format/mappings 等只在
1041
+ // options 里的语义),省掉一次 field.get 才能核对单位/精度/映射方向。
1042
+ ...(createdOptions !== undefined ? { options: createdOptions } : {}),
1038
1043
  ...(prepared.normalized ? { normalized: prepared.normalized } : {}),
1039
1044
  ...(textLike
1040
1045
  ? {
@@ -56,7 +56,7 @@ export function dataSubmitDescription() {
56
56
  /** Runtime business-object data keyed by field code. */
57
57
  export const runtimeFormDataArg = z
58
58
  .record(z.string(), z.unknown())
59
- .describe('business-object data keyed by field code, e.g. { name:"...", omc_x_amount:123, omc_x_rel:"<target objectId>" }. Relation value SHAPE depends on the field type (live 2026-09-24): a SINGLE relation (WORK_SHEET, propertyType 9) takes the target object id string or an object { id, name? } — an ARRAY here makes runtime/form/save answer 50000; a MULTI relation (propertyType 11) takes an array. STAFF/ORG fields (propertyType 50/51/60/61) take an array of selection objects `[{ id, type, name }]` where `type` is MANDATORY (BizField.parseFromClient casts `type` to Integer and calls intValue(); omitting it answers 50000) — `type` is the UnitType index: USER=3, DEPARTMENT=1. When unsure, prefer "id" or { id }. Field `mappings` are applied by the form RUNTIME when a user picks a value — a server-side data.save does NOT copy source→target, so API callers must set the mapped fields themselves.');
59
+ .describe('business-object data keyed by field code, e.g. { name:"...", omc_x_amount:123, omc_x_rel:"<target objectId>" }. Relation value SHAPE depends on the field type (live 2026-09-24): a SINGLE relation (WORK_SHEET, propertyType 9) takes the target object id string or an object { id, name? } — an ARRAY here makes runtime/form/save answer 50000; a MULTI relation (propertyType 11) is written as a semicolon-joined string "id1;id2" (the array is the readback shape). STAFF/ORG fields (propertyType 50/51/60/61) take an array of selection objects `[{ id, type, name }]` where `type` is MANDATORY (BizField.parseFromClient casts `type` to Integer and calls intValue(); omitting it answers 50000) — `type` is the UnitType index: USER=3, DEPARTMENT=1. When unsure, prefer "id" or { id }. 子表字段(CHILD_TABLE)用字段 code 直接作键:`"<子表字段code>": [{<子列code>:value}]`(不是固定 items;行内关联/人员形状与顶层字段写侧一致)。 Field `mappings` are applied by the form RUNTIME when a user picks a value — a server-side data.save does NOT copy source→target, so API callers must set the mapped fields themselves.');
60
60
  export const RUNTIME_DATA_LANE_CONTRACT = Object.freeze({
61
61
  lane: LANES.runtimeData,
62
62
  family: CONTRACT_FAMILY,
@@ -2617,9 +2617,27 @@ export function registerRuntimeDataLane(tools) {
2617
2617
  ...(unprojectedCodes.length > 0 && items.length <= 10
2618
2618
  ? { rowsProjected: true, unprojectedFieldCount: unprojectedCodes.length }
2619
2619
  : {}),
2620
+ // 探针 O F5(0.8.21,P1):`full:true` 只展开行/子表载荷,**不改变**
2621
+ // 列表的视图列投影;未投影列仍不在 items[].fields(不是值为空)。
2622
+ ...(args.full === true && unprojectedCodes.length > 0
2623
+ ? {
2624
+ fullProjectionNote: `full:true 只展开行/子表载荷,不改变列表的视图列投影:未投影列(${unprojectedCodes.slice(0, 10).join("、")})不会出现在 items[].fields,不代表未落库。整行真值用 data.load {schemaCode,bizObjectId}(路径见 items[].id)。`,
2625
+ }
2626
+ : {}),
2620
2627
  ...(projectionMissAll.length > 0 ? { projectionMiss: projectionMissAll } : {}),
2621
2628
  ...(columnsNotProjected.length > 0 ? { columnsNotProjected } : {}),
2622
2629
  ...(columnsOutsideView.length > 0 ? { columnsOutsideView, columnsNarrowingOnly: true, columnsNote: DATA_LIST_COLUMNS_NARROWING_NOTE } : {}),
2630
+ // 探针 P F7(0.8.22):请求列全在视图外时 items[].fields 必然为空——不是
2631
+ // 数据丢失。给一句结论 + 单条真值的可复制命令。
2632
+ ...(itemsFinal.length > 0 && fields !== undefined && fields.length > 0 && viewEvidence?.viewColumnCodes !== undefined
2633
+ && fields.every((code) => columnsOutsideView.includes(code))
2634
+ ? {
2635
+ projectionEmptyNote: "本次 --fields 的列都没有出现在结果行(不在视图列或未被投影):items[].fields 为空是投影结果,不是数据丢失。单条真值用 data.load(见下方 nextCommand);列表要看这些列请核对视图列配置。",
2636
+ ...(typeof itemsFinal[0]?.id === "string"
2637
+ ? { projectionEmptyNextCommand: `omc call data.load --env <env> --args '${JSON.stringify({ schemaCode: args.schemaCode, bizObjectId: itemsFinal[0].id })}'` }
2638
+ : {}),
2639
+ }
2640
+ : {}),
2623
2641
  ...(dateReadbackNote !== undefined ? { dateReadbackNote } : {}),
2624
2642
  items: itemsFinal,
2625
2643
  };
@@ -2832,9 +2850,24 @@ export function registerRuntimeDataLane(tools) {
2832
2850
  ...(unprojectedCodes.length > 0 && items.length <= 10
2833
2851
  ? { rowsProjected: true, unprojectedFieldCount: unprojectedCodes.length }
2834
2852
  : {}),
2853
+ ...(args.full === true && unprojectedCodes.length > 0
2854
+ ? {
2855
+ fullProjectionNote: `full:true 只展开行/子表载荷,不改变列表的视图列投影:未投影列(${unprojectedCodes.slice(0, 10).join("、")})不会出现在 items[].fields,不代表未落库。整行真值用 data.load {schemaCode,bizObjectId}(路径见 items[].id)。`,
2856
+ }
2857
+ : {}),
2835
2858
  ...(projectionMissPaged.length > 0 ? { projectionMiss: projectionMissPaged } : {}),
2836
2859
  ...(columnsNotProjected.length > 0 ? { columnsNotProjected } : {}),
2837
2860
  ...(columnsOutsideView.length > 0 ? { columnsOutsideView, columnsNarrowingOnly: true, columnsNote: DATA_LIST_COLUMNS_NARROWING_NOTE } : {}),
2861
+ // 探针 P F7(0.8.22):请求列全在视图外时 items[].fields 必然为空——不是数据丢失。
2862
+ ...(itemsFinal.length > 0 && fields !== undefined && fields.length > 0 && viewEvidence?.viewColumnCodes !== undefined
2863
+ && fields.every((code) => columnsOutsideView.includes(code))
2864
+ ? {
2865
+ projectionEmptyNote: "本次 --fields 的列都没有出现在结果行(不在视图列或未被投影):items[].fields 为空是投影结果,不是数据丢失。单条真值用 data.load(见下方 nextCommand);列表要看这些列请核对视图列配置。",
2866
+ ...(typeof itemsFinal[0]?.id === "string"
2867
+ ? { projectionEmptyNextCommand: `omc call data.load --env <env> --args '${JSON.stringify({ schemaCode: args.schemaCode, bizObjectId: itemsFinal[0].id })}'` }
2868
+ : {}),
2869
+ }
2870
+ : {}),
2838
2871
  ...(dateReadbackNote !== undefined ? { dateReadbackNote } : {}),
2839
2872
  totalPages,
2840
2873
  itemsCount: items.length,
@@ -3626,7 +3659,7 @@ export function registerRuntimeDataLane(tools) {
3626
3659
  // 券商 issue 1.3(cpdocs 2026-10-27):更新既有记录的主键契约——平台
3627
3660
  // BizObjectModel.getId() 只读 bizObject.data.id;顶层 bizObject.bizObjectId
3628
3661
  // 被保存逻辑忽略,errcode:0 但 objectId 是新 id(静默新建孤儿行)。
3629
- 'business-object data keyed by field code(关联/人员形状同默认描述)。**单选关联 WORK_SHEET 9=id 串或 `{id}`;MULT_WORK_SHEET 11/人员/组织 50/51 才数组;人员/组织元素 `{id,type,name}`,type 必填**。引擎拥有键(sequenceStatus 等)会被剥离——读改写的 sequenceStatus 不会把行钉回旧状态。新建时子表行缺 sortKey 会按数组下标补 1..n(平台读回按 sortKey ASC;更新既有记录请显式带 sortKey)。mappings 仅门户回填;子表快照字段为空会回 mappingSnapshotGap 点名行/字段;字典-backed 不校验取值(不存在/已停用码也会落库,要拦请配数据规则)。**`name` 是平台数据标题(模型可配置 summary,常见如 创建人+模型名+时间),传入会被覆盖;业务标识用自建字段**。既有记录更新:主键必须放 formData.id(顶层 bizObject.bizObjectId 被平台忽略会静默新建孤儿行——直调 REST 同理,cpdocs issue §1.3);id 无对应行会被拒(save-update-target-absent),新建请省略 id。'),
3662
+ 'business-object data keyed by field code(关联/人员形状同默认描述)。**单选关联 WORK_SHEET 9=id 串或 `{id}`;MULT_WORK_SHEET 11 写侧是分号串 `"id1;id2"`(数组是读回形状);人员/组织 50/51 写侧数组,元素 `{id,type,name}`,type 必填**;**子表用「子表字段 code」直接作键:`"<子表字段code>": [{<子列code>: value}]`(不是固定 items;行内关联/人员形状与顶层字段写侧一致,见 omc-write-hazards)**。引擎拥有键(sequenceStatus 等)会被剥离——读改写的 sequenceStatus 不会把行钉回旧状态。新建时子表行缺 sortKey 会按数组下标补 1..n(平台读回按 sortKey ASC;更新既有记录请显式带 sortKey)。mappings 仅门户回填;子表快照字段为空会回 mappingSnapshotGap 点名行/字段;字典-backed 不校验取值(不存在/已停用码也会落库,要拦请配数据规则)。**`name` 是平台数据标题(模型可配置 summary,常见如 创建人+模型名+时间),传入会被覆盖;业务标识用自建字段**。既有记录更新:主键必须放 formData.id(顶层 bizObject.bizObjectId 被平台忽略会静默新建孤儿行——直调 REST 同理,cpdocs issue §1.3);id 无对应行会被拒(save-update-target-absent),新建请省略 id。'),
3630
3663
  workflowCode: z.string().optional().describe("portal draft-save shape: create the row AND a DRAFT workflow instance + start workItem (finishStart=FALSE); submit later via data.submit with the returned workItemId. formData must NOT carry an id — in-place workflow start has no REST surface in 8.6.26。发起语义阶梯:本参数=发起停在第一节点(行/实例双 DRAFT,首办待办=发起人);到第一个审批节点用 data.submit 三件套;无流程模型用 submit:true 一调完成态;代他人发起(可选发起人)唯一路径=业务规则 CREATE+startWorkflow(完成态发起,不留草稿待办)"),
3631
3664
  submit: z.boolean().optional().describe("true=保存后立即直提(无流程模型 DRAFT→COMPLETED,触发 Create 规则);与 workflowCode 互斥。**按业务约定正式数据优先直接 data.submit(无 id=新建并提交一调完成)——本参数是便捷别名,save 的定位是草稿/暂存**"),
3632
3665
  allowStaffOnSubmit: z.boolean().optional().describe("submit:true 时显式允许携带人员字段(issue#10:人员字段提交面两种形状都可能 50000,可靠链路是 save 落库后提交时省略;个别平台构建接受提交面携带,自担风险)"),
@@ -3971,7 +3971,7 @@ export function registerWorkflowLane(tools) {
3971
3971
  code,
3972
3972
  name,
3973
3973
  ...(fieldCodes.length > 0 ? { fieldCodes } : {}),
3974
- action: "移除指向本流程的 add 绑定(其余动作原样保留)",
3974
+ action: "移除指向本流程的 add 动作(add 的语义就是发起本流程,整条会消失,不是只删关联);其余动作原样保留。需要恢复新增按钮时用 listview.configure {actions:[], defaultActions:true} 重建(defaultActions 需要 actions 意图才生效)。",
3975
3975
  })),
3976
3976
  }
3977
3977
  : {}),
package/dist/plan.js CHANGED
@@ -62,8 +62,29 @@ function summarizedArgs(tool, args) {
62
62
  else if (Array.isArray(value) || (value && typeof value === "object") || typeof value === "string") {
63
63
  summary[`${key}Summary`] = summarizeValue(value);
64
64
  const preview = smallStringPreview(value);
65
- if (preview !== undefined)
65
+ if (preview !== undefined) {
66
+ // 探针 O F4(0.8.21):关联映射的方向是「写反即配置错」的核心,dry-run 的
67
+ // optionsPreview 必须能自查 source→target(原先只给 sha256 + 标量键)。
68
+ if (key === "options" && value !== null && typeof value === "object" && !Array.isArray(value)) {
69
+ const rawMappings = value.mappings;
70
+ let mappings = rawMappings;
71
+ if (typeof rawMappings === "string" && rawMappings.trim() !== "") {
72
+ try {
73
+ mappings = JSON.parse(rawMappings);
74
+ }
75
+ catch {
76
+ mappings = undefined;
77
+ }
78
+ }
79
+ if (Array.isArray(mappings) && mappings.length > 0) {
80
+ const pairs = mappings.slice(0, 5).map((entry) => entry !== null && typeof entry === "object"
81
+ ? `${String(entry.source ?? "?")}→${String(entry.target ?? "?")}`
82
+ : String(entry));
83
+ preview.mappings = mappings.length > pairs.length ? `${pairs.join(", ")} …(共 ${mappings.length} 对)` : pairs.join(", ");
84
+ }
85
+ }
66
86
  summary[`${key}Preview`] = preview;
87
+ }
67
88
  }
68
89
  else {
69
90
  summary[key] = value;
package/dist/skills.js CHANGED
@@ -303,7 +303,26 @@ export function readSkillSection(name, requested) {
303
303
  if (start < 0)
304
304
  return { document, section: "", headings };
305
305
  const startEntry = scanned.find((entry) => entry.index === start);
306
- return { document, section: sliceSectionText(lines, startEntry.index, startEntry.level), headings, heading: startEntry.heading, matchType };
306
+ // 探针 P F1(0.8.22):数字按**标题序号**匹配,不是文档第 N 篇。文档常有未编号的
307
+ // 前置节(omc-start-here 的「最小路径」),`--section 1` 会落到「1. Task → …」。
308
+ // 行为不变(序号语义有既有用户),但回执点明位置与第一篇,省一次重试。
309
+ // 复核:position 只数 level-2 篇(H1/H3 不算),并**不**生成带引号的复制命令
310
+ // (标题里可能有 `"`,截断前缀会拼出坏命令)。
311
+ const level2 = scanned.filter((entry) => entry.level === 2);
312
+ const position = level2.findIndex((entry) => entry.index === start) + 1;
313
+ const firstSection = level2[0] ?? scanned[0];
314
+ const ordinalMismatch = requestedOrdinal !== undefined && position > 0 && position !== Number(requestedOrdinal);
315
+ const sectionHint = ordinalMismatch && firstSection !== undefined
316
+ ? `--section 数字按**标题序号**匹配(本次命中文档第 ${position} 篇「${startEntry.heading}」),不是文档第 ${requestedOrdinal} 篇「${firstSection.heading}」;想按位置读请用标题前缀:--section '<该篇标题或前缀>'。`
317
+ : undefined;
318
+ return {
319
+ document,
320
+ section: sliceSectionText(lines, startEntry.index, startEntry.level),
321
+ headings,
322
+ heading: startEntry.heading,
323
+ matchType,
324
+ ...(sectionHint !== undefined ? { sectionHint } : {}),
325
+ };
307
326
  }
308
327
  /**
309
328
  * The "shape" of a topic: every heading with the bytes it would cost to read.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stalfh233/omc-cli",
3
- "version": "0.8.20",
3
+ "version": "0.8.22",
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.20",
61
+ "omc-core": "0.8.22",
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.20"
79
+ "@stalfh233/omc-fake-platform": "0.8.22"
80
80
  }
81
81
  }