bfi-cli 0.1.91 → 0.1.93
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 +218 -28
- package/dist/mcp-codesearch/main.mjs +3 -3
- package/dist/mcp-db/main.mjs +1 -1
- 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
|
}
|
|
@@ -7159,7 +7162,6 @@ async function handleInstall(args, api, globalOpts) {
|
|
|
7159
7162
|
console.error(`${RED$1}获取包信息失败:${error.message}${RESET$3}`);
|
|
7160
7163
|
process.exit(1);
|
|
7161
7164
|
}
|
|
7162
|
-
if (pkgInfo.kind === "PLUGIN") throw new Error("这是完整插件,不是技能组合;请使用 --as plugin --agent <目标Agent> 安装,插件可能包含 MCP 和 Hooks。");
|
|
7163
7165
|
const skills = pkgInfo.skills || [];
|
|
7164
7166
|
if (skills.length === 0) {
|
|
7165
7167
|
console.log(`${YELLOW$1}包中没有可独立安装的技能。${RESET$3}`);
|
|
@@ -7482,9 +7484,7 @@ async function handleUpdate(args, api, globalOpts) {
|
|
|
7482
7484
|
console.log(`${DIM$3}正在更新 ${packagesToUpdate.length} 个包...${RESET$3}`);
|
|
7483
7485
|
for (const pkg of packagesToUpdate) try {
|
|
7484
7486
|
const pkgInfo = await api.getPackage(pkg.namespace, pkg.slug);
|
|
7485
|
-
const
|
|
7486
|
-
if (info.kind === "PLUGIN") throw new Error("这是完整插件,请使用 --as plugin --agent <目标Agent> 更新;不会按技能组合安装。");
|
|
7487
|
-
const skills = info.skills || [];
|
|
7487
|
+
const skills = (pkgInfo.data || pkgInfo).skills || [];
|
|
7488
7488
|
console.log(` ${DIM$3}更新 @${pkg.namespace}/${pkg.slug}(${skills.length} 个技能)...${RESET$3}`);
|
|
7489
7489
|
for (const skill of skills) {
|
|
7490
7490
|
const skillRef = skill.namespace ? `@${skill.namespace}/${skill.slug}` : skill.slug;
|
|
@@ -7828,7 +7828,7 @@ async function runInstall(args, globalOpts) {
|
|
|
7828
7828
|
if (failedCount > 0) console.log(`${YELLOW}⚠ ${failedCount} 项恢复失败${RESET$1}`);
|
|
7829
7829
|
console.log();
|
|
7830
7830
|
}
|
|
7831
|
-
const YMC_DEFAULT_BASE = process.env.BFI_YMC_BASE || "
|
|
7831
|
+
const YMC_DEFAULT_BASE = process.env.BFI_YMC_BASE || "https://bfi.yyuap.com/bfi-api/bficli/api/v2";
|
|
7832
7832
|
var YmcApi = class {
|
|
7833
7833
|
baseUrl;
|
|
7834
7834
|
token;
|
|
@@ -7960,11 +7960,15 @@ var YmcApi = class {
|
|
|
7960
7960
|
};
|
|
7961
7961
|
}
|
|
7962
7962
|
};
|
|
7963
|
+
function flagNameOf(token) {
|
|
7964
|
+
const eq = token.indexOf("=");
|
|
7965
|
+
return eq === -1 ? token : token.slice(0, eq);
|
|
7966
|
+
}
|
|
7963
7967
|
function opt(args, ...names) {
|
|
7964
7968
|
for (const name of names) {
|
|
7965
7969
|
const idx = args.indexOf(name);
|
|
7966
7970
|
if (idx !== -1 && idx + 1 < args.length) return args[idx + 1];
|
|
7967
|
-
const eq = args.find((a) => a.
|
|
7971
|
+
const eq = args.find((a) => a.includes("=") && flagNameOf(a) === name);
|
|
7968
7972
|
if (eq) return eq.slice(name.length + 1);
|
|
7969
7973
|
}
|
|
7970
7974
|
}
|
|
@@ -8018,6 +8022,180 @@ function timeError(t) {
|
|
|
8018
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 同格式(北京时间)`;
|
|
8019
8023
|
return null;
|
|
8020
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
|
+
"--page",
|
|
8138
|
+
"--page-size"
|
|
8139
|
+
],
|
|
8140
|
+
sqlstat: [
|
|
8141
|
+
...F_ENV,
|
|
8142
|
+
...F_RANGE,
|
|
8143
|
+
"--page",
|
|
8144
|
+
"--page-size"
|
|
8145
|
+
],
|
|
8146
|
+
events: [
|
|
8147
|
+
...F_ENV,
|
|
8148
|
+
"--app",
|
|
8149
|
+
"--start-time",
|
|
8150
|
+
"--end-time",
|
|
8151
|
+
"--histogram",
|
|
8152
|
+
"--page",
|
|
8153
|
+
"--page-size",
|
|
8154
|
+
"--pipeline",
|
|
8155
|
+
"--type"
|
|
8156
|
+
],
|
|
8157
|
+
"log-url": [
|
|
8158
|
+
...F_ENV,
|
|
8159
|
+
"--app",
|
|
8160
|
+
"--filter-app",
|
|
8161
|
+
"--type"
|
|
8162
|
+
],
|
|
8163
|
+
"sample-list": [...F_ENV, ...F_RANGE],
|
|
8164
|
+
rca: [
|
|
8165
|
+
...F_ENV,
|
|
8166
|
+
...F_RANGE,
|
|
8167
|
+
"--app",
|
|
8168
|
+
"--app-code"
|
|
8169
|
+
],
|
|
8170
|
+
"bpr-download": [
|
|
8171
|
+
...F_ENV,
|
|
8172
|
+
"--out",
|
|
8173
|
+
"-o"
|
|
8174
|
+
],
|
|
8175
|
+
"tool-download": [
|
|
8176
|
+
...F_ENV,
|
|
8177
|
+
"--out",
|
|
8178
|
+
"-o"
|
|
8179
|
+
],
|
|
8180
|
+
call: [
|
|
8181
|
+
...F_ENV,
|
|
8182
|
+
...F_RANGE,
|
|
8183
|
+
"--data",
|
|
8184
|
+
"--timeout"
|
|
8185
|
+
]
|
|
8186
|
+
};
|
|
8187
|
+
function assertKnownFlags(sub, rest) {
|
|
8188
|
+
const allowed = /* @__PURE__ */ new Set([...COMMON_FLAGS, ...ALLOWED_FLAGS[sub] ?? []]);
|
|
8189
|
+
for (const a of rest) {
|
|
8190
|
+
if (!a.startsWith("-")) continue;
|
|
8191
|
+
const key = flagNameOf(a);
|
|
8192
|
+
if (allowed.has(key)) continue;
|
|
8193
|
+
console.error(`未知参数:${key}(bfi ymc ${sub} 不支持)`);
|
|
8194
|
+
console.error(`本命令支持:${[...allowed].join(" / ")}`);
|
|
8195
|
+
console.error(`查看用法:bfi ymc help ${sub}`);
|
|
8196
|
+
process.exit(1);
|
|
8197
|
+
}
|
|
8198
|
+
}
|
|
8021
8199
|
function requireEnv(args) {
|
|
8022
8200
|
const env = opt(args, "-e", "--env", "--env-name");
|
|
8023
8201
|
const err = envError(env);
|
|
@@ -8089,6 +8267,7 @@ async function runYmc(args, globalOpts) {
|
|
|
8089
8267
|
printCommandHelp(sub);
|
|
8090
8268
|
return;
|
|
8091
8269
|
}
|
|
8270
|
+
if (ALLOWED_FLAGS[sub]) assertKnownFlags(sub, rest);
|
|
8092
8271
|
if (!dryRun) requireToken(api);
|
|
8093
8272
|
switch (sub) {
|
|
8094
8273
|
case "status":
|
|
@@ -8197,14 +8376,18 @@ async function runYmc(args, globalOpts) {
|
|
|
8197
8376
|
case "sls-grep": {
|
|
8198
8377
|
const kw = positionals(rest)[0];
|
|
8199
8378
|
if (!kw) {
|
|
8200
|
-
console.error("用法:bfi ymc sls-grep \"<关键词>\" -e <env> [-t time] [--group-by applicationName|message|requestURL]");
|
|
8379
|
+
console.error("用法:bfi ymc sls-grep \"<关键词>\" -e <env> [-t time] [--app <appCode>] [--group-by applicationName|message|requestURL]");
|
|
8201
8380
|
console.error("例:bfi ymc sls-grep \"ClassCastException\" -e daily -t 3d");
|
|
8381
|
+
console.error("⚠️ 关键词按「整值」匹配:类名/全限定异常名必须整串加引号");
|
|
8382
|
+
console.error(" (\"java.lang.OutOfMemoryError\" 命中;简写 \"OutOfMemoryError\" 恒 0 且不报错)——sls-discipline §3");
|
|
8202
8383
|
console.error("⚠️ 输出为聚合统计行(每组计数,计数上限 100,可能被封顶)——非明细。");
|
|
8203
8384
|
console.error(" 需要真实条数/明细/精确时间窗时改用 sls-raw + GROUP BY + --start-time/--end-time");
|
|
8204
8385
|
process.exit(1);
|
|
8205
8386
|
}
|
|
8206
8387
|
const groupBy = opt(rest, "--group-by") || "applicationName";
|
|
8207
|
-
const
|
|
8388
|
+
const safe = kw.replace(/"/g, "");
|
|
8389
|
+
const app = opt(rest, "--app");
|
|
8390
|
+
const query = `${app ? `applicationname: ${app} AND "${safe}"` : `"${safe}"`} | SELECT ${groupBy}, count(*) AS count GROUP BY ${groupBy} ORDER BY count DESC`;
|
|
8208
8391
|
emit(await api.call("sls/raw", {
|
|
8209
8392
|
query,
|
|
8210
8393
|
...requireEnv(rest),
|
|
@@ -8634,7 +8817,7 @@ async function runYmc(args, globalOpts) {
|
|
|
8634
8817
|
if (!route) {
|
|
8635
8818
|
console.error("用法:bfi ymc call <route> -e <env> [--data '{\"k\":\"v\"}'] [--timeout 秒] [-t time | --start-time <s> --end-time <e>]");
|
|
8636
8819
|
console.error("route 例:warningCall/warningSql/exceptionHistory/bpr/list/alert/detail/uba/query/tool/list/environment ...");
|
|
8637
|
-
console.error("完整清单见
|
|
8820
|
+
console.error("完整清单见 https://bfi.yyuap.com/bfi-api/docs");
|
|
8638
8821
|
process.exit(1);
|
|
8639
8822
|
}
|
|
8640
8823
|
let extra;
|
|
@@ -8692,8 +8875,11 @@ const HELP = {
|
|
|
8692
8875
|
bfi ymc sls-raw 'applicationname: yonbip-scm-scmmp AND "unaudit" | SELECT traceid, time LIMIT 10' -e core3 -t 1d
|
|
8693
8876
|
注意:业务关键词检索必须 applicationname: 限定目标服务(共享路径 URL 全平台都有);
|
|
8694
8877
|
traceid/spanid 检索例外(全局唯一)。非索引字段(logger/requesturl)不能进检索语法,只能在 SELECT 里引用。`,
|
|
8695
|
-
"sls-grep": `bfi ymc sls-grep "<关键词>" -e <env> -t <time> [--json]
|
|
8696
|
-
SLS 全文检索聚合(每组计数精确不封顶;组数上限 500——实测 2026-09-17:计数不受限,仅组数受 SLS 默认 LIMIT
|
|
8878
|
+
"sls-grep": `bfi ymc sls-grep "<关键词>" -e <env> -t <time> [--app <appCode>] [--group-by <字段>] [--json]
|
|
8879
|
+
SLS 全文检索聚合(每组计数精确不封顶;组数上限 500——实测 2026-09-17:计数不受限,仅组数受 SLS 默认 LIMIT 约束,服务端已放宽)。
|
|
8880
|
+
⚠️ 关键词按「整值」匹配:类名/全限定异常名必须整串加引号
|
|
8881
|
+
("java.lang.OutOfMemoryError" 命中;简写 "OutOfMemoryError" 恒 0 命中且不报错)——sls-discipline §3
|
|
8882
|
+
--app <appCode> 裸微服务名,前置 applicationname 限定(不限服务的检索会命中不相干服务)`,
|
|
8697
8883
|
slowsql: `bfi ymc slowsql -t <time> -e <env> [--sql-str <表名或片段>] [--md5 <指纹>] [--trace-id <id>] [--app <appCode>] [--no-profiler] [--page N] [--page-size N] [--json]
|
|
8698
8884
|
慢 SQL 告警明细(耗时降序;摘要含 服务/耗时/行数/SQL 前段/指纹/调用栈首帧)。
|
|
8699
8885
|
参数:
|
|
@@ -8775,11 +8961,15 @@ const HELP = {
|
|
|
8775
8961
|
输出默认取文件名部分(monitor/xx.html → xx.html)。`,
|
|
8776
8962
|
call: `bfi ymc call <route> -e <env> [--data '<json>'] [-t <time> | --start-time <s> --end-time <e>] [--timeout <秒>] [--json]
|
|
8777
8963
|
通用透传:覆盖全部注册表端点(warningCall/warningSql/exceptionHistory/bpr/list/alert/detail/tool/list/app/history/environment/uba/query ...)。
|
|
8778
|
-
完整清单与参数声明:curl
|
|
8964
|
+
完整清单与参数声明:curl https://bfi.yyuap.com/bfi-api/openapi.json 或 /docs(Swagger UI)。
|
|
8779
8965
|
时间参数(-t/--start-time/--end-time)由服务端按端点 time_fields 展开为 beginTs/endTs 等——
|
|
8780
8966
|
禁止在 --data JSON 里手传 start/end/start_time(数字 422、字符串被忽略返回空)。
|
|
8781
|
-
⚠️ app/history、jvm/history 等资源端点的 appId 必须带环境前缀(如 stage-dc-core1-<appCode
|
|
8782
|
-
|
|
8967
|
+
⚠️ app/history、jvm/history 等资源端点的 appId 必须带环境前缀(如 stage-dc-core1-<appCode>)
|
|
8968
|
+
—— 由环境别名**直接推导**:appId = <env 对应的前缀>-<appCode>(core1→stage-dc-core1-、
|
|
8969
|
+
core4→online-dc-core4-),无需查接口。
|
|
8970
|
+
⛔ 不要用 bfi ymc call app/list 查 appCode:该端点无查询参数、不支持 keyword 过滤
|
|
8971
|
+
(传了被上游静默忽略,只返回本用户可访问的应用,非全量目录)。
|
|
8972
|
+
CLI 的 --app 参数则传裸 appCode。
|
|
8783
8973
|
数据可能为空(覆盖不全)——一次空即换通道,不做参数变体重试。
|
|
8784
8974
|
示例:
|
|
8785
8975
|
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);
|
|
@@ -91,7 +91,7 @@ function loadGlobalConfig() {
|
|
|
91
91
|
return null;
|
|
92
92
|
}
|
|
93
93
|
function resolveApiBase() {
|
|
94
|
-
return process.env.BFI_API_BASE || "
|
|
94
|
+
return process.env.BFI_API_BASE || "https://bfi.yyuap.com/bfi-api";
|
|
95
95
|
}
|
|
96
96
|
function resolveToken() {
|
|
97
97
|
if (process.env.BFI_TOKEN) return process.env.BFI_TOKEN;
|
package/dist/mcp-db/main.mjs
CHANGED
|
@@ -151,7 +151,7 @@ function loadGlobalConfig() {
|
|
|
151
151
|
return null;
|
|
152
152
|
}
|
|
153
153
|
function resolveApiBase() {
|
|
154
|
-
return process.env.BFI_API_BASE || "
|
|
154
|
+
return process.env.BFI_API_BASE || "https://bfi.yyuap.com/bfi-api";
|
|
155
155
|
}
|
|
156
156
|
function resolveToken() {
|
|
157
157
|
if (process.env.BFI_TOKEN) return process.env.BFI_TOKEN;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bfi-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.93",
|
|
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"
|