@stalfh233/omc-cli 0.8.5 → 0.8.7
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/coverage/m1-coverage-manifest-v1.json +1 -0
- package/dist/approval-flow.js +49 -4
- package/dist/batch-call.js +21 -4
- package/dist/bench/scenario.js +1 -1
- package/dist/cli-stdout.js +1 -0
- package/dist/cli.js +84 -3
- package/dist/code-rules.js +144 -8
- package/dist/config-store.js +15 -1
- package/dist/coverage.js +2 -1
- package/dist/discovery.js +8 -2
- package/dist/endpoints.js +10 -0
- package/dist/form-layout.js +79 -0
- package/dist/form-support.js +65 -1
- package/dist/goal-routes.js +35 -5
- package/dist/graph.js +38 -3
- package/dist/human-summary.js +38 -2
- package/dist/intent/capabilities/field.js +1 -1
- package/dist/lanes/field-contract.js +4 -0
- package/dist/lanes/field-coverage.js +1 -0
- package/dist/lanes/field.js +20 -2
- package/dist/lanes/form-contract.js +1 -1
- package/dist/lanes/form.js +25 -3
- package/dist/lanes/list-view.js +21 -11
- package/dist/lanes/model-contract.js +2 -2
- package/dist/lanes/model-references.js +172 -0
- package/dist/lanes/model.js +226 -129
- package/dist/lanes/runtime-data-contract.js +3 -3
- package/dist/lanes/runtime-data.js +64 -8
- package/dist/lanes/workflow.js +91 -1
- package/dist/model-purge.js +1 -1
- package/dist/model-scaffold.js +6 -3
- package/dist/recipes/form.js +33 -6
- package/dist/recipes/runtime-data.js +1 -1
- package/dist/reserved.js +28 -0
- package/dist/residue.js +1 -1
- package/dist/tool-types.js +1 -0
- package/dist/version-family-gaps.js +33 -6
- package/dist/write.js +46 -8
- package/package.json +3 -3
- package/skills/omc-business-configuration.md +7 -0
- package/skills/omc-capabilities.md +1 -1
- package/skills/omc-playbook.md +5 -0
- package/skills/omc-refusals.md +4 -2
- package/skills/omc-start-here.md +1 -1
- package/skills/omc-tool-selection.md +2 -0
- package/skills/omc-write-hazards.md +3 -0
package/dist/approval-flow.js
CHANGED
|
@@ -20,6 +20,8 @@ import { runToolCall } from "./call.js";
|
|
|
20
20
|
import { envelope, requestId, classifyResult, CLI_EXIT_CODES } from "./cli-contract.js";
|
|
21
21
|
import { writeEnvelope } from "./cli-output.js";
|
|
22
22
|
import { argvValue } from "./args.js";
|
|
23
|
+
import { ConfigStore, defaultPaths } from "./config-store.js";
|
|
24
|
+
import { sessionAccountForEnvironment } from "./session-account.js";
|
|
23
25
|
/**
|
|
24
26
|
* r31c F20: participant object arrays only accept `{code,corpId,id,name,type}`.
|
|
25
27
|
* Intuitive keys (`participantType`/`roleId`/`participantName`) are silently
|
|
@@ -65,8 +67,8 @@ export function assertParticipantShape(participant, at) {
|
|
|
65
67
|
}
|
|
66
68
|
}
|
|
67
69
|
}
|
|
68
|
-
/** 解析步骤 DSL 为 {name,
|
|
69
|
-
export function
|
|
70
|
+
/** 解析步骤 DSL 为 {name,participant,kind,code}(导出供测试)。 */
|
|
71
|
+
export function parseStepDetail(raw) {
|
|
70
72
|
const match = /^(.+?)@(role|user):([A-Za-z0-9_.:-]+)$/.exec(raw.trim());
|
|
71
73
|
if (!match)
|
|
72
74
|
throw new Error(`--steps "${raw}" 解析失败:形如 名称@role:<角色code> 或 名称@user:<用户id>(自由文本角色名能发布但解析不到人、不生成待办)`);
|
|
@@ -74,10 +76,50 @@ export function parseStep(raw) {
|
|
|
74
76
|
// Role steps stay on FindUserByRole (department-scoped). User steps emit the
|
|
75
77
|
// canonical object array — never participantType/roleId.
|
|
76
78
|
if (kind === "role")
|
|
77
|
-
return { name: name.trim(), participant: `FindUserByRole({Originator.OU},"${code}","random")` };
|
|
79
|
+
return { name: name.trim(), kind: "role", code: code, participant: `FindUserByRole({Originator.OU},"${code}","random")` };
|
|
78
80
|
const participant = JSON.stringify([{ code, corpId: "other", id: code, name: name.trim(), type: 3 }]);
|
|
79
81
|
assertParticipantShape(participant, `--steps ${name}`);
|
|
80
|
-
return { name: name.trim(), participant };
|
|
82
|
+
return { name: name.trim(), kind: "user", code: code, participant };
|
|
83
|
+
}
|
|
84
|
+
/** 解析步骤 DSL 为 {name, participant}(导出供测试)。 */
|
|
85
|
+
export function parseStep(raw) {
|
|
86
|
+
const detail = parseStepDetail(raw);
|
|
87
|
+
return { name: detail.name, participant: detail.participant };
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* F11(0.8.7 探针 B):dry-run 回执里 user 参与者的 `corpId:"other"` 是 **CLI
|
|
91
|
+
* 自己**为 `--steps 名称@user:<id>` 生成的占位(见 parseStepDetail),不是平台
|
|
92
|
+
* 要求,也不是「查不到组织」。平台解析用户时先按 `id` 找人,id 命中则 corpId
|
|
93
|
+
* 不参与(8.6.26 `ParticipleServiceImplCompanion.java:171-174`、
|
|
94
|
+
* `WorkflowTemplateValidateUtility.java:549-552`;type 3=用户见 `UnitType.java`)。
|
|
95
|
+
* 这行说明进 dry-run,避免调用方把占位当坏数据去「修」。
|
|
96
|
+
*
|
|
97
|
+
* 显示名只在**零额外 wire**可得时给:本地 token 缓存的会话账号 id 与该 user
|
|
98
|
+
* 步骤的 id 相同,才把它标成 resolvedName;否则只解释语义,不猜。
|
|
99
|
+
*/
|
|
100
|
+
function participantNotes(steps, environment) {
|
|
101
|
+
const account = sessionAccountForEnvironment(new ConfigStore(defaultPaths()), environment);
|
|
102
|
+
const notes = [];
|
|
103
|
+
for (const raw of steps) {
|
|
104
|
+
const detail = parseStepDetail(raw);
|
|
105
|
+
if (detail.kind !== "user")
|
|
106
|
+
continue;
|
|
107
|
+
const resolvedName = "id" in account && account.id === detail.code && typeof account.name === "string" && account.name.length > 0 ? account.name : undefined;
|
|
108
|
+
notes.push({
|
|
109
|
+
activity: detail.name,
|
|
110
|
+
type: 3,
|
|
111
|
+
typeName: "用户",
|
|
112
|
+
code: detail.code,
|
|
113
|
+
corpId: "other",
|
|
114
|
+
note: "corpId:\"other\" 是 CLI 为 user 参与者生成的本地占位(src/approval-flow.ts parseStepDetail),不是平台要求、也不是组织查询结果;平台先按 id 解析用户,id 命中时 corpId 不参与(8.6.26 ParticipleServiceImplCompanion.java:171-174 / WorkflowTemplateValidateUtility.java:549-552,type 3=用户)。审批人按 id 找人,apply 后接待办解析为本人。",
|
|
115
|
+
...(resolvedName !== undefined
|
|
116
|
+
? { resolvedName, resolvedNameSource: "sessionAccount(本地 token 缓存,零 wire)" }
|
|
117
|
+
: {
|
|
118
|
+
resolvedNameNote: "当前会话账号与该步骤 id 不同或本地无缓存 token,dry-run 不访问环境,无法零 wire 解析显示名(不猜);apply 后工作流读面会按 id 解析。",
|
|
119
|
+
}),
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
return notes;
|
|
81
123
|
}
|
|
82
124
|
/** 编译完整模板(recipe 验证形状)。 */
|
|
83
125
|
export function composeApprovalTemplate(options) {
|
|
@@ -129,6 +171,7 @@ export async function cmdApprovalFlow(args) {
|
|
|
129
171
|
const usage = [
|
|
130
172
|
'用法:omc approval-flow --schema <模型> --steps "节点名@role:<角色code>" [--steps ...多级] [--no-originator-node] [--no-reject-to-start] [--apply]',
|
|
131
173
|
"步骤也可用 名称@user:<用户id> 绑定具体审批人。默认 dry-run(编译模板预览);--apply 建/改流程+字段权限+发布。",
|
|
174
|
+
"user 参与者的 corpId 是 CLI 生成的本地占位(平台按 id 解析用户,id 命中时 corpId 不参与);dry-run 的 participantNotes 会逐条说明,无需手改 corpId。",
|
|
132
175
|
"⚠️ 本工具只做线性流程(START→填写→N 级审批→END),没有 --condition。",
|
|
133
176
|
"条件分支请用:omc describe workflow.update --example workflow-conditional-branch",
|
|
134
177
|
'最小条件流示例:routes 上加 ruleConditionGroup:[[{currentDataItem:"amount",bizPropertyType:2,conditionType:"GT",value:"50000"}]],兜底线加 utilizeElse:true。',
|
|
@@ -156,11 +199,13 @@ export async function cmdApprovalFlow(args) {
|
|
|
156
199
|
const linearOnlyNote = "本工具只做线性审批;条件分支用 omc describe workflow.update --example workflow-conditional-branch。" +
|
|
157
200
|
"workflow.permissions 只设谁能发起,不是行级可见范围(行级数据权限当前工具面不支持)。";
|
|
158
201
|
if (!apply) {
|
|
202
|
+
const compiledParticipantNotes = participantNotes(steps, environment);
|
|
159
203
|
writeEnvelope(envelope("ok", {
|
|
160
204
|
schemaCode: schema,
|
|
161
205
|
...compiled,
|
|
162
206
|
dryRun: true,
|
|
163
207
|
crossAccountApproval,
|
|
208
|
+
...(compiledParticipantNotes.length > 0 ? { participantNotes: compiledParticipantNotes } : {}),
|
|
164
209
|
linearOnly: true,
|
|
165
210
|
rowLevelDataPermission: "unsupported",
|
|
166
211
|
note: `dry-run 仅编译预览;--apply 执行 workflow.create(无流程时)→update(模板+字段权限)→publish。边界:非发起人身份的审批无法在单会话 CLI 内推进(单 token);若要验跨账号审批,用第二账号另建环境,或把参与人设为 {Originator}。${linearOnlyNote}`,
|
package/dist/batch-call.js
CHANGED
|
@@ -46,17 +46,34 @@ function failureDetails(entry, args) {
|
|
|
46
46
|
}
|
|
47
47
|
return { hint: "平台回了无明细 50000,常见成因见 help omc-refusals;请用该行输入与已发布字段逐项核对" };
|
|
48
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Tools whose input schema carries a business-object payload (`formData`).
|
|
51
|
+
* Verified against the registry: `runtimeFormDataArg` is declared only on
|
|
52
|
+
* data.save / data.update / data.submit. `configure_model.fields[]` is a
|
|
53
|
+
* field-definition list, not a data row, and the `code` on config tools is a
|
|
54
|
+
* business code — neither may borrow this row-shape heuristic. Anything else
|
|
55
|
+
* (reads, model/field/config writes, …) gets no guessed warnings at all.
|
|
56
|
+
*/
|
|
57
|
+
const FORM_DATA_TOOLS = new Set(["data.save", "data.update", "data.submit"]);
|
|
49
58
|
export function batchWarnings(argsList, tool) {
|
|
50
|
-
//
|
|
51
|
-
//
|
|
52
|
-
|
|
59
|
+
// Without a tool name there is no schema to justify a row shape: return
|
|
60
|
+
// nothing rather than treating arbitrary args as formData.
|
|
61
|
+
if (tool === undefined || !FORM_DATA_TOOLS.has(tool))
|
|
62
|
+
return [];
|
|
63
|
+
// data.save's warnings are produced by the runtime-data lane from published
|
|
64
|
+
// field metadata + readback, which is authoritative. Re-running the generic
|
|
65
|
+
// heuristics here would re-add the ghost `code` requirement that lane removed.
|
|
53
66
|
if (tool === "data.save")
|
|
54
67
|
return [];
|
|
55
68
|
const warnings = [];
|
|
56
69
|
const seenCodes = new Map();
|
|
57
70
|
argsList.forEach((args, index) => {
|
|
58
71
|
const row = index + 1;
|
|
59
|
-
|
|
72
|
+
// Only rows that actually carry the formData payload are data rows. A
|
|
73
|
+
// data.submit approval row has no formData and must not be checked as one.
|
|
74
|
+
if (args.formData === null || typeof args.formData !== "object" || Array.isArray(args.formData))
|
|
75
|
+
return;
|
|
76
|
+
const data = args.formData;
|
|
60
77
|
if (data.code === undefined || data.code === null || data.code === "")
|
|
61
78
|
warnings.push({ row, fieldCode: "code", code: "required", message: "必填字段 code 缺失" });
|
|
62
79
|
else if (typeof data.code === "string") {
|
package/dist/bench/scenario.js
CHANGED
|
@@ -308,7 +308,7 @@ export async function runScenario(harness) {
|
|
|
308
308
|
// nonces, so a slow or partially-orphaned cascade cannot block the next
|
|
309
309
|
// run (orphaned default data items are undeletable — 301012).
|
|
310
310
|
// Ticket 23: the order is dependency-inverted (d→p→c). Back-to-back
|
|
311
|
-
// deletes race the previous model's
|
|
311
|
+
// deletes race the previous model's async cascade (duration unbounded):
|
|
312
312
|
// live evidence shows the p/c deletes can come back refused
|
|
313
313
|
// (model-referenced-by while the relation columns still exist, or a
|
|
314
314
|
// transient wire-business envelope while the engine is busy) — wait and
|
package/dist/cli-stdout.js
CHANGED
package/dist/cli.js
CHANGED
|
@@ -73,6 +73,7 @@ import { WireError, wireCall } from "./wire.js";
|
|
|
73
73
|
import { describeWireFailure } from "./wire-failure.js";
|
|
74
74
|
import { DEFAULT_PULL_CONCURRENCY, GraphIndexAmbiguousError, GraphIndexError, GraphIndexUnreadableError, GraphPullLockHeldError, GraphPullTimeoutError, DEFAULT_GRAPH_PULL_TIMEOUT_MS, MAX_GRAPH_PULL_TIMEOUT_MS, MAX_PULL_CONCURRENCY, graphDbPath, graphRoot, impactGraph, listGraphIndexes, publishGraphPull, queryGraphReferences, queryGraphReferencesBatch, queryGraphEdges, readGraphStatus, searchGraphRules, } from "./graph.js";
|
|
75
75
|
import { cmdResidue } from "./residue.js";
|
|
76
|
+
import { reservedCodeReport } from "./reserved.js";
|
|
76
77
|
import { cmdTrack } from "./track.js";
|
|
77
78
|
import { ENDPOINTS } from "./endpoints.js";
|
|
78
79
|
import { makeToolContext } from "./context.js";
|
|
@@ -853,6 +854,24 @@ async function cmdCall(store, args) {
|
|
|
853
854
|
return emit("error", result, CLI_EXIT_CODES.invalidInput);
|
|
854
855
|
}
|
|
855
856
|
}
|
|
857
|
+
// GitLab #47:显式 --env 指向未配置环境时,恢复动作是「去掉 --env 重跑本次
|
|
858
|
+
// 调用」。在进入执行面(会话/写锁/wire)之前给出,stderr 与 stdout 同一份
|
|
859
|
+
// 文案,不必让 agent 再撞一次。只处理 unknown environment;跨环境拒绝/凭据
|
|
860
|
+
// 缺失的恢复动作不同,继续走原有分类。
|
|
861
|
+
if (environment !== undefined && tool !== undefined) {
|
|
862
|
+
try {
|
|
863
|
+
if (!store.readConfig().environments[environment])
|
|
864
|
+
store.resolveEnvironment(environment);
|
|
865
|
+
}
|
|
866
|
+
catch (error) {
|
|
867
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
868
|
+
if (/^unknown environment "/u.test(message)) {
|
|
869
|
+
const result = withUnknownEnvironmentRecovery({ status: "error", message }, { tool: toolName, ...(rawArgs !== undefined ? { rawArgs } : {}), ...(argsFile !== undefined ? { argsFile } : {}), parsedArgs });
|
|
870
|
+
humanSummary(JSON.stringify(result));
|
|
871
|
+
return emit("error", result, CLI_EXIT_CODES.authConfig);
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
}
|
|
856
875
|
const toolKind = tool?.kind;
|
|
857
876
|
// F2':只对写面(含 dry-run 预览)标记;读面人话不追加 2>&1 提示。
|
|
858
877
|
if (toolKind === "write")
|
|
@@ -912,6 +931,9 @@ async function cmdCall(store, args) {
|
|
|
912
931
|
await lock.release();
|
|
913
932
|
}
|
|
914
933
|
}
|
|
934
|
+
// GitLab #47:unknown --env 的恢复动作 = 去掉 --env 重跑同一调用。文案由
|
|
935
|
+
// config-store 给出绑定事实,这里补上只有 call 层才知道的 tool + 本次参数。
|
|
936
|
+
result = withUnknownEnvironmentRecovery(result, { tool: toolName, ...(rawArgs !== undefined ? { rawArgs } : {}), ...(argsFile !== undefined ? { argsFile } : {}), parsedArgs });
|
|
915
937
|
let unwrappedBody;
|
|
916
938
|
let resultMeta;
|
|
917
939
|
// C7(0.8.4):结果容器键自描述——`items`/`models`/`rules`/`logs`/`fields` 各面
|
|
@@ -1174,6 +1196,59 @@ function resolvedDefaultEnvironment(store) {
|
|
|
1174
1196
|
return "default";
|
|
1175
1197
|
}
|
|
1176
1198
|
}
|
|
1199
|
+
/**
|
|
1200
|
+
* GitLab #47:`unknown environment "test"` 的恢复动作在 99% 情况下是「去掉
|
|
1201
|
+
* --env 重跑同一条调用」(项目 .omc-env 已是正确绑定)。config-store 的文案
|
|
1202
|
+
* 说明了这条规则,但只有 call 这一层知道 tool 与本次参数,所以在这里补一条
|
|
1203
|
+
* **真正可复制**的 nextCommand。
|
|
1204
|
+
*
|
|
1205
|
+
* 只对 `unknown environment "…"` 这一类生效:跨环境访问被拒、凭据缺失、平台
|
|
1206
|
+
* 错误的恢复动作各不相同,不能套用「去掉 --env」。参数过大/来自 stdin/文件时
|
|
1207
|
+
* 退回不内联参数的命令,绝不截断或编造载荷。
|
|
1208
|
+
*/
|
|
1209
|
+
function withoutEnvironmentCommand(input) {
|
|
1210
|
+
const inlineRaw = input.rawArgs !== undefined && input.rawArgs.trim().startsWith("{") ? input.rawArgs : undefined;
|
|
1211
|
+
// `parseToolInput` folds `--env` into args.environment; keeping it in the retry
|
|
1212
|
+
// would reproduce the very failure it is meant to recover from. Strip it from
|
|
1213
|
+
// the caller's JSON too (a tool-arg `environment` fails the same way).
|
|
1214
|
+
let inline = inlineRaw;
|
|
1215
|
+
if (inlineRaw !== undefined) {
|
|
1216
|
+
try {
|
|
1217
|
+
const parsed = JSON.parse(inlineRaw);
|
|
1218
|
+
if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed) && "environment" in parsed) {
|
|
1219
|
+
delete parsed.environment;
|
|
1220
|
+
inline = Object.keys(parsed).length > 0 ? JSON.stringify(parsed) : undefined;
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
catch {
|
|
1224
|
+
// Not valid JSON: the call already failed input validation before this path.
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
const remaining = { ...input.parsedArgs };
|
|
1228
|
+
delete remaining.environment;
|
|
1229
|
+
const serialized = inline ?? (Object.keys(remaining).length > 0 ? JSON.stringify(remaining) : undefined);
|
|
1230
|
+
if (serialized === undefined || serialized === "{}")
|
|
1231
|
+
return `omc call ${input.tool}`;
|
|
1232
|
+
if (serialized.length <= 500)
|
|
1233
|
+
return `omc call ${input.tool} --args '${serialized.replace(/'/g, "'\\''")}'`;
|
|
1234
|
+
if (input.argsFile !== undefined)
|
|
1235
|
+
return `omc call ${input.tool} --args-file ${input.argsFile}`;
|
|
1236
|
+
if (input.rawArgs === "-")
|
|
1237
|
+
return `omc call ${input.tool} --args -`;
|
|
1238
|
+
return `omc call ${input.tool}`;
|
|
1239
|
+
}
|
|
1240
|
+
function withUnknownEnvironmentRecovery(result, input) {
|
|
1241
|
+
if (result.status !== "error" || typeof result.message !== "string")
|
|
1242
|
+
return result;
|
|
1243
|
+
if (!/^unknown environment "/u.test(result.message))
|
|
1244
|
+
return result;
|
|
1245
|
+
const nextCommand = withoutEnvironmentCommand(input);
|
|
1246
|
+
return {
|
|
1247
|
+
...result,
|
|
1248
|
+
nextCommand,
|
|
1249
|
+
message: result.message.includes("直接重试:") ? result.message : `${result.message};直接重试:${nextCommand}`,
|
|
1250
|
+
};
|
|
1251
|
+
}
|
|
1177
1252
|
/**
|
|
1178
1253
|
* Above this size `omc artifact get` returns the outline, not the body. The
|
|
1179
1254
|
* transport cap (64 KB) is far too generous for a working context: one 27 KB
|
|
@@ -2575,7 +2650,7 @@ function cmdGraphReferences(kind, code, transport, selector = {}) {
|
|
|
2575
2650
|
const results = kinds.map((one) => queryGraphReferences(one, code, selector));
|
|
2576
2651
|
const result = results[0];
|
|
2577
2652
|
if (kind === undefined)
|
|
2578
|
-
return emitResult({ status: "ok", code, index: result.index, references: Object.fromEntries(results.map((item) => [item.kind, { matches: item.matches, ...(item.coverage !== undefined ? { coverage: item.coverage } : {}), ...(item.note !== undefined ? { note: item.note } : {}) }])) }, transport);
|
|
2653
|
+
return emitResult({ status: "ok", code, index: result.index, references: Object.fromEntries(results.map((item) => [item.kind, { matches: item.matches, ...(item.coverage !== undefined ? { coverage: item.coverage } : {}), ...(item.note !== undefined ? { note: item.note } : {}), ...(item.granularityUnsupported !== undefined ? { granularityUnsupported: item.granularityUnsupported } : {}) }])) }, transport);
|
|
2579
2654
|
return emitResult({
|
|
2580
2655
|
status: "ok",
|
|
2581
2656
|
kind: result.kind,
|
|
@@ -2590,6 +2665,8 @@ function cmdGraphReferences(kind, code, transport, selector = {}) {
|
|
|
2590
2665
|
...(result.scopeNote !== undefined ? { scopeNote: result.scopeNote } : {}),
|
|
2591
2666
|
...(result.coverage !== undefined ? { coverage: result.coverage } : {}),
|
|
2592
2667
|
...(result.note !== undefined ? { note: result.note } : {}),
|
|
2668
|
+
// issue 07(CLI 面):粒度边界与 MCP 同源——白名单重建漏带就等于没修。
|
|
2669
|
+
...(result.granularityUnsupported !== undefined ? { granularityUnsupported: result.granularityUnsupported } : {}),
|
|
2593
2670
|
...(result.gapWarning !== undefined ? { gapWarning: result.gapWarning } : {}),
|
|
2594
2671
|
}, transport);
|
|
2595
2672
|
}
|
|
@@ -3488,7 +3565,7 @@ async function main() {
|
|
|
3488
3565
|
commandExitCode = CLI_EXIT_CODES.ok;
|
|
3489
3566
|
});
|
|
3490
3567
|
command.command("doctor").option("--environment <environment>").option("--env <environment>").option("--service <serviceCode>", "可选:体检单个业务集成服务的鉴权参数形状(掩码/占位/全 0 检出,WARN 非致命)").option("--fresh-login", "忽略 token 缓存,做一次完整登录握手(默认复用缓存,登录请求 0 次;回执 loginSource 标明来源)").addOption(new Option("--jq [path]", "--jq 不是 jq,仅路径选择器(与 call --jq 同 DSL;可逗号多路径;裸 --jq 列顶层键),相对回执 result(checks/anchor/unsupportedCapabilities)").argParser((value, previous = []) => [...previous, value]).default([])).option("--explain", "--jq 未命中时给出完整排查载荷(available/correctPath/成因 hint);默认 miss 只回 missedAt/didYouMean/helpRef").action(async (options) => { commandExitCode = await cmdDoctor(new ConfigStore(defaultPaths()), options.environment ?? options.env, options.service, options.freshLogin === true, Array.isArray(options.jq) ? options.jq : [], options.explain === true); });
|
|
3491
|
-
command.command("call <tool>").option("--env <environment>", "环境名;项目白名单按当前 cwd 解析,须在含 .omc-env 的目录内运行").option("--environment <environment>").option("--args <json>").option("--args-file <path>", "从文件读参数 JSON。**必须位于配置根内**(数组批量请改用 --args-list;跨目录/系统临时文件会被拒);免落盘用 `--args -`(stdin)").option("--args-list <json-array>", '同一工具跑 N 次(JSON 数组,每条一个 args 对象,最多 200 条);超过上限请分批,或用 omc script 读文件。逐条执行、默认不中断,最后回 succeeded/failed
|
|
3568
|
+
command.command("call <tool>").option("--env <environment>", "环境名;项目白名单按当前 cwd 解析,须在含 .omc-env 的目录内运行").option("--environment <environment>").option("--args <json>").option("--args-file <path>", "从文件读参数 JSON。**必须位于配置根内**(数组批量请改用 --args-list;跨目录/系统临时文件会被拒);免落盘用 `--args -`(stdin)").option("--args-list <json-array>", '同一工具跑 N 次(JSON 数组,每条一个 args 对象,最多 200 条);超过上限请分批,或用 omc script 读文件。逐条执行、默认不中断,最后回 succeeded/failed 汇总。**只回汇总(succeeded/failed + 每行 ok),不内联各条 result**;读批量请用 `omc script -`(逐行带 result)或工具的 schemaCodes/ruleCodes 批参数。适合批量建字段等').option("--preflight", "与 --args-list 一起用:只跑参数校验 + 写前语义闸(零 wire、零写入),一次报全所有形状问题").option("--keys", "与 artifact get 的 --keys 同义(= --extract-keys):列出本次结果 artifact 的顶层键与体积").addOption(new Option("--extract <path>", "在本次结果的 artifact 内取一个路径的值(可重复;省掉一次 artifact get)").argParser((value, previous = []) => [...previous, value]).default([])).addOption(new Option("--jq [path]", "路径选择器(非 jq)——不是 jq 表达式,不支持管道;[] 映射如 items[].fields.planNo;裸 --jq 列顶层键。单路径命中时 result 直接是节点本体。示例:omc call model.list --env e --jq models · omc call rule.list --env e --args '{\"schemaCode\":\"m\"}' --jq rules[].code · omc call workflow.get_published --env e --args '{\"code\":\"f\"}' --jq activities[].bizActions").argParser((value, previous = []) => [...previous, value]).default([])).option("--extract-keys", "列出本次结果 artifact 的顶层键与体积(省掉一次 artifact get --keys)").option("--max-output-bytes <bytes>", "最终 stdout 信封预算;默认 65536(投影/--jq 之后再判);读面 diet(~2048) 独立外置 detailArtifactId,抬高本参数不会把已 diet 的大表重新内联;artifact get 内联上限 8192").option("--request-id <requestId>").option("--reason <text>", "写入原因(审计面,仅写操作):记入本次写 journal 行的 reason;不是工具参数(写 schema 拒未知键),也不参与任何门禁").option("--timeout-ms <milliseconds>").option("--wait <milliseconds>", "仅 `omc call` / `omc intent apply` 支持;写锁冲突时有界排队(0=立刻拒绝)").option("--dry-run").option("--explain", "--jq 未命中时给出完整排查载荷(available 该层全部键、correctPath、nextCommand、成因 hint);默认 miss 只回 missedAt/didYouMean/helpRef(≤300B)").addHelpText("after", `\n${onboardingHelp()}\n`).action(async (tool, options) => {
|
|
3492
3569
|
const rest = [tool, ...(options.env ? ["--env", options.env] : []), ...(options.environment ? ["--environment", options.environment] : []), ...(options.args !== undefined ? ["--args", options.args] : []), ...(options.argsFile !== undefined ? ["--args-file", options.argsFile] : []), ...(options.argsList !== undefined ? ["--args-list", options.argsList] : []), ...(options.preflight ? ["--preflight"] : []), ...(Array.isArray(options.extract) ? options.extract.flatMap((path) => ["--extract", path]) : []), ...(options.jq === true ? ["--jq"] : Array.isArray(options.jq) ? options.jq.flatMap((path) => path === true ? ["--jq"] : ["--jq", path]) : []), ...(options.extractKeys ? ["--extract-keys"] : []),
|
|
3493
3570
|
...(options.keys ? ["--keys"] : []), ...(options.maxOutputBytes !== undefined ? ["--max-output-bytes", options.maxOutputBytes] : []), ...(options.requestId ? ["--request-id", options.requestId] : []), ...(options.reason !== undefined ? ["--reason", options.reason] : []), ...(options.timeoutMs !== undefined ? ["--timeout-ms", options.timeoutMs] : []), ...(options.wait !== undefined ? ["--wait", options.wait] : []), ...(options.dryRun ? ["--dry-run"] : []), ...(options.explain ? ["--explain"] : [])];
|
|
3494
3571
|
commandExitCode = await cmdCall(new ConfigStore(defaultPaths()), rest);
|
|
@@ -3529,7 +3606,7 @@ async function main() {
|
|
|
3529
3606
|
const rest = ["rule-when", ...(options.schema ? ["--schema", options.schema] : []), ...(options.schemaCode ? ["--schema-code", options.schemaCode] : []), ...(options.on ? ["--on", options.on] : []), ...(Array.isArray(options.when) ? options.when.flatMap((w) => ["--when", w]) : []), ...(Array.isArray(options.then) ? options.then.flatMap((a) => ["--then", a]) : []), ...(options.name ? ["--name", options.name] : []), ...(options.env ? ["--env", options.env] : []), ...(options.environment ? ["--environment", options.environment] : []), ...(options.apply ? ["--apply"] : [])];
|
|
3530
3607
|
commandExitCode = await cmdRuleWhen(rest);
|
|
3531
3608
|
});
|
|
3532
|
-
command.command("approval-flow").option("--schema <schemaCode>").option("--schema-code <schemaCode>").addOption(new Option("--steps <step>", "
|
|
3609
|
+
command.command("approval-flow").option("--schema <schemaCode>").option("--schema-code <schemaCode>").addOption(new Option("--steps <step>", "审批步骤,可重复;`节点名@role:<角色code>` 或 `节点名@user:<userId>`(user 参与者的 corpId 是 CLI 本地占位,平台按 id 解析用户,无需手改)").argParser(collectValues).default([])).option("--env <environment>").option("--environment <environment>").option("--apply").option("--no-originator-node").option("--no-reject-to-start").addHelpText("after", "\n审批流拼装器:--steps 名称@role:<角色code> 或 节点名@user:<userId>(多级给多个)。编译为验证模板(START→填写→审批链→END,审批节点字段只读),--apply 建流+权限+发布。\n`@user:` 适合单账号/角色无成员环境;参与者对象的 corpId 由 CLI 写成本地占位 \"other\",平台先按 id 解析用户、id 命中时 corpId 不参与(8.6.26 ParticipleServiceImplCompanion.java:171-174),dry-run 的 participantNotes 会逐条说明,无需替换。role 参与者按 OU 解析,先 `org.role.users` 复核。\n边界:非发起人身份的审批无法在单会话 CLI 内推进(单 token);若要验跨账号审批,用第二账号另建环境,或把参与人设为 {Originator}。\n").action(async (options) => {
|
|
3533
3610
|
const rest = ["approval-flow", ...(options.schema ? ["--schema", options.schema] : []), ...(options.schemaCode ? ["--schema-code", options.schemaCode] : []), ...(Array.isArray(options.steps) ? options.steps.flatMap((s) => ["--steps", s]) : []), ...(options.env ? ["--env", options.env] : []), ...(options.environment ? ["--environment", options.environment] : []), ...(options.apply ? ["--apply"] : []), ...(options.originatorNode === false ? ["--no-originator-node"] : []), ...(options.rejectToStart === false ? ["--no-reject-to-start"] : [])];
|
|
3534
3611
|
commandExitCode = await cmdApprovalFlow(rest);
|
|
3535
3612
|
});
|
|
@@ -3851,6 +3928,10 @@ async function main() {
|
|
|
3851
3928
|
// 2026-11-05 用户实测:`commands --json` 存在,于是大家自然写 `capabilities --json`
|
|
3852
3929
|
// ——旧实现报 `unknown option`(退出码 10)。输出本来就是 JSON 信封,接受它做兼容别名。
|
|
3853
3930
|
command.command("capabilities").option("--compact").option("--full", "完整投影(id/标题/别名/工具/依赖)——默认只是能力索引").option("--json", "兼容别名:输出本就是 JSON 信封(与 commands --json 对齐)").option("--max-output-bytes <bytes>").addOption(jqOption()).addOption(explainOption()).action(async (options) => { commandExitCode = await withTransport(options, request, (transport) => cmdCapabilities(transport, { compact: options.compact === true, full: options.full === true }, options.jq, options.explain === true)); });
|
|
3931
|
+
// F1(0.8.7 探针 B):保留字清单不可发现——报错只给 code_reserved 分类,help 只有
|
|
3932
|
+
// SQL 关键字。本命令是 src/code-rules.ts 同一张表的只读投影(零环境接触),
|
|
3933
|
+
// 不新增第二套校验逻辑,也不声称是平台全量清单。
|
|
3934
|
+
command.command("reserved").description("本地 code 保留字清单(系统默认属性/扩展默认属性/平台内部/子表专用 + SQL 关键字);建模型或字段前查,平台 301014/10033 仍是最终门").option("--json", "兼容别名:输出本就是 JSON 信封").option("--max-output-bytes <bytes>").addHelpText("after", "\n清单来自本地 dry-lint 同一张表(src/code-rules.ts),与 field.create / model.create / configure_model 的 code_reserved 判定同源;不是平台全量保留字清单——平台最终门仍是属性冲突 301014、SQL 关键字 10033。\n").action(async (options) => { commandExitCode = await withTransport(options, request, (transport) => emitTransportResult(reservedCodeReport(), transport)); });
|
|
3854
3935
|
// `--env` is accepted but ignored: `next` is a zero-environment-contact route
|
|
3855
3936
|
// solver, and a caller who reflexively passes `--env` should not be refused
|
|
3856
3937
|
// (round 15 dogfood: `next "<goal>" --env local` → unknown option, one round).
|
package/dist/code-rules.js
CHANGED
|
@@ -13,11 +13,25 @@ const CODE_PATTERNS = {
|
|
|
13
13
|
lower_snake: /^[a-z][a-z0-9]*(?:_[a-z0-9]+)*$/u,
|
|
14
14
|
};
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
17
|
-
* never claim (they are minted by the platform; reusing one
|
|
18
|
-
* engine's own columns). Mirrors base3.0's reserved sets.
|
|
16
|
+
* Group 1 — main-table system / audit column codes a business-authored model
|
|
17
|
+
* or field must never claim (they are minted by the platform; reusing one
|
|
18
|
+
* collides with the engine's own columns). Mirrors base3.0's reserved sets.
|
|
19
|
+
*
|
|
20
|
+
* Backend enum `DefaultPropertyType` (the same 14 codes in both builds):
|
|
21
|
+
* - 8.6.26: cp-sources/backend/decompiled-full/launcher-8.6.26/cloudpivot-shared-8.6.26/
|
|
22
|
+
* com/authine/cloudpivot/metadata/bizmodel/DefaultPropertyType.java:16-29
|
|
23
|
+
* - 2.1.5 : .../launcher-2.1.5/cloudpivot-contracts-AI-Platform-v2.1.5/
|
|
24
|
+
* com/authine/cloudpivot/metadata/bizmodel/DefaultPropertyType.java:16-29
|
|
25
|
+
* Checked by `BizPropertyManagerImpl.validateNotEqualDefaultPropertyCode`
|
|
26
|
+
* (8.6.26 :1017-1020; 2.1.5 :1048-1051), i.e. on every property created or
|
|
27
|
+
* renamed through the property manager (child columns included).
|
|
19
28
|
*/
|
|
20
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Display-order copy of the same table. The Set below is derived from it, so
|
|
31
|
+
* `omc reserved` and the write gate cannot drift: every listed code is rejected
|
|
32
|
+
* by `validateBusinessCode` and every Set member appears in the listing.
|
|
33
|
+
*/
|
|
34
|
+
export const SYSTEM_RESERVED_CODES = Object.freeze([
|
|
21
35
|
"id",
|
|
22
36
|
"name",
|
|
23
37
|
"creater",
|
|
@@ -32,24 +46,111 @@ export const RESERVED_CODES = new Set([
|
|
|
32
46
|
"sequenceStatus",
|
|
33
47
|
"ownerDeptQueryCode",
|
|
34
48
|
"version",
|
|
35
|
-
]
|
|
49
|
+
]);
|
|
50
|
+
export const RESERVED_CODES = new Set(SYSTEM_RESERVED_CODES.map((code) => code.toLowerCase()));
|
|
51
|
+
/**
|
|
52
|
+
* Group 2a — platform EXTENDED property codes (`DefaultPropertyExtendType`).
|
|
53
|
+
* Not plain audit columns: they are the display-name companions the engine
|
|
54
|
+
* maintains next to `creater`/`owner`/`modifier`, so a business field claiming
|
|
55
|
+
* one collides with platform-managed data. Same five codes in both builds:
|
|
56
|
+
* - 8.6.26: .../launcher-8.6.26/cloudpivot-shared-8.6.26/
|
|
57
|
+
* com/authine/cloudpivot/metadata/bizmodel/DefaultPropertyExtendType.java:9-13
|
|
58
|
+
* - 2.1.5 : .../launcher-2.1.5/cloudpivot-contracts-AI-Platform-v2.1.5/
|
|
59
|
+
* com/authine/cloudpivot/metadata/bizmodel/DefaultPropertyExtendType.java:9-13
|
|
60
|
+
* Checked (equalsIgnoreCase) by validateNotEqualDefaultPropertyCode
|
|
61
|
+
* (8.6.26 :1021-1024; 2.1.5 :1052-1055) — 301014 on the platform.
|
|
62
|
+
*/
|
|
63
|
+
export const EXTENDED_RESERVED_CODES = Object.freeze([
|
|
64
|
+
"createdName",
|
|
65
|
+
"createdDeptName",
|
|
66
|
+
"ownerName",
|
|
67
|
+
"ownerDeptName",
|
|
68
|
+
"modifiedName",
|
|
69
|
+
]);
|
|
70
|
+
export const RESERVED_EXTEND_CODES = new Set(EXTENDED_RESERVED_CODES.map((code) => code.toLowerCase()));
|
|
71
|
+
/**
|
|
72
|
+
* Group 2b — engine-internal reserved words (`INTERNAL_RESERVED_WORDS_LOWERCASE`).
|
|
73
|
+
* Not enum members: a literal lowercase set hit with `code.toLowerCase()`.
|
|
74
|
+
* - 8.6.26: .../launcher-8.6.26/cloudpivot-metadata-8.6.26/
|
|
75
|
+
* com/authine/cloudpivot/metadata/BizPropertyManagerImpl.java:129 (set),
|
|
76
|
+
* checked at :1025-1027
|
|
77
|
+
* - 2.1.5 : .../launcher-2.1.5/cloudpivot-metadata-AI-Platform-v2.1.5/
|
|
78
|
+
* com/authine/cloudpivot/metadata/BizPropertyManagerImpl.java:109 (set),
|
|
79
|
+
* checked at :1056-1058
|
|
80
|
+
*/
|
|
81
|
+
export const INTERNAL_RESERVED_CODES = Object.freeze([
|
|
82
|
+
"parentworkflowinstanceid",
|
|
83
|
+
"sheetbizobjectid",
|
|
84
|
+
]);
|
|
85
|
+
export const RESERVED_INTERNAL_CODES = new Set(INTERNAL_RESERVED_CODES);
|
|
86
|
+
/**
|
|
87
|
+
* Group 3 — SUB-TABLE-only reserved columns (`DefaultSubPropertyType`). The
|
|
88
|
+
* platform checks this enum ONLY when `getBizSchema().isSubSchema()` is true
|
|
89
|
+
* (8.6.26 BizPropertyManagerImpl.java:1028-1033; 2.1.5 :1059-1063), so a
|
|
90
|
+
* main-table field may legitimately be called `parentId`/`sortKey`.
|
|
91
|
+
*
|
|
92
|
+
* Child columns ride `BizPropertyFacadeImpl.save` → `subSchema.addProperty`
|
|
93
|
+
* (8.6.26 history/bizmodel/BizPropertyFacadeImpl.java:86-89; 2.1.5 :75-78), so
|
|
94
|
+
* they get group 1+2 as well; the sub-only increment is `parentId` + `sortKey`
|
|
95
|
+
* (the enum's `id/modifier/modifiedTime/version` are already in group 1).
|
|
96
|
+
*
|
|
97
|
+
* Enum: 8.6.26 .../cloudpivot-shared-8.6.26/.../DefaultSubPropertyType.java:12-17;
|
|
98
|
+
* 2.1.5 .../cloudpivot-contracts-AI-Platform-v2.1.5/.../DefaultSubPropertyType.java:12-17.
|
|
99
|
+
*/
|
|
100
|
+
export const SUBTABLE_RESERVED_CODES = Object.freeze([
|
|
101
|
+
"id",
|
|
102
|
+
"parentId",
|
|
103
|
+
"sortKey",
|
|
104
|
+
"modifier",
|
|
105
|
+
"modifiedTime",
|
|
106
|
+
"version",
|
|
107
|
+
]);
|
|
108
|
+
export const RESERVED_SUBTABLE_CODES = new Set(SUBTABLE_RESERVED_CODES.map((code) => code.toLowerCase()));
|
|
36
109
|
/**
|
|
37
110
|
* SQL 关键字(MySQL 未加引号时的保留字)。平台在 wire 才拒绝(10033
|
|
38
111
|
* 编码[order]为SQL关键字),这里前置到与 code 格式同层,省一轮建了再改。
|
|
39
112
|
*/
|
|
40
|
-
export const
|
|
113
|
+
export const SQL_KEYWORDS = Object.freeze([
|
|
41
114
|
"order", "group", "key", "index", "desc", "asc", "select", "from", "where", "join",
|
|
42
115
|
"union", "all", "and", "or", "not", "null", "true", "false", "case", "when", "then",
|
|
43
116
|
"else", "end", "default", "primary", "foreign", "references", "constraint", "create",
|
|
44
117
|
"drop", "alter", "insert", "delete", "update", "into", "values", "table", "column",
|
|
45
118
|
"check", "distinct", "having", "limit", "offset", "by", "left", "right", "inner", "outer",
|
|
46
119
|
]);
|
|
120
|
+
export const SQL_KEYWORD_CODES = new Set(SQL_KEYWORDS);
|
|
121
|
+
/**
|
|
122
|
+
* The single projection of the table above for the read-only `omc reserved`
|
|
123
|
+
* face. Derived (not copied) so it cannot drift from the gate. This is a LOCAL
|
|
124
|
+
* dry-lint list, not a claim about the platform's complete reserved set: the
|
|
125
|
+
* platform remains the final gate (301014 for property codes, 10033 for SQL
|
|
126
|
+
* keywords).
|
|
127
|
+
*/
|
|
128
|
+
export const RESERVED_CODE_GROUPS = Object.freeze([
|
|
129
|
+
Object.freeze({ id: "system", title: "系统默认属性", appliesTo: "模型 code 与字段 code", codes: SYSTEM_RESERVED_CODES, note: "DefaultPropertyType;平台自建且业务不得占用" }),
|
|
130
|
+
Object.freeze({ id: "extended", title: "扩展默认属性", appliesTo: "字段 code", codes: EXTENDED_RESERVED_CODES, note: "DefaultPropertyExtendType;引擎维护的显示名伴生列" }),
|
|
131
|
+
Object.freeze({ id: "internal", title: "平台内部保留", appliesTo: "字段 code", codes: INTERNAL_RESERVED_CODES, note: "INTERNAL_RESERVED_WORDS_LOWERCASE" }),
|
|
132
|
+
Object.freeze({ id: "subtable", title: "子表专用", appliesTo: "子表列 code(主表字段不受此组限制)", codes: SUBTABLE_RESERVED_CODES, note: "DefaultSubPropertyType;仅 isSubSchema() 时校验" }),
|
|
133
|
+
Object.freeze({ id: "sql", title: "SQL 关键字", appliesTo: "模型 code 与字段 code", codes: SQL_KEYWORDS, note: "落库时回 10033;不是平台属性保留字,但同样不可用" }),
|
|
134
|
+
]);
|
|
47
135
|
/** Infer the style a code is written in (underscores → snake, else camel). */
|
|
48
136
|
export function inferCodeStyle(code) {
|
|
49
137
|
if (code.includes("_"))
|
|
50
138
|
return CODE_PATTERNS.lower_snake.test(code) ? "lower_snake" : null;
|
|
51
139
|
return CODE_PATTERNS.lowerCamel.test(code) ? "lowerCamel" : null;
|
|
52
140
|
}
|
|
141
|
+
/** True when the code is reserved for the given kind/scope (mirrors the backend checks). */
|
|
142
|
+
function reservedClassification(lowerCode, options) {
|
|
143
|
+
if (RESERVED_CODES.has(lowerCode))
|
|
144
|
+
return "main";
|
|
145
|
+
// Group 1 also covers model codes (existing local behaviour). Groups 2/3 are
|
|
146
|
+
// property-code checks on the platform (`validateAddProperty`), so they apply
|
|
147
|
+
// to fields only — a model named `ownerName` is not a platform collision.
|
|
148
|
+
if (options.kind === "field" && (RESERVED_EXTEND_CODES.has(lowerCode) || RESERVED_INTERNAL_CODES.has(lowerCode)))
|
|
149
|
+
return "extended";
|
|
150
|
+
if (options.kind === "field" && options.subTable === true && RESERVED_SUBTABLE_CODES.has(lowerCode))
|
|
151
|
+
return "subtable";
|
|
152
|
+
return null;
|
|
153
|
+
}
|
|
53
154
|
/** Returns the (normalized) violations; an empty array means the code is valid. */
|
|
54
155
|
export function validateBusinessCode(rawCode, options) {
|
|
55
156
|
const maxLength = options.kind === "model" ? MODEL_CODE_MAX_LENGTH : FIELD_CODE_MAX_LENGTH;
|
|
@@ -69,8 +170,21 @@ export function validateBusinessCode(rawCode, options) {
|
|
|
69
170
|
else if (!detected) {
|
|
70
171
|
violations.push({ code, classification: "code_style", message: `code "${code}" 既不是 lowerCamel 也不是 lower_snake(须以字母开头,仅含字母/数字/下划线,且不得连续或结尾下划线)` });
|
|
71
172
|
}
|
|
72
|
-
|
|
73
|
-
|
|
173
|
+
const reserved = reservedClassification(code.toLowerCase(), options);
|
|
174
|
+
if (reserved === "main")
|
|
175
|
+
violations.push({ code, classification: "code_reserved", message: `code "${code}" 是平台系统/保留字段编码,业务模型与字段不得使用(会与平台自身列冲突);完整清单见 omc reserved` });
|
|
176
|
+
else if (reserved === "extended")
|
|
177
|
+
violations.push({
|
|
178
|
+
code,
|
|
179
|
+
classification: "code_reserved",
|
|
180
|
+
message: `code "${code}" 是平台扩展/内部保留字段编码(DefaultPropertyExtendType / INTERNAL_RESERVED_WORDS_LOWERCASE,如 ownerName、createdName、parentworkflowinstanceid、sheetbizobjectid),平台会报 301014;平台自动维护该列,业务字段不得占用;完整清单见 omc reserved`,
|
|
181
|
+
});
|
|
182
|
+
else if (reserved === "subtable")
|
|
183
|
+
violations.push({
|
|
184
|
+
code,
|
|
185
|
+
classification: "code_reserved",
|
|
186
|
+
message: `code "${code}" 是子表(CHILD_TABLE)平台保留列(DefaultSubPropertyType,如 parentId、sortKey),子表列不得使用(平台报 301014);主表字段不受此组限制;完整清单见 omc reserved`,
|
|
187
|
+
});
|
|
74
188
|
if (SQL_KEYWORD_CODES.has(code.toLowerCase()))
|
|
75
189
|
violations.push({
|
|
76
190
|
code,
|
|
@@ -83,4 +197,26 @@ export function validateBusinessCode(rawCode, options) {
|
|
|
83
197
|
export function businessCodeValid(rawCode, options) {
|
|
84
198
|
return validateBusinessCode(rawCode, options).length === 0;
|
|
85
199
|
}
|
|
200
|
+
/**
|
|
201
|
+
* Validate a field entry's code AND (when it is a CHILD_TABLE) its sub-column
|
|
202
|
+
* codes. Child columns are ordinary properties on the sub-schema, so the
|
|
203
|
+
* platform runs the same `validateNotEqualDefaultPropertyCode` over them
|
|
204
|
+
* (BizPropertyFacadeImpl.save → subSchema.addProperty); only the sub-table-only
|
|
205
|
+
* group is extra. Missing/non-string codes are left to the shape gates.
|
|
206
|
+
*/
|
|
207
|
+
export function validateFieldEntryCodes(entry) {
|
|
208
|
+
const violations = [];
|
|
209
|
+
if (typeof entry.code === "string")
|
|
210
|
+
violations.push(...validateBusinessCode(entry.code, { kind: "field" }));
|
|
211
|
+
if (Array.isArray(entry.subFields)) {
|
|
212
|
+
for (const sub of entry.subFields) {
|
|
213
|
+
if (!sub || typeof sub !== "object")
|
|
214
|
+
continue;
|
|
215
|
+
const subCode = sub.code;
|
|
216
|
+
if (typeof subCode === "string")
|
|
217
|
+
violations.push(...validateBusinessCode(subCode, { kind: "field", subTable: true }));
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
return violations;
|
|
221
|
+
}
|
|
86
222
|
//# sourceMappingURL=code-rules.js.map
|
package/dist/config-store.js
CHANGED
|
@@ -327,11 +327,25 @@ export class ConfigStore {
|
|
|
327
327
|
this.assertProjectScope(resolved.name, resolved.source);
|
|
328
328
|
return resolved;
|
|
329
329
|
}
|
|
330
|
+
/**
|
|
331
|
+
* GitLab #47:agent 把自然语言标签(「测试环境」)拼成 `--env test`,失败后
|
|
332
|
+
* 只能靠撞一次才知道「省略 --env = 项目绑定环境」。文案里必须直接给出这件事,
|
|
333
|
+
* 且只陈述事实(绑定名可读就读、读不到就说未绑定)——**不做名字猜测**:猜错
|
|
334
|
+
* 比一次失败更危险(会写到别的环境)。
|
|
335
|
+
*/
|
|
336
|
+
unknownEnvironmentAdvice() {
|
|
337
|
+
const bound = this.readProjectEnvBinding();
|
|
338
|
+
if (bound === undefined)
|
|
339
|
+
return "本项目未绑定 .omc-env(省略 --env 不会选中特定环境);先 omc env list 查看可用环境,再显式传 --env <name> 或运行 omc setup 绑定";
|
|
340
|
+
if (!this.readConfig().environments[bound])
|
|
341
|
+
return `本项目 .omc-env 绑定的 "${bound}" 未在 omc.config.json 配置(省略 --env 同样不可用);先运行 omc setup 或改 .omc-env`;
|
|
342
|
+
return `本项目绑定环境:${bound}(.omc-env);省略 --env 即用它`;
|
|
343
|
+
}
|
|
330
344
|
resolveCandidate(explicit) {
|
|
331
345
|
if (explicit && explicit.trim()) {
|
|
332
346
|
const profile = this.readConfig().environments[explicit];
|
|
333
347
|
if (!profile)
|
|
334
|
-
throw new ConfigurationError(`unknown environment "${explicit}"; available: ${this.availableEnvironmentNames()}(仅本项目;doctor prints the bound 环境=; do not guess or read ~/.config/omc manually)`);
|
|
348
|
+
throw new ConfigurationError(`unknown environment "${explicit}"; available: ${this.availableEnvironmentNames()}(仅本项目;doctor prints the bound 环境=; do not guess or read ~/.config/omc manually);${this.unknownEnvironmentAdvice()}`);
|
|
335
349
|
return { name: explicit, profile, source: "explicit" };
|
|
336
350
|
}
|
|
337
351
|
if (process.env.OMC_ENV) {
|
package/dist/coverage.js
CHANGED
|
@@ -127,7 +127,8 @@ export function versionFamilyNotice(manifest, detectedVersion) {
|
|
|
127
127
|
return undefined;
|
|
128
128
|
return (`兼容模式:检测到 CloudPivot ${detectedVersion},不在 OMC 锚定的 ${manifest.version_family} 族` +
|
|
129
129
|
`(锚点 ${manifest.anchor_version})。OMC 基于 8.6 构建,非 8.6 环境按兼容支持,部分能力面可能不适用。` +
|
|
130
|
-
`取证口径:以本环境真机实测为准,8.6 文档与反编译结论仅作参考。`
|
|
130
|
+
`取证口径:以本环境真机实测为准,8.6 文档与反编译结论仅作参考。` +
|
|
131
|
+
`族差异清单见 docs/platform-contracts/2.1-delta.md(逐条带 file:line;未登记的条目按实测,不臆断同形或不同形)。`);
|
|
131
132
|
}
|
|
132
133
|
/**
|
|
133
134
|
* 无版本证据时的兼容提示(2026-11-24 产品口径)。
|
package/dist/discovery.js
CHANGED
|
@@ -276,7 +276,7 @@ function summarizeDescription(description) {
|
|
|
276
276
|
return sentence.length > 200 ? `${sentence.slice(0, 197)}...` : sentence;
|
|
277
277
|
}
|
|
278
278
|
/** A terse type label: `string`, `integer`, `array<string>`, `string: A|B`. */
|
|
279
|
-
function terseType(node, depth = 0) {
|
|
279
|
+
export function terseType(node, depth = 0) {
|
|
280
280
|
if (!node)
|
|
281
281
|
return "any";
|
|
282
282
|
// 审查 2026-11-04:展开嵌套 object 后递归可能遇到自引用 schema($refStrategy:none
|
|
@@ -317,7 +317,13 @@ function terseType(node, depth = 0) {
|
|
|
317
317
|
if (rendered.length === 0)
|
|
318
318
|
return "object";
|
|
319
319
|
const joined = `object{${rendered.join(",")}}`;
|
|
320
|
-
|
|
320
|
+
if (joined.length <= 80)
|
|
321
|
+
return joined;
|
|
322
|
+
// F4(0.8.6):超预算时**弃类型不弃键名**——旧实现整块退回 "object",调用方连
|
|
323
|
+
// 成员键都看不到(`sorts` 四项展开约 93 字符,`buttons` 较短才显示)。键名长度
|
|
324
|
+
// 仍超预算才退回 "object"。
|
|
325
|
+
const keys = `object{${Object.keys(node.properties ?? {}).join(",")}}`;
|
|
326
|
+
return keys.length <= 80 ? keys : "object";
|
|
321
327
|
}
|
|
322
328
|
return node.type ?? "any";
|
|
323
329
|
}
|
package/dist/endpoints.js
CHANGED
|
@@ -94,6 +94,16 @@ export const ENDPOINTS = {
|
|
|
94
94
|
customPageContentUpdate: "/api/api/custom/page/content/update",
|
|
95
95
|
customPageContentPublish: "/api/api/custom/page/content/publish",
|
|
96
96
|
appPackagePhysicallyDelete: "/api/api/app/apppackage/physically_delete",
|
|
97
|
+
/**
|
|
98
|
+
* Platform async-delete task result (2.1.5 and 8.6.26 both:
|
|
99
|
+
* AppPackageController `/delete/history?taskId=` → 8.6.26 :1460-1476,
|
|
100
|
+
* 2.1.5 :1369-1378; `getAppDeletHistoryByTaskId`, unknown id → 309027
|
|
101
|
+
* 任务不存在). physically_delete returns the AppDeleteHistoryModel it saved
|
|
102
|
+
* with TaskStatus.RUN (:1333-1358); the real failure reason is only written
|
|
103
|
+
* to this row (message + FAIL in the catch). The CLI polls this endpoint
|
|
104
|
+
* inline from model.delete — there is deliberately no `deleteHistory` tool.
|
|
105
|
+
*/
|
|
106
|
+
appPackageDeleteHistory: "/api/api/app/apppackage/delete/history",
|
|
97
107
|
fieldList: "/api/api/app/bizproperty/list",
|
|
98
108
|
fieldGet: "/api/api/app/bizproperty/get",
|
|
99
109
|
fieldCreate: "/api/api/app/bizproperty/create",
|