@stalfh233/omc-cli 0.6.39 → 0.6.41
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/dist/cli.js
CHANGED
|
@@ -214,7 +214,7 @@ async function cmdDoctor(store, environment, serviceCode) {
|
|
|
214
214
|
steps.push(`配置 ok 环境=${resolved.name}(来源 ${resolved.source})`);
|
|
215
215
|
steps.push(`远端写 ok 远端写=${environmentWritable(resolved.profile) ? "允许" : "只读"}${requiresProductionConfirmation(resolved.profile) ? ";生产环境:每笔写入需 confirmProduction" : ""}(平台侧变更)`);
|
|
216
216
|
// r29f F9:读面也会本地落盘(artifacts/usage/describe 缓存);与远端写分开说。
|
|
217
|
-
steps.push(`本地落盘 ok .omc/(artifacts·usage·describe
|
|
217
|
+
steps.push(`本地落盘 ok .omc/(artifacts·usage·describe 缓存;读面也会写)。usage 台账只供维护者计量,agent 不要读它自查成本(你的成本口径=轮数+字节)。重定位:OMC_CONFIG_HOME=<根>(其下 .omc/)或 OMC_ARTIFACTS_HOME=<产物目录>`);
|
|
218
218
|
const removed = removedProfileKeys(resolved.profile);
|
|
219
219
|
if (removed.length > 0)
|
|
220
220
|
steps.push(`配置 ⚠ 含已移除键(请删除):${removed.join("、")}`);
|
|
@@ -375,7 +375,7 @@ function doctorAnchor() {
|
|
|
375
375
|
`方法论 omc help <topic>(或 --topic <name>)--sections / --section "<标题>"(按节读,随包 skills/);topic:${topics}`,
|
|
376
376
|
"大输出 超预算结果只回 artifactId/sha256/fetch;用 fetch 里的 omc artifact get <id>(可加 --jq <path>)取回,勿全量读入",
|
|
377
377
|
// r29f F9:只读面不碰远端,但仍会本地落盘——写清,避免「零写入」核对误判。
|
|
378
|
-
"落盘 远端写=环境 writable 决定的平台变更;本地落盘=.omc/(artifacts/usage/describe
|
|
378
|
+
"落盘 远端写=环境 writable 决定的平台变更;本地落盘=.omc/(artifacts/usage/describe 缓存,读面也会写;usage 台账只供维护者计量,agent 不要读它自查成本——你的成本口径=轮数+字节)。可用 OMC_CONFIG_HOME 重定位配置根(其下 .omc/),或 OMC_ARTIFACTS_HOME 单独重定位产物目录",
|
|
379
379
|
].join("\n");
|
|
380
380
|
}
|
|
381
381
|
function flag0(args, name) {
|
|
@@ -2207,7 +2207,7 @@ async function main() {
|
|
|
2207
2207
|
nextCommand: "omc setup --list",
|
|
2208
2208
|
}));
|
|
2209
2209
|
});
|
|
2210
|
-
command.command("env [action] [name]").description("环境清单与联调参数包;`env export` 一键导出 token/headers,免手工从浏览器复制 token").option("--json").option("--env <environment>", "环境名;按与 call 相同的项目范围门解析").option("--format <format>", "export:输出可 source 的 bash 环境变量语句").option("--field <field>", "输出单个裸值:accessToken|baseUrl|enterpriseId|engineCode").option("--example <example>", "追加一个复制即测示例:curl|node;path
|
|
2210
|
+
command.command("env [action] [name]").description("环境清单与联调参数包;`env export` 一键导出 token/headers,免手工从浏览器复制 token").option("--json").option("--env <environment>", "环境名;按与 call 相同的项目范围门解析").option("--format <format>", "export:输出可 source 的 bash 环境变量语句").option("--field <field>", "输出单个裸值:accessToken|baseUrl|enterpriseId|engineCode").option("--example <example>", "追加一个复制即测示例:curl|node;path 换成你的接口(示例内 token 默认占位,真值走 --field accessToken 或管道注入)").option("--reveal-token", "示例里回填真实 accessToken(默认打码;只在本地直接执行时用,别把输出贴进对话/归档)").addHelpText("after", "\n`omc env export` 用于二开联调参数包;`--example curl|node` 追加复制即测示例(把 `<your-api-path>` 换成你的接口),默认 JSON 不带示例。`--format env` 可 source,`--field accessToken` 输出裸 token;`--example` 里的 token 默认占位(`--reveal-token` 才回填真值)。\n").action(async (action, name, options) => {
|
|
2211
2211
|
// Read-only inventory of configured environment names. r18: the sandbox
|
|
2212
2212
|
// guessed names instead of listing them; doctor's wording now points here.
|
|
2213
2213
|
const store = new ConfigStore(defaultPaths());
|
|
@@ -2228,7 +2228,7 @@ async function main() {
|
|
|
2228
2228
|
if (options.format !== undefined && options.field !== undefined)
|
|
2229
2229
|
throw new Error("--format and --field are mutually exclusive");
|
|
2230
2230
|
const session = await new SessionManager(store).session(resolved.name);
|
|
2231
|
-
const result = exportEnvironment(session, example);
|
|
2231
|
+
const result = exportEnvironment(session, example, options.revealToken === true);
|
|
2232
2232
|
if (options.format === "env")
|
|
2233
2233
|
process.stdout.write(formatEnv(result));
|
|
2234
2234
|
else if (options.field !== undefined) {
|
|
@@ -2287,9 +2287,14 @@ async function main() {
|
|
|
2287
2287
|
console.error("(none configured; run omc setup)");
|
|
2288
2288
|
// A5(GitLab #15):credential: missing 的环境列得出、调不通(auth-config)——
|
|
2289
2289
|
// 标注出来,防把"没凭据"误判成"参数写错"。
|
|
2290
|
-
else
|
|
2290
|
+
else {
|
|
2291
2291
|
for (const row of rows)
|
|
2292
2292
|
console.error(`${row.name}${row.isDefault ? " (default)" : ""} ${row.baseUrl} app=${row.applicationCode}${row.writable ? "" : " [read-only]"}${row.credential === "ok" ? "" : " [credential: missing → omc setup]"}`);
|
|
2293
|
+
// r55(2026-11-11 Windows 真机联调摩擦):agent 为拿 token 花 7 轮、用户手粘
|
|
2294
|
+
// 700+ 字符坏 3 次——正道 `env export` 在所有 skill/文档里零露出。列环境时顺手
|
|
2295
|
+
// 指路(CLI 自更新直达存量项目,比 AGENTS.md 重装传播可靠)。
|
|
2296
|
+
console.error(`联调/token/headers 一律走 omc env export --env <env> --example curl|node(CLI 自己登录;凭据只从这条取)`);
|
|
2297
|
+
}
|
|
2293
2298
|
commandExitCode = CLI_EXIT_CODES.ok;
|
|
2294
2299
|
});
|
|
2295
2300
|
command.command("doctor").option("--environment <environment>").option("--env <environment>").option("--service <serviceCode>", "可选:体检单个业务集成服务的鉴权参数形状(掩码/占位/全 0 检出,WARN 非致命)").action(async (options) => { commandExitCode = await cmdDoctor(new ConfigStore(defaultPaths()), options.environment ?? options.env, options.service); });
|
package/dist/env-export.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const EXPORT_NOTE = "token 即登录态(本地缓存 8h,401 自动重登);勿提交版本库/粘贴共享文档;仅本机联调。";
|
|
2
2
|
/** Build the structured local-only credential bundle. */
|
|
3
|
-
export function exportEnvironment(session, example) {
|
|
3
|
+
export function exportEnvironment(session, example, revealToken = false) {
|
|
4
4
|
const token = session.token();
|
|
5
5
|
// This is the same projection consumed by CloudPivotSession.send(). In
|
|
6
6
|
// particular, it includes the gateway tenant header when configured.
|
|
@@ -21,7 +21,7 @@ export function exportEnvironment(session, example) {
|
|
|
21
21
|
administrator: session.administrator(),
|
|
22
22
|
note: EXPORT_NOTE,
|
|
23
23
|
};
|
|
24
|
-
return example === undefined ? result : { ...result, example: requestExample(result, example) };
|
|
24
|
+
return example === undefined ? result : { ...result, example: requestExample(result, example, revealToken) };
|
|
25
25
|
}
|
|
26
26
|
export function fieldValue(result, field) {
|
|
27
27
|
return result[field];
|
|
@@ -41,9 +41,16 @@ export function formatEnv(result) {
|
|
|
41
41
|
export function maskAccount(account) {
|
|
42
42
|
return `${account.slice(0, 2)}***${account.slice(-2)}`;
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
/** 示例里的 token 占位(真值走 --field accessToken 或 --reveal-token)。 */
|
|
45
|
+
const REDACTED_TOKEN = "<$OMC_ACCESS_TOKEN>";
|
|
46
|
+
function requestExample(result, example, revealToken) {
|
|
45
47
|
const url = `${result.baseUrl}/<your-api-path>`;
|
|
46
|
-
|
|
48
|
+
// 2026-11-11 真机(sandbox-r55 场景05):示例把 8 小时管理员 JWT 原文打进
|
|
49
|
+
// stdout,转录/归档即泄漏。默认占位,管道注入真值。
|
|
50
|
+
const headers = Object.entries(result.headers).map(([name, value]) => [
|
|
51
|
+
name,
|
|
52
|
+
!revealToken && /^authorization$/i.test(name) ? `Bearer ${REDACTED_TOKEN}` : value,
|
|
53
|
+
]);
|
|
47
54
|
if (example === "curl") {
|
|
48
55
|
return `curl -s ${bashQuote(url)} ${headers.map(([name, value]) => `-H ${bashQuote(`${name}: ${value}`)}`).join(" ")}`;
|
|
49
56
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stalfh233/omc-cli",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.41",
|
|
4
4
|
"description": "CloudPivot 8.6 configuration capability CLI — governed, fail-closed, coverage-manifest bounded.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"commander": "14.0.3",
|
|
58
|
-
"omc-core": "0.6.
|
|
58
|
+
"omc-core": "0.6.41",
|
|
59
59
|
"proper-lockfile": "4.1.2",
|
|
60
60
|
"write-file-atomic": "6.0.0",
|
|
61
61
|
"zod": "^3.23.8",
|
|
@@ -73,6 +73,6 @@
|
|
|
73
73
|
"directory": "packages/omc-cli"
|
|
74
74
|
},
|
|
75
75
|
"optionalDependencies": {
|
|
76
|
-
"@stalfh233/omc-fake-platform": "0.6.
|
|
76
|
+
"@stalfh233/omc-fake-platform": "0.6.41"
|
|
77
77
|
}
|
|
78
78
|
}
|
|
@@ -410,6 +410,8 @@ owner/creater/modifier/部门/时间字段才从请求上下文回填(显式
|
|
|
410
410
|
| 前端 / 站内 | `POST /api/api/v2/businessRule/invoke`(**双层 /api 前缀**,与按钮面一致),body `{appCode,schemaCode,businessRuleCode,data}`;**必带租户头 `X-LowCode-Corpid: <企业ID>`**(缺了 50000,容器日志 `corpId can not be blank`;头名多一个连字符都无效) | Bearer 用户会话 token(RequestContext,无 userId 参数) | **handle 返回值原样 = `ResponseResult.data`(全部键,无白名单)** |
|
|
411
411
|
| 第三方 | `POST /api/openapi/v3/bo/invokeBizRule`,body 带 `userId` | OAuth2 client_credentials(token 端点**按部署路由不同**,见下) | handle 返回值**包在 `returnObject` 里**(不是直接 data) |
|
|
412
412
|
|
|
413
|
+
v2/v3 的用户会话 token:`omc env export --env <env> --field accessToken`(CLI 内部登录,401 自动重登;禁手翻 token-cache)。
|
|
414
|
+
|
|
413
415
|
**v3 的 token 端点三处口径不一,以真机为准(2026-11-11 实测 1.1.25)**:
|
|
414
416
|
|
|
415
417
|
| 来源 | 写的路径 | 实测 |
|
package/skills/omc-start-here.md
CHANGED
|
@@ -102,6 +102,8 @@ To use another environment you must ask the user first, then either
|
|
|
102
102
|
`OMC_ALLOW_CROSS_ENV=1` (prints a `cross-env:` line to stderr). Never widen the
|
|
103
103
|
scope on your own initiative.
|
|
104
104
|
|
|
105
|
+
联调/token/headers 一律走 `omc env export --env <env> --example node|curl`(CLI 自行登录;凭据只从这条取,token-cache 是维护者面)。
|
|
106
|
+
|
|
105
107
|
## 4. Boundaries
|
|
106
108
|
|
|
107
109
|
Out-of-coverage, blocked, or unsupported faces refuse with a manifest citation —
|
|
@@ -41,6 +41,10 @@ description: Choose the right OMC CLI tool for a goal. Use when unsure whether a
|
|
|
41
41
|
| **批量停用**某模型规则 | `omc call rule.disableMany --args '{"schemaCode":"<m>"}'`(默认含预置行;`customOnly:true` 只停自定义) |
|
|
42
42
|
| 字段清单(去噪) | `omc call field.list --args '{"schemaCode":"<m>","published":true}'`(默认业务字段,`all:true` 取全) |
|
|
43
43
|
|
|
44
|
+
## `omc call` 结果怎么取值
|
|
45
|
+
|
|
46
|
+
A 内联(结果小)`--jq 'result.路径'` 直取;B 外置(带 `artifactId`/`truncated`)同次调用加 `--jq`,或 `omc artifact get <id> --jq`;C pathMiss 按 `available[]` 真键名改路径——别换语法重试。
|
|
47
|
+
|
|
44
48
|
**业务键优先**:`rule.get`/`datarule.update`/`datarule.delete`/`workflow.get_*` 接受业务键
|
|
45
49
|
(schemaCode+ruleCode / schemaCode+propertyCode / schemaCode),免去先 list 取 id。
|
|
46
50
|
|