@hcmai/cli 0.8.0 → 0.9.0

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/index.js CHANGED
@@ -532,8 +532,8 @@ var init_TerminalRenderer = __esm({
532
532
  }
533
533
  }
534
534
  /** 来源行(仅子代理触发,agentPath ≥2 段时显示 `↑ 来自 a › b`,对齐 Web)。 */
535
- originLine(path14) {
536
- const segs = path14.split(".").filter(Boolean);
535
+ originLine(path15) {
536
+ const segs = path15.split(".").filter(Boolean);
537
537
  if (segs.length < 2) return "";
538
538
  const names = segs.map((k) => agentDisplayName(k));
539
539
  return chalk.gray(` \u2191 \u6765\u81EA ${names.join(" \u203A ")}`) + "\n";
@@ -1715,8 +1715,8 @@ function agentLabel(agentId) {
1715
1715
  if (/^[0-9a-f]{8}-[0-9a-f-]{27}$/i.test(agentId)) return `agent \u2026${agentId.slice(-4)}`;
1716
1716
  return agentDisplayName(agentId);
1717
1717
  }
1718
- function originLine(path14) {
1719
- const segs = (path14 ?? "").split(".").filter(Boolean);
1718
+ function originLine(path15) {
1719
+ const segs = (path15 ?? "").split(".").filter(Boolean);
1720
1720
  if (segs.length < 2) return null;
1721
1721
  return `\u6765\u81EA ${segs.map((k) => agentDisplayName(k)).join(" \u203A ")}`;
1722
1722
  }
@@ -3474,7 +3474,7 @@ function launchBrowser(url, platform = process.platform) {
3474
3474
  child.unref();
3475
3475
  }
3476
3476
  async function runOpen(target, args, deps) {
3477
- const path14 = normalizeTarget(target);
3477
+ const path15 = normalizeTarget(target);
3478
3478
  if (!deps.frontend?.trim()) {
3479
3479
  throw new CliError13({
3480
3480
  code: CliErrorCode12.INVALID_ARGUMENT,
@@ -3482,13 +3482,13 @@ async function runOpen(target, args, deps) {
3482
3482
  });
3483
3483
  }
3484
3484
  const { ticket, expiresIn } = await deps.mintTicket();
3485
- const url = buildBrowserLoginUrl(deps.frontend, ticket, path14);
3485
+ const url = buildBrowserLoginUrl(deps.frontend, ticket, path15);
3486
3486
  if (args.printUrl) {
3487
3487
  deps.write(`${url}
3488
3488
  `);
3489
3489
  } else {
3490
3490
  deps.launch(url);
3491
- deps.write(`\u5DF2\u7528\u5F53\u524D\u8EAB\u4EFD\u6253\u5F00 ${path14}\uFF08\u7968\u636E ${expiresIn ?? 60}s \u5185\u6709\u6548\uFF0C\u53EA\u80FD\u7528\u4E00\u6B21\uFF09
3491
+ deps.write(`\u5DF2\u7528\u5F53\u524D\u8EAB\u4EFD\u6253\u5F00 ${path15}\uFF08\u7968\u636E ${expiresIn ?? 60}s \u5185\u6709\u6548\uFF0C\u53EA\u80FD\u7528\u4E00\u6B21\uFF09
3492
3492
  `);
3493
3493
  }
3494
3494
  return { url, expiresIn };
@@ -3582,8 +3582,8 @@ import {
3582
3582
  formatObject as formatObject7,
3583
3583
  fromAxiosError as fromAxiosError9
3584
3584
  } from "@hcmai/sdk";
3585
- function collectYmlFiles(path14) {
3586
- if (statSync(path14).isFile()) return [path14];
3585
+ function collectYmlFiles(path15) {
3586
+ if (statSync(path15).isFile()) return [path15];
3587
3587
  const out = [];
3588
3588
  const walk = (dir) => {
3589
3589
  for (const name of readdirSync(dir).sort()) {
@@ -3592,7 +3592,7 @@ function collectYmlFiles(path14) {
3592
3592
  else if (full.endsWith(".yml") || full.endsWith(".yaml")) out.push(full);
3593
3593
  }
3594
3594
  };
3595
- walk(path14);
3595
+ walk(path15);
3596
3596
  return out.sort();
3597
3597
  }
3598
3598
  var DRY_RUN_CLIENT = {
@@ -3600,9 +3600,9 @@ var DRY_RUN_CLIENT = {
3600
3600
  create: async () => ({ id: "" }),
3601
3601
  update: async () => ({})
3602
3602
  };
3603
- async function importCommand(path14, args) {
3603
+ async function importCommand(path15, args) {
3604
3604
  try {
3605
- const files = collectYmlFiles(path14);
3605
+ const files = collectYmlFiles(path15);
3606
3606
  const fixtures = files.map(
3607
3607
  (f) => parseFixture(readFileSync2(f, "utf8"), relative(process.cwd(), f))
3608
3608
  );
@@ -3726,29 +3726,29 @@ import {
3726
3726
  import chalk2 from "chalk";
3727
3727
  import * as fs5 from "fs/promises";
3728
3728
  function parseInjectOn(s) {
3729
- const fail7 = (detail) => {
3729
+ const fail8 = (detail) => {
3730
3730
  throw new CliError15({
3731
3731
  code: CliErrorCode14.INVALID_ARGUMENT,
3732
3732
  message: `--inject-on \u683C\u5F0F <eventType>:<action>[:<arg>]\uFF0Caction \u2208 {interrupt, steer}\uFF08steer \u5FC5\u987B\u5E26 content\uFF09\uFF1B${detail}\uFF0C\u6536\u5230 "${s}"`
3733
3733
  });
3734
3734
  };
3735
3735
  const firstColon = s.indexOf(":");
3736
- if (firstColon < 0) return fail7("\u7F3A\u5C11 action \u6BB5");
3736
+ if (firstColon < 0) return fail8("\u7F3A\u5C11 action \u6BB5");
3737
3737
  const eventType = s.slice(0, firstColon);
3738
3738
  const rest = s.slice(firstColon + 1);
3739
3739
  const secondColon = rest.indexOf(":");
3740
3740
  const action = secondColon < 0 ? rest : rest.slice(0, secondColon);
3741
3741
  const arg = secondColon < 0 ? void 0 : rest.slice(secondColon + 1);
3742
- if (!eventType) return fail7("eventType \u6BB5\u4E3A\u7A7A");
3742
+ if (!eventType) return fail8("eventType \u6BB5\u4E3A\u7A7A");
3743
3743
  if (action === "interrupt") {
3744
- if (arg !== void 0) return fail7("interrupt \u4E0D\u63A5\u53D7 arg");
3744
+ if (arg !== void 0) return fail8("interrupt \u4E0D\u63A5\u53D7 arg");
3745
3745
  return { eventType, action: "interrupt" };
3746
3746
  }
3747
3747
  if (action === "steer") {
3748
- if (arg === void 0 || arg === "") return fail7("steer \u5FC5\u987B\u5E26 content\uFF08arg\uFF09");
3748
+ if (arg === void 0 || arg === "") return fail8("steer \u5FC5\u987B\u5E26 content\uFF08arg\uFF09");
3749
3749
  return { eventType, action: "steer", arg };
3750
3750
  }
3751
- return fail7(`\u672A\u77E5 action "${action}"`);
3751
+ return fail8(`\u672A\u77E5 action "${action}"`);
3752
3752
  }
3753
3753
  function parseOnConfirm(s) {
3754
3754
  if (s === "approve") return { decision: "approve" };
@@ -5010,7 +5010,7 @@ async function datapackageInstallCommand(artifactPath, args) {
5010
5010
  }
5011
5011
  const timeoutMs = Math.max(1, Number(args.timeout ?? DEFAULT_INSTALL_WAIT_SECONDS)) * 1e3;
5012
5012
  const showProgress = human && process.stderr.isTTY === true;
5013
- const { run: run2, timedOut } = await waitForInstallRun(client3, accepted.runId, {
5013
+ const { run: run3, timedOut } = await waitForInstallRun(client3, accepted.runId, {
5014
5014
  timeoutMs,
5015
5015
  onProgress: showProgress ? (r) => process.stderr.write(`\r${renderProgress(r)}`.padEnd(96)) : void 0
5016
5016
  });
@@ -5024,27 +5024,27 @@ async function datapackageInstallCommand(artifactPath, args) {
5024
5024
  }
5025
5025
  emit3({
5026
5026
  runId: accepted.runId,
5027
- status: run2?.status ?? "RUNNING",
5028
- phase: run2?.phase,
5029
- filesDone: run2?.filesDone,
5030
- filesTotal: run2?.filesTotal,
5031
- rowsDone: run2?.rowsDone,
5027
+ status: run3?.status ?? "RUNNING",
5028
+ phase: run3?.phase,
5029
+ filesDone: run3?.filesDone,
5030
+ filesTotal: run3?.filesTotal,
5031
+ rowsDone: run3?.rowsDone,
5032
5032
  timedOut: true,
5033
5033
  next_step: `hcm datapackage status ${accepted.runId}`
5034
5034
  }, fmt);
5035
5035
  process.exitCode = 0;
5036
5036
  return;
5037
5037
  }
5038
- const failed2 = run2?.status !== "SUCCESS";
5038
+ const failed2 = run3?.status !== "SUCCESS";
5039
5039
  if (human) {
5040
5040
  process.stdout.write(
5041
- `${failed2 ? "\u274C" : "\u2705"} ${run2?.packageCode ?? accepted.packageName ?? "?"} v${run2?.version ?? accepted.version ?? "?"} \u2192 ${run2?.status ?? "?"}\uFF08rowCount=${run2?.rowCount ?? 0}\uFF0C${Math.round((run2?.durationMs ?? 0) / 1e3)}s\uFF09
5041
+ `${failed2 ? "\u274C" : "\u2705"} ${run3?.packageCode ?? accepted.packageName ?? "?"} v${run3?.version ?? accepted.version ?? "?"} \u2192 ${run3?.status ?? "?"}\uFF08rowCount=${run3?.rowCount ?? 0}\uFF0C${Math.round((run3?.durationMs ?? 0) / 1e3)}s\uFF09
5042
5042
  `
5043
5043
  );
5044
- if (run2?.errorMessage) process.stdout.write(` \u539F\u56E0\uFF1A${run2.errorMessage}
5044
+ if (run3?.errorMessage) process.stdout.write(` \u539F\u56E0\uFF1A${run3.errorMessage}
5045
5045
  `);
5046
5046
  }
5047
- emit3({ ...run2 ?? {}, runId: accepted.runId, documentId: accepted.documentId }, fmt);
5047
+ emit3({ ...run3 ?? {}, runId: accepted.runId, documentId: accepted.documentId }, fmt);
5048
5048
  process.exitCode = failed2 ? 1 : 0;
5049
5049
  return;
5050
5050
  } catch (e) {
@@ -5062,9 +5062,9 @@ async function datapackageStatusCommand(runId, args) {
5062
5062
  try {
5063
5063
  const ctx = await getActiveAuthContextFromCli(args);
5064
5064
  const client3 = HcmClient17.fromAuthContext(ctx);
5065
- const run2 = await fetchInstallRun(client3, runId);
5065
+ const run3 = await fetchInstallRun(client3, runId);
5066
5066
  const fmt = args.output ?? "json";
5067
- if (!run2) {
5067
+ if (!run3) {
5068
5068
  if (fmt !== "json") {
5069
5069
  process.stdout.write(`\u23F3 \u6D41\u6C34 ${runId} \u8FD8\u6CA1\u51FA\u73B0\u2014\u2014\u521A\u53D7\u7406\u7684\u88C5\u8F7D\u4F1A\u6709\u51E0\u767E\u6BEB\u79D2\u7684\u7A7A\u7A97\u3002
5070
5070
  `);
@@ -5074,12 +5074,12 @@ async function datapackageStatusCommand(runId, args) {
5074
5074
  return;
5075
5075
  }
5076
5076
  if (fmt !== "json") {
5077
- process.stdout.write(`${renderProgress(run2)}
5077
+ process.stdout.write(`${renderProgress(run3)}
5078
5078
  `);
5079
- if (run2.errorMessage) process.stdout.write(` \u539F\u56E0\uFF1A${run2.errorMessage}
5079
+ if (run3.errorMessage) process.stdout.write(` \u539F\u56E0\uFF1A${run3.errorMessage}
5080
5080
  `);
5081
5081
  }
5082
- emit3({ ...run2, ...isTerminalRunStatus(run2.status) ? {} : { next_step: `hcm datapackage status ${runId}` } }, fmt);
5082
+ emit3({ ...run3, ...isTerminalRunStatus(run3.status) ? {} : { next_step: `hcm datapackage status ${runId}` } }, fmt);
5083
5083
  process.exitCode = 0;
5084
5084
  return;
5085
5085
  } catch (e) {
@@ -5088,13 +5088,13 @@ async function datapackageStatusCommand(runId, args) {
5088
5088
  else exitWithError(e);
5089
5089
  }
5090
5090
  }
5091
- function renderProgress(run2) {
5092
- if (!run2) return "\u23F3 \u7B49\u5F85\u88C5\u8F7D\u6D41\u6C34\u51FA\u73B0\u2026";
5093
- const phase = run2.phase ?? run2.status ?? "?";
5094
- const files = run2.filesTotal ? `${run2.filesDone ?? 0}/${run2.filesTotal} \u6587\u4EF6` : `${run2.filesDone ?? 0} \u6587\u4EF6`;
5095
- const rows = run2.rowsTotal ? `${run2.rowsDone ?? 0}/${run2.rowsTotal} \u884C` : `${run2.rowsDone ?? 0} \u884C`;
5096
- const pct = run2.rowsTotal ? ` ${Math.min(100, Math.round((run2.rowsDone ?? 0) / run2.rowsTotal * 100))}%` : "";
5097
- const file = run2.currentFile ? ` ${truncateTail(run2.currentFile, 42)}` : "";
5091
+ function renderProgress(run3) {
5092
+ if (!run3) return "\u23F3 \u7B49\u5F85\u88C5\u8F7D\u6D41\u6C34\u51FA\u73B0\u2026";
5093
+ const phase = run3.phase ?? run3.status ?? "?";
5094
+ const files = run3.filesTotal ? `${run3.filesDone ?? 0}/${run3.filesTotal} \u6587\u4EF6` : `${run3.filesDone ?? 0} \u6587\u4EF6`;
5095
+ const rows = run3.rowsTotal ? `${run3.rowsDone ?? 0}/${run3.rowsTotal} \u884C` : `${run3.rowsDone ?? 0} \u884C`;
5096
+ const pct = run3.rowsTotal ? ` ${Math.min(100, Math.round((run3.rowsDone ?? 0) / run3.rowsTotal * 100))}%` : "";
5097
+ const file = run3.currentFile ? ` ${truncateTail(run3.currentFile, 42)}` : "";
5098
5098
  return `\u23F3 ${phase}${pct} ${files} ${rows}${file}`;
5099
5099
  }
5100
5100
  function truncateTail(text, max) {
@@ -6718,10 +6718,10 @@ async function metaListCommand(args) {
6718
6718
  fail6(e, args);
6719
6719
  }
6720
6720
  }
6721
- async function metaGetCommand(path14, args) {
6721
+ async function metaGetCommand(path15, args) {
6722
6722
  try {
6723
6723
  const c = await client2(args);
6724
- const content = await getTenantMeta(c.raw(), path14);
6724
+ const content = await getTenantMeta(c.raw(), path15);
6725
6725
  process.stdout.write(content.endsWith("\n") ? content : content + "\n");
6726
6726
  process.exitCode = 0;
6727
6727
  return;
@@ -6730,8 +6730,8 @@ async function metaGetCommand(path14, args) {
6730
6730
  }
6731
6731
  }
6732
6732
  var PROBEABLE_META_TYPES = /* @__PURE__ */ new Set(["model", "list", "info", "view", "filter", "page", "wiz", "impexp"]);
6733
- function parseMetaPath(path14) {
6734
- const base = path14.split(/[\\/]/).pop() ?? path14;
6733
+ function parseMetaPath(path15) {
6734
+ const base = path15.split(/[\\/]/).pop() ?? path15;
6735
6735
  if (!/\.(yml|yaml)$/i.test(base)) return {};
6736
6736
  const parts = base.replace(/\.(yml|yaml)$/i, "").split(".");
6737
6737
  return { model: parts[0] || void 0, kind: parts[1] ?? "model", state: parts[2] };
@@ -6748,10 +6748,10 @@ function unverifiableReason(e) {
6748
6748
  if (st == null) return `\u8BF7\u6C42\u6CA1\u53D1\u51FA\u53BB\u6216\u6CA1\u56DE\u6765\uFF08${err.code ?? err.message ?? "\u672A\u77E5"}\uFF09`;
6749
6749
  return void 0;
6750
6750
  }
6751
- async function verifyAfterWrite(c, path14) {
6752
- const { model, kind, state } = parseMetaPath(path14);
6751
+ async function verifyAfterWrite(c, path15) {
6752
+ const { model, kind, state } = parseMetaPath(path15);
6753
6753
  if (!model || !kind) {
6754
- return { status: "unverified", where: "(\u672A\u63A2)", why: `\u4ECE\u8DEF\u5F84 ${path14} \u8BA4\u4E0D\u51FA\u6A21\u578B\u540D/\u5C42\u540D` };
6754
+ return { status: "unverified", where: "(\u672A\u63A2)", why: `\u4ECE\u8DEF\u5F84 ${path15} \u8BA4\u4E0D\u51FA\u6A21\u578B\u540D/\u5C42\u540D` };
6755
6755
  }
6756
6756
  try {
6757
6757
  await clearMetaCache2(c.raw(), model, {});
@@ -6796,7 +6796,7 @@ async function verifyAfterWrite(c, path14) {
6796
6796
  }
6797
6797
  return { status: "ok" };
6798
6798
  }
6799
- async function metaSetCommand(path14, args) {
6799
+ async function metaSetCommand(path15, args) {
6800
6800
  try {
6801
6801
  if (!args.file) {
6802
6802
  throw new CliError20({
@@ -6812,9 +6812,9 @@ async function metaSetCommand(path14, args) {
6812
6812
  process.stdin.on("error", reject);
6813
6813
  }) : await fsp3.readFile(args.file, "utf8");
6814
6814
  if (!args.skipValidate) {
6815
- const result2 = validateMetaContent(path14, content);
6815
+ const result2 = validateMetaContent(path15, content);
6816
6816
  if (result2.issues.length > 0) {
6817
- process.stderr.write(`\u{1F50E} \u5199\u524D\u6821\u9A8C ${path14}\uFF08schema \u7C7B\u578B\uFF1A${result2.kind ?? "\u672A\u8BC6\u522B"}\uFF09
6817
+ process.stderr.write(`\u{1F50E} \u5199\u524D\u6821\u9A8C ${path15}\uFF08schema \u7C7B\u578B\uFF1A${result2.kind ?? "\u672A\u8BC6\u522B"}\uFF09
6818
6818
  `);
6819
6819
  process.stderr.write(formatMetaIssues(result2, " ") + "\n");
6820
6820
  }
@@ -6833,13 +6833,13 @@ async function metaSetCommand(path14, args) {
6833
6833
  if (dryFmt === "json" || dryFmt === "yaml") {
6834
6834
  process.stdout.write(
6835
6835
  formatObject18(
6836
- { dryRun: true, path: path14, bytes: Buffer.byteLength(content), content },
6836
+ { dryRun: true, path: path15, bytes: Buffer.byteLength(content), content },
6837
6837
  { format: dryFmt }
6838
6838
  ) + "\n"
6839
6839
  );
6840
6840
  } else {
6841
6841
  process.stdout.write(
6842
- `[dry-run] \u5C06\u5199\u5165 ${path14}\uFF08${Buffer.byteLength(content)} B\uFF09\u2014\u2014\u672A\u5B9E\u9645\u5199\u5165
6842
+ `[dry-run] \u5C06\u5199\u5165 ${path15}\uFF08${Buffer.byteLength(content)} B\uFF09\u2014\u2014\u672A\u5B9E\u9645\u5199\u5165
6843
6843
  ---
6844
6844
  ${content}
6845
6845
  `
@@ -6853,13 +6853,13 @@ ${content}
6853
6853
  let backupState = "unknown";
6854
6854
  let backupWhy;
6855
6855
  try {
6856
- const prev = await getTenantMeta(c.raw(), path14);
6856
+ const prev = await getTenantMeta(c.raw(), path15);
6857
6857
  if (!prev || prev.trim() === "") {
6858
6858
  backupState = "absent";
6859
6859
  } else {
6860
6860
  backupFile = nodePath.join(
6861
6861
  os3.tmpdir(),
6862
- `hcm-meta-backup-${Date.now()}-${path14.replace(/[\\/]/g, "_")}`
6862
+ `hcm-meta-backup-${Date.now()}-${path15.replace(/[\\/]/g, "_")}`
6863
6863
  );
6864
6864
  await fsp3.writeFile(backupFile, prev, "utf8");
6865
6865
  backupState = "saved";
@@ -6874,22 +6874,22 @@ ${content}
6874
6874
  backupWhy = `HTTP ${st ?? "-"}${err.code ? ` ${err.code}` : ""}${err.message ? `\uFF1A${err.message}` : ""}`;
6875
6875
  }
6876
6876
  }
6877
- const result = await saveTenantMeta(c.raw(), path14, content);
6877
+ const result = await saveTenantMeta(c.raw(), path15, content);
6878
6878
  const fmt = args.output ?? "json";
6879
- if (fmt !== "json") process.stdout.write(`\u2705 \u5DF2\u5199\u5165 ${path14}
6879
+ if (fmt !== "json") process.stdout.write(`\u2705 \u5DF2\u5199\u5165 ${path15}
6880
6880
  `);
6881
6881
  const restoreHint = backupState === "saved" && backupFile ? ` \u65E7\u5185\u5BB9\u5DF2\u5B58\uFF1A${backupFile}
6882
- \u653E\u56DE\u53BB\uFF1Ahcm meta set ${path14} --file ${backupFile}${connFlags(args)}
6883
- ` : backupState === "absent" ? ` \u8FD9\u4E00\u5C42\u6B64\u524D\u6CA1\u6709\u8986\u76D6\uFF08\u5DF2\u8BC1\u5B9E\uFF09\uFF0C\u6062\u590D\u5373\u5220\u9664\uFF1Ahcm meta delete ${path14}${connFlags(args)}
6882
+ \u653E\u56DE\u53BB\uFF1Ahcm meta set ${path15} --file ${backupFile}${connFlags(args)}
6883
+ ` : backupState === "absent" ? ` \u8FD9\u4E00\u5C42\u6B64\u524D\u6CA1\u6709\u8986\u76D6\uFF08\u5DF2\u8BC1\u5B9E\uFF09\uFF0C\u6062\u590D\u5373\u5220\u9664\uFF1Ahcm meta delete ${path15}${connFlags(args)}
6884
6884
  ` : ` \u26A0\uFE0F \u65E7\u5185\u5BB9**\u6CA1\u5907\u4EFD\u6210**\uFF08${backupWhy ?? "\u539F\u56E0\u672A\u77E5"}\uFF09\u2014\u2014\u65E2\u4E0D\u77E5\u9053\u6B64\u524D\u6709\u6CA1\u6709\u8986\u76D6\uFF0C\u4E5F\u5C31\u7ED9\u4E0D\u51FA\u6062\u590D\u547D\u4EE4\u3002
6885
- \u5148\u81EA\u5DF1\u8BFB\u4E00\u904D\u786E\u8BA4\uFF1Ahcm meta get ${path14}${connFlags(args)}
6885
+ \u5148\u81EA\u5DF1\u8BFB\u4E00\u904D\u786E\u8BA4\uFF1Ahcm meta get ${path15}${connFlags(args)}
6886
6886
  `;
6887
6887
  if (args.verify === false) {
6888
6888
  process.stderr.write(
6889
6889
  "\u26A0\uFE0F --no-verify\uFF1A**\u6CA1\u6709**\u9A8C\u8FC7\u670D\u52A1\u7AEF\u8BFB\u4E0D\u8BFB\u5F97\u52A8\u8FD9\u4EFD meta\u3002\u300C\u5199\u5165\u6210\u529F\u300D\u53EA\u8BF4\u660E\u5B57\u8282\u6536\u4E0B\u4E86\u3002\n \u81EA\u5DF1\u8865\uFF1Ahcm cache clear-meta <Model> \u540E\u6253\u5F00\u9875\u9762\u770B\u4E00\u773C\u3002\n" + restoreHint
6890
6890
  );
6891
6891
  } else {
6892
- const outcome = await verifyAfterWrite(c, path14);
6892
+ const outcome = await verifyAfterWrite(c, path15);
6893
6893
  if (outcome.status === "broken") {
6894
6894
  const human = explainJacksonError(outcome.raw);
6895
6895
  process.stderr.write(
@@ -6922,19 +6922,19 @@ ${content}
6922
6922
  fail6(e, args);
6923
6923
  }
6924
6924
  }
6925
- async function metaDeleteCommand(path14, args) {
6925
+ async function metaDeleteCommand(path15, args) {
6926
6926
  try {
6927
6927
  if (!args.yes) {
6928
- const ok = await promptConfirm(`\u5C06\u5220\u9664\u5143\u6570\u636E ${path14}\uFF0C\u6B64\u64CD\u4F5C\u4E0D\u53EF\u9006\u3002\u7EE7\u7EED\uFF1F`);
6928
+ const ok = await promptConfirm(`\u5C06\u5220\u9664\u5143\u6570\u636E ${path15}\uFF0C\u6B64\u64CD\u4F5C\u4E0D\u53EF\u9006\u3002\u7EE7\u7EED\uFF1F`);
6929
6929
  if (!ok) {
6930
6930
  process.stderr.write("\u5DF2\u53D6\u6D88\n");
6931
6931
  process.exit(1);
6932
6932
  }
6933
6933
  }
6934
6934
  const c = await client2(args);
6935
- const result = await deleteTenantMeta(c.raw(), path14);
6935
+ const result = await deleteTenantMeta(c.raw(), path15);
6936
6936
  const fmt = args.output ?? "json";
6937
- if (fmt !== "json") process.stdout.write(`\u{1F5D1}\uFE0F \u5DF2\u5220\u9664 ${path14}
6937
+ if (fmt !== "json") process.stdout.write(`\u{1F5D1}\uFE0F \u5DF2\u5220\u9664 ${path15}
6938
6938
  `);
6939
6939
  process.stdout.write(formatObject18(result, { format: fmt }) + "\n");
6940
6940
  process.exitCode = 0;
@@ -6943,7 +6943,7 @@ async function metaDeleteCommand(path14, args) {
6943
6943
  fail6(e, args);
6944
6944
  }
6945
6945
  }
6946
- async function metaValidateCommand(path14, args) {
6946
+ async function metaValidateCommand(path15, args) {
6947
6947
  try {
6948
6948
  if (!args.file) {
6949
6949
  throw new CliError20({
@@ -6958,13 +6958,13 @@ async function metaValidateCommand(path14, args) {
6958
6958
  process.stdin.on("end", () => resolve3(buf));
6959
6959
  process.stdin.on("error", reject);
6960
6960
  }) : await fsp3.readFile(args.file, "utf8");
6961
- const result = validateMetaContent(path14, content);
6961
+ const result = validateMetaContent(path15, content);
6962
6962
  const fmt = args.output ?? "table";
6963
6963
  if (fmt === "json" || fmt === "yaml") {
6964
6964
  process.stdout.write(
6965
6965
  formatObject18(
6966
6966
  {
6967
- path: path14,
6967
+ path: path15,
6968
6968
  kind: result.kind,
6969
6969
  schemaKnown: result.schemaKnown,
6970
6970
  schemaSourceCommit: META_SCHEMA_SOURCE_COMMIT,
@@ -6976,7 +6976,7 @@ async function metaValidateCommand(path14, args) {
6976
6976
  );
6977
6977
  } else {
6978
6978
  process.stdout.write(
6979
- `\u{1F50E} ${path14}\uFF08schema \u7C7B\u578B\uFF1A${result.kind ?? "\u672A\u8BC6\u522B"}\uFF0C\u6765\u6E90 ${META_SCHEMA_SOURCE_COMMIT.slice(0, 8)}\uFF09
6979
+ `\u{1F50E} ${path15}\uFF08schema \u7C7B\u578B\uFF1A${result.kind ?? "\u672A\u8BC6\u522B"}\uFF0C\u6765\u6E90 ${META_SCHEMA_SOURCE_COMMIT.slice(0, 8)}\uFF09
6980
6980
  `
6981
6981
  );
6982
6982
  process.stdout.write(
@@ -9000,73 +9000,15 @@ function mergeChironAgentInstructions(existing) {
9000
9000
  function caseLibraryDir() {
9001
9001
  return path7.join(hcmConfigDir(), CASES_MCP_NAME);
9002
9002
  }
9003
- function codexConfigFile() {
9004
- return path7.join(process.env.HOME ?? os4.homedir(), ".codex", "config.toml");
9005
- }
9006
- function renderCodexMcpSection(repo, envName, binPath = process.env.PATH ?? "") {
9007
- const server = path7.join(repo, "mcp", "server.mjs");
9008
- const env2 = [
9009
- `CASES_REPO = ${JSON.stringify(repo)}`,
9010
- `HCM_ENV = ${JSON.stringify(envName)}`,
9011
- ...binPath ? [`PATH = ${JSON.stringify(binPath)}`] : []
9012
- ].join(", ");
9013
- return [
9014
- `[mcp_servers.${CASES_MCP_NAME}]`,
9015
- 'command = "node"',
9016
- `args = [${JSON.stringify(server)}]`,
9017
- `env = { ${env2} }`,
9018
- ""
9019
- ].join("\n");
9020
- }
9021
- function mergeCodexMcpConfig(existing, section) {
9022
- const lines = existing.split(/\r?\n/);
9023
- const isOurs = (line) => new RegExp(`^\\[mcp_servers\\.${CASES_MCP_NAME}(\\.|\\])`).test(line.trim());
9024
- const isHeader = (line) => /^\s*\[/.test(line);
9025
- let start = -1;
9026
- let end = -1;
9027
- for (let i = 0; i < lines.length; i++) {
9028
- const line = lines[i] ?? "";
9029
- if (start < 0 && isOurs(line)) {
9030
- start = i;
9031
- continue;
9032
- }
9033
- if (start >= 0 && isHeader(line) && !isOurs(line)) {
9034
- end = i;
9035
- break;
9036
- }
9037
- }
9038
- const block = section.trimEnd();
9039
- if (start < 0) {
9040
- const prefix = existing.trimEnd();
9041
- return `${prefix}${prefix ? "\n\n" : ""}${block}
9042
- `;
9043
- }
9044
- const tail = lines.slice(end < 0 ? lines.length : end);
9045
- const head = lines.slice(0, start);
9046
- return `${[...head, block, "", ...tail].join("\n").replace(/\n{3,}/g, "\n\n").trimEnd()}
9047
- `;
9048
- }
9049
- function codexConfigHasCases(text) {
9050
- return new RegExp(`^\\[mcp_servers\\.${CASES_MCP_NAME}\\]`, "m").test(text);
9051
- }
9052
9003
  var defaultCaseLibraryDeps = {
9053
9004
  git: (args, cwd) => {
9054
9005
  const r = spawnSync("git", args, { cwd, encoding: "utf8", timeout: 12e4, env: { ...process.env, GIT_TERMINAL_PROMPT: "0" } });
9055
9006
  return { status: r.status, stderr: r.stderr ?? "", error: r.error };
9056
- },
9057
- npmInstall: (cwd) => {
9058
- const r = spawnSync("npm", ["install", "--omit=dev", "--no-audit", "--no-fund", "--loglevel=error"], {
9059
- cwd,
9060
- encoding: "utf8",
9061
- timeout: 3e5
9062
- });
9063
- return { status: r.status, stderr: r.stderr ?? "", error: r.error };
9064
9007
  }
9065
9008
  };
9066
- async function ensureCaseLibrary(envName, deps = defaultCaseLibraryDeps, paths = {}) {
9009
+ async function ensureCaseLibrary(deps = defaultCaseLibraryDeps, paths = {}) {
9067
9010
  const repo = paths.repo ?? caseLibraryDir();
9068
- const codexConfig = paths.codexConfig ?? codexConfigFile();
9069
- const status = { ok: false, repo, step: "present", serverInstalled: false, codexWired: false };
9011
+ const status = { ok: false, repo, step: "present" };
9070
9012
  const hasGit = await exists2(path7.join(repo, ".git"));
9071
9013
  if (hasGit) {
9072
9014
  const pull = deps.git(["pull", "--ff-only", "--quiet"], repo);
@@ -9082,36 +9024,14 @@ async function ensureCaseLibrary(envName, deps = defaultCaseLibraryDeps, paths =
9082
9024
  }
9083
9025
  status.step = "cloned";
9084
9026
  }
9085
- const mcpDir = path7.join(repo, "mcp");
9086
- if (!await exists2(path7.join(mcpDir, "server.mjs"))) {
9087
- status.step = "install-failed";
9088
- status.reason = `\u6848\u4F8B\u5E93\u91CC\u6CA1\u6709 mcp/server.mjs\uFF1A${mcpDir}`;
9089
- return status;
9090
- }
9091
- if (!await exists2(path7.join(mcpDir, "node_modules", "@modelcontextprotocol"))) {
9092
- const install = deps.npmInstall(mcpDir);
9093
- if (install.status !== 0) {
9094
- status.step = "install-failed";
9095
- status.reason = `npm install \u5931\u8D25\uFF1A${firstLine(install.stderr, install.error)}`;
9096
- return status;
9097
- }
9098
- }
9099
- status.serverInstalled = true;
9100
- await fs8.mkdir(path7.dirname(codexConfig), { recursive: true });
9101
- const existing = await fs8.readFile(codexConfig, "utf8").catch(() => "");
9102
- const next = mergeCodexMcpConfig(existing, renderCodexMcpSection(repo, envName));
9103
- if (next !== existing) await fs8.writeFile(codexConfig, next, "utf8");
9104
- status.codexWired = true;
9105
9027
  status.ok = true;
9106
9028
  return status;
9107
9029
  }
9108
9030
  async function inspectCaseLibrary(paths = {}) {
9109
9031
  const repo = paths.repo ?? caseLibraryDir();
9110
- const codexConfig = paths.codexConfig ?? codexConfigFile();
9111
9032
  const cloned = await exists2(path7.join(repo, ".git"));
9112
- const serverInstalled = cloned && await exists2(path7.join(repo, "mcp", "server.mjs")) && await exists2(path7.join(repo, "mcp", "node_modules", "@modelcontextprotocol"));
9113
- const codexWired = codexConfigHasCases(await fs8.readFile(codexConfig, "utf8").catch(() => ""));
9114
- return { repo, cloned, serverInstalled, codexWired };
9033
+ const indexed = cloned && await exists2(path7.join(repo, "index", "index.json"));
9034
+ return { repo, cloned, indexed };
9115
9035
  }
9116
9036
  function firstLine(stderr, error) {
9117
9037
  if (error) return error.message;
@@ -9186,7 +9106,7 @@ var defaultChironInitDeps = {
9186
9106
  throw new Error("\u6280\u80FD\u6CA1\u88C5\u4E0A\uFF08\u4E0A\u9762\u662F skills install \u7684\u8F93\u51FA\uFF09\uFF1B\u4FEE\u597D\u540E\u91CD\u8DD1 hcm chiron init");
9187
9107
  }
9188
9108
  },
9189
- caseLibrary: (envName) => ensureCaseLibrary(envName)
9109
+ caseLibrary: () => ensureCaseLibrary()
9190
9110
  };
9191
9111
  async function resolveLoggedInEnv() {
9192
9112
  const g = await loadGlobalConfig10();
@@ -9282,7 +9202,7 @@ async function runChironInit(args, deps = defaultChironInitDeps) {
9282
9202
  let cases = { ok: false, step: "skipped" };
9283
9203
  if (!args.skipCases) {
9284
9204
  say("\u63A5\u6848\u4F8B\u5E93\uFF08chiron-cases MCP\uFF09\u2026");
9285
- cases = await deps.caseLibrary(name);
9205
+ cases = await deps.caseLibrary();
9286
9206
  if (cases.ok) say(`\u6848\u4F8B\u5E93\u5DF2\u63A5\u5165 Codex\uFF1A${cases.repo}`);
9287
9207
  else say(`\u6848\u4F8B\u5E93\u672A\u63A5\u5165\uFF08\u4E0D\u5F71\u54CD\u5F00\u5DE5\uFF0C\u7528\u5230\u65F6\u4F1A\u63D0\u793A\u6743\u9650\u4E0D\u8DB3\uFF09\uFF1A${cases.reason ?? cases.step}`);
9288
9208
  }
@@ -9664,16 +9584,229 @@ ${r.url}
9664
9584
  });
9665
9585
  }
9666
9586
 
9587
+ // src/commands/chiron-case.ts
9588
+ init_exit();
9589
+ import { execFileSync } from "child_process";
9590
+ import { existsSync as existsSync2, readFileSync as readFileSync6, cpSync, writeFileSync as writeFileSync2, mkdirSync } from "fs";
9591
+ import os5 from "os";
9592
+ import path9 from "path";
9593
+ import { CASES_REPO_SLUG as CASES_REPO_SLUG2, CNB_ORIGIN, CliError as CliError23, CliErrorCode as CliErrorCode22, formatObject as formatObject23 } from "@hcmai/sdk";
9594
+ var casesRepoDir = () => process.env.HCM_CASES_DIR?.trim() || path9.join(os5.homedir(), "Projects", "chiron-cases");
9595
+ var fail7 = (message, nextStep) => new CliError23({ code: CliErrorCode22.INVALID_ARGUMENT, message, context: { nextStep } });
9596
+ var run2 = (cmd, args, opts = {}) => execFileSync(cmd, args, { encoding: "utf8", maxBuffer: 1 << 26, ...opts });
9597
+ function loadIndex(dir = casesRepoDir()) {
9598
+ const file = path9.join(dir, "index", "index.json");
9599
+ if (!existsSync2(file)) {
9600
+ throw fail7(
9601
+ `\u6848\u4F8B\u5E93\u7D22\u5F15\u4E0D\u5728\uFF1A${file}`,
9602
+ `\u5148 clone \u6848\u4F8B\u5E93\uFF08\`hcm chiron doctor --fix\` \u4F1A\u505A\uFF09\uFF0C\u6216\u7528 HCM_CASES_DIR \u6307\u5230\u5DF2\u6709\u7684 clone\u3002\u6CA1\u6709 cnb \u6743\u9650\u5C31\u8DF3\u8FC7\u6848\u4F8B\u5E93\u8FD9\u4E00\u683C\u3002`
9603
+ );
9604
+ }
9605
+ return JSON.parse(readFileSync6(file, "utf8"));
9606
+ }
9607
+ function backendFingerprint(env2) {
9608
+ if (!env2) return { reason: "\u6CA1\u7ED9 --env\uFF0C\u6CA1\u6CD5\u73B0\u67E5\u6307\u7EB9" };
9609
+ try {
9610
+ const raw = run2(process.execPath, [process.argv[1], "version", "--env", env2, "--output", "json"]);
9611
+ const j = JSON.parse(raw.slice(raw.indexOf("{")));
9612
+ const backend = j.backend?.commit ?? j.commit ?? j.server?.commit;
9613
+ if (!backend) return { reason: "\u540E\u7AEF\u56DE\u6267\u91CC\u6CA1\u6709 commit \u5B57\u6BB5" };
9614
+ return { backend: String(backend), cli: String(j.cli?.version ?? j.cliVersion ?? "") };
9615
+ } catch (e) {
9616
+ return { reason: String(e.message).split("\n")[0]?.slice(0, 120) };
9617
+ }
9618
+ }
9619
+ function matchTag(c, fp) {
9620
+ if (!fp.backend) return `\u672A\u6BD4\u5BF9\uFF08${fp.reason ?? "\u6CA1\u6709\u6307\u7EB9"}\uFF09`;
9621
+ const be = String(c.fingerprint?.backend_commit ?? "");
9622
+ if (!be) return "\u6848\u4F8B\u6CA1\u8BB0\u540E\u7AEF\u6307\u7EB9";
9623
+ const a = be.slice(0, 12);
9624
+ const b = fp.backend.slice(0, 12);
9625
+ return a === b ? "\u5339\u914D" : `\u4E0D\u5339\u914D\uFF08\u6848\u4F8B ${a} / \u5F53\u524D ${b}\uFF09`;
9626
+ }
9627
+ function emit5(args, data, text) {
9628
+ if (args.output === "json" || args.output === "yaml") {
9629
+ process.stdout.write(formatObject23(data, { format: args.output }) + "\n");
9630
+ } else {
9631
+ process.stdout.write(text() + "\n");
9632
+ }
9633
+ }
9634
+ async function guard(fn) {
9635
+ try {
9636
+ await fn();
9637
+ } catch (e) {
9638
+ exitWithError(e);
9639
+ }
9640
+ }
9641
+ async function caseSearchCommand(query, args) {
9642
+ await guard(async () => {
9643
+ const idx = loadIndex();
9644
+ const fp = backendFingerprint(args.env);
9645
+ let raw;
9646
+ try {
9647
+ raw = run2("cnb", [
9648
+ "knowledge-base",
9649
+ "query-knowledge-base-get",
9650
+ "--repo",
9651
+ CASES_REPO_SLUG2,
9652
+ "--query",
9653
+ query,
9654
+ "--top-k",
9655
+ String(args.topK ?? 5),
9656
+ "--verbose"
9657
+ ]);
9658
+ } catch (e) {
9659
+ throw fail7(
9660
+ `\u6848\u4F8B\u5E93\u68C0\u7D22\u6CA1\u8DD1\u6210\uFF1A${String(e.message).split("\n")[0]}`,
9661
+ "\u68C0\u7D22\u8D70 cnb \u7684\u77E5\u8BC6\u5E93\u63A5\u53E3\uFF0C\u9700\u8981 cnb \u5DF2\u767B\u5F55\u4E14\u6709\u6848\u4F8B\u5E93\u6743\u9650\u3002\u6CA1\u6709\u5C31\u5148\u8DF3\u8FC7\u6848\u4F8B\u5E93\uFF0C\u76F4\u63A5\u6309\u6280\u80FD\u505A\uFF1B\u522B\u628A\u300C\u67E5\u4E0D\u5230\u300D\u5F53\u6210\u300C\u6CA1\u6709\u5148\u4F8B\u300D\u3002"
9662
+ );
9663
+ }
9664
+ const json = JSON.parse(raw.slice(raw.indexOf("{")));
9665
+ const seen = /* @__PURE__ */ new Map();
9666
+ for (const h of json.data ?? []) {
9667
+ const p = h.metadata?.path ?? "";
9668
+ const m = /^cases\/[^/]+\/([^/]+)\//.exec(p);
9669
+ if (!m) continue;
9670
+ const id = m[1];
9671
+ if (seen.has(id)) continue;
9672
+ const c = idx.cases.find((x) => x.id === id);
9673
+ seen.set(id, {
9674
+ id,
9675
+ score: h.score,
9676
+ file: p.split("/").pop(),
9677
+ status: c?.status,
9678
+ tier: c?.tier,
9679
+ skills: c?.skills,
9680
+ customer_ask: c?.customer_ask,
9681
+ match: c ? matchTag(c, fp) : "\u7D22\u5F15\u91CC\u6CA1\u6709\uFF08\u672C\u673A clone \u53EF\u80FD\u65E7\u4E86\uFF0Cgit pull \u4E00\u6B21\uFF09"
9682
+ });
9683
+ }
9684
+ const rows = [...seen.values()];
9685
+ emit5(
9686
+ args,
9687
+ { query, rows },
9688
+ () => rows.length ? rows.map((r) => `${r.id} [${r.status ?? "?"}\xB7${r.match}] ${r.customer_ask ?? ""}
9689
+ \u6280\u80FD\uFF1A${(r.skills ?? []).join(" / ") || "\uFF08\u672A\u767B\u8BB0\uFF09"}`).join("\n") : `\u6CA1\u6709\u547D\u4E2D\u300C${query}\u300D\u7684\u6848\u4F8B\u3002\u5148\u6309\u6280\u80FD\u505A\uFF0C\u8DD1\u901A\u4E86\u7528 \`hcm chiron case submit\` \u4E0A\u884C\u4E00\u6761\u3002`
9690
+ );
9691
+ });
9692
+ }
9693
+ async function caseShowCommand(id, args) {
9694
+ await guard(async () => {
9695
+ const idx = loadIndex();
9696
+ const c = idx.cases.find((x) => x.id === id);
9697
+ if (!c?.path) {
9698
+ throw fail7(
9699
+ `\u7D22\u5F15\u91CC\u6CA1\u6709\u6848\u4F8B ${id}`,
9700
+ `\u5148 \`hcm chiron case search <\u5173\u952E\u8BCD>\` \u62FF\u51C6\u786E\u7684 id\uFF1B\u672C\u673A clone \u65E7\u4E86\u5C31\u5728 ${casesRepoDir()} \u91CC git pull \u4E00\u6B21\u3002`
9701
+ );
9702
+ }
9703
+ const dir = path9.join(casesRepoDir(), c.path);
9704
+ const files = args.file ? [args.file] : ["\u95EE\u9898.md", "\u65B9\u6848.md"];
9705
+ const parts = files.map((f) => {
9706
+ const p = path9.join(dir, f);
9707
+ return existsSync2(p) ? `# ${f}
9708
+
9709
+ ${readFileSync6(p, "utf8")}` : `# ${f}
9710
+
9711
+ \uFF08\u8FD9\u4E2A\u6848\u4F8B\u6CA1\u6709\u8FD9\u4EFD\u6587\u4EF6\uFF09`;
9712
+ });
9713
+ const meta2 = readFileSync6(path9.join(dir, "case.yml"), "utf8");
9714
+ emit5(args, { id, caseYml: meta2, files: parts }, () => `case.yml:
9715
+ ${meta2}
9716
+
9717
+ ${parts.join("\n\n---\n\n")}`);
9718
+ });
9719
+ }
9720
+ async function caseMatchCommand(args) {
9721
+ await guard(async () => {
9722
+ const idx = loadIndex();
9723
+ const fp = backendFingerprint(args.env);
9724
+ const rows = idx.cases.filter((c) => c.status === "approved").map((c) => ({ id: c.id, match: matchTag(c, fp), skills: c.skills, customer_ask: c.customer_ask }));
9725
+ emit5(args, { fingerprint: fp, rows }, () => {
9726
+ const head = fp.backend ? `\u5F53\u524D\u540E\u7AEF ${fp.backend.slice(0, 12)}\uFF08env ${args.env}\uFF09` : `\u26A0\uFE0F \u6CA1\u53D6\u5230\u5F53\u524D\u6307\u7EB9\uFF08${fp.reason}\uFF09\u2014\u2014\u4E0B\u9762\u6BCF\u4E00\u6761\u90FD\u6807\u7740\u300C\u672A\u6BD4\u5BF9\u300D\uFF0C\u522B\u628A\u5B83\u8BFB\u6210\u300C\u90FD\u80FD\u7167\u505A\u300D`;
9727
+ return [head, ...rows.map((r) => `${r.match === "\u5339\u914D" ? "\u2705" : "\xB7 "} ${r.id} [${r.match}] ${r.customer_ask ?? ""}`)].join("\n");
9728
+ });
9729
+ });
9730
+ }
9731
+ async function caseSubmitCommand(dir, args) {
9732
+ await guard(async () => {
9733
+ const repo = casesRepoDir();
9734
+ const src = path9.resolve(dir);
9735
+ if (!existsSync2(path9.join(src, "case.yml"))) {
9736
+ throw fail7(`${src} \u91CC\u6CA1\u6709 case.yml`, "\u6307\u5230\u9879\u76EE\u4ED3\u7684\u6848\u4F8B\u76EE\u5F55\uFF08\u5982 cases/CASE-20260902-xxx\uFF09\uFF0C\u90A3\u91CC\u5E94\u5F53\u6709 case.yml\u3002");
9737
+ }
9738
+ loadIndex(repo);
9739
+ const yamlText = readFileSync6(path9.join(src, "case.yml"), "utf8");
9740
+ const id = /^\s*(?:id|case_id):\s*(\S+)/m.exec(yamlText)?.[1];
9741
+ if (!id) throw fail7("case.yml \u91CC\u6CA1\u6709 id", "case.yml \u9876\u5C42\u8981\u6709 `id: CASE-YYYYMMDD-xxx`\u3002");
9742
+ run2("git", ["-C", repo, "checkout", "-q", "main"]);
9743
+ run2("git", ["-C", repo, "pull", "-q", "--ff-only", "origin", "main"]);
9744
+ const branch = `case/${id}-submit`;
9745
+ run2("git", ["-C", repo, "checkout", "-q", "-B", branch]);
9746
+ const dst = path9.join(repo, "cases", args.category, id);
9747
+ cpSync(src, dst, { recursive: true, filter: (p) => !p.includes("node_modules") });
9748
+ mkdirSync(path9.join(dst, "evidence"), { recursive: true });
9749
+ let doc = readFileSync6(path9.join(dst, "case.yml"), "utf8");
9750
+ doc = /^\s*tier:/m.test(doc) ? doc.replace(/^\s*tier:.*$/m, "tier: public") : `tier: public
9751
+ ${doc}`;
9752
+ doc = /^\s*category:/m.test(doc) ? doc.replace(/^\s*category:.*$/m, `category: ${args.category}`) : `category: ${args.category}
9753
+ ${doc}`;
9754
+ doc = /^\s*origin:/m.test(doc) ? doc.replace(/^\s*origin:.*$/m, `origin: ${args.origin}`) : `origin: ${args.origin}
9755
+ ${doc}`;
9756
+ if (!/^\s*status:/m.test(doc)) doc = `status: approved
9757
+ ${doc}`;
9758
+ writeFileSync2(path9.join(dst, "case.yml"), doc);
9759
+ run2("python3", ["scripts/render-readme.py", dst], { cwd: repo });
9760
+ let lint;
9761
+ try {
9762
+ lint = run2("python3", ["scripts/lint-case.py"], { cwd: repo });
9763
+ } catch (e) {
9764
+ throw fail7(
9765
+ `\u6848\u4F8B lint \u6CA1\u8FC7\uFF0CPR \u6CA1\u5F00\uFF1A
9766
+ ${e.stdout ?? e.message}`,
9767
+ "\u7167 lint \u7684\u63D0\u793A\u8865\u9F50 case.yml \u4E0E\u6B63\u6587\uFF0C\u518D\u8DD1\u4E00\u6B21\u3002\u6848\u4F8B\u8FD8\u5728\u9879\u76EE\u4ED3\u91CC\uFF0C\u6CA1\u4E22\u3002"
9768
+ );
9769
+ }
9770
+ run2("python3", ["scripts/build-index.py"], { cwd: repo });
9771
+ run2("git", ["-C", repo, "add", "-A"]);
9772
+ run2("git", ["-C", repo, "-c", "user.name=hcm-cli", "-c", "user.email=chiron@local", "commit", "-q", "-m", `case: ${id}\uFF08\u9879\u76EE\u6848\u4F8B\u4E0A\u884C\uFF09`]);
9773
+ run2("git", ["-C", repo, "push", "-q", "-f", "-u", "origin", branch]);
9774
+ const pr = run2("cnb", [
9775
+ "pulls",
9776
+ "post-pull",
9777
+ "--repo",
9778
+ CASES_REPO_SLUG2,
9779
+ "--base",
9780
+ "main",
9781
+ "--head",
9782
+ branch,
9783
+ "--title",
9784
+ `case: ${id}\uFF08\u9879\u76EE\u6848\u4F8B\u4E0A\u884C\uFF09`,
9785
+ "--body",
9786
+ `\u6765\u6E90\uFF1A${args.origin}
9787
+
9788
+ \u7531 \`hcm chiron case submit\` \u63D0\u4EA4\uFF0Clint \u5DF2\u8FC7\u3002`
9789
+ ]);
9790
+ const num = /number: "?(\d+)/.exec(pr)?.[1];
9791
+ emit5(
9792
+ args,
9793
+ { id, pr: num, lint: lint.trim() },
9794
+ () => `\u5DF2\u5F00 PR #${num ?? "?"}\uFF1A${CNB_ORIGIN}/${CASES_REPO_SLUG2}/-/pulls/${num ?? ""}
9795
+ ${lint.trim()}`
9796
+ );
9797
+ });
9798
+ }
9799
+
9667
9800
  // src/commands/chiron-doctor.ts
9668
9801
  init_auth_guard();
9669
9802
  init_exit();
9670
9803
  import { promises as fs10 } from "fs";
9671
- import path9 from "path";
9804
+ import path10 from "path";
9672
9805
  import {
9673
9806
  HcmClient as HcmClient21,
9674
- CliError as CliError23,
9807
+ CliError as CliError24,
9675
9808
  fetchReconIdentity as fetchReconIdentity2,
9676
- formatObject as formatObject23,
9809
+ formatObject as formatObject24,
9677
9810
  httpProbe as httpProbe2,
9678
9811
  runDoctor
9679
9812
  } from "@hcmai/sdk";
@@ -9686,16 +9819,16 @@ var defaultDeps2 = {
9686
9819
  return { report: await runDoctor(probe, identity2), tokenTenant: identity2?.tenantId ? String(identity2.tenantId) : void 0 };
9687
9820
  },
9688
9821
  fixSkills: (root, envName) => defaultChironInitDeps.installSkills(root, envName),
9689
- fixCases: async (envName) => {
9690
- await ensureCaseLibrary(envName);
9822
+ fixCases: async () => {
9823
+ await ensureCaseLibrary();
9691
9824
  },
9692
9825
  inspectCases: () => inspectCaseLibrary(),
9693
9826
  inspectJira: () => inspectJira()
9694
9827
  };
9695
9828
  async function runChironDoctor(args, deps = defaultDeps2) {
9696
- const root = path9.resolve(args.project ?? ".");
9829
+ const root = path10.resolve(args.project ?? ".");
9697
9830
  const report = { ok: false, project: root, env: null, envName: null, lines: [] };
9698
- const envText = await fs10.readFile(path9.join(root, ENV_FILE), "utf8").catch(() => null);
9831
+ const envText = await fs10.readFile(path10.join(root, ENV_FILE), "utf8").catch(() => null);
9699
9832
  if (envText === null) {
9700
9833
  report.lines.push({
9701
9834
  item: "\u767B\u5F55",
@@ -9740,12 +9873,12 @@ async function runChironDoctor(args, deps = defaultDeps2) {
9740
9873
  });
9741
9874
  }
9742
9875
  } catch (e) {
9743
- const msg = e instanceof CliError23 ? e.message : e.message;
9876
+ const msg = e instanceof CliError24 ? e.message : e.message;
9744
9877
  report.lines.push({ item: "\u767B\u5F55", verdict: "fail", detail: `${found.name} \xB7 ${env2.endpoint}\uFF1A${msg}`, nextStep: loginCmd });
9745
9878
  }
9746
9879
  }
9747
9880
  const skillsLine = async () => {
9748
- const state = await readSkillsState(path9.join(root, SKILLS_DIR));
9881
+ const state = await readSkillsState(path10.join(root, SKILLS_DIR));
9749
9882
  if (!state) return { item: "\u6280\u80FD", verdict: "fail", detail: `${SKILLS_DIR}/ \u91CC\u6CA1\u6709\u5B89\u88C5\u6E05\u5355`, nextStep: "hcm chiron doctor --fix\uFF08\u6216 hcm chiron init\uFF09" };
9750
9883
  const count = Object.keys(state.skills).length;
9751
9884
  if (state.endpoint && normalizeOrigin(state.endpoint) !== env2.endpoint) {
@@ -9765,13 +9898,12 @@ async function runChironDoctor(args, deps = defaultDeps2) {
9765
9898
  const casesLine = async () => {
9766
9899
  const c = await deps.inspectCases();
9767
9900
  if (!c.cloned) return { item: "\u6848\u4F8B\u5E93", verdict: "warn", detail: `\u672A clone\uFF08${c.repo}\uFF09`, nextStep: "hcm chiron doctor --fix\uFF1B\u6CA1\u6709 cnb \u6743\u9650\u5C31\u5148\u8DF3\u8FC7\uFF0C\u63D0\u4EA4\u6848\u4F8B/\u7F3A\u53E3\u65F6\u4F1A\u63D0\u793A" };
9768
- if (!c.serverInstalled) return { item: "\u6848\u4F8B\u5E93", verdict: "warn", detail: "MCP \u4F9D\u8D56\u6CA1\u88C5", nextStep: "hcm chiron doctor --fix" };
9769
- if (!c.codexWired) return { item: "\u6848\u4F8B\u5E93", verdict: "warn", detail: "Codex \u6CA1\u63A5\u7EBF\uFF08~/.codex/config.toml \u7F3A [mcp_servers.chiron-cases]\uFF09", nextStep: "hcm chiron doctor --fix" };
9901
+ if (!c.indexed) return { item: "\u6848\u4F8B\u5E93", verdict: "warn", detail: `clone \u4E86\u4F46\u6CA1\u6709\u7D22\u5F15\uFF08${c.repo}/index/index.json\uFF09`, nextStep: `\u5230 ${c.repo} \u91CC git pull \u4E00\u6B21\uFF1B\u4ECD\u7136\u6CA1\u6709\u5C31\u662F clone \u534A\u622A\u4E86\uFF0C\u5220\u6389\u91CD\u6765\u3002` };
9770
9902
  return { item: "\u6848\u4F8B\u5E93", verdict: "ok", detail: `\u5DF2\u63A5\u5165 Codex\uFF08${c.repo}\uFF09` };
9771
9903
  };
9772
9904
  let cases = await casesLine();
9773
9905
  if (cases.verdict !== "ok" && args.fix && report.envName) {
9774
- await deps.fixCases(report.envName);
9906
+ await deps.fixCases();
9775
9907
  cases = await casesLine();
9776
9908
  }
9777
9909
  report.lines.push(cases);
@@ -9800,7 +9932,7 @@ async function chironDoctorCommand(args, deps) {
9800
9932
  try {
9801
9933
  const report = await runChironDoctor(args, deps);
9802
9934
  const fmt = args.output ?? "table";
9803
- if (fmt === "json" || fmt === "yaml") process.stdout.write(formatObject23(report, { format: fmt }) + "\n");
9935
+ if (fmt === "json" || fmt === "yaml") process.stdout.write(formatObject24(report, { format: fmt }) + "\n");
9804
9936
  else process.stdout.write(renderChironDoctor(report) + "\n");
9805
9937
  process.exitCode = report.ok ? 0 : 1;
9806
9938
  } catch (e) {
@@ -9812,9 +9944,9 @@ async function chironDoctorCommand(args, deps) {
9812
9944
  init_exit();
9813
9945
  import { spawnSync as spawnSync2 } from "child_process";
9814
9946
  import { promises as fs11 } from "fs";
9815
- import path10 from "path";
9947
+ import path11 from "path";
9816
9948
  import yaml from "js-yaml";
9817
- import { formatObject as formatObject24 } from "@hcmai/sdk";
9949
+ import { formatObject as formatObject25 } from "@hcmai/sdk";
9818
9950
 
9819
9951
  // src/commands/delivery-action-policy.ts
9820
9952
  init_auth_guard();
@@ -10421,7 +10553,7 @@ function flagValue2(argv, flag) {
10421
10553
  }
10422
10554
 
10423
10555
  // src/commands/xlsx-peek.ts
10424
- import { readFileSync as readFileSync6 } from "fs";
10556
+ import { readFileSync as readFileSync7 } from "fs";
10425
10557
  import { inflateRawSync } from "zlib";
10426
10558
  function readZip(buf, want) {
10427
10559
  let eocd = -1;
@@ -10459,7 +10591,7 @@ function readZip(buf, want) {
10459
10591
  }
10460
10592
  var decode = (s) => s.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&apos;/g, "'").replace(/&amp;/g, "&");
10461
10593
  function xlsxRows(file, maxRows = 50) {
10462
- const buf = readFileSync6(file);
10594
+ const buf = readFileSync7(file);
10463
10595
  const [sheet] = readZip(buf, (n) => n === "xl/worksheets/sheet1.xml");
10464
10596
  if (!sheet) throw new Error(`${file} \u91CC\u6CA1\u6709 xl/worksheets/sheet1.xml\uFF0C\u53EF\u80FD\u4E0D\u662F xlsx`);
10465
10597
  const [shared] = readZip(buf, (n) => n === "xl/sharedStrings.xml");
@@ -10675,7 +10807,7 @@ async function runCase(spec, root, opts = {}, deps = defaultDeps3) {
10675
10807
  continue;
10676
10808
  }
10677
10809
  if (c.file) {
10678
- const file = path10.resolve(root, fill(c.file));
10810
+ const file = path11.resolve(root, fill(c.file));
10679
10811
  const want = c.expect ?? {};
10680
10812
  const bad = [];
10681
10813
  if (want.xlsx_header || want.xlsx_min_rows !== void 0) {
@@ -10691,7 +10823,7 @@ async function runCase(spec, root, opts = {}, deps = defaultDeps3) {
10691
10823
  results.push(bad.length ? { name: c.name, verdict: "fail", detail: bad.join("\uFF1B") } : { name: c.name, verdict: "pass", detail: "" });
10692
10824
  continue;
10693
10825
  }
10694
- const out = path10.join("evidence", "test", `${spec.name}-${c.name}`.replace(/[^\w一-龥-]+/g, "_") + ".png");
10826
+ const out = path11.join("evidence", "test", `${spec.name}-${c.name}`.replace(/[^\w一-龥-]+/g, "_") + ".png");
10695
10827
  const argv = ["--path", fill(c.page), "--out", out];
10696
10828
  if (opts.env) argv.push("--env", opts.env);
10697
10829
  const as = c.as ?? opts.as;
@@ -10708,11 +10840,11 @@ async function runCase(spec, root, opts = {}, deps = defaultDeps3) {
10708
10840
  }
10709
10841
  async function loadCases(target) {
10710
10842
  const stat = await fs11.stat(target);
10711
- const files = stat.isDirectory() ? (await fs11.readdir(target)).filter((f) => /\.ya?ml$/.test(f)).sort().map((f) => path10.join(target, f)) : [target];
10843
+ const files = stat.isDirectory() ? (await fs11.readdir(target)).filter((f) => /\.ya?ml$/.test(f)).sort().map((f) => path11.join(target, f)) : [target];
10712
10844
  const out = [];
10713
10845
  for (const f of files) {
10714
10846
  const spec = yaml.load(await fs11.readFile(f, "utf8"));
10715
- assertUsableSpec(spec, path10.basename(f));
10847
+ assertUsableSpec(spec, path11.basename(f));
10716
10848
  out.push({ file: f, spec });
10717
10849
  }
10718
10850
  if (out.length === 0) throw new Error(`${target} \u4E0B\u6CA1\u6709\u7528\u4F8B\uFF08*.yml\uFF09`);
@@ -10720,19 +10852,19 @@ async function loadCases(target) {
10720
10852
  }
10721
10853
  async function chironTestCommand(target, args, deps) {
10722
10854
  try {
10723
- const root = path10.resolve(args.project ?? ".");
10724
- const where = path10.resolve(root, target ?? "tests");
10855
+ const root = path11.resolve(args.project ?? ".");
10856
+ const where = path11.resolve(root, target ?? "tests");
10725
10857
  const cases = await loadCases(where);
10726
10858
  const report = [];
10727
10859
  let failed2 = 0;
10728
10860
  for (const { file, spec } of cases) {
10729
10861
  const results = await runCase(spec, root, { env: args.env, as: args.as }, deps);
10730
10862
  failed2 += results.filter((r) => r.verdict === "fail").length;
10731
- report.push({ case: spec.name, file: path10.relative(root, file), results });
10863
+ report.push({ case: spec.name, file: path11.relative(root, file), results });
10732
10864
  }
10733
10865
  const fmt = args.output ?? "table";
10734
10866
  if (fmt === "json" || fmt === "yaml") {
10735
- process.stdout.write(formatObject24({ ok: failed2 === 0, failed: failed2, cases: report }, { format: fmt }) + "\n");
10867
+ process.stdout.write(formatObject25({ ok: failed2 === 0, failed: failed2, cases: report }, { format: fmt }) + "\n");
10736
10868
  } else {
10737
10869
  for (const c of report) {
10738
10870
  process.stdout.write(`
@@ -10765,7 +10897,7 @@ import {
10765
10897
  ReconLayout,
10766
10898
  ROUND_EXIT_CODES,
10767
10899
  computeReconSourceKey,
10768
- formatObject as formatObject25,
10900
+ formatObject as formatObject26,
10769
10901
  fromAxiosError as fromAxiosError21,
10770
10902
  httpProbe as httpProbe3,
10771
10903
  inspectRound,
@@ -10785,7 +10917,7 @@ async function deliveryReconCommand(args) {
10785
10917
  onlyModel: args.model ?? null,
10786
10918
  identity: ctx.tenantId ? { requestedTenantId: ctx.tenantId } : null
10787
10919
  });
10788
- process.stdout.write(formatObject25(summary, { format: args.output ?? "json" }) + "\n");
10920
+ process.stdout.write(formatObject26(summary, { format: args.output ?? "json" }) + "\n");
10789
10921
  } catch (e) {
10790
10922
  const err = e;
10791
10923
  if (err?.isAxiosError) exitWithError(fromAxiosError21(err, args.env));
@@ -10799,7 +10931,7 @@ async function deliveryReconRoundCommand(args) {
10799
10931
  const result = inspectRound(args.dir ?? ".");
10800
10932
  const fmt = args.output ?? "json";
10801
10933
  if (fmt !== "json") process.stdout.write(renderRound(result));
10802
- process.stdout.write(formatObject25(result, { format: fmt }) + "\n");
10934
+ process.stdout.write(formatObject26(result, { format: fmt }) + "\n");
10803
10935
  code = ROUND_EXIT_CODES[result.state];
10804
10936
  } catch (e) {
10805
10937
  exitWithError(e);
@@ -10868,8 +11000,8 @@ import {
10868
11000
  writeImportPlan,
10869
11001
  writeRisk
10870
11002
  } from "@hcmai/sdk";
10871
- import { existsSync as existsSync2 } from "fs";
10872
- import * as path11 from "path";
11003
+ import { existsSync as existsSync3 } from "fs";
11004
+ import * as path12 from "path";
10873
11005
  function premise(message, hint = "") {
10874
11006
  process.stderr.write(message + (hint ? `
10875
11007
  \u2192 ${hint}` : "") + "\n");
@@ -10880,7 +11012,7 @@ async function runSeedPlan(args, client3) {
10880
11012
  const tenant2 = tenantOf(client3);
10881
11013
  const work = seedWorkDir({ out, tenant: tenant2, work: args.work ?? null, mapping: args.mapping ?? null });
10882
11014
  const mappingPath = seedMappingPath({ out, tenant: tenant2, mapping: args.mapping ?? null }, work);
10883
- if (!existsSync2(mappingPath)) {
11015
+ if (!existsSync3(mappingPath)) {
10884
11016
  return premise(
10885
11017
  `\u8BFB\u4E0D\u5230\u5BFC\u5165\u6620\u5C04\u5DE5\u4EF6\uFF1A${mappingPath}`,
10886
11018
  "\u5DE5\u4EF6\u662F\u987E\u95EE\u81EA\u5DF1\u5199\u7684\uFF08\u5951\u7EA6\u89C1 README \u7684 `work/mapping.json` \u4E00\u8282\uFF09\u3002\u5199\u5728\u522B\u5904\u5C31\u7528 `--mapping <\u8DEF\u5F84>` \u6307\u8FC7\u53BB\uFF0C\u6216\u7528 `--work <\u76EE\u5F55>` \u6362 work \u76EE\u5F55\u3002"
@@ -10896,13 +11028,13 @@ async function runSeedPlan(args, client3) {
10896
11028
  const reconDir = candidates[0].reconDir;
10897
11029
  if (candidates.length > 1) {
10898
11030
  process.stderr.write(
10899
- `\u26A0\uFE0F \u540C\u79DF\u6237\u4E0B\u6709 ${candidates.length} \u4EFD\u57FA\u7EBF\uFF0C\u672C\u8F6E\u8BFB\u7684\u662F \`${path11.basename(reconDir)}\`\uFF1A` + candidates.slice(1).map((c) => `\`${path11.basename(c.reconDir)}\``).join("\u3001") + " \u672A\u88AB\u8BFB\u53D6 \u2014\u2014 \u4E0D\u540C sourceKey \u7684\u4EA7\u7269**\u4E0D\u53EF\u4E92\u6362**\u3002\n"
11031
+ `\u26A0\uFE0F \u540C\u79DF\u6237\u4E0B\u6709 ${candidates.length} \u4EFD\u57FA\u7EBF\uFF0C\u672C\u8F6E\u8BFB\u7684\u662F \`${path12.basename(reconDir)}\`\uFF1A` + candidates.slice(1).map((c) => `\`${path12.basename(c.reconDir)}\``).join("\u3001") + " \u672A\u88AB\u8BFB\u53D6 \u2014\u2014 \u4E0D\u540C sourceKey \u7684\u4EA7\u7269**\u4E0D\u53EF\u4E92\u6362**\u3002\n"
10900
11032
  );
10901
11033
  }
10902
11034
  const round = inspectRound2(reconDir);
10903
11035
  process.stderr.write(roundWarning(round));
10904
11036
  const baseline = {
10905
- path: `${path11.basename(path11.dirname(reconDir))}/${path11.basename(reconDir)}`,
11037
+ path: `${path12.basename(path12.dirname(reconDir))}/${path12.basename(reconDir)}`,
10906
11038
  roundId: round.roundId ?? null
10907
11039
  };
10908
11040
  let exemptions = null;
@@ -11162,9 +11294,9 @@ async function deliverySeedVerifyCommand(args) {
11162
11294
  }
11163
11295
 
11164
11296
  // src/commands/delivery-seed-find.ts
11165
- import { existsSync as existsSync3 } from "fs";
11166
- import { readFileSync as readFileSync7 } from "fs";
11167
- import * as path12 from "path";
11297
+ import { existsSync as existsSync4 } from "fs";
11298
+ import { readFileSync as readFileSync8 } from "fs";
11299
+ import * as path13 from "path";
11168
11300
  import {
11169
11301
  INIT_EXIT_CODES as INIT_EXIT_CODES2,
11170
11302
  ValueHints,
@@ -11178,10 +11310,10 @@ import {
11178
11310
  valuesRoundCaveat
11179
11311
  } from "@hcmai/sdk";
11180
11312
  function provenance(chosenReconDir, others) {
11181
- let line = `> \u57FA\u7EBF\uFF1A\`${path12.basename(chosenReconDir)}\`
11313
+ let line = `> \u57FA\u7EBF\uFF1A\`${path13.basename(chosenReconDir)}\`
11182
11314
  `;
11183
11315
  if (others.length > 0) {
11184
- line += `> \u26A0\uFE0F \u540C\u79DF\u6237\u4E0B\u53E6\u6709 ${others.length} \u4EFD\u57FA\u7EBF\u672A\u88AB\u8BFB\u53D6\uFF1A` + others.map((o) => `\`${path12.basename(o)}\``).join("\u3001") + " \u2014\u2014 \u4E0D\u540C sourceKey \u7684\u4EA7\u7269**\u4E0D\u53EF\u4E92\u6362**\u3002\n";
11316
+ line += `> \u26A0\uFE0F \u540C\u79DF\u6237\u4E0B\u53E6\u6709 ${others.length} \u4EFD\u57FA\u7EBF\u672A\u88AB\u8BFB\u53D6\uFF1A` + others.map((o) => `\`${path13.basename(o)}\``).join("\u3001") + " \u2014\u2014 \u4E0D\u540C sourceKey \u7684\u4EA7\u7269**\u4E0D\u53EF\u4E92\u6362**\u3002\n";
11185
11317
  }
11186
11318
  return `${line}
11187
11319
  `;
@@ -11223,10 +11355,10 @@ function runSeedFind(args) {
11223
11355
  const chosen = { reconDir: picked.reconDir, indexFile: picked.indexFile };
11224
11356
  const prefix = picked.prefix;
11225
11357
  process.stdout.write(prefix);
11226
- if (!existsSync3(chosen.indexFile)) {
11358
+ if (!existsSync4(chosen.indexFile)) {
11227
11359
  return premise2(`\u7D22\u5F15\u6587\u4EF6\u5728\u9009\u4E2D\u4E4B\u540E\u6D88\u5931\u4E86\uFF1A${chosen.indexFile}`);
11228
11360
  }
11229
- const { rows, problems } = loadRows(readFileSync7(chosen.indexFile, "utf-8"));
11361
+ const { rows, problems } = loadRows(readFileSync8(chosen.indexFile, "utf-8"));
11230
11362
  process.stdout.write(
11231
11363
  renderFind(find(rows, args.term), args.term, rows.length, {
11232
11364
  prefixBytes: Buffer.byteLength(prefix, "utf-8"),
@@ -11266,7 +11398,7 @@ function deliverySeedValuesCommand(model, args) {
11266
11398
 
11267
11399
  // src/commands/delivery-meta.ts
11268
11400
  init_auth_guard();
11269
- import { readFileSync as readFileSync8 } from "fs";
11401
+ import { readFileSync as readFileSync9 } from "fs";
11270
11402
  import {
11271
11403
  BINDING_WORDS,
11272
11404
  CHANGE_STATES,
@@ -11414,7 +11546,7 @@ function premise3(what, hint) {
11414
11546
  async function runDeliveryMeta(args, client3) {
11415
11547
  let content;
11416
11548
  try {
11417
- content = readFileSync8(args.contentFile, "utf-8");
11549
+ content = readFileSync9(args.contentFile, "utf-8");
11418
11550
  } catch (e) {
11419
11551
  return premise3(
11420
11552
  `\u8981\u5199\u8FDB\u53BB\u7684\u6B63\u6587\u8BFB\u4E0D\u51FA\u6765\uFF1A${e.message}`,
@@ -11517,8 +11649,8 @@ import {
11517
11649
  ReconLayout as ReconLayout2,
11518
11650
  runTriageRound
11519
11651
  } from "@hcmai/sdk";
11520
- import { mkdirSync, readFileSync as readFileSync9, writeFileSync as writeFileSync2 } from "fs";
11521
- import * as path13 from "path";
11652
+ import { mkdirSync as mkdirSync2, readFileSync as readFileSync10, writeFileSync as writeFileSync3 } from "fs";
11653
+ import * as path14 from "path";
11522
11654
  var DEFAULT_CAPABILITIES3 = "default";
11523
11655
  function premise4(message, hint) {
11524
11656
  process.stderr.write(`\u{1F534} \u524D\u63D0\u4E0D\u6210\u7ACB\uFF1A${message}
@@ -11531,7 +11663,7 @@ var REQUESTS_SHAPE = "`--requests` \u6536\u7684\u662F\u4E00\u4E2A JSON \u6570\u7
11531
11663
  function readRequests(file) {
11532
11664
  let raw;
11533
11665
  try {
11534
- raw = JSON.parse(readFileSync9(file, "utf8"));
11666
+ raw = JSON.parse(readFileSync10(file, "utf8"));
11535
11667
  } catch (e) {
11536
11668
  throw new Error(`\u9700\u6C42\u6E05\u5355\u8BFB\u4E0D\u51FA\u6765\uFF08${file}\uFF09\uFF1A${e instanceof Error ? e.message : String(e)}`);
11537
11669
  }
@@ -11554,9 +11686,9 @@ function renderProblems(rows) {
11554
11686
  `;
11555
11687
  }
11556
11688
  function writeTriageArtifact(outDir, body) {
11557
- const out = path13.join(outDir, "work", "triage.md");
11558
- mkdirSync(path13.dirname(out), { recursive: true });
11559
- writeFileSync2(out, body, "utf8");
11689
+ const out = path14.join(outDir, "work", "triage.md");
11690
+ mkdirSync2(path14.dirname(out), { recursive: true });
11691
+ writeFileSync3(out, body, "utf8");
11560
11692
  return out;
11561
11693
  }
11562
11694
  async function runTriage(args) {
@@ -11599,23 +11731,23 @@ init_exit();
11599
11731
  import {
11600
11732
  HcmClient as HcmClient27,
11601
11733
  adminResetPassword,
11602
- formatObject as formatObject26,
11734
+ formatObject as formatObject27,
11603
11735
  fromAxiosError as fromAxiosError22,
11604
- CliError as CliError24,
11605
- CliErrorCode as CliErrorCode22
11736
+ CliError as CliError25,
11737
+ CliErrorCode as CliErrorCode23
11606
11738
  } from "@hcmai/sdk";
11607
11739
  function buildAdminResetPasswordRequest(args, password) {
11608
11740
  const hasId = Boolean(args.id);
11609
11741
  const hasUsername = Boolean(args.username);
11610
11742
  if (hasId === hasUsername) {
11611
- throw new CliError24({
11612
- code: CliErrorCode22.INVALID_ARGUMENT,
11743
+ throw new CliError25({
11744
+ code: CliErrorCode23.INVALID_ARGUMENT,
11613
11745
  message: "--id <uuid> \u4E0E --username <user> \u5FC5\u987B\u4E14\u53EA\u80FD\u63D0\u4F9B\u4E00\u4E2A"
11614
11746
  });
11615
11747
  }
11616
11748
  if (!password) {
11617
- throw new CliError24({
11618
- code: CliErrorCode22.INVALID_ARGUMENT,
11749
+ throw new CliError25({
11750
+ code: CliErrorCode23.INVALID_ARGUMENT,
11619
11751
  message: "\u65B0\u5BC6\u7801\u4E0D\u80FD\u4E3A\u7A7A"
11620
11752
  });
11621
11753
  }
@@ -11633,7 +11765,7 @@ async function userResetPasswordCommand(args) {
11633
11765
  const request = buildAdminResetPasswordRequest(args, password);
11634
11766
  const client3 = HcmClient27.fromAuthContext(await getActiveAuthContextFromCli(args));
11635
11767
  const result = await adminResetPassword(client3.raw(), request);
11636
- process.stdout.write(formatObject26(result, { format: args.output ?? "json" }) + "\n");
11768
+ process.stdout.write(formatObject27(result, { format: args.output ?? "json" }) + "\n");
11637
11769
  } catch (cause) {
11638
11770
  const err = cause;
11639
11771
  if (err?.isAxiosError) exitWithError(fromAxiosError22(err, args.env));
@@ -11644,8 +11776,8 @@ async function promptPasswordTwice() {
11644
11776
  const password = await promptSecret("\u65B0\u5BC6\u7801: ");
11645
11777
  const confirmation = await promptSecret("\u518D\u6B21\u8F93\u5165\u65B0\u5BC6\u7801: ");
11646
11778
  if (password !== confirmation) {
11647
- throw new CliError24({
11648
- code: CliErrorCode22.INVALID_ARGUMENT,
11779
+ throw new CliError25({
11780
+ code: CliErrorCode23.INVALID_ARGUMENT,
11649
11781
  message: "\u4E24\u6B21\u8F93\u5165\u7684\u65B0\u5BC6\u7801\u4E0D\u4E00\u81F4"
11650
11782
  });
11651
11783
  }
@@ -11657,7 +11789,7 @@ init_exit();
11657
11789
  init_auth_guard();
11658
11790
  import {
11659
11791
  HcmClient as HcmClient28,
11660
- formatObject as formatObject27,
11792
+ formatObject as formatObject28,
11661
11793
  fromAxiosError as fromAxiosError23
11662
11794
  } from "@hcmai/sdk";
11663
11795
  async function modelsCommand(keyword, args) {
@@ -11668,7 +11800,7 @@ async function modelsCommand(keyword, args) {
11668
11800
  const rows = (needle ? all.filter((m) => JSON.stringify(m).toLowerCase().includes(needle)) : all).sort((a, b) => key(a).localeCompare(key(b)));
11669
11801
  const fmt = args.output ?? "table";
11670
11802
  if (fmt !== "table") {
11671
- process.stdout.write(formatObject27({ total: rows.length, models: rows }, { format: fmt }) + "\n");
11803
+ process.stdout.write(formatObject28({ total: rows.length, models: rows }, { format: fmt }) + "\n");
11672
11804
  process.exitCode = 0;
11673
11805
  return;
11674
11806
  }
@@ -11761,13 +11893,18 @@ chiron.command("init").description(
11761
11893
  ).option("--project <dir>", "\u9879\u76EE\u6839\u76EE\u5F55", ".").option("--skip-skills", "\u4E0D\u88C5\u6280\u80FD\uFF08\u79BB\u7EBF/\u6D4B\u8BD5\uFF09").option("--skip-cases", "\u4E0D\u63A5\u6848\u4F8B\u5E93").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((opts) => chironInitCommand(opts));
11762
11894
  chiron.command("test").description("\u6309\u7528\u4F8B\u8DD1\u4E00\u904D\u5E76\u628A\u95EE\u9898\u627E\u51FA\u6765\uFF1A\u7528\u4F8B\u5728\u9879\u76EE\u4ED3 tests/\uFF0C\u5224\u636E\u5FC5\u987B\u770B\u5185\u5BB9\uFF08\u53EA\u5224\u9000\u51FA\u7801\u7684\u7528\u4F8B\u4F1A\u88AB\u62D2\u7EDD\u52A0\u8F7D\uFF09").argument("[target]", "\u7528\u4F8B\u6587\u4EF6\u6216\u76EE\u5F55\uFF08\u9ED8\u8BA4 tests/\uFF09").option("--project <dir>", "\u9879\u76EE\u6839\u76EE\u5F55", ".").option("--env <name>", "\u76EE\u6807\u73AF\u5883\uFF1B\u7528\u4F8B\u91CC\u6CA1\u5199 --env \u65F6\u8865\u4E0A").option("--as <identity>", "\u8EAB\u4EFD\uFF1B\u7528\u4F8B\u91CC\u6CA1\u5199 --as \u65F6\u8865\u4E0A").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((target, opts) => chironTestCommand(target, opts));
11763
11895
  chiron.command("doctor").description(
11764
- "\u6838\u5BF9\uFF1A\u672C\u673A\u767B\u5F55\u662F\u5426\u5BF9\u7740 env.yaml \u7684\u73AF\u5883\uFF08\u542B\u56DB\u6761\u951A\u70B9\uFF09/ \u6280\u80FD\u88C5\u6CA1\u88C5 / \u6848\u4F8B\u5E93\u63A5\u6CA1\u63A5 / Jira \u80FD\u4E0D\u80FD\u63D0\u5355"
11896
+ "\u6838\u5BF9\uFF1A\u672C\u673A\u767B\u5F55\u662F\u5426\u5BF9\u7740 env.yaml \u7684\u73AF\u5883\uFF08\u542B\u56DB\u6761\u951A\u70B9\uFF09/ \u6280\u80FD\u88C5\u6CA1\u88C5 / \u6848\u4F8B\u5E93 clone \u4E86\u6CA1 / Jira \u80FD\u4E0D\u80FD\u63D0\u5355"
11765
11897
  ).option("--project <dir>", "\u9879\u76EE\u6839\u76EE\u5F55", ".").option("--env <name>", "\u8986\u76D6\u8981\u6838\u7684\u73AF\u5883\u522B\u540D\uFF08\u9ED8\u8BA4\u53D6 env.yaml\uFF1B\u591A\u73AF\u5883\u9879\u76EE\u7528\u5B83\u6328\u4E2A\u63A2\uFF09").option("--as <identity>", "\u4E34\u65F6\u6362\u8EAB\u4EFD\u63A2\u951A\u70B9").option("--fix", "\u80FD\u81EA\u52A8\u8865\u7684\u8865\u4E0A\uFF08\u6280\u80FD / \u6848\u4F8B\u5E93\uFF09\u540E\u518D\u6838\u4E00\u904D").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((opts) => chironDoctorCommand(opts));
11766
11898
  var OUTPUT_OPT = ["--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table"];
11767
11899
  var gap = chiron.command("gap").description("\u7F3A\u53E3\uFF1A\u649E\u5230\u300C\u4EA7\u54C1\u505A\u4E0D\u5230\u300D\u65F6\u7684\u7EDF\u4E00\u51FA\u53E3\uFF0C\u8FDB Jira\uFF08HCMNX\uFF09\u2014\u2014\u67E5\u91CD search / \u67E5\u8FDB\u5EA6 status / \u63D0\u7F3A\u53E3 submit");
11768
11900
  gap.command("search").description("\u67E5\u91CD\uFF1A\u6309\u9519\u8BEF\u7801 / Model / Action / \u4E00\u53E5\u73B0\u8C61\u67E5 Jira\uFF0C\u5E26\u56DE\u7F16\u53F7\u4E0E\u72B6\u6001").argument("<keywords...>", "\u5173\u952E\u8BCD\uFF0C\u6BCF\u4E2A\u5355\u72EC\u67E5\u4E00\u6B21").option("--no-include-closed", "\u53EA\u67E5\u672A\u89E3\u51B3\u7684").option(...OUTPUT_OPT).action((keywords, opts) => gapSearchCommand(keywords, opts));
11769
11901
  gap.command("status").description("\u67E5\u8FDB\u5EA6\uFF1A\u7ED9 Jira \u5355\u53F7\uFF08HCMNX-12 \u6216\u88F8\u6570\u5B57 12\uFF09").argument("<ref>", "Jira \u5355\u53F7").option(...OUTPUT_OPT).action((ref, opts) => gapStatusCommand(ref, opts));
11770
11902
  gap.command("submit").description("\u63D0\u7F3A\u53E3\uFF1A\u5148\u67E5\u91CD\uFF08\u540C\u4E00\u7F3A\u53E3\u8FFD\u52A0\u300C\u53C8\u4E00\u4E2A\u73B0\u573A\u300D\uFF09\uFF0C\u5426\u5219\u6309 HCMNX \u5FC5\u586B\u683C\u65B0\u5F00\uFF1B\u8F7D\u8377 JSON \u8D70 --file \u6216\u6807\u51C6\u8F93\u5165").option("--file <path>", "\u7F3A\u53E3\u8F7D\u8377 JSON\uFF08title/phenomenon/repro/expected/alternative/q_*/severity/kind/module\u2026\uFF09").option("--env <name>", "\u53D6\u73AF\u5883\u6307\u7EB9\u7528\u7684\u73AF\u5883\u522B\u540D\uFF08\u7F3A\u7701 activeEnv\uFF09").option("--fingerprint <text>", "\u76F4\u63A5\u7ED9\u6307\u7EB9\u6587\u672C\uFF08\u8BAD\u7EC3\u573A\u4ECE \u573A.yml \u53D6\u65F6\u7528\uFF09\uFF0C\u4E0D\u518D\u73B0\u67E5").option("--issuetype <name>", "\u8986\u76D6 issuetype\uFF08\u7F3A\u7701\u6309 kind \u9009 \u6545\u969C / \u9700\u6C42\uFF09").option("--assignee <user>", "\u8986\u76D6\u7ECF\u529E\u4EBA\uFF08\u7F3A\u7701\u9879\u76EE\u8D1F\u8D23\u4EBA\uFF09").option(...OUTPUT_OPT).action((opts) => gapSubmitCommand(opts));
11903
+ var kase = chiron.command("case").description("\u516C\u5171\u6848\u4F8B\u5E93\uFF1A\u67E5 search / \u770B show / \u5BF9\u6307\u7EB9 match / \u9879\u76EE\u6848\u4F8B\u4E0A\u884C submit");
11904
+ kase.command("search").description("\u6309\u5BA2\u6237\u539F\u8BDD / \u9519\u8BEF\u7801 / Model / \u6280\u80FD\u627E\u516C\u5171\u6848\u4F8B\uFF0C\u5E76\u6309\u5F53\u524D\u73AF\u5883\u6307\u7EB9\u6807\u5339\u914D").argument("<query>", "\u4E00\u53E5\u8BDD\u6216\u5173\u952E\u8BCD").option("--top-k <n>", "\u53D6\u524D\u51E0\u6761\uFF081-10\uFF09", "5").option("--env <name>", "\u7528\u54EA\u4E2A\u73AF\u5883\u7684\u540E\u7AEF\u6307\u7EB9\u6BD4\u5BF9\uFF08\u4E0D\u7ED9\u5C31\u6807\u300C\u672A\u6BD4\u5BF9\u300D\uFF0C\u4E0D\u5047\u88C5\u5339\u914D\uFF09").option(...OUTPUT_OPT).action((query, opts) => caseSearchCommand(query, { ...opts, topK: Number(opts.topK) }));
11905
+ kase.command("show").description("\u8BFB\u4E00\u4E2A\u6848\u4F8B\u7684\u6B63\u6587\uFF08\u9ED8\u8BA4 \u95EE\u9898.md + \u65B9\u6848.md\uFF09").argument("<id>", "\u6848\u4F8B id\uFF0C\u5982 CASE-20260828-xxx").option("--file <name>", "\u53EA\u770B\u67D0\u4E00\u4EFD\u6587\u4EF6").option(...OUTPUT_OPT).action((id, opts) => caseShowCommand(id, opts));
11906
+ kase.command("match").description("\u5217\u51FA\u5F53\u524D\u73AF\u5883\u6307\u7EB9\u4E0B\u53EF\u7167\u505A\u7684\u516C\u5171\u6848\u4F8B\uFF08status=approved\uFF09").option("--env <name>", "\u7528\u54EA\u4E2A\u73AF\u5883\u7684\u540E\u7AEF\u6307\u7EB9\u6BD4\u5BF9").option(...OUTPUT_OPT).action((opts) => caseMatchCommand(opts));
11907
+ kase.command("submit").description("\u628A\u9879\u76EE\u6848\u4F8B\u8131\u654F\u4E0A\u884C\u4E3A\u516C\u5171\u6848\u4F8B\uFF1A\u590D\u5236\u8FDB\u672C\u673A clone \u2192 tier=public \u2192 lint \u2192 \u5F00 PR").argument("<dir>", "\u9879\u76EE\u4ED3\u91CC\u7684\u6848\u4F8B\u76EE\u5F55\uFF0C\u5982 cases/CASE-20260902-xxx").requiredOption("--category <name>", "\u516C\u5171\u6848\u4F8B\u7684\u5206\u7C7B\u76EE\u5F55").requiredOption("--origin <text>", "\u6765\u6E90\u8BF4\u660E\uFF0C\u5982\u300C\u9879\u76EE\u4ED3 acme-hr cases/\u2026\u300D").option(...OUTPUT_OPT).action((dir, opts) => caseSubmitCommand(dir, opts));
11771
11908
  var recon = chiron.command("recon").description("\u722C\u4E00\u4EFD\u53EF\u5E26\u8D70\u7684\u57FA\u7EBF\uFF1A\u6A21\u578B / \u5B57\u6BB5 / \u53EA\u8BFB\u95F8 / \u4F9D\u8D56\u56FE / \u7801\u8868 / \u53EF\u5199\u6027\u753B\u50CF").option("--env <name>", "\u76EE\u6807\u73AF\u5883\u522B\u540D").option("--as <identity>", "\u4E34\u65F6\u6362\u8EAB\u4EFD").option("--out <dir>", "\u4EA7\u7269\u6839\u76EE\u5F55\uFF08\u4EA7\u7269\u843D\u5728 <out>/recon/<\u79DF\u6237\u6BB5>/<\u6765\u6E90\u6BB5>\uFF09", ".").option("--state <s>", "\u53EA\u8BFB\u95F8\u7684 state\uFF08\u4EA7\u54C1\u91CC state \u4E0D\u53EF\u679A\u4E3E\uFF0C\u95F8\u7684\u8986\u76D6\u9762\u6C38\u8FDC\u662F state-scoped\uFF09").option("--model <key>", "\u5B9A\u5411\u91CD\u722C\uFF1A\u53EA\u91CD\u722C\u8FD9\u4E00\u4E2A\u6A21\u578B\uFF0C\u5176\u4F59\u6CBF\u7528\u4E0A\u4E00\u8F6E\u4EA7\u7269").option("--capabilities <s>", "\u722C\u53D6\u65F6\u58F0\u660E\u7684 capability \u4E32\uFF08\u4F1A\u968F\u56DB\u5143\u7EC4\u7559\u6863\uFF09").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").action((opts) => deliveryReconCommand(opts));
11772
11909
  recon.command("round").description("\u96F6\u7F51\u7EDC\uFF1A\u8BFB\u4E00\u4EFD\u5DF2\u843D\u76D8\u7684\u57FA\u7EBF\uFF0C\u5224\u65AD\u5B83\u662F\u4E0D\u662F\u4E00\u8F6E\u5B8C\u6574\u8DD1\u51FA\u6765\u7684\uFF08complete/mixed/unknown\uFF09").option("--dir <dir>", "\u4EA7\u7269\u76EE\u5F55\uFF08<out>/recon/<\u79DF\u6237\u6BB5>/<\u6765\u6E90\u6BB5>\uFF09", ".").action(
11773
11910
  (opts, cmd) => deliveryReconRoundCommand({
@@ -11951,7 +12088,7 @@ program.command("update <Model>").description("\u66F4\u65B0\u4E00\u6761 Model \u
11951
12088
  ).action((model, opts) => updateCommand(model, opts));
11952
12089
  program.command("version").description("\u67E5 CLI \u4E0E\u540E\u7AEF\u4E24\u4E2A\u7248\u672C\uFF08commit / tag / \u6784\u5EFA\u65F6\u95F4\uFF09\u2014\u2014\u514D\u8BA4\u8BC1\uFF0C\u65E0\u9700\u5148 login").option("--endpoint <url>", "\u540E\u7AEF\u5730\u5740\uFF08\u9ED8\u8BA4\u53D6 activeEnv \u7684 endpoint\uFF09").option("--env <name>", "\u4ECE\u8BE5 env \u89E3\u6790 endpoint").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").action((opts) => versionCommand(opts));
11953
12090
  program.command("upgrade").alias("self-update").description("\u5347\u7EA7 CLI \u81EA\u5DF1\uFF08\u6CE8\u610F\uFF1A`hcm update` \u662F\u66F4\u65B0\u4E1A\u52A1\u8BB0\u5F55\uFF0C\u4E0D\u662F\u5347\u7EA7\uFF09").option("--check", "\u53EA\u68C0\u67E5\uFF1B\u6709\u65B0\u7248\u672C\u65F6\u4EE5\u9000\u51FA\u7801 1 \u7ED3\u675F\uFF0C\u4FBF\u4E8E\u811A\u672C\u5224\u65AD").action((opts) => upgradeCommand(opts));
11954
- program.command("open [path]").description("\u7528\u5F53\u524D CLI \u8EAB\u4EFD\u6253\u5F00\u524D\u7AEF\u9875\u9762\uFF1A\u94F8\u4E00\u5F20 60s \u4E00\u6B21\u6027\u7968\u636E\u4EA4\u7ED9\u6D4F\u89C8\u5668\uFF0C\u4F1A\u8BDD token \u4E0D\u8FDB URL").option("--print-url", "\u53EA\u6253\u5370\u767B\u5F55 URL\uFF0C\u4E0D\u5F00\u6D4F\u89C8\u5668\uFF08\u7ED9 agent \u6D4F\u89C8\u5668 navigate \u7528\uFF09").option("--env <name>", "\u4E34\u65F6\u5207\u73AF\u5883\uFF08\u8986\u76D6 activeEnv\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--as <identity>", "\u4E34\u65F6\u6362\u8EAB\u4EFD\uFF08\u8986\u76D6 env defaultIdentity\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--profile <name>", "[deprecated] \u7528 --env \u66FF\u4EE3").action((path14, opts) => openCommand(path14, opts));
12091
+ program.command("open [path]").description("\u7528\u5F53\u524D CLI \u8EAB\u4EFD\u6253\u5F00\u524D\u7AEF\u9875\u9762\uFF1A\u94F8\u4E00\u5F20 60s \u4E00\u6B21\u6027\u7968\u636E\u4EA4\u7ED9\u6D4F\u89C8\u5668\uFF0C\u4F1A\u8BDD token \u4E0D\u8FDB URL").option("--print-url", "\u53EA\u6253\u5370\u767B\u5F55 URL\uFF0C\u4E0D\u5F00\u6D4F\u89C8\u5668\uFF08\u7ED9 agent \u6D4F\u89C8\u5668 navigate \u7528\uFF09").option("--env <name>", "\u4E34\u65F6\u5207\u73AF\u5883\uFF08\u8986\u76D6 activeEnv\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--as <identity>", "\u4E34\u65F6\u6362\u8EAB\u4EFD\uFF08\u8986\u76D6 env defaultIdentity\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--profile <name>", "[deprecated] \u7528 --env \u66FF\u4EE3").action((path15, opts) => openCommand(path15, opts));
11955
12092
  var setting = program.command("setting").description("\u79DF\u6237\u7CFB\u7EDF\u53C2\u6570\uFF08\u767B\u5F55\u7B56\u7565 / \u5BC6\u7801\u7B56\u7565 / \u529F\u80FD\u5F00\u5173 / \u96C6\u6210\u53C2\u6570\uFF09");
11956
12093
  setting.command("get <domain>").description("\u8BFB\u67D0\u57DF\u53C2\u6570\uFF08\u5B9A\u4E49 + \u79DF\u6237\u8986\u76D6\u503C\u5408\u5E76\uFF0C\u7F3A\u5931\u56DE\u843D\u9ED8\u8BA4\u503C\uFF09").option("--env <name>", "\u4E34\u65F6\u5207\u73AF\u5883\uFF08\u8986\u76D6 activeEnv\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--as <identity>", "\u4E34\u65F6\u6362\u8EAB\u4EFD").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((d, opts) => settingGetCommand(d, opts));
11957
12094
  setting.command("set <domain>").description("\u6539\u53C2\u6570\uFF0C\u53EF\u91CD\u590D --set\uFF1B\u8D70\u53D7\u63A7\u6821\u9A8C\u8DEF\u5F84\u800C\u975E\u6807\u51C6 CRUD").option(