@hcmai/cli 0.4.26 → 0.4.28

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(path17) {
536
- const segs = path17.split(".").filter(Boolean);
535
+ originLine(path18) {
536
+ const segs = path18.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(path17) {
1719
- const segs = (path17 ?? "").split(".").filter(Boolean);
1718
+ function originLine(path18) {
1719
+ const segs = (path18 ?? "").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
  }
@@ -3362,7 +3362,7 @@ function launchBrowser(url, platform = process.platform) {
3362
3362
  child.unref();
3363
3363
  }
3364
3364
  async function runOpen(target, args, deps) {
3365
- const path17 = normalizeTarget(target);
3365
+ const path18 = normalizeTarget(target);
3366
3366
  if (!deps.frontend?.trim()) {
3367
3367
  throw new CliError12({
3368
3368
  code: CliErrorCode11.INVALID_ARGUMENT,
@@ -3370,13 +3370,13 @@ async function runOpen(target, args, deps) {
3370
3370
  });
3371
3371
  }
3372
3372
  const { ticket, expiresIn } = await deps.mintTicket();
3373
- const url = buildBrowserLoginUrl(deps.frontend, ticket, path17);
3373
+ const url = buildBrowserLoginUrl(deps.frontend, ticket, path18);
3374
3374
  if (args.printUrl) {
3375
3375
  deps.write(`${url}
3376
3376
  `);
3377
3377
  } else {
3378
3378
  deps.launch(url);
3379
- deps.write(`\u5DF2\u7528\u5F53\u524D\u8EAB\u4EFD\u6253\u5F00 ${path17}\uFF08\u7968\u636E ${expiresIn ?? 60}s \u5185\u6709\u6548\uFF0C\u53EA\u80FD\u7528\u4E00\u6B21\uFF09
3379
+ deps.write(`\u5DF2\u7528\u5F53\u524D\u8EAB\u4EFD\u6253\u5F00 ${path18}\uFF08\u7968\u636E ${expiresIn ?? 60}s \u5185\u6709\u6548\uFF0C\u53EA\u80FD\u7528\u4E00\u6B21\uFF09
3380
3380
  `);
3381
3381
  }
3382
3382
  return { url, expiresIn };
@@ -3470,8 +3470,8 @@ import {
3470
3470
  formatObject as formatObject7,
3471
3471
  fromAxiosError as fromAxiosError9
3472
3472
  } from "@hcmai/sdk";
3473
- function collectYmlFiles(path17) {
3474
- if (statSync(path17).isFile()) return [path17];
3473
+ function collectYmlFiles(path18) {
3474
+ if (statSync(path18).isFile()) return [path18];
3475
3475
  const out = [];
3476
3476
  const walk = (dir) => {
3477
3477
  for (const name of readdirSync(dir).sort()) {
@@ -3480,7 +3480,7 @@ function collectYmlFiles(path17) {
3480
3480
  else if (full.endsWith(".yml") || full.endsWith(".yaml")) out.push(full);
3481
3481
  }
3482
3482
  };
3483
- walk(path17);
3483
+ walk(path18);
3484
3484
  return out.sort();
3485
3485
  }
3486
3486
  var DRY_RUN_CLIENT = {
@@ -3488,9 +3488,9 @@ var DRY_RUN_CLIENT = {
3488
3488
  create: async () => ({ id: "" }),
3489
3489
  update: async () => ({})
3490
3490
  };
3491
- async function importCommand(path17, args) {
3491
+ async function importCommand(path18, args) {
3492
3492
  try {
3493
- const files = collectYmlFiles(path17);
3493
+ const files = collectYmlFiles(path18);
3494
3494
  const fixtures = files.map(
3495
3495
  (f) => parseFixture(readFileSync2(f, "utf8"), relative(process.cwd(), f))
3496
3496
  );
@@ -4751,8 +4751,8 @@ async function scriptManifestValidateCommand(args) {
4751
4751
  if (!args.file) {
4752
4752
  throw new Error("\u7F3A\u5C11 --file\n \u4E0B\u4E00\u6B65\uFF1Ahcm script manifest-validate --file ./manifest.yml");
4753
4753
  }
4754
- const yaml2 = readFileSync3(args.file, "utf8");
4755
- const result = await withClient2(args, (c) => validateScriptManifest(c.raw(), yaml2));
4754
+ const yaml3 = readFileSync3(args.file, "utf8");
4755
+ const result = await withClient2(args, (c) => validateScriptManifest(c.raw(), yaml3));
4756
4756
  emit2(result, args, `\u{1F4CB} manifest \u6821\u9A8C\u5B8C\u6210\uFF1A${args.file}`);
4757
4757
  } catch (e) {
4758
4758
  fail3(e, args);
@@ -6606,10 +6606,10 @@ async function metaListCommand(args) {
6606
6606
  fail5(e, args);
6607
6607
  }
6608
6608
  }
6609
- async function metaGetCommand(path17, args) {
6609
+ async function metaGetCommand(path18, args) {
6610
6610
  try {
6611
6611
  const c = await client2(args);
6612
- const content = await getTenantMeta(c.raw(), path17);
6612
+ const content = await getTenantMeta(c.raw(), path18);
6613
6613
  process.stdout.write(content.endsWith("\n") ? content : content + "\n");
6614
6614
  process.exitCode = 0;
6615
6615
  return;
@@ -6618,8 +6618,8 @@ async function metaGetCommand(path17, args) {
6618
6618
  }
6619
6619
  }
6620
6620
  var PROBEABLE_META_TYPES = /* @__PURE__ */ new Set(["model", "list", "info", "view", "filter", "page", "wiz", "impexp"]);
6621
- function parseMetaPath(path17) {
6622
- const base = path17.split(/[\\/]/).pop() ?? path17;
6621
+ function parseMetaPath(path18) {
6622
+ const base = path18.split(/[\\/]/).pop() ?? path18;
6623
6623
  if (!/\.(yml|yaml)$/i.test(base)) return {};
6624
6624
  const parts = base.replace(/\.(yml|yaml)$/i, "").split(".");
6625
6625
  return { model: parts[0] || void 0, kind: parts[1] ?? "model", state: parts[2] };
@@ -6636,10 +6636,10 @@ function unverifiableReason(e) {
6636
6636
  if (st == null) return `\u8BF7\u6C42\u6CA1\u53D1\u51FA\u53BB\u6216\u6CA1\u56DE\u6765\uFF08${err.code ?? err.message ?? "\u672A\u77E5"}\uFF09`;
6637
6637
  return void 0;
6638
6638
  }
6639
- async function verifyAfterWrite(c, path17) {
6640
- const { model, kind, state } = parseMetaPath(path17);
6639
+ async function verifyAfterWrite(c, path18) {
6640
+ const { model, kind, state } = parseMetaPath(path18);
6641
6641
  if (!model || !kind) {
6642
- return { status: "unverified", where: "(\u672A\u63A2)", why: `\u4ECE\u8DEF\u5F84 ${path17} \u8BA4\u4E0D\u51FA\u6A21\u578B\u540D/\u5C42\u540D` };
6642
+ return { status: "unverified", where: "(\u672A\u63A2)", why: `\u4ECE\u8DEF\u5F84 ${path18} \u8BA4\u4E0D\u51FA\u6A21\u578B\u540D/\u5C42\u540D` };
6643
6643
  }
6644
6644
  try {
6645
6645
  await clearMetaCache2(c.raw(), model, {});
@@ -6684,7 +6684,7 @@ async function verifyAfterWrite(c, path17) {
6684
6684
  }
6685
6685
  return { status: "ok" };
6686
6686
  }
6687
- async function metaSetCommand(path17, args) {
6687
+ async function metaSetCommand(path18, args) {
6688
6688
  try {
6689
6689
  if (!args.file) {
6690
6690
  throw new CliError19({
@@ -6700,9 +6700,9 @@ async function metaSetCommand(path17, args) {
6700
6700
  process.stdin.on("error", reject);
6701
6701
  }) : await fsp3.readFile(args.file, "utf8");
6702
6702
  if (!args.skipValidate) {
6703
- const result2 = validateMetaContent(path17, content);
6703
+ const result2 = validateMetaContent(path18, content);
6704
6704
  if (result2.issues.length > 0) {
6705
- process.stderr.write(`\u{1F50E} \u5199\u524D\u6821\u9A8C ${path17}\uFF08schema \u7C7B\u578B\uFF1A${result2.kind ?? "\u672A\u8BC6\u522B"}\uFF09
6705
+ process.stderr.write(`\u{1F50E} \u5199\u524D\u6821\u9A8C ${path18}\uFF08schema \u7C7B\u578B\uFF1A${result2.kind ?? "\u672A\u8BC6\u522B"}\uFF09
6706
6706
  `);
6707
6707
  process.stderr.write(formatMetaIssues(result2, " ") + "\n");
6708
6708
  }
@@ -6721,13 +6721,13 @@ async function metaSetCommand(path17, args) {
6721
6721
  if (dryFmt === "json" || dryFmt === "yaml") {
6722
6722
  process.stdout.write(
6723
6723
  formatObject18(
6724
- { dryRun: true, path: path17, bytes: Buffer.byteLength(content), content },
6724
+ { dryRun: true, path: path18, bytes: Buffer.byteLength(content), content },
6725
6725
  { format: dryFmt }
6726
6726
  ) + "\n"
6727
6727
  );
6728
6728
  } else {
6729
6729
  process.stdout.write(
6730
- `[dry-run] \u5C06\u5199\u5165 ${path17}\uFF08${Buffer.byteLength(content)} B\uFF09\u2014\u2014\u672A\u5B9E\u9645\u5199\u5165
6730
+ `[dry-run] \u5C06\u5199\u5165 ${path18}\uFF08${Buffer.byteLength(content)} B\uFF09\u2014\u2014\u672A\u5B9E\u9645\u5199\u5165
6731
6731
  ---
6732
6732
  ${content}
6733
6733
  `
@@ -6741,13 +6741,13 @@ ${content}
6741
6741
  let backupState = "unknown";
6742
6742
  let backupWhy;
6743
6743
  try {
6744
- const prev = await getTenantMeta(c.raw(), path17);
6744
+ const prev = await getTenantMeta(c.raw(), path18);
6745
6745
  if (!prev || prev.trim() === "") {
6746
6746
  backupState = "absent";
6747
6747
  } else {
6748
6748
  backupFile = nodePath.join(
6749
6749
  os3.tmpdir(),
6750
- `hcm-meta-backup-${Date.now()}-${path17.replace(/[\\/]/g, "_")}`
6750
+ `hcm-meta-backup-${Date.now()}-${path18.replace(/[\\/]/g, "_")}`
6751
6751
  );
6752
6752
  await fsp3.writeFile(backupFile, prev, "utf8");
6753
6753
  backupState = "saved";
@@ -6762,22 +6762,22 @@ ${content}
6762
6762
  backupWhy = `HTTP ${st ?? "-"}${err.code ? ` ${err.code}` : ""}${err.message ? `\uFF1A${err.message}` : ""}`;
6763
6763
  }
6764
6764
  }
6765
- const result = await saveTenantMeta(c.raw(), path17, content);
6765
+ const result = await saveTenantMeta(c.raw(), path18, content);
6766
6766
  const fmt = args.output ?? "json";
6767
- if (fmt !== "json") process.stdout.write(`\u2705 \u5DF2\u5199\u5165 ${path17}
6767
+ if (fmt !== "json") process.stdout.write(`\u2705 \u5DF2\u5199\u5165 ${path18}
6768
6768
  `);
6769
6769
  const restoreHint = backupState === "saved" && backupFile ? ` \u65E7\u5185\u5BB9\u5DF2\u5B58\uFF1A${backupFile}
6770
- \u653E\u56DE\u53BB\uFF1Ahcm meta set ${path17} --file ${backupFile}${connFlags(args)}
6771
- ` : 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 ${path17}${connFlags(args)}
6770
+ \u653E\u56DE\u53BB\uFF1Ahcm meta set ${path18} --file ${backupFile}${connFlags(args)}
6771
+ ` : 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 ${path18}${connFlags(args)}
6772
6772
  ` : ` \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
6773
- \u5148\u81EA\u5DF1\u8BFB\u4E00\u904D\u786E\u8BA4\uFF1Ahcm meta get ${path17}${connFlags(args)}
6773
+ \u5148\u81EA\u5DF1\u8BFB\u4E00\u904D\u786E\u8BA4\uFF1Ahcm meta get ${path18}${connFlags(args)}
6774
6774
  `;
6775
6775
  if (args.verify === false) {
6776
6776
  process.stderr.write(
6777
6777
  "\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
6778
6778
  );
6779
6779
  } else {
6780
- const outcome = await verifyAfterWrite(c, path17);
6780
+ const outcome = await verifyAfterWrite(c, path18);
6781
6781
  if (outcome.status === "broken") {
6782
6782
  const human = explainJacksonError(outcome.raw);
6783
6783
  process.stderr.write(
@@ -6810,19 +6810,19 @@ ${content}
6810
6810
  fail5(e, args);
6811
6811
  }
6812
6812
  }
6813
- async function metaDeleteCommand(path17, args) {
6813
+ async function metaDeleteCommand(path18, args) {
6814
6814
  try {
6815
6815
  if (!args.yes) {
6816
- const ok = await promptConfirm(`\u5C06\u5220\u9664\u5143\u6570\u636E ${path17}\uFF0C\u6B64\u64CD\u4F5C\u4E0D\u53EF\u9006\u3002\u7EE7\u7EED\uFF1F`);
6816
+ const ok = await promptConfirm(`\u5C06\u5220\u9664\u5143\u6570\u636E ${path18}\uFF0C\u6B64\u64CD\u4F5C\u4E0D\u53EF\u9006\u3002\u7EE7\u7EED\uFF1F`);
6817
6817
  if (!ok) {
6818
6818
  process.stderr.write("\u5DF2\u53D6\u6D88\n");
6819
6819
  process.exit(1);
6820
6820
  }
6821
6821
  }
6822
6822
  const c = await client2(args);
6823
- const result = await deleteTenantMeta(c.raw(), path17);
6823
+ const result = await deleteTenantMeta(c.raw(), path18);
6824
6824
  const fmt = args.output ?? "json";
6825
- if (fmt !== "json") process.stdout.write(`\u{1F5D1}\uFE0F \u5DF2\u5220\u9664 ${path17}
6825
+ if (fmt !== "json") process.stdout.write(`\u{1F5D1}\uFE0F \u5DF2\u5220\u9664 ${path18}
6826
6826
  `);
6827
6827
  process.stdout.write(formatObject18(result, { format: fmt }) + "\n");
6828
6828
  process.exitCode = 0;
@@ -6831,7 +6831,7 @@ async function metaDeleteCommand(path17, args) {
6831
6831
  fail5(e, args);
6832
6832
  }
6833
6833
  }
6834
- async function metaValidateCommand(path17, args) {
6834
+ async function metaValidateCommand(path18, args) {
6835
6835
  try {
6836
6836
  if (!args.file) {
6837
6837
  throw new CliError19({
@@ -6846,13 +6846,13 @@ async function metaValidateCommand(path17, args) {
6846
6846
  process.stdin.on("end", () => resolve4(buf));
6847
6847
  process.stdin.on("error", reject);
6848
6848
  }) : await fsp3.readFile(args.file, "utf8");
6849
- const result = validateMetaContent(path17, content);
6849
+ const result = validateMetaContent(path18, content);
6850
6850
  const fmt = args.output ?? "table";
6851
6851
  if (fmt === "json" || fmt === "yaml") {
6852
6852
  process.stdout.write(
6853
6853
  formatObject18(
6854
6854
  {
6855
- path: path17,
6855
+ path: path18,
6856
6856
  kind: result.kind,
6857
6857
  schemaKnown: result.schemaKnown,
6858
6858
  schemaSourceCommit: META_SCHEMA_SOURCE_COMMIT,
@@ -6864,7 +6864,7 @@ async function metaValidateCommand(path17, args) {
6864
6864
  );
6865
6865
  } else {
6866
6866
  process.stdout.write(
6867
- `\u{1F50E} ${path17}\uFF08schema \u7C7B\u578B\uFF1A${result.kind ?? "\u672A\u8BC6\u522B"}\uFF0C\u6765\u6E90 ${META_SCHEMA_SOURCE_COMMIT.slice(0, 8)}\uFF09
6867
+ `\u{1F50E} ${path18}\uFF08schema \u7C7B\u578B\uFF1A${result.kind ?? "\u672A\u8BC6\u522B"}\uFF0C\u6765\u6E90 ${META_SCHEMA_SOURCE_COMMIT.slice(0, 8)}\uFF09
6868
6868
  `
6869
6869
  );
6870
6870
  process.stdout.write(
@@ -8548,6 +8548,29 @@ function classify(argv, actionResolution) {
8548
8548
  if (name === "delivery" && subcommand === "assess") {
8549
8549
  return direct("R0", "local-discovery", "risk-assessment");
8550
8550
  }
8551
+ if (name === "models") return direct("R0", "product-discovery", "model-discovery");
8552
+ if (name === "config") {
8553
+ if (["list", "show", "get"].includes(subcommand)) return direct("R0", "local-discovery", "config-read");
8554
+ return forbidden("identity-governance", "\u4FEE\u6539\u672C\u673A\u5168\u5C40\u914D\u7F6E\u4F1A\u6539\u53D8\u540E\u7EED\u6240\u6709\u547D\u4EE4\u7684\u73AF\u5883\u4E0E\u8EAB\u4EFD\uFF0C\u5C5E\u6CBB\u7406\u64CD\u4F5C\u3002");
8555
+ }
8556
+ if (name === "upgrade" || name === "self-update") {
8557
+ return direct("R1", "managed-local-write", "cli-self-upgrade");
8558
+ }
8559
+ if (name === "datapackage") {
8560
+ if (subcommand === "pack") return direct("R1", "local-validation", "datapackage-pack");
8561
+ if (subcommand === "status") return direct("R1", "remote-read", "datapackage-status");
8562
+ if (subcommand === "install") return guarded("tenant-data-write", "datapackage-install");
8563
+ return forbidden("unknown-command", "\u672A\u77E5 datapackage \u5B50\u547D\u4EE4\u6309\u6700\u9AD8\u98CE\u9669\u5173\u95ED\u3002");
8564
+ }
8565
+ if (name === "mini") {
8566
+ return forbidden("removed-command", "`hcm mini` \u5DF2\u79FB\u9664\uFF0C\u6539\u7528 `hcm workspace`\u3002");
8567
+ }
8568
+ if (name === "chiron") {
8569
+ if (subcommand === "doctor") return direct("R0", "local-discovery", "chiron-doctor");
8570
+ if (subcommand === "init") return direct("R1", "managed-local-write", "chiron-project-scaffold");
8571
+ if (subcommand === "test") return direct("R1", "remote-read", "chiron-regression-test");
8572
+ return forbidden("unknown-command", "\u672A\u77E5 chiron \u5B50\u547D\u4EE4\u6309\u6700\u9AD8\u98CE\u9669\u5173\u95ED\u3002");
8573
+ }
8551
8574
  if (name === "skills") {
8552
8575
  if (subcommand === "list" || subcommand === "show") {
8553
8576
  return direct("R0", "product-discovery", "skill-discovery");
@@ -9045,21 +9068,21 @@ async function resolveCoreAction(request) {
9045
9068
  `Core \u5143\u6570\u636E\u91CC\u6CA1\u6709 ${request.model}.${request.action} \u8FD9\u4E2A Action\u3002${degraded}next_step=\u7528 \`hcm describe ${request.model}\` \u770B\u5B83\u5217\u51FA\u7684 Action \u540D\uFF08\u811A\u672C Action \u4F1A\u6807 [script]\uFF09`
9046
9069
  );
9047
9070
  }
9048
- const matches = request.explicitShape ? named.filter((action) => matchesRequest(action, request)) : named;
9049
- if (matches.length === 0) {
9071
+ const matches2 = request.explicitShape ? named.filter((action) => matchesRequest(action, request)) : named;
9072
+ if (matches2.length === 0) {
9050
9073
  const shapes = named.map((a) => `scope=${a.scope ?? "?"} method=${(a.httpMethod ?? "?").toUpperCase()}`).join("\uFF1B");
9051
9074
  return failed(
9052
9075
  "action-shape-mismatch",
9053
9076
  `${request.model}.${request.action} \u5B58\u5728\uFF0C\u4F46\u5F62\u6001\u5BF9\u4E0D\u4E0A\uFF1A\u4F60\u7ED9\u7684\u662F scope=${request.scope} method=${request.httpMethod}\uFF0C\u5143\u6570\u636E\u91CC\u662F ${shapes}\u3002next_step=\u53BB\u6389 --scope/--method \u8BA9 CLI \u6309\u5143\u6570\u636E\u81EA\u52A8\u5224\u5B9A\uFF0C\u6216\u6539\u6210\u4E0A\u9762\u7684\u5F62\u6001`
9054
9077
  );
9055
9078
  }
9056
- if (matches.length > 1) {
9079
+ if (matches2.length > 1) {
9057
9080
  return failed(
9058
9081
  "action-metadata-ambiguous",
9059
9082
  `${request.model}.${request.action} \u5728\u5143\u6570\u636E\u91CC\u6709\u591A\u79CD\u5F62\u6001\uFF0C\u65E0\u6CD5\u552F\u4E00\u5224\u5B9A\u3002next_step=\u7528 --scope \u4E0E --method \u6307\u660E\u8981\u8C03\u54EA\u4E00\u4E2A`
9060
9083
  );
9061
9084
  }
9062
- return policyFromActionMeta(matches[0], request);
9085
+ return policyFromActionMeta(matches2[0], request);
9063
9086
  } catch {
9064
9087
  return failed(
9065
9088
  "action-metadata-unavailable",
@@ -9931,17 +9954,17 @@ import {
9931
9954
  formatObject as formatObject24,
9932
9955
  httpProbe as httpProbe2,
9933
9956
  isTempEnv as isTempEnv3,
9934
- listIdentities as listIdentities4,
9957
+ listIdentities as listIdentities5,
9935
9958
  loadEnv as loadEnv11,
9936
- loadGlobalConfig as loadGlobalConfig10
9959
+ loadGlobalConfig as loadGlobalConfig11
9937
9960
  } from "@hcmai/sdk";
9938
9961
 
9939
9962
  // src/commands/chiron-project.ts
9940
9963
  import { promises as fs9 } from "fs";
9941
9964
  import os4 from "os";
9942
9965
  import path9 from "path";
9943
- import { spawnSync } from "child_process";
9944
- import { hcmConfigDir, listEnvs as listEnvs3, loadEnv as loadEnv10 } from "@hcmai/sdk";
9966
+ import { execFileSync, spawnSync } from "child_process";
9967
+ import { hcmConfigDir, listEnvs as listEnvs3, listIdentities as listIdentities4, loadEnv as loadEnv10, loadGlobalConfig as loadGlobalConfig10 } from "@hcmai/sdk";
9945
9968
  var ENV_FILE = "env.yaml";
9946
9969
  var SKILLS_DIR = "hcm-skills";
9947
9970
  var CASES_REPO_URL = "https://cnb.cool/hcm/chiron-cases.git";
@@ -10003,13 +10026,19 @@ function projectEnvFromConfig(cfg) {
10003
10026
  tenant: cfg.tenantId ?? "1"
10004
10027
  };
10005
10028
  }
10006
- async function findEnvByEndpoint(endpoint) {
10029
+ async function findEnvByEndpoint(endpoint, tenant2) {
10007
10030
  const wanted = normalizeOrigin(endpoint);
10031
+ const matches2 = [];
10008
10032
  for (const name of await listEnvs3().catch(() => [])) {
10009
10033
  const config2 = await loadEnv10(name).catch(() => null);
10010
- if (config2 && normalizeOrigin(config2.endpoint) === wanted) return { name, config: config2 };
10034
+ if (!config2 || normalizeOrigin(config2.endpoint) !== wanted) continue;
10035
+ matches2.push({ name, config: config2, hasIdentity: (await listIdentities4(name).catch(() => [])).length > 0 });
10011
10036
  }
10012
- return null;
10037
+ if (matches2.length === 0) return null;
10038
+ const active = (await loadGlobalConfig10().catch(() => null))?.activeEnv;
10039
+ const usable = matches2.filter((m) => m.hasIdentity);
10040
+ const pick2 = usable.find((m) => m.name === active) ?? (tenant2 ? usable.find((m) => (m.config.tenantId ?? "1") === tenant2) : void 0) ?? usable[0] ?? matches2.find((m) => m.name === active) ?? matches2[0];
10041
+ return { name: pick2.name, config: pick2.config };
10013
10042
  }
10014
10043
  function renderChironAgentInstructions() {
10015
10044
  return [
@@ -10154,6 +10183,60 @@ function firstLine(stderr, error) {
10154
10183
  const line = stderr.split(/\r?\n/).map((l) => l.trim()).find(Boolean);
10155
10184
  return line ?? "\uFF08\u65E0\u8F93\u51FA\uFF09";
10156
10185
  }
10186
+ var JIRA_BASE = (process.env.JIRA_BASE || "https://jira.hcmcloud.cn").replace(/\/+$/, "");
10187
+ var JIRA_PROJECT = process.env.JIRA_PROJECT || "HCMNX";
10188
+ var JIRA_TOKEN_FILE = () => path9.join(os4.homedir(), ".config", "hcm", "jira-token");
10189
+ var JIRA_KEYCHAIN = "jira-hcmcloud";
10190
+ async function jiraTokenSource() {
10191
+ if (process.env.JIRA_TOKEN?.trim()) return { token: process.env.JIRA_TOKEN.trim(), from: "\u73AF\u5883\u53D8\u91CF JIRA_TOKEN" };
10192
+ const file = process.env.JIRA_TOKEN_FILE || JIRA_TOKEN_FILE();
10193
+ try {
10194
+ const value = (await fs9.readFile(file, "utf8")).trim();
10195
+ if (value) return { token: value, from: file };
10196
+ } catch {
10197
+ }
10198
+ try {
10199
+ const out = execFileSync("security", ["find-generic-password", "-s", JIRA_KEYCHAIN, "-w"], {
10200
+ encoding: "utf8",
10201
+ stdio: ["ignore", "pipe", "ignore"]
10202
+ }).trim();
10203
+ if (out) return { token: out, from: `\u94A5\u5319\u4E32 ${JIRA_KEYCHAIN}` };
10204
+ } catch {
10205
+ }
10206
+ return null;
10207
+ }
10208
+ async function inspectJira() {
10209
+ const src = await jiraTokenSource();
10210
+ if (!src) {
10211
+ return {
10212
+ ok: false,
10213
+ reason: `\u6CA1\u6709\u4EE4\u724C\u3002\u5728 ${JIRA_BASE} \u53F3\u4E0A\u89D2\u5934\u50CF \u2192 \u4E2A\u4EBA\u8BBE\u7F6E \u2192 Personal Access Tokens \u5EFA\u4E00\u4E2A\uFF0C\u7136\u540E\uFF1Amkdir -p ~/.config/hcm && read -rs pat && printf "%s" "$pat" > ~/.config/hcm/jira-token && chmod 600 ~/.config/hcm/jira-token && unset pat`
10214
+ };
10215
+ }
10216
+ const call = async (path_) => {
10217
+ const res = await fetch(`${JIRA_BASE}${path_}`, {
10218
+ headers: { Authorization: `Bearer ${src.token}`, Accept: "application/json" },
10219
+ signal: AbortSignal.timeout(15e3)
10220
+ });
10221
+ return res;
10222
+ };
10223
+ try {
10224
+ const me = await call("/rest/api/2/myself");
10225
+ if (me.status === 401) return { ok: false, from: src.from, reason: "\u4EE4\u724C\u65E0\u6548\u6216\u5DF2\u8FC7\u671F\uFF0C\u91CD\u5EFA PAT \u540E\u91CD\u65B0\u5B58\u4E00\u6B21" };
10226
+ if (!me.ok) return { ok: false, from: src.from, reason: `\u8FDE\u5F97\u4E0A\u4F46 /myself \u8FD4\u56DE ${me.status}` };
10227
+ const who = (await me.json()).displayName ?? "";
10228
+ const project = await call(`/rest/api/2/project/${JIRA_PROJECT}`);
10229
+ return {
10230
+ ok: project.ok,
10231
+ from: src.from,
10232
+ who,
10233
+ projectVisible: project.ok,
10234
+ reason: project.ok ? void 0 : `\u770B\u4E0D\u5230\u9879\u76EE ${JIRA_PROJECT}\uFF08${project.status}\uFF09\uFF0C\u627E Jira \u7BA1\u7406\u5458\u5F00\u6743\u9650`
10235
+ };
10236
+ } catch (e) {
10237
+ return { ok: false, from: src.from, reason: `\u8FDE\u4E0D\u4E0A ${JIRA_BASE}\uFF1A${e.message}` };
10238
+ }
10239
+ }
10157
10240
  async function exists2(file) {
10158
10241
  try {
10159
10242
  await fs9.access(file);
@@ -10193,7 +10276,7 @@ var defaultChironInitDeps = {
10193
10276
  caseLibrary: (envName) => ensureCaseLibrary(envName)
10194
10277
  };
10195
10278
  async function resolveLoggedInEnv() {
10196
- const g = await loadGlobalConfig10();
10279
+ const g = await loadGlobalConfig11();
10197
10280
  const name = g.activeEnv;
10198
10281
  const loginHint = "hcm login https://<\u4F60\u7684 HCM \u5730\u5740> --code <\u914D\u5BF9\u7801>";
10199
10282
  if (!name) {
@@ -10209,7 +10292,7 @@ async function resolveLoggedInEnv() {
10209
10292
  message: `\u5F53\u524D\u73AF\u5883 '${name}' \u6CA1\u6709 endpoint\u3002\u5148\u6267\u884C\uFF1A${loginHint}`
10210
10293
  });
10211
10294
  }
10212
- const identities = await listIdentities4(name).catch(() => []);
10295
+ const identities = await listIdentities5(name).catch(() => []);
10213
10296
  if (identities.length === 0) {
10214
10297
  throw new CliError21({
10215
10298
  code: CliErrorCode20.IDENTITY_NOT_FOUND,
@@ -10360,7 +10443,8 @@ var defaultDeps = {
10360
10443
  fixCases: async (envName) => {
10361
10444
  await ensureCaseLibrary(envName);
10362
10445
  },
10363
- inspectCases: () => inspectCaseLibrary()
10446
+ inspectCases: () => inspectCaseLibrary(),
10447
+ inspectJira: () => inspectJira()
10364
10448
  };
10365
10449
  async function runChironDoctor(args, deps = defaultDeps) {
10366
10450
  const root = path11.resolve(args.project ?? ".");
@@ -10383,7 +10467,7 @@ async function runChironDoctor(args, deps = defaultDeps) {
10383
10467
  return finish(report);
10384
10468
  }
10385
10469
  report.env = env2;
10386
- const found = await findEnvByEndpoint(env2.endpoint);
10470
+ const found = await findEnvByEndpoint(env2.endpoint, env2.tenant);
10387
10471
  const loginCmd = `hcm login ${env2.endpoint} --code <\u914D\u5BF9\u7801>`;
10388
10472
  if (!found) {
10389
10473
  report.lines.push({ item: "\u767B\u5F55", verdict: "fail", detail: `\u672C\u673A\u6CA1\u6709\u767B\u5F55\u8FC7 ${env2.endpoint}`, nextStep: loginCmd });
@@ -10444,6 +10528,10 @@ async function runChironDoctor(args, deps = defaultDeps) {
10444
10528
  cases = await casesLine();
10445
10529
  }
10446
10530
  report.lines.push(cases);
10531
+ const jira = await deps.inspectJira();
10532
+ report.lines.push(
10533
+ jira.ok ? { item: "Jira", verdict: "ok", detail: `${jira.who || "\u5DF2\u8FDE\u63A5"} \xB7 \u770B\u5F97\u5230 ${JIRA_PROJECT}\uFF08\u4EE4\u724C\u6765\u81EA ${jira.from}\uFF09` } : { item: "Jira", verdict: "warn", detail: jira.reason ?? "\u4E0D\u53EF\u7528", nextStep: "\u73B0\u5728\u4E0D\u914D\u4E5F\u80FD\u4EA4\u4ED8\uFF1B\u649E\u5230\u300C\u4EA7\u54C1\u505A\u4E0D\u5230\u300D\u8981\u63D0\u5355\u65F6\u5FC5\u987B\u5148\u914D\u597D" }
10534
+ );
10447
10535
  return finish(report);
10448
10536
  }
10449
10537
  function finish(report) {
@@ -10473,6 +10561,346 @@ async function chironDoctorCommand(args, deps) {
10473
10561
  }
10474
10562
  }
10475
10563
 
10564
+ // src/commands/chiron-test.ts
10565
+ init_exit();
10566
+ import { spawnSync as spawnSync2 } from "child_process";
10567
+ import { promises as fs12 } from "fs";
10568
+ import path12 from "path";
10569
+ import yaml2 from "js-yaml";
10570
+ import { formatObject as formatObject26 } from "@hcmai/sdk";
10571
+
10572
+ // src/commands/xlsx-peek.ts
10573
+ import { readFileSync as readFileSync6 } from "fs";
10574
+ import { inflateRawSync } from "zlib";
10575
+ function readZip(buf, want) {
10576
+ let eocd = -1;
10577
+ for (let i = buf.length - 22; i >= 0 && i > buf.length - 66e3; i--) {
10578
+ if (buf.readUInt32LE(i) === 101010256) {
10579
+ eocd = i;
10580
+ break;
10581
+ }
10582
+ }
10583
+ if (eocd < 0) throw new Error("\u4E0D\u662F\u6709\u6548\u7684 zip/xlsx\uFF08\u627E\u4E0D\u5230\u4E2D\u592E\u76EE\u5F55\uFF09");
10584
+ const count = buf.readUInt16LE(eocd + 10);
10585
+ let p = buf.readUInt32LE(eocd + 16);
10586
+ const out = [];
10587
+ for (let n = 0; n < count; n++) {
10588
+ if (buf.readUInt32LE(p) !== 33639248) break;
10589
+ const method = buf.readUInt16LE(p + 10);
10590
+ const compressedSize = buf.readUInt32LE(p + 20);
10591
+ const nameLen = buf.readUInt16LE(p + 28);
10592
+ const extraLen = buf.readUInt16LE(p + 30);
10593
+ const commentLen = buf.readUInt16LE(p + 32);
10594
+ const localOffset = buf.readUInt32LE(p + 42);
10595
+ const name = buf.subarray(p + 46, p + 46 + nameLen).toString("utf8");
10596
+ if (want(name)) {
10597
+ const lnameLen = buf.readUInt16LE(localOffset + 26);
10598
+ const lextraLen = buf.readUInt16LE(localOffset + 28);
10599
+ const start = localOffset + 30 + lnameLen + lextraLen;
10600
+ const raw = buf.subarray(start, start + compressedSize);
10601
+ if (method === 0) out.push({ name, data: Buffer.from(raw) });
10602
+ else if (method === 8) out.push({ name, data: inflateRawSync(raw) });
10603
+ else throw new Error(`xlsx \u91CC\u7684 ${name} \u7528\u4E86\u4E0D\u652F\u6301\u7684\u538B\u7F29\u65B9\u5F0F ${method}`);
10604
+ }
10605
+ p += 46 + nameLen + extraLen + commentLen;
10606
+ }
10607
+ return out;
10608
+ }
10609
+ var decode = (s) => s.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&apos;/g, "'").replace(/&amp;/g, "&");
10610
+ function xlsxRows(file, maxRows = 50) {
10611
+ const buf = readFileSync6(file);
10612
+ const [sheet] = readZip(buf, (n) => n === "xl/worksheets/sheet1.xml");
10613
+ if (!sheet) throw new Error(`${file} \u91CC\u6CA1\u6709 xl/worksheets/sheet1.xml\uFF0C\u53EF\u80FD\u4E0D\u662F xlsx`);
10614
+ const [shared] = readZip(buf, (n) => n === "xl/sharedStrings.xml");
10615
+ const sharedStrings = [];
10616
+ if (shared) {
10617
+ for (const si of shared.data.toString("utf8").split("<si>").slice(1)) {
10618
+ sharedStrings.push(decode([...si.matchAll(/<t[^>]*>([\s\S]*?)<\/t>/g)].map((m) => m[1] ?? "").join("")));
10619
+ }
10620
+ }
10621
+ const xml = sheet.data.toString("utf8");
10622
+ const rows = [];
10623
+ for (const rowXml of xml.split("<row").slice(1)) {
10624
+ if (rows.length >= maxRows) break;
10625
+ const cells = [];
10626
+ for (const m of rowXml.matchAll(/<c\b([^>]*)>([\s\S]*?)<\/c>/g)) {
10627
+ const attrs = m[1] ?? "";
10628
+ const body = m[2] ?? "";
10629
+ const v = /<v>([\s\S]*?)<\/v>/.exec(body)?.[1] ?? "";
10630
+ const inline = [...body.matchAll(/<t[^>]*>([\s\S]*?)<\/t>/g)].map((x) => x[1] ?? "").join("");
10631
+ if (/t="s"/.test(attrs)) cells.push(sharedStrings[Number(v)] ?? "");
10632
+ else if (inline) cells.push(decode(inline));
10633
+ else cells.push(decode(v));
10634
+ }
10635
+ rows.push(cells);
10636
+ }
10637
+ return rows;
10638
+ }
10639
+
10640
+ // src/commands/chiron-test.ts
10641
+ var CONTENT_KEYS = ["stdout_contains", "json", "xlsx_header", "xlsx_min_rows", "text_contains"];
10642
+ var hasContentAssertion = (c) => (c.page ? (c.expect_text?.length ?? 0) > 0 : false) || CONTENT_KEYS.some((k) => c.expect?.[k] !== void 0);
10643
+ function assertUsableSpec(spec, where) {
10644
+ if (!spec?.name || !Array.isArray(spec.checks) || spec.checks.length === 0) {
10645
+ throw new Error(`${where}: \u7528\u4F8B\u8981\u6709 name \u4E0E\u81F3\u5C11\u4E00\u6761 checks`);
10646
+ }
10647
+ spec.checks.forEach((c, i) => {
10648
+ const at = `${where} \u7B2C ${i + 1} \u6761\u300C${c.name ?? "\u672A\u547D\u540D"}\u300D`;
10649
+ if (!c.name) throw new Error(`${at}: \u7F3A name`);
10650
+ const kinds = [c.run, c.file, c.page].filter(Boolean).length;
10651
+ if (kinds !== 1) throw new Error(`${at}: run / file / page \u5FC5\u987B\u4E14\u53EA\u80FD\u6709\u4E00\u4E2A`);
10652
+ if (c.run) {
10653
+ if (!/^hcm\s/.test(c.run.trim())) {
10654
+ throw new Error(`${at}: run \u53EA\u80FD\u8DD1 hcm \u5B50\u547D\u4EE4\uFF08\u4E0D\u63A5\u53D7\u4EFB\u610F shell\uFF1B\u8981\u7ED5\u8FC7 CLI \u7684\u4E8B\u672C\u6765\u5C31\u4E0D\u8BE5\u505A\uFF09`);
10655
+ }
10656
+ tokenize(c.run);
10657
+ }
10658
+ if (c.page && !c.expect_text?.length) throw new Error(`${at}: \u9875\u9762\u5224\u636E\u81F3\u5C11\u8981\u4E00\u4E2A expect_text\u2014\u2014\u622A\u56FE\u5B58\u5728\u4E0D\u7B49\u4E8E\u9875\u9762\u5BF9`);
10659
+ if (c.file && !hasContentAssertion(c)) throw new Error(`${at}: \u8BFB\u6587\u4EF6\u5374\u6CA1\u6709\u5185\u5BB9\u5224\u636E\uFF08${CONTENT_KEYS.join(" / ")}\uFF09\u2014\u2014\u6587\u4EF6\u5B58\u5728\u4E0D\u7B49\u4E8E\u5185\u5BB9\u5BF9`);
10660
+ });
10661
+ if (!spec.checks.some(hasContentAssertion)) {
10662
+ throw new Error(
10663
+ `${where}: \u6574\u4EFD\u7528\u4F8B\u6CA1\u6709\u4EFB\u4F55\u5185\u5BB9\u5224\u636E\uFF08${CONTENT_KEYS.join(" / ")} / expect_text\uFF09\uFF0C\u53EA\u8DD1\u4E0D\u770B\u7B49\u4E8E\u6CA1\u6D4B\u3002`
10664
+ );
10665
+ }
10666
+ }
10667
+ function tokenize(line) {
10668
+ const out = [];
10669
+ let cur = "";
10670
+ let quote = null;
10671
+ let started = false;
10672
+ for (let i = 0; i < line.length; i++) {
10673
+ const ch = line[i];
10674
+ if (quote) {
10675
+ if (ch === quote) quote = null;
10676
+ else if (ch === "\\" && quote === '"' && i + 1 < line.length) {
10677
+ cur += line[++i];
10678
+ } else cur += ch;
10679
+ continue;
10680
+ }
10681
+ if (ch === '"' || ch === "'") {
10682
+ quote = ch;
10683
+ started = true;
10684
+ continue;
10685
+ }
10686
+ if (ch === "\\" && i + 1 < line.length) {
10687
+ cur += line[++i];
10688
+ started = true;
10689
+ continue;
10690
+ }
10691
+ if (/\s/.test(ch)) {
10692
+ if (started || cur) {
10693
+ out.push(cur);
10694
+ cur = "";
10695
+ started = false;
10696
+ }
10697
+ continue;
10698
+ }
10699
+ cur += ch;
10700
+ started = true;
10701
+ }
10702
+ if (quote) throw new Error(`\u547D\u4EE4\u91CC\u7684\u5F15\u53F7\u6CA1\u95ED\u5408\uFF1A${line}`);
10703
+ if (started || cur) out.push(cur);
10704
+ return out;
10705
+ }
10706
+ function parseJsonLoose(stdout) {
10707
+ const candidates = [];
10708
+ const oa = stdout.indexOf("{"), ob = stdout.lastIndexOf("}");
10709
+ const aa = stdout.indexOf("["), ab = stdout.lastIndexOf("]");
10710
+ if (aa >= 0 && ab > aa) candidates.push([aa, ab]);
10711
+ if (oa >= 0 && ob > oa) candidates.push([oa, ob]);
10712
+ candidates.sort((x, y) => x[0] - y[0]);
10713
+ for (const [a, b] of candidates) {
10714
+ try {
10715
+ return JSON.parse(stdout.slice(a, b + 1));
10716
+ } catch {
10717
+ }
10718
+ }
10719
+ return void 0;
10720
+ }
10721
+ function pick(value, expr) {
10722
+ const tokens = [...expr.replace(/^\$/, "").matchAll(/\[(\d+)\]|([^.[\]]+)/g)];
10723
+ let cur = value;
10724
+ for (const t of tokens) {
10725
+ if (cur === null || cur === void 0) return void 0;
10726
+ if (t[1] !== void 0) {
10727
+ if (!Array.isArray(cur)) return void 0;
10728
+ cur = cur[Number(t[1])];
10729
+ } else {
10730
+ if (typeof cur !== "object") return void 0;
10731
+ cur = cur[t[2]];
10732
+ }
10733
+ }
10734
+ return cur;
10735
+ }
10736
+ function matches(actual, rule) {
10737
+ const r = rule.trim();
10738
+ if (r === "\u975E\u7A7A" || r === "nonempty") return actual !== void 0 && actual !== null && String(actual) !== "" && !(Array.isArray(actual) && actual.length === 0);
10739
+ const m = /^(>=|<=|>|<|!=|=)\s*(.*)$/.exec(r);
10740
+ if (!m) return String(actual) === r;
10741
+ const [, op, want] = m;
10742
+ const n = Number(want), a = Array.isArray(actual) ? actual.length : Number(actual);
10743
+ switch (op) {
10744
+ case ">":
10745
+ return Number.isFinite(a) && a > n;
10746
+ case "<":
10747
+ return Number.isFinite(a) && a < n;
10748
+ case ">=":
10749
+ return Number.isFinite(a) && a >= n;
10750
+ case "<=":
10751
+ return Number.isFinite(a) && a <= n;
10752
+ case "!=":
10753
+ return String(actual) !== want;
10754
+ default:
10755
+ return String(actual) === want;
10756
+ }
10757
+ }
10758
+ var defaultDeps2 = {
10759
+ assess: (argv) => assessEffectiveDeliveryCommand(argv),
10760
+ hcm: (argv, cwd) => {
10761
+ const r = spawnSync2("hcm", argv, { cwd, encoding: "utf8", maxBuffer: 1 << 26, timeout: 6e5 });
10762
+ return { status: r.status, stdout: r.stdout ?? "", stderr: r.stderr ?? "" };
10763
+ },
10764
+ pageAcceptance: (root, argv) => {
10765
+ const r = spawnSync2("./page-acceptance.sh", argv, { cwd: root, encoding: "utf8", maxBuffer: 1 << 24, timeout: 3e5 });
10766
+ return { status: r.status, stdout: r.stdout ?? "", stderr: r.stderr ?? "" };
10767
+ },
10768
+ readXlsx: (file) => xlsxRows(file),
10769
+ readText: (file) => fs12.readFile(file, "utf8")
10770
+ };
10771
+ async function runCase(spec, root, opts = {}, deps = defaultDeps2) {
10772
+ const results = [];
10773
+ const vars = {};
10774
+ const fill = (text) => text.replace(/\$\{(\w+)\}/g, (_, k) => {
10775
+ if (vars[k] === void 0) throw new Error(`\u7528\u5230\u4E86 ${"$"}{${k}} \u4F46\u524D\u9762\u6CA1\u6709\u54EA\u4E00\u6B65\u6355\u83B7\u5B83`);
10776
+ return vars[k];
10777
+ });
10778
+ for (const c of spec.checks) {
10779
+ try {
10780
+ if (c.run) {
10781
+ const argv2 = tokenize(fill(c.run)).slice(1);
10782
+ const verdict = await deps.assess(argv2);
10783
+ if (verdict.execution !== "direct") {
10784
+ results.push({
10785
+ name: c.name,
10786
+ verdict: "fail",
10787
+ detail: `\u8FD9\u6761\u547D\u4EE4\u6309\u4EA4\u4ED8\u98CE\u63A7\u662F ${verdict.risk} / ${verdict.execution}\uFF08${verdict.reasonCode}\uFF09\uFF0C\u6CA1\u6709\u8DD1\u3002\u7528\u4F8B\u53EA\u8DD1\u53EA\u8BFB\uFF1B\u8981\u5199\u6570\u636E\u8D70 hcm delivery assess \u2192 prepare \u2192 execute\u3002`
10788
+ });
10789
+ continue;
10790
+ }
10791
+ if (opts.env && !argv2.includes("--env")) argv2.push("--env", opts.env);
10792
+ const as2 = c.as ?? opts.as;
10793
+ if (as2 && !argv2.includes("--as")) argv2.push("--as", as2);
10794
+ const r2 = deps.hcm(argv2, root);
10795
+ const want = c.expect ?? {};
10796
+ const bad = [];
10797
+ if (want.exit !== void 0 && r2.status !== want.exit) bad.push(`\u9000\u51FA\u7801 ${r2.status} \u2260 ${want.exit}`);
10798
+ for (const t of want.stdout_contains ?? []) if (!r2.stdout.includes(t)) bad.push(`\u8F93\u51FA\u91CC\u6CA1\u6709\u300C${t}\u300D`);
10799
+ for (const t of want.stdout_not_contains ?? []) if (r2.stdout.includes(t)) bad.push(`\u8F93\u51FA\u91CC\u51FA\u73B0\u4E86\u4E0D\u8BE5\u6709\u7684\u300C${t}\u300D`);
10800
+ if (want.json) {
10801
+ const parsed = parseJsonLoose(r2.stdout);
10802
+ if (parsed === void 0) bad.push("\u8F93\u51FA\u4E0D\u662F JSON\uFF0C\u65E0\u6CD5\u6309 json \u5224\u636E\u6BD4\u5BF9");
10803
+ if (parsed !== void 0) {
10804
+ for (const [expr, rule] of Object.entries(want.json)) {
10805
+ const actual = pick(parsed, expr);
10806
+ if (!matches(actual, rule)) bad.push(`${expr} \u5B9E\u9645 ${JSON.stringify(actual)}\uFF0C\u671F\u671B ${rule}`);
10807
+ }
10808
+ }
10809
+ }
10810
+ if (c.capture && bad.length === 0) {
10811
+ const parsed = parseJsonLoose(r2.stdout);
10812
+ for (const [name, expr] of Object.entries(c.capture)) {
10813
+ const v = pick(parsed, expr);
10814
+ if (v === void 0 || v === null || String(v) === "") bad.push(`\u8981\u6355\u83B7\u7684 ${name}\uFF08${expr}\uFF09\u5728\u8F93\u51FA\u91CC\u53D6\u4E0D\u5230`);
10815
+ else vars[name] = String(v);
10816
+ }
10817
+ }
10818
+ results.push(bad.length ? { name: c.name, verdict: "fail", detail: `${bad.join("\uFF1B")}${r2.stderr.trim() ? `\uFF5Cstderr: ${r2.stderr.trim().split("\n")[0]}` : ""}` } : { name: c.name, verdict: hasContentAssertion(c) ? "pass" : "step", detail: c.capture ? `\u6355\u83B7 ${Object.keys(c.capture).join("\u3001")}` : "" });
10819
+ continue;
10820
+ }
10821
+ if (c.file) {
10822
+ const file = path12.resolve(root, fill(c.file));
10823
+ const want = c.expect ?? {};
10824
+ const bad = [];
10825
+ if (want.xlsx_header || want.xlsx_min_rows !== void 0) {
10826
+ const rows = deps.readXlsx(file);
10827
+ const header = (rows[0] ?? []).map((x) => String(x).trim());
10828
+ for (const h of want.xlsx_header ?? []) if (!header.includes(h)) bad.push(`\u8868\u5934\u91CC\u6CA1\u6709\u300C${h}\u300D\uFF0C\u5B9E\u9645\u662F [${header.slice(0, 8).join(", ")}]`);
10829
+ if (want.xlsx_min_rows !== void 0 && rows.length - 1 < want.xlsx_min_rows) bad.push(`\u6570\u636E\u884C ${Math.max(rows.length - 1, 0)} \u5C11\u4E8E ${want.xlsx_min_rows}`);
10830
+ }
10831
+ if (want.text_contains) {
10832
+ const text = await deps.readText(file);
10833
+ for (const t of want.text_contains) if (!text.includes(t)) bad.push(`\u6587\u4EF6\u91CC\u6CA1\u6709\u300C${t}\u300D`);
10834
+ }
10835
+ results.push(bad.length ? { name: c.name, verdict: "fail", detail: bad.join("\uFF1B") } : { name: c.name, verdict: "pass", detail: "" });
10836
+ continue;
10837
+ }
10838
+ const out = path12.join("evidence", "test", `${spec.name}-${c.name}`.replace(/[^\w一-龥-]+/g, "_") + ".png");
10839
+ const argv = ["--path", fill(c.page), "--out", out];
10840
+ if (opts.env) argv.push("--env", opts.env);
10841
+ const as = c.as ?? opts.as;
10842
+ if (as) argv.push("--as", as);
10843
+ for (const t of c.expect_text ?? []) argv.push("--expect-text", t);
10844
+ for (const t of c.reject_text ?? []) argv.push("--reject-text", t);
10845
+ const r = deps.pageAcceptance(root, argv);
10846
+ results.push(r.status === 0 ? { name: c.name, verdict: "pass", detail: out } : { name: c.name, verdict: "fail", detail: (r.stderr || r.stdout).trim().split("\n").slice(-1)[0] ?? `\u9000\u51FA\u7801 ${r.status}` });
10847
+ } catch (e) {
10848
+ results.push({ name: c.name, verdict: "fail", detail: e.message });
10849
+ }
10850
+ }
10851
+ return results;
10852
+ }
10853
+ async function loadCases(target) {
10854
+ const stat = await fs12.stat(target);
10855
+ const files = stat.isDirectory() ? (await fs12.readdir(target)).filter((f) => /\.ya?ml$/.test(f)).sort().map((f) => path12.join(target, f)) : [target];
10856
+ const out = [];
10857
+ for (const f of files) {
10858
+ const spec = yaml2.load(await fs12.readFile(f, "utf8"));
10859
+ assertUsableSpec(spec, path12.basename(f));
10860
+ out.push({ file: f, spec });
10861
+ }
10862
+ if (out.length === 0) throw new Error(`${target} \u4E0B\u6CA1\u6709\u7528\u4F8B\uFF08*.yml\uFF09`);
10863
+ return out;
10864
+ }
10865
+ async function chironTestCommand(target, args, deps) {
10866
+ try {
10867
+ const root = path12.resolve(args.project ?? ".");
10868
+ const where = path12.resolve(root, target ?? "tests");
10869
+ const cases = await loadCases(where);
10870
+ const report = [];
10871
+ let failed2 = 0;
10872
+ for (const { file, spec } of cases) {
10873
+ const results = await runCase(spec, root, { env: args.env, as: args.as }, deps);
10874
+ failed2 += results.filter((r) => r.verdict === "fail").length;
10875
+ report.push({ case: spec.name, file: path12.relative(root, file), results });
10876
+ }
10877
+ const fmt = args.output ?? "table";
10878
+ if (fmt === "json" || fmt === "yaml") {
10879
+ process.stdout.write(formatObject26({ ok: failed2 === 0, failed: failed2, cases: report }, { format: fmt }) + "\n");
10880
+ } else {
10881
+ for (const c of report) {
10882
+ process.stdout.write(`
10883
+ ${c.case}\uFF08${c.file}\uFF09
10884
+ `);
10885
+ for (const r of c.results) {
10886
+ const mark = r.verdict === "pass" ? "\u2705" : r.verdict === "step" ? "\xB7" : r.verdict === "warn" ? "\u26A0\uFE0F" : "\u274C";
10887
+ process.stdout.write(` ${mark} ${r.name}${r.detail ? ` ${r.detail}` : ""}
10888
+ `);
10889
+ }
10890
+ }
10891
+ const verified = report.reduce((n, c) => n + c.results.filter((r) => r.verdict === "pass").length, 0);
10892
+ process.stdout.write(failed2 === 0 ? `
10893
+ \u5168\u90E8\u901A\u8FC7\uFF08\u771F\u5224\u8FC7\u5185\u5BB9\u7684 ${verified} \u6761\uFF1B\u5E26 \xB7 \u7684\u662F\u6B65\u9AA4\uFF0C\u4E0D\u7B97\u9A8C\u8BC1\uFF09\u3002
10894
+ ` : `
10895
+ ${failed2} \u6761\u6CA1\u8FC7\u2014\u2014\u4E0A\u9762\u6BCF\u6761\u90FD\u5199\u4E86\u5B9E\u9645\u503C\u4E0E\u671F\u671B\uFF0C\u7167\u7740\u67E5\u3002
10896
+ `);
10897
+ }
10898
+ process.exitCode = failed2 === 0 ? 0 : 1;
10899
+ } catch (e) {
10900
+ exitWithError(e);
10901
+ }
10902
+ }
10903
+
10476
10904
  // src/commands/delivery-recon.ts
10477
10905
  init_auth_guard();
10478
10906
  init_exit();
@@ -10481,7 +10909,7 @@ import {
10481
10909
  ReconLayout,
10482
10910
  ROUND_EXIT_CODES,
10483
10911
  computeReconSourceKey,
10484
- formatObject as formatObject26,
10912
+ formatObject as formatObject27,
10485
10913
  fromAxiosError as fromAxiosError22,
10486
10914
  httpProbe as httpProbe4,
10487
10915
  inspectRound,
@@ -10501,7 +10929,7 @@ async function deliveryReconCommand(args) {
10501
10929
  onlyModel: args.model ?? null,
10502
10930
  identity: ctx.tenantId ? { requestedTenantId: ctx.tenantId } : null
10503
10931
  });
10504
- process.stdout.write(formatObject26(summary, { format: args.output ?? "json" }) + "\n");
10932
+ process.stdout.write(formatObject27(summary, { format: args.output ?? "json" }) + "\n");
10505
10933
  } catch (e) {
10506
10934
  const err = e;
10507
10935
  if (err?.isAxiosError) exitWithError(fromAxiosError22(err, args.env));
@@ -10515,7 +10943,7 @@ async function deliveryReconRoundCommand(args) {
10515
10943
  const result = inspectRound(args.dir ?? ".");
10516
10944
  const fmt = args.output ?? "json";
10517
10945
  if (fmt !== "json") process.stdout.write(renderRound(result));
10518
- process.stdout.write(formatObject26(result, { format: fmt }) + "\n");
10946
+ process.stdout.write(formatObject27(result, { format: fmt }) + "\n");
10519
10947
  code = ROUND_EXIT_CODES[result.state];
10520
10948
  } catch (e) {
10521
10949
  exitWithError(e);
@@ -10534,14 +10962,14 @@ import {
10534
10962
  GAP_REASONS,
10535
10963
  deriveAclass,
10536
10964
  exitCode as gate0ExitCode,
10537
- formatObject as formatObject27,
10965
+ formatObject as formatObject28,
10538
10966
  inspectRound as inspectRound2,
10539
10967
  loadProtocolFacts,
10540
10968
  scan
10541
10969
  } from "@hcmai/sdk";
10542
- import * as path12 from "path";
10970
+ import * as path13 from "path";
10543
10971
  function renderGate0(result, skillRoot) {
10544
- const where = skillRoot ? `\uFF08${path12.resolve(skillRoot)}\uFF09` : "";
10972
+ const where = skillRoot ? `\uFF08${path13.resolve(skillRoot)}\uFF09` : "";
10545
10973
  const lines = [
10546
10974
  `\u626B\u63CF\u9762${where}\uFF1A${result.scanned.length} \u4E2A\u6587\u4EF6\uFF1B\u5224\u7EA2 ${result.red.length} \u6761\uFF1B\u7F3A\u53E3\u653E\u884C ${result.gaps.length} \u6761\u3002`
10547
10975
  ];
@@ -10579,7 +11007,7 @@ async function deliveryGate0Command(args) {
10579
11007
  const merged = { ...result, premise: premise5 };
10580
11008
  const fmt = args.output ?? "json";
10581
11009
  if (fmt !== "json") process.stdout.write(renderGate0(merged, skillRoot));
10582
- process.stdout.write(`${formatObject27(merged, { format: fmt })}
11010
+ process.stdout.write(`${formatObject28(merged, { format: fmt })}
10583
11011
  `);
10584
11012
  for (const problem of premise5) {
10585
11013
  process.stderr.write(`\u{1F534} \u524D\u63D0\u4E0D\u6210\u7ACB\uFF08${problem.reason}\uFF09\uFF1A${problem.message}
@@ -10654,7 +11082,7 @@ import {
10654
11082
  writeRisk
10655
11083
  } from "@hcmai/sdk";
10656
11084
  import { existsSync as existsSync3 } from "fs";
10657
- import * as path13 from "path";
11085
+ import * as path14 from "path";
10658
11086
  function premise(message, hint = "") {
10659
11087
  process.stderr.write(message + (hint ? `
10660
11088
  \u2192 ${hint}` : "") + "\n");
@@ -10681,13 +11109,13 @@ async function runSeedPlan(args, client3) {
10681
11109
  const reconDir = candidates[0].reconDir;
10682
11110
  if (candidates.length > 1) {
10683
11111
  process.stderr.write(
10684
- `\u26A0\uFE0F \u540C\u79DF\u6237\u4E0B\u6709 ${candidates.length} \u4EFD\u57FA\u7EBF\uFF0C\u672C\u8F6E\u8BFB\u7684\u662F \`${path13.basename(reconDir)}\`\uFF1A` + candidates.slice(1).map((c) => `\`${path13.basename(c.reconDir)}\``).join("\u3001") + " \u672A\u88AB\u8BFB\u53D6 \u2014\u2014 \u4E0D\u540C sourceKey \u7684\u4EA7\u7269**\u4E0D\u53EF\u4E92\u6362**\u3002\n"
11112
+ `\u26A0\uFE0F \u540C\u79DF\u6237\u4E0B\u6709 ${candidates.length} \u4EFD\u57FA\u7EBF\uFF0C\u672C\u8F6E\u8BFB\u7684\u662F \`${path14.basename(reconDir)}\`\uFF1A` + candidates.slice(1).map((c) => `\`${path14.basename(c.reconDir)}\``).join("\u3001") + " \u672A\u88AB\u8BFB\u53D6 \u2014\u2014 \u4E0D\u540C sourceKey \u7684\u4EA7\u7269**\u4E0D\u53EF\u4E92\u6362**\u3002\n"
10685
11113
  );
10686
11114
  }
10687
11115
  const round = inspectRound3(reconDir);
10688
11116
  process.stderr.write(roundWarning(round));
10689
11117
  const baseline = {
10690
- path: `${path13.basename(path13.dirname(reconDir))}/${path13.basename(reconDir)}`,
11118
+ path: `${path14.basename(path14.dirname(reconDir))}/${path14.basename(reconDir)}`,
10691
11119
  roundId: round.roundId ?? null
10692
11120
  };
10693
11121
  let exemptions = null;
@@ -10948,8 +11376,8 @@ async function deliverySeedVerifyCommand(args) {
10948
11376
 
10949
11377
  // src/commands/delivery-seed-find.ts
10950
11378
  import { existsSync as existsSync4 } from "fs";
10951
- import { readFileSync as readFileSync6 } from "fs";
10952
- import * as path14 from "path";
11379
+ import { readFileSync as readFileSync7 } from "fs";
11380
+ import * as path15 from "path";
10953
11381
  import {
10954
11382
  INIT_EXIT_CODES as INIT_EXIT_CODES2,
10955
11383
  ValueHints,
@@ -10963,10 +11391,10 @@ import {
10963
11391
  valuesRoundCaveat
10964
11392
  } from "@hcmai/sdk";
10965
11393
  function provenance(chosenReconDir, others) {
10966
- let line = `> \u57FA\u7EBF\uFF1A\`${path14.basename(chosenReconDir)}\`
11394
+ let line = `> \u57FA\u7EBF\uFF1A\`${path15.basename(chosenReconDir)}\`
10967
11395
  `;
10968
11396
  if (others.length > 0) {
10969
- line += `> \u26A0\uFE0F \u540C\u79DF\u6237\u4E0B\u53E6\u6709 ${others.length} \u4EFD\u57FA\u7EBF\u672A\u88AB\u8BFB\u53D6\uFF1A` + others.map((o) => `\`${path14.basename(o)}\``).join("\u3001") + " \u2014\u2014 \u4E0D\u540C sourceKey \u7684\u4EA7\u7269**\u4E0D\u53EF\u4E92\u6362**\u3002\n";
11397
+ line += `> \u26A0\uFE0F \u540C\u79DF\u6237\u4E0B\u53E6\u6709 ${others.length} \u4EFD\u57FA\u7EBF\u672A\u88AB\u8BFB\u53D6\uFF1A` + others.map((o) => `\`${path15.basename(o)}\``).join("\u3001") + " \u2014\u2014 \u4E0D\u540C sourceKey \u7684\u4EA7\u7269**\u4E0D\u53EF\u4E92\u6362**\u3002\n";
10970
11398
  }
10971
11399
  return `${line}
10972
11400
  `;
@@ -11011,7 +11439,7 @@ function runSeedFind(args) {
11011
11439
  if (!existsSync4(chosen.indexFile)) {
11012
11440
  return premise2(`\u7D22\u5F15\u6587\u4EF6\u5728\u9009\u4E2D\u4E4B\u540E\u6D88\u5931\u4E86\uFF1A${chosen.indexFile}`);
11013
11441
  }
11014
- const { rows, problems } = loadRows(readFileSync6(chosen.indexFile, "utf-8"));
11442
+ const { rows, problems } = loadRows(readFileSync7(chosen.indexFile, "utf-8"));
11015
11443
  process.stdout.write(
11016
11444
  renderFind(find(rows, args.term), args.term, rows.length, {
11017
11445
  prefixBytes: Buffer.byteLength(prefix, "utf-8"),
@@ -11051,7 +11479,7 @@ function deliverySeedValuesCommand(model, args) {
11051
11479
 
11052
11480
  // src/commands/delivery-meta.ts
11053
11481
  init_auth_guard();
11054
- import { readFileSync as readFileSync7 } from "fs";
11482
+ import { readFileSync as readFileSync8 } from "fs";
11055
11483
  import {
11056
11484
  BINDING_WORDS,
11057
11485
  CHANGE_STATES,
@@ -11199,7 +11627,7 @@ function premise3(what, hint) {
11199
11627
  async function runDeliveryMeta(args, client3) {
11200
11628
  let content;
11201
11629
  try {
11202
- content = readFileSync7(args.contentFile, "utf-8");
11630
+ content = readFileSync8(args.contentFile, "utf-8");
11203
11631
  } catch (e) {
11204
11632
  return premise3(
11205
11633
  `\u8981\u5199\u8FDB\u53BB\u7684\u6B63\u6587\u8BFB\u4E0D\u51FA\u6765\uFF1A${e.message}`,
@@ -11302,8 +11730,8 @@ import {
11302
11730
  ReconLayout as ReconLayout2,
11303
11731
  runTriageRound
11304
11732
  } from "@hcmai/sdk";
11305
- import { mkdirSync, readFileSync as readFileSync8, writeFileSync as writeFileSync2 } from "fs";
11306
- import * as path15 from "path";
11733
+ import { mkdirSync, readFileSync as readFileSync9, writeFileSync as writeFileSync2 } from "fs";
11734
+ import * as path16 from "path";
11307
11735
  var DEFAULT_CAPABILITIES4 = "default";
11308
11736
  function premise4(message, hint) {
11309
11737
  process.stderr.write(`\u{1F534} \u524D\u63D0\u4E0D\u6210\u7ACB\uFF1A${message}
@@ -11316,7 +11744,7 @@ var REQUESTS_SHAPE = "`--requests` \u6536\u7684\u662F\u4E00\u4E2A JSON \u6570\u7
11316
11744
  function readRequests(file) {
11317
11745
  let raw;
11318
11746
  try {
11319
- raw = JSON.parse(readFileSync8(file, "utf8"));
11747
+ raw = JSON.parse(readFileSync9(file, "utf8"));
11320
11748
  } catch (e) {
11321
11749
  throw new Error(`\u9700\u6C42\u6E05\u5355\u8BFB\u4E0D\u51FA\u6765\uFF08${file}\uFF09\uFF1A${e instanceof Error ? e.message : String(e)}`);
11322
11750
  }
@@ -11339,8 +11767,8 @@ function renderProblems(rows) {
11339
11767
  `;
11340
11768
  }
11341
11769
  function writeTriageArtifact(outDir, body) {
11342
- const out = path15.join(outDir, "work", "triage.md");
11343
- mkdirSync(path15.dirname(out), { recursive: true });
11770
+ const out = path16.join(outDir, "work", "triage.md");
11771
+ mkdirSync(path16.dirname(out), { recursive: true });
11344
11772
  writeFileSync2(out, body, "utf8");
11345
11773
  return out;
11346
11774
  }
@@ -11381,9 +11809,9 @@ async function deliveryTriageCommand(args) {
11381
11809
  // src/commands/delivery-execution.ts
11382
11810
  import { createHash as createHash5, randomBytes as secureRandomBytes } from "crypto";
11383
11811
  import { spawn as spawn2 } from "child_process";
11384
- import { createReadStream, promises as fs12 } from "fs";
11385
- import path16 from "path";
11386
- import { CliError as CliError23, CliErrorCode as CliErrorCode21, formatObject as formatObject28 } from "@hcmai/sdk";
11812
+ import { createReadStream, promises as fs13 } from "fs";
11813
+ import path17 from "path";
11814
+ import { CliError as CliError23, CliErrorCode as CliErrorCode21, formatObject as formatObject29 } from "@hcmai/sdk";
11387
11815
  init_exit();
11388
11816
  var EXECUTION_CONTRACT_VERSION = "2026-09-03.controlled-v4";
11389
11817
  var DEFAULT_TTL_SECONDS = 15 * 60;
@@ -11425,11 +11853,11 @@ async function prepareDeliveryExecution(input) {
11425
11853
  };
11426
11854
  const planId = sha2565(canonicalJson(core)).slice(0, 24);
11427
11855
  const plan = { ...core, planId };
11428
- const plansDir = path16.join(project, ".hcm-delivery", "execution-plans");
11856
+ const plansDir = path17.join(project, ".hcm-delivery", "execution-plans");
11429
11857
  await safeManagedDirectory(project, ".hcm-delivery/execution-plans", plansDir);
11430
- const planFile = path16.join(plansDir, `${planId}.json`);
11858
+ const planFile = path17.join(plansDir, `${planId}.json`);
11431
11859
  try {
11432
- await fs12.writeFile(planFile, `${JSON.stringify(plan, null, 2)}
11860
+ await fs13.writeFile(planFile, `${JSON.stringify(plan, null, 2)}
11433
11861
  `, {
11434
11862
  encoding: "utf8",
11435
11863
  mode: 384,
@@ -11443,7 +11871,7 @@ async function prepareDeliveryExecution(input) {
11443
11871
  async function executeDeliveryPlan(input) {
11444
11872
  if (!PLAN_ID_PATTERN.test(input.planId)) throw invalid2("planId \u5FC5\u987B\u662F 24 \u4F4D\u5C0F\u5199\u5341\u516D\u8FDB\u5236");
11445
11873
  const project = await realProject(input.project);
11446
- const planFile = path16.join(project, ".hcm-delivery", "execution-plans", `${input.planId}.json`);
11874
+ const planFile = path17.join(project, ".hcm-delivery", "execution-plans", `${input.planId}.json`);
11447
11875
  const plan = await readPlan(project, planFile);
11448
11876
  if (plan.planId !== input.planId || computePlanId(plan) !== input.planId) {
11449
11877
  throw invalid2("\u6267\u884C\u8BA1\u5212\u5185\u5BB9\u4E0E planId \u6458\u8981\u4E0D\u4E00\u81F4");
@@ -11480,13 +11908,13 @@ async function executeDeliveryPlan(input) {
11480
11908
  await assertDocumentUnchanged(project, plan.documents.rollback, "\u56DE\u6EDA\u8BF4\u660E");
11481
11909
  await assertPayloadsUnchanged(project, plan.payloads);
11482
11910
  const evidenceDir = await bindEvidenceDirectory(project, plan.evidenceDir);
11483
- const receiptFile = path16.join(evidenceDir.absolute, `${plan.planId}.receipt.json`);
11911
+ const receiptFile = path17.join(evidenceDir.absolute, `${plan.planId}.receipt.json`);
11484
11912
  if (await pathExists(receiptFile)) throw invalid2(`\u6267\u884C\u6536\u636E\u5DF2\u5B58\u5728\uFF0C\u62D2\u7EDD\u518D\u6B21\u6267\u884C\uFF1A${plan.planId}`);
11485
- const claimsDir = path16.join(project, ".hcm-delivery", "execution-claims");
11913
+ const claimsDir = path17.join(project, ".hcm-delivery", "execution-claims");
11486
11914
  await safeManagedDirectory(project, ".hcm-delivery/execution-claims", claimsDir);
11487
- const claimFile = path16.join(claimsDir, `${plan.planId}.json`);
11915
+ const claimFile = path17.join(claimsDir, `${plan.planId}.json`);
11488
11916
  try {
11489
- await fs12.writeFile(
11917
+ await fs13.writeFile(
11490
11918
  claimFile,
11491
11919
  `${JSON.stringify({ schemaVersion: 1, planId: plan.planId, claimedAt: now.toISOString() }, null, 2)}
11492
11920
  `,
@@ -11543,7 +11971,7 @@ async function deliveryPrepareCommand(argv, args) {
11543
11971
  evidenceDir: args.evidenceDir,
11544
11972
  ...ttlSeconds === void 0 ? {} : { ttlSeconds }
11545
11973
  });
11546
- process.stdout.write(formatObject28(plan, { format: args.output ?? "json" }) + "\n");
11974
+ process.stdout.write(formatObject29(plan, { format: args.output ?? "json" }) + "\n");
11547
11975
  process.stderr.write(`
11548
11976
  \u4E0B\u4E00\u6B65\uFF08argv \u5FC5\u987B\u4E0E\u672C\u6B21\u5B8C\u5168\u4E00\u81F4\uFF09\uFF1A
11549
11977
  ${nextCommandHint(plan.planId, args.project, argv)}
@@ -11570,11 +11998,11 @@ async function deliveryExecuteCommand(planId, argv, args) {
11570
11998
  }
11571
11999
  }
11572
12000
  function writeDeliveryExecutionReceipt(receipt, format = "json") {
11573
- process.stderr.write(formatObject28(receipt, { format }) + "\n");
12001
+ process.stderr.write(formatObject29(receipt, { format }) + "\n");
11574
12002
  process.exitCode = receipt.exitCode;
11575
12003
  }
11576
12004
  async function readProjectMode(project, environment) {
11577
- const file = path16.join(project, ".hcm-delivery", "project.yml");
12005
+ const file = path17.join(project, ".hcm-delivery", "project.yml");
11578
12006
  const content = await readSafeFile(project, file, "\u9879\u76EE\u914D\u7F6E");
11579
12007
  let mode;
11580
12008
  try {
@@ -11590,13 +12018,13 @@ async function readProjectMode(project, environment) {
11590
12018
  return mode;
11591
12019
  }
11592
12020
  var SKILLS_LOCK_CANDIDATES = [
11593
- path16.join("hcm-skills", ".hcm-skills.json"),
11594
- path16.join(".claude", "skills", ".hcm-skills.json")
12021
+ path17.join("hcm-skills", ".hcm-skills.json"),
12022
+ path17.join(".claude", "skills", ".hcm-skills.json")
11595
12023
  ];
11596
12024
  async function readSkillsLock(project) {
11597
12025
  const found = [];
11598
12026
  for (const candidate of SKILLS_LOCK_CANDIDATES) {
11599
- if (await pathExists(path16.join(project, candidate))) found.push(candidate);
12027
+ if (await pathExists(path17.join(project, candidate))) found.push(candidate);
11600
12028
  }
11601
12029
  if (found.length === 0) {
11602
12030
  throw invalid2(
@@ -11608,7 +12036,7 @@ async function readSkillsLock(project) {
11608
12036
  `\u9879\u76EE\u91CC\u6709\u591A\u4EFD\u6280\u80FD\u9501\uFF08${found.join("\u3001")}\uFF09\uFF0C\u65E0\u6CD5\u552F\u4E00\u5224\u5B9A\u53D7\u63A7\u6267\u884C\u7ED1\u5B9A\u54EA\u4E00\u4EFD\u3002next_step=\u53EA\u4FDD\u7559\u5B9E\u9645\u5728\u7528\u7684\u90A3\u4E2A\u6280\u80FD\u76EE\u5F55`
11609
12037
  );
11610
12038
  }
11611
- const bytes = await readSafeFile(project, path16.join(project, found[0]), "\u6280\u80FD\u9501");
12039
+ const bytes = await readSafeFile(project, path17.join(project, found[0]), "\u6280\u80FD\u9501");
11612
12040
  try {
11613
12041
  JSON.parse(bytes.toString("utf8"));
11614
12042
  } catch (cause) {
@@ -11621,7 +12049,7 @@ async function bindDocument(project, reference, label) {
11621
12049
  if (!(relative2.startsWith("work/") || relative2.startsWith("decisions/"))) {
11622
12050
  throw invalid2(`${label}\u5FC5\u987B\u4F4D\u4E8E\u9879\u76EE work/ \u6216 decisions/ \u4E0B`);
11623
12051
  }
11624
- const file = path16.join(project, relative2);
12052
+ const file = path17.join(project, relative2);
11625
12053
  const bytes = await readSafeFile(project, file, label);
11626
12054
  return { path: relative2, sha256: sha2565(bytes) };
11627
12055
  }
@@ -11634,11 +12062,11 @@ async function bindEvidenceDirectory(project, reference) {
11634
12062
  if (!(relative2 === "evidence" || relative2.startsWith("evidence/"))) {
11635
12063
  throw invalid2("evidence \u76EE\u5F55\u5FC5\u987B\u4F4D\u4E8E\u9879\u76EE evidence/ \u4E0B");
11636
12064
  }
11637
- const absolute = path16.join(project, relative2);
12065
+ const absolute = path17.join(project, relative2);
11638
12066
  await assertNoSymlinkComponents(project, relative2);
11639
- const stat = await fs12.stat(absolute).catch(() => null);
12067
+ const stat = await fs13.stat(absolute).catch(() => null);
11640
12068
  if (stat === null) {
11641
- await fs12.mkdir(absolute, { recursive: true, mode: 448 }).catch((cause) => {
12069
+ await fs13.mkdir(absolute, { recursive: true, mode: 448 }).catch((cause) => {
11642
12070
  throw invalid2(
11643
12071
  `evidence \u76EE\u5F55\u5EFA\u4E0D\u51FA\u6765\uFF1A${relative2}\u3002next_step=\u68C0\u67E5\u4E0A\u7EA7\u76EE\u5F55\u6743\u9650\uFF0C\u6216\u6362\u4E00\u4E2A evidence/ \u4E0B\u7684\u8DEF\u5F84`,
11644
12072
  cause
@@ -11818,7 +12246,7 @@ async function bindPayloadPath(project, reference, label) {
11818
12246
  const relative2 = safeRelative(reference, label);
11819
12247
  let stat;
11820
12248
  try {
11821
- stat = await fs12.stat(path16.join(project, relative2));
12249
+ stat = await fs13.stat(path17.join(project, relative2));
11822
12250
  } catch (cause) {
11823
12251
  throw invalid2(
11824
12252
  `${label}\u4E0D\u5B58\u5728\uFF1A${relative2}\u3002next_step=\u628A\u6570\u636E\u96C6\u653E\u8FDB\u9879\u76EE\u76EE\u5F55\u5185\uFF0C\u5E76\u7528\u9879\u76EE\u5185\u76F8\u5BF9\u8DEF\u5F84\u5F15\u7528\uFF08\u53D7\u63A7\u6267\u884C\u53EA\u9489\u5F97\u4F4F\u9879\u76EE\u5185\u7684\u8F7D\u8377\uFF09`,
@@ -11829,10 +12257,10 @@ async function bindPayloadPath(project, reference, label) {
11829
12257
  }
11830
12258
  async function bindPayloadDirectory(project, reference, label) {
11831
12259
  const relative2 = reference === "." ? "." : safeRelative(reference, label);
11832
- const root = path16.join(project, relative2);
12260
+ const root = path17.join(project, relative2);
11833
12261
  let stat;
11834
12262
  try {
11835
- stat = await fs12.stat(root);
12263
+ stat = await fs13.stat(root);
11836
12264
  } catch {
11837
12265
  throw invalid2(`${label}\u4E0D\u5B58\u5728\uFF1A${relative2}`);
11838
12266
  }
@@ -11842,10 +12270,10 @@ async function bindPayloadDirectory(project, reference, label) {
11842
12270
  const skipToolingAtRoot = relative2 === ".";
11843
12271
  const entries = [];
11844
12272
  const walk = async (dir, prefix) => {
11845
- const items = await fs12.readdir(dir, { withFileTypes: true });
12273
+ const items = await fs13.readdir(dir, { withFileTypes: true });
11846
12274
  for (const item of [...items].sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0)) {
11847
12275
  if (skipToolingAtRoot && prefix === "" && TOOLING_DIRS.includes(item.name)) continue;
11848
- const child = path16.join(dir, item.name);
12276
+ const child = path17.join(dir, item.name);
11849
12277
  const rel = prefix ? `${prefix}/${item.name}` : item.name;
11850
12278
  if (item.isSymbolicLink()) {
11851
12279
  throw invalid2(
@@ -11870,7 +12298,7 @@ ${sha2565(bytes)}`);
11870
12298
  }
11871
12299
  async function bindPayloadFile(project, reference, label) {
11872
12300
  const relative2 = safeRelative(reference, label);
11873
- const file = path16.join(project, relative2);
12301
+ const file = path17.join(project, relative2);
11874
12302
  const bytes = await readSafeFile(project, file, label);
11875
12303
  return { path: relative2, kind: "file", sha256: sha2565(bytes) };
11876
12304
  }
@@ -11933,29 +12361,29 @@ async function runCurrentCliCommand(argv, cwd, streams) {
11933
12361
  async function writeReceiptExclusive(target, receipt) {
11934
12362
  const temp = `${target}.${process.pid}.${Date.now()}.tmp`;
11935
12363
  try {
11936
- await fs12.writeFile(temp, `${JSON.stringify(receipt, null, 2)}
12364
+ await fs13.writeFile(temp, `${JSON.stringify(receipt, null, 2)}
11937
12365
  `, {
11938
12366
  encoding: "utf8",
11939
12367
  mode: 384,
11940
12368
  flag: "wx"
11941
12369
  });
11942
- await fs12.link(temp, target);
12370
+ await fs13.link(temp, target);
11943
12371
  } catch (cause) {
11944
- throw invalid2(`\u6267\u884C\u6536\u636E\u5199\u5165\u5931\u8D25\u6216\u5DF2\u5B58\u5728\uFF1A${path16.basename(target)}`, cause);
12372
+ throw invalid2(`\u6267\u884C\u6536\u636E\u5199\u5165\u5931\u8D25\u6216\u5DF2\u5B58\u5728\uFF1A${path17.basename(target)}`, cause);
11945
12373
  } finally {
11946
- await fs12.unlink(temp).catch(() => void 0);
12374
+ await fs13.unlink(temp).catch(() => void 0);
11947
12375
  }
11948
12376
  }
11949
12377
  async function safeManagedDirectory(project, relative2, absolute) {
11950
- await assertNoSymlinkComponents(project, path16.dirname(relative2));
11951
- const existing = await fs12.lstat(absolute).catch(() => void 0);
12378
+ await assertNoSymlinkComponents(project, path17.dirname(relative2));
12379
+ const existing = await fs13.lstat(absolute).catch(() => void 0);
11952
12380
  if (existing?.isSymbolicLink()) throw invalid2(`\u53D7\u7BA1\u76EE\u5F55\u4E0D\u80FD\u662F\u7B26\u53F7\u94FE\u63A5\uFF1A${relative2}`);
11953
12381
  if (existing && !existing.isDirectory()) throw invalid2(`\u53D7\u7BA1\u8DEF\u5F84\u4E0D\u662F\u76EE\u5F55\uFF1A${relative2}`);
11954
- if (!existing) await fs12.mkdir(absolute, { mode: 448 });
11955
- await fs12.chmod(absolute, 448);
12382
+ if (!existing) await fs13.mkdir(absolute, { mode: 448 });
12383
+ await fs13.chmod(absolute, 448);
11956
12384
  }
11957
12385
  async function pathExists(file) {
11958
- return fs12.lstat(file).then(
12386
+ return fs13.lstat(file).then(
11959
12387
  () => true,
11960
12388
  (cause) => {
11961
12389
  if (cause.code === "ENOENT") return false;
@@ -11964,47 +12392,47 @@ async function pathExists(file) {
11964
12392
  );
11965
12393
  }
11966
12394
  async function readSafeFile(project, file, label) {
11967
- const relative2 = path16.relative(project, file).split(path16.sep).join("/");
11968
- if (relative2.startsWith("../") || path16.isAbsolute(relative2))
12395
+ const relative2 = path17.relative(project, file).split(path17.sep).join("/");
12396
+ if (relative2.startsWith("../") || path17.isAbsolute(relative2))
11969
12397
  throw invalid2(`${label}\u8DEF\u5F84\u9003\u9038\u9879\u76EE`);
11970
12398
  await assertNoSymlinkComponents(project, relative2);
11971
12399
  let stat;
11972
12400
  try {
11973
- stat = await fs12.lstat(file);
12401
+ stat = await fs13.lstat(file);
11974
12402
  } catch (cause) {
11975
12403
  throw invalid2(`${label}\u4E0D\u53EF\u7528\uFF1A${relative2}`, cause);
11976
12404
  }
11977
12405
  if (stat.isSymbolicLink()) throw invalid2(`${label}\u4E0D\u80FD\u662F\u7B26\u53F7\u94FE\u63A5\uFF1A${relative2}`);
11978
12406
  if (!stat.isFile()) throw invalid2(`${label}\u4E0D\u662F\u666E\u901A\u6587\u4EF6\uFF1A${relative2}`);
11979
- return fs12.readFile(file);
12407
+ return fs13.readFile(file);
11980
12408
  }
11981
12409
  async function assertNoSymlinkComponents(project, relative2) {
11982
12410
  const parts = relative2.split("/").filter(Boolean);
11983
12411
  let current = project;
11984
12412
  for (const part of parts) {
11985
- current = path16.join(current, part);
11986
- const stat = await fs12.lstat(current).catch(() => void 0);
12413
+ current = path17.join(current, part);
12414
+ const stat = await fs13.lstat(current).catch(() => void 0);
11987
12415
  if (stat?.isSymbolicLink()) throw invalid2(`\u8DEF\u5F84\u5305\u542B\u7B26\u53F7\u94FE\u63A5\uFF1A${relative2}`);
11988
12416
  if (!stat) break;
11989
12417
  }
11990
12418
  }
11991
12419
  async function realProject(requested) {
11992
- const absolute = path16.resolve(requested);
12420
+ const absolute = path17.resolve(requested);
11993
12421
  let project;
11994
12422
  try {
11995
- project = await fs12.realpath(absolute);
12423
+ project = await fs13.realpath(absolute);
11996
12424
  } catch (cause) {
11997
12425
  throw invalid2(`\u9879\u76EE\u76EE\u5F55\u4E0D\u53EF\u7528\uFF1A${absolute}`, cause);
11998
12426
  }
11999
- const stat = await fs12.stat(project);
12427
+ const stat = await fs13.stat(project);
12000
12428
  if (!stat.isDirectory()) throw invalid2(`\u9879\u76EE\u8DEF\u5F84\u4E0D\u662F\u76EE\u5F55\uFF1A${absolute}`);
12001
12429
  return project;
12002
12430
  }
12003
12431
  function safeRelative(reference, label) {
12004
- if (!reference || path16.isAbsolute(reference) || /[\r\n\0]/.test(reference)) {
12432
+ if (!reference || path17.isAbsolute(reference) || /[\r\n\0]/.test(reference)) {
12005
12433
  throw invalid2(`${label}\u5FC5\u987B\u662F\u9879\u76EE\u5185\u76F8\u5BF9\u8DEF\u5F84`);
12006
12434
  }
12007
- const normalized = path16.normalize(reference).split(path16.sep).join("/");
12435
+ const normalized = path17.normalize(reference).split(path17.sep).join("/");
12008
12436
  if (normalized === ".." || normalized.startsWith("../") || normalized === ".") {
12009
12437
  throw invalid2(`${label}\u8DEF\u5F84\u9003\u9038\u9879\u76EE`);
12010
12438
  }
@@ -12071,7 +12499,7 @@ init_exit();
12071
12499
  import {
12072
12500
  HcmClient as HcmClient28,
12073
12501
  adminResetPassword,
12074
- formatObject as formatObject29,
12502
+ formatObject as formatObject30,
12075
12503
  fromAxiosError as fromAxiosError23,
12076
12504
  CliError as CliError24,
12077
12505
  CliErrorCode as CliErrorCode22
@@ -12105,7 +12533,7 @@ async function userResetPasswordCommand(args) {
12105
12533
  const request = buildAdminResetPasswordRequest(args, password);
12106
12534
  const client3 = HcmClient28.fromAuthContext(await getActiveAuthContextFromCli(args));
12107
12535
  const result = await adminResetPassword(client3.raw(), request);
12108
- process.stdout.write(formatObject29(result, { format: args.output ?? "json" }) + "\n");
12536
+ process.stdout.write(formatObject30(result, { format: args.output ?? "json" }) + "\n");
12109
12537
  } catch (cause) {
12110
12538
  const err = cause;
12111
12539
  if (err?.isAxiosError) exitWithError(fromAxiosError23(err, args.env));
@@ -12129,7 +12557,7 @@ init_exit();
12129
12557
  init_auth_guard();
12130
12558
  import {
12131
12559
  HcmClient as HcmClient29,
12132
- formatObject as formatObject30,
12560
+ formatObject as formatObject31,
12133
12561
  fromAxiosError as fromAxiosError24
12134
12562
  } from "@hcmai/sdk";
12135
12563
  async function modelsCommand(keyword, args) {
@@ -12140,7 +12568,7 @@ async function modelsCommand(keyword, args) {
12140
12568
  const rows = (needle ? all.filter((m) => JSON.stringify(m).toLowerCase().includes(needle)) : all).sort((a, b) => key(a).localeCompare(key(b)));
12141
12569
  const fmt = args.output ?? "table";
12142
12570
  if (fmt !== "table") {
12143
- process.stdout.write(formatObject30({ total: rows.length, models: rows }, { format: fmt }) + "\n");
12571
+ process.stdout.write(formatObject31({ total: rows.length, models: rows }, { format: fmt }) + "\n");
12144
12572
  process.exitCode = 0;
12145
12573
  return;
12146
12574
  }
@@ -12219,9 +12647,10 @@ identity.command("use <name>").description("\u628A identity \u8BBE\u4E3A\u5176 e
12219
12647
  identity.command("remove <name>").description("\u5220\u9664 identity\uFF08\u6E05 token + \u82E5\u662F env default \u5219\u6E05\u7A7A\uFF09").action((name) => identityRemove(name));
12220
12648
  var user = program.command("user").description("\u7BA1\u7406\u79DF\u6237\u7528\u6237\u7684\u4E13\u7528\u51ED\u636E\u6D41\u7A0B");
12221
12649
  user.command("reset-password").description("\u7531 admin.system \u5B89\u5168\u91CD\u7F6E\u7528\u6237\u5BC6\u7801\uFF0C\u5E76\u4F7F\u65E2\u6709\u4F1A\u8BDD\u5931\u6548").option("--id <uuid>", "\u76EE\u6807\u7528\u6237 ID\uFF08\u4E0E --username \u4E8C\u9009\u4E00\uFF09").option("--username <user>", "\u76EE\u6807\u7528\u6237\u540D\uFF08\u4E0E --id \u4E8C\u9009\u4E00\uFF09").option("--password-stdin", "\u4ECE\u6807\u51C6\u8F93\u5165\u8BFB\u53D6\u65B0\u5BC6\u7801\uFF08Agent/\u53D7\u63A7\u4EA4\u4ED8\u5FC5\u987B\u4F7F\u7528\uFF09").option("--no-force-change", "\u4E0B\u6B21\u767B\u5F55\u4E0D\u5F3A\u5236\u6539\u5BC6\uFF08\u4EC5\u9650\u5DF2\u6279\u51C6\u7684\u9694\u79BB\u6D4B\u8BD5\u73AF\u5883\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\u5FC5\u987B\u5177\u5907 admin.system\uFF09").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").action((opts) => userResetPasswordCommand(opts));
12222
- var chiron = program.command("chiron").description("\u777F\u620E\u987E\u95EE\u9879\u76EE\uFF1Ainit \u4E00\u6761\u547D\u4EE4\u521D\u59CB\u5316\u9879\u76EE\u4ED3\uFF0Cdoctor \u4E09\u884C\u6838\u5BF9\u80FD\u4E0D\u80FD\u5F00\u5DE5");
12650
+ var chiron = program.command("chiron").description("\u777F\u620E\u987E\u95EE\u9879\u76EE\uFF1Ainit \u4E00\u6761\u547D\u4EE4\u521D\u59CB\u5316\u9879\u76EE\u4ED3\uFF0Cdoctor \u56DB\u884C\u6838\u5BF9\u80FD\u4E0D\u80FD\u5F00\u5DE5");
12223
12651
  chiron.command("init").description("\u521D\u59CB\u5316\u987E\u95EE\u9879\u76EE\u4ED3\uFF1A\u5199 env.yaml\uFF08\u7528\u521A hcm login \u7684\u73AF\u5883\uFF09\u3001\u5EFA\u76EE\u5F55\u3001\u88C5\u5168\u90E8\u6280\u80FD\u3001\u63A5\u6848\u4F8B\u5E93\uFF1B\u91CD\u8DD1\u5B89\u5168").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));
12224
- chiron.command("doctor").description("\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").option("--project <dir>", "\u9879\u76EE\u6839\u76EE\u5F55", ".").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));
12652
+ 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));
12653
+ chiron.command("doctor").description("\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").option("--project <dir>", "\u9879\u76EE\u6839\u76EE\u5F55", ".").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));
12225
12654
  var delivery = program.command("delivery").description("\u987E\u95EE\u4EA4\u4ED8\uFF1A\u73B0\u573A\u63A2\u6D3B\u3001\u98CE\u9669\u8BC4\u4F30\u4E0E\u4E00\u6B21\u6027\u53D7\u63A7\u6267\u884C\u5408\u540C");
12226
12655
  delivery.command("assess").description("\u8BC4\u4F30\u4E00\u6B21 HCM CLI argv\uFF1BAction \u98CE\u63A7\u58F0\u660E\u8BFB\u53D6\u81EA\u76EE\u6807 Core\uFF0C\u7528 -- \u5206\u9694\u88AB\u8BC4\u4F30\u547D\u4EE4").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").allowUnknownOption(true).argument("<command...>", "\u88AB\u8BC4\u4F30\u7684 HCM \u5B50\u547D\u4EE4\u4E0E\u53C2\u6570\uFF0C\u4E0D\u5305\u542B hcm \u672C\u8EAB").action((command, opts) => deliveryAssessCommand(command, opts));
12227
12656
  delivery.command("doctor").description("\u56DB\u6761\u951A\u70B9\u63A2\u6D3B\uFF1A\u8FDE\u901A / \u6211\u662F\u8C01 / configAdmin / \u7AD9\u5728\u54EA\u4E00\u5C42").option("--env <name>", "\u76EE\u6807\u73AF\u5883\u522B\u540D").option("--as <identity>", "\u4E34\u65F6\u6362\u8EAB\u4EFD").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) => deliveryDoctorCommand(opts));
@@ -12374,7 +12803,7 @@ skills.command("update").description("\u628A\u88C5\u8FC7\u7684\u6280\u80FD\u5347
12374
12803
  program.command("update <Model>").description("\u66F4\u65B0\u4E00\u6761 Model \u8BB0\u5F55\uFF08\u8D70\u540E\u7AEF\u5B8C\u6574\u6821\u9A8C\uFF09\u3002\u5347\u7EA7 CLI \u8BF7\u7528 `hcm upgrade`").requiredOption("--id <id>", "\u8BB0\u5F55 ID").option("--data <JSON>", `\u8981\u66F4\u65B0\u7684\u5B57\u6BB5 JSON\uFF0C\u4F8B\u5982 '{"name":"\u65B0\u540D\u79F0"}'`).option("--data-file <path>", "\u4ECE UTF-8 JSON \u6587\u4EF6\u8BFB\u53D6\u66F4\u65B0\u5B57\u6BB5\uFF08\u4E0E --data \u4E92\u65A5\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("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").option("--i18n", "\u591A\u8BED\u8A00\u5B57\u6BB5\u6309 Map \u5B8C\u6574\u66FF\u6362\uFF08\u952E\u7528 zh-CN / en-US \u8FDE\u5B57\u7B26\u5F62\uFF09\uFF1B\u4E0D\u4F20\u5219\u6309\u5B57\u7B26\u4E32\u53EA\u6539\u5F53\u524D\u8BED\u8A00").action((model, opts) => updateCommand(model, opts));
12375
12804
  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));
12376
12805
  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));
12377
- 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((path17, opts) => openCommand(path17, opts));
12806
+ 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((path18, opts) => openCommand(path18, opts));
12378
12807
  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");
12379
12808
  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));
12380
12809
  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("--set <assignment...>", "namespace.key=value\uFF0C\u4F8B\u5982 security.password.passwordPolicy=complex").option("--dry-run", "\u53EA\u663E\u793A\u5C06\u5199\u5165\u4EC0\u4E48\uFF0C\u4E0D\u5B9E\u9645\u5199\u5165").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", "json").action((d, opts) => settingSetCommand(d, opts));