@stalfh233/omc-cli 0.4.0 → 0.4.11
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 +11 -22
- package/dist/call.js +15 -4
- package/dist/cli.js +18 -5
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -244,42 +244,31 @@ src/ args/support/plan/read/write/package/context(治理管道)
|
|
|
244
244
|
| `omc-acceptance-criteria` | 验收门:读回、交付态、零残留、反例基线 |
|
|
245
245
|
| `omc-glossary` | 术语:环境指纹、覆盖清单、交付态、Void envelope、结果状态 |
|
|
246
246
|
|
|
247
|
-
##
|
|
247
|
+
## npm 分发
|
|
248
248
|
|
|
249
|
-
|
|
249
|
+
本包(`@stalfh233/omc-cli`,可执行命令仍是 `omc`)通过公共 npm registry 分发。`omc-core` 是 `omc-cli` 的内部依赖,发布时先发 `omc-core`,再发 `omc-cli`;两者版本保持一致。当前版本为 `0.4.11`,尚未宣称 `1.0.0` 稳定契约。
|
|
250
250
|
|
|
251
251
|
### 使用已发布包
|
|
252
252
|
|
|
253
|
-
先从 GitLab 项目概览页取得 `<PROJECT_ID>`,再在使用方项目目录创建本地 `.npmrc`。不要把 token 写入仓库:
|
|
254
|
-
|
|
255
|
-
```ini
|
|
256
|
-
registry=https://gitlab.h3yun.com/api/v4/projects/<PROJECT_ID>/packages/npm/
|
|
257
|
-
//gitlab.h3yun.com/api/v4/projects/<PROJECT_ID>/packages/npm/:_authToken=${NPM_TOKEN}
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
`NPM_TOKEN` 使用具有 `read_package_registry` 的 Deploy Token,或 GitLab 推荐的其他 npm Registry token。然后安装:
|
|
261
|
-
|
|
262
253
|
```bash
|
|
263
|
-
npm install omc-cli@0.
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
254
|
+
npm install -g @stalfh233/omc-cli@0.4.11
|
|
255
|
+
omc setup
|
|
256
|
+
omc doctor
|
|
257
|
+
omc help omc-write-hazards
|
|
258
|
+
omc help omc-business-configuration
|
|
268
259
|
```
|
|
269
260
|
|
|
270
|
-
如果组织使用 group/instance Registry,可把 `.npmrc` 的 project endpoint 换成对应 group/instance endpoint;token 必须有目标包及其 `omc-core` 依赖的读取权限。
|
|
271
|
-
|
|
272
261
|
### 发布新版本
|
|
273
262
|
|
|
274
|
-
|
|
263
|
+
发布在开发机执行,必须先 `omc-core` 后 `omc-cli`,顺序不能反:
|
|
275
264
|
|
|
276
265
|
```bash
|
|
277
266
|
npm run verify
|
|
278
|
-
|
|
279
|
-
|
|
267
|
+
npm publish --workspace packages/omc-core
|
|
268
|
+
npm publish --workspace packages/omc-cli
|
|
280
269
|
```
|
|
281
270
|
|
|
282
|
-
`
|
|
271
|
+
`omc-core` 与 `omc-cli` 版本保持一致;发布前先用 `git tag vX.Y.Z` 记录该版本。新包首次发布进入 npm staged-publishing 审核队列,需维护者在 npmjs.com 用交互式 2FA 批准后真实版本才可见。
|
|
283
272
|
|
|
284
273
|
### 版本策略
|
|
285
274
|
|
package/dist/call.js
CHANGED
|
@@ -106,10 +106,21 @@ export async function runToolCall(toolName, options = {}) {
|
|
|
106
106
|
};
|
|
107
107
|
const result = options.timeoutMs === undefined
|
|
108
108
|
? await invoke()
|
|
109
|
-
: await
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
109
|
+
: await (async () => {
|
|
110
|
+
let timer;
|
|
111
|
+
try {
|
|
112
|
+
return await Promise.race([
|
|
113
|
+
invoke(),
|
|
114
|
+
new Promise((resolve) => { timer = setTimeout(() => resolve({ status: "uncertain", blocker: "cli-timeout", nextAction: "read back the requestId before retrying; retry only after the outcome is established", retryable: true }), options.timeoutMs); }),
|
|
115
|
+
]);
|
|
116
|
+
}
|
|
117
|
+
finally {
|
|
118
|
+
// Clear the losing timeout so a completed call does not leave a
|
|
119
|
+
// pending timer that would otherwise keep the event loop alive.
|
|
120
|
+
if (timer)
|
|
121
|
+
clearTimeout(timer);
|
|
122
|
+
}
|
|
123
|
+
})();
|
|
113
124
|
// The stderr line is a human diagnostic, NOT a second copy of the result: the
|
|
114
125
|
// stdout envelope is the single machine truth. Dumping the whole result here
|
|
115
126
|
// doubled every call's payload on stderr (unbounded and un-sanitized — it also
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createInterface } from "node:readline/promises";
|
|
3
|
-
import { stdin, argv
|
|
3
|
+
import { stdin, argv } from "node:process";
|
|
4
4
|
import { Command, CommanderError } from "commander";
|
|
5
5
|
import { ConfigStore, defaultPaths, removedProfileKeys } from "./config-store.js";
|
|
6
6
|
import { loadCoverageManifest, versionFamilyNotice } from "./coverage.js";
|
|
@@ -1373,22 +1373,35 @@ async function main() {
|
|
|
1373
1373
|
await command.parseAsync(stripOutputFlags(argv));
|
|
1374
1374
|
return commandExitCode;
|
|
1375
1375
|
}
|
|
1376
|
+
/**
|
|
1377
|
+
* End the process with `code` without the Windows-only libuv abort a bare
|
|
1378
|
+
* `process.exit()` triggers while undici is still closing its sockets:
|
|
1379
|
+
* Assertion failed: !(handle->flags & UV_HANDLE_CLOSING), src\win\async.c
|
|
1380
|
+
* We set `exitCode` so the loop drains and the process exits with the right
|
|
1381
|
+
* status; an unref'd guard force-exits only if some ref'd handle (e.g. an
|
|
1382
|
+
* optional `--timeout-ms` race timer) would otherwise keep the loop alive — by
|
|
1383
|
+
* which point the HTTP sockets are closed, so the forced exit is safe.
|
|
1384
|
+
*/
|
|
1385
|
+
function finish(code) {
|
|
1386
|
+
process.exitCode = code;
|
|
1387
|
+
setTimeout(() => process.exit(code), 1000).unref();
|
|
1388
|
+
}
|
|
1376
1389
|
const request = requestId();
|
|
1377
1390
|
main().then((code) => {
|
|
1378
1391
|
if (argv[2] === "call" || argv[2] === "artifact" || argv[2] === "commands" || argv[2] === "describe" || argv[2] === "contract" || argv[2] === "capabilities" || argv[2] === "capability" || argv[2] === "next" || argv[2] === "usage" || argv[2] === "intent" || argv[2] === "help") {
|
|
1379
1392
|
completeUsage(code);
|
|
1380
|
-
|
|
1393
|
+
finish(code);
|
|
1381
1394
|
return;
|
|
1382
1395
|
}
|
|
1383
1396
|
writeEnvelope(envelope(code === 0 ? "ok" : "error", {}, request, code === 0 ? null : { code: "internal", message: "command failed", retryable: false }));
|
|
1384
1397
|
completeUsage(code);
|
|
1385
|
-
|
|
1398
|
+
finish(code);
|
|
1386
1399
|
}, (error) => {
|
|
1387
1400
|
// commander prints `--help` / `-h` usage to stderr and signals success with
|
|
1388
1401
|
// this code; it is not an error and must not grow a spurious error envelope.
|
|
1389
1402
|
if (error instanceof CommanderError && error.code === "commander.helpDisplayed") {
|
|
1390
1403
|
completeUsage(0);
|
|
1391
|
-
|
|
1404
|
+
finish(0);
|
|
1392
1405
|
return;
|
|
1393
1406
|
}
|
|
1394
1407
|
const commander = error instanceof CommanderError;
|
|
@@ -1413,6 +1426,6 @@ main().then((code) => {
|
|
|
1413
1426
|
const parsed = errorEnvelope(new Error(message), commander ? "invalid-input" : "internal", commander ? CLI_EXIT_CODES.invalidInput : CLI_EXIT_CODES.internal, request);
|
|
1414
1427
|
writeEnvelope(parsed.envelope);
|
|
1415
1428
|
completeUsage(parsed.exitCode);
|
|
1416
|
-
|
|
1429
|
+
finish(parsed.exitCode);
|
|
1417
1430
|
});
|
|
1418
1431
|
//# sourceMappingURL=cli.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stalfh233/omc-cli",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.11",
|
|
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.
|
|
54
|
+
"omc-core": "0.4.11",
|
|
55
55
|
"proper-lockfile": "4.1.2",
|
|
56
56
|
"write-file-atomic": "6.0.0",
|
|
57
57
|
"zod": "^3.23.8",
|