@stalfh233/omc-cli 0.0.0-stage → 0.4.0

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 (181) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +304 -3
  3. package/coverage/m1-coverage-manifest-v1.json +1278 -0
  4. package/dist/approval-token.js +102 -0
  5. package/dist/args.js +25 -0
  6. package/dist/artifacts.js +119 -0
  7. package/dist/bench/call-face-eval.js +256 -0
  8. package/dist/bench/context-attribution.js +151 -0
  9. package/dist/bench/discovery-cost-eval.js +230 -0
  10. package/dist/bench/driver.js +81 -0
  11. package/dist/bench/evals.js +236 -0
  12. package/dist/bench/fake-http-server.js +65 -0
  13. package/dist/bench/instrument.js +87 -0
  14. package/dist/bench/intent-face-eval.js +343 -0
  15. package/dist/bench/run.js +166 -0
  16. package/dist/bench/scenario.js +343 -0
  17. package/dist/bench/types.js +76 -0
  18. package/dist/bi-wire.js +41 -0
  19. package/dist/bizservice-config.js +581 -0
  20. package/dist/call.js +153 -0
  21. package/dist/capability-absences.js +23 -0
  22. package/dist/capability-overview.js +492 -0
  23. package/dist/capability-shape.js +154 -0
  24. package/dist/cli-contract.js +70 -0
  25. package/dist/cli-output.js +73 -0
  26. package/dist/cli.js +1418 -0
  27. package/dist/code-rules.js +69 -0
  28. package/dist/command-transport.js +155 -0
  29. package/dist/config-store.js +195 -0
  30. package/dist/context.js +21 -0
  31. package/dist/contract-consistency.js +66 -0
  32. package/dist/contract-resources.js +62 -0
  33. package/dist/coverage-consistency.js +62 -0
  34. package/dist/coverage-registry.js +76 -0
  35. package/dist/coverage.js +130 -0
  36. package/dist/data-list-filter.js +114 -0
  37. package/dist/discovery.js +390 -0
  38. package/dist/endpoints.js +154 -0
  39. package/dist/environment-policy.js +26 -0
  40. package/dist/execution-metadata.js +1092 -0
  41. package/dist/fake/app.js +45 -0
  42. package/dist/fake/b2-registration.js +594 -0
  43. package/dist/fake/businessrule.js +242 -0
  44. package/dist/fake/datarule.js +72 -0
  45. package/dist/fake/dictionary.js +108 -0
  46. package/dist/fake/environment.js +30 -0
  47. package/dist/fake/field.js +167 -0
  48. package/dist/fake/form.js +101 -0
  49. package/dist/fake/index.js +121 -0
  50. package/dist/fake/list-view.js +289 -0
  51. package/dist/fake/model.js +136 -0
  52. package/dist/fake/online-js.js +18 -0
  53. package/dist/fake/report.js +253 -0
  54. package/dist/fake/routes.js +47 -0
  55. package/dist/fake/rule-lifecycle.js +37 -0
  56. package/dist/fake/runtime-data.js +367 -0
  57. package/dist/fake/state.js +67 -0
  58. package/dist/fake/workflow.js +364 -0
  59. package/dist/field-change.js +200 -0
  60. package/dist/field-families.js +896 -0
  61. package/dist/form-layout.js +111 -0
  62. package/dist/form-support.js +821 -0
  63. package/dist/goal-routes.js +468 -0
  64. package/dist/governed-execution.js +87 -0
  65. package/dist/human-summary.js +212 -0
  66. package/dist/identity.js +62 -0
  67. package/dist/intent/baseline.js +57 -0
  68. package/dist/intent/capabilities/bizservice.js +274 -0
  69. package/dist/intent/capabilities/businessrule.js +493 -0
  70. package/dist/intent/capabilities/datarule.js +187 -0
  71. package/dist/intent/capabilities/field.js +545 -0
  72. package/dist/intent/capabilities/form.js +136 -0
  73. package/dist/intent/capabilities/index.js +64 -0
  74. package/dist/intent/capabilities/listview.js +157 -0
  75. package/dist/intent/capabilities/model.js +100 -0
  76. package/dist/intent/capabilities/onlinejs.js +108 -0
  77. package/dist/intent/capabilities/report.js +355 -0
  78. package/dist/intent/capabilities/workflow.js +458 -0
  79. package/dist/intent/capability.js +6 -0
  80. package/dist/intent/cli.js +91 -0
  81. package/dist/intent/compare.js +56 -0
  82. package/dist/intent/compiler.js +79 -0
  83. package/dist/intent/dsl.js +129 -0
  84. package/dist/intent/plan-file.js +63 -0
  85. package/dist/intent/readback.js +65 -0
  86. package/dist/intent/schema.js +158 -0
  87. package/dist/intent/validation.js +30 -0
  88. package/dist/intent/yaml.js +315 -0
  89. package/dist/json-column.js +68 -0
  90. package/dist/lanes/app-contract.js +95 -0
  91. package/dist/lanes/app-coverage.js +16 -0
  92. package/dist/lanes/app.js +174 -0
  93. package/dist/lanes/apply-changes.js +231 -0
  94. package/dist/lanes/b2-registration-contract.js +292 -0
  95. package/dist/lanes/b2-registration-coverage.js +48 -0
  96. package/dist/lanes/b2-registration.js +1187 -0
  97. package/dist/lanes/businessrule-contract.js +232 -0
  98. package/dist/lanes/businessrule-coverage.js +16 -0
  99. package/dist/lanes/businessrule.js +221 -0
  100. package/dist/lanes/contract-support.js +65 -0
  101. package/dist/lanes/coverage-declaration.js +9 -0
  102. package/dist/lanes/datarule-contract.js +155 -0
  103. package/dist/lanes/datarule-coverage.js +19 -0
  104. package/dist/lanes/datarule-protocol.js +308 -0
  105. package/dist/lanes/datarule.js +818 -0
  106. package/dist/lanes/dictionary-contract.js +78 -0
  107. package/dist/lanes/dictionary-coverage.js +24 -0
  108. package/dist/lanes/dictionary.js +235 -0
  109. package/dist/lanes/environment-contract.js +70 -0
  110. package/dist/lanes/environment-coverage.js +14 -0
  111. package/dist/lanes/environment.js +163 -0
  112. package/dist/lanes/field-contract.js +223 -0
  113. package/dist/lanes/field-coverage.js +27 -0
  114. package/dist/lanes/field.js +374 -0
  115. package/dist/lanes/form-contract.js +97 -0
  116. package/dist/lanes/form-coverage.js +16 -0
  117. package/dist/lanes/form.js +185 -0
  118. package/dist/lanes/lane-ids.js +34 -0
  119. package/dist/lanes/list-view-contract.js +175 -0
  120. package/dist/lanes/list-view-coverage.js +20 -0
  121. package/dist/lanes/list-view-shapes.js +1207 -0
  122. package/dist/lanes/list-view.js +578 -0
  123. package/dist/lanes/meta-contract.js +85 -0
  124. package/dist/lanes/meta.js +255 -0
  125. package/dist/lanes/model-contract.js +168 -0
  126. package/dist/lanes/model-coverage.js +20 -0
  127. package/dist/lanes/model.js +986 -0
  128. package/dist/lanes/online-js-contract.js +99 -0
  129. package/dist/lanes/online-js-coverage.js +28 -0
  130. package/dist/lanes/online-js.js +127 -0
  131. package/dist/lanes/report-contract.js +144 -0
  132. package/dist/lanes/report-coverage.js +21 -0
  133. package/dist/lanes/report.js +476 -0
  134. package/dist/lanes/rule-graph.js +1846 -0
  135. package/dist/lanes/rule-lifecycle-contract.js +92 -0
  136. package/dist/lanes/rule-lifecycle-coverage.js +20 -0
  137. package/dist/lanes/rule-lifecycle.js +176 -0
  138. package/dist/lanes/runtime-data-contract.js +264 -0
  139. package/dist/lanes/runtime-data-coverage.js +25 -0
  140. package/dist/lanes/runtime-data.js +1054 -0
  141. package/dist/lanes/workflow-contract.js +223 -0
  142. package/dist/lanes/workflow-coverage.js +40 -0
  143. package/dist/lanes/workflow.js +1813 -0
  144. package/dist/online-js-layout.js +58 -0
  145. package/dist/online-js-source.js +276 -0
  146. package/dist/package-tool.js +51 -0
  147. package/dist/package.js +73 -0
  148. package/dist/plan.js +73 -0
  149. package/dist/read.js +144 -0
  150. package/dist/redact.js +28 -0
  151. package/dist/rule-support.js +587 -0
  152. package/dist/runtime-support.js +134 -0
  153. package/dist/server.js +92 -0
  154. package/dist/session-manager.js +30 -0
  155. package/dist/session.js +149 -0
  156. package/dist/skills.js +112 -0
  157. package/dist/support.js +98 -0
  158. package/dist/tool-types.js +127 -0
  159. package/dist/tools.js +59 -0
  160. package/dist/usage-log.js +197 -0
  161. package/dist/wire.js +287 -0
  162. package/dist/workflow-support.js +99 -0
  163. package/dist/write-lease.js +26 -0
  164. package/dist/write-lock.js +109 -0
  165. package/dist/write.js +176 -0
  166. package/dist/zip.js +156 -0
  167. package/docs/tool-surface-map.md +42 -0
  168. package/package.json +71 -6
  169. package/skills/omc-acceptance-criteria.md +47 -0
  170. package/skills/omc-business-configuration.md +257 -0
  171. package/skills/omc-capabilities.md +197 -0
  172. package/skills/omc-capability-scouting.md +55 -0
  173. package/skills/omc-config-draft-review.md +171 -0
  174. package/skills/omc-five-piece-flow.md +35 -0
  175. package/skills/omc-glossary.md +86 -0
  176. package/skills/omc-refusals.md +110 -0
  177. package/skills/omc-requirement-analysis.md +161 -0
  178. package/skills/omc-requirement-vocabulary.md +51 -0
  179. package/skills/omc-start-here.md +82 -0
  180. package/skills/omc-tool-selection.md +119 -0
  181. package/skills/omc-write-hazards.md +87 -0
@@ -0,0 +1,111 @@
1
+ /**
2
+ * CFG-form-layout (borrowed from cpdocs base3.0 `cp-bizsheet/scripts/layout.js`):
3
+ * a form's rows + control spans must obey the platform's layout invariants.
4
+ * The pre-fix tools wrote rows/span unchecked, so a malformed layout only
5
+ * surfaced as a blank or broken designer page — the same failure family as
6
+ * CFG-26's blank rule canvas.
7
+ *
8
+ * Invariants (all local, zero wire):
9
+ * 1. `span` is one of the platform's allowed widths {6, 8, 12, 16, 18, 24};
10
+ * 2. each row's spans sum to at most 24;
11
+ * 3. a full-width control (span 24) occupies its row alone;
12
+ * 4. every attribute control appears in `rows` exactly once — nothing extra,
13
+ * nothing missing, no duplicates.
14
+ */
15
+ export const ALLOWED_SPANS = new Set([6, 8, 12, 16, 18, 24]);
16
+ export const FULL_SPAN = 24;
17
+ /** Child-table (Sheet 201) column keys, which must live on `columns`, never in rows. */
18
+ function childColumnKeys(attrs) {
19
+ const keys = new Set();
20
+ for (const control of Object.values(attrs)) {
21
+ if (control?.type !== 201 || !Array.isArray(control.columns))
22
+ continue;
23
+ for (const column of control.columns)
24
+ if (typeof column?.key === "string")
25
+ keys.add(column.key);
26
+ }
27
+ return keys;
28
+ }
29
+ /**
30
+ * The render-shape gate for CALLER-PROVIDED layouts. These read back fine but
31
+ * blank the 8.6.34 renderer:
32
+ * - a control's `options` as a JSON string → the runtime mutates
33
+ * `options.name_i18n` on it and throws "Cannot create property 'name_i18n'
34
+ * on string". Healthy platform forms carry object options only (0/43 sampled).
35
+ * - a non-string viewJson cell.
36
+ * - a child-table column key used as a layout row (child keys stay on the 201
37
+ * control's `columns`).
38
+ * Tolerant of a one-sided layout (only rows or only attributes supplied).
39
+ */
40
+ export function validateFormLayoutShape(rows, attributes) {
41
+ const violations = [];
42
+ const attrs = (attributes && typeof attributes === "object" && !Array.isArray(attributes) ? attributes : {});
43
+ for (const [code, control] of Object.entries(attrs)) {
44
+ if (control && typeof control === "object" && typeof control.options === "string")
45
+ violations.push({
46
+ classification: "control_options_not_object",
47
+ field: code,
48
+ message: `控件 ${code} 的 options 是 JSON 字符串;必须是对象(8.6.34 运行时会写 options.name_i18n,字符串会抛 "Cannot create property 'name_i18n' on string" 导致整页空白)`,
49
+ });
50
+ }
51
+ if (Array.isArray(rows)) {
52
+ rows.forEach((row, rowIndex) => {
53
+ if (!Array.isArray(row)) {
54
+ violations.push({ classification: "view_cell_not_string", row: rowIndex + 1, message: `第 ${rowIndex + 1} 行必须是字段 key 数组` });
55
+ return;
56
+ }
57
+ row.forEach((cell, cellIndex) => {
58
+ if (typeof cell !== "string")
59
+ violations.push({ classification: "view_cell_not_string", row: rowIndex + 1, message: `viewJson[${rowIndex}][${cellIndex}] 必须是字符串(字段 key),实为 ${typeof cell}` });
60
+ });
61
+ });
62
+ const childKeys = childColumnKeys(attrs);
63
+ if (childKeys.size > 0) {
64
+ const leaked = [...new Set(rows.flat().filter((cell) => typeof cell === "string" && childKeys.has(cell)))];
65
+ if (leaked.length > 0)
66
+ violations.push({ classification: "child_column_in_rows", field: leaked.join("、"), message: `子表列 key 不能进 viewJson(应只挂在 201 控件的 columns 上):${leaked.join("、")}` });
67
+ }
68
+ }
69
+ return violations;
70
+ }
71
+ function spanOf(attributes, code, violations) {
72
+ const raw = typeof attributes[code]?.options === "object" ? (attributes[code]?.options).span : undefined;
73
+ const span = Number(raw ?? FULL_SPAN);
74
+ if (!ALLOWED_SPANS.has(span)) {
75
+ violations.push({ classification: "layout_invalid_span", field: code, span, message: `控件 ${code} 的 span=${String(raw)} 不在允许宽度 ${[...ALLOWED_SPANS].join("/")}` });
76
+ return FULL_SPAN;
77
+ }
78
+ return span;
79
+ }
80
+ /**
81
+ * Validate a form layout. Returns [] when the layout is well-formed. `rows` is
82
+ * the 2-D array of control codes; `attributes` is the control map.
83
+ */
84
+ export function validateFormLayout(rows, attributes) {
85
+ const violations = validateFormLayoutShape(rows, attributes);
86
+ if (!Array.isArray(rows) || rows.some((row) => !Array.isArray(row))) {
87
+ violations.push({ classification: "layout_coverage_mismatch", message: "rows 必须是二维数组(每行是控件 code 数组)" });
88
+ return violations;
89
+ }
90
+ const attrs = (attributes && typeof attributes === "object" && !Array.isArray(attributes) ? attributes : {});
91
+ const flat = rows.flat().map((code) => String(code));
92
+ const attributeCodes = Object.keys(attrs).sort();
93
+ const unique = new Set(flat);
94
+ if (unique.size !== flat.length)
95
+ violations.push({ classification: "layout_coverage_mismatch", message: `rows 中存在重复控件:${flat.filter((code, index) => flat.indexOf(code) !== index).join("、")}` });
96
+ if (JSON.stringify(attributeCodes) !== JSON.stringify([...flat].sort()))
97
+ violations.push({ classification: "layout_coverage_mismatch", message: `顶层控件与布局必须完整一一对应:attributes=[${attributeCodes.join(",")}] 而 rows=[${[...flat].sort().join(",")}]` });
98
+ rows.forEach((row, index) => {
99
+ const codes = row.map((code) => String(code));
100
+ const widths = codes.map((code) => spanOf(attrs, code, violations));
101
+ const total = widths.reduce((sum, width) => sum + width, 0);
102
+ if (total > FULL_SPAN) {
103
+ violations.push({ classification: "layout_row_overflow", row: index + 1, message: `第 ${index + 1} 行 span 合计 ${total},超过 ${FULL_SPAN}(${codes.join(" + ")})` });
104
+ }
105
+ if (codes.length !== 1 && widths.some((width) => width === FULL_SPAN)) {
106
+ violations.push({ classification: "full_row_control_conflict", row: index + 1, message: `第 ${index + 1} 行含整行控件(span=24),不能与其他控件同行(${codes.join(" + ")})` });
107
+ }
108
+ });
109
+ return violations;
110
+ }
111
+ //# sourceMappingURL=form-layout.js.map