bfi-cli 0.1.76 → 0.1.77
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.mjs +15 -3
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -8583,6 +8583,12 @@ async function runYmc(args, globalOpts) {
|
|
|
8583
8583
|
const sub2 = rest[0] || "search";
|
|
8584
8584
|
const rest2 = rest.slice(1);
|
|
8585
8585
|
const searchBase = (process.env.BFI_WIKI_BASE || YMC_DEFAULT_BASE.replace(/\/api\/v2$/, "/api/v1")) + "/search/";
|
|
8586
|
+
const wikiToken = api.token;
|
|
8587
|
+
if (!wikiToken) {
|
|
8588
|
+
console.error("未认证。先运行:bfi auth login --token <sk-token>(或传 --token)");
|
|
8589
|
+
process.exit(1);
|
|
8590
|
+
}
|
|
8591
|
+
const authHeaders = { Authorization: `Bearer ${wikiToken}` };
|
|
8586
8592
|
if (sub2 === "search") {
|
|
8587
8593
|
const kw = positionals(rest2)[0];
|
|
8588
8594
|
if (!kw) {
|
|
@@ -8602,6 +8608,7 @@ async function runYmc(args, globalOpts) {
|
|
|
8602
8608
|
const req = mod.request(searchBase + "unified", {
|
|
8603
8609
|
method: "POST",
|
|
8604
8610
|
headers: {
|
|
8611
|
+
...authHeaders,
|
|
8605
8612
|
"Content-Type": "application/json",
|
|
8606
8613
|
Accept: "application/json",
|
|
8607
8614
|
"Content-Length": Buffer.byteLength(payload)
|
|
@@ -8623,7 +8630,7 @@ async function runYmc(args, globalOpts) {
|
|
|
8623
8630
|
}
|
|
8624
8631
|
const parsed = JSON.parse(raw0(resp));
|
|
8625
8632
|
if (parsed.code !== 0) {
|
|
8626
|
-
console.error(`✗ ${parsed.msg}`);
|
|
8633
|
+
console.error(`✗ ${parsed.msg ?? parsed.detail ?? JSON.stringify(parsed).slice(0, 200)}`);
|
|
8627
8634
|
process.exit(1);
|
|
8628
8635
|
}
|
|
8629
8636
|
console.log(JSON.stringify(parsed.data, null, 2));
|
|
@@ -8644,6 +8651,7 @@ async function runYmc(args, globalOpts) {
|
|
|
8644
8651
|
const req = mod.request(searchBase + "detail", {
|
|
8645
8652
|
method: "POST",
|
|
8646
8653
|
headers: {
|
|
8654
|
+
...authHeaders,
|
|
8647
8655
|
"Content-Type": "application/json",
|
|
8648
8656
|
Accept: "application/json",
|
|
8649
8657
|
"Content-Length": Buffer.byteLength(payload)
|
|
@@ -8665,7 +8673,7 @@ async function runYmc(args, globalOpts) {
|
|
|
8665
8673
|
}
|
|
8666
8674
|
const parsed = JSON.parse(raw0(resp));
|
|
8667
8675
|
if (parsed.code !== 0) {
|
|
8668
|
-
console.error(`✗ ${parsed.msg}`);
|
|
8676
|
+
console.error(`✗ ${parsed.msg ?? parsed.detail ?? JSON.stringify(parsed).slice(0, 200)}`);
|
|
8669
8677
|
process.exit(1);
|
|
8670
8678
|
}
|
|
8671
8679
|
const d = parsed.data;
|
|
@@ -8927,7 +8935,11 @@ const HELP = {
|
|
|
8927
8935
|
call: `bfi ymc call <route> -e <env> [--data '<json>'] [-t <time> | --start-time <s> --end-time <e>] [--timeout <秒>] [--json]
|
|
8928
8936
|
通用透传:覆盖全部注册表端点(warningCall/warningSql/exceptionHistory/bpr/list/alert/detail/tool/list/app/history/environment/uba/query ...)。
|
|
8929
8937
|
完整清单与参数声明:curl http://172.20.35.178:8901/openapi.json 或 /docs(Swagger UI)。
|
|
8930
|
-
时间参数(-t/--start-time/--end-time)由服务端按端点 time_fields 展开为 beginTs/endTs
|
|
8938
|
+
时间参数(-t/--start-time/--end-time)由服务端按端点 time_fields 展开为 beginTs/endTs 等——
|
|
8939
|
+
禁止在 --data JSON 里手传 start/end/start_time(数字 422、字符串被忽略返回空)。
|
|
8940
|
+
⚠️ app/history、jvm/history 等资源端点的 appId 必须带环境前缀(如 stage-dc-core1-<appCode>,
|
|
8941
|
+
可用 bfi ymc call app/list --data '{"keyword":"<appCode>"}' 查得);CLI 的 --app 参数则传裸名。
|
|
8942
|
+
数据可能为空(覆盖不全)——一次空即换通道,不做参数变体重试。
|
|
8931
8943
|
示例:
|
|
8932
8944
|
bfi ymc call warningCallstat --data '{"curAppCode":"yonbip-scm-scmmp","page":1,"pageSize":10}' -e core3 -t 1h
|
|
8933
8945
|
bfi ymc call app/history --data '{"appId":"daily-x","queryType":"podCpuUsage"}' -e daily -t 1d`
|