@stalfh233/omc-cli 0.6.44 → 0.6.49

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.
Files changed (43) hide show
  1. package/dist/capability-overview.js +113 -0
  2. package/dist/cli-stdout.js +3 -0
  3. package/dist/cli.js +255 -60
  4. package/dist/command-transport.js +5 -1
  5. package/dist/discovery.js +193 -75
  6. package/dist/goal-plan.js +1244 -0
  7. package/dist/goal-routes.js +78 -3
  8. package/dist/graph.js +264 -38
  9. package/dist/lanes/app.js +4 -0
  10. package/dist/lanes/apply-changes.js +1 -0
  11. package/dist/lanes/b2-registration.js +24 -0
  12. package/dist/lanes/businessrule.js +5 -0
  13. package/dist/lanes/custom-page.js +8 -0
  14. package/dist/lanes/datarule.js +4 -0
  15. package/dist/lanes/dictionary.js +13 -0
  16. package/dist/lanes/environment.js +2 -0
  17. package/dist/lanes/field.js +14 -0
  18. package/dist/lanes/folder.js +4 -0
  19. package/dist/lanes/form.js +5 -0
  20. package/dist/lanes/list-view.js +5 -0
  21. package/dist/lanes/meta.js +5 -0
  22. package/dist/lanes/model.js +9 -0
  23. package/dist/lanes/online-js.js +2 -0
  24. package/dist/lanes/organization.js +20 -0
  25. package/dist/lanes/perm.js +5 -5
  26. package/dist/lanes/programming.js +6 -0
  27. package/dist/lanes/report.js +9 -0
  28. package/dist/lanes/rule-lifecycle.js +6 -0
  29. package/dist/lanes/rulelog.js +1 -0
  30. package/dist/lanes/runtime-data.js +6 -0
  31. package/dist/lanes/workflow.js +18 -0
  32. package/dist/mcp-graph.js +180 -41
  33. package/dist/package-tool.js +1 -0
  34. package/dist/search-index.js +137 -0
  35. package/dist/tool-search.js +647 -0
  36. package/dist/tools.js +1 -0
  37. package/dist/write.js +2 -1
  38. package/docs/omc-introduction.md +5 -7
  39. package/package.json +6 -5
  40. package/skills/omc-business-configuration.md +2 -1
  41. package/skills/omc-capabilities.md +3 -2
  42. package/skills/omc-start-here.md +21 -7
  43. package/skills/omc-tool-selection.md +7 -15
package/dist/tools.js CHANGED
@@ -167,6 +167,7 @@ export function buildToolRegistry() {
167
167
  function registerRequestStatusTool(tools) {
168
168
  tools.push(defineTool({
169
169
  name: "request.status",
170
+ search: { intents: ["请求后来成了吗", "请求结果", "按 requestId 查状态", "请求状态", "异步请求"] },
170
171
  layer: "meta",
171
172
  kind: "read",
172
173
  description: "按 requestId 查本机写产物;uncertain 后确认,不查远端。",
package/dist/write.js CHANGED
@@ -354,7 +354,7 @@ function findCompleted(root, requestId, tool, environment, requestFingerprint) {
354
354
  }
355
355
  /** Low-level write registration factory: shared by every lane adapter. */
356
356
  export function writeTool(definition) {
357
- const { tools, name, lane, scope, description, inputSchema, execute, preflight, dryRunPayload, rollback, readOnlyEscape } = definition;
357
+ const { tools, name, lane, scope, description, inputSchema, search, execute, preflight, dryRunPayload, rollback, readOnlyEscape } = definition;
358
358
  const rawExecute = execute;
359
359
  const semanticGate = (args) => {
360
360
  if (name === "field.create")
@@ -408,6 +408,7 @@ export function writeTool(definition) {
408
408
  lane,
409
409
  scope,
410
410
  description: `${description} ${WRITE_PROTOCOL}`,
411
+ ...(search === undefined ? {} : { search }),
411
412
  inputSchema: { environment: environmentArg, capability: capabilityArg, confirmProduction: confirmProductionArg, requestId: z.string().min(1).optional(), dryRun: z.boolean().optional(), ...inputSchema },
412
413
  handler: async (ctx, args, self) => {
413
414
  semanticGate(args);
@@ -629,12 +629,10 @@ CLI 把 writable、生产确认、写锁、幂等、读回做进**进程边界**
629
629
 
630
630
  **发现面分档,按需放大。**
631
631
 
632
- - `next`:2–5 KB
633
- - `commands --json --compact --lane`:约 1 KB
634
- - `describe`:1.5–2.5 KB
635
- - `commands --json`:约 20 KB(回退面)
636
-
637
- 先走小档,缺形状再放大。
632
+ 各面的**实测字节与选面规则**只有一份:`omc help omc-start-here` 的「发现面档位表」。
633
+ 一句话版:`next` → `capability` → `describe` / `describe --example` → `commands`(索引)
634
+ → `commands --json`(回退面)→ `describe --full`。先走小档,缺形状再放大;
635
+ `commands --json` 与 `--full` 都是回退面,不是默认面。
638
636
 
639
637
  **默认只回索引 / 摘要 / 形状。**
640
638
 
@@ -782,7 +780,7 @@ omc describe <tool> # 单工具 schema + 可运行示例
782
780
 
783
781
  ## 12. 附录:全部工具清单
784
782
 
785
- > 以 `omc commands --json` 为准;下面是按能力分组的当前快照(154 个)。
783
+ > **唯一权威是 `omc commands --json`**(工具数随能力增长,本附录不维护计数);下面是按能力分组的快照。
786
784
 
787
785
  **元 / 治理(6)**
788
786
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stalfh233/omc-cli",
3
- "version": "0.6.44",
3
+ "version": "0.6.49",
4
4
  "description": "CloudPivot 8.6 configuration capability CLI — governed, fail-closed, coverage-manifest bounded.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -27,7 +27,7 @@
27
27
  "coverage:manifest": "tsx scripts/coverage-manifest.ts --write",
28
28
  "coverage:check": "tsx scripts/coverage-manifest.ts --check",
29
29
  "test": "npm run build && node scripts/run-tests.mjs",
30
- "verify": "npm run typecheck && npm run coverage:check && npm test",
30
+ "verify": "npm run typecheck && npm run coverage:check && npm run verify:search-metadata && npm test",
31
31
  "eval:call-face": "node --import tsx scripts/run-call-face-eval.ts",
32
32
  "eval:intent-face": "node --import tsx scripts/run-intent-face-eval.ts",
33
33
  "eval:discovery-cost": "node --import tsx scripts/run-discovery-cost-baseline.ts",
@@ -45,7 +45,8 @@
45
45
  "build:fast": "tsc --project tsconfig.build.json --incremental",
46
46
  "typecheck:fast": "tsc --noEmit --incremental --tsBuildInfoFile .typecheck.tsbuildinfo",
47
47
  "test:changed": "node scripts/run-tests-changed.mjs",
48
- "test:changed:since": "node scripts/run-tests-changed.mjs --since"
48
+ "test:changed:since": "node scripts/run-tests-changed.mjs --since",
49
+ "verify:search-metadata": "tsx scripts/verify-search-metadata.ts --strict"
49
50
  },
50
51
  "engines": {
51
52
  "node": ">=20"
@@ -55,7 +56,7 @@
55
56
  },
56
57
  "dependencies": {
57
58
  "commander": "14.0.3",
58
- "omc-core": "0.6.44",
59
+ "omc-core": "0.6.49",
59
60
  "proper-lockfile": "4.1.2",
60
61
  "write-file-atomic": "6.0.0",
61
62
  "zod": "^3.23.8",
@@ -73,6 +74,6 @@
73
74
  "directory": "packages/omc-cli"
74
75
  },
75
76
  "optionalDependencies": {
76
- "@stalfh233/omc-fake-platform": "0.6.44"
77
+ "@stalfh233/omc-fake-platform": "0.6.49"
77
78
  }
78
79
  }
@@ -11,7 +11,8 @@ description: 中文 CloudPivot 业务配置 runbook。用于把模型、字段
11
11
 
12
12
  ```bash
13
13
  CLI="packages/omc-cli/dist/cli.js"
14
- node "$CLI" commands --json
14
+ node "$CLI" commands --capability <id> # 单能力族工具面
15
+ node "$CLI" commands --json # 全量目录(回退面)
15
16
  node "$CLI" describe <tool>
16
17
  node "$CLI" contract <lane>
17
18
  node "$CLI" call discover_environment --env <env> --args '{}'
@@ -10,8 +10,9 @@ covers**. Read it when you need to answer "能不能做 X?/ 用哪个能力?
10
10
  before you escalate the question to the user, and before you decide "X 要二开".
11
11
 
12
12
  This topic is the **prose authority** for capability coverage; `omc capabilities`
13
- / `omc next` / `omc capability <id>` are its machine-readable projection over the
14
- same 15 capabilities (a `verify` test fails if the two drift). A concrete wire
13
+ (索引) / `omc capabilities --full`(完整投影)/ `omc next` / `omc capability <id>`
14
+ / `omc commands --capability <id>`(该能力族的工具面)are its machine-readable
15
+ projection over the same capabilities (a `verify` test fails if the two drift). A concrete wire
15
16
  shape is always reached by `omc describe <tool> --example <recipe>` — this
16
17
  catalogue only names the tool and the recipe, never re-specifies the payload.
17
18
 
@@ -25,15 +25,13 @@ be treated as a second source. Read this, then follow the topics it names.
25
25
  - `whole-package`(做应用/系统、从零搭)→ 带 `intent` 块:写声明式意图文件,`omc intent validate/plan/apply/readback` 按依赖顺序合成原生结构,比逐能力拼装更省、更不易漂移;`intent: partial` 未覆盖的(应用/字典/集成/运行数据)再用 `call` 补。
26
26
  - `build`/`modify` → 按阶梯内联的**写工具 + 必填参数**执行。
27
27
  - `scout`(能不能/怎么写/是否支持)→ 先探边界(`omc-capability-scouting`),别直接写。若 `next` 返回 **`boundary`**(`match.kind:"boundary"`,如 `ocr-e-signature`/`release-prod`/`inline-coding`),说明需求**不在覆盖内**(`write:false`):如实报告、用 `omc capabilities` 核对,**不要**用相近能力伪造实现。
28
- 阶梯步骤已内联工具必填参数(`route.ladder[].tools`/`readTools`)与命中 recipe 的 `describe <tool> --example <id>`;据此直接执行——**不要再逐能力 `commands --lane`**,也不要先扫 `commands --json`/全部 `contract`/全部 `describe --full`。
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 报告),之后 `omc graph references <service|model|field> <code>` 离线答「谁引用了它」——一调替代逐模型 `rule.get` 枚举(r30 实测影响评估手工枚举 8×rule.get,graph 一调可达);`impact <kind> <code>` 看爆炸半径、`search <词>` 找规则 code、`status` 看索引新鲜度。索引不含规则条件叶子与流程绑定,命中后仍以 `rule.get` 原文为准。无索引时会拒绝并指路 pull。宿主已接 MCP 时用 `omc mcp-graph --path <项目根>`(工具 `omc_graph_explore`/`omc_graph_status`)。
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.get` 原文为准。MCP:`omc mcp-graph --path <根>[,<另一根>]`,用 `project`+`env` 选库(`omc_graph_projects`)。
31
31
 
32
- **图谱多应用覆盖时怎么盘点(只读)**:优先用 `omc graph pull --all-applications --env <env>` 建全租户索引;也可用 `--application-codes <a,b,c>` 指定应用,再用 `omc graph status` 看 coveredApplications/tenantApplications。
33
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。包路径/类名不得改。
34
33
  2. 写前只需读 `omc-config-draft-review`(人审门)与 `omc-five-piece-flow`(发现→草稿→权限→执行→回读);`omc-business-configuration` 按命中的能力分节读(见 `next` 的 `readSections`),不要整篇预取。
35
- 3. 环境名以 `omc doctor` 的「环境=」或 `.omc-env` 为准;工具不确定先用默认 `describe`/`--example`,只有单个工具缺形状才用 `--full`;`describe` 带 `exampleHint`/`recipeHint` 时优先 `--example`。
36
- 4. 只有工具不在 `next` 命中能力内、或要看 purpose/枚举时,才补一次 `commands --json --compact --lane <lane>`。非显然形状(规则图、流程模板、表单布局、RESTFUL)才单独 `describe --example`。
34
+ 3. 环境名以 `omc doctor` 的「环境=」或 `.omc-env` 为准。发现面按下面的档位表(唯一口径)从小到大取;`describe` 带 `exampleHint`/`recipeHint` 时优先 `--example`。
37
35
  5. 键名按对象不同:模型 `schemaCode`、默认表单 `sheetCode`(可省略,默认 == 模型 code)、流程 `workflowCode`/`code`——报错会提示同义键;字段族名认不出会给「最接近的族」。
38
36
  6. **写操作串行**:同一环境不要并发写(含多个 `omc call` 并行进程——环境写锁互斥,r31 实证并行 field.create 2/3 被拒);多个写合并为一条 `omc script` 逐行跑(进程内自动串行);`write-lock-held` 是瞬态:**优先在发起时就排队**——`omc call <tool> --wait 5000`(或 `omc intent apply ... --wait 5000`)让 CLI 内部有界重试,不必自己再花一轮。
39
37
  7. **单个对象优先高阶编排工具**:模型+字段用 `configure_model`(一次含全部字段),表单用 `configure_form`,列表用 `listview.configure`(**默认视图已存在,省略 code 即配置它,不要 `listview.create`**)。原子工具留给单点修改。
@@ -57,9 +55,25 @@ omc help <topic> --section "<heading>" # one methodology section, not all
57
55
  omc help --search "40000" # full-text search across all topics (answer in one call)
58
56
  ```
59
57
 
60
- Discovery precedes every write. 预算档位见 `omc-tool-selection` 的「Discovery 成本档位」;裸 `omc commands` 是有界索引,全量目录须显式 `commands --json`。
58
+ Discovery precedes every write(档位见下表;裸 `commands` 是有界索引,全量目录用 `commands --json`)。
61
59
 
62
- Fallback faces: `omc capabilities`, `omc capability <id-or-alias> --executable`, `omc commands --json --compact`, `omc contract <lane>`, `omc describe <tool>`.
60
+ ## 发现面档位表(唯一口径)
61
+
62
+ 从小到大取;上一档不够才进下一档,不为「先看看」取 `--json`/`--full`。
63
+
64
+ | 命令 | 默认给什么 / 何时用 | 实测 |
65
+ |---|---|---|
66
+ | `omc plan "<目标>" --env` | **第一调用**:路由+解析id+步骤+读回+dry-run | 1–3.3K |
67
+ | `omc next "<目标>"` | 只要路线/方法论 | 0.9–2.8 KB |
68
+ | `omc commands` / `capabilities` | 路由/能力索引 | 0.6–0.9 KB |
69
+ | `omc commands --capability <id>` | 单能力族工具面(brief+recipe) | 1.3–2.5K |
70
+ | `omc capability <id>` | 单能力:依赖顺序+意图+覆盖 | ~1.9 KB |
71
+ | `omc describe <tool>` / `--example <id>` | 参数面+firstCall / 单配方可运行 args | 0.5–1.7 KB |
72
+ | `omc commands --json` | 全量目录(回退面;`--compact` 去散文) | 22–29 KB |
73
+ | `omc contract <lane>` / `describe <tool> --full` | lane 契约 / 全 schema;默认缺形状才用 | 1–75 KB |
74
+ | `omc help <topic>` / `--search "<词>"` | 节索引 / 跨 topic 命中节 | 1–8 KB |
75
+
76
+ `capabilities --full`(~8.9KB)/ `omc capability <id-or-alias> --executable`(~5.6KB)都不是默认面。
63
77
 
64
78
  ## 1. Task → topic map
65
79
 
@@ -8,21 +8,13 @@ description: Choose the right OMC CLI tool for a goal. Use when unsure whether a
8
8
  ## Discovery 成本档位(按量级选,别一上来就点大档)
9
9
 
10
10
  实测:一条重难业务里,agent 对**发现面**的重复读占了任务上下文的大头。先走小档,缺形状再逐级放大。
11
- (round14 已把各面瘦身,下表为当前实测。)
12
-
13
- | Face | ~size | 用途 |
14
- | --- | ---: | --- |
15
- | `omc next "<goal>"` | 2–5 KB | 目标→路线(首选) |
16
- | `omc commands --json --compact --lane <lane>` | ~1 KB | 单能力工具行(最省的枚举面) |
17
- | `omc describe <tool>` / `--example <id>` | 1.5–2.5 KB | 单工具形状 |
18
- | `omc commands` | ~8 KB | 有界索引(name/lane/kind) |
19
- | `omc commands --json --compact` | ~13 KB | 全量紧凑行 |
20
- | `omc capabilities --compact` | ~2.5 KB | 能力索引(id/lane/intent/coverage/toolCount,**无工具名**) |
21
- | `omc capabilities` | ~8 KB | 能力总览(含 aliases/tools/依赖顺序);`next` 已给路线时可省 |
22
- | `omc commands --json` | ~20 KB | 全量目录(回退面,尽量避免) |
23
- | `omc describe <tool> --full` | 7–19 KB | 仅当 schema 需要;不再重发 recipes(用 `--example` 取可运行参数) |
24
-
25
- 裸 `omc commands` 只是索引;**全量目录必须显式 `--json`**。同一 face 不要反复读。
11
+
12
+ **各面的实测字节与「什么时候用」= `omc-start-here` 的「发现面档位表」(唯一口径,不在此重复)。**
13
+
14
+ 选面只用两条规则:
15
+
16
+ 1. 从最上面一档试;**上一档不够才进下一档**。
17
+ 2. 同一 face 不要反复读;`describe` 给过 `exampleHint` 就直接 `--example`,不要先 `--full`。
26
18
 
27
19
  ## Minimal-path cheat sheet(最小路径速查)
28
20