@stalfh233/omc-cli 0.4.11 → 0.4.13

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/README.md CHANGED
@@ -246,12 +246,12 @@ src/ args/support/plan/read/write/package/context(治理管道)
246
246
 
247
247
  ## npm 分发
248
248
 
249
- 本包(`@stalfh233/omc-cli`,可执行命令仍是 `omc`)通过公共 npm registry 分发。`omc-core` 是 `omc-cli` 的内部依赖,发布时先发 `omc-core`,再发 `omc-cli`;两者版本保持一致。当前版本为 `0.4.11`,尚未宣称 `1.0.0` 稳定契约。
249
+ 本包(`@stalfh233/omc-cli`,可执行命令仍是 `omc`)通过公共 npm registry 分发。`omc-core` 是 `omc-cli` 的内部依赖,发布时先发 `omc-core`,再发 `omc-cli`;两者版本保持一致。当前版本为 `0.4.13`,尚未宣称 `1.0.0` 稳定契约。
250
250
 
251
251
  ### 使用已发布包
252
252
 
253
253
  ```bash
254
- npm install -g @stalfh233/omc-cli@0.4.11
254
+ npm install -g @stalfh233/omc-cli@0.4.13
255
255
  omc setup
256
256
  omc doctor
257
257
  omc help omc-write-hazards
@@ -270,6 +270,10 @@ npm publish --workspace packages/omc-cli
270
270
 
271
271
  `omc-core` 与 `omc-cli` 版本保持一致;发布前先用 `git tag vX.Y.Z` 记录该版本。新包首次发布进入 npm staged-publishing 审核队列,需维护者在 npmjs.com 用交互式 2FA 批准后真实版本才可见。
272
272
 
273
+ ### 输出编码
274
+
275
+ stdout 是机器解析的 JSON:Windows 上默认把非 ASCII 转义成 `\uXXXX`(纯 ASCII,在 GBK 控制台也不会乱码,等价于 Python `json.dumps(ensure_ascii=True)`),Linux/macOS 保持原始 UTF-8。UTF-8 终端想要可读中文时设 `OMC_ASCII_STDOUT=0`。`--out` 文件、artifact、stderr、CloudPivot 请求体始终是原始 UTF-8。
276
+
273
277
  ### 版本策略
274
278
 
275
279
  - `0.2.x`:继续演进 CLI/覆盖清单/配置契约,允许新增能力和必要的行为修复。
@@ -13,14 +13,21 @@ export function envelope(status, result, requestId, error = null) {
13
13
  /**
14
14
  * The single stdout serialization for every envelope.
15
15
  *
16
- * On zh-CN Windows, PowerShell decodes a native process's bytes with the legacy
17
- * console code page and mangles UTF-8 Chinese ("付文�?"), which forces callers
18
- * into a "write to file, then re-read" workaround. When `OMC_ASCII_STDOUT`
19
- * resolves on, non-ASCII is escaped to `\uXXXX`: stdout stays pure ASCII and
20
- * decodes identically under any code page while still parsing to the original
21
- * string. It is on by default only on win32, so Linux output keeps its smaller
22
- * UTF-8 bytes. Override with `OMC_ASCII_STDOUT=1|0`. Artifacts keep raw UTF-8 —
23
- * they are files, not a console stream. See `CONTEXT.md` → Agent-facing CLI.
16
+ * stdout is machine-parsed JSON, so it must decode identically for ANY consumer
17
+ * regardless of the ambient console code page. On zh-CN Windows the console is
18
+ * GBK (cp936), and a native process's bytes are decoded with that code page — by
19
+ * the terminal for direct output, and by PowerShell's `[Console]::OutputEncoding`
20
+ * for `$x = omc …` / `omc … > f` / `omc … | …`. Raw UTF-8 Chinese is mangled
21
+ * there (verified on Windows PowerShell 5.1 AND PowerShell 7.6). Escaping every
22
+ * non-ASCII code unit to `\uXXXX` makes stdout pure ASCII, so it survives any
23
+ * code page and still `JSON.parse`s back to the original string. This is the
24
+ * same conservative default as Python's `json.dumps(ensure_ascii=True)`.
25
+ *
26
+ * Escaping is ON by default only on win32; POSIX keeps its smaller raw UTF-8
27
+ * bytes. Override with `OMC_ASCII_STDOUT=1|0` (set `0` on a UTF-8 terminal to
28
+ * get readable Chinese). `--out` files, artifacts, stderr, and the CloudPivot
29
+ * wire stay raw UTF-8 — they are not a code-page-bound console stream. See
30
+ * `CONTEXT.md` → Agent-facing CLI.
24
31
  */
25
32
  export function asciiStdout() {
26
33
  const override = process.env.OMC_ASCII_STDOUT;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stalfh233/omc-cli",
3
- "version": "0.4.11",
3
+ "version": "0.4.13",
4
4
  "description": "CloudPivot 8.6 configuration capability CLI — governed, fail-closed, coverage-manifest bounded.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -51,7 +51,7 @@
51
51
  },
52
52
  "dependencies": {
53
53
  "commander": "14.0.3",
54
- "omc-core": "0.4.11",
54
+ "omc-core": "0.4.13",
55
55
  "proper-lockfile": "4.1.2",
56
56
  "write-file-atomic": "6.0.0",
57
57
  "zod": "^3.23.8",