@stalfh233/omc-cli 0.4.44 → 0.4.46

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.
@@ -1,5 +1,5 @@
1
1
  import { writeFileSync } from "node:fs";
2
- import { serializeEnvelope } from "./cli-contract.js";
2
+ import { asciiStdout, serializeEnvelope } from "./cli-contract.js";
3
3
  import { recordUsageOutput } from "./usage-log.js";
4
4
  let options = { quiet: false, verbose: false };
5
5
  /** Parse `--quiet`, `--verbose` and `--out <file>` from the raw argv once, before dispatch. */
@@ -63,9 +63,20 @@ function compactForOutput(value) {
63
63
  * reaches stdout — keeping the "exactly one envelope" contract even on failure.
64
64
  * stdout and the file can never diverge (both follow the same verbose rule).
65
65
  */
66
+ let asciiBannerEmitted = false;
67
+ function emitAsciiBannerOnce() {
68
+ if (asciiBannerEmitted)
69
+ return;
70
+ asciiBannerEmitted = true;
71
+ // r73 win32 实测:管道 + 非 UTF-8 代码页时输出被 ASCII 转义(\uXXXX),用户视为乱码。
72
+ // 横幅走 stderr(不进管道、不破坏单信封契约),在痛点时刻给出两个解法。
73
+ process.stderr.write("[omc] 当前控制台代码页非 UTF-8,中文已 ASCII 转义防乱码。要原样中文:chcp 65001 后重跑,或设 OMC_ASCII_STDOUT=0。\n");
74
+ }
66
75
  export function writeEnvelope(value) {
67
76
  const outputValue = compactForOutput(value);
68
77
  const text = serializeEnvelope(outputValue);
78
+ if (asciiStdout())
79
+ emitAsciiBannerOnce();
69
80
  if (!options.outFile) {
70
81
  recordUsageOutput(value, Buffer.byteLength(text, "utf8"));
71
82
  process.stdout.write(text);
package/dist/cli.js CHANGED
@@ -122,7 +122,7 @@ async function cmdDoctor(store, environment, serviceCode) {
122
122
  const chcp = spawnSync("chcp.com", [], { encoding: "utf8" });
123
123
  const active = /([0-9]{3,5})\s*$/.exec((chcp.stdout || "").trim().split("\n").pop() ?? "")?.[1];
124
124
  if (active && active !== "65001") {
125
- steps.push(`编码 ⚠ 活动代码页 ${active}(非 65001)——PowerShell 管道会把 CLI 的 UTF-8 中文输出解成乱码;这是终端解码问题不是 OMC 故障。先 \`chcp 65001\` + \`[Console]::OutputEncoding=[Text.Encoding]::UTF8\` 再读 CLI 输出`);
125
+ steps.push(`编码 ⚠ 活动代码页 ${active}(非 65001)——管道输出会把中文转义为 unicode 形式。要原样中文:\`chcp 65001\` + \`[Console]::OutputEncoding=[Text.Encoding]::UTF8\`,或设 \`OMC_ASCII_STDOUT=0\``);
126
126
  }
127
127
  else if (active === "65001") {
128
128
  steps.push("编码 ok 活动代码页 65001(UTF-8,中文输出无乱码风险)");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stalfh233/omc-cli",
3
- "version": "0.4.44",
3
+ "version": "0.4.46",
4
4
  "description": "CloudPivot 8.6 configuration capability CLI — governed, fail-closed, coverage-manifest bounded.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -207,6 +207,7 @@ rules:
207
207
  - **执行门 / 满足条件触发**(`dataCondition`,BIZ_ACTION 用 `execConditionGroups`):**与定位两码事**——决定「要不要执行」,不决定「改哪条」。compact `actions.when` 表达 UPDATE 执行门(叶 `currentSchemaDataItem`+`ruleDataConditionType`);其它节点用 `nodeGraph`。**条件改自身**:`when: [{field: amount, gt: 10000}]` + 省略 `filter`(默认 `id=id`)——别把条件写进 `filter`,那会改掉所有符合的行(bench66 多行互覆)。
208
208
  - 子表定位 `filterSubCondition`;子表触发范围 `childTriggerConditionType∈ADD/MODIFY/DELETE`。
209
209
  - **触发时机**:数据事件(`Create`/`Update`/`Delete`)**只分发到平台预置 code 行**;流程相关用预置 `Available`(流程生效)/`Cancel`(流程作废),或流程事件绑定 `workflow.bindRule` 的 `end`/`cancel`/`start`/`activate`。
210
+ **"流程结束后执行"的两个正式入口(2026-10-16 真机反馈消歧)**:① **流程设计 → 流程结束后**(对应 `workflow.bindRule` 的 `end`,绑定自定义规则承载动作节点);② **平台自带业务规则的"流程生效"(预置 `Available`)行**。两者都在**流程实例走完归档/审批通过那一刻**触发,**不是进入流程时**——进入流程时刻是 `start`/`activate`。业务要"审批通过后执行某逻辑"时只用 ①或②,**禁止**绑 `start`/`activate`,也勿误用 `Create`(提交即触发,时序等同流程发起)。
210
211
  - **预置规则身份不可改**:`Create`/`Update`/`Delete`/`Load`/`GetList`/`Available`/`Cancel` 名称由平台维护(`Create`=数据新增);传 `name` 不生效(仅自定义规则名称可改),可改的是节点名 `nodeName`。
211
212
  - **流程事件只绑自定义规则**:`workflow.bindRule` 的 `ruleCodes` 只能给自定义 code——设计器的事件规则选择器不提供预置触发行(绑 `Create` 到 `end` 非法,工具 fail closed)。要「审批通过后执行某逻辑」:新建自定义规则承载动作节点再绑 `end`。
212
213
  - **审批通过/驳回回写**:通过绑 `end`(或 `Available`)、驳回绑 `cancel`(或 `Cancel`)——**不要**把两条各自 FIXED 赋值的规则都绑到 `endEventHandler`(两条都会执行、后者覆盖前者;工具会在 `bizActions.length>1` 时回读 `advisory` 提醒)。真实生产只在 `endEventHandler` 绑**一条**多分支规则图。
@@ -59,6 +59,10 @@ A single draft may cover **several** designs; group them by **design surface**:
59
59
  - **Attach the code for identity keys** (model schemaCode, field code, choice
60
60
  values, relation target code) — these are written verbatim and can collide.
61
61
  Pure display labels may omit the code.
62
+ - **编码风格参考(参考非门禁)**:产品规范默认——字段编码=小驼峰(`applyTime`),
63
+ 模型/子表编码=小写下划线(`leave_apply`)。**目标模型既有字段已是另一种风格时,
64
+ 新字段跟随客户既有风格保持整模型一致**(混合风格比统一偏航更伤),并在草稿标注
65
+ 一句"编码风格跟随既有模型"。长度上限与平台保留字仍是强制校验(出门前拒)。
62
66
  - Each section is headed with its design surface + the tool it maps to, so the
63
67
  reviewer can point at one section precisely.
64
68