bfi-cli 0.1.86 → 0.1.87

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.
Files changed (2) hide show
  1. package/dist/cli.mjs +70 -7
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -8307,12 +8307,12 @@ async function runYmc(args, globalOpts) {
8307
8307
  const token = globalOpts.token;
8308
8308
  const api = new YmcApi(token ?? null, void 0, dryRun);
8309
8309
  if (!sub || sub === "--help" || sub === "-h") {
8310
- printHelp$2();
8310
+ printHelp$3();
8311
8311
  return;
8312
8312
  }
8313
8313
  if (sub === "help") {
8314
8314
  if (!rest[0]) {
8315
- printHelp$2();
8315
+ printHelp$3();
8316
8316
  return;
8317
8317
  }
8318
8318
  printCommandHelp(rest[0]);
@@ -8888,7 +8888,7 @@ async function runYmc(args, globalOpts) {
8888
8888
  }
8889
8889
  default:
8890
8890
  console.error(`未知子命令:${sub}`);
8891
- printHelp$2();
8891
+ printHelp$3();
8892
8892
  process.exit(1);
8893
8893
  }
8894
8894
  }
@@ -9023,11 +9023,11 @@ function printCommandHelp(cmd) {
9023
9023
  if (h) console.log(h);
9024
9024
  else {
9025
9025
  console.error(`未知子命令:${cmd}`);
9026
- printHelp$2();
9026
+ printHelp$3();
9027
9027
  process.exit(1);
9028
9028
  }
9029
9029
  }
9030
- function printHelp$2() {
9030
+ function printHelp$3() {
9031
9031
  console.log(`
9032
9032
  bfi ymc — 观测查询(v2 API:YMC/Kibana/SLS/trace)
9033
9033
 
@@ -9082,7 +9082,7 @@ const RESOURCES = [
9082
9082
  "type-info",
9083
9083
  "listener-doc"
9084
9084
  ];
9085
- function printHelp$1() {
9085
+ function printHelp$2() {
9086
9086
  console.log(`bfi event — YonBIP 事件中心取数(诊断编排见 bfi-diagnose-event 技能)
9087
9087
 
9088
9088
  用法:
@@ -9119,7 +9119,7 @@ async function runEvent(args, globalOpts) {
9119
9119
  const sub = args[0];
9120
9120
  const rest = args.slice(1);
9121
9121
  if (!sub || sub === "--help" || sub === "-h" || flag(rest, "--help") || flag(rest, "-h")) {
9122
- printHelp$1();
9122
+ printHelp$2();
9123
9123
  return;
9124
9124
  }
9125
9125
  const jsonMode = flag(rest, "--json");
@@ -9290,6 +9290,66 @@ async function runEvent(args, globalOpts) {
9290
9290
  console.error(`未知子命令: ${sub}。运行 bfi event --help`);
9291
9291
  process.exit(1);
9292
9292
  }
9293
+ function printHelp$1() {
9294
+ console.log(`bfi ms — 微服务→仓库映射(诊断中把微服务编码可靠地转换为仓库列表)
9295
+
9296
+ 用法:
9297
+ bfi ms <微服务编码> # 精确/模糊查询(精确匹配行排前)
9298
+ bfi ms --keyword <名称关键词> # 按微服务中文名模糊查询
9299
+ 全局: --json / --dry-run / --token <tok>
9300
+
9301
+ 输出: 每个微服务的 code/名称/类型/部门/负责人/Jira 项目 + repos 列表
9302
+ (repo 字段可直接作为 bfi-code-search context 的 repo 参数;
9303
+ 与 BCS list_repos 名单核对,个别仓为 org__repo 形态时用备选值)
9304
+
9305
+ 示例:
9306
+ bfi ms yonbip-scm-stock
9307
+ bfi ms --keyword 库存
9308
+
9309
+ 提示: 事件监听的 microServiceCode 字段 / 异常栈的包名线索都可用本命令反查仓库。`);
9310
+ }
9311
+ async function runMs(args, globalOpts) {
9312
+ const rest = args;
9313
+ if (!args[0] || flag(rest, "--help") || flag(rest, "-h")) {
9314
+ printHelp$1();
9315
+ return;
9316
+ }
9317
+ const jsonMode = flag(rest, "--json");
9318
+ const dryRun = flag(rest, "--dry-run");
9319
+ const api = new YmcApi(globalOpts.token ?? null, void 0, dryRun);
9320
+ if (!dryRun && !api.token) {
9321
+ console.error("未认证。先运行:bfi auth login --token <sk-token>(或传 --token)");
9322
+ process.exit(1);
9323
+ }
9324
+ const keyword = opt(rest, "--keyword");
9325
+ const code = keyword ? "" : positionals(rest)[0] ?? "";
9326
+ if (!code && !keyword) {
9327
+ console.error("缺少微服务编码或 --keyword。运行 bfi ms --help 查看用法。");
9328
+ process.exit(1);
9329
+ }
9330
+ const body = {
9331
+ code,
9332
+ name: keyword ?? "",
9333
+ use_status: opt(rest, "--use-status") ?? "1",
9334
+ page: Number(opt(rest, "--page") ?? 1),
9335
+ size: Number(opt(rest, "--size") ?? 20)
9336
+ };
9337
+ emit(await api.call("code/microservice", body), jsonMode, (data) => {
9338
+ const d = data;
9339
+ const rows = d.rows ?? [];
9340
+ if (!rows.length) return `无匹配微服务(total=${d.total ?? 0})`;
9341
+ return rows.map((r) => {
9342
+ const repos = r.repos ?? [];
9343
+ const repoLines = repos.map((x) => ` - ${x.repo}${x.repo_qualified && x.repo_qualified !== x.repo ? ` (备选: ${x.repo_qualified})` : ""} (${x.git_url}${x.branch ? ` @${x.branch}` : ""})`).join("\n");
9344
+ return [
9345
+ `${r.code} ${r.name} [${r.type || "-"}]`,
9346
+ ` 部门: ${r.department || "-"} | 开发: ${r.developer_name || "-"} | 架构: ${r.architect_name || "-"} | Jira: ${r.jira_project_name || "-"}`,
9347
+ ` 仓库(${repos.length}):`,
9348
+ repoLines || " (无 git 地址)"
9349
+ ].join("\n");
9350
+ }).join("\n\n");
9351
+ });
9352
+ }
9293
9353
  async function runDb(args, globalOpts) {
9294
9354
  const sub = args[0];
9295
9355
  const rest = args.slice(1);
@@ -10019,6 +10079,9 @@ async function main() {
10019
10079
  case "event":
10020
10080
  await runEvent(restArgs, globalOpts);
10021
10081
  break;
10082
+ case "ms":
10083
+ await runMs(restArgs, globalOpts);
10084
+ break;
10022
10085
  case "db":
10023
10086
  await runDb(restArgs, globalOpts);
10024
10087
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bfi-cli",
3
- "version": "0.1.86",
3
+ "version": "0.1.87",
4
4
  "description": "用友大业财BFI统一命令行工具,支持技能,技能包,元数据,UI元数据等",
5
5
  "type": "module",
6
6
  "bin": {