bfi-cli 0.1.76 → 0.1.78
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 +19 -4
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -8326,6 +8326,8 @@ async function runYmc(args, globalOpts) {
|
|
|
8326
8326
|
console.error("例:bfi ymc sls-raw '* | SELECT applicationName, count(*) AS c GROUP BY applicationName' -e daily -t 3d");
|
|
8327
8327
|
console.error("例:bfi ymc sls-raw '* | SELECT * WHERE level=''ERROR''' -e pre --start-time \"2026-08-31 15:00:00\" --end-time \"2026-08-31 16:00:00\"");
|
|
8328
8328
|
console.error("说明:--start-time/--end-time(yyyy-MM-dd HH:mm:ss 北京时间)为精确窗口,优先于 -t/--days");
|
|
8329
|
+
console.error("行数与翻页:纯检索由服务端自动拼 LIMIT [offset,]line(line 可到数千);带 SQL 段时尊重原语句(翻页自写 LIMIT off,cnt)");
|
|
8330
|
+
console.error("⚠️ 实测口径:LIMIT 无偏移可靠但慢(1000 行约 190s);带偏移翻页 cnt≤100 可靠(offset>0 且 cnt>100 会返回空);大窗口优先窄时间多次查询");
|
|
8329
8331
|
process.exit(1);
|
|
8330
8332
|
}
|
|
8331
8333
|
const body = {
|
|
@@ -8333,7 +8335,8 @@ async function runYmc(args, globalOpts) {
|
|
|
8333
8335
|
...requireEnv(rest),
|
|
8334
8336
|
...timeOpts(rest),
|
|
8335
8337
|
...opt(rest, "--days") ? { days: Number(opt(rest, "--days")) } : {},
|
|
8336
|
-
...opt(rest, "--line") ? { line: Number(opt(rest, "--line")) } : {}
|
|
8338
|
+
...opt(rest, "--line") ? { line: Number(opt(rest, "--line")) } : {},
|
|
8339
|
+
...opt(rest, "--offset") ? { offset: Number(opt(rest, "--offset")) } : {}
|
|
8337
8340
|
};
|
|
8338
8341
|
if (!opt(rest, "-t", "--time") && !opt(rest, "--start-time") && !opt(rest, "--days")) console.error("⚠️ 未指定时间窗:服务端按超大窗口兜底,命中可能含数天前记录——取证请显式 -t/--start-time");
|
|
8339
8342
|
emit(await api.call("sls/raw", body), jsonMode, (data) => {
|
|
@@ -8583,6 +8586,12 @@ async function runYmc(args, globalOpts) {
|
|
|
8583
8586
|
const sub2 = rest[0] || "search";
|
|
8584
8587
|
const rest2 = rest.slice(1);
|
|
8585
8588
|
const searchBase = (process.env.BFI_WIKI_BASE || YMC_DEFAULT_BASE.replace(/\/api\/v2$/, "/api/v1")) + "/search/";
|
|
8589
|
+
const wikiToken = api.token;
|
|
8590
|
+
if (!wikiToken) {
|
|
8591
|
+
console.error("未认证。先运行:bfi auth login --token <sk-token>(或传 --token)");
|
|
8592
|
+
process.exit(1);
|
|
8593
|
+
}
|
|
8594
|
+
const authHeaders = { Authorization: `Bearer ${wikiToken}` };
|
|
8586
8595
|
if (sub2 === "search") {
|
|
8587
8596
|
const kw = positionals(rest2)[0];
|
|
8588
8597
|
if (!kw) {
|
|
@@ -8602,6 +8611,7 @@ async function runYmc(args, globalOpts) {
|
|
|
8602
8611
|
const req = mod.request(searchBase + "unified", {
|
|
8603
8612
|
method: "POST",
|
|
8604
8613
|
headers: {
|
|
8614
|
+
...authHeaders,
|
|
8605
8615
|
"Content-Type": "application/json",
|
|
8606
8616
|
Accept: "application/json",
|
|
8607
8617
|
"Content-Length": Buffer.byteLength(payload)
|
|
@@ -8623,7 +8633,7 @@ async function runYmc(args, globalOpts) {
|
|
|
8623
8633
|
}
|
|
8624
8634
|
const parsed = JSON.parse(raw0(resp));
|
|
8625
8635
|
if (parsed.code !== 0) {
|
|
8626
|
-
console.error(`✗ ${parsed.msg}`);
|
|
8636
|
+
console.error(`✗ ${parsed.msg ?? parsed.detail ?? JSON.stringify(parsed).slice(0, 200)}`);
|
|
8627
8637
|
process.exit(1);
|
|
8628
8638
|
}
|
|
8629
8639
|
console.log(JSON.stringify(parsed.data, null, 2));
|
|
@@ -8644,6 +8654,7 @@ async function runYmc(args, globalOpts) {
|
|
|
8644
8654
|
const req = mod.request(searchBase + "detail", {
|
|
8645
8655
|
method: "POST",
|
|
8646
8656
|
headers: {
|
|
8657
|
+
...authHeaders,
|
|
8647
8658
|
"Content-Type": "application/json",
|
|
8648
8659
|
Accept: "application/json",
|
|
8649
8660
|
"Content-Length": Buffer.byteLength(payload)
|
|
@@ -8665,7 +8676,7 @@ async function runYmc(args, globalOpts) {
|
|
|
8665
8676
|
}
|
|
8666
8677
|
const parsed = JSON.parse(raw0(resp));
|
|
8667
8678
|
if (parsed.code !== 0) {
|
|
8668
|
-
console.error(`✗ ${parsed.msg}`);
|
|
8679
|
+
console.error(`✗ ${parsed.msg ?? parsed.detail ?? JSON.stringify(parsed).slice(0, 200)}`);
|
|
8669
8680
|
process.exit(1);
|
|
8670
8681
|
}
|
|
8671
8682
|
const d = parsed.data;
|
|
@@ -8927,7 +8938,11 @@ const HELP = {
|
|
|
8927
8938
|
call: `bfi ymc call <route> -e <env> [--data '<json>'] [-t <time> | --start-time <s> --end-time <e>] [--timeout <秒>] [--json]
|
|
8928
8939
|
通用透传:覆盖全部注册表端点(warningCall/warningSql/exceptionHistory/bpr/list/alert/detail/tool/list/app/history/environment/uba/query ...)。
|
|
8929
8940
|
完整清单与参数声明:curl http://172.20.35.178:8901/openapi.json 或 /docs(Swagger UI)。
|
|
8930
|
-
时间参数(-t/--start-time/--end-time)由服务端按端点 time_fields 展开为 beginTs/endTs
|
|
8941
|
+
时间参数(-t/--start-time/--end-time)由服务端按端点 time_fields 展开为 beginTs/endTs 等——
|
|
8942
|
+
禁止在 --data JSON 里手传 start/end/start_time(数字 422、字符串被忽略返回空)。
|
|
8943
|
+
⚠️ app/history、jvm/history 等资源端点的 appId 必须带环境前缀(如 stage-dc-core1-<appCode>,
|
|
8944
|
+
可用 bfi ymc call app/list --data '{"keyword":"<appCode>"}' 查得);CLI 的 --app 参数则传裸名。
|
|
8945
|
+
数据可能为空(覆盖不全)——一次空即换通道,不做参数变体重试。
|
|
8931
8946
|
示例:
|
|
8932
8947
|
bfi ymc call warningCallstat --data '{"curAppCode":"yonbip-scm-scmmp","page":1,"pageSize":10}' -e core3 -t 1h
|
|
8933
8948
|
bfi ymc call app/history --data '{"appId":"daily-x","queryType":"podCpuUsage"}' -e daily -t 1d`
|