@stalfh233/omc-cli 0.6.65 → 0.6.67
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/cli.js +5 -3
- package/dist/config-store.js +58 -6
- package/dist/form-support.js +88 -26
- package/dist/goal-routes.js +22 -5
- package/dist/graph.js +222 -27
- package/dist/lanes/businessrule-contract.js +5 -0
- package/dist/lanes/businessrule.js +11 -3
- package/dist/lanes/field.js +2 -2
- package/dist/lanes/form-contract.js +4 -4
- package/dist/lanes/form.js +9 -2
- package/dist/lanes/rule-graph.js +15 -0
- package/dist/mcp-graph.js +56 -27
- package/dist/read-shapes.js +16 -2
- package/dist/recipes/businessrule.js +2 -1
- package/dist/refusal-guidance.js +14 -0
- package/dist/write.js +9 -4
- package/package.json +3 -3
- package/skills/omc-start-here.md +1 -1
package/dist/mcp-graph.js
CHANGED
|
@@ -3,7 +3,7 @@ import { DatabaseSync } from "node:sqlite";
|
|
|
3
3
|
import { readdirSync } from "node:fs";
|
|
4
4
|
import { basename, join, resolve, sep } from "node:path";
|
|
5
5
|
import { createInterface } from "node:readline";
|
|
6
|
-
import { GraphIndexError, graphRoot, impactGraph, listGraphIndexes, queryGraphReferences, readGraphStatus, resolveGraphDbPath, searchGraphRules, } from "./graph.js";
|
|
6
|
+
import { GRAPH_COVERAGE, GraphIndexError, graphRoot, impactGraph, listGraphIndexes, parseScopedFieldQuery, queryGraphReferences, readGraphStatus, resolveGraphDbPath, searchGraphRules, } from "./graph.js";
|
|
7
7
|
/**
|
|
8
8
|
* Stdio MCP server for the local rule-graph index (ADR-0008).
|
|
9
9
|
*
|
|
@@ -116,12 +116,20 @@ function respond(id, result) {
|
|
|
116
116
|
function respondError(id, code, message) {
|
|
117
117
|
process.stdout.write(`${JSON.stringify({ jsonrpc: "2.0", id: id ?? null, error: { code, message } })}\n`);
|
|
118
118
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
/**
|
|
120
|
+
* r72g(2026-11-17 探针)重排:第一句从「改名/删除前必查」改为**关系型快查定位**——
|
|
121
|
+
* 探针 49 次调用里「哪些字段被规则用到/改 status 注意什么/关于 amount 有哪些规则」
|
|
122
|
+
* 三问无一问一调,都是逐模型 model.inspect/rule.list 枚举出来的。索引本来就是
|
|
123
|
+
* 这些问题的第一入口,instructions 却只教了破坏性变更前置检查一个触发场景。
|
|
124
|
+
* (导出供测试钉住定位语,防止将来又被改窄。)
|
|
125
|
+
*/
|
|
126
|
+
export const INSTRUCTIONS_INDEXED = [
|
|
127
|
+
"规则/配置图检索——回答关系型配置问题的第一入口(本地索引,先于逐平台扫描):谁用到 X / 关于 X 配了哪些规则 / 改动 X 影响什么,毫秒级一次答全,替代逐模型 model.inspect/rule.list 枚举(N 次调用 → 1 次)。",
|
|
128
|
+
"- 改名/删除/重构一个 字段(field)/模型(model)/服务(service) 前,必先用 omc_graph_explore 查引用与影响面;查\"谁引用了 X\"也走它。",
|
|
129
|
+
"- 覆盖对照(先验):在线面 `omc call rule.references`(实时,仅 businessrule,不含条件叶子);本索引(离线快照,businessrule+datarule+listview,且含规则条件叶子 rule.condition 边)——条件里的字段引用离线一次可答,在线面要 rule.get 逐条看。",
|
|
122
130
|
"- 不确定查哪个库时先调 omc_graph_projects(零参数):列出所有项目根 + 各自可查的环境名。",
|
|
123
131
|
"- 每个索引的身份是「项目根 + 环境名」这一对:同一个项目可以同时建了 test/prod 等多份,同一环境也可以被多个项目各自 pull。所以 explore/status 用 project(目录名或绝对路径)+ env 指定;只给 env 时不唯一就会报歧义并列出可用环境。",
|
|
124
|
-
"-
|
|
132
|
+
"- query 可为业务名(实体 name+code 子串)、字段/模型/服务 code,或 `<schemaCode>.<字段code>`(同名字段精确消歧,如 crm_contract.contract_no)。",
|
|
125
133
|
"- search 语义:只匹配规则 code+name 的**词首**(中文子串不命中:搜「预算」匹配不到「增加预算」)。",
|
|
126
134
|
"答案带 environmentName/projectPath/dbId 与 freshness/pulledAtIso——索引是快照(平台侧改动后需 CLI 重建:omc graph pull --path <项目根> --env <env>,只读远端约 1 分钟),且多库并存时靠这三个字段自证归属。",
|
|
127
135
|
].join("\n");
|
|
@@ -133,17 +141,17 @@ const INSTRUCTIONS_NO_INDEX = [
|
|
|
133
141
|
const EXPLORE_TOOL = {
|
|
134
142
|
name: "omc_graph_explore",
|
|
135
143
|
description: [
|
|
136
|
-
"
|
|
137
|
-
"输入 query 可为业务名(实体 name+code
|
|
144
|
+
"回答关系型配置问题的第一入口——\"谁用到 X?\"\"关于 X 配了哪些规则?\"\"改动 X 影响什么?\":一次查全引用与影响面(本地索引,毫秒级),替代逐模型 model.inspect/rule.list 枚举。",
|
|
145
|
+
"输入 query 可为业务名(实体 name+code 子串)、规则 code+name 词首、字段/模型/服务 code,或 `<schemaCode>.<字段code>`(同名字段精确消歧,如 crm_contract.contract_no)。kind 可选 field|model|service,不给则三种都查。",
|
|
138
146
|
"返回 {index(freshness), references:{kind:[{schemaCode,ruleCode,nodeCode,nodeType,via,referrer,isSelf}]}, impact:{kind:totals}, search:{matches:{model,field,service},rules}}。",
|
|
139
|
-
"references/impact 支持 offset+limit 分页;truncated 时按返回的 nextOffset 继续调用。实体分页结果带 nextCall;分页不会改变 resolved
|
|
147
|
+
"references/impact 支持 offset+limit 分页;truncated 时按返回的 nextOffset 继续调用。实体分页结果带 nextCall;分页不会改变 resolved。字段同名时用 schemaCode 参数或 <schemaCode>.<字段code> 写法消歧。",
|
|
148
|
+
"覆盖对照(先验):在线面 `omc call rule.references` 实时但仅 businessrule、不含条件叶子;本索引是离线快照(businessrule 含条件叶子 rule.condition 边 + datarule + listview)——条件里的字段引用离线一次可答;freshness=partial 时命中可能不完整(答案里有 gapWarning)。",
|
|
140
149
|
"改/删/重命名任何字段、模型、服务之前必查;找\"关于 X 的规则\"拿 code 也走这里。",
|
|
141
|
-
"索引不含规则条件叶子与流程绑定;freshness=partial 时命中可能不完整(答案里有 gapWarning)。",
|
|
142
150
|
].join(" "),
|
|
143
151
|
inputSchema: {
|
|
144
152
|
type: "object",
|
|
145
153
|
properties: {
|
|
146
|
-
query: { type: "string", description: "业务名(实体 name+code 子串)、字段/模型/服务 code
|
|
154
|
+
query: { type: "string", description: "业务名(实体 name+code 子串)、字段/模型/服务 code、`<schemaCode>.<字段code>`(同名字段精确消歧),或规则检索词(规则 code+name 词首匹配)" },
|
|
147
155
|
queries: { type: "array", items: { type: "string" }, description: "实体面多条件检索;与 query 并存时合并,match 默认 any" },
|
|
148
156
|
match: { type: "string", enum: ["all", "any"], description: "queries[] 的模型∪字段所属模型求交/并" },
|
|
149
157
|
kind: { type: "string", enum: [...KINDS], description: "限定一种引用种类;省略则 field/model/service 全查" },
|
|
@@ -309,6 +317,13 @@ export async function executeGraphTool(name, rawArgs, context) {
|
|
|
309
317
|
const selector = selectorOf(args);
|
|
310
318
|
const status = readGraphStatus(selector);
|
|
311
319
|
const index = status.index;
|
|
320
|
+
// r72g(P0):query 支持 `<schemaCode>.<字段code>` 带点写法——探针被旧
|
|
321
|
+
// description 的「用 schemaCode 消歧」引导出带点写法,撞上 impact/search/
|
|
322
|
+
// 实体解析三处静默假阴性。这里解析一次供实体归位(resolved 回显、候选与
|
|
323
|
+
// schema 过滤);引用/影响面由 graph.ts 内部同一解析兜底。
|
|
324
|
+
const scopedQuery = parseScopedFieldQuery(primaryQuery, selector);
|
|
325
|
+
const effectiveSchemaCode = schemaCode ?? scopedQuery?.schemaCode;
|
|
326
|
+
const effectiveQuery = scopedQuery?.code ?? query;
|
|
312
327
|
const kinds = kind === undefined ? [...KINDS] : [kind];
|
|
313
328
|
const offset = typeof args.offset === "number" && Number.isSafeInteger(args.offset) && args.offset >= 0 ? args.offset : 0;
|
|
314
329
|
const limit = typeof args.limit === "number" && Number.isSafeInteger(args.limit) && args.limit > 0 && args.limit <= MATCH_CAP ? args.limit : MATCH_CAP;
|
|
@@ -326,13 +341,19 @@ export async function executeGraphTool(name, rawArgs, context) {
|
|
|
326
341
|
},
|
|
327
342
|
} : search;
|
|
328
343
|
const resolvedSearch = searchGraphRules(primaryQuery, MATCH_CAP, 0, selector);
|
|
329
|
-
const loweredQuery =
|
|
344
|
+
const loweredQuery = effectiveQuery.toLocaleLowerCase();
|
|
330
345
|
const allCandidates = entityInventory(selector).filter((r) => (r.code.toLocaleLowerCase().includes(loweredQuery) || r.name.toLocaleLowerCase().includes(loweredQuery)) &&
|
|
331
|
-
(!
|
|
332
|
-
(!applicationCode || r.applicationCode === applicationCode));
|
|
333
|
-
const candidatesForQuery = (term) => entityInventory(selector).filter((r) => (r.code.toLocaleLowerCase().includes(term.toLocaleLowerCase()) || r.name.toLocaleLowerCase().includes(term.toLocaleLowerCase())) &&
|
|
334
|
-
(!schemaCode || (r.kind !== "service" && r.schemaCode === schemaCode)) &&
|
|
346
|
+
(!effectiveSchemaCode || (r.kind !== "service" && r.schemaCode === effectiveSchemaCode)) &&
|
|
335
347
|
(!applicationCode || r.applicationCode === applicationCode));
|
|
348
|
+
const candidatesForQuery = (term) => {
|
|
349
|
+
// r72g:queries[] 里的带点词同样按 schema.field 解析后再匹配。
|
|
350
|
+
const scopedTerm = parseScopedFieldQuery(term, selector);
|
|
351
|
+
const needle = (scopedTerm?.code ?? term).toLocaleLowerCase();
|
|
352
|
+
return entityInventory(selector).filter((r) => (r.code.toLocaleLowerCase().includes(needle) || r.name.toLocaleLowerCase().includes(needle)) &&
|
|
353
|
+
(!scopedTerm || (r.kind !== "service" && r.schemaCode === scopedTerm.schemaCode)) &&
|
|
354
|
+
(!effectiveSchemaCode || (r.kind !== "service" && r.schemaCode === effectiveSchemaCode)) &&
|
|
355
|
+
(!applicationCode || r.applicationCode === applicationCode));
|
|
356
|
+
};
|
|
336
357
|
const perQueryModels = queries.map((term) => new Set(candidatesForQuery(term).filter((r) => r.kind === "model").map((r) => r.schemaCode)));
|
|
337
358
|
const perQueryFieldModels = queries.map((term) => new Set(candidatesForQuery(term).filter((r) => r.kind === "field").map((r) => r.schemaCode)));
|
|
338
359
|
const combine = (sets) => {
|
|
@@ -346,17 +367,21 @@ export async function executeGraphTool(name, rawArgs, context) {
|
|
|
346
367
|
const hitFieldModels = combine(perQueryFieldModels);
|
|
347
368
|
const typedCandidates = kind ? allCandidates.filter((r) => r.kind === kind) : allCandidates;
|
|
348
369
|
const fieldCandidates = kind === "field" ? typedCandidates : allCandidates.filter((r) => r.kind === "field");
|
|
349
|
-
const exactSame = fieldCandidates.filter((r) => r.code ===
|
|
350
|
-
const ambiguous = kind === "field" && !
|
|
370
|
+
const exactSame = fieldCandidates.filter((r) => r.code === effectiveQuery);
|
|
371
|
+
const ambiguous = kind === "field" && !effectiveSchemaCode && exactSame.length > 1;
|
|
351
372
|
const resolvedEntity = ambiguous ? undefined : typedCandidates[0] ?? (kind === undefined ? allCandidates[0] : undefined);
|
|
352
|
-
const subjectByName =
|
|
373
|
+
const subjectByName = effectiveQuery !== (resolvedEntity?.code ?? "") && resolvedEntity;
|
|
353
374
|
const subjects = resolvedEntity
|
|
354
375
|
? [{ kind: resolvedEntity.kind, code: resolvedEntity.kind === "model" ? (resolvedEntity.schemaCode ?? resolvedEntity.code) : resolvedEntity.code }]
|
|
355
376
|
: [];
|
|
356
377
|
for (const one of kinds) {
|
|
357
378
|
const subject = subjects.find((s) => s.kind === one);
|
|
358
|
-
|
|
359
|
-
|
|
379
|
+
// r72g:字段面把 schema 限定(显式 schemaCode 参数或 query 的 schema.field
|
|
380
|
+
// 解析)下推为精确查询——references/impact 在 graph.ts 内统一解析,事后
|
|
381
|
+
// 过滤只救得了 rules 面,datarules/listviews 的 totals 也会随之精确。
|
|
382
|
+
const targetCode = subject && one === "field" && effectiveSchemaCode ? `${effectiveSchemaCode}.${subject.code}` : subject?.code ?? query;
|
|
383
|
+
const ref = queryGraphReferences(one, targetCode, selector);
|
|
384
|
+
const scopedMatches = ref.matches.filter((row) => !applicationCode || row.applicationCode === applicationCode).filter((row) => one === "field" && effectiveSchemaCode ? row.schemaCode === effectiveSchemaCode : true);
|
|
360
385
|
const capped = cap(scopedMatches, offset, limit);
|
|
361
386
|
// r35a-F4c(真机 2026-11-06):**MCP 面是第三个消费者**——CLI 的 references
|
|
362
387
|
// 与 impact 都带 coverage 了,这里若不显式透传,MCP 用户看到的仍是
|
|
@@ -367,11 +392,13 @@ export async function executeGraphTool(name, rawArgs, context) {
|
|
|
367
392
|
offset: capped.offset,
|
|
368
393
|
limit: capped.limit,
|
|
369
394
|
...(capped.truncated ? { truncated: true, nextOffset: capped.nextOffset, note: `共 ${capped.total} 条,已给 ${capped.rows.length} 条,offset=${capped.offset} 取下一段(调用时传 offset=${capped.nextOffset}、limit=${capped.limit})` } : {}),
|
|
395
|
+
// r72g:`schema.field` 解析生效时回显 resolvedScope,让「精确过滤中」可见。
|
|
396
|
+
...(ref.resolvedScope !== undefined ? { resolvedScope: ref.resolvedScope } : {}),
|
|
370
397
|
...(ref.gapWarning ? { gapWarning: ref.gapWarning } : {}),
|
|
371
398
|
};
|
|
372
399
|
if (scopedMatches.length > 0 || kind !== undefined || subject !== undefined) {
|
|
373
|
-
const imp = impactGraph(one,
|
|
374
|
-
const scopedRules =
|
|
400
|
+
const imp = impactGraph(one, targetCode, selector);
|
|
401
|
+
const scopedRules = one === "field" && effectiveSchemaCode ? imp.rules.filter((row) => row.schemaCode === effectiveSchemaCode) : imp.rules;
|
|
375
402
|
impact[one] = {
|
|
376
403
|
totals: scopedRules.length === imp.rules.length ? imp.totals : { ...imp.totals, rules: scopedRules.length },
|
|
377
404
|
rules: cap(scopedRules, offset, limit),
|
|
@@ -389,7 +416,7 @@ export async function executeGraphTool(name, rawArgs, context) {
|
|
|
389
416
|
};
|
|
390
417
|
}
|
|
391
418
|
}
|
|
392
|
-
const decorate = (row) => withMatchedOn({ ...row, ...(row.schemaCode && row.code === undefined ? { code: row.schemaCode } : {}) },
|
|
419
|
+
const decorate = (row) => withMatchedOn({ ...row, ...(row.schemaCode && row.code === undefined ? { code: row.schemaCode } : {}) }, effectiveQuery);
|
|
393
420
|
const decoratedMatches = { ...scopedSearch.matches, model: { ...scopedSearch.matches.model, items: scopedSearch.matches.model.items.map(decorate) }, field: { ...scopedSearch.matches.field, items: scopedSearch.matches.field.items.map(decorate) }, service: { ...scopedSearch.matches.service, items: scopedSearch.matches.service.items.map(decorate) } };
|
|
394
421
|
const noEntityHit = search.matches.model.total === 0 && search.matches.field.total === 0 && search.matches.service.total === 0;
|
|
395
422
|
const composite = /\s|\+|,|\b(?:AND|OR)\b/i.test(query);
|
|
@@ -404,7 +431,7 @@ export async function executeGraphTool(name, rawArgs, context) {
|
|
|
404
431
|
hitModels: [...hitModels],
|
|
405
432
|
...(() => { const page = cap([...hitFieldModels].flatMap((schema) => entityInventory(selector).filter((r) => r.kind === "field" && r.schemaCode === schema && (!applicationCode || r.applicationCode === applicationCode)).map((r) => ({ schemaCode: schema, code: r.code, name: r.name }))), offset, limit); return { hitFields: page.rows, hitFieldsCount: page.total, ...(page.truncated ? { hitFieldsTruncated: true, hitFieldsNextOffset: page.nextOffset } : {}) }; })(),
|
|
406
433
|
found: resolvedEntity !== undefined,
|
|
407
|
-
...(resolvedEntity ? { resolved: { kind: resolvedEntity.kind, schemaCode: "schemaCode" in resolvedEntity ? resolvedEntity.schemaCode : "", code: resolvedEntity.code, matchedOn: { on: resolvedEntity.name.includes(
|
|
434
|
+
...(resolvedEntity ? { resolved: { kind: resolvedEntity.kind, schemaCode: "schemaCode" in resolvedEntity ? resolvedEntity.schemaCode : "", code: resolvedEntity.code, matchedOn: { on: resolvedEntity.name.includes(effectiveQuery) ? "name" : "code", fragment: effectiveQuery }, ...(resolvedEntity.applicationCode ? { applicationCode: resolvedEntity.applicationCode } : {}) } } : {}),
|
|
408
435
|
...(resolvedEntity ? { otherCandidates: allCandidates.filter((r) => r.code !== resolvedEntity.code).slice(0, 5).map((r) => ({ schemaCode: r.schemaCode ?? r.code, name: r.name, ...(r.applicationCode ? { applicationCode: r.applicationCode } : {}) })) } : {}),
|
|
409
436
|
...(ambiguous ? { ambiguous: true, candidates: exactSame.map((r) => ({ schemaCode: r.schemaCode, code: r.code, name: r.name })) } : {}),
|
|
410
437
|
...(kind !== undefined ? { kind } : {}),
|
|
@@ -418,9 +445,11 @@ export async function executeGraphTool(name, rawArgs, context) {
|
|
|
418
445
|
...(noEntityHit ? { suggestions: suggestions(query, selector), hint: "可尝试 suggestions 中的实体 code/name;引用明细请使用匹配 code 查 references/impact" } : {}),
|
|
419
446
|
searchNote: `${searchNote}${paginationNote}${queries.length > 1 ? " 规则面(词首匹配)不参与 queries[] 的实体求交。" : ""}`,
|
|
420
447
|
...(search.note ? { searchNote: `${searchNote}\n${search.note}` } : {}),
|
|
421
|
-
//
|
|
422
|
-
//
|
|
423
|
-
|
|
448
|
+
// r72g:不再手抄 scanned/notScanned 清单——三个消费面(CLI references /
|
|
449
|
+
// CLI impact / MCP explore)必须共用 graph.ts 的同一份 GRAPH_COVERAGE 声明,
|
|
450
|
+
// 手抄版已经漂过一次(mustCheckManually/note/crossFace 全丢)。这里直接
|
|
451
|
+
// 展开,新增字段自动透传。
|
|
452
|
+
coverage: { ...index.coverage, ...GRAPH_COVERAGE },
|
|
424
453
|
note: `零命中只代表 references[].coverage.scanned 面没有命中;字段面覆盖应用:${index.coverage.fields?.coveredApplications.join("、") || "(未知)"};notScanned 面(尤其 form 与 workflow.permissions)未扫描,不可据此判定可安全删除或无影响`,
|
|
425
454
|
});
|
|
426
455
|
}
|
package/dist/read-shapes.js
CHANGED
|
@@ -122,6 +122,17 @@ const READ_SHAPES = {
|
|
|
122
122
|
"modelPresent:false 时未发 list(避免幻影 schema 补建 7 条预置)",
|
|
123
123
|
],
|
|
124
124
|
},
|
|
125
|
+
// r72g(2026-11-17 探针):`rule.references`(在线,仅 businessrule)与
|
|
126
|
+
// `omc graph references`(离线,businessrule+datarule+listview 三面)同名不同
|
|
127
|
+
// 覆盖——探针只能读回执 coverage 才发现选错了面。对照进 notes[0]:
|
|
128
|
+
// returnsFace 只显首条,默认 describe 面就要能先验选对面,不是打完才知道。
|
|
129
|
+
"rule.references": {
|
|
130
|
+
keys: ["kind", "code", "scanned:{models,rules,parseFailures?}", "matches:array<{schemaCode,ruleCode,nodeCode,nodeType,via,targetObjectCode?}>", "coverage:{scanned,notScanned,note}", "applicationResolution?", "note?(零命中)", "hint?"],
|
|
131
|
+
notes: [
|
|
132
|
+
"覆盖面对照:本工具=在线实时、仅 businessrule;omc graph references=离线快照、businessrule+datarule+listview 三面(毫秒级,需先 omc graph pull),且已含规则条件叶子(rule.condition 边;本在线面不含,条件引用走 graph);字段消歧 graph 面支持 schema.field 写法",
|
|
133
|
+
"matches:[] 只代表已扫面零命中(coverage.notScanned 是权威,勿当可安全删除);字段 code 跨模型不唯一,建议配 schemaCodes 限范围",
|
|
134
|
+
],
|
|
135
|
+
},
|
|
125
136
|
"datarule.list": {
|
|
126
137
|
keys: ["rules:array<{id,propertyCode,dataRuleType,checkType,optionsKeys?}>", "rulesCount", "modelPresent", "rulesOmitted?"],
|
|
127
138
|
notes: [
|
|
@@ -130,8 +141,11 @@ const READ_SHAPES = {
|
|
|
130
141
|
],
|
|
131
142
|
},
|
|
132
143
|
"form.get": {
|
|
133
|
-
keys: ["present", "published", "publishedControlCodes", "draftControlCodes"],
|
|
134
|
-
notes: [
|
|
144
|
+
keys: ["present", "published", "publishedControlCodes", "draftControlCodes", "formButtonCodes?", "formButtons?", "customButtonJson?(full)", "customButtonJsonShapeWarning?"],
|
|
145
|
+
notes: [
|
|
146
|
+
"控件清单键是 publishedControlCodes/draftControlCodes,不是 controls",
|
|
147
|
+
"表单按钮读 formButtonCodes/formButtons;full:true 另带 customButtonJson 数组原样(库里是字符串脏形时给 customButtonJsonShapeWarning——线上 #38 前端按钮不渲染,重写 buttons 自愈)",
|
|
148
|
+
],
|
|
135
149
|
},
|
|
136
150
|
"listview.get": {
|
|
137
151
|
keys: ["present", "published", "lifecycle", "columns[]"],
|
|
@@ -464,7 +464,7 @@ const ruleBizactionInvokeService = Object.freeze({
|
|
|
464
464
|
nodeGraph: {
|
|
465
465
|
nodes: [
|
|
466
466
|
{ nodeCode: "Start", nodeName: "开始", nodeType: "START" },
|
|
467
|
-
{ nodeCode: "A1", nodeName: "调用服务并回写", nodeType: "BIZ_ACTION", inputParam: "_input", methodMapping: { schemaCode: model, serviceCode: "<svc>", serviceMethodCode: "<method>", inputMappings: [{ serviceMethodParameterCode: "<in_code>", codeType: 1, bizCode: "<src_field>", required: true }], outputMappings: [{ serviceMethodParameterCode: "<out_code>", codeType: 1, bizCode: "<dst_field>" }] } },
|
|
467
|
+
{ nodeCode: "A1", nodeName: "调用服务并回写", nodeType: "BIZ_ACTION", inputParam: "_input", methodMapping: { schemaCode: model, serviceCode: "<svc>", serviceName: "<服务名>", serviceMethodCode: "<method>", serviceMethodName: "<方法名>", methodCode: "<注册槽>", inputMappings: [{ serviceMethodParameterCode: "<in_code>", codeType: 1, bizCode: "<src_field>", required: true }], outputMappings: [{ serviceMethodParameterCode: "<out_code>", codeType: 1, bizCode: "<dst_field>" }] } },
|
|
468
468
|
{ nodeCode: "End", nodeName: "结束", nodeType: "END" },
|
|
469
469
|
],
|
|
470
470
|
routes: [
|
|
@@ -481,6 +481,7 @@ const ruleBizactionInvokeService = Object.freeze({
|
|
|
481
481
|
],
|
|
482
482
|
conditionalRequirements: [
|
|
483
483
|
"**系统节点由工具注入**——本 recipe 只写 Start→BIZ_ACTION→End;工具注入 SYSTEM_CREATE 并排在 BIZ_ACTION 之后(ASSIGN/BIZ_ACTION 必须在系统节点前)。",
|
|
484
|
+
"methodMapping 必带 serviceName/serviceMethodName/methodCode(缺则 40000,#38 实证)",
|
|
484
485
|
"**出参回写三前提(r28b 8 组实验定案,缺一出参恒 null 且节点日志仍 successful)**:① 响应 JSON 根级平铺出参键(信封嵌套如 {data:{...}} 静默不回写)② 挂预置 Create/Update 规则上下文(自定义规则/rule.run 不回写业务字段)③ 用 data.submit/data.update 触发(data.save 存草稿不触发)。回写是否成功只认 data.load 读字段,不认调用日志。",
|
|
485
486
|
"codeType:1 = 映射模型字段(bizCode=字段 code);codeType:0 = 常量(bizCode=常量值);serviceMethodParameterCode 必须与方法声明的参数 code 逐字一致",
|
|
486
487
|
"**接口响应必须在 JSON 根级**返回与出参 code 同名的键——嵌套在信封里(如 {data:{level}})会静默映射不上(p7 实测;r28b 8 组实验全因信封端点失败,换平铺端点后 4 组一次全过)",
|
package/dist/refusal-guidance.js
CHANGED
|
@@ -219,6 +219,20 @@ export function refusalRecovery(blocker, payload, options = {}) {
|
|
|
219
219
|
fixFirst: "处置三选一:① 换一个 code 重建(最快,不动回收站);② 门户「回收站」里物理删除该条目后原 code 可用;③ 保留残留用现名(先 report.get 核对 treeVisibility)。不要反复重试同 code——回收站不清空它就一直占。",
|
|
220
220
|
};
|
|
221
221
|
}
|
|
222
|
+
// 线上 #38(摩擦 B):40000「调用数据库发生异常」的引导曾单向判「平台侧故障,勿
|
|
223
|
+
// 改参数硬重试」——真机(詹记 8.6.26)两次实证反向成因:创建类写入缺非空列时平台
|
|
224
|
+
// 同样回 40000(rule.save 的 methodMapping 缺 serviceName/serviceMethodName/methodCode;
|
|
225
|
+
// form.draft/publish 的 button 缺 triggerCode/triggerType/showPermCode/showPermType——h_biz_button
|
|
226
|
+
// 的 NOT NULL 列)。照「勿改参数」引导原地打转;正确动作=对照已成功配置补齐字段。
|
|
227
|
+
// runtime-write-db-exception(运行面 40000)自带公式字段诊断教学,不在此重复。
|
|
228
|
+
if (blocker !== "runtime-write-db-exception" && (Number(payload.errcode) === 40000 || /调用数据库发生异常/.test(text0))) {
|
|
229
|
+
return {
|
|
230
|
+
whatWentWrong: "平台回 40000「调用数据库发生异常」——无明细掩码,有两种常见成因,先分叉再动手",
|
|
231
|
+
fixFirst: "① 真·平台故障(DB/ORM 层)→ 稍后重试同一请求,持续复现查平台日志;" +
|
|
232
|
+
"② **创建类写入缺非空列**(线上 #38 实证)——rule.save 的 methodMapping 缺 serviceName/serviceMethodName/methodCode;form.draft/form.publish 的 button 缺 triggerCode/triggerType/showPermCode/showPermType(h_biz_button 非空列)。照 recipe 最小示例形状新建必炸②:先 rule.get/form.get 读一条已成功落库的同族配置,对照补齐这些字段后一次成功。",
|
|
233
|
+
doNot: "不要只按「平台故障勿改参数」原地重试——成因②下同参数永远 40000;也不要不分叉就盲改参数——成因①下改了也没用",
|
|
234
|
+
};
|
|
235
|
+
}
|
|
222
236
|
// r19 p14: the report BI boundary is matched from the wire path in the
|
|
223
237
|
// message/detail, so both refused and frozen (uncertain) envelopes teach it.
|
|
224
238
|
if (mentionsDashboardChannel(payload)) {
|
package/dist/write.js
CHANGED
|
@@ -118,16 +118,21 @@ async function governedWrite(ctx, tool, args, execute, dryRunPayload, readOnlyEs
|
|
|
118
118
|
message: `${error.message}——这是平台 ORM 的对象状态错误(Serializer.update/delete 要求实体先被装载),不是入参或规则图的形状问题。` +
|
|
119
119
|
"同一份入参再保存一次通常即恢复。持续复现就换行:rule.delete 后重建(rule.save 会铸新记录),或用 rule.get 读回完整行再 rule.node.update 改一处——不要继续重试同一份 payload。",
|
|
120
120
|
};
|
|
121
|
-
// r30a F10:errcode 40000
|
|
122
|
-
//
|
|
121
|
+
// r30a F10:errcode 40000「调用数据库发生异常」曾单向判「平台侧故障,勿改参数」。
|
|
122
|
+
// 线上 #38(摩擦 B,詹记 8.6.26)实证反向成因:创建类写入缺非空列时平台同样
|
|
123
|
+
// 回 40000(rule.save 的 methodMapping 缺 serviceName/serviceMethodName/methodCode;
|
|
124
|
+
// form.draft/publish 的 button 缺 triggerCode/triggerType/showPermCode/showPermType),
|
|
125
|
+
// 照「勿改参数硬重试」引导原地打转。引导必须双向:先分叉成因再动手。
|
|
123
126
|
if (error.errcode === 40000 || /调用数据库发生异常/.test(error.message))
|
|
124
127
|
return {
|
|
125
128
|
status: "refused",
|
|
126
129
|
blocker: `wire-${error.kind}`,
|
|
127
130
|
errcode: error.errcode,
|
|
128
131
|
"platform-fault": true,
|
|
129
|
-
message: `${error.message}
|
|
130
|
-
|
|
132
|
+
message: `${error.message}——40000「调用数据库发生异常」是无明细掩码,两种常见成因(线上 #38 实证):` +
|
|
133
|
+
"① 真·平台故障(DB/ORM 层,重试/查平台日志);" +
|
|
134
|
+
"② 创建类写入缺非空列——rule.save 的 methodMapping 缺 serviceName/serviceMethodName/methodCode、form.draft/publish 的 button 缺 triggerCode/triggerType/showPermCode/showPermType 时同样回 40000(照 recipe 最小示例形状新建必炸;对照已成功落库的同族配置补齐字段后一次成功)。",
|
|
135
|
+
nextAction: "先分叉:本次是照示例新建/改配置吗?是→按成因②对照一条已成功配置(rule.get/form.get 读回)补齐非空列字段再重试;否→按成因①稍后重试同一请求,持续复现查平台 DB/ORM 日志",
|
|
131
136
|
...(error.diagnostic ? { diagnostic: error.diagnostic } : {}),
|
|
132
137
|
};
|
|
133
138
|
return { status: "refused", blocker: `wire-${error.kind}`, errcode: error.errcode, message: error.message, ...(error.diagnostic ? { diagnostic: error.diagnostic } : {}) };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stalfh233/omc-cli",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.67",
|
|
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.
|
|
59
|
+
"omc-core": "0.6.67",
|
|
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.
|
|
77
|
+
"@stalfh233/omc-fake-platform": "0.6.67"
|
|
78
78
|
}
|
|
79
79
|
}
|
package/skills/omc-start-here.md
CHANGED
|
@@ -27,7 +27,7 @@ be treated as a second source. Read this, then follow the topics it names.
|
|
|
27
27
|
- `scout`(能不能/怎么写/是否支持)→ 先探边界(`omc-capability-scouting`),别直接写。若 `next` 返回 **`boundary`**(`match.kind:"boundary"`,如 `ocr-e-signature`/`release-prod`/`inline-coding`),说明需求**不在覆盖内**(`write:false`):如实报告、用 `omc capabilities` 核对,**不要**用相近能力伪造实现。
|
|
28
28
|
阶梯步骤已内联工具必填参数(`route.ladder[].tools`/`readTools`)与命中 recipe 的 `describe <tool> --example <id>`;据此直接执行——**不要再逐能力扫**(能力族工具面用 `commands --capability <id>`),也不要先扫 `commands --json`/全部 `contract`/全部 `describe --full`。
|
|
29
29
|
方法论按 `route.readSections` 逐节读:对每条 `{topic, section}` 执行 `omc help <topic> --section "<section>"`(单节 0.4–3.4KB)。`omc help <topic>` 默认只回节索引(约 1KB,含每节字节数);**不要 `--all` 读整篇**(5–14KB,读一次就留在后续每一轮窗口)。**带着具体问题(错误码/跨能力语义/某个词)直接 `omc help --search "<词>"`**——跨全部 topic 全文检索,命中节的正文随结果内联返回,一次调用就是答案;**严禁自己写 `for t in …; do omc help $t --all | grep …` 循环**(r18 实测 12 调用/176KB,检索一次 8KB 搞定)。
|
|
30
|
-
1b. **改/删/重命名既有对象前先看影响面**:`omc graph pull --env <env>` 建本地索引(增量、带锁与 gap 报告;`--all-applications` 或 `--application-codes a,b` 定覆盖),之后 `graph references <kind> <code>` 离线答「谁引用了它」(一调替代逐模型 `rule.get` 枚举),`impact` 看爆炸半径、`search` 找规则 code、`status` 看新鲜度与覆盖、`indexes` 清点多项目×环境。索引身份=「项目根+环境名」对:references/edges/impact/search/status 与 pull 对称认 `--path`/`--env`;多库不给 `--env` 会拒(`graph indexes` 清点);回执带 projectPath/environmentName/dbId
|
|
30
|
+
1b. **改/删/重命名既有对象前先看影响面**:`omc graph pull --env <env>` 建本地索引(增量、带锁与 gap 报告;`--all-applications` 或 `--application-codes a,b` 定覆盖),之后 `graph references <kind> <code>` 离线答「谁引用了它」(一调替代逐模型 `rule.get` 枚举),`impact` 看爆炸半径、`search` 找规则 code、`status` 看新鲜度与覆盖、`indexes` 清点多项目×环境。索引身份=「项目根+环境名」对:references/edges/impact/search/status 与 pull 对称认 `--path`/`--env`;多库不给 `--env` 会拒(`graph indexes` 清点);回执带 projectPath/environmentName/dbId 自证归属。索引含规则条件叶子(rule.condition 边),不含流程绑定,命中后以 `rule.get` 原文为准。MCP:`omc mcp-graph --path <根>[,<另一根>]`,用 `project`+`env` 选库(`omc_graph_projects`)。
|
|
31
31
|
|
|
32
32
|
1c. **写后端 Java 源码(在线开发)走工作区而不是一条条 call**:`omc programming pull --env <env> --app <appCode>` 把业务规则源码拉进 `.omc-programming/`(git 可管),改文件后 `omc programming status` → `omc programming apply [--publish]`(逐文件走编程面治理);图形化规则转编码用 `omc programming adopt --schema <s> --rule <r>`;验证用 `omc programming test --schema <s> --rule <r>`(fixture 驱动:compile→publish→触发→断言→清理)。**平台运行时只执行已发布版**:只 save 不 publish 等于没改;publish 内部会编译并把规则切 CODING+enable。包路径/类名不得改。
|
|
33
33
|
2. 写前只需读 `omc-config-draft-review`(人审门)与 `omc-five-piece-flow`(发现→草稿→权限→执行→回读);`omc-business-configuration` 按命中的能力分节读(见 `next` 的 `readSections`),不要整篇预取。
|