@stalfh233/omc-cli 0.6.40 → 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 +3 -3
- package/dist/env-export.js +11 -4
- package/package.json +3 -3
- package/skills/omc-start-here.md +1 -1
package/dist/cli.js
CHANGED
|
@@ -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) {
|
|
@@ -2293,7 +2293,7 @@ async function main() {
|
|
|
2293
2293
|
// r55(2026-11-11 Windows 真机联调摩擦):agent 为拿 token 花 7 轮、用户手粘
|
|
2294
2294
|
// 700+ 字符坏 3 次——正道 `env export` 在所有 skill/文档里零露出。列环境时顺手
|
|
2295
2295
|
// 指路(CLI 自更新直达存量项目,比 AGENTS.md 重装传播可靠)。
|
|
2296
|
-
console.error(`联调/token/headers
|
|
2296
|
+
console.error(`联调/token/headers 一律走 omc env export --env <env> --example curl|node(CLI 自己登录;凭据只从这条取)`);
|
|
2297
2297
|
}
|
|
2298
2298
|
commandExitCode = CLI_EXIT_CODES.ok;
|
|
2299
2299
|
});
|
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
|
}
|
package/skills/omc-start-here.md
CHANGED
|
@@ -102,7 +102,7 @@ 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
|
|
105
|
+
联调/token/headers 一律走 `omc env export --env <env> --example node|curl`(CLI 自行登录;凭据只从这条取,token-cache 是维护者面)。
|
|
106
106
|
|
|
107
107
|
## 4. Boundaries
|
|
108
108
|
|