bfi-cli 0.1.92 → 0.1.94
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/_chunks/skills.mjs +3 -2
- package/dist/cli.mjs +248 -23
- package/dist/mcp-codesearch/main.mjs +2 -2
- package/package.json +2 -2
package/dist/_chunks/skills.mjs
CHANGED
|
@@ -322,13 +322,14 @@ async function parseSkillMd(skillMdPath, options) {
|
|
|
322
322
|
const { data } = parseFrontmatter(content);
|
|
323
323
|
if (!data.name || !data.description) return null;
|
|
324
324
|
if (typeof data.name !== "string" || typeof data.description !== "string") return null;
|
|
325
|
-
|
|
325
|
+
const metadata = data.metadata;
|
|
326
|
+
if (metadata?.internal === true && !shouldInstallInternalSkills() && !options?.includeInternal) return null;
|
|
326
327
|
return {
|
|
327
328
|
name: sanitizeMetadata(data.name),
|
|
328
329
|
description: sanitizeMetadata(data.description),
|
|
329
330
|
path: dirname(skillMdPath),
|
|
330
331
|
rawContent: content,
|
|
331
|
-
metadata
|
|
332
|
+
metadata
|
|
332
333
|
};
|
|
333
334
|
} catch {
|
|
334
335
|
return null;
|
package/dist/cli.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { cancel, confirm, groupMultiselect, intro, log, multiselect as multisele
|
|
|
5
5
|
import { require_picocolors } from "./_chunks/libs/picocolors.mjs";
|
|
6
6
|
import { addSkillToLocalLock, addSkillToLock, computeSkillFolderHash, discoverSkills, dismissPrompt, filterSkills, getAllLockedSkills, getGitHubToken, getLastSelectedAgents, getSkillDisplayName, getSkillFromLock, isPromptDismissed, parseFrontmatter, parseSkillMd, readLocalLock, readSkillLock, removeSkillFromLock, sanitizeMetadata, saveSelectedAgents, stripTerminalEscapes } from "./_chunks/skills.mjs";
|
|
7
7
|
import { PluginRegistryClient } from "./_chunks/registry-client.mjs";
|
|
8
|
-
import { loadGlobalConfig, loadLockfile, loadProjectConfig, resolveConfig, saveGlobalConfig
|
|
8
|
+
import { loadGlobalConfig, loadLockfile, loadProjectConfig, resolveConfig, saveGlobalConfig, saveLockfile, setConfigValue } from "./_chunks/config.mjs";
|
|
9
9
|
import { esm_default } from "./_chunks/libs/simple-git.mjs";
|
|
10
10
|
import { EVE_SUBAGENTS_DIR, agents, detectInstalledAgents, getEveSubagents, getNonUniversalAgents, getUniversalAgents, getVisibleUniversalAgents, isUniversalAgent } from "./_chunks/agents.mjs";
|
|
11
11
|
import { packageSkillName } from "./_chunks/package-skill-identity.mjs";
|
|
@@ -170,7 +170,7 @@ function parseSource(input) {
|
|
|
170
170
|
const [, owner, repo, ref, subpath] = githubTreeWithPathMatch;
|
|
171
171
|
return {
|
|
172
172
|
type: "github",
|
|
173
|
-
url:
|
|
173
|
+
url: `https://github.com/${owner}/${repo}.git`,
|
|
174
174
|
ref: ref || fragmentRef,
|
|
175
175
|
subpath: subpath ? sanitizeSubpath(subpath) : subpath
|
|
176
176
|
};
|
|
@@ -180,7 +180,7 @@ function parseSource(input) {
|
|
|
180
180
|
const [, owner, repo, ref] = githubTreeMatch;
|
|
181
181
|
return {
|
|
182
182
|
type: "github",
|
|
183
|
-
url:
|
|
183
|
+
url: `https://github.com/${owner}/${repo}.git`,
|
|
184
184
|
ref: ref || fragmentRef
|
|
185
185
|
};
|
|
186
186
|
}
|
|
@@ -928,7 +928,9 @@ async function extractZip(zipPath, targetDir) {
|
|
|
928
928
|
return new Promise((resolve, reject) => {
|
|
929
929
|
const chunks = [];
|
|
930
930
|
const readStream = fs.createReadStream(zipPath);
|
|
931
|
-
readStream.on("data", (chunk) =>
|
|
931
|
+
readStream.on("data", (chunk) => {
|
|
932
|
+
chunks.push(chunk);
|
|
933
|
+
});
|
|
932
934
|
readStream.on("end", () => {
|
|
933
935
|
const buffer = Buffer.concat(chunks);
|
|
934
936
|
try {
|
|
@@ -1153,14 +1155,15 @@ function isAuthFailure(message) {
|
|
|
1153
1155
|
return message.includes("Authentication failed") || message.includes("could not read Username") || message.includes("Permission denied") || message.includes("Repository not found") || message.includes("requested URL returned error: 403") || isGitHubSsoAuthError(message);
|
|
1154
1156
|
}
|
|
1155
1157
|
function createGitClient(extraEnv) {
|
|
1158
|
+
const env = {};
|
|
1159
|
+
for (const [k, v] of Object.entries({
|
|
1160
|
+
...process.env,
|
|
1161
|
+
GIT_TERMINAL_PROMPT: "0",
|
|
1162
|
+
GIT_LFS_SKIP_SMUDGE: "1",
|
|
1163
|
+
...extraEnv
|
|
1164
|
+
})) if (v !== void 0) env[k] = v;
|
|
1156
1165
|
return esm_default({
|
|
1157
1166
|
timeout: { block: CLONE_TIMEOUT_MS },
|
|
1158
|
-
env: {
|
|
1159
|
-
...process.env,
|
|
1160
|
-
GIT_TERMINAL_PROMPT: "0",
|
|
1161
|
-
GIT_LFS_SKIP_SMUDGE: "1",
|
|
1162
|
-
...extraEnv
|
|
1163
|
-
},
|
|
1164
1167
|
config: [
|
|
1165
1168
|
"filter.lfs.required=false",
|
|
1166
1169
|
"filter.lfs.smudge=",
|
|
@@ -1168,7 +1171,7 @@ function createGitClient(extraEnv) {
|
|
|
1168
1171
|
"filter.lfs.process="
|
|
1169
1172
|
],
|
|
1170
1173
|
unsafe: { allowUnsafeFilter: true }
|
|
1171
|
-
});
|
|
1174
|
+
}).env(env);
|
|
1172
1175
|
}
|
|
1173
1176
|
async function resetTempDir(dir) {
|
|
1174
1177
|
await rm(dir, {
|
|
@@ -4008,7 +4011,7 @@ async function runAdd(args, options = {}) {
|
|
|
4008
4011
|
if (successful.length > 0 && installGlobally && (normalizedSource || parsed.type === "skillhub")) {
|
|
4009
4012
|
const successfulSkillNames = new Set(successful.map((r) => r.skill));
|
|
4010
4013
|
let cachedTree;
|
|
4011
|
-
if (parsed.type === "github" && !blobResult) cachedTree = await fetchRepoTree(normalizedSource, parsed.ref, getGitHubToken);
|
|
4014
|
+
if (parsed.type === "github" && !blobResult && normalizedSource) cachedTree = await fetchRepoTree(normalizedSource, parsed.ref, getGitHubToken);
|
|
4012
4015
|
for (const skill of selectedSkills) {
|
|
4013
4016
|
const skillDisplayName = getSkillDisplayName(skill);
|
|
4014
4017
|
if (successfulSkillNames.has(skillDisplayName)) try {
|
|
@@ -5825,7 +5828,7 @@ async function runLogin(args, globalOpts) {
|
|
|
5825
5828
|
name: String(userInfo.displayName || userInfo.name || ""),
|
|
5826
5829
|
handle: String(userInfo.handle || "")
|
|
5827
5830
|
};
|
|
5828
|
-
saveGlobalConfig
|
|
5831
|
+
saveGlobalConfig(config);
|
|
5829
5832
|
console.log(`✓ 已登录为 ${userInfo.displayName || userInfo.name || "Unknown"}`);
|
|
5830
5833
|
console.log(` 注册中心:${registry}`);
|
|
5831
5834
|
} catch (error) {
|
|
@@ -5838,7 +5841,7 @@ async function runLogout() {
|
|
|
5838
5841
|
if (config?.token) {
|
|
5839
5842
|
delete config.token;
|
|
5840
5843
|
delete config.user;
|
|
5841
|
-
saveGlobalConfig
|
|
5844
|
+
saveGlobalConfig(config);
|
|
5842
5845
|
console.log("✓ 已登出");
|
|
5843
5846
|
} else console.log("未登录。");
|
|
5844
5847
|
}
|
|
@@ -7957,11 +7960,15 @@ var YmcApi = class {
|
|
|
7957
7960
|
};
|
|
7958
7961
|
}
|
|
7959
7962
|
};
|
|
7963
|
+
function flagNameOf(token) {
|
|
7964
|
+
const eq = token.indexOf("=");
|
|
7965
|
+
return eq === -1 ? token : token.slice(0, eq);
|
|
7966
|
+
}
|
|
7960
7967
|
function opt(args, ...names) {
|
|
7961
7968
|
for (const name of names) {
|
|
7962
7969
|
const idx = args.indexOf(name);
|
|
7963
7970
|
if (idx !== -1 && idx + 1 < args.length) return args[idx + 1];
|
|
7964
|
-
const eq = args.find((a) => a.
|
|
7971
|
+
const eq = args.find((a) => a.includes("=") && flagNameOf(a) === name);
|
|
7965
7972
|
if (eq) return eq.slice(name.length + 1);
|
|
7966
7973
|
}
|
|
7967
7974
|
}
|
|
@@ -8015,6 +8022,192 @@ function timeError(t) {
|
|
|
8015
8022
|
if (!TIME_RE.test(t)) return `时间简写无效:收到 '${t}'\n合法格式:<N><单位>,单位 m(分)/h(时)/d(天)/w(周),如 10m/2h/3d/4w\n精确窗口:--start-time "yyyy-MM-dd HH:mm:ss" --end-time 同格式(北京时间)`;
|
|
8016
8023
|
return null;
|
|
8017
8024
|
}
|
|
8025
|
+
const COMMON_FLAGS = [
|
|
8026
|
+
"--json",
|
|
8027
|
+
"--dry-run",
|
|
8028
|
+
"--help",
|
|
8029
|
+
"-h",
|
|
8030
|
+
"--token",
|
|
8031
|
+
"--registry",
|
|
8032
|
+
"--namespace"
|
|
8033
|
+
];
|
|
8034
|
+
const F_ENV = [
|
|
8035
|
+
"-e",
|
|
8036
|
+
"--env",
|
|
8037
|
+
"--env-name"
|
|
8038
|
+
];
|
|
8039
|
+
const F_TIME = ["-t", "--time"];
|
|
8040
|
+
const F_RANGE = [
|
|
8041
|
+
"-t",
|
|
8042
|
+
"--time",
|
|
8043
|
+
"--start-time",
|
|
8044
|
+
"--end-time"
|
|
8045
|
+
];
|
|
8046
|
+
const ALLOWED_FLAGS = {
|
|
8047
|
+
status: [],
|
|
8048
|
+
trace: [...F_ENV, "--ts"],
|
|
8049
|
+
chain: [...F_ENV, "--ts"],
|
|
8050
|
+
"sls-raw": [
|
|
8051
|
+
...F_ENV,
|
|
8052
|
+
...F_RANGE,
|
|
8053
|
+
"--days",
|
|
8054
|
+
"--line",
|
|
8055
|
+
"--offset"
|
|
8056
|
+
],
|
|
8057
|
+
"sls-grep": [
|
|
8058
|
+
...F_ENV,
|
|
8059
|
+
...F_TIME,
|
|
8060
|
+
"--group-by",
|
|
8061
|
+
"--line",
|
|
8062
|
+
"--app"
|
|
8063
|
+
],
|
|
8064
|
+
"sls-logs": [...F_ENV, "--ts"],
|
|
8065
|
+
slowsql: [
|
|
8066
|
+
...F_ENV,
|
|
8067
|
+
...F_RANGE,
|
|
8068
|
+
"--sql-str",
|
|
8069
|
+
"--md5",
|
|
8070
|
+
"--trace-id",
|
|
8071
|
+
"--app",
|
|
8072
|
+
"--no-profiler",
|
|
8073
|
+
"--page",
|
|
8074
|
+
"--page-size"
|
|
8075
|
+
],
|
|
8076
|
+
slowcall: [
|
|
8077
|
+
...F_ENV,
|
|
8078
|
+
...F_RANGE,
|
|
8079
|
+
"--trace-id",
|
|
8080
|
+
"--app",
|
|
8081
|
+
"--method",
|
|
8082
|
+
"--profiler",
|
|
8083
|
+
"--min-cost",
|
|
8084
|
+
"--page",
|
|
8085
|
+
"--page-size"
|
|
8086
|
+
],
|
|
8087
|
+
exceptions: [
|
|
8088
|
+
...F_ENV,
|
|
8089
|
+
...F_RANGE,
|
|
8090
|
+
"--app"
|
|
8091
|
+
],
|
|
8092
|
+
alerts: [
|
|
8093
|
+
...F_ENV,
|
|
8094
|
+
...F_RANGE,
|
|
8095
|
+
"--level",
|
|
8096
|
+
"--page-size"
|
|
8097
|
+
],
|
|
8098
|
+
"url-stats": [
|
|
8099
|
+
...F_ENV,
|
|
8100
|
+
...F_RANGE,
|
|
8101
|
+
"--app"
|
|
8102
|
+
],
|
|
8103
|
+
ingress: [
|
|
8104
|
+
...F_ENV,
|
|
8105
|
+
...F_RANGE,
|
|
8106
|
+
"--app",
|
|
8107
|
+
"--exact",
|
|
8108
|
+
"--size",
|
|
8109
|
+
"--trace-id",
|
|
8110
|
+
"--uri"
|
|
8111
|
+
],
|
|
8112
|
+
"dump-list": [
|
|
8113
|
+
...F_ENV,
|
|
8114
|
+
...F_RANGE,
|
|
8115
|
+
"--app",
|
|
8116
|
+
"--type"
|
|
8117
|
+
],
|
|
8118
|
+
cases: [
|
|
8119
|
+
"--type",
|
|
8120
|
+
"--finger",
|
|
8121
|
+
"--service",
|
|
8122
|
+
"--kw",
|
|
8123
|
+
"--limit",
|
|
8124
|
+
"--file",
|
|
8125
|
+
"--env",
|
|
8126
|
+
"--confidence",
|
|
8127
|
+
"--title"
|
|
8128
|
+
],
|
|
8129
|
+
wiki: [
|
|
8130
|
+
"--limit",
|
|
8131
|
+
"--source",
|
|
8132
|
+
"--titles"
|
|
8133
|
+
],
|
|
8134
|
+
callstat: [
|
|
8135
|
+
...F_ENV,
|
|
8136
|
+
...F_RANGE,
|
|
8137
|
+
"--app",
|
|
8138
|
+
"--page",
|
|
8139
|
+
"--page-size"
|
|
8140
|
+
],
|
|
8141
|
+
sqlstat: [
|
|
8142
|
+
...F_ENV,
|
|
8143
|
+
...F_RANGE,
|
|
8144
|
+
"--app",
|
|
8145
|
+
"--page",
|
|
8146
|
+
"--page-size"
|
|
8147
|
+
],
|
|
8148
|
+
events: [
|
|
8149
|
+
...F_ENV,
|
|
8150
|
+
"--app",
|
|
8151
|
+
"--start-time",
|
|
8152
|
+
"--end-time",
|
|
8153
|
+
"--histogram",
|
|
8154
|
+
"--page",
|
|
8155
|
+
"--page-size",
|
|
8156
|
+
"--pipeline",
|
|
8157
|
+
"--type"
|
|
8158
|
+
],
|
|
8159
|
+
"log-url": [
|
|
8160
|
+
...F_ENV,
|
|
8161
|
+
"--app",
|
|
8162
|
+
"--filter-app",
|
|
8163
|
+
"--type"
|
|
8164
|
+
],
|
|
8165
|
+
"sample-list": [...F_ENV, ...F_RANGE],
|
|
8166
|
+
rca: [
|
|
8167
|
+
...F_ENV,
|
|
8168
|
+
...F_RANGE,
|
|
8169
|
+
"--app",
|
|
8170
|
+
"--app-code"
|
|
8171
|
+
],
|
|
8172
|
+
"bpr-download": [
|
|
8173
|
+
...F_ENV,
|
|
8174
|
+
"--out",
|
|
8175
|
+
"-o"
|
|
8176
|
+
],
|
|
8177
|
+
"tool-download": [
|
|
8178
|
+
...F_ENV,
|
|
8179
|
+
"--out",
|
|
8180
|
+
"-o"
|
|
8181
|
+
],
|
|
8182
|
+
call: [
|
|
8183
|
+
...F_ENV,
|
|
8184
|
+
...F_RANGE,
|
|
8185
|
+
"--data",
|
|
8186
|
+
"--timeout"
|
|
8187
|
+
]
|
|
8188
|
+
};
|
|
8189
|
+
const SUBCOMMAND_HINTS = {
|
|
8190
|
+
"db-tenant-locate": "租户定位在 db 命令组:bfi db tenant-locate <租户编码>",
|
|
8191
|
+
"tenant-locate": "租户定位在 db 命令组:bfi db tenant-locate <租户编码>",
|
|
8192
|
+
"tool-start": "call 透传路由:bfi ymc call action/tool/start --data '{\"type\":1,...}'",
|
|
8193
|
+
"eventHistograms": "call 透传路由:bfi ymc call eventHistograms ...(无同名子命令)",
|
|
8194
|
+
"exceptionDetail": "call 透传路由:bfi ymc call exceptionDetail ...(无同名子命令)",
|
|
8195
|
+
"app-list": "该端点无查询参数且不支持按服务过滤(列表型导航端点);appId 用推导式 <env>-<appCode>",
|
|
8196
|
+
"warningSqlstat": "用子命令:bfi ymc sqlstat",
|
|
8197
|
+
"warningCallstat": "用子命令:bfi ymc callstat"
|
|
8198
|
+
};
|
|
8199
|
+
function assertKnownFlags(sub, rest) {
|
|
8200
|
+
const allowed = /* @__PURE__ */ new Set([...COMMON_FLAGS, ...ALLOWED_FLAGS[sub] ?? []]);
|
|
8201
|
+
for (const a of rest) {
|
|
8202
|
+
if (!a.startsWith("-")) continue;
|
|
8203
|
+
const key = flagNameOf(a);
|
|
8204
|
+
if (allowed.has(key)) continue;
|
|
8205
|
+
console.error(`未知参数:${key}(bfi ymc ${sub} 不支持)`);
|
|
8206
|
+
console.error(`本命令支持:${[...allowed].join(" / ")}`);
|
|
8207
|
+
console.error(`查看用法:bfi ymc help ${sub}`);
|
|
8208
|
+
process.exit(1);
|
|
8209
|
+
}
|
|
8210
|
+
}
|
|
8018
8211
|
function requireEnv(args) {
|
|
8019
8212
|
const env = opt(args, "-e", "--env", "--env-name");
|
|
8020
8213
|
const err = envError(env);
|
|
@@ -8063,6 +8256,21 @@ function rowsSummary(label) {
|
|
|
8063
8256
|
return `✓ ${label}: ${Array.isArray(rows) ? rows.length : 0} 条`;
|
|
8064
8257
|
};
|
|
8065
8258
|
}
|
|
8259
|
+
function aggSummary(label) {
|
|
8260
|
+
return (data) => {
|
|
8261
|
+
const d = data;
|
|
8262
|
+
const rows = d.rows ?? d;
|
|
8263
|
+
if (!Array.isArray(rows) || !rows.length) return `✓ ${label}: 0 组`;
|
|
8264
|
+
const countCol = [
|
|
8265
|
+
"count",
|
|
8266
|
+
"cnt",
|
|
8267
|
+
"COUNT(*)",
|
|
8268
|
+
"c"
|
|
8269
|
+
].find((k) => rows.every((r) => r[k] !== void 0));
|
|
8270
|
+
const total = countCol ? rows.reduce((acc, r) => acc + (Number(r[countCol]) || 0), 0) : NaN;
|
|
8271
|
+
return Number.isFinite(total) ? `✓ ${label}: ${rows.length} 组 / 总计 ${total} 条` : `✓ ${label}: ${rows.length} 组`;
|
|
8272
|
+
};
|
|
8273
|
+
}
|
|
8066
8274
|
async function runYmc(args, globalOpts) {
|
|
8067
8275
|
const sub = args[0];
|
|
8068
8276
|
const rest = args.slice(1);
|
|
@@ -8086,6 +8294,7 @@ async function runYmc(args, globalOpts) {
|
|
|
8086
8294
|
printCommandHelp(sub);
|
|
8087
8295
|
return;
|
|
8088
8296
|
}
|
|
8297
|
+
if (ALLOWED_FLAGS[sub]) assertKnownFlags(sub, rest);
|
|
8089
8298
|
if (!dryRun) requireToken(api);
|
|
8090
8299
|
switch (sub) {
|
|
8091
8300
|
case "status":
|
|
@@ -8194,20 +8403,24 @@ async function runYmc(args, globalOpts) {
|
|
|
8194
8403
|
case "sls-grep": {
|
|
8195
8404
|
const kw = positionals(rest)[0];
|
|
8196
8405
|
if (!kw) {
|
|
8197
|
-
console.error("用法:bfi ymc sls-grep \"<关键词>\" -e <env> [-t time] [--group-by applicationName|message|requestURL]");
|
|
8406
|
+
console.error("用法:bfi ymc sls-grep \"<关键词>\" -e <env> [-t time] [--app <appCode>] [--group-by applicationName|message|requestURL]");
|
|
8198
8407
|
console.error("例:bfi ymc sls-grep \"ClassCastException\" -e daily -t 3d");
|
|
8408
|
+
console.error("⚠️ 关键词按「整值」匹配:类名/全限定异常名必须整串加引号");
|
|
8409
|
+
console.error(" (\"java.lang.OutOfMemoryError\" 命中;简写 \"OutOfMemoryError\" 恒 0 且不报错)——sls-discipline §3");
|
|
8199
8410
|
console.error("⚠️ 输出为聚合统计行(每组计数,计数上限 100,可能被封顶)——非明细。");
|
|
8200
8411
|
console.error(" 需要真实条数/明细/精确时间窗时改用 sls-raw + GROUP BY + --start-time/--end-time");
|
|
8201
8412
|
process.exit(1);
|
|
8202
8413
|
}
|
|
8203
8414
|
const groupBy = opt(rest, "--group-by") || "applicationName";
|
|
8204
|
-
const
|
|
8415
|
+
const safe = kw.replace(/"/g, "");
|
|
8416
|
+
const app = opt(rest, "--app");
|
|
8417
|
+
const query = `${app ? `applicationname: ${app} AND "${safe}"` : `"${safe}"`} | SELECT ${groupBy}, count(*) AS count GROUP BY ${groupBy} ORDER BY count DESC`;
|
|
8205
8418
|
emit(await api.call("sls/raw", {
|
|
8206
8419
|
query,
|
|
8207
8420
|
...requireEnv(rest),
|
|
8208
8421
|
...timeOf(rest, false),
|
|
8209
8422
|
line: Number(opt(rest, "--line") || 50)
|
|
8210
|
-
}), jsonMode,
|
|
8423
|
+
}), jsonMode, aggSummary(`SLS 全文检索 "${kw}"`));
|
|
8211
8424
|
break;
|
|
8212
8425
|
}
|
|
8213
8426
|
case "sls-logs": {
|
|
@@ -8527,6 +8740,7 @@ async function runYmc(args, globalOpts) {
|
|
|
8527
8740
|
emit(await api.call("ymc/warningCallstat", {
|
|
8528
8741
|
...requireEnv(rest),
|
|
8529
8742
|
...timeOpts(rest),
|
|
8743
|
+
curAppCode: opt(rest, "--app") || "",
|
|
8530
8744
|
page: Number(opt(rest, "--page") || 1),
|
|
8531
8745
|
pageSize: Number(opt(rest, "--page-size") || 20)
|
|
8532
8746
|
}), jsonMode, rowsSummary("慢调用统计"));
|
|
@@ -8535,6 +8749,7 @@ async function runYmc(args, globalOpts) {
|
|
|
8535
8749
|
emit(await api.call("ymc/warningSqlstat", {
|
|
8536
8750
|
...requireEnv(rest),
|
|
8537
8751
|
...timeOpts(rest),
|
|
8752
|
+
curAppCode: opt(rest, "--app") || "",
|
|
8538
8753
|
page: Number(opt(rest, "--page") || 1),
|
|
8539
8754
|
pageSize: Number(opt(rest, "--page-size") || 20)
|
|
8540
8755
|
}), jsonMode, rowsSummary("慢 SQL 统计"));
|
|
@@ -8650,10 +8865,13 @@ async function runYmc(args, globalOpts) {
|
|
|
8650
8865
|
}, timeoutMs), jsonMode);
|
|
8651
8866
|
break;
|
|
8652
8867
|
}
|
|
8653
|
-
default:
|
|
8868
|
+
default: {
|
|
8654
8869
|
console.error(`未知子命令:${sub}`);
|
|
8870
|
+
const hint = SUBCOMMAND_HINTS[sub];
|
|
8871
|
+
if (hint) console.error(`提示:${hint}`);
|
|
8655
8872
|
printHelp$3();
|
|
8656
8873
|
process.exit(1);
|
|
8874
|
+
}
|
|
8657
8875
|
}
|
|
8658
8876
|
}
|
|
8659
8877
|
const HELP = {
|
|
@@ -8689,8 +8907,11 @@ const HELP = {
|
|
|
8689
8907
|
bfi ymc sls-raw 'applicationname: yonbip-scm-scmmp AND "unaudit" | SELECT traceid, time LIMIT 10' -e core3 -t 1d
|
|
8690
8908
|
注意:业务关键词检索必须 applicationname: 限定目标服务(共享路径 URL 全平台都有);
|
|
8691
8909
|
traceid/spanid 检索例外(全局唯一)。非索引字段(logger/requesturl)不能进检索语法,只能在 SELECT 里引用。`,
|
|
8692
|
-
"sls-grep": `bfi ymc sls-grep "<关键词>" -e <env> -t <time> [--json]
|
|
8693
|
-
SLS 全文检索聚合(每组计数精确不封顶;组数上限 500——实测 2026-09-17:计数不受限,仅组数受 SLS 默认 LIMIT
|
|
8910
|
+
"sls-grep": `bfi ymc sls-grep "<关键词>" -e <env> -t <time> [--app <appCode>] [--group-by <字段>] [--json]
|
|
8911
|
+
SLS 全文检索聚合(每组计数精确不封顶;组数上限 500——实测 2026-09-17:计数不受限,仅组数受 SLS 默认 LIMIT 约束,服务端已放宽)。
|
|
8912
|
+
⚠️ 关键词按「整值」匹配:类名/全限定异常名必须整串加引号
|
|
8913
|
+
("java.lang.OutOfMemoryError" 命中;简写 "OutOfMemoryError" 恒 0 命中且不报错)——sls-discipline §3
|
|
8914
|
+
--app <appCode> 裸微服务名,前置 applicationname 限定(不限服务的检索会命中不相干服务)`,
|
|
8694
8915
|
slowsql: `bfi ymc slowsql -t <time> -e <env> [--sql-str <表名或片段>] [--md5 <指纹>] [--trace-id <id>] [--app <appCode>] [--no-profiler] [--page N] [--page-size N] [--json]
|
|
8695
8916
|
慢 SQL 告警明细(耗时降序;摘要含 服务/耗时/行数/SQL 前段/指纹/调用栈首帧)。
|
|
8696
8917
|
参数:
|
|
@@ -8775,8 +8996,12 @@ const HELP = {
|
|
|
8775
8996
|
完整清单与参数声明:curl https://bfi.yyuap.com/bfi-api/openapi.json 或 /docs(Swagger UI)。
|
|
8776
8997
|
时间参数(-t/--start-time/--end-time)由服务端按端点 time_fields 展开为 beginTs/endTs 等——
|
|
8777
8998
|
禁止在 --data JSON 里手传 start/end/start_time(数字 422、字符串被忽略返回空)。
|
|
8778
|
-
⚠️ app/history、jvm/history 等资源端点的 appId 必须带环境前缀(如 stage-dc-core1-<appCode
|
|
8779
|
-
|
|
8999
|
+
⚠️ app/history、jvm/history 等资源端点的 appId 必须带环境前缀(如 stage-dc-core1-<appCode>)
|
|
9000
|
+
—— 由环境别名**直接推导**:appId = <env 对应的前缀>-<appCode>(core1→stage-dc-core1-、
|
|
9001
|
+
core4→online-dc-core4-),无需查接口。
|
|
9002
|
+
⛔ 不要用 bfi ymc call app/list 查 appCode:该端点无查询参数、不支持 keyword 过滤
|
|
9003
|
+
(传了被上游静默忽略,只返回本用户可访问的应用,非全量目录)。
|
|
9004
|
+
CLI 的 --app 参数则传裸 appCode。
|
|
8780
9005
|
数据可能为空(覆盖不全)——一次空即换通道,不做参数变体重试。
|
|
8781
9006
|
示例:
|
|
8782
9007
|
bfi ymc call warningCallstat --data '{"curAppCode":"yonbip-scm-scmmp","page":1,"pageSize":10}' -e core3 -t 1h
|
|
@@ -54,9 +54,9 @@ var BcsRemote = class {
|
|
|
54
54
|
name: "bfi-codesearch-mcp",
|
|
55
55
|
version: "0.1.0"
|
|
56
56
|
});
|
|
57
|
-
const transport = new StreamableHTTPClientTransport(this.url, {
|
|
57
|
+
const transport = new StreamableHTTPClientTransport(new URL(this.url), {
|
|
58
58
|
requestInit: { headers: { Authorization: `Bearer ${token}` } },
|
|
59
|
-
fetchImpl: this.fetchImpl
|
|
59
|
+
...this.fetchImpl ? { fetch: this.fetchImpl } : {}
|
|
60
60
|
});
|
|
61
61
|
try {
|
|
62
62
|
await client.connect(transport);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bfi-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.94",
|
|
4
4
|
"description": "用友大业财BFI统一命令行工具,支持技能,技能包,元数据,UI元数据等",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"build": "obuild",
|
|
19
19
|
"dev": "node src/cli.ts",
|
|
20
20
|
"test": "vitest",
|
|
21
|
-
"type-check": "tsc
|
|
21
|
+
"type-check": "tsc -p tsconfig.check.json",
|
|
22
22
|
"format": "prettier --write \"src/**/*.ts\"",
|
|
23
23
|
"format:check": "prettier --check \"src/**/*.ts\"",
|
|
24
24
|
"prepublishOnly": "npm run build"
|