@stalfh233/omc-cli 0.6.66 → 0.6.68
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/call.js +12 -1
- package/dist/cli-contract.js +11 -0
- package/dist/cli.js +64 -5
- package/dist/goal-routes.js +22 -5
- package/dist/graph.js +231 -28
- package/dist/lanes/businessrule-contract.js +5 -0
- package/dist/lanes/businessrule.js +148 -30
- package/dist/lanes/field.js +33 -2
- package/dist/lanes/list-view-contract.js +2 -2
- package/dist/lanes/list-view.js +72 -10
- package/dist/lanes/rule-graph.js +2 -2
- package/dist/lanes/runtime-data.js +8 -3
- package/dist/mcp-graph.js +56 -27
- package/dist/read-shapes.js +14 -0
- package/dist/rule-support.js +118 -79
- package/dist/tool-types.js +11 -0
- package/dist/write.js +6 -0
- 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: [
|
|
@@ -138,6 +149,9 @@ const READ_SHAPES = {
|
|
|
138
149
|
},
|
|
139
150
|
"listview.get": {
|
|
140
151
|
keys: ["present", "published", "lifecycle", "columns[]"],
|
|
152
|
+
// r73 #5(GitLab #40 P1,8.6.41 实测):FLOW 按钮读写不对称的对照表。
|
|
153
|
+
// returnsFace 只显 notes[0],教学并进首条。
|
|
154
|
+
notes: ["FLOW:读面 targetCode 回填自 actionConfig.WorkflowListData[0].workflowCode(targetCodeSource 标注;可能≠模型 code)↔ 写面 buttons[].targetCode 必填"],
|
|
141
155
|
},
|
|
142
156
|
"service.list": {
|
|
143
157
|
// r28f F1:行内带 adapterCode;顶栏 adapterDistribution 是选型聚合。
|
package/dist/rule-support.js
CHANGED
|
@@ -761,6 +761,116 @@ export async function computeCarriedNodeCodes(session, schemaCode, ruleCode, pre
|
|
|
761
761
|
return undefined; // 取不到存量图 → 维持严格闭集,行为与放宽前一致
|
|
762
762
|
}
|
|
763
763
|
}
|
|
764
|
+
/**
|
|
765
|
+
* A5 写前 gate(2026-11-03 issue):平台设计器只接受 中文/字母/数字、≤50 字符的
|
|
766
|
+
* 规则名。违规名 create 能落库(平台不拦),但设计器打开即报「规则名称仅支持
|
|
767
|
+
* 输入中文、字母和数字」且无法编辑——产出一个 UI 不可维护的 landmine。
|
|
768
|
+
* 只约束自定义规则(预置触发行的 name 属平台,见 executeRuleSaveWrite 的
|
|
769
|
+
* isPresetRule 分支)。
|
|
770
|
+
*
|
|
771
|
+
* r73 #1(GitLab #40):同一校验此前只在 executeRuleSaveWrite(execute 面)里,
|
|
772
|
+
* dry-run 不跑 → 「dry-run 过、真写拒」。导出后 write.ts semanticGate(rule.save
|
|
773
|
+
* 的 dry-run 与真写)与 rule.node.update 的 dryRunPayload 共用本函数,dry-run 与
|
|
774
|
+
* 真写同答案;语义(正则/适用范围/报错文案)与原内联版逐字节一致。
|
|
775
|
+
*/
|
|
776
|
+
export function assertRuleNamePlatformAcceptable(ruleCode, name) {
|
|
777
|
+
if (PLATFORM_TRIGGER_RULE_CODES.has(ruleCode))
|
|
778
|
+
return;
|
|
779
|
+
if (typeof name !== "string")
|
|
780
|
+
return;
|
|
781
|
+
if (/^[\u4e00-\u9fa5A-Za-z0-9]{1,50}$/.test(name))
|
|
782
|
+
return;
|
|
783
|
+
throw new ToolRefusalError({
|
|
784
|
+
status: "refused",
|
|
785
|
+
blocker: "rule-name-invalid",
|
|
786
|
+
message: `规则 name「${name.slice(0, 60)}」不符合平台约束:仅支持中文/字母/数字,长度 1-50(设计器校验;违规名虽能落库,但设计器无法再编辑该规则)。建议改为纯中文或字母数字命名。`,
|
|
787
|
+
});
|
|
788
|
+
}
|
|
789
|
+
/**
|
|
790
|
+
* The ONE write-face graph lint (r73 #1, GitLab #40): prepareRuleGraph →
|
|
791
|
+
* carried-node relaxation → validateRuleNodeGraph → session-aware warnings
|
|
792
|
+
* (radio-condition / CREATE-flow-start) → the local refusal gates
|
|
793
|
+
* (formula-lint / rule-graph-validation-failed / routes-empty).
|
|
794
|
+
*
|
|
795
|
+
* executeRuleSaveWrite runs it before the real write; `rule.node.update`'s
|
|
796
|
+
* dryRunPayload runs it on the patched graph so a dry-run answers the SAME
|
|
797
|
+
* 能写/不能写 question as the real write — previously the dry-run only
|
|
798
|
+
* returned a plan (8.6.41 live: an empty originatorValue passed dry-run and
|
|
799
|
+
* was refused at execute). No second write path is introduced: this function
|
|
800
|
+
* only lints and refuses.
|
|
801
|
+
*/
|
|
802
|
+
export async function lintRuleGraphForWrite(session, args, options = {}) {
|
|
803
|
+
// Pre-flight dry lint (ticket 14): a mis-shaped graph must be refused BEFORE
|
|
804
|
+
// any wire call, with structured blockers locating the node/key — never
|
|
805
|
+
// silently forwarded to the platform (ticket 09 lesson).
|
|
806
|
+
//
|
|
807
|
+
// Preset trigger rules (Create/Update/Delete) route the trigger-row write
|
|
808
|
+
// through the platform system node; the adapter injects it when absent
|
|
809
|
+
// before linting, so the caller only authors their action nodes (ticket 17
|
|
810
|
+
// live finding: dropping SYSTEM_CREATE pinned the row to DRAFT).
|
|
811
|
+
//
|
|
812
|
+
// Ticket 80: a button/flow-triggered rule (explicit customTrigger signal)
|
|
813
|
+
// gets the platform's CUSTOM_NODE 「自定义按钮/流程触发」 system trigger node
|
|
814
|
+
// synthesized after START when the caller did not author one, and EVERY
|
|
815
|
+
// route leaves with explicit string coordinates (empty points break the
|
|
816
|
+
// designer canvas).
|
|
817
|
+
//
|
|
818
|
+
// Ticket 80 + CFG-02/CFG-26: ONE normalization shared with the write
|
|
819
|
+
// preflight (prepareRuleGraph), so preview and execute validate the same
|
|
820
|
+
// graph: preset system node → button/flow CUSTOM_NODE trigger → route shape.
|
|
821
|
+
const prepared = prepareRuleGraph(args.ruleCode, args.nodeGraph, args.customTrigger, args.schemaCode);
|
|
822
|
+
const preparedGraph = prepared.graph;
|
|
823
|
+
// 回读差异放宽(中冶 2026-10-16):更新已存在规则时取存量图逐节点比对,
|
|
824
|
+
// 与存量完全一致的"原样携带"节点免闭集硬校验(设计器 UI 独有算子降级
|
|
825
|
+
// legacy warning 原样回传);新增/改动节点维持严格。存量永远可编辑。
|
|
826
|
+
const carriedNodeCodes = await computeCarriedNodeCodes(session, args.schemaCode, args.ruleCode, preparedGraph);
|
|
827
|
+
const blockers = [...prepared.warnings, ...validateRuleNodeGraph(preparedGraph, args.ruleCode, typeof args.schemaCode === "string" ? args.schemaCode : undefined, carriedNodeCodes ? { carriedNodeCodes } : {})];
|
|
828
|
+
const nodeArray = Array.isArray(preparedGraph.nodes) ? preparedGraph.nodes : [];
|
|
829
|
+
// 1.2: needs the published field types (pure lint cannot see them).
|
|
830
|
+
blockers.push(...(await radioConditionWarnings(session, args.schemaCode, nodeArray)));
|
|
831
|
+
// r24 反馈(2026-10-27 真机四格矩阵):CREATE 目标带已发布流程时的发起开关教学/拦截。
|
|
832
|
+
blockers.push(...(await createNodeFlowStartWarnings(session, nodeArray)));
|
|
833
|
+
// Ticket 113: warning-severity findings (e.g. unknown mapping keys) do not
|
|
834
|
+
// gate the write; they surface in the readback as lintWarnings.
|
|
835
|
+
const warningFindings = blockers.filter((blocker) => blocker.severity === "warning");
|
|
836
|
+
// `hazard` warnings stay non-gating but are surfaced separately: the readback
|
|
837
|
+
// must not let an always-true condition or an inert trigger look like a
|
|
838
|
+
// plain advisory.
|
|
839
|
+
const lintWarnings = warningFindings.filter((blocker) => blocker.hazard !== true);
|
|
840
|
+
const lintHazards = warningFindings.filter((blocker) => blocker.hazard === true);
|
|
841
|
+
const formulaWarnings = lintWarnings.filter((finding) => FORMULA_LINT_CODES.has(finding.code));
|
|
842
|
+
if (formulaWarnings.length > 0 && args.allowAdvisory !== true) {
|
|
843
|
+
throw new ToolRefusalError({
|
|
844
|
+
status: "refused",
|
|
845
|
+
blocker: "formula-lint-failed",
|
|
846
|
+
validation: formulaWarnings,
|
|
847
|
+
nextCommand: "将未知函数改为平台注册函数(文本拼接使用 STRING),仅调查时显式传 allowAdvisory:true",
|
|
848
|
+
message: "公式写前校验拒绝:发现未知函数、平台别名或字符串 + 拼接。请修正公式;调查用途可显式 allowAdvisory:true(默认 fail-closed)。",
|
|
849
|
+
});
|
|
850
|
+
}
|
|
851
|
+
if (blockers.some((blocker) => blocker.severity !== "warning")) {
|
|
852
|
+
throw new ToolRefusalError({
|
|
853
|
+
status: "refused",
|
|
854
|
+
blocker: "rule-graph-validation-failed",
|
|
855
|
+
message: options.validationRefusalMessage ?? "nodeGraph 未过出门前校验(dry lint);按 validation 逐项修正,校验器不猜不改",
|
|
856
|
+
validation: blockers,
|
|
857
|
+
});
|
|
858
|
+
}
|
|
859
|
+
const nodes = nodeArray;
|
|
860
|
+
const routes = Array.isArray(preparedGraph.routes) ? preparedGraph.routes : [];
|
|
861
|
+
// r15 harness finding: a multi-node graph with ZERO routes SAVES fine but the
|
|
862
|
+
// platform publish answers 550014 孤立节点 for every non-boundary node — the
|
|
863
|
+
// usual cause is the WRONG edge key (edges/from/to instead of routes/
|
|
864
|
+
// preNode/postNode, silently stripped). Refuse at the save gate, name the
|
|
865
|
+
// right shape, save the publish round-trip.
|
|
866
|
+
if (nodes.length >= 2 && routes.length === 0)
|
|
867
|
+
throw new ToolRefusalError({
|
|
868
|
+
status: "refused",
|
|
869
|
+
blocker: "rule-graph-routes-empty",
|
|
870
|
+
message: `图有 ${nodes.length} 个节点但 0 条 routes——平台发布会判「孤立节点」(550014)。边用 routes:[{preNode:"Start",postNode:"UPDATE_1"},...](不是 edges/from/to,那会被静默剥掉)`,
|
|
871
|
+
});
|
|
872
|
+
return { preparedGraph, blockers, lintWarnings, lintHazards, nodes, routes };
|
|
873
|
+
}
|
|
764
874
|
/**
|
|
765
875
|
* 550018 is the platform's catch-all "rule self-check failed" (ErrorCode
|
|
766
876
|
* BUSINESS_RULE_PARAM_ERROR from BusinessRuleFacadeImpl.publishBusinessRule when
|
|
@@ -846,74 +956,10 @@ export async function modelWorkflowDispatchWarning(session, schemaCode) {
|
|
|
846
956
|
}
|
|
847
957
|
}
|
|
848
958
|
export async function executeRuleSaveWrite(session, args) {
|
|
849
|
-
// Pre-flight dry lint (ticket 14)
|
|
850
|
-
//
|
|
851
|
-
//
|
|
852
|
-
|
|
853
|
-
// Preset trigger rules (Create/Update/Delete) route the trigger-row write
|
|
854
|
-
// through the platform system node; the adapter injects it when absent
|
|
855
|
-
// before linting, so the caller only authors their action nodes (ticket 17
|
|
856
|
-
// live finding: dropping SYSTEM_CREATE pinned the row to DRAFT).
|
|
857
|
-
//
|
|
858
|
-
// Ticket 80: a button/flow-triggered rule (explicit customTrigger signal)
|
|
859
|
-
// gets the platform's CUSTOM_NODE 「自定义按钮/流程触发」 system trigger node
|
|
860
|
-
// synthesized after START when the caller did not author one, and EVERY
|
|
861
|
-
// route leaves with explicit string coordinates (empty points break the
|
|
862
|
-
// designer canvas).
|
|
863
|
-
const graph = args.nodeGraph;
|
|
864
|
-
// Ticket 80 + CFG-02/CFG-26: ONE normalization shared with the write
|
|
865
|
-
// preflight (prepareRuleGraph), so preview and execute validate the same
|
|
866
|
-
// graph: preset system node → button/flow CUSTOM_NODE trigger → route shape.
|
|
867
|
-
const prepared = prepareRuleGraph(args.ruleCode, graph, args.customTrigger, args.schemaCode);
|
|
868
|
-
const preparedGraph = prepared.graph;
|
|
869
|
-
// 回读差异放宽(中冶 2026-10-16):更新已存在规则时取存量图逐节点比对,
|
|
870
|
-
// 与存量完全一致的"原样携带"节点免闭集硬校验(设计器 UI 独有算子降级
|
|
871
|
-
// legacy warning 原样回传);新增/改动节点维持严格。存量永远可编辑。
|
|
872
|
-
const carriedNodeCodes = await computeCarriedNodeCodes(session, args.schemaCode, args.ruleCode, preparedGraph);
|
|
873
|
-
const blockers = [...prepared.warnings, ...validateRuleNodeGraph(preparedGraph, args.ruleCode, typeof args.schemaCode === "string" ? args.schemaCode : undefined, carriedNodeCodes ? { carriedNodeCodes } : {})];
|
|
874
|
-
// 1.2: needs the published field types (pure lint cannot see them).
|
|
875
|
-
blockers.push(...(await radioConditionWarnings(session, args.schemaCode, Array.isArray(preparedGraph.nodes) ? preparedGraph.nodes : [])));
|
|
876
|
-
// r24 反馈(2026-10-27 真机四格矩阵):CREATE 目标带已发布流程时的发起开关教学/拦截。
|
|
877
|
-
blockers.push(...(await createNodeFlowStartWarnings(session, Array.isArray(preparedGraph.nodes) ? preparedGraph.nodes : [])));
|
|
878
|
-
// Ticket 113: warning-severity findings (e.g. unknown mapping keys) do not
|
|
879
|
-
// gate the write; they surface in the readback as lintWarnings.
|
|
880
|
-
const warningFindings = blockers.filter((blocker) => blocker.severity === "warning");
|
|
881
|
-
// `hazard` warnings stay non-gating but are surfaced separately: the readback
|
|
882
|
-
// must not let an always-true condition or an inert trigger look like a
|
|
883
|
-
// plain advisory.
|
|
884
|
-
const lintWarnings = warningFindings.filter((blocker) => blocker.hazard !== true);
|
|
885
|
-
const lintHazards = warningFindings.filter((blocker) => blocker.hazard === true);
|
|
886
|
-
const formulaWarnings = lintWarnings.filter((finding) => FORMULA_LINT_CODES.has(finding.code));
|
|
887
|
-
if (formulaWarnings.length > 0 && args.allowAdvisory !== true) {
|
|
888
|
-
throw new ToolRefusalError({
|
|
889
|
-
status: "refused",
|
|
890
|
-
blocker: "formula-lint-failed",
|
|
891
|
-
validation: formulaWarnings,
|
|
892
|
-
nextCommand: "将未知函数改为平台注册函数(文本拼接使用 STRING),仅调查时显式传 allowAdvisory:true",
|
|
893
|
-
message: "公式写前校验拒绝:发现未知函数、平台别名或字符串 + 拼接。请修正公式;调查用途可显式 allowAdvisory:true(默认 fail-closed)。",
|
|
894
|
-
});
|
|
895
|
-
}
|
|
896
|
-
if (blockers.some((blocker) => blocker.severity !== "warning")) {
|
|
897
|
-
throw new ToolRefusalError({
|
|
898
|
-
status: "refused",
|
|
899
|
-
blocker: "rule-graph-validation-failed",
|
|
900
|
-
message: "nodeGraph 未过出门前校验(dry lint);按 validation 逐项修正,校验器不猜不改",
|
|
901
|
-
validation: blockers,
|
|
902
|
-
});
|
|
903
|
-
}
|
|
904
|
-
const nodes = Array.isArray(preparedGraph.nodes) ? preparedGraph.nodes : [];
|
|
905
|
-
const routes = Array.isArray(preparedGraph.routes) ? preparedGraph.routes : [];
|
|
906
|
-
// r15 harness finding: a multi-node graph with ZERO routes SAVES fine but the
|
|
907
|
-
// platform publish answers 550014 孤立节点 for every non-boundary node — the
|
|
908
|
-
// usual cause is the WRONG edge key (edges/from/to instead of routes/
|
|
909
|
-
// preNode/postNode, silently stripped). Refuse at the save gate, name the
|
|
910
|
-
// right shape, save the publish round-trip.
|
|
911
|
-
if (nodes.length >= 2 && routes.length === 0)
|
|
912
|
-
throw new ToolRefusalError({
|
|
913
|
-
status: "refused",
|
|
914
|
-
blocker: "rule-graph-routes-empty",
|
|
915
|
-
message: `图有 ${nodes.length} 个节点但 0 条 routes——平台发布会判「孤立节点」(550014)。边用 routes:[{preNode:"Start",postNode:"UPDATE_1"},...](不是 edges/from/to,那会被静默剥掉)`,
|
|
916
|
-
});
|
|
959
|
+
// Pre-flight dry lint (ticket 14) lives in lintRuleGraphForWrite (r73 #1):
|
|
960
|
+
// the SAME lint now serves the real write AND `rule.node.update`'s
|
|
961
|
+
// dryRunPayload, so a dry-run answers the same 能写/不能写 question.
|
|
962
|
+
const { preparedGraph, blockers, lintWarnings, lintHazards, nodes, routes } = await lintRuleGraphForWrite(session, args);
|
|
917
963
|
await assertCreateSelectionCompatibility(session, args.schemaCode, Array.isArray(nodes) ? nodes : []);
|
|
918
964
|
await assertBizActionMappingFieldsExist(session, args.schemaCode, Array.isArray(nodes) ? nodes : []);
|
|
919
965
|
// r47a: ordinary UPDATE/CREATE/EXPRESSION references use two distinct
|
|
@@ -1053,17 +1099,10 @@ export async function executeRuleSaveWrite(session, args) {
|
|
|
1053
1099
|
// Only CUSTOM rule codes take the caller's name. `existing` already carries
|
|
1054
1100
|
// the platform name, so the spread preserves it.
|
|
1055
1101
|
const isPresetRule = PLATFORM_TRIGGER_RULE_CODES.has(args.ruleCode);
|
|
1056
|
-
// A5 写前 gate(2026-11-03 issue
|
|
1057
|
-
//
|
|
1058
|
-
//
|
|
1059
|
-
|
|
1060
|
-
if (!isPresetRule && typeof args.name === "string" && !/^[\u4e00-\u9fa5A-Za-z0-9]{1,50}$/.test(args.name)) {
|
|
1061
|
-
throw new ToolRefusalError({
|
|
1062
|
-
status: "refused",
|
|
1063
|
-
blocker: "rule-name-invalid",
|
|
1064
|
-
message: `规则 name「${args.name.slice(0, 60)}」不符合平台约束:仅支持中文/字母/数字,长度 1-50(设计器校验;违规名虽能落库,但设计器无法再编辑该规则)。建议改为纯中文或字母数字命名。`,
|
|
1065
|
-
});
|
|
1066
|
-
}
|
|
1102
|
+
// A5 写前 gate(2026-11-03 issue):name 字符集校验。r73 #1 起与 write.ts
|
|
1103
|
+
// semanticGate / rule.node.update dryRunPayload 共用同一函数(预置触发行
|
|
1104
|
+
// 在函数内部跳过),dry-run 与真写同答案。
|
|
1105
|
+
assertRuleNamePlatformAcceptable(args.ruleCode, args.name);
|
|
1067
1106
|
// A8(2026-11-03 issue,8.1.108 实测):`options` / `extensionSetting` 缺席或空串
|
|
1068
1107
|
// 时平台落 "",8.1 族实体校验要求结构化的默认值——update 回无明细 50000。写前
|
|
1069
1108
|
// 归一:空串/缺席补平台默认结构(与设计器保存行为一致)。
|
package/dist/tool-types.js
CHANGED
|
@@ -114,6 +114,17 @@ const TOOL_INPUT_ALIASES = Object.freeze({
|
|
|
114
114
|
"programming.compile": Object.freeze({ businessRuleCode: ["ruleCode"] }),
|
|
115
115
|
"programming.save": Object.freeze({ businessRuleCode: ["ruleCode"] }),
|
|
116
116
|
"programming.publish": Object.freeze({ businessRuleCode: ["ruleCode"] }),
|
|
117
|
+
// 线上 #40 第 10 条(2026-11-17):参数键名靠试错。以下四组在实证里
|
|
118
|
+
// 都是「同一对象换了个名字」,且别名在该工具上不与任何合法键冲突:
|
|
119
|
+
// 视图 code(listview 族)在参数表里叫 code,调用方习惯 viewCode;
|
|
120
|
+
"listview.get": Object.freeze({ code: ["viewCode"] }),
|
|
121
|
+
"listview.configure": Object.freeze({ code: ["viewCode"] }),
|
|
122
|
+
// 服务 code(b2 族读面)叫 serviceCode,调用方习惯 code;
|
|
123
|
+
"service.get": Object.freeze({ serviceCode: ["code"] }),
|
|
124
|
+
// 规则引用:查引用时调用方习惯 ruleCode/schemaCode,规范键是 code/schemaCodes。
|
|
125
|
+
// 注意 schemaCode→schemaCodes 是「扫描范围」语义(不是被查对象)——只在
|
|
126
|
+
// 调用方没给 code 时生效;kind=model 想按模型查请显式用 code。
|
|
127
|
+
"rule.references": Object.freeze({ code: ["ruleCode"], schemaCodes: ["schemaCode"] }),
|
|
117
128
|
});
|
|
118
129
|
/**
|
|
119
130
|
* r54 C② F2:该工具在 TOOL_INPUT_ALIASES 里声明的**同义词键**(调用方可能拿来
|
package/dist/write.js
CHANGED
|
@@ -24,6 +24,7 @@ import { assertFieldFamilyAllowed } from "./field-families.js";
|
|
|
24
24
|
import { validateBusinessCode } from "./code-rules.js";
|
|
25
25
|
import { hardLayoutViolations, validateFormLayout } from "./form-layout.js";
|
|
26
26
|
import { prepareRuleGraph, validateRuleNodeGraph } from "./lanes/rule-graph.js";
|
|
27
|
+
import { assertRuleNamePlatformAcceptable } from "./rule-support.js";
|
|
27
28
|
import { WireError } from "./wire.js";
|
|
28
29
|
/**
|
|
29
30
|
* The shared governed write pipeline and the low-level write registration
|
|
@@ -399,6 +400,11 @@ export function writeTool(definition) {
|
|
|
399
400
|
// Ticket 113: warning-severity findings ride the payload but never gate.
|
|
400
401
|
if (blockers.some((blocker) => blocker.severity !== "warning"))
|
|
401
402
|
throw new ToolRefusalError({ status: "refused", blocker: "rule-graph-validation-failed", nextCommand: "omc describe rule.save --example business-rule-branch-conditional", message: "nodeGraph 未过出门前校验(dry lint);按 validation 逐项修正,校验器不猜不改", validation: blockers });
|
|
403
|
+
// r73 #1(GitLab #40):rule name 的字符集校验此前只在
|
|
404
|
+
// executeRuleSaveWrite(execute 面)里,`rule.save --dry-run` 能跑图 lint 却
|
|
405
|
+
// 不跑 name 校验 → dry-run 过、真写拒。同一函数提到本闸后,dry-run 与真写
|
|
406
|
+
// 同答案(预置触发行在函数内部跳过;语义与 execute 面逐字节一致)。
|
|
407
|
+
assertRuleNamePlatformAcceptable(String(args.ruleCode ?? ""), args.name);
|
|
402
408
|
}
|
|
403
409
|
// Optional per-tool semantic gate: refuse before the write permission gate
|
|
404
410
|
// and before any wire call, independent of input-schema validation.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stalfh233/omc-cli",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.68",
|
|
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.68",
|
|
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.68"
|
|
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`),不要整篇预取。
|