@stalfh233/omc-cli 0.6.79 → 0.6.80

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.
@@ -144,22 +144,53 @@ export function inputAliasSynonymKeys(toolName) {
144
144
  synonyms.push(...list);
145
145
  return synonyms;
146
146
  }
147
+ /**
148
+ * r83:规范键可由**另一个键**满足的登记(保持 JSON schema 的必填面稳定)。
149
+ *
150
+ * 背景:`rule.list` 的 `schemaCode` 是历史必填键(`commands` 目录、golden、
151
+ * A2/A3 必填参数面都按它对齐)。r83 要给同一工具加 `schemaCodes[]` 跨模型
152
+ * 清单——若把 `schemaCode` 改成 optional,整个必填面/目录/golden 一起漂移。
153
+ * 这里保留 schema 的必填声明,只在调用方**只传了备选键**时补一个占位值让
154
+ * 校验通过;handler 识别占位符(`REQUIRED_ALTERNATIVE_PLACEHOLDER`)并走
155
+ * 备选语义。占位值永远不会被当成真实业务 code 使用,也不是默认值。
156
+ */
157
+ export const REQUIRED_ALTERNATIVE_PLACEHOLDER = "__omc-required-alternative__";
158
+ const TOOL_INPUT_REQUIRED_ALTERNATIVES = Object.freeze({
159
+ "rule.list": Object.freeze({ schemaCode: "schemaCodes" }),
160
+ });
161
+ /** 该工具的这个规范键是否由备选键填充(handler 用来区分「用户真传了」与占位)。 */
162
+ export function isRequiredAlternativePlaceholder(value) {
163
+ return value === REQUIRED_ALTERNATIVE_PLACEHOLDER;
164
+ }
147
165
  function applyInputAliases(tool, input) {
148
- const aliases = TOOL_INPUT_ALIASES[tool.name];
149
- if (!aliases)
150
- return input;
151
166
  let normalized;
152
- for (const [canonical, synonyms] of Object.entries(aliases)) {
153
- if (input[canonical] !== undefined)
154
- continue;
155
- const hit = synonyms.find((synonym) => input[synonym] !== undefined);
156
- if (hit === undefined)
157
- continue;
158
- normalized ??= { ...input };
159
- normalized[canonical] = input[hit];
160
- // 同义词键就地删除:归一后的输入只留规范键——写面未知键 fail-closed
161
- // (r43 后)不把已消费的同义词误报成未知键。
162
- delete normalized[hit];
167
+ const aliases = TOOL_INPUT_ALIASES[tool.name];
168
+ if (aliases) {
169
+ for (const [canonical, synonyms] of Object.entries(aliases)) {
170
+ if (input[canonical] !== undefined)
171
+ continue;
172
+ const hit = synonyms.find((synonym) => input[synonym] !== undefined);
173
+ if (hit === undefined)
174
+ continue;
175
+ normalized ??= { ...input };
176
+ normalized[canonical] = input[hit];
177
+ // 同义词键就地删除:归一后的输入只留规范键——写面未知键 fail-closed
178
+ // (r43 后)不把已消费的同义词误报成未知键。
179
+ delete normalized[hit];
180
+ }
181
+ }
182
+ const alternatives = TOOL_INPUT_REQUIRED_ALTERNATIVES[tool.name];
183
+ if (alternatives) {
184
+ for (const [canonical, from] of Object.entries(alternatives)) {
185
+ const current = normalized ?? input;
186
+ if (current[canonical] !== undefined)
187
+ continue;
188
+ const source = current[from];
189
+ if (source === undefined || (Array.isArray(source) && source.length === 0))
190
+ continue;
191
+ normalized ??= { ...input };
192
+ normalized[canonical] = REQUIRED_ALTERNATIVE_PLACEHOLDER;
193
+ }
163
194
  }
164
195
  return normalized ?? input;
165
196
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stalfh233/omc-cli",
3
- "version": "0.6.79",
3
+ "version": "0.6.80",
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.79",
59
+ "omc-core": "0.6.80",
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.79"
77
+ "@stalfh233/omc-fake-platform": "0.6.80"
78
78
  }
79
79
  }
@@ -142,6 +142,7 @@ only the section for the capability you need —
142
142
 
143
143
  - **能做哪些事**:图形规则图(nodeGraph)——数据事件(Create/Update/Delete)触发、按钮/流程触发、动作节点(UPDATE/CREATE/DELETE/QUERY/ASSIGN/MESSAGE/BIZ_ACTION/GET_LIST…)、BRANCH 条件分支、**定时任务 TIMING_TASK**(每天/周期,SCHEDULER 节点)。
144
144
  - **工具**:`rule.list`、`rule.get`、`rule.references`(跨规则引用检索:谁引用了服务/模型/字段)、`rule.save`、`rule.node.update`、`rulelog.search`(**规则执行日志审计入口**:规则触发没触发/哪行/节点链——data.update 后查 F31)
145
+ - **批量/清单(r83)**:`rule.list {schemaCodes:[…]}` 跨模型清单(逐模型读,`models[].modelPresent` / `partial+failed[]`,≤20 模型);`rule.list {withMappings:true}` 每行附 `mappings[]={nodeCode,serviceCode,serviceMethodCode,inputCount,outputCount}` 摘要(正文仍用 `rule.get`);`rule.get {schemaCodes:[…],ruleCodes:[…],summary:true}` 跨模型扫规则图,部分失败不整单失败。
145
146
  - **recipe**:
146
147
  - `omc describe rule.save --example standard-business-rule-graph`
147
148
  - `omc describe rule.save --example business-rule-branch-conditional`