@stalfh233/omc-cli 0.5.15 → 0.5.16

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.
@@ -64,6 +64,35 @@ function projectRuleGraph(nodes, routes, full) {
64
64
  };
65
65
  return { nodes: strip(nodes, RULE_NODE_LAYOUT_KEYS), routes: strip(routes, RULE_ROUTE_LAYOUT_KEYS) };
66
66
  }
67
+ /**
68
+ * `rule.get` 的默认投影:保住语义图(nodes/routes),只剥确定性布局。
69
+ *
70
+ * 不能依赖通用 `compactReadback`(read.ts):它把 `nodes`/`routes` 归入
71
+ * `BULKY_READ_KEYS`,结果超过 2048B 就压成 `nodesCount`/`routesCount` ——
72
+ * 这与 `rule.get` 自己的 `full` 契约("默认返回语义图")直接冲突:任何真实
73
+ * 规则都 >2KB,于是 nodes 从不曾内联,按文档取 `.nodes` 必 `KeyError`
74
+ * (r47 实测连踩 3 次)。`workflow.get_*` 早已用同类工具级投影绕开
75
+ * (workflowCompactProjection),`rule.get` 此前漏了这一步。
76
+ */
77
+ export function ruleCompactProjection(result) {
78
+ const strip = (value, keys) => {
79
+ if (!Array.isArray(value))
80
+ return value;
81
+ return value.map((entry) => {
82
+ if (entry === null || typeof entry !== "object" || Array.isArray(entry))
83
+ return entry;
84
+ const copy = { ...entry };
85
+ for (const key of keys)
86
+ delete copy[key];
87
+ return copy;
88
+ });
89
+ };
90
+ return {
91
+ ...result,
92
+ ...(Array.isArray(result.nodes) ? { nodes: strip(result.nodes, RULE_NODE_LAYOUT_KEYS) } : {}),
93
+ ...(Array.isArray(result.routes) ? { routes: strip(result.routes, RULE_ROUTE_LAYOUT_KEYS) } : {}),
94
+ };
95
+ }
67
96
  export function registerBusinessRuleLane(tools) {
68
97
  tools.push(defineTool({
69
98
  name: "rule.list",
@@ -373,7 +402,7 @@ export function registerBusinessRuleLane(tools) {
373
402
  ...(semanticFindings ? { semanticFindings } : {}),
374
403
  ...(staleRow ? { staleRow, effectiveId, staleRowMessage } : {}),
375
404
  };
376
- }, { full: args.full === true, target: `rule.get:${args.id ?? `${args.schemaCode}/${args.ruleCode}`}` }),
405
+ }, { full: args.full === true, compact: ruleCompactProjection, target: `rule.get:${args.id ?? `${args.schemaCode}/${args.ruleCode}`}` }),
377
406
  }));
378
407
  writeTool(tools, "rule.save", RULE_LANE, RULE_TOOLS["rule.save"].scope, RULE_TOOLS["rule.save"].description, {
379
408
  schemaCode: z.string().min(1),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stalfh233/omc-cli",
3
- "version": "0.5.15",
3
+ "version": "0.5.16",
4
4
  "description": "CloudPivot 8.6 configuration capability CLI — governed, fail-closed, coverage-manifest bounded.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -52,9 +52,9 @@
52
52
  "access": "public"
53
53
  },
54
54
  "dependencies": {
55
- "@stalfh233/omc-fake-platform": "0.5.15",
55
+ "@stalfh233/omc-fake-platform": "0.5.16",
56
56
  "commander": "14.0.3",
57
- "omc-core": "0.5.15",
57
+ "omc-core": "0.5.16",
58
58
  "proper-lockfile": "4.1.2",
59
59
  "write-file-atomic": "6.0.0",
60
60
  "zod": "^3.23.8",