@hcmai/cli 0.31.0 → 0.31.1

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
@@ -285,13 +285,13 @@ function prepareImpersonationExit(code2, brokenStderr = false) {
285
285
  terminating ??= (async () => {
286
286
  process.exitCode = code2 || process.exitCode || 0;
287
287
  const errors = await cleanup();
288
- await new Promise((resolve7) => {
288
+ await new Promise((resolve8) => {
289
289
  let remaining = 2;
290
- const timer = setTimeout(resolve7, 1e3);
290
+ const timer = setTimeout(resolve8, 1e3);
291
291
  const done = () => {
292
292
  if (--remaining === 0) {
293
293
  clearTimeout(timer);
294
- resolve7();
294
+ resolve8();
295
295
  }
296
296
  };
297
297
  for (const stream of [process.stdout, process.stderr]) {
@@ -658,7 +658,7 @@ __export(attachment_args_exports, {
658
658
  });
659
659
  import * as fs4 from "fs";
660
660
  import * as os from "os";
661
- import * as path4 from "path";
661
+ import * as path5 from "path";
662
662
  function extractAtFileTokens(text2) {
663
663
  const paths = [];
664
664
  const re = /@(?:"([^"]+)"|'([^']+)'|(\S+))/g;
@@ -694,7 +694,7 @@ function isBareFilePath(text2) {
694
694
  return isExistingFile(abs) ? abs : null;
695
695
  }
696
696
  function expandHome(p) {
697
- return p.startsWith("~") ? path4.join(os.homedir(), p.slice(1)) : path4.resolve(p);
697
+ return p.startsWith("~") ? path5.join(os.homedir(), p.slice(1)) : path5.resolve(p);
698
698
  }
699
699
  function isExistingFile(p) {
700
700
  try {
@@ -1067,8 +1067,8 @@ var init_TerminalRenderer = __esm({
1067
1067
  }
1068
1068
  }
1069
1069
  /** 来源行(仅子代理触发,agentPath ≥2 段时显示 `↑ 来自 a › b`,对齐 Web)。 */
1070
- originLine(path25) {
1071
- const segs = path25.split(".").filter(Boolean);
1070
+ originLine(path26) {
1071
+ const segs = path26.split(".").filter(Boolean);
1072
1072
  if (segs.length < 2) return "";
1073
1073
  const names = segs.map((k) => agentDisplayName(k));
1074
1074
  return chalk.gray(` \u2191 \u6765\u81EA ${names.join(" \u203A ")}`) + "\n";
@@ -2257,8 +2257,8 @@ function agentLabel(agentId) {
2257
2257
  if (/^[0-9a-f]{8}-[0-9a-f-]{27}$/i.test(agentId)) return `agent \u2026${agentId.slice(-4)}`;
2258
2258
  return agentDisplayName(agentId);
2259
2259
  }
2260
- function originLine(path25) {
2261
- const segs = (path25 ?? "").split(".").filter(Boolean);
2260
+ function originLine(path26) {
2261
+ const segs = (path26 ?? "").split(".").filter(Boolean);
2262
2262
  if (segs.length < 2) return null;
2263
2263
  return `\u6765\u81EA ${segs.map((k) => agentDisplayName(k)).join(" \u203A ")}`;
2264
2264
  }
@@ -2494,10 +2494,10 @@ __export(readline_exports, {
2494
2494
  import * as readline2 from "readline";
2495
2495
  function readLineFromStdin(prompt = "") {
2496
2496
  const rl = readline2.createInterface({ input: process.stdin, output: process.stdout });
2497
- return new Promise((resolve7) => {
2497
+ return new Promise((resolve8) => {
2498
2498
  rl.question(prompt, (answer) => {
2499
2499
  rl.close();
2500
- resolve7(answer);
2500
+ resolve8(answer);
2501
2501
  });
2502
2502
  });
2503
2503
  }
@@ -2847,7 +2847,7 @@ function requireTerminalForPrompt(message, nextStep) {
2847
2847
  }
2848
2848
  async function promptText(question, output = process.stdout) {
2849
2849
  const rl = readline.createInterface({ input: process.stdin, output });
2850
- return new Promise((resolve7, reject) => {
2850
+ return new Promise((resolve8, reject) => {
2851
2851
  let answered = false;
2852
2852
  rl.on("close", () => {
2853
2853
  if (!answered) reject(new Error("\u8F93\u5165\u5DF2\u7ED3\u675F\uFF1B\u64CD\u4F5C\u5DF2\u53D6\u6D88\u3002"));
@@ -2855,12 +2855,12 @@ async function promptText(question, output = process.stdout) {
2855
2855
  rl.question(question, (ans) => {
2856
2856
  answered = true;
2857
2857
  rl.close();
2858
- resolve7(ans.trim());
2858
+ resolve8(ans.trim());
2859
2859
  });
2860
2860
  });
2861
2861
  }
2862
2862
  async function promptSecret(question, output = process.stdout) {
2863
- return new Promise((resolve7, reject) => {
2863
+ return new Promise((resolve8, reject) => {
2864
2864
  const stdin = process.stdin;
2865
2865
  stdin.setRawMode?.(true);
2866
2866
  let buf = "";
@@ -2880,7 +2880,7 @@ async function promptSecret(question, output = process.stdout) {
2880
2880
  stdin.removeListener("data", onData);
2881
2881
  stdin.removeListener("end", onEnd);
2882
2882
  output.write("\n");
2883
- resolve7(buf);
2883
+ resolve8(buf);
2884
2884
  return;
2885
2885
  }
2886
2886
  if (ch === "") {
@@ -2985,7 +2985,7 @@ function launchBrowser(url, platform = process.platform, onFailure) {
2985
2985
  child.unref();
2986
2986
  }
2987
2987
  async function runOpen(target, args, deps) {
2988
- const path25 = normalizeTarget(target);
2988
+ const path26 = normalizeTarget(target);
2989
2989
  if (!deps.frontend?.trim()) {
2990
2990
  throw new CliError6({
2991
2991
  code: CliErrorCode4.INVALID_ARGUMENT,
@@ -2993,13 +2993,13 @@ async function runOpen(target, args, deps) {
2993
2993
  });
2994
2994
  }
2995
2995
  const { ticket, expiresIn } = await deps.mintTicket();
2996
- const url = buildBrowserLoginUrl(deps.frontend, ticket, path25);
2996
+ const url = buildBrowserLoginUrl(deps.frontend, ticket, path26);
2997
2997
  if (args.printUrl) {
2998
2998
  deps.write(`${url}
2999
2999
  `);
3000
3000
  } else {
3001
3001
  deps.launch(url);
3002
- deps.write(`\u5DF2\u7528\u5F53\u524D\u8EAB\u4EFD\u6253\u5F00 ${path25}\uFF08\u7968\u636E ${expiresIn ?? 60}s \u5185\u6709\u6548\uFF0C\u53EA\u80FD\u7528\u4E00\u6B21\uFF09
3002
+ deps.write(`\u5DF2\u7528\u5F53\u524D\u8EAB\u4EFD\u6253\u5F00 ${path26}\uFF08\u7968\u636E ${expiresIn ?? 60}s \u5185\u6709\u6548\uFF0C\u53EA\u80FD\u7528\u4E00\u6B21\uFF09
3003
3003
  `);
3004
3004
  }
3005
3005
  return { url, expiresIn };
@@ -3196,10 +3196,10 @@ async function beginBrowserLogin(input) {
3196
3196
  let closing;
3197
3197
  let watch;
3198
3198
  let stopCountdown = () => void 0;
3199
- let resolve7;
3199
+ let resolve8;
3200
3200
  let reject;
3201
3201
  const result = new Promise((yes, no) => {
3202
- resolve7 = yes;
3202
+ resolve8 = yes;
3203
3203
  reject = no;
3204
3204
  });
3205
3205
  void result.catch(() => void 0);
@@ -3252,7 +3252,7 @@ async function beginBrowserLogin(input) {
3252
3252
  }).then((authorized) => {
3253
3253
  verifier = "";
3254
3254
  session = authorized;
3255
- resolve7({ session, close, complete: async () => {
3255
+ resolve8({ session, close, complete: async () => {
3256
3256
  if (cancel.controller.signal.aborted) throw cancel.error(new Error("\u767B\u5F55\u5DF2\u53D6\u6D88"));
3257
3257
  session.complete();
3258
3258
  reply(response, 200, "CLI \u767B\u5F55\u6210\u529F");
@@ -4915,6 +4915,7 @@ import {
4915
4915
 
4916
4916
  // src/utils/json-input.ts
4917
4917
  import * as fs2 from "fs/promises";
4918
+ import * as path3 from "path";
4918
4919
  import { CliError as CliError13, CliErrorCode as CliErrorCode11 } from "@hcmai/sdk";
4919
4920
  async function readJsonObjectInput(options) {
4920
4921
  const { inline, file, inlineFlag, fileFlag, required: required2 = true } = options;
@@ -4933,10 +4934,14 @@ async function readJsonObjectInput(options) {
4933
4934
  }
4934
4935
  let raw;
4935
4936
  let sourceFlag;
4937
+ let fileContext;
4936
4938
  if (file) {
4937
4939
  sourceFlag = fileFlag;
4938
4940
  try {
4939
- raw = await fs2.readFile(file, "utf-8");
4941
+ const filePath2 = path3.resolve(file);
4942
+ const contents = await fs2.readFile(filePath2);
4943
+ raw = contents.toString("utf-8");
4944
+ fileContext = { filePath: filePath2, sizeBytes: contents.byteLength };
4940
4945
  } catch (error) {
4941
4946
  throw new CliError13({
4942
4947
  code: CliErrorCode11.INVALID_ARGUMENT,
@@ -4947,19 +4952,26 @@ async function readJsonObjectInput(options) {
4947
4952
  sourceFlag = inlineFlag;
4948
4953
  raw = inline;
4949
4954
  }
4955
+ const source = fileContext ? `${sourceFlag}: ${fileContext.filePath}\uFF08${fileContext.sizeBytes} \u5B57\u8282\uFF09` : sourceFlag;
4956
+ const context = {
4957
+ ...fileContext,
4958
+ nextStep: `\u6821\u9A8C\u8F93\u5165\u4E3A\u5B8C\u6574\u7684 JSON \u5BF9\u8C61\u3002${fileContext ? "CLI \u53EA\u8BFB\u53D6\u8C03\u7528\u65B9\u63D0\u4F9B\u7684\u6587\u4EF6\uFF0C\u4E0D\u81EA\u5EFA\u53C2\u6570\u4E34\u65F6\u6587\u4EF6\uFF1B\u5E76\u53D1\u65F6\u6BCF\u4E2A\u4EFB\u52A1\u4F7F\u7528\u72EC\u7ACB\u6587\u4EF6\uFF0C\u7B49\u5F85\u5199\u5165\u5B8C\u6210\u540E\u518D\u8C03\u7528\u3002" : ""}` + (!required2 ? `\u82E5\u52A8\u4F5C\u65E0\u53C2\u6570\uFF0C\u53EF\u7701\u7565 ${inlineFlag}/${fileFlag}\uFF0C\u6216\u4F7F\u7528 ${inlineFlag} '{}'\u3002` : "")
4959
+ };
4950
4960
  let parsed;
4951
4961
  try {
4952
4962
  parsed = JSON.parse(raw);
4953
- } catch (error) {
4963
+ } catch {
4954
4964
  throw new CliError13({
4955
4965
  code: CliErrorCode11.INVALID_JSON,
4956
- message: `${sourceFlag}: ${error.message}`
4966
+ message: `${source}: ${raw.trim() ? "JSON \u8BED\u6CD5\u65E0\u6548\uFF0C\u53EF\u80FD\u672A\u5199\u5B8C\u6574\u6216\u5DF2\u622A\u65AD" : "\u8F93\u5165\u4E3A\u7A7A\u6216\u4EC5\u542B\u7A7A\u767D"}`,
4967
+ context
4957
4968
  });
4958
4969
  }
4959
4970
  if (parsed === null || Array.isArray(parsed) || typeof parsed !== "object") {
4960
4971
  throw new CliError13({
4961
4972
  code: CliErrorCode11.INVALID_JSON,
4962
- message: `${sourceFlag}: \u9876\u5C42\u5FC5\u987B\u662F JSON \u5BF9\u8C61`
4973
+ message: `${source}: \u9876\u5C42\u5FC5\u987B\u662F JSON \u5BF9\u8C61`,
4974
+ context
4963
4975
  });
4964
4976
  }
4965
4977
  return parsed;
@@ -4969,7 +4981,7 @@ async function readJsonObjectInput(options) {
4969
4981
  import { createHash as createHash2 } from "crypto";
4970
4982
  import { CliError as CliError14, CliErrorCode as CliErrorCode12 } from "@hcmai/sdk";
4971
4983
  import { promises as fs3 } from "fs";
4972
- import path3 from "path";
4984
+ import path4 from "path";
4973
4985
  var MAX_ARTIFACT_BYTES = 10 * 1024 * 1024;
4974
4986
  var ARTIFACT_ENCODING_BASE64 = "base64";
4975
4987
  var SHA256_HEX = /^[0-9a-f]{64}$/;
@@ -5001,7 +5013,7 @@ function parseArtifactEnvelope(data) {
5001
5013
  }
5002
5014
  var fail = (message, nextStep) => new CliError14({ code: CliErrorCode12.INVALID_ARGUMENT, message, context: { nextStep } });
5003
5015
  async function writeArtifact(artifact, target, opts = {}) {
5004
- const abs = path3.resolve(target);
5016
+ const abs = path4.resolve(target);
5005
5017
  const stat = await fs3.lstat(abs).catch(() => null);
5006
5018
  if (stat) {
5007
5019
  if (stat.isSymbolicLink()) {
@@ -5030,9 +5042,9 @@ async function writeArtifact(artifact, target, opts = {}) {
5030
5042
  if (digest !== artifact.sha256) {
5031
5043
  throw fail(`SHA-256 \u5BF9\u4E0D\u4E0A\uFF1A\u4FE1\u5C01\u8BF4 ${artifact.sha256}\uFF0C\u5B9E\u9645 ${digest}`, "\u540C\u4E0A\uFF1A\u5185\u5BB9\u4E0E\u6458\u8981\u4E0D\u4E00\u81F4\uFF0C\u8FD9\u4EFD\u5236\u54C1\u4E0D\u53EF\u4FE1\uFF0C\u4E0D\u843D\u76D8\u3002");
5032
5044
  }
5033
- const dir = path3.dirname(abs);
5045
+ const dir = path4.dirname(abs);
5034
5046
  await fs3.mkdir(dir, { recursive: true });
5035
- const tmp = path3.join(dir, `.tmp-artifact-${process.pid}-${Date.now()}`);
5047
+ const tmp = path4.join(dir, `.tmp-artifact-${process.pid}-${Date.now()}`);
5036
5048
  try {
5037
5049
  await fs3.writeFile(tmp, bytes, { mode: 384, flag: "wx" });
5038
5050
  await fs3.rename(tmp, abs);
@@ -5535,8 +5547,8 @@ import {
5535
5547
  formatObject as formatObject9,
5536
5548
  fromAxiosError as fromAxiosError12
5537
5549
  } from "@hcmai/sdk";
5538
- function collectYmlFiles(path25) {
5539
- if (statSync(path25).isFile()) return [path25];
5550
+ function collectYmlFiles(path26) {
5551
+ if (statSync(path26).isFile()) return [path26];
5540
5552
  const out = [];
5541
5553
  const walk = (dir) => {
5542
5554
  for (const name of readdirSync(dir).sort()) {
@@ -5545,7 +5557,7 @@ function collectYmlFiles(path25) {
5545
5557
  else if (full.endsWith(".yml") || full.endsWith(".yaml")) out.push(full);
5546
5558
  }
5547
5559
  };
5548
- walk(path25);
5560
+ walk(path26);
5549
5561
  return out.sort();
5550
5562
  }
5551
5563
  var DRY_RUN_CLIENT = {
@@ -5554,9 +5566,9 @@ var DRY_RUN_CLIENT = {
5554
5566
  update: async () => ({}),
5555
5567
  fieldKeys: async () => []
5556
5568
  };
5557
- async function importCommand(path25, args) {
5569
+ async function importCommand(path26, args) {
5558
5570
  try {
5559
- const files = collectYmlFiles(path25);
5571
+ const files = collectYmlFiles(path26);
5560
5572
  const fixtures = files.map(
5561
5573
  (f) => parseFixture(readFileSync3(f, "utf8"), relative2(process.cwd(), f))
5562
5574
  );
@@ -6320,11 +6332,11 @@ async function chatCommand(prompt, args) {
6320
6332
  lastConversationId: handle.conversationId,
6321
6333
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
6322
6334
  });
6323
- await new Promise((resolve7) => {
6335
+ await new Promise((resolve8) => {
6324
6336
  if (process.stdout.writableNeedDrain) {
6325
- process.stdout.once("drain", resolve7);
6337
+ process.stdout.once("drain", resolve8);
6326
6338
  } else {
6327
- resolve7();
6339
+ resolve8();
6328
6340
  }
6329
6341
  });
6330
6342
  process.exitCode = 0;
@@ -6393,11 +6405,11 @@ async function chatCommand(prompt, args) {
6393
6405
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
6394
6406
  });
6395
6407
  process.removeListener("SIGINT", sigintHandler);
6396
- await new Promise((resolve7) => {
6408
+ await new Promise((resolve8) => {
6397
6409
  if (process.stdout.writableNeedDrain) {
6398
- process.stdout.once("drain", resolve7);
6410
+ process.stdout.once("drain", resolve8);
6399
6411
  } else {
6400
- resolve7();
6412
+ resolve8();
6401
6413
  }
6402
6414
  });
6403
6415
  process.exitCode = result.status === "interrupted" ? 130 : 0;
@@ -7661,7 +7673,7 @@ function emit3(payload, fmt) {
7661
7673
  init_exit();
7662
7674
  init_auth_guard();
7663
7675
  import { promises as fs7 } from "fs";
7664
- import * as path5 from "path";
7676
+ import * as path6 from "path";
7665
7677
  import yaml from "js-yaml";
7666
7678
  import { HcmClient as HcmClient22, fromAxiosError as fromAxiosError21, CliError as CliError23, CliErrorCode as CliErrorCode23, stripDefinitionIds, columnSlotsToFlex, redactDescriptiveUuids, removeActionsUsingScripts, stripUnknownFieldKeysForPath } from "@hcmai/sdk";
7667
7679
 
@@ -7747,10 +7759,10 @@ function createLaneApi(http) {
7747
7759
  }
7748
7760
  return out.filter((x) => x.name);
7749
7761
  },
7750
- async tenantMetaGet(path25) {
7751
- const resp = await http.get("/api/tenant-meta/meta", { params: { path: path25 } });
7762
+ async tenantMetaGet(path26) {
7763
+ const resp = await http.get("/api/tenant-meta/meta", { params: { path: path26 } });
7752
7764
  const d = resp.data?.data ?? resp.data;
7753
- if (typeof d?.content !== "string") throw new Error(`\u8BFB\u53D6 ${path25} \u672A\u8FD4\u56DE content`);
7765
+ if (typeof d?.content !== "string") throw new Error(`\u8BFB\u53D6 ${path26} \u672A\u8FD4\u56DE content`);
7754
7766
  return { content: d.content, sourceKind: d.source?.kind };
7755
7767
  }
7756
7768
  };
@@ -8448,7 +8460,7 @@ async function resolvePackageIdentity(api2, opts) {
8448
8460
  async function envExportConfigCommand(args) {
8449
8461
  try {
8450
8462
  if (!args.out) throw new CliError23({ code: CliErrorCode23.MISSING_FLAG, message: "\u7F3A --out <dir>", context: { nextStep: "hcm env export-config --out ./export-<\u73AF\u5883\u540D>" } });
8451
- const outDir = path5.resolve(args.out);
8463
+ const outDir = path6.resolve(args.out);
8452
8464
  const columnSlots = args.columnSlots ?? "to-flex";
8453
8465
  if (columnSlots !== "to-flex" && columnSlots !== "keep") {
8454
8466
  throw new CliError23({
@@ -8472,12 +8484,12 @@ async function envExportConfigCommand(args) {
8472
8484
  `)
8473
8485
  });
8474
8486
  if (args.force) {
8475
- await fs7.rm(path5.join(outDir, "data"), { recursive: true, force: true });
8476
- await fs7.rm(path5.join(outDir, "extensions"), { recursive: true, force: true });
8487
+ await fs7.rm(path6.join(outDir, "data"), { recursive: true, force: true });
8488
+ await fs7.rm(path6.join(outDir, "extensions"), { recursive: true, force: true });
8477
8489
  }
8478
8490
  for (const [rel, content] of result.files) {
8479
- const abs = path5.join(outDir, rel);
8480
- await fs7.mkdir(path5.dirname(abs), { recursive: true });
8491
+ const abs = path6.join(outDir, rel);
8492
+ await fs7.mkdir(path6.dirname(abs), { recursive: true });
8481
8493
  await fs7.writeFile(abs, content, "utf8");
8482
8494
  }
8483
8495
  const r = result.report;
@@ -8503,7 +8515,7 @@ async function envExportConfigCommand(args) {
8503
8515
  }, null, 2) + "\n");
8504
8516
  process.stderr.write(renderColumnSlots(r.columnSlots));
8505
8517
  if (r.status === "DEGRADED") {
8506
- process.stderr.write(`\u5BFC\u51FA\u4E0D\u5B8C\u6574\uFF08DEGRADED\uFF0C\u9000\u51FA\u7801 3\uFF09\uFF1A\u8BE6\u89C1 ${path5.join(outDir, "export-report.json")} \u7684 degradedReasons / unresolvedReferences\u3002
8518
+ process.stderr.write(`\u5BFC\u51FA\u4E0D\u5B8C\u6574\uFF08DEGRADED\uFF0C\u9000\u51FA\u7801 3\uFF09\uFF1A\u8BE6\u89C1 ${path6.join(outDir, "export-report.json")} \u7684 degradedReasons / unresolvedReferences\u3002
8507
8519
  `);
8508
8520
  }
8509
8521
  process.stderr.write(renderNextSteps(outDir, r));
@@ -8551,7 +8563,7 @@ function renderNextSteps(outDir, r) {
8551
8563
  init_exit();
8552
8564
  init_auth_guard();
8553
8565
  import { promises as fs8 } from "fs";
8554
- import * as path6 from "path";
8566
+ import * as path7 from "path";
8555
8567
  import yaml2 from "js-yaml";
8556
8568
  import { HcmClient as HcmClient23, fromAxiosError as fromAxiosError22, CliError as CliError24, CliErrorCode as CliErrorCode24 } from "@hcmai/sdk";
8557
8569
  var FINGERPRINT_MODELS = ["Employee", "OrgUnit", "Position", "Assignment"];
@@ -9221,7 +9233,7 @@ async function envFingerprintCommand(args) {
9221
9233
  `) });
9222
9234
  assertRedLine(fp, fieldMetas);
9223
9235
  const text2 = yaml2.dump(fp, { lineWidth: -1, noRefs: true });
9224
- const outFile = path6.resolve(args.out);
9236
+ const outFile = path7.resolve(args.out);
9225
9237
  await fs8.writeFile(outFile, text2, "utf8");
9226
9238
  const summary = {
9227
9239
  out: outFile,
@@ -9277,8 +9289,9 @@ async function envFingerprintCommand(args) {
9277
9289
  init_exit();
9278
9290
  import { promises as fsp2 } from "fs";
9279
9291
  import os3 from "os";
9280
- import path11 from "path";
9292
+ import path12 from "path";
9281
9293
  import { createHash as createHash4 } from "crypto";
9294
+ import axios4 from "axios";
9282
9295
  import {
9283
9296
  createHttpClient as createHttpClient2,
9284
9297
  fetchSkillCatalog,
@@ -9498,7 +9511,7 @@ function boundaryFallbackLine(reason, notFetchedBy) {
9498
9511
 
9499
9512
  // src/commands/chiron-project.ts
9500
9513
  import { promises as fs10 } from "fs";
9501
- import path8 from "path";
9514
+ import path9 from "path";
9502
9515
 
9503
9516
  // src/commands/chiron-case.ts
9504
9517
  init_exit();
@@ -9506,10 +9519,10 @@ import { execFile } from "child_process";
9506
9519
  import { promisify } from "util";
9507
9520
  import { cpSync, existsSync, mkdirSync, mkdtempSync, readFileSync as readFileSync5, rmSync, statSync as statSync3, writeFileSync as writeFileSync2 } from "fs";
9508
9521
  import os2 from "os";
9509
- import path7 from "path";
9522
+ import path8 from "path";
9510
9523
  import { CASES_REPO_SLUG, CASES_REPO_URL, CNB_ORIGIN, CliError as CliError26, CliErrorCode as CliErrorCode26, formatObject as formatObject19 } from "@hcmai/sdk";
9511
- var casesCacheDir = () => process.env.HCM_CASES_CACHE?.trim() || path7.join(os2.homedir(), ".cache", "hcm", "chiron-cases");
9512
- var INDEX_CACHE = () => path7.join(casesCacheDir(), "index.json");
9524
+ var casesCacheDir = () => process.env.HCM_CASES_CACHE?.trim() || path8.join(os2.homedir(), ".cache", "hcm", "chiron-cases");
9525
+ var INDEX_CACHE = () => path8.join(casesCacheDir(), "index.json");
9513
9526
  var INDEX_TTL_MS = 60 * 60 * 1e3;
9514
9527
  var fail5 = (message, nextStep, context = {}) => new CliError26({ code: CliErrorCode26.INVALID_ARGUMENT, message, context: { nextStep, ...context } });
9515
9528
  var execFileAsync = promisify(execFile);
@@ -9521,7 +9534,7 @@ function stderrCause(stderr) {
9521
9534
  }
9522
9535
  var runCaseProcess = async (cmd, args, opts = {}) => {
9523
9536
  const { timeoutMs, label: given, ...rest } = opts;
9524
- const label = given ?? [path7.basename(cmd), args[0] && !args[0].startsWith("-") ? path7.basename(args[0]) : args[0] ?? ""].join(" ").trim();
9537
+ const label = given ?? [path8.basename(cmd), args[0] && !args[0].startsWith("-") ? path8.basename(args[0]) : args[0] ?? ""].join(" ").trim();
9525
9538
  try {
9526
9539
  const pending = execFileAsync(cmd, args, { encoding: "utf8", maxBuffer: 1 << 26, timeout: timeoutMs ?? 0, ...rest });
9527
9540
  pending.child.stdin?.end();
@@ -9547,8 +9560,8 @@ var CNB_NOT_FOUND = "\u627E\u4E0D\u5230 cnb \u53EF\u6267\u884C\u6587\u4EF6\uFF08
9547
9560
  var CNB_NOT_FOUND_NEXT = "\u88C5 cnb\uFF1A`npm i -g @cnbcool/cnb-cli`\uFF0C\u518D `cnb login`\uFF1B\u88C5\u8FC7\u5C31\u68C0\u67E5 PATH\uFF08Windows \u4E0A `where cnb` \u5E94\u5217\u51FA cnb.exe \u6216\u5305\u7BA1\u7406\u5668\u751F\u6210\u7684 cnb.cmd\uFF0C\u7528 Volta \u7684\u8981\u6709 volta.exe\uFF1B\u81EA\u5DF1\u5199\u7684 .bat / .cmd \u5305\u88C5\u8BA4\u4E0D\u51FA\uFF09\uFF0C\u88C5\u574F\u4E86\u5C31\u91CD\u88C5\u3002\u53D6\u4E0D\u5230\u6848\u4F8B\u5E93\u4E0D\u62E6\u8DEF\uFF1A\u5148\u8DF3\u8FC7\u5B83\u6309\u6280\u80FD\u505A\uFF0C\u522B\u628A\u300C\u53D6\u4E0D\u5230\u300D\u5F53\u6210\u300C\u6CA1\u6709\u5148\u4F8B\u300D\u3002";
9548
9561
  var CNB_NETWORK_CAUSE = /ECONN\w*|ENOTFOUND|EAI_AGAIN|ETIMEDOUT|fetch failed|socket|TLS/i;
9549
9562
  var CNB_LOGIN_CAUSE = /未登录|登录凭证|登录失效|cnb login|unauthori[sz]ed/i;
9550
- var windowsPathDirs = (pathVar, p = path7) => pathVar.split(";").map((d) => d.trim().replace(/^"(.*)"$/, "$1")).filter((d) => p.isAbsolute(d));
9551
- function shimTarget(dir, text2, p = path7) {
9563
+ var windowsPathDirs = (pathVar, p = path8) => pathVar.split(";").map((d) => d.trim().replace(/^"(.*)"$/, "$1")).filter((d) => p.isAbsolute(d));
9564
+ function shimTarget(dir, text2, p = path8) {
9552
9565
  const rel = /"%~?dp0%?[\\/]([^"%]+\.[cm]?js)"/i.exec(text2)?.[1];
9553
9566
  return rel ? p.join(dir, ...rel.split(/[\\/]/)) : /"([A-Za-z]:[\\/][^"%]+\.[cm]?js)"/.exec(text2)?.[1];
9554
9567
  }
@@ -9566,9 +9579,9 @@ function resolveCnb() {
9566
9579
  return r;
9567
9580
  };
9568
9581
  for (const dir of dirs) {
9569
- const exe = path7.join(dir, "cnb.exe");
9582
+ const exe = path8.join(dir, "cnb.exe");
9570
9583
  if (existsSync(exe)) return use({ cmd: exe, prefix: [] });
9571
- for (const shim of ["cnb.cmd", "cnb.bat"].map((f) => path7.join(dir, f)).filter((f) => existsSync(f))) {
9584
+ for (const shim of ["cnb.cmd", "cnb.bat"].map((f) => path8.join(dir, f)).filter((f) => existsSync(f))) {
9572
9585
  let text2;
9573
9586
  try {
9574
9587
  text2 = readFileSync5(shim, "utf8");
@@ -9577,7 +9590,7 @@ function resolveCnb() {
9577
9590
  continue;
9578
9591
  }
9579
9592
  if (/^\s*volta run %~n0 %\*\s*$/im.test(text2)) {
9580
- const volta = dirs.map((d) => path7.join(d, "volta.exe")).find((f) => existsSync(f));
9593
+ const volta = dirs.map((d) => path8.join(d, "volta.exe")).find((f) => existsSync(f));
9581
9594
  if (volta) return use({ cmd: volta, prefix: ["run", "cnb"] });
9582
9595
  blocked ??= `\u627E\u5230\u4E86 Volta \u7684 ${shim}\uFF0C\u4F46 PATH \u91CC\u6CA1\u6709 volta.exe`;
9583
9596
  continue;
@@ -9675,7 +9688,7 @@ async function loadIndex(opts = {}) {
9675
9688
  const cases2 = JSON.parse(text2).cases;
9676
9689
  const fetchedAt = (/* @__PURE__ */ new Date()).toISOString();
9677
9690
  if (opts.writeCache !== false) {
9678
- mkdirSync(path7.dirname(file), { recursive: true });
9691
+ mkdirSync(path8.dirname(file), { recursive: true });
9679
9692
  writeFileSync2(file, text2);
9680
9693
  }
9681
9694
  return { cases: cases2, source: "live", fetchedAt };
@@ -9855,16 +9868,16 @@ async function caseMatchCommand(args) {
9855
9868
  }
9856
9869
  async function caseSubmitCommand(dir, args) {
9857
9870
  await guard(async () => {
9858
- const src = path7.resolve(dir);
9859
- if (!existsSync(path7.join(src, "case.yml"))) {
9871
+ const src = path8.resolve(dir);
9872
+ if (!existsSync(path8.join(src, "case.yml"))) {
9860
9873
  throw fail5(`${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");
9861
9874
  }
9862
- const yamlText = readFileSync5(path7.join(src, "case.yml"), "utf8");
9875
+ const yamlText = readFileSync5(path8.join(src, "case.yml"), "utf8");
9863
9876
  const id = /^\s*(?:id|case_id):\s*(\S+)/m.exec(yamlText)?.[1];
9864
9877
  if (!id) throw fail5("case.yml \u91CC\u6CA1\u6709 id", "case.yml \u9876\u5C42\u8981\u6709 `id: CASE-YYYYMMDD-xxx`\u3002");
9865
- const work = mkdtempSync(path7.join(os2.tmpdir(), "hcm-case-submit-"));
9878
+ const work = mkdtempSync(path8.join(os2.tmpdir(), "hcm-case-submit-"));
9866
9879
  try {
9867
- const repo = path7.join(work, "chiron-cases");
9880
+ const repo = path8.join(work, "chiron-cases");
9868
9881
  try {
9869
9882
  await run("git", ["clone", "--depth", "1", "--filter=blob:none", "--quiet", CASES_REPO_URL, repo]);
9870
9883
  } catch (e) {
@@ -9875,10 +9888,10 @@ async function caseSubmitCommand(dir, args) {
9875
9888
  }
9876
9889
  const branch = `case/${id}-submit`;
9877
9890
  await run("git", ["-C", repo, "checkout", "-q", "-B", branch]);
9878
- const dst = path7.join(repo, "cases", args.category, id);
9891
+ const dst = path8.join(repo, "cases", args.category, id);
9879
9892
  cpSync(src, dst, { recursive: true, filter: (p) => !p.includes("node_modules") });
9880
- mkdirSync(path7.join(dst, "evidence"), { recursive: true });
9881
- let doc = readFileSync5(path7.join(dst, "case.yml"), "utf8");
9893
+ mkdirSync(path8.join(dst, "evidence"), { recursive: true });
9894
+ let doc = readFileSync5(path8.join(dst, "case.yml"), "utf8");
9882
9895
  doc = /^\s*tier:/m.test(doc) ? doc.replace(/^\s*tier:.*$/m, "tier: public") : `tier: public
9883
9896
  ${doc}`;
9884
9897
  doc = /^\s*category:/m.test(doc) ? doc.replace(/^\s*category:.*$/m, `category: ${args.category}`) : `category: ${args.category}
@@ -9887,7 +9900,7 @@ ${doc}`;
9887
9900
  ${doc}`;
9888
9901
  if (!/^\s*status:/m.test(doc)) doc = `status: approved
9889
9902
  ${doc}`;
9890
- writeFileSync2(path7.join(dst, "case.yml"), doc);
9903
+ writeFileSync2(path8.join(dst, "case.yml"), doc);
9891
9904
  await run("python3", ["scripts/render-readme.py", dst], { cwd: repo });
9892
9905
  let lint;
9893
9906
  try {
@@ -9943,10 +9956,10 @@ var SKILLS_DIR = "hcm-skills";
9943
9956
  var SKILLS_SYNC_SUBDIR = "sync";
9944
9957
  var SKILLS_LOCAL_SUBDIR = "local";
9945
9958
  function skillsSyncDir(root) {
9946
- return path8.join(root, SKILLS_DIR, SKILLS_SYNC_SUBDIR);
9959
+ return path9.join(root, SKILLS_DIR, SKILLS_SYNC_SUBDIR);
9947
9960
  }
9948
9961
  function skillsLocalDir(root) {
9949
- return path8.join(root, SKILLS_DIR, SKILLS_LOCAL_SUBDIR);
9962
+ return path9.join(root, SKILLS_DIR, SKILLS_LOCAL_SUBDIR);
9950
9963
  }
9951
9964
  var CHIRON_PROJECT_DIRECTORIES = [
9952
9965
  "work",
@@ -10042,13 +10055,13 @@ async function inspectJira(opts = {}) {
10042
10055
 
10043
10056
  // src/commands/skills-bundled.ts
10044
10057
  import { existsSync as existsSync3, statSync as statSync5, promises as fsp } from "fs";
10045
- import * as path10 from "path";
10058
+ import * as path11 from "path";
10046
10059
  import { CliError as CliError27, CliErrorCode as CliErrorCode27, assertSafeReferencePath, parseSkillRequirements } from "@hcmai/sdk";
10047
10060
 
10048
10061
  // src/commands/skills-manifest.ts
10049
10062
  import { readFileSync as readFileSync6, readdirSync as readdirSync2, statSync as statSync4, existsSync as existsSync2 } from "fs";
10050
10063
  import { createHash as createHash3 } from "crypto";
10051
- import * as path9 from "path";
10064
+ import * as path10 from "path";
10052
10065
  import { fileURLToPath } from "url";
10053
10066
  import { formatObject as formatObject20, parseSkillFrontmatter } from "@hcmai/sdk";
10054
10067
  function collectCommandSurface(root) {
@@ -10067,8 +10080,8 @@ function collectCommandSurface(root) {
10067
10080
  return out.sort((a, b) => a.path.localeCompare(b.path));
10068
10081
  }
10069
10082
  function bundledSkillsDir() {
10070
- const here = path9.dirname(fileURLToPath(import.meta.url));
10071
- return path9.join(here, "skills");
10083
+ const here = path10.dirname(fileURLToPath(import.meta.url));
10084
+ return path10.join(here, "skills");
10072
10085
  }
10073
10086
  function sha256(buf) {
10074
10087
  return createHash3("sha256").update(buf).digest("hex");
@@ -10076,7 +10089,7 @@ function sha256(buf) {
10076
10089
  function listFiles(dir, rel = "") {
10077
10090
  const out = [];
10078
10091
  for (const name of readdirSync2(dir)) {
10079
- const p = path9.join(dir, name);
10092
+ const p = path10.join(dir, name);
10080
10093
  const r = rel ? `${rel}/${name}` : name;
10081
10094
  if (statSync4(p).isDirectory()) out.push(...listFiles(p, r));
10082
10095
  else out.push(r);
@@ -10087,17 +10100,17 @@ function collectBundledSkills(dir = bundledSkillsDir()) {
10087
10100
  if (!existsSync2(dir)) return [];
10088
10101
  const out = [];
10089
10102
  for (const id of readdirSync2(dir).sort()) {
10090
- const skillDir = path9.join(dir, id);
10103
+ const skillDir = path10.join(dir, id);
10091
10104
  if (!statSync4(skillDir).isDirectory()) continue;
10092
10105
  const files = listFiles(skillDir).sort();
10093
10106
  if (!files.includes("SKILL.md")) continue;
10094
10107
  let bytes = 0;
10095
10108
  const fileRows = files.map((rel) => {
10096
- const buf = readFileSync6(path9.join(skillDir, rel));
10109
+ const buf = readFileSync6(path10.join(skillDir, rel));
10097
10110
  bytes += buf.byteLength;
10098
10111
  return { path: rel, bytes: buf.byteLength, sha256: sha256(buf) };
10099
10112
  });
10100
- const body = readFileSync6(path9.join(skillDir, "SKILL.md"), "utf8");
10113
+ const body = readFileSync6(path10.join(skillDir, "SKILL.md"), "utf8");
10101
10114
  const fm = parseSkillFrontmatter(body, id);
10102
10115
  out.push({
10103
10116
  id,
@@ -10159,7 +10172,7 @@ function unreachable(id, detail) {
10159
10172
  });
10160
10173
  }
10161
10174
  async function readBundledReferences(skillDir) {
10162
- const root = path10.join(skillDir, "references");
10175
+ const root = path11.join(skillDir, "references");
10163
10176
  const out = [];
10164
10177
  const walk = async (dir, prefix) => {
10165
10178
  let items;
@@ -10172,22 +10185,22 @@ async function readBundledReferences(skillDir) {
10172
10185
  for (const item of items.sort((a, b) => a.name.localeCompare(b.name))) {
10173
10186
  const relative3 = prefix ? `${prefix}/${item.name}` : item.name;
10174
10187
  if (item.isDirectory()) {
10175
- await walk(path10.join(dir, item.name), relative3);
10188
+ await walk(path11.join(dir, item.name), relative3);
10176
10189
  continue;
10177
10190
  }
10178
10191
  if (!item.isFile()) continue;
10179
10192
  assertSafeReferencePath(relative3);
10180
- out.push({ path: relative3, content: await fsp.readFile(path10.join(dir, item.name), "utf8") });
10193
+ out.push({ path: relative3, content: await fsp.readFile(path11.join(dir, item.name), "utf8") });
10181
10194
  }
10182
10195
  };
10183
10196
  await walk(root, "");
10184
10197
  return out;
10185
10198
  }
10186
10199
  async function readBundledSkillDocument(id, dir = bundledSkillsDir()) {
10187
- const skillDir = path10.join(dir, id);
10200
+ const skillDir = path11.join(dir, id);
10188
10201
  let markdown;
10189
10202
  try {
10190
- markdown = await fsp.readFile(path10.join(skillDir, "SKILL.md"), "utf8");
10203
+ markdown = await fsp.readFile(path11.join(skillDir, "SKILL.md"), "utf8");
10191
10204
  } catch (cause) {
10192
10205
  if (cause?.code === "ENOENT") throw unreachable(id, "SKILL.md \u4E0D\u5B58\u5728");
10193
10206
  throw cause;
@@ -10339,9 +10352,9 @@ async function exists(target) {
10339
10352
  }
10340
10353
  }
10341
10354
  async function detectTarget(cwd) {
10342
- if (await exists(path11.join(cwd, ".claude"))) return "claude";
10343
- if (await exists(path11.join(cwd, "AGENTS.md"))) return "codex";
10344
- if (await exists(path11.join(cwd, ".codex"))) return "codex";
10355
+ if (await exists(path12.join(cwd, ".claude"))) return "claude";
10356
+ if (await exists(path12.join(cwd, "AGENTS.md"))) return "codex";
10357
+ if (await exists(path12.join(cwd, ".codex"))) return "codex";
10345
10358
  return void 0;
10346
10359
  }
10347
10360
  var DIR_ROOT_WRITE_TARGETS = ["AGENTS.md", "CLAUDE.md", SKILLS_STATE_FILE];
@@ -10354,15 +10367,15 @@ async function assertDirWriteTargetsConfined(dir) {
10354
10367
  throw cause;
10355
10368
  }
10356
10369
  for (const name of DIR_ROOT_WRITE_TARGETS) {
10357
- const file = path11.join(root, name);
10370
+ const file = path12.join(root, name);
10358
10371
  const stat = await fsp2.lstat(file).catch((cause) => {
10359
10372
  if (cause.code === "ENOENT") return null;
10360
10373
  throw cause;
10361
10374
  });
10362
10375
  if (!stat?.isSymbolicLink()) continue;
10363
10376
  const destination = await fsp2.realpath(file).catch(() => null);
10364
- const relative3 = destination === null ? null : path11.relative(root, destination);
10365
- if (relative3 === null || relative3 === ".." || relative3.startsWith(`..${path11.sep}`) || path11.isAbsolute(relative3)) {
10377
+ const relative3 = destination === null ? null : path12.relative(root, destination);
10378
+ if (relative3 === null || relative3 === ".." || relative3.startsWith(`..${path12.sep}`) || path12.isAbsolute(relative3)) {
10366
10379
  throw new CliError28({
10367
10380
  code: CliErrorCode28.INVALID_ARGUMENT,
10368
10381
  message: `--dir \u4E0B\u7684 ${name} \u662F\u7B26\u53F7\u94FE\u63A5\uFF0C\u6307\u5411${destination === null ? "\u4E00\u4E2A\u4E0D\u5B58\u5728\u7684\u76EE\u6807" : `\u76EE\u5F55\u5916\u7684 ${destination}`}\uFF1B\u672C\u547D\u4EE4\u4F1A\u6539\u5199\u5B83\uFF0C\u62D2\u7EDD\u7ECF\u94FE\u63A5\u5199\u5230 --dir \u4E4B\u5916\u3002\u672C\u6B21\u6CA1\u6709\u5199\u76D8\u3002`,
@@ -10374,22 +10387,22 @@ async function assertDirWriteTargetsConfined(dir) {
10374
10387
  async function resolveInstallLayout(args, cwd = process.cwd(), forWrite = false) {
10375
10388
  const requested = parseSkillTarget(args.target);
10376
10389
  const target = requested ?? await detectTarget(cwd) ?? "claude";
10377
- const explicitDir = args.dir ? path11.resolve(args.dir) : void 0;
10390
+ const explicitDir = args.dir ? path12.resolve(args.dir) : void 0;
10378
10391
  if (explicitDir && forWrite) await assertDirWriteTargetsConfined(explicitDir);
10379
10392
  if (target === "codex") {
10380
- const root = explicitDir ?? (args.global ? path11.join(os3.homedir(), ".codex") : cwd);
10381
- const claudeFile = path11.join(root, "CLAUDE.md");
10393
+ const root = explicitDir ?? (args.global ? path12.join(os3.homedir(), ".codex") : cwd);
10394
+ const claudeFile = path12.join(root, "CLAUDE.md");
10382
10395
  return {
10383
10396
  target,
10384
10397
  baseDir: explicitDir ?? skillsSyncDir(root),
10385
10398
  localDir: explicitDir ? void 0 : skillsLocalDir(root),
10386
- agentsFile: path11.join(root, "AGENTS.md"),
10399
+ agentsFile: path12.join(root, "AGENTS.md"),
10387
10400
  companionAgentFiles: (explicitDir || !args.global) && await exists(claudeFile) ? [claudeFile] : []
10388
10401
  };
10389
10402
  }
10390
10403
  return {
10391
10404
  target,
10392
- baseDir: explicitDir ?? (args.global ? path11.join(os3.homedir(), ".claude", "skills") : path11.join(cwd, ".claude", "skills"))
10405
+ baseDir: explicitDir ?? (args.global ? path12.join(os3.homedir(), ".claude", "skills") : path12.join(cwd, ".claude", "skills"))
10393
10406
  };
10394
10407
  }
10395
10408
  async function chironClient(args, options = {}) {
@@ -10428,7 +10441,16 @@ async function beforeAnyWrite(step2) {
10428
10441
  function fail6(e, args) {
10429
10442
  const err = e;
10430
10443
  if (err?.response?.status === 404) {
10431
- exitWithError(new Error("\u8BE5\u73AF\u5883\u6CA1\u6709\u8FD9\u4E2A\u6280\u80FD \u2014\u2014 \u8DD1 `hcm skills list` \u770B\u76EE\u5F55\uFF08\u6280\u80FD\u968F\u4EA7\u54C1\u7248\u672C\u8D70\uFF09"));
10444
+ let requestPath;
10445
+ try {
10446
+ if (err.config?.url) requestPath = new URL(axios4.getUri(err.config), "https://request-path.invalid").pathname;
10447
+ } catch {
10448
+ }
10449
+ const traceId = fromAxiosError23(err, args.env).traceId;
10450
+ exitWithError(new Error(
10451
+ `\u6280\u80FD\u8D44\u6E90\u8BF7\u6C42\u8FD4\u56DE HTTP 404${requestPath ? `\uFF1A${requestPath}` : "\uFF08\u8BF7\u6C42\u8DEF\u5F84\u672A\u77E5\uFF09"}${traceId ? ` [traceId: ${traceId}]` : ""}\u3002
10452
+ \u4E0B\u4E00\u6B65: \u8FD0\u884C hcm skills list \u6838\u5BF9\u5F53\u524D\u76EE\u5F55\uFF1B\u82E5\u76EE\u5F55\u4ECD\u58F0\u660E\u8BE5\u8D44\u6E90\uFF0C\u8BF7\u68C0\u67E5\u670D\u52A1\u7AEF\u8D44\u6E90\u548C\u5B9E\u4F8B\u7248\u672C\uFF0C\u518D\u91CD\u8BD5\u3002`
10453
+ ));
10432
10454
  }
10433
10455
  if (err?.isAxiosError) exitWithError(fromAxiosError23(err, args.env));
10434
10456
  exitWithError(e);
@@ -10588,7 +10610,7 @@ async function listInstalledSkills(keyword, args, cwd = process.cwd()) {
10588
10610
  process.exitCode = 0;
10589
10611
  return;
10590
10612
  }
10591
- process.stdout.write(`${path11.join(layout.baseDir, SKILLS_STATE_FILE)} \u4E0D\u5B58\u5728\u6216\u4E3A\u7A7A \u2014\u2014 \u8FD9\u4E2A\u76EE\u5F55\u4E0B\u8FD8\u6CA1\u7528\u672C CLI \u88C5\u8FC7\u6280\u80FD\u3002
10613
+ process.stdout.write(`${path12.join(layout.baseDir, SKILLS_STATE_FILE)} \u4E0D\u5B58\u5728\u6216\u4E3A\u7A7A \u2014\u2014 \u8FD9\u4E2A\u76EE\u5F55\u4E0B\u8FD8\u6CA1\u7528\u672C CLI \u88C5\u8FC7\u6280\u80FD\u3002
10592
10614
  `);
10593
10615
  process.stdout.write(" \u5168\u90E8\u88C5\u9F50\uFF1Ahcm chiron skills sync\n");
10594
10616
  process.exitCode = 0;
@@ -10619,7 +10641,7 @@ async function listInstalledSkills(keyword, args, cwd = process.cwd()) {
10619
10641
  id: x.id,
10620
10642
  title: x.title,
10621
10643
  sourceKind: "local",
10622
- sourceLocator: path11.relative(path11.dirname(layout.baseDir), x.absolute).split(path11.sep).join("/"),
10644
+ sourceLocator: path12.relative(path12.dirname(layout.baseDir), x.absolute).split(path12.sep).join("/"),
10623
10645
  direct: true,
10624
10646
  installedAt: void 0,
10625
10647
  status: "installed"
@@ -10777,7 +10799,7 @@ async function skillsInstallCommand(id, args) {
10777
10799
  let manifest2;
10778
10800
  let conflictNote;
10779
10801
  if (args.from) {
10780
- const root = path11.resolve(args.from);
10802
+ const root = path12.resolve(args.from);
10781
10803
  requestedIds = all ? await listLocalSkillIds(root) : [id];
10782
10804
  const seen = /* @__PURE__ */ new Set();
10783
10805
  documents = [];
@@ -10927,7 +10949,7 @@ async function skillsInstallCommand(id, args) {
10927
10949
  agentIndexes: agentIndexes2
10928
10950
  }, { format: fmtCheck }) + "\n");
10929
10951
  } else {
10930
- process.stdout.write(installDir === layout.baseDir ? `\u8FD9\u4E2A\u76EE\u5F55\u8FD8\u6CA1\u88C5\u8FC7\u6280\u80FD\uFF08${path11.join(layout.baseDir, SKILLS_STATE_FILE)} \u4E0D\u5B58\u5728\uFF09\u3002
10952
+ process.stdout.write(installDir === layout.baseDir ? `\u8FD9\u4E2A\u76EE\u5F55\u8FD8\u6CA1\u88C5\u8FC7\u6280\u80FD\uFF08${path12.join(layout.baseDir, SKILLS_STATE_FILE)} \u4E0D\u5B58\u5728\uFF09\u3002
10931
10953
  ` : `--from \u53D6\u6765\u7684\u6280\u80FD\u843D ${SKILLS_LOCAL_SUBDIR}/\uFF08\u4F60\u81EA\u5DF1\u7684\u90A3\u4E00\u534A\uFF0C\u4E0D\u8FDB\u9501\u6587\u4EF6\uFF09\u3002
10932
10954
  `);
10933
10955
  process.stdout.write(`--check\uFF1A\u4F1A\u88C5 ${would.length} \u4E2A\u6280\u80FD\u5230 ${installDir}\uFF0C${agentIndexes2.length > 0 ? `\u5E76\u628A\u7D22\u5F15\u4E0E\u9879\u76EE\u8FB9\u754C\u5757\u5199\u8FDB ${agentIndexes2.map((index) => index.file).join("\u3001")}` : "Claude Code \u81EA\u52A8\u53D1\u73B0\u6280\u80FD\uFF0C\u65E0\u7D22\u5F15\u6587\u4EF6"}\u3002**\u672C\u6B21\u4E00\u4E2A\u5B57\u8282\u90FD\u6CA1\u5199\u3002**
@@ -10955,7 +10977,7 @@ async function skillsInstallCommand(id, args) {
10955
10977
  if (fmt === "json" || fmt === "yaml") {
10956
10978
  process.stdout.write(formatObject21({ ...result, all, target_agent: layout.target, agentsFile: layout.agentsFile, agents, agentIndexes, conflictCheck: conflictNote ? { checked: false, note: conflictNote } : { checked: true } }, { format: fmt }) + "\n");
10957
10979
  } else {
10958
- const headline = all ? `\u2705 \u5168\u90E8 ${requestedIds.length} \u4E2A\u6280\u80FD \u2192 ${result.baseDir}` : `\u2705 ${id} \u2192 ${path11.join(result.baseDir, id, "SKILL.md")}`;
10980
+ const headline = all ? `\u2705 \u5168\u90E8 ${requestedIds.length} \u4E2A\u6280\u80FD \u2192 ${result.baseDir}` : `\u2705 ${id} \u2192 ${path12.join(result.baseDir, id, "SKILL.md")}`;
10959
10981
  process.stdout.write(`${headline}
10960
10982
  `);
10961
10983
  if (result.installed.length > 0) {
@@ -10974,17 +10996,17 @@ async function skillsInstallCommand(id, args) {
10974
10996
  `);
10975
10997
  }
10976
10998
  for (const index of agentIndexes) {
10977
- const reader = path11.basename(index.file) === "CLAUDE.md" ? "Claude Code" : "Codex";
10999
+ const reader = path12.basename(index.file) === "CLAUDE.md" ? "Claude Code" : "Codex";
10978
11000
  process.stdout.write(` \u5DF2${index.status === "created" ? "\u521B\u5EFA" : "\u66F4\u65B0"} ${index.file} \u91CC\u7684\u6280\u80FD\u7D22\u5F15\u4E0E\u9879\u76EE\u8FB9\u754C\u5757\uFF08${reader} \u8BFB\u8FD9\u91CC\uFF09
10979
11001
  `);
10980
11002
  }
10981
11003
  const fallback = agentIndexes.find((i) => i.boundary === "cli-fallback");
10982
11004
  if (fallback) {
10983
- const by = args.from ? `--from ${path11.resolve(args.from)}` : `--source ${args.source ?? "all"}`;
11005
+ const by = args.from ? `--from ${path12.resolve(args.from)}` : `--source ${args.source ?? "all"}`;
10984
11006
  process.stdout.write(` ${boundaryFallbackLine(fallback.boundaryFallbackReason, by)}
10985
11007
  `);
10986
11008
  }
10987
- process.stdout.write(` \u6765\u6E90 ${endpoint ?? (args.from ? path11.resolve(args.from) : `@hcmai/cli@${CLI_VERSION}`)}
11009
+ process.stdout.write(` \u6765\u6E90 ${endpoint ?? (args.from ? path12.resolve(args.from) : `@hcmai/cli@${CLI_VERSION}`)}
10988
11010
  `);
10989
11011
  if (conflictNote) process.stdout.write(` \u26A0\uFE0F ${conflictNote}
10990
11012
  `);
@@ -11021,7 +11043,7 @@ async function listLocalSkillIds(root) {
11021
11043
  const ids = [];
11022
11044
  for (const entry of entries) {
11023
11045
  if (!entry.isDirectory()) continue;
11024
- if (await exists(path11.join(root, entry.name, "SKILL.md"))) ids.push(entry.name);
11046
+ if (await exists(path12.join(root, entry.name, "SKILL.md"))) ids.push(entry.name);
11025
11047
  }
11026
11048
  if (ids.length === 0) throw invalid(`\u672C\u5730\u76EE\u5F55\u91CC\u6CA1\u6709\u4EFB\u4F55 <id>/SKILL.md\uFF1A${root}`);
11027
11049
  return ids.sort();
@@ -11042,7 +11064,7 @@ async function fetchSkillDocument(http, skill, endpoint, base) {
11042
11064
  }
11043
11065
  async function ensureLocalSlot(localDir) {
11044
11066
  if (!localDir) return;
11045
- const keep = path11.join(localDir, ".gitkeep");
11067
+ const keep = path12.join(localDir, ".gitkeep");
11046
11068
  if (await fsp2.stat(localDir).then(() => true).catch(() => false)) return;
11047
11069
  await fsp2.mkdir(localDir, { recursive: true });
11048
11070
  await fsp2.writeFile(keep, "# \u4F60\u81EA\u5DF1\u5199\u7684\u6280\u80FD\u653E\u8FD9\u513F\u3002hcm chiron skills sync \u53EA\u7BA1\u9694\u58C1 sync/\uFF0C\u4E00\u4E2A\u5B57\u8282\u90FD\u4E0D\u78B0\u8FD9\u91CC\u3002\n", "utf8");
@@ -11051,7 +11073,7 @@ var isNotFound = (e) => ["ENOENT", "ENOTDIR"].includes(String(e?.code));
11051
11073
  var SkillsDirUnreadable = class extends Error {
11052
11074
  /** `claude`:`.claude/skills/` 那一半(产品版,双布局下与 local/ 对照遮蔽时才读,#399)。 */
11053
11075
  constructor(side, dir, id, cause) {
11054
- const where = id ? path11.join(dir, id, "SKILL.md") : dir, detail = cause instanceof Error ? cause.message : String(cause);
11076
+ const where = id ? path12.join(dir, id, "SKILL.md") : dir, detail = cause instanceof Error ? cause.message : String(cause);
11055
11077
  super(`${where}\uFF1A${detail}`);
11056
11078
  this.side = side;
11057
11079
  this.id = id;
@@ -11080,7 +11102,7 @@ function unreadableFix(code2, detail) {
11080
11102
  if (code2 === "EACCES" || code2 === "EPERM") return "\u6CA1\u6709\u8BFB\u53D6\u6743\u9650\uFF0C\u4FEE\u597D\u6743\u9650";
11081
11103
  return `\u8BFB\u53D6\u62A5 ${code2 ?? (detail || "\u672A\u77E5\u9519\u8BEF")}\uFF0C\u6309\u8FD9\u4E2A\u62A5\u9519\u4FEE\u597D`;
11082
11104
  }
11083
- var describeUnreadable = (list) => list.map((u) => `${u.id ?? path11.basename(u.where)}\uFF08${unreadableFix(u.code, u.detail)}\uFF09`).join("\u3001");
11105
+ var describeUnreadable = (list) => list.map((u) => `${u.id ?? path12.basename(u.where)}\uFF08${unreadableFix(u.code, u.detail)}\uFF09`).join("\u3001");
11084
11106
  async function readLocalSkills(localDir, { strict = false } = {}) {
11085
11107
  if (!localDir) return [];
11086
11108
  let names;
@@ -11092,7 +11114,7 @@ async function readLocalSkills(localDir, { strict = false } = {}) {
11092
11114
  }
11093
11115
  const out = [];
11094
11116
  for (const id of names.sort()) {
11095
- const absolute = path11.join(localDir, id, "SKILL.md");
11117
+ const absolute = path12.join(localDir, id, "SKILL.md");
11096
11118
  let markdown;
11097
11119
  try {
11098
11120
  markdown = await fsp2.readFile(absolute, "utf8");
@@ -11125,7 +11147,7 @@ async function listShadowedSkills(layout, productSide = "sync", tracked) {
11125
11147
  const isProduct = async (id) => {
11126
11148
  if (tracked && !tracked.has(id)) return false;
11127
11149
  try {
11128
- await fsp2.stat(path11.join(layout.baseDir, id, "SKILL.md"));
11150
+ await fsp2.stat(path12.join(layout.baseDir, id, "SKILL.md"));
11129
11151
  return true;
11130
11152
  } catch (e) {
11131
11153
  if (!isNotFound(e)) throw new SkillsDirUnreadable(productSide, layout.baseDir, id, e);
@@ -11150,7 +11172,7 @@ async function listShadowedSkills(layout, productSide = "sync", tracked) {
11150
11172
  }
11151
11173
  const shadowed = [];
11152
11174
  for (const s of locals) {
11153
- if (await isProduct(s.id)) shadowed.push({ id: s.id, local: s.absolute, product: path11.join(layout.baseDir, s.id, "SKILL.md"), note: s.firstLine });
11175
+ if (await isProduct(s.id)) shadowed.push({ id: s.id, local: s.absolute, product: path12.join(layout.baseDir, s.id, "SKILL.md"), note: s.firstLine });
11154
11176
  }
11155
11177
  return { local: locals.length, product, shadowed, unreadable };
11156
11178
  }
@@ -11179,7 +11201,7 @@ var CLAUDE_SKILLS_DIR_LABEL = ".claude/skills/";
11179
11201
  async function readClaudeLocalIndex(root) {
11180
11202
  let text2;
11181
11203
  try {
11182
- text2 = await fsp2.readFile(path11.join(root, "CLAUDE.md"), "utf8");
11204
+ text2 = await fsp2.readFile(path12.join(root, "CLAUDE.md"), "utf8");
11183
11205
  } catch (e) {
11184
11206
  if (isNotFound(e)) return { kind: "no-file" };
11185
11207
  return { kind: "unreadable", detail: e instanceof Error ? e.message : String(e) };
@@ -11258,7 +11280,7 @@ async function reportClaudeShadows(claudeDir, root) {
11258
11280
  async function resolveSkillPath(layout, id) {
11259
11281
  assertSafeSkillId(id);
11260
11282
  const at = async (dir) => {
11261
- const file = path11.join(dir, id, "SKILL.md");
11283
+ const file = path12.join(dir, id, "SKILL.md");
11262
11284
  return await fsp2.stat(file).then(() => file).catch(() => void 0);
11263
11285
  };
11264
11286
  const inSync = await at(layout.baseDir);
@@ -11268,12 +11290,12 @@ async function resolveSkillPath(layout, id) {
11268
11290
  id,
11269
11291
  file: inLocal,
11270
11292
  half: "local",
11271
- references: path11.join(layout.localDir, id, "references"),
11293
+ references: path12.join(layout.localDir, id, "references"),
11272
11294
  ...inSync ? { shadowed: inSync } : {}
11273
11295
  };
11274
11296
  }
11275
11297
  if (inSync) {
11276
- return { id, file: inSync, half: "sync", references: path11.join(layout.baseDir, id, "references") };
11298
+ return { id, file: inSync, half: "sync", references: path12.join(layout.baseDir, id, "references") };
11277
11299
  }
11278
11300
  const looked = [
11279
11301
  ...layout.localDir ? [`${layout.localDir}/${id}/SKILL.md`] : [],
@@ -11318,11 +11340,11 @@ async function findShadowBypassingRefs(layout, shadowedIds) {
11318
11340
  return [];
11319
11341
  }
11320
11342
  for (const from of ids.sort()) {
11321
- const files = [path11.join(layout.baseDir, from, "SKILL.md")];
11322
- const refDir = path11.join(layout.baseDir, from, "references");
11343
+ const files = [path12.join(layout.baseDir, from, "SKILL.md")];
11344
+ const refDir = path12.join(layout.baseDir, from, "references");
11323
11345
  try {
11324
11346
  for (const e of await fsp2.readdir(refDir, { withFileTypes: true })) {
11325
- if (e.isFile()) files.push(path11.join(refDir, e.name));
11347
+ if (e.isFile()) files.push(path12.join(refDir, e.name));
11326
11348
  }
11327
11349
  } catch {
11328
11350
  }
@@ -11351,11 +11373,11 @@ async function syncAgentIndexes(layout, manifest2) {
11351
11373
  const files = [layout.agentsFile, ...layout.companionAgentFiles ?? []];
11352
11374
  const results = [];
11353
11375
  for (const file of files) {
11354
- const agentsDir = path11.dirname(file);
11376
+ const agentsDir = path12.dirname(file);
11355
11377
  const managed = await Promise.all(Object.keys(state?.skills ?? {}).sort().map(async (id) => {
11356
11378
  const known = catalog.get(id);
11357
- const absolute = path11.join(layout.baseDir, id, "SKILL.md");
11358
- let relative3 = path11.relative(agentsDir, absolute);
11379
+ const absolute = path12.join(layout.baseDir, id, "SKILL.md");
11380
+ let relative3 = path12.relative(agentsDir, absolute);
11359
11381
  if (!relative3.startsWith(".")) relative3 = `./${relative3}`;
11360
11382
  let title = known?.title;
11361
11383
  let description = known?.description;
@@ -11378,19 +11400,19 @@ async function syncAgentIndexes(layout, manifest2) {
11378
11400
  id,
11379
11401
  title: title ?? id,
11380
11402
  description: description ?? "",
11381
- relativePath: relative3.split(path11.sep).join("/")
11403
+ relativePath: relative3.split(path12.sep).join("/")
11382
11404
  };
11383
11405
  }));
11384
11406
  const shadowed = new Set(local.map((x) => x.id));
11385
11407
  const localEntries = local.map((x) => {
11386
- let relative3 = path11.relative(agentsDir, x.absolute);
11408
+ let relative3 = path12.relative(agentsDir, x.absolute);
11387
11409
  if (!relative3.startsWith(".")) relative3 = `./${relative3}`;
11388
11410
  const covers = managed.some((m) => m.id === x.id) ? `\uFF08\u4F60\u6539\u8FC7\u7684\u7248\u672C\uFF0C\u4EA7\u54C1\u90A3\u4E00\u4EFD\u5728 ${SKILLS_DIR}/${SKILLS_SYNC_SUBDIR}/${x.id}/\uFF0C\u540C\u6B65\u53EA\u66F4\u65B0\u90A3\u4E00\u4EFD\uFF09` : "";
11389
11411
  return {
11390
11412
  id: x.id,
11391
11413
  title: x.title,
11392
11414
  description: x.description ? `${x.description}${covers}` : covers,
11393
- relativePath: relative3.split(path11.sep).join("/")
11415
+ relativePath: relative3.split(path12.sep).join("/")
11394
11416
  };
11395
11417
  });
11396
11418
  const entries = [...managed.filter((m) => !shadowed.has(m.id)), ...localEntries].sort((a, b) => a.id.localeCompare(b.id));
@@ -11421,7 +11443,7 @@ async function resolveLocalSkillDocuments(sourceRoot, targetId, options = {}) {
11421
11443
  throw invalid(`\u6280\u80FD\u4F9D\u8D56\u5B58\u5728\u73AF: ${[...pathStack.slice(Math.max(0, start)), id].join(" -> ")}`);
11422
11444
  }
11423
11445
  assertSafeSkillId(id);
11424
- const local = path11.join(sourceRoot, id, "SKILL.md");
11446
+ const local = path12.join(sourceRoot, id, "SKILL.md");
11425
11447
  let markdown;
11426
11448
  try {
11427
11449
  markdown = await fsp2.readFile(local, "utf8");
@@ -11431,7 +11453,7 @@ async function resolveLocalSkillDocuments(sourceRoot, targetId, options = {}) {
11431
11453
  options.onSatisfiedElsewhere?.(id, requiredBy);
11432
11454
  return;
11433
11455
  }
11434
- throw invalid(requiredBy ? `\u672C\u5730\u6280\u80FD ${requiredBy} \u4F9D\u8D56\u4E0D\u5B58\u5728: ${id}\uFF08${local}\uFF09\u2014\u2014\u628A ${id}/SKILL.md \u653E\u8FDB --from \u76EE\u5F55\u540E\u91CD\u8DD1\uFF0C\u6216\u5148\u4E0D\u5E26 --from \u8FDE\u7F51 sync \u88C5\u4E0A\u5B83` : `\u672C\u5730\u76EE\u5F55\u91CC\u6CA1\u6709 ${id}/SKILL.md\uFF1A${path11.join(sourceRoot, id)}`);
11456
+ throw invalid(requiredBy ? `\u672C\u5730\u6280\u80FD ${requiredBy} \u4F9D\u8D56\u4E0D\u5B58\u5728: ${id}\uFF08${local}\uFF09\u2014\u2014\u628A ${id}/SKILL.md \u653E\u8FDB --from \u76EE\u5F55\u540E\u91CD\u8DD1\uFF0C\u6216\u5148\u4E0D\u5E26 --from \u8FDE\u7F51 sync \u88C5\u4E0A\u5B83` : `\u672C\u5730\u76EE\u5F55\u91CC\u6CA1\u6709 ${id}/SKILL.md\uFF1A${path12.join(sourceRoot, id)}`);
11435
11457
  }
11436
11458
  throw cause;
11437
11459
  }
@@ -11443,7 +11465,7 @@ async function resolveLocalSkillDocuments(sourceRoot, targetId, options = {}) {
11443
11465
  markdown,
11444
11466
  source: local,
11445
11467
  sourceKind: "local",
11446
- references: await readLocalReferences(path11.join(sourceRoot, id))
11468
+ references: await readLocalReferences(path12.join(sourceRoot, id))
11447
11469
  };
11448
11470
  for (const required2 of parseSkillRequirements2(markdown, id)) {
11449
11471
  await visit(required2, id);
@@ -11457,7 +11479,7 @@ async function resolveLocalSkillDocuments(sourceRoot, targetId, options = {}) {
11457
11479
  }
11458
11480
  async function readSkillsState(baseDir, options = {}) {
11459
11481
  try {
11460
- const raw = await fsp2.readFile(path11.join(baseDir, SKILLS_STATE_FILE), "utf8");
11482
+ const raw = await fsp2.readFile(path12.join(baseDir, SKILLS_STATE_FILE), "utf8");
11461
11483
  const parsed = JSON.parse(raw);
11462
11484
  if (options.strict && (!parsed || typeof parsed !== "object" || !parsed.skills || typeof parsed.skills !== "object" || Array.isArray(parsed.skills)))
11463
11485
  throw new Error("skills \u5FC5\u987B\u662F\u5BF9\u8C61");
@@ -11470,7 +11492,7 @@ async function readSkillsState(baseDir, options = {}) {
11470
11492
  }
11471
11493
  async function writeSkillsState(baseDir, state) {
11472
11494
  await fsp2.mkdir(baseDir, { recursive: true });
11473
- const file = path11.join(baseDir, SKILLS_STATE_FILE);
11495
+ const file = path12.join(baseDir, SKILLS_STATE_FILE);
11474
11496
  const temp = `${file}.${process.pid}.tmp`;
11475
11497
  await fsp2.writeFile(temp, JSON.stringify(state, null, 2) + "\n", "utf8");
11476
11498
  await fsp2.rename(temp, file);
@@ -11503,7 +11525,7 @@ async function upsertAgentsBlock(agentsFile, block) {
11503
11525
  existing = await fsp2.readFile(agentsFile, "utf8");
11504
11526
  } catch (cause) {
11505
11527
  if (cause?.code !== "ENOENT") throw cause;
11506
- await fsp2.mkdir(path11.dirname(agentsFile), { recursive: true });
11528
+ await fsp2.mkdir(path12.dirname(agentsFile), { recursive: true });
11507
11529
  await fsp2.writeFile(agentsFile, block + "\n", "utf8");
11508
11530
  return "created";
11509
11531
  }
@@ -11529,7 +11551,7 @@ async function installSkillDocuments(documents, requestedIds, baseDir, force, me
11529
11551
  if (!document2.markdown.trim()) throw invalid(`\u6280\u80FD ${document2.id} \u5185\u5BB9\u4E3A\u7A7A`);
11530
11552
  return {
11531
11553
  ...document2,
11532
- target: path11.join(baseDir, document2.id, "SKILL.md"),
11554
+ target: path12.join(baseDir, document2.id, "SKILL.md"),
11533
11555
  bytes: Buffer.byteLength(document2.markdown)
11534
11556
  };
11535
11557
  });
@@ -11582,7 +11604,7 @@ async function sameOnDisk(baseDir, candidate) {
11582
11604
  return true;
11583
11605
  }
11584
11606
  async function readLocalReferences(skillDir) {
11585
- const root = path11.join(skillDir, "references");
11607
+ const root = path12.join(skillDir, "references");
11586
11608
  const out = [];
11587
11609
  const walk = async (dir, prefix) => {
11588
11610
  let items;
@@ -11595,12 +11617,12 @@ async function readLocalReferences(skillDir) {
11595
11617
  for (const item of items.sort((a, b) => a.name.localeCompare(b.name))) {
11596
11618
  const relative3 = prefix ? `${prefix}/${item.name}` : item.name;
11597
11619
  if (item.isDirectory()) {
11598
- await walk(path11.join(dir, item.name), relative3);
11620
+ await walk(path12.join(dir, item.name), relative3);
11599
11621
  continue;
11600
11622
  }
11601
11623
  if (!item.isFile()) continue;
11602
11624
  assertSafeReferencePath2(relative3);
11603
- out.push({ path: relative3, content: await fsp2.readFile(path11.join(dir, item.name), "utf8") });
11625
+ out.push({ path: relative3, content: await fsp2.readFile(path12.join(dir, item.name), "utf8") });
11604
11626
  }
11605
11627
  };
11606
11628
  await walk(root, "");
@@ -11632,10 +11654,10 @@ async function removeSkillDirs(baseDir, ids) {
11632
11654
  const state = await readSkillsState(baseDir);
11633
11655
  for (const id of ids) {
11634
11656
  assertSafeSkillId(id);
11635
- const dir = path11.join(baseDir, id);
11636
- const resolved = path11.resolve(dir);
11637
- if (resolved !== path11.join(path11.resolve(baseDir), id)) continue;
11638
- const hasSkillFile = await fsp2.stat(path11.join(dir, "SKILL.md")).then(() => true).catch(() => false);
11657
+ const dir = path12.join(baseDir, id);
11658
+ const resolved = path12.resolve(dir);
11659
+ if (resolved !== path12.join(path12.resolve(baseDir), id)) continue;
11660
+ const hasSkillFile = await fsp2.stat(path12.join(dir, "SKILL.md")).then(() => true).catch(() => false);
11639
11661
  const exists2 = await fsp2.stat(dir).then(() => true).catch(() => false);
11640
11662
  if (exists2 && !hasSkillFile) {
11641
11663
  kept.push({ id, kept: "\u76EE\u5F55\u91CC\u6CA1\u6709 SKILL.md\uFF0C\u50CF\u662F\u4F60\u81EA\u5DF1\u653E\u7684\u4E1C\u897F\uFF0C\u6CA1\u6709\u5220" });
@@ -11659,15 +11681,15 @@ async function writeSkillDocuments(documents, baseDir, removals = []) {
11659
11681
  const removed = [];
11660
11682
  try {
11661
11683
  for (const document2 of documents) {
11662
- const target = path11.join(baseDir, document2.id, "SKILL.md");
11663
- await fsp2.mkdir(path11.dirname(target), { recursive: true });
11664
- const temp = path11.join(path11.dirname(target), `.SKILL.md.${process.pid}.${Date.now()}.tmp`);
11684
+ const target = path12.join(baseDir, document2.id, "SKILL.md");
11685
+ await fsp2.mkdir(path12.dirname(target), { recursive: true });
11686
+ const temp = path12.join(path12.dirname(target), `.SKILL.md.${process.pid}.${Date.now()}.tmp`);
11665
11687
  await fsp2.writeFile(temp, document2.markdown, "utf8");
11666
11688
  staged.push({ temp, target });
11667
11689
  for (const reference of document2.references ?? []) {
11668
11690
  assertSafeReferencePath2(reference.path);
11669
- const referenceTarget = path11.join(baseDir, document2.id, "references", reference.path);
11670
- await fsp2.mkdir(path11.dirname(referenceTarget), { recursive: true });
11691
+ const referenceTarget = path12.join(baseDir, document2.id, "references", reference.path);
11692
+ await fsp2.mkdir(path12.dirname(referenceTarget), { recursive: true });
11671
11693
  const referenceTemp = `${referenceTarget}.${process.pid}.${Date.now()}.tmp`;
11672
11694
  await fsp2.writeFile(referenceTemp, reference.content, "utf8");
11673
11695
  staged.push({ temp: referenceTemp, target: referenceTarget });
@@ -11675,7 +11697,7 @@ async function writeSkillDocuments(documents, baseDir, removals = []) {
11675
11697
  }
11676
11698
  for (const stale of removals) {
11677
11699
  assertSafeReferencePath2(stale.path);
11678
- const original = path11.join(baseDir, stale.id, "references", stale.path);
11700
+ const original = path12.join(baseDir, stale.id, "references", stale.path);
11679
11701
  const parked = `${original}.${process.pid}.${Date.now()}.removed`;
11680
11702
  await fsp2.rename(original, parked);
11681
11703
  removed.push({ parked, original });
@@ -11785,7 +11807,7 @@ async function planOrphanPrune(options) {
11785
11807
  }
11786
11808
  async function readInstalled(baseDir, id) {
11787
11809
  try {
11788
- return await fsp2.readFile(path11.join(baseDir, id, "SKILL.md"), "utf8");
11810
+ return await fsp2.readFile(path12.join(baseDir, id, "SKILL.md"), "utf8");
11789
11811
  } catch (cause) {
11790
11812
  if (cause?.code === "ENOENT") return void 0;
11791
11813
  throw cause;
@@ -11793,7 +11815,7 @@ async function readInstalled(baseDir, id) {
11793
11815
  }
11794
11816
  async function readInstalledReference(baseDir, id, relative3) {
11795
11817
  try {
11796
- return await fsp2.readFile(path11.join(baseDir, id, "references", relative3), "utf8");
11818
+ return await fsp2.readFile(path12.join(baseDir, id, "references", relative3), "utf8");
11797
11819
  } catch (cause) {
11798
11820
  if (cause?.code === "ENOENT") return void 0;
11799
11821
  throw cause;
@@ -11811,7 +11833,7 @@ function installConflictAdvice(where) {
11811
11833
  if (where.half === "product") {
11812
11834
  const product = displayDir(where.productDir);
11813
11835
  const reach = where.target === "claude" ? CLAUDE_LOCAL_REACH : "\uFF08\u540C\u540D\u65F6\u5B83\u906E\u853D\u4EA7\u54C1\u90A3\u4EFD\uFF0C\u4EA7\u54C1\u90A3\u4EFD\u7EE7\u7EED\u8DDF\u7740\u66F4\u65B0\uFF09";
11814
- return `${product}/ \u5F52\u4EA7\u54C1\uFF1A\u8981\u7559\u4F4F\u76D8\u4E0A\u8FD9\u4EFD\u6539\u52A8\uFF0C\u628A\u5B83\u632A\u5230 ${displayDir(path11.join(where.localDir, id))}/${reach}\uFF0C\u632A\u597D\u540E\u91CD\u8DD1\uFF1B\u786E\u8BA4\u653E\u5F03\u8FD9\u4EFD\u6539\u52A8\u624D\u52A0 --force\uFF08\u4F1A\u4E22\u6389\u76D8\u4E0A\u8FD9\u4EFD\uFF09\uFF0C\u8981\u88C5\u5230\u522B\u5904\u7528 --dir <path>`;
11836
+ return `${product}/ \u5F52\u4EA7\u54C1\uFF1A\u8981\u7559\u4F4F\u76D8\u4E0A\u8FD9\u4EFD\u6539\u52A8\uFF0C\u628A\u5B83\u632A\u5230 ${displayDir(path12.join(where.localDir, id))}/${reach}\uFF0C\u632A\u597D\u540E\u91CD\u8DD1\uFF1B\u786E\u8BA4\u653E\u5F03\u8FD9\u4EFD\u6539\u52A8\u624D\u52A0 --force\uFF08\u4F1A\u4E22\u6389\u76D8\u4E0A\u8FD9\u4EFD\uFF09\uFF0C\u8981\u88C5\u5230\u522B\u5904\u7528 --dir <path>`;
11815
11837
  }
11816
11838
  if (where.half === "local") {
11817
11839
  return `${displayDir(where.localDir)}/ \u662F\u8FD9\u4E2A\u9879\u76EE\u81EA\u5DF1\u7684\u90A3\u4E00\u534A\uFF1A\u786E\u8BA4\u8981\u7528 --from \u8FD9\u4E00\u4EFD\u6362\u6389\u76D8\u4E0A\u90A3\u4EFD\u624D\u52A0 --force\uFF08\u4F1A\u4E22\u6389\u76D8\u4E0A\u8FD9\u4EFD\uFF09\uFF0C\u4E24\u4EFD\u90FD\u8981\u7559\u5C31\u7528 --dir <path> \u88C5\u5230\u522B\u5904`;
@@ -11832,8 +11854,8 @@ function reconcileAdvice(layout, args) {
11832
11854
  return where.half === "product" && where.target === "claude" ? (id) => skillLocalModificationAdvice(id, "claude") : (id) => skillLocalModificationAdvice(id);
11833
11855
  }
11834
11856
  function displayDir(dir) {
11835
- const relative3 = path11.relative(process.cwd(), dir);
11836
- return relative3 && relative3 !== ".." && !relative3.startsWith(`..${path11.sep}`) && !path11.isAbsolute(relative3) ? relative3.split(path11.sep).join("/") : dir;
11857
+ const relative3 = path12.relative(process.cwd(), dir);
11858
+ return relative3 && relative3 !== ".." && !relative3.startsWith(`..${path12.sep}`) && !path12.isAbsolute(relative3) ? relative3.split(path12.sep).join("/") : dir;
11837
11859
  }
11838
11860
  async function compareInstalledWithSource(baseDir, id, record3, onDisk, source, force, advice = skillLocalModificationAdvice) {
11839
11861
  let differsFromSource = source.markdown !== onDisk;
@@ -11884,11 +11906,11 @@ async function planLocalSkillUpdate(options) {
11884
11906
  note: `\u672C\u8F6E\u6309 --from \u76EE\u5F55\u5BF9\u8D26\uFF0C${root} \u91CC\u6CA1\u6709\u5B83\uFF1A\u8FD9\u4E00\u8D9F\u6CA1\u6838\u5BF9\u5B83\uFF0C\u4E5F\u4E0D\u6E05\u5B83` + (by.length > 0 ? `\uFF1B${by.join("\u3001")} \u4F9D\u8D56\u5B83\uFF0C\u7528\u7684\u662F\u76D8\u4E0A\u5DF2\u88C5\u7684\u8FD9\u4EFD` : "")
11885
11907
  });
11886
11908
  }
11887
- const advice = (id) => `\u672C\u5730\u6539\u8FC7\uFF0C\u6CA1\u6709\u8986\u76D6\u3002\u76D8\u4E0A\u8FD9\u4EFD\u4E0E\u9501\u91CC\u8BB0\u7684\u4E0D\u540C\uFF0C${path11.join(root, id)}/ \u4E5F\u4E0E\u5B83\u4E0D\u540C\uFF1A\u628A\u76D8\u4E0A\u7684\u6539\u52A8\u5408\u8FDB ${path11.join(root, id)}/ \u540E\u91CD\u8DD1 sync --from\uFF1B\u786E\u8BA4\u653E\u5F03\u76D8\u4E0A\u6539\u52A8\u624D\u7528 --force`;
11909
+ const advice = (id) => `\u672C\u5730\u6539\u8FC7\uFF0C\u6CA1\u6709\u8986\u76D6\u3002\u76D8\u4E0A\u8FD9\u4EFD\u4E0E\u9501\u91CC\u8BB0\u7684\u4E0D\u540C\uFF0C${path12.join(root, id)}/ \u4E5F\u4E0E\u5B83\u4E0D\u540C\uFF1A\u628A\u76D8\u4E0A\u7684\u6539\u52A8\u5408\u8FDB ${path12.join(root, id)}/ \u540E\u91CD\u8DD1 sync --from\uFF1B\u786E\u8BA4\u653E\u5F03\u76D8\u4E0A\u6539\u52A8\u624D\u7528 --force`;
11888
11910
  for (const [id, document2] of closure) {
11889
11911
  const record3 = state.skills[id];
11890
11912
  const onDisk = await readInstalled(baseDir, id);
11891
- const withoutReferences = !await exists(path11.join(root, id, "references"));
11913
+ const withoutReferences = !await exists(path12.join(root, id, "references"));
11892
11914
  if (withoutReferences && record3 && Object.keys(record3.references ?? {}).length > 0) {
11893
11915
  let onDiskCount = 0;
11894
11916
  for (const relative3 of Object.keys(record3.references ?? {})) {
@@ -12146,7 +12168,7 @@ async function requireManagedState(layout) {
12146
12168
  if (!state || Object.keys(state.skills).length === 0) {
12147
12169
  throw new CliError28({
12148
12170
  code: CliErrorCode28.INVALID_ARGUMENT,
12149
- message: `${path11.join(layout.baseDir, SKILLS_STATE_FILE)} \u4E0D\u5B58\u5728\u6216\u4E3A\u7A7A \u2014\u2014 \u8FD9\u4E2A\u76EE\u5F55\u4E0B\u8FD8\u6CA1\u6709\u7528\u672C CLI \u88C5\u8FC7\u6280\u80FD\u3002\u5148\u8DD1 \`hcm chiron skills sync\`\uFF1B\u5982\u679C\u6280\u80FD\u662F\u624B\u5DE5\u62F7\u8FDB\u6765\u7684\uFF0C\u540C\u6B65\u4E00\u6B21\u5373\u53EF\u63A5\u7BA1\u5347\u7EA7\u3002`
12171
+ message: `${path12.join(layout.baseDir, SKILLS_STATE_FILE)} \u4E0D\u5B58\u5728\u6216\u4E3A\u7A7A \u2014\u2014 \u8FD9\u4E2A\u76EE\u5F55\u4E0B\u8FD8\u6CA1\u6709\u7528\u672C CLI \u88C5\u8FC7\u6280\u80FD\u3002\u5148\u8DD1 \`hcm chiron skills sync\`\uFF1B\u5982\u679C\u6280\u80FD\u662F\u624B\u5DE5\u62F7\u8FDB\u6765\u7684\uFF0C\u540C\u6B65\u4E00\u6B21\u5373\u53EF\u63A5\u7BA1\u5347\u7EA7\u3002`
12150
12172
  });
12151
12173
  }
12152
12174
  return state;
@@ -12155,7 +12177,7 @@ async function skillsUpdateFromLocalCommand(args) {
12155
12177
  try {
12156
12178
  const layout = await resolveInstallLayout(args, process.cwd(), true);
12157
12179
  const state = await requireManagedState(layout);
12158
- const root = path11.resolve(args.from);
12180
+ const root = path12.resolve(args.from);
12159
12181
  const ignored = [args.endpoint ? "--endpoint" : "", args.env ? "--env" : "", args.pruneMax !== void 0 ? "--prune-max" : ""].filter(Boolean);
12160
12182
  if (ignored.length > 0) {
12161
12183
  process.stderr.write(`[hcm] --from \u5BF9\u8D26\u4E0D\u89E3\u6790 endpoint\u3001\u4E0D\u6E05\u5B64\u513F\uFF1A${ignored.join(" / ")} \u672C\u8D9F\u4E0D\u751F\u6548\uFF08\u53BB\u6389 --from \u624D\u8D70\u8FDE\u7F51\u5BF9\u8D26\uFF09
@@ -12231,7 +12253,7 @@ async function skillsUpdateFromLocalCommand(args) {
12231
12253
  }
12232
12254
  process.stdout.write("\n");
12233
12255
  for (const index of agentIndexes) {
12234
- const reader = path11.basename(index.file) === "CLAUDE.md" ? "Claude Code" : "Codex";
12256
+ const reader = path12.basename(index.file) === "CLAUDE.md" ? "Claude Code" : "Codex";
12235
12257
  process.stdout.write(` \u5DF2${index.status === "created" ? "\u521B\u5EFA" : "\u66F4\u65B0"} ${index.file} \u91CC\u7684\u6280\u80FD\u7D22\u5F15\u4E0E\u9879\u76EE\u8FB9\u754C\u5757\uFF08${reader} \u8BFB\u8FD9\u91CC\uFF09
12236
12258
  `);
12237
12259
  }
@@ -12253,7 +12275,7 @@ async function skillsUpdateFromLocalCommand(args) {
12253
12275
  );
12254
12276
  }
12255
12277
  for (const item of plan.referencesNotProvided) {
12256
- process.stdout.write(` ${path11.join(root, item.id)}/ \u6CA1\u6709 references/\uFF0C\u76D8\u4E0A ${item.onDisk} \u4E2A\u53C2\u8003\u6587\u4EF6\u4FDD\u7559\u672A\u6838` + (item.missing > 0 ? `\uFF08\u9501\u91CC\u8BB0\u7684\u53E6\u6709 ${item.missing} \u4E2A\u76D8\u4E0A\u6CA1\u6709\uFF0C\u8BB0\u5F55\u7167\u65E7\uFF09` : "") + "\n");
12278
+ process.stdout.write(` ${path12.join(root, item.id)}/ \u6CA1\u6709 references/\uFF0C\u76D8\u4E0A ${item.onDisk} \u4E2A\u53C2\u8003\u6587\u4EF6\u4FDD\u7559\u672A\u6838` + (item.missing > 0 ? `\uFF08\u9501\u91CC\u8BB0\u7684\u53E6\u6709 ${item.missing} \u4E2A\u76D8\u4E0A\u6CA1\u6709\uFF0C\u8BB0\u5F55\u7167\u65E7\uFF09` : "") + "\n");
12257
12279
  }
12258
12280
  const tail = [
12259
12281
  skipped > 0 ? `${skipped} \u4E2A\u672C\u5730\u6539\u8FC7\u88AB\u8DF3\u8FC7\uFF08--force \u8986\u76D6\uFF09` : "",
@@ -12417,7 +12439,7 @@ async function skillsUpdateCommand(args) {
12417
12439
  if (conflictNote) process.stdout.write(` \u26A0\uFE0F ${conflictNote}
12418
12440
  `);
12419
12441
  for (const index of agentIndexes) {
12420
- const reader = path11.basename(index.file) === "CLAUDE.md" ? "Claude Code" : "Codex";
12442
+ const reader = path12.basename(index.file) === "CLAUDE.md" ? "Claude Code" : "Codex";
12421
12443
  process.stdout.write(` \u5DF2${index.status === "created" ? "\u521B\u5EFA" : "\u66F4\u65B0"} ${index.file} \u91CC\u7684\u6280\u80FD\u7D22\u5F15\u4E0E\u9879\u76EE\u8FB9\u754C\u5757\uFF08${reader} \u8BFB\u8FD9\u91CC\uFF09
12422
12444
  `);
12423
12445
  }
@@ -12460,7 +12482,7 @@ async function skillsUpdateCommand(args) {
12460
12482
  const bypass = await findShadowBypassingRefs(layout, shadowedIds);
12461
12483
  for (const hit of bypass) {
12462
12484
  process.stdout.write(
12463
- ` \u26A0\uFE0F ${path11.relative(layout.baseDir, hit.file)} \u91CC\u7684 ../${hit.to}/ \u7ED5\u8FC7\u4E86\u906E\u853D\uFF1A\u4F60\u5728 ${SKILLS_LOCAL_SUBDIR}/${hit.to}/ \u6539\u8FC7\u5B83\uFF0C\u4F46\u987A\u7740\u8FD9\u6761\u76F8\u5BF9\u8DEF\u5F84\u8BFB\u5230\u7684\u662F ${SKILLS_SYNC_SUBDIR}/ \u91CC\u7684\u4EA7\u54C1\u539F\u7248
12485
+ ` \u26A0\uFE0F ${path12.relative(layout.baseDir, hit.file)} \u91CC\u7684 ../${hit.to}/ \u7ED5\u8FC7\u4E86\u906E\u853D\uFF1A\u4F60\u5728 ${SKILLS_LOCAL_SUBDIR}/${hit.to}/ \u6539\u8FC7\u5B83\uFF0C\u4F46\u987A\u7740\u8FD9\u6761\u76F8\u5BF9\u8DEF\u5F84\u8BFB\u5230\u7684\u662F ${SKILLS_SYNC_SUBDIR}/ \u91CC\u7684\u4EA7\u54C1\u539F\u7248
12464
12486
  \u6B63\u6587\u6539\u6210\u6309 id \u53D6\u5740\u5C31\u4E0D\u4F1A\u518D\u9519\uFF1Ahcm chiron skills path ${hit.to}
12465
12487
  `
12466
12488
  );
@@ -12488,13 +12510,13 @@ async function skillsUpdateCommand(args) {
12488
12510
  async function detectLegacyFlatLayout(layout) {
12489
12511
  if (!layout.localDir) return void 0;
12490
12512
  if (await readSkillsState(layout.baseDir)) return void 0;
12491
- const legacyRoot = path11.dirname(layout.baseDir);
12513
+ const legacyRoot = path12.dirname(layout.baseDir);
12492
12514
  return await readSkillsState(legacyRoot) ? legacyRoot : void 0;
12493
12515
  }
12494
12516
  async function migrateFlatSkillsLayout(skillsRoot) {
12495
- const legacyState = path11.join(skillsRoot, SKILLS_STATE_FILE);
12496
- const syncDir = path11.join(skillsRoot, SKILLS_SYNC_SUBDIR);
12497
- const localDir = path11.join(skillsRoot, SKILLS_LOCAL_SUBDIR);
12517
+ const legacyState = path12.join(skillsRoot, SKILLS_STATE_FILE);
12518
+ const syncDir = path12.join(skillsRoot, SKILLS_SYNC_SUBDIR);
12519
+ const localDir = path12.join(skillsRoot, SKILLS_LOCAL_SUBDIR);
12498
12520
  const hasLegacy = await fsp2.stat(legacyState).then(() => true).catch(() => false);
12499
12521
  if (!hasLegacy) return { moved: [], migrated: false };
12500
12522
  const state = await readSkillsState(skillsRoot);
@@ -12511,23 +12533,23 @@ async function migrateFlatSkillsLayout(skillsRoot) {
12511
12533
  }
12512
12534
  const moved = [];
12513
12535
  for (const id of names) {
12514
- const hasSkill = await fsp2.stat(path11.join(skillsRoot, id, "SKILL.md")).then(() => true).catch(() => false);
12536
+ const hasSkill = await fsp2.stat(path12.join(skillsRoot, id, "SKILL.md")).then(() => true).catch(() => false);
12515
12537
  if (!hasSkill) continue;
12516
12538
  const to = owned.has(id) ? "sync" : "local";
12517
- const target = path11.join(to === "sync" ? syncDir : localDir, id);
12539
+ const target = path12.join(to === "sync" ? syncDir : localDir, id);
12518
12540
  if (await fsp2.stat(target).then(() => true).catch(() => false)) {
12519
12541
  throw invalid(`${target} \u5DF2\u7ECF\u5B58\u5728\uFF0C${id} \u642C\u4E0D\u8FC7\u53BB \u2014\u2014 \u5DF2\u7ECF\u642C\u597D\u7684\u90A3\u4E9B\u7559\u5728\u539F\u5730\uFF0C\u6CA1\u6709\u534A\u4EFD\u6587\u4EF6\u3002\u6253\u5F00\u8FD9\u4E24\u4E2A\u76EE\u5F55\u6BD4\u4E00\u6BD4\uFF0C\u7559\u4E00\u4EFD\u3001\u5220\u53E6\u4E00\u4EFD\uFF0C\u7136\u540E\u91CD\u8DD1 hcm chiron skills sync\u3002`);
12520
12542
  }
12521
- await fsp2.mkdir(path11.dirname(target), { recursive: true });
12543
+ await fsp2.mkdir(path12.dirname(target), { recursive: true });
12522
12544
  try {
12523
- await fsp2.rename(path11.join(skillsRoot, id), target);
12545
+ await fsp2.rename(path12.join(skillsRoot, id), target);
12524
12546
  } catch (cause) {
12525
12547
  throw invalid(`\u628A ${id} \u642C\u8FDB ${to}/ \u5931\u8D25\uFF1A${cause.message}\u3002\u5DF2\u7ECF\u642C\u597D\u7684 ${moved.length} \u4EFD\u5728\u65B0\u4F4D\u7F6E\uFF0C\u6CA1\u642C\u7684\u8FD8\u5728\u539F\u5730\uFF0C\u4E24\u8FB9\u90FD\u662F\u5B8C\u6574\u76EE\u5F55 \u2014\u2014 \u5904\u7406\u6389\u8FD9\u4E2A\u9519\u8BEF\u4E4B\u540E\u91CD\u8DD1 hcm chiron skills sync \u4F1A\u63A5\u7740\u642C\u5B8C\u3002`);
12526
12548
  }
12527
12549
  moved.push({ id, to });
12528
12550
  }
12529
12551
  await fsp2.mkdir(syncDir, { recursive: true });
12530
- await fsp2.rename(legacyState, path11.join(syncDir, SKILLS_STATE_FILE));
12552
+ await fsp2.rename(legacyState, path12.join(syncDir, SKILLS_STATE_FILE));
12531
12553
  return { moved, migrated: true };
12532
12554
  }
12533
12555
  function assertSyncArgs(args) {
@@ -12551,7 +12573,7 @@ var defaultSkillsSyncDeps = {
12551
12573
  migrate: async (args) => {
12552
12574
  const layout = await resolveInstallLayout(args).catch(() => null);
12553
12575
  if (!layout || !layout.localDir) return { moved: [], migrated: false };
12554
- return migrateFlatSkillsLayout(path11.dirname(layout.baseDir));
12576
+ return migrateFlatSkillsLayout(path12.dirname(layout.baseDir));
12555
12577
  }
12556
12578
  };
12557
12579
  async function skillsSyncCommand(args, deps = defaultSkillsSyncDeps) {
@@ -12865,19 +12887,19 @@ import {
12865
12887
  CliErrorCode as CliErrorCode30,
12866
12888
  fromAxiosError as fromAxiosError25
12867
12889
  } from "@hcmai/sdk";
12868
- import axios4 from "axios";
12890
+ import axios5 from "axios";
12869
12891
  init_exit();
12870
12892
  async function bootstrapReport(http) {
12871
12893
  const read = () => http.get("/api/system/health/report", { params: { only: "tenant.bootstrap" } });
12872
12894
  try {
12873
12895
  return (await read()).data;
12874
12896
  } catch (error) {
12875
- const wait = axios4.isAxiosError(error) ? Number(error.response?.headers["retry-after"]) : NaN;
12876
- if (!axios4.isAxiosError(error) || error.response?.status !== 429 || !Number.isFinite(wait) || wait < 0 || wait > 30) throw error;
12897
+ const wait = axios5.isAxiosError(error) ? Number(error.response?.headers["retry-after"]) : NaN;
12898
+ if (!axios5.isAxiosError(error) || error.response?.status !== 429 || !Number.isFinite(wait) || wait < 0 || wait > 30) throw error;
12877
12899
  const waitSeconds = Math.ceil(wait) + 1;
12878
12900
  process.stderr.write(`\u521D\u59CB\u5316\u590D\u9A8C\u88AB\u8282\u6D41\uFF0C\u6309 Retry-After \u52A0\u4E00\u79D2\u8FB9\u754C\u7B49\u5F85 ${waitSeconds} \u79D2\u540E\u53EA\u91CD\u8BD5\u4E00\u6B21\u53EA\u8BFB\u68C0\u67E5\u3002
12879
12901
  `);
12880
- await new Promise((resolve7) => setTimeout(resolve7, waitSeconds * 1e3));
12902
+ await new Promise((resolve8) => setTimeout(resolve8, waitSeconds * 1e3));
12881
12903
  return (await read()).data;
12882
12904
  }
12883
12905
  }
@@ -12952,7 +12974,7 @@ async function tenantReconcileCommand(args) {
12952
12974
  ...!passed ? { reason: "\u521D\u59CB\u5316\u590D\u9A8C\u672A\u8BC1\u660E\u5F53\u524D\u79DF\u6237\u5168\u90E8\u7EC4\u4EF6\u901A\u8FC7\uFF1B\u8BF7\u8BFB\u53D6\u539F\u59CB report\uFF0C\u4E0D\u80FD\u5BA3\u79F0\u5B8C\u6210\u3002" } : {}
12953
12975
  };
12954
12976
  } catch (error) {
12955
- const translated = axios4.isAxiosError(error) ? fromAxiosError25(error, env2) : error;
12977
+ const translated = axios5.isAxiosError(error) ? fromAxiosError25(error, env2) : error;
12956
12978
  verification = { status: "UNDETERMINED", reason: translated instanceof Error ? translated.message : "\u521D\u59CB\u5316\u590D\u9A8C\u5931\u8D25\uFF0C\u539F\u56E0\u672A\u77E5" };
12957
12979
  }
12958
12980
  }
@@ -12973,7 +12995,7 @@ async function tenantReconcileCommand(args) {
12973
12995
  process.exitCode = verification.status === "PASS" ? 0 : 3;
12974
12996
  } catch (error) {
12975
12997
  if (attempted) process.stderr.write("TENANT_RECONCILE_RESULT_UNKNOWN\uFF1A\u5DF2\u5C1D\u8BD5\u4E00\u6B21\u8865\u8DD1\uFF0C\u7ED3\u679C\u672A\u786E\u8BA4\uFF0C\u672A\u81EA\u52A8\u91CD\u53D1\uFF1B\u5148\u53EA\u8BFB\u68C0\u67E5 tenant.bootstrap \u4E0E\u670D\u52A1\u7AEF\u65E5\u5FD7\uFF0C\u4E0D\u8981\u76F2\u76EE\u91CD\u8DD1\u3002\n");
12976
- exitWithError(axios4.isAxiosError(error) ? fromAxiosError25(error, args.env) : error);
12998
+ exitWithError(axios5.isAxiosError(error) ? fromAxiosError25(error, args.env) : error);
12977
12999
  }
12978
13000
  }
12979
13001
 
@@ -13039,10 +13061,10 @@ async function metaListCommand(args) {
13039
13061
  fail7(e, args, "read");
13040
13062
  }
13041
13063
  }
13042
- async function metaGetCommand(path25, args) {
13064
+ async function metaGetCommand(path26, args) {
13043
13065
  try {
13044
13066
  const c2 = await client2(args);
13045
- const content = await getTenantMeta(c2.raw(), path25);
13067
+ const content = await getTenantMeta(c2.raw(), path26);
13046
13068
  process.stdout.write(content.endsWith("\n") ? content : content + "\n");
13047
13069
  process.exitCode = 0;
13048
13070
  return;
@@ -13051,8 +13073,8 @@ async function metaGetCommand(path25, args) {
13051
13073
  }
13052
13074
  }
13053
13075
  var PROBEABLE_META_TYPES = /* @__PURE__ */ new Set(["model", "list", "info", "view", "filter", "page", "wiz", "impexp"]);
13054
- function parseMetaPath(path25) {
13055
- const base = path25.split(/[\\/]/).pop() ?? path25;
13076
+ function parseMetaPath(path26) {
13077
+ const base = path26.split(/[\\/]/).pop() ?? path26;
13056
13078
  if (!/\.(yml|yaml)$/i.test(base)) return {};
13057
13079
  const parts = base.replace(/\.(yml|yaml)$/i, "").split(".");
13058
13080
  return { model: parts[0] || void 0, kind: parts[1] ?? "model", state: parts[2] };
@@ -13069,10 +13091,10 @@ function unverifiableReason(e) {
13069
13091
  if (st == null) return `\u8BF7\u6C42\u6CA1\u53D1\u51FA\u53BB\u6216\u6CA1\u56DE\u6765\uFF08${err.code ?? err.message ?? "\u672A\u77E5"}\uFF09`;
13070
13092
  return void 0;
13071
13093
  }
13072
- async function verifyAfterWrite(c2, path25) {
13073
- const { model, kind, state } = parseMetaPath(path25);
13094
+ async function verifyAfterWrite(c2, path26) {
13095
+ const { model, kind, state } = parseMetaPath(path26);
13074
13096
  if (!model || !kind) {
13075
- return { status: "unverified", where: "(\u672A\u63A2)", why: `\u4ECE\u8DEF\u5F84 ${path25} \u8BA4\u4E0D\u51FA\u6A21\u578B\u540D/\u5C42\u540D` };
13097
+ return { status: "unverified", where: "(\u672A\u63A2)", why: `\u4ECE\u8DEF\u5F84 ${path26} \u8BA4\u4E0D\u51FA\u6A21\u578B\u540D/\u5C42\u540D` };
13076
13098
  }
13077
13099
  try {
13078
13100
  await clearMetaCache2(c2.raw(), model, {});
@@ -13117,7 +13139,7 @@ async function verifyAfterWrite(c2, path25) {
13117
13139
  }
13118
13140
  return { status: "ok" };
13119
13141
  }
13120
- async function metaSetCommand(path25, args) {
13142
+ async function metaSetCommand(path26, args) {
13121
13143
  try {
13122
13144
  if (!args.file) {
13123
13145
  throw new CliError31({
@@ -13125,17 +13147,17 @@ async function metaSetCommand(path25, args) {
13125
13147
  message: "--file <path> \u5FC5\u586B\uFF08\u4ECE\u6587\u4EF6\u8BFB\u53D6 meta \u539F\u6587\uFF1B\u7528 - \u8868\u793A stdin\uFF09"
13126
13148
  });
13127
13149
  }
13128
- const content = args.file === "-" ? await new Promise((resolve7, reject) => {
13150
+ const content = args.file === "-" ? await new Promise((resolve8, reject) => {
13129
13151
  let buf = "";
13130
13152
  process.stdin.setEncoding("utf8");
13131
13153
  process.stdin.on("data", (d) => buf += d);
13132
- process.stdin.on("end", () => resolve7(buf));
13154
+ process.stdin.on("end", () => resolve8(buf));
13133
13155
  process.stdin.on("error", reject);
13134
13156
  }) : await fsp3.readFile(args.file, "utf8");
13135
13157
  if (!args.skipValidate) {
13136
- const result2 = validateMetaContent(path25, content);
13158
+ const result2 = validateMetaContent(path26, content);
13137
13159
  if (result2.issues.length > 0) {
13138
- process.stderr.write(`\u{1F50E} \u5199\u524D\u6821\u9A8C ${path25}\uFF08schema \u7C7B\u578B\uFF1A${result2.kind ?? "\u672A\u8BC6\u522B"}\uFF09
13160
+ process.stderr.write(`\u{1F50E} \u5199\u524D\u6821\u9A8C ${path26}\uFF08schema \u7C7B\u578B\uFF1A${result2.kind ?? "\u672A\u8BC6\u522B"}\uFF09
13139
13161
  `);
13140
13162
  process.stderr.write(formatMetaIssues(result2, " ") + "\n");
13141
13163
  }
@@ -13154,13 +13176,13 @@ async function metaSetCommand(path25, args) {
13154
13176
  if (dryFmt === "json" || dryFmt === "yaml") {
13155
13177
  process.stdout.write(
13156
13178
  formatObject24(
13157
- { dryRun: true, path: path25, bytes: Buffer.byteLength(content), content },
13179
+ { dryRun: true, path: path26, bytes: Buffer.byteLength(content), content },
13158
13180
  { format: dryFmt }
13159
13181
  ) + "\n"
13160
13182
  );
13161
13183
  } else {
13162
13184
  process.stdout.write(
13163
- `[dry-run] \u5C06\u5199\u5165 ${path25}\uFF08${Buffer.byteLength(content)} B\uFF09\u2014\u2014\u672A\u5B9E\u9645\u5199\u5165
13185
+ `[dry-run] \u5C06\u5199\u5165 ${path26}\uFF08${Buffer.byteLength(content)} B\uFF09\u2014\u2014\u672A\u5B9E\u9645\u5199\u5165
13164
13186
  ---
13165
13187
  ${content}
13166
13188
  `
@@ -13174,13 +13196,13 @@ ${content}
13174
13196
  let backupState = "unknown";
13175
13197
  let backupWhy;
13176
13198
  try {
13177
- const prev = await getTenantMeta(c2.raw(), path25);
13199
+ const prev = await getTenantMeta(c2.raw(), path26);
13178
13200
  if (!prev || prev.trim() === "") {
13179
13201
  backupState = "absent";
13180
13202
  } else {
13181
13203
  backupFile = nodePath.join(
13182
13204
  os4.tmpdir(),
13183
- `hcm-meta-backup-${Date.now()}-${path25.replace(/[\\/]/g, "_")}`
13205
+ `hcm-meta-backup-${Date.now()}-${path26.replace(/[\\/]/g, "_")}`
13184
13206
  );
13185
13207
  await fsp3.writeFile(backupFile, prev, "utf8");
13186
13208
  backupState = "saved";
@@ -13195,22 +13217,22 @@ ${content}
13195
13217
  backupWhy = `HTTP ${st ?? "-"}${err.code ? ` ${err.code}` : ""}${err.message ? `\uFF1A${err.message}` : ""}`;
13196
13218
  }
13197
13219
  }
13198
- const result = await saveTenantMeta(c2.raw(), path25, content);
13220
+ const result = await saveTenantMeta(c2.raw(), path26, content);
13199
13221
  const fmt = args.output ?? "json";
13200
- if (fmt !== "json") process.stdout.write(`\u2705 \u5DF2\u5199\u5165 ${path25}
13222
+ if (fmt !== "json") process.stdout.write(`\u2705 \u5DF2\u5199\u5165 ${path26}
13201
13223
  `);
13202
13224
  const restoreHint = backupState === "saved" && backupFile ? ` \u65E7\u5185\u5BB9\u5DF2\u5B58\uFF1A${backupFile}
13203
- \u653E\u56DE\u53BB\uFF1Ahcm meta set ${path25} --file ${backupFile}${connFlags(args)}
13204
- ` : 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 ${path25}${connFlags(args)}
13225
+ \u653E\u56DE\u53BB\uFF1Ahcm meta set ${path26} --file ${backupFile}${connFlags(args)}
13226
+ ` : 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 ${path26}${connFlags(args)}
13205
13227
  ` : ` \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
13206
- \u5148\u81EA\u5DF1\u8BFB\u4E00\u904D\u786E\u8BA4\uFF1Ahcm meta get ${path25}${connFlags(args)}
13228
+ \u5148\u81EA\u5DF1\u8BFB\u4E00\u904D\u786E\u8BA4\uFF1Ahcm meta get ${path26}${connFlags(args)}
13207
13229
  `;
13208
13230
  if (args.verify === false) {
13209
13231
  process.stderr.write(
13210
13232
  "\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
13211
13233
  );
13212
13234
  } else {
13213
- const outcome = await verifyAfterWrite(c2, path25);
13235
+ const outcome = await verifyAfterWrite(c2, path26);
13214
13236
  if (outcome.status === "broken") {
13215
13237
  const human = explainJacksonError(outcome.raw);
13216
13238
  process.stderr.write(
@@ -13244,23 +13266,23 @@ ${content}
13244
13266
  fail7(e, args);
13245
13267
  }
13246
13268
  }
13247
- async function metaDeleteCommand(path25, args) {
13269
+ async function metaDeleteCommand(path26, args) {
13248
13270
  try {
13249
13271
  if (!args.yes) {
13250
13272
  requireTerminalForPrompt(
13251
- `\u6807\u51C6\u8F93\u5165\u4E0D\u662F\u7EC8\u7AEF\uFF0C\u65E0\u6CD5\u786E\u8BA4\u5220\u9664\u5143\u6570\u636E ${path25}\uFF1B\u672A\u5220\u9664\u3001\u672A\u53D1\u9001\u8BF7\u6C42\u3002`,
13252
- `\u6838\u5BF9\u8DEF\u5F84\u4E0E\u5F71\u54CD\u540E\u52A0 --yes\uFF1Ahcm meta delete ${path25} --yes${connFlags(args)}`
13273
+ `\u6807\u51C6\u8F93\u5165\u4E0D\u662F\u7EC8\u7AEF\uFF0C\u65E0\u6CD5\u786E\u8BA4\u5220\u9664\u5143\u6570\u636E ${path26}\uFF1B\u672A\u5220\u9664\u3001\u672A\u53D1\u9001\u8BF7\u6C42\u3002`,
13274
+ `\u6838\u5BF9\u8DEF\u5F84\u4E0E\u5F71\u54CD\u540E\u52A0 --yes\uFF1Ahcm meta delete ${path26} --yes${connFlags(args)}`
13253
13275
  );
13254
- const ok = await promptConfirm(`\u5C06\u5220\u9664\u5143\u6570\u636E ${path25}\uFF0C\u6B64\u64CD\u4F5C\u4E0D\u53EF\u9006\u3002\u7EE7\u7EED\uFF1F`);
13276
+ const ok = await promptConfirm(`\u5C06\u5220\u9664\u5143\u6570\u636E ${path26}\uFF0C\u6B64\u64CD\u4F5C\u4E0D\u53EF\u9006\u3002\u7EE7\u7EED\uFF1F`);
13255
13277
  if (!ok) {
13256
13278
  process.stderr.write("\u5DF2\u53D6\u6D88\n");
13257
13279
  process.exit(1);
13258
13280
  }
13259
13281
  }
13260
13282
  const c2 = await client2(args);
13261
- const result = await deleteTenantMeta(c2.raw(), path25);
13283
+ const result = await deleteTenantMeta(c2.raw(), path26);
13262
13284
  const fmt = args.output ?? "json";
13263
- if (fmt !== "json") process.stdout.write(`\u{1F5D1}\uFE0F \u5DF2\u5220\u9664 ${path25}
13285
+ if (fmt !== "json") process.stdout.write(`\u{1F5D1}\uFE0F \u5DF2\u5220\u9664 ${path26}
13264
13286
  `);
13265
13287
  process.stdout.write(formatObject24(result, { format: fmt }) + "\n");
13266
13288
  process.exitCode = 0;
@@ -13269,7 +13291,7 @@ async function metaDeleteCommand(path25, args) {
13269
13291
  fail7(e, args);
13270
13292
  }
13271
13293
  }
13272
- async function metaValidateCommand(path25, args) {
13294
+ async function metaValidateCommand(path26, args) {
13273
13295
  try {
13274
13296
  if (!args.file) {
13275
13297
  throw new CliError31({
@@ -13277,20 +13299,20 @@ async function metaValidateCommand(path25, args) {
13277
13299
  message: "--file <path> \u5FC5\u586B\uFF08\u8981\u9A8C\u7684\u90A3\u4EFD\u539F\u6587\uFF1B\u7528 - \u8868\u793A stdin\uFF09"
13278
13300
  });
13279
13301
  }
13280
- const content = args.file === "-" ? await new Promise((resolve7, reject) => {
13302
+ const content = args.file === "-" ? await new Promise((resolve8, reject) => {
13281
13303
  let buf = "";
13282
13304
  process.stdin.setEncoding("utf8");
13283
13305
  process.stdin.on("data", (d) => buf += d);
13284
- process.stdin.on("end", () => resolve7(buf));
13306
+ process.stdin.on("end", () => resolve8(buf));
13285
13307
  process.stdin.on("error", reject);
13286
13308
  }) : await fsp3.readFile(args.file, "utf8");
13287
- const result = validateMetaContent(path25, content);
13309
+ const result = validateMetaContent(path26, content);
13288
13310
  const fmt = args.output ?? "table";
13289
13311
  if (fmt === "json" || fmt === "yaml") {
13290
13312
  process.stdout.write(
13291
13313
  formatObject24(
13292
13314
  {
13293
- path: path25,
13315
+ path: path26,
13294
13316
  kind: result.kind,
13295
13317
  schemaKnown: result.schemaKnown,
13296
13318
  schemaSourceCommit: META_SCHEMA_SOURCE_COMMIT,
@@ -13302,7 +13324,7 @@ async function metaValidateCommand(path25, args) {
13302
13324
  );
13303
13325
  } else {
13304
13326
  process.stdout.write(
13305
- `\u{1F50E} ${path25}\uFF08schema \u7C7B\u578B\uFF1A${result.kind ?? "\u672A\u8BC6\u522B"}\uFF0C\u6765\u6E90 ${META_SCHEMA_SOURCE_COMMIT.slice(0, 8)}\uFF09
13327
+ `\u{1F50E} ${path26}\uFF08schema \u7C7B\u578B\uFF1A${result.kind ?? "\u672A\u8BC6\u522B"}\uFF0C\u6765\u6E90 ${META_SCHEMA_SOURCE_COMMIT.slice(0, 8)}\uFF09
13306
13328
  `
13307
13329
  );
13308
13330
  process.stdout.write(
@@ -13574,7 +13596,7 @@ async function metaColumnSlotSqlCommand(model, field, args) {
13574
13596
  init_exit();
13575
13597
  import * as crypto from "crypto";
13576
13598
  import * as fs12 from "fs/promises";
13577
- import * as path13 from "path";
13599
+ import * as path14 from "path";
13578
13600
  import {
13579
13601
  buildMiniPreviewTargets,
13580
13602
  buildMiniVerifyAgentReport,
@@ -13738,7 +13760,7 @@ function boolValue(value) {
13738
13760
 
13739
13761
  // src/commands/workspace-rebase.ts
13740
13762
  import * as fs11 from "fs/promises";
13741
- import * as path12 from "path";
13763
+ import * as path13 from "path";
13742
13764
  import { formatObject as formatObject26 } from "@hcmai/sdk";
13743
13765
  async function runWorkspaceRebase(workspaceKey, args, connect2) {
13744
13766
  const plan = args.plan && !args.dryRun ? readPlan(JSON.parse(await fs11.readFile(args.plan, "utf8"))) : void 0;
@@ -13783,8 +13805,8 @@ async function runWorkspaceRebase(workspaceKey, args, connect2) {
13783
13805
  content: file.workspaceContent
13784
13806
  }))
13785
13807
  };
13786
- await fs11.writeFile(path12.resolve(args.plan), JSON.stringify(draft, null, 2) + "\n", { flag: "wx", mode: 384 });
13787
- process.stderr.write(`\u5DF2\u5199\u89E3\u51B3\u8349\u6848 ${path12.resolve(args.plan)}\u3002\u586B\u5199 reason\uFF0C\u5220\u9664\u6682\u4E0D\u5904\u7406\u7684\u8DEF\u5F84\u884C\uFF1B\u9010\u8DEF\u5F84\u628A UNRESOLVED \u6539\u4E3A TAKE_ACTIVE / MERGED / KEEP_WORKSPACE / DELETE\u3002MERGED \u5FC5\u987B\u586B\u5199 content\uFF08\u7A7A\u4E32\u5408\u6CD5\uFF09\uFF1B\u5176\u4ED6\u9009\u62E9\u4E0D\u4F1A\u63D0\u4EA4\u8349\u6848 content\u3002\u6838\u5BF9\u540E\u6267\u884C hcm workspace rebase --plan <\u6587\u4EF6>\uFF0C\u6CBF\u7528\u672C\u6B21 --workspace/--dir/--env/--as\u3002
13808
+ await fs11.writeFile(path13.resolve(args.plan), JSON.stringify(draft, null, 2) + "\n", { flag: "wx", mode: 384 });
13809
+ process.stderr.write(`\u5DF2\u5199\u89E3\u51B3\u8349\u6848 ${path13.resolve(args.plan)}\u3002\u586B\u5199 reason\uFF0C\u5220\u9664\u6682\u4E0D\u5904\u7406\u7684\u8DEF\u5F84\u884C\uFF1B\u9010\u8DEF\u5F84\u628A UNRESOLVED \u6539\u4E3A TAKE_ACTIVE / MERGED / KEEP_WORKSPACE / DELETE\u3002MERGED \u5FC5\u987B\u586B\u5199 content\uFF08\u7A7A\u4E32\u5408\u6CD5\uFF09\uFF1B\u5176\u4ED6\u9009\u62E9\u4E0D\u4F1A\u63D0\u4EA4\u8349\u6848 content\u3002\u6838\u5BF9\u540E\u6267\u884C hcm workspace rebase --plan <\u6587\u4EF6>\uFF0C\u6CBF\u7528\u672C\u6B21 --workspace/--dir/--env/--as\u3002
13788
13810
  `);
13789
13811
  } else {
13790
13812
  process.stderr.write("\u53EA\u8BFB\u9884\u89C8\u5B8C\u6210\u3002\u53EF\u7528 hcm workspace rebase --dry-run --plan <\u65B0\u6587\u4EF6> \u751F\u6210\u89E3\u51B3\u8349\u6848\uFF1B\u6CBF\u7528\u672C\u6B21 --workspace/--dir/--env/--as\u3002pull \u4E0D\u4F1A\u66F4\u65B0\u670D\u52A1\u7AEF baseline\u3002\n");
@@ -13868,7 +13890,7 @@ function nonnegativeInteger2(value) {
13868
13890
  }
13869
13891
  function filePath(value) {
13870
13892
  const text2 = requiredText(value, "relativePath");
13871
- if (path12.isAbsolute(text2) || text2.includes("\\") || text2.includes("\0") || /^[A-Za-z]:/.test(text2) || text2.split("/").some((part) => !part || part === "." || part === "..")) {
13893
+ if (path13.isAbsolute(text2) || text2.includes("\\") || text2.includes("\0") || /^[A-Za-z]:/.test(text2) || text2.split("/").some((part) => !part || part === "." || part === "..")) {
13872
13894
  throw new Error(`relativePath \u5FC5\u987B\u662F\u5B89\u5168\u7684\u76F8\u5BF9\u6587\u4EF6\u8DEF\u5F84\uFF1A${text2}`);
13873
13895
  }
13874
13896
  return text2;
@@ -14004,8 +14026,8 @@ function releaseIssueNextStep(issue, deletedPaths) {
14004
14026
  }
14005
14027
  return "\u6309\u4E0A\u9762\u7684\u62A5\u9519\u6539\u597D\u540E\u91CD\u8DD1 hcm workspace verify";
14006
14028
  }
14007
- function appDirOf(path25) {
14008
- const m = path25 ? /^(mini_apps|apps)\/([^/]+)\//.exec(path25) : null;
14029
+ function appDirOf(path26) {
14030
+ const m = path26 ? /^(mini_apps|apps)\/([^/]+)\//.exec(path26) : null;
14009
14031
  return m ? `${m[1]}/${m[2]}/` : void 0;
14010
14032
  }
14011
14033
  function formatCoverageDetail(coverage) {
@@ -14243,9 +14265,9 @@ async function workspacePullCommand(args) {
14243
14265
  });
14244
14266
  }
14245
14267
  await fs12.mkdir(rootDir, { recursive: true });
14246
- await fs12.mkdir(path13.join(rootDir, WORKSPACE_STATE_DIR), { recursive: true });
14268
+ await fs12.mkdir(path14.join(rootDir, WORKSPACE_STATE_DIR), { recursive: true });
14247
14269
  await fs12.writeFile(
14248
- path13.join(rootDir, WORKSPACE_STATE_DIR, WORKSPACE_PULL_INCOMPLETE_FILE),
14270
+ path14.join(rootDir, WORKSPACE_STATE_DIR, WORKSPACE_PULL_INCOMPLETE_FILE),
14249
14271
  JSON.stringify(context, null, 2) + "\n"
14250
14272
  );
14251
14273
  const pulledMiniApps = [];
@@ -14254,7 +14276,7 @@ async function workspacePullCommand(args) {
14254
14276
  http: client4.raw(),
14255
14277
  appCode,
14256
14278
  workspaceKey,
14257
- targetDir: path13.join(rootDir, MINI_APPS_DIR, appCode),
14279
+ targetDir: path14.join(rootDir, MINI_APPS_DIR, appCode),
14258
14280
  tenantId: client4.tenantId,
14259
14281
  endpoint: client4.endpoint,
14260
14282
  profile: context.profile,
@@ -14279,7 +14301,7 @@ async function workspacePullCommand(args) {
14279
14301
  }
14280
14302
  });
14281
14303
  }
14282
- const target = path13.join(rootDir, content.relativePath);
14304
+ const target = path14.join(rootDir, content.relativePath);
14283
14305
  await writeTextFile(target, content.content, !!args.force);
14284
14306
  pulledRawFiles.push(content.relativePath);
14285
14307
  snapshots.push({
@@ -14293,7 +14315,7 @@ async function workspacePullCommand(args) {
14293
14315
  }
14294
14316
  await writeWorkspaceRawState(rootDir, context, snapshots);
14295
14317
  await writeWorkspaceContext(rootDir, context);
14296
- await fs12.unlink(path13.join(rootDir, WORKSPACE_STATE_DIR, WORKSPACE_PULL_INCOMPLETE_FILE));
14318
+ await fs12.unlink(path14.join(rootDir, WORKSPACE_STATE_DIR, WORKSPACE_PULL_INCOMPLETE_FILE));
14297
14319
  writeWorkspacePullResult(
14298
14320
  {
14299
14321
  workspaceKey,
@@ -14336,7 +14358,7 @@ async function workspaceAddMiniCommand(appCode, args) {
14336
14358
  const result = await initMiniAppProject({
14337
14359
  appCode,
14338
14360
  workspaceKey: context.workspaceKey,
14339
- targetDir: path13.join(rootDir, MINI_APPS_DIR, appCode),
14361
+ targetDir: path14.join(rootDir, MINI_APPS_DIR, appCode),
14340
14362
  name: args.name,
14341
14363
  runtimeSdkVersion: args.sdkVersion,
14342
14364
  defaultSurface: parseSurface(args.surface),
@@ -14363,7 +14385,7 @@ async function workspaceRmCommand(relativePath, args) {
14363
14385
  const rootDir = resolveRootDir(args.dir);
14364
14386
  const context = await requireWorkspaceContext(rootDir);
14365
14387
  const normalized = normalizeWorkspaceRmPath(relativePath);
14366
- const absolutePath = path13.join(rootDir, ...normalized.split("/"));
14388
+ const absolutePath = path14.join(rootDir, ...normalized.split("/"));
14367
14389
  let stat;
14368
14390
  try {
14369
14391
  stat = await fs12.lstat(absolutePath);
@@ -14493,7 +14515,7 @@ async function workspaceValidateCommand(args) {
14493
14515
  const rootDir = resolveRootDir(args.dir);
14494
14516
  await requireWorkspaceContext(rootDir);
14495
14517
  const miniApps = await discoverMiniApps(rootDir);
14496
- const metaFiles = await readWorkspaceRawLocalFiles(path13.join(rootDir, "metas"));
14518
+ const metaFiles = await readWorkspaceRawLocalFiles(path14.join(rootDir, "metas"));
14497
14519
  const metaResults = metaFiles.filter((file) => /\.ya?ml$/i.test(file.localPath)).map((file) => {
14498
14520
  const artifact = `meta:metas/${file.localPath}`;
14499
14521
  const validation = validateMetaContent2(`metas/${file.localPath}`, file.content);
@@ -14746,7 +14768,7 @@ function removedMiniCommand() {
14746
14768
  );
14747
14769
  }
14748
14770
  function resolveRootDir(dir) {
14749
- return path13.resolve(dir ?? ".");
14771
+ return path14.resolve(dir ?? ".");
14750
14772
  }
14751
14773
  async function workspacePathExists(file) {
14752
14774
  try {
@@ -14763,11 +14785,11 @@ async function assertWorkspacePushRoot(rootDir) {
14763
14785
  let insideMiniApp = false;
14764
14786
  let dir = realRoot;
14765
14787
  for (; ; ) {
14766
- const parent = path13.dirname(dir);
14767
- const appsDir = path13.basename(dir) === MINI_APPS_DIR ? dir : path13.basename(parent) === MINI_APPS_DIR ? parent : void 0;
14768
- const miniDir = appsDir !== void 0 && (await workspacePathExists(path13.join(path13.dirname(appsDir), WORKSPACE_CONTEXT_FILE)) || appsDir === parent && await workspacePathExists(path13.join(dir, "manifest.json"))) || await workspacePathExists(path13.join(dir, MINI_CONTEXT_FILE)) || await workspacePathExists(path13.join(dir, MINI_STATE_DIR, MINI_PULL_MANIFEST_FILE));
14788
+ const parent = path14.dirname(dir);
14789
+ const appsDir = path14.basename(dir) === MINI_APPS_DIR ? dir : path14.basename(parent) === MINI_APPS_DIR ? parent : void 0;
14790
+ const miniDir = appsDir !== void 0 && (await workspacePathExists(path14.join(path14.dirname(appsDir), WORKSPACE_CONTEXT_FILE)) || appsDir === parent && await workspacePathExists(path14.join(dir, "manifest.json"))) || await workspacePathExists(path14.join(dir, MINI_CONTEXT_FILE)) || await workspacePathExists(path14.join(dir, MINI_STATE_DIR, MINI_PULL_MANIFEST_FILE));
14769
14791
  insideMiniApp ||= miniDir;
14770
- if (!miniDir && await workspacePathExists(path13.join(dir, WORKSPACE_CONTEXT_FILE))) {
14792
+ if (!miniDir && await workspacePathExists(path14.join(dir, WORKSPACE_CONTEXT_FILE))) {
14771
14793
  workspaceRoot = dir;
14772
14794
  break;
14773
14795
  }
@@ -14798,7 +14820,7 @@ function buildWorkspaceContext(args) {
14798
14820
  async function readWorkspaceContext(rootDir) {
14799
14821
  try {
14800
14822
  const parsed = JSON.parse(
14801
- await fs12.readFile(path13.join(rootDir, WORKSPACE_CONTEXT_FILE), "utf-8")
14823
+ await fs12.readFile(path14.join(rootDir, WORKSPACE_CONTEXT_FILE), "utf-8")
14802
14824
  );
14803
14825
  if (parsed.kind !== WORKSPACE_CONTEXT_KIND || parsed.version !== WORKSPACE_CONTEXT_VERSION) {
14804
14826
  throw new Error(`${WORKSPACE_CONTEXT_FILE} is not an HCM workspace context`);
@@ -14828,7 +14850,7 @@ async function requireWorkspaceContext(rootDir) {
14828
14850
  }
14829
14851
  async function writeWorkspaceContext(rootDir, context) {
14830
14852
  await fs12.writeFile(
14831
- path13.join(rootDir, WORKSPACE_CONTEXT_FILE),
14853
+ path14.join(rootDir, WORKSPACE_CONTEXT_FILE),
14832
14854
  JSON.stringify(context, null, 2) + "\n"
14833
14855
  );
14834
14856
  }
@@ -14839,13 +14861,13 @@ async function writeTextFile(file, content, force) {
14839
14861
  } catch (e) {
14840
14862
  if (e.code !== "ENOENT") throw e;
14841
14863
  }
14842
- await fs12.mkdir(path13.dirname(file), { recursive: true });
14864
+ await fs12.mkdir(path14.dirname(file), { recursive: true });
14843
14865
  await fs12.writeFile(file, content);
14844
14866
  }
14845
14867
  async function readWorkspaceRawManifest(rootDir, context, forPull = false) {
14846
14868
  if (!forPull) {
14847
14869
  try {
14848
- await fs12.access(path13.join(rootDir, WORKSPACE_STATE_DIR, WORKSPACE_PULL_INCOMPLETE_FILE));
14870
+ await fs12.access(path14.join(rootDir, WORKSPACE_STATE_DIR, WORKSPACE_PULL_INCOMPLETE_FILE));
14849
14871
  throw new CliError34({
14850
14872
  code: CliErrorCode34.BUSINESS_RULE_VIOLATION,
14851
14873
  message: "\u4E0A\u6B21 workspace pull \u672A\u5B8C\u6210\uFF0C\u672C\u5730\u53EF\u80FD\u6DF7\u6709\u4E0D\u540C\u76EE\u6807\u7684\u5185\u5BB9\uFF0C\u4E0D\u80FD\u7EE7\u7EED\u540C\u6B65\u3002",
@@ -14861,7 +14883,7 @@ async function readWorkspaceRawManifest(rootDir, context, forPull = false) {
14861
14883
  try {
14862
14884
  const parsed = JSON.parse(
14863
14885
  await fs12.readFile(
14864
- path13.join(rootDir, WORKSPACE_STATE_DIR, WORKSPACE_PULL_MANIFEST_FILE),
14886
+ path14.join(rootDir, WORKSPACE_STATE_DIR, WORKSPACE_PULL_MANIFEST_FILE),
14865
14887
  "utf-8"
14866
14888
  )
14867
14889
  );
@@ -14899,9 +14921,9 @@ function workspaceRawBaselineByPath(manifest2) {
14899
14921
  return new Map(manifest2.files.filter((file) => typeof file.fileId === "string" && file.fileId.trim().length > 0 && !isProtectedWorkspacePath(file.remotePath)).map((file) => [file.localPath, file]));
14900
14922
  }
14901
14923
  async function writeWorkspaceRawManifest(rootDir, manifest2) {
14902
- const stateDir = path13.join(rootDir, WORKSPACE_STATE_DIR);
14924
+ const stateDir = path14.join(rootDir, WORKSPACE_STATE_DIR);
14903
14925
  await fs12.mkdir(stateDir, { recursive: true });
14904
- const target = path13.join(stateDir, WORKSPACE_PULL_MANIFEST_FILE);
14926
+ const target = path14.join(stateDir, WORKSPACE_PULL_MANIFEST_FILE);
14905
14927
  const temporary = `${target}.${crypto.randomUUID()}.tmp`;
14906
14928
  try {
14907
14929
  await fs12.writeFile(temporary, JSON.stringify(manifest2, null, 2) + "\n", { encoding: "utf8", flag: "wx" });
@@ -14917,7 +14939,7 @@ async function readWorkspaceRawLocalFiles(rootDir) {
14917
14939
  return files;
14918
14940
  }
14919
14941
  async function walkWorkspaceRawFiles(rootDir, relativeDir, files) {
14920
- const absoluteDir = path13.join(rootDir, relativeDir);
14942
+ const absoluteDir = path14.join(rootDir, relativeDir);
14921
14943
  let entries;
14922
14944
  try {
14923
14945
  entries = await fs12.readdir(absoluteDir, { withFileTypes: true });
@@ -14929,8 +14951,8 @@ async function walkWorkspaceRawFiles(rootDir, relativeDir, files) {
14929
14951
  if (entry.isDirectory() && RAW_WORKSPACE_EXCLUDED_DIRS.has(entry.name)) continue;
14930
14952
  if (entry.isFile() && RAW_WORKSPACE_EXCLUDED_FILES.has(entry.name)) continue;
14931
14953
  if (!relativeDir && isProtectedWorkspacePath(entry.name)) continue;
14932
- const localPath = normalizeRelativePath(path13.posix.join(toPosix(relativeDir), entry.name));
14933
- const absolutePath = path13.join(rootDir, localPath);
14954
+ const localPath = normalizeRelativePath(path14.posix.join(toPosix(relativeDir), entry.name));
14955
+ const absolutePath = path14.join(rootDir, localPath);
14934
14956
  if (entry.isDirectory()) {
14935
14957
  await walkWorkspaceRawFiles(rootDir, localPath, files);
14936
14958
  continue;
@@ -15540,7 +15562,7 @@ function workspaceRawConflict(entry, reason) {
15540
15562
  };
15541
15563
  }
15542
15564
  async function discoverMiniApps(rootDir) {
15543
- const appsRoot = path13.join(rootDir, MINI_APPS_DIR);
15565
+ const appsRoot = path14.join(rootDir, MINI_APPS_DIR);
15544
15566
  let entries;
15545
15567
  try {
15546
15568
  entries = await fs12.readdir(appsRoot, { withFileTypes: true });
@@ -15548,7 +15570,7 @@ async function discoverMiniApps(rootDir) {
15548
15570
  if (e.code === "ENOENT") return [];
15549
15571
  throw e;
15550
15572
  }
15551
- return entries.filter((entry) => entry.isDirectory()).map((entry) => ({ appCode: entry.name, dir: path13.join(appsRoot, entry.name) })).sort((a, b) => a.appCode.localeCompare(b.appCode));
15573
+ return entries.filter((entry) => entry.isDirectory()).map((entry) => ({ appCode: entry.name, dir: path14.join(appsRoot, entry.name) })).sort((a, b) => a.appCode.localeCompare(b.appCode));
15552
15574
  }
15553
15575
  function detectRemoteMiniApps(files) {
15554
15576
  const appCodes = /* @__PURE__ */ new Set();
@@ -15733,7 +15755,7 @@ function normalizeWorkspaceKey(value) {
15733
15755
  return key2;
15734
15756
  }
15735
15757
  function normalizeWorkspaceRmPath(value) {
15736
- if (path13.isAbsolute(value) || /^[A-Za-z]:[\\/]/.test(value)) {
15758
+ if (path14.isAbsolute(value) || /^[A-Za-z]:[\\/]/.test(value)) {
15737
15759
  throw new Error("workspace rm path must be relative to the bound workspace");
15738
15760
  }
15739
15761
  const normalized = normalizeRelativePath(value);
@@ -15755,7 +15777,7 @@ function normalizeRelativePath(value) {
15755
15777
  return normalized;
15756
15778
  }
15757
15779
  function toPosix(value) {
15758
- return value.split(path13.sep).join("/");
15780
+ return value.split(path14.sep).join("/");
15759
15781
  }
15760
15782
  function sha2563(content) {
15761
15783
  return crypto.createHash("sha256").update(content, "utf-8").digest("hex");
@@ -16203,7 +16225,7 @@ async function workspaceDeactivateCommand(args) {
16203
16225
 
16204
16226
  // src/commands/identity.ts
16205
16227
  init_exit();
16206
- import axios5 from "axios";
16228
+ import axios6 from "axios";
16207
16229
  import {
16208
16230
  AUTH_INFO_PATH,
16209
16231
  CliError as CliError35,
@@ -16223,7 +16245,7 @@ import {
16223
16245
  toPrincipal
16224
16246
  } from "@hcmai/sdk";
16225
16247
  var fetchAuthInfo = async (endpoint, accessToken) => {
16226
- const response = await axios5.get(`${endpoint.replace(/\/$/, "")}${AUTH_INFO_PATH}`, {
16248
+ const response = await axios6.get(`${endpoint.replace(/\/$/, "")}${AUTH_INFO_PATH}`, {
16227
16249
  headers: { Authorization: `Bearer ${accessToken}` },
16228
16250
  timeout: 3e4
16229
16251
  });
@@ -16265,7 +16287,7 @@ async function identityShow(name, args) {
16265
16287
  const details = await inspectIdentity(name);
16266
16288
  return exitOk(formatObject28(details, { format: args.output ?? "json" }));
16267
16289
  } catch (e) {
16268
- exitWithError(axios5.isAxiosError(e) ? fromAxiosError30(e, name) : e);
16290
+ exitWithError(axios6.isAxiosError(e) ? fromAxiosError30(e, name) : e);
16269
16291
  }
16270
16292
  }
16271
16293
  async function identityList(args) {
@@ -16337,7 +16359,7 @@ async function identityRemove(name) {
16337
16359
  init_auth_guard();
16338
16360
  init_exit();
16339
16361
  import { promises as fs13 } from "fs";
16340
- import path14 from "path";
16362
+ import path15 from "path";
16341
16363
  import {
16342
16364
  CliError as CliError36,
16343
16365
  CliErrorCode as CliErrorCode36,
@@ -16398,7 +16420,7 @@ async function resolveInitEnv(root, args, deps) {
16398
16420
  };
16399
16421
  }
16400
16422
  const existing = await discoverProjectEnv5(root);
16401
- if (existing && path14.dirname(existing.path) === path14.resolve(root)) {
16423
+ if (existing && path15.dirname(existing.path) === path15.resolve(root)) {
16402
16424
  const name2 = args.env ?? existing.config.default;
16403
16425
  const env2 = existing.config.environments[name2];
16404
16426
  if (!env2) throw new CliError36({
@@ -16449,7 +16471,7 @@ ${explicitPaths}` }
16449
16471
  }
16450
16472
  async function scaffoldChironProject(root, env2, envName) {
16451
16473
  const result = { created: [], updated: [], preserved: [] };
16452
- const envFile = path14.join(root, ENV_FILE);
16474
+ const envFile = path15.join(root, ENV_FILE);
16453
16475
  const existing = await fs13.readFile(envFile, "utf8").catch(() => null);
16454
16476
  if (existing !== null) {
16455
16477
  const document2 = parseEnvYaml(existing);
@@ -16498,14 +16520,14 @@ async function scaffoldChironProject(root, env2, envName) {
16498
16520
  result.created.push(ENV_FILE);
16499
16521
  }
16500
16522
  for (const directory of CHIRON_PROJECT_DIRECTORIES) {
16501
- const absolute = path14.join(root, directory);
16523
+ const absolute = path15.join(root, directory);
16502
16524
  await ensureDirectory(absolute);
16503
- await writeIfAbsent(path14.join(absolute, ".gitkeep"), "", result, `${directory}/.gitkeep`);
16525
+ await writeIfAbsent(path15.join(absolute, ".gitkeep"), "", result, `${directory}/.gitkeep`);
16504
16526
  }
16505
16527
  return result;
16506
16528
  }
16507
16529
  async function runChironInit(args, deps = defaultChironInitDeps) {
16508
- const root = path14.resolve(args.project ?? ".");
16530
+ const root = path15.resolve(args.project ?? ".");
16509
16531
  const say = (line) => process.stderr.write(`[chiron init] ${line}
16510
16532
  `);
16511
16533
  const choice = await resolveInitEnv(root, args, deps);
@@ -18036,8 +18058,8 @@ async function gapVerifyCommand(ref, args, deps = defaultDeps) {
18036
18058
 
18037
18059
  // src/commands/chiron-doctor.ts
18038
18060
  import { promises as fs16 } from "fs";
18039
- import path18 from "path";
18040
- import axios10 from "axios";
18061
+ import path19 from "path";
18062
+ import axios11 from "axios";
18041
18063
  import {
18042
18064
  CliError as CliError44,
18043
18065
  CliErrorCode as CliErrorCode44,
@@ -18060,7 +18082,7 @@ init_auth_guard();
18060
18082
  // src/commands/chiron-env.ts
18061
18083
  init_exit();
18062
18084
  import { promises as fs14 } from "fs";
18063
- import path15 from "path";
18085
+ import path16 from "path";
18064
18086
  import yaml3 from "js-yaml";
18065
18087
  import {
18066
18088
  AUTH_INFO_PATH as AUTH_INFO_PATH2,
@@ -18210,9 +18232,9 @@ async function runChironEnv(action, args = {}) {
18210
18232
  if (args.output && !["table", "json", "yaml"].includes(args.output)) {
18211
18233
  invalid2(`\u672A\u77E5\u8F93\u51FA\u683C\u5F0F '${args.output}'\uFF0C\u914D\u7F6E\u672A\u5199\u5165\u3002`, "\u4F7F\u7528 --output table\u3001json \u6216 yaml");
18212
18234
  }
18213
- const root = path15.resolve(args.project ?? ".");
18235
+ const root = path16.resolve(args.project ?? ".");
18214
18236
  const discovered = await discoverProjectEnv6(root);
18215
- const file = discovered?.path ?? path15.join(root, ENV_FILE2);
18237
+ const file = discovered?.path ?? path16.join(root, ENV_FILE2);
18216
18238
  if (!discovered && action !== "add") invalid2(`\u6CA1\u6709\u627E\u5230 ${file}\u3002`, "\u8FDB\u5165\u987E\u95EE\u9879\u76EE\uFF0C\u6216\u8FD0\u884C hcm chiron env add <\u540D\u5B57> --endpoint <URL> --frontend <URL> --tenant <\u79DF\u6237>");
18217
18239
  const original = discovered ? await fs14.readFile(file, "utf8") : null;
18218
18240
  const config2 = original ? parseEnvYaml2(original) : { default: "", environments: {} };
@@ -18310,7 +18332,7 @@ import { promisify as promisify2 } from "util";
18310
18332
  import { createHash as createHash6 } from "crypto";
18311
18333
  import { existsSync as existsSync4, promises as fsp4 } from "fs";
18312
18334
  import os5 from "os";
18313
- import path16 from "path";
18335
+ import path17 from "path";
18314
18336
  import yaml4 from "js-yaml";
18315
18337
  import {
18316
18338
  CliError as CliError40,
@@ -18483,7 +18505,7 @@ function latestVersionTag(tags) {
18483
18505
  return [...tags.keys()].filter((t) => SEMVER_TAG.test(t)).sort(compareTags).pop();
18484
18506
  }
18485
18507
  async function listRemoteTags(deps) {
18486
- const context = await fsp4.mkdtemp(path16.join(os5.tmpdir(), "hcm-method-tags-"));
18508
+ const context = await fsp4.mkdtemp(path17.join(os5.tmpdir(), "hcm-method-tags-"));
18487
18509
  try {
18488
18510
  await deps.git(["init", "--quiet", context], { timeoutMs: 1e4 });
18489
18511
  await deps.git(["remote", "add", "origin", deps.repoUrl], { cwd: context, timeoutMs: 1e4 });
@@ -18634,10 +18656,10 @@ function parsePackageManifest(text2) {
18634
18656
  async function sha256File(file) {
18635
18657
  return createHash6("sha256").update(await fsp4.readFile(file)).digest("hex");
18636
18658
  }
18637
- async function verifyDigests(entries, resolve7) {
18659
+ async function verifyDigests(entries, resolve8) {
18638
18660
  const out = { files: entries.length, mismatched: [], missing: [] };
18639
18661
  for (const f of entries) {
18640
- const abs = resolve7(f.path);
18662
+ const abs = resolve8(f.path);
18641
18663
  if (!existsSync4(abs)) {
18642
18664
  out.missing.push(f.path);
18643
18665
  continue;
@@ -18651,7 +18673,7 @@ async function listFilesUnder(root, rel) {
18651
18673
  const walk = async (dirRel) => {
18652
18674
  let items;
18653
18675
  try {
18654
- items = await fsp4.readdir(path16.join(root, dirRel), { withFileTypes: true });
18676
+ items = await fsp4.readdir(path17.join(root, dirRel), { withFileTypes: true });
18655
18677
  } catch {
18656
18678
  return;
18657
18679
  }
@@ -18672,9 +18694,9 @@ var BLOCK_LABEL = {
18672
18694
  "online-catalog": "\u5728\u7EBF\u4EA7\u54C1\u76EE\u5F55"
18673
18695
  };
18674
18696
  var PROJECT_SKILL_STATE_FILES = [
18675
- path16.join(SKILLS_DIR, SKILLS_SYNC_SUBDIR, SKILLS_STATE_FILE),
18676
- path16.join(SKILLS_DIR, SKILLS_STATE_FILE),
18677
- path16.join(".claude", "skills", SKILLS_STATE_FILE)
18697
+ path17.join(SKILLS_DIR, SKILLS_SYNC_SUBDIR, SKILLS_STATE_FILE),
18698
+ path17.join(SKILLS_DIR, SKILLS_STATE_FILE),
18699
+ path17.join(".claude", "skills", SKILLS_STATE_FILE)
18678
18700
  ];
18679
18701
  async function onlineTargetFor(root) {
18680
18702
  try {
@@ -18714,7 +18736,7 @@ async function checkMethodConflicts(methodIds, root, online, deps) {
18714
18736
  const unreadable = [];
18715
18737
  const owners = /* @__PURE__ */ new Map();
18716
18738
  for (const rel of PROJECT_SKILL_STATE_FILES) {
18717
- const file = path16.join(root, rel);
18739
+ const file = path17.join(root, rel);
18718
18740
  if (!existsSync4(file)) continue;
18719
18741
  found2.push(rel);
18720
18742
  try {
@@ -18722,20 +18744,20 @@ async function checkMethodConflicts(methodIds, root, online, deps) {
18722
18744
  for (const [id, rec] of Object.entries(state.skills ?? {})) {
18723
18745
  if (!owners.has(id)) {
18724
18746
  const from = rec?.sourceKind === "cli" ? "CLI \u81EA\u5E26" : rec?.sourceKind === "local" ? "\u672C\u5730\u76EE\u5F55" : `\u4EA7\u54C1 ${state.endpoint ?? "\uFF08\u672A\u8BB0\u73AF\u5883\uFF09"}`;
18725
- owners.set(id, `\u672C\u9879\u76EE\u5DF2\u88C5\uFF08${rel.split(path16.sep).join("/")}\uFF0C\u6765\u6E90 ${from}\uFF09`);
18747
+ owners.set(id, `\u672C\u9879\u76EE\u5DF2\u88C5\uFF08${rel.split(path17.sep).join("/")}\uFF0C\u6765\u6E90 ${from}\uFF09`);
18726
18748
  }
18727
18749
  }
18728
18750
  } catch (e) {
18729
- unreadable.push(`${rel.split(path16.sep).join("/")}\uFF08${e.message.split("\n")[0]}\uFF09`);
18751
+ unreadable.push(`${rel.split(path17.sep).join("/")}\uFF08${e.message.split("\n")[0]}\uFF09`);
18730
18752
  }
18731
18753
  }
18732
18754
  if (found2.length === 0) {
18733
18755
  b.note = "\u672C\u9879\u76EE\u8FD8\u6CA1\u88C5\u4EA7\u54C1\u6280\u80FD\uFF0C\u4EA7\u54C1\u4FA7\u672A\u6BD4\u5BF9";
18734
18756
  } else if (owners.size === 0) {
18735
- b.note = unreadable.length ? `\u5B89\u88C5\u6E05\u5355\u8BFB\u4E0D\u61C2\uFF1A${unreadable.join("\uFF1B")}\uFF0C\u4EA7\u54C1\u4FA7\u672A\u6BD4\u5BF9` : `\u5B89\u88C5\u6E05\u5355\u5728\uFF08${found2.map((f) => f.split(path16.sep).join("/")).join("\u3001")}\uFF09\uFF0C\u4F46\u4E00\u6761\u8BB0\u5F55\u90FD\u6CA1\u6709\uFF0C\u7A7A\u96C6\u5408\u4E0A\u6BD4\u4E0D\u51FA\u300C\u65E0\u540C\u540D\u300D\uFF0C\u4EA7\u54C1\u4FA7\u672A\u6BD4\u5BF9`;
18757
+ b.note = unreadable.length ? `\u5B89\u88C5\u6E05\u5355\u8BFB\u4E0D\u61C2\uFF1A${unreadable.join("\uFF1B")}\uFF0C\u4EA7\u54C1\u4FA7\u672A\u6BD4\u5BF9` : `\u5B89\u88C5\u6E05\u5355\u5728\uFF08${found2.map((f) => f.split(path17.sep).join("/")).join("\u3001")}\uFF09\uFF0C\u4F46\u4E00\u6761\u8BB0\u5F55\u90FD\u6CA1\u6709\uFF0C\u7A7A\u96C6\u5408\u4E0A\u6BD4\u4E0D\u51FA\u300C\u65E0\u540C\u540D\u300D\uFF0C\u4EA7\u54C1\u4FA7\u672A\u6BD4\u5BF9`;
18736
18758
  } else {
18737
18759
  b.checked = true;
18738
- b.source = found2.map((f) => f.split(path16.sep).join("/")).join("\u3001");
18760
+ b.source = found2.map((f) => f.split(path17.sep).join("/")).join("\u3001");
18739
18761
  b.compared = [...owners.keys()].sort();
18740
18762
  b.conflicts = b.compared.filter((id) => wanted.has(id)).map((id) => ({ id, other: owners.get(id) }));
18741
18763
  if (unreadable.length) b.note = `\u53E6\u6709\u6E05\u5355\u8BFB\u4E0D\u61C2\u3001\u6CA1\u7B97\u8FDB\u6765\uFF1A${unreadable.join("\uFF1B")}`;
@@ -18855,7 +18877,7 @@ function renderLock(lock) {
18855
18877
  `;
18856
18878
  }
18857
18879
  async function readLock(root) {
18858
- const file = path16.join(root, METHOD_DIR, METHOD_LOCK_FILE);
18880
+ const file = path17.join(root, METHOD_DIR, METHOD_LOCK_FILE);
18859
18881
  let text2;
18860
18882
  try {
18861
18883
  text2 = await fsp4.readFile(file, "utf8");
@@ -18883,17 +18905,17 @@ async function readLock(root) {
18883
18905
  }
18884
18906
  async function readState(root) {
18885
18907
  try {
18886
- return JSON.parse(await fsp4.readFile(path16.join(root, METHOD_DIR, METHOD_STATE_FILE), "utf8"));
18908
+ return JSON.parse(await fsp4.readFile(path17.join(root, METHOD_DIR, METHOD_STATE_FILE), "utf8"));
18887
18909
  } catch {
18888
18910
  return void 0;
18889
18911
  }
18890
18912
  }
18891
18913
  async function resolveMethodRoot(project2, log) {
18892
- if (project2 !== void 0) return { root: path16.resolve(project2), rootSource: "--project" };
18914
+ if (project2 !== void 0) return { root: path17.resolve(project2), rootSource: "--project" };
18893
18915
  const cwd = process.cwd();
18894
18916
  try {
18895
18917
  const found2 = await discoverProjectEnv7(cwd);
18896
- if (found2) return { root: path16.dirname(found2.path), rootSource: "env.yaml" };
18918
+ if (found2) return { root: path17.dirname(found2.path), rootSource: "env.yaml" };
18897
18919
  } catch (e) {
18898
18920
  log(`env.yaml \u8BFB\u4E0D\u61C2\uFF08${e.message.split("\n")[0]}\uFF09\uFF0C\u4EE5\u5F53\u524D\u76EE\u5F55\u4E3A\u9879\u76EE\u6839\uFF1A${cwd}`);
18899
18921
  return { root: cwd, rootSource: "cwd" };
@@ -18907,13 +18929,13 @@ async function resolveTarget(root, requested) {
18907
18929
  return (await readState(root))?.target ?? await detectTarget(root) ?? "claude";
18908
18930
  }
18909
18931
  function skillFileSig(manifest2, skill) {
18910
- const dir = `${path16.posix.dirname(skill.path)}/`;
18932
+ const dir = `${path17.posix.dirname(skill.path)}/`;
18911
18933
  return manifest2.files.filter((f) => f.path.startsWith(dir)).map((f) => `${f.path}:${f.sha256}`).sort().join("\n");
18912
18934
  }
18913
18935
  async function readCriteria(dir) {
18914
18936
  let text2;
18915
18937
  try {
18916
- text2 = await fsp4.readFile(path16.join(dir, GATES_FILE), "utf8");
18938
+ text2 = await fsp4.readFile(path17.join(dir, GATES_FILE), "utf8");
18917
18939
  } catch {
18918
18940
  return { reason: `\u6CA1\u6709 ${GATES_FILE}` };
18919
18941
  }
@@ -18981,7 +19003,7 @@ async function step(deps, n, label, fn) {
18981
19003
  }
18982
19004
  async function readInstalledManifest(root) {
18983
19005
  try {
18984
- const text2 = await fsp4.readFile(path16.join(root, METHOD_DIR, "package.yml"), "utf8");
19006
+ const text2 = await fsp4.readFile(path17.join(root, METHOD_DIR, "package.yml"), "utf8");
18985
19007
  return { text: text2, manifest: parsePackageManifest(text2) };
18986
19008
  } catch {
18987
19009
  return void 0;
@@ -18990,31 +19012,31 @@ async function readInstalledManifest(root) {
18990
19012
  var sha256Text = (t) => createHash6("sha256").update(t, "utf8").digest("hex");
18991
19013
  async function hasClaudeCopies(root) {
18992
19014
  try {
18993
- return (await fsp4.readdir(path16.join(root, ".claude", "skills"), { withFileTypes: true })).some((it) => it.isDirectory() && it.name.startsWith(METHOD_SKILL_PREFIX));
19015
+ return (await fsp4.readdir(path17.join(root, ".claude", "skills"), { withFileTypes: true })).some((it) => it.isDirectory() && it.name.startsWith(METHOD_SKILL_PREFIX));
18994
19016
  } catch {
18995
19017
  return false;
18996
19018
  }
18997
19019
  }
18998
19020
  function codexAgentFiles(root) {
18999
- const files = [path16.join(root, "AGENTS.md")];
19000
- if (existsSync4(path16.join(root, "CLAUDE.md"))) files.push(path16.join(root, "CLAUDE.md"));
19021
+ const files = [path17.join(root, "AGENTS.md")];
19022
+ if (existsSync4(path17.join(root, "CLAUDE.md"))) files.push(path17.join(root, "CLAUDE.md"));
19001
19023
  return files;
19002
19024
  }
19003
19025
  async function installClaudeCopies(root, manifest2) {
19004
- const skillsRoot = path16.join(root, ".claude", "skills");
19026
+ const skillsRoot = path17.join(root, ".claude", "skills");
19005
19027
  await fsp4.mkdir(skillsRoot, { recursive: true });
19006
19028
  const ids = new Set(manifest2.skills.map((s) => s.id));
19007
19029
  const written = [];
19008
19030
  for (const s of manifest2.skills) {
19009
- const dst = path16.join(skillsRoot, s.id);
19031
+ const dst = path17.join(skillsRoot, s.id);
19010
19032
  await fsp4.rm(dst, { recursive: true, force: true });
19011
- await fsp4.cp(path16.join(root, METHOD_DIR, path16.dirname(s.path)), dst, { recursive: true });
19033
+ await fsp4.cp(path17.join(root, METHOD_DIR, path17.dirname(s.path)), dst, { recursive: true });
19012
19034
  written.push(`.claude/skills/${s.id}/`);
19013
19035
  }
19014
19036
  const pruned = [];
19015
19037
  for (const it of await fsp4.readdir(skillsRoot, { withFileTypes: true })) {
19016
19038
  if (it.isDirectory() && it.name.startsWith(METHOD_SKILL_PREFIX) && !ids.has(it.name)) {
19017
- await fsp4.rm(path16.join(skillsRoot, it.name), { recursive: true, force: true });
19039
+ await fsp4.rm(path17.join(skillsRoot, it.name), { recursive: true, force: true });
19018
19040
  pruned.push(`.claude/skills/${it.name}/`);
19019
19041
  }
19020
19042
  }
@@ -19023,14 +19045,14 @@ async function installClaudeCopies(root, manifest2) {
19023
19045
  async function indexEntries(root, agentsDir, manifest2) {
19024
19046
  const out = [];
19025
19047
  for (const s of manifest2.skills) {
19026
- const abs = path16.join(root, METHOD_DIR, s.path);
19048
+ const abs = path17.join(root, METHOD_DIR, s.path);
19027
19049
  let description = "";
19028
19050
  try {
19029
19051
  const fm = parseSkillFrontmatter3(await fsp4.readFile(abs, "utf8"), s.id);
19030
19052
  if (typeof fm.description === "string") description = fm.description.trim().replace(/\s+/g, " ");
19031
19053
  } catch {
19032
19054
  }
19033
- let rel = path16.relative(agentsDir, abs).split(path16.sep).join("/");
19055
+ let rel = path17.relative(agentsDir, abs).split(path17.sep).join("/");
19034
19056
  if (!rel.startsWith(".")) rel = `./${rel}`;
19035
19057
  out.push({ id: s.id, title: s.title, description, phases: s.phases, relativePath: rel });
19036
19058
  }
@@ -19053,9 +19075,9 @@ async function runMethodPipeline(input, deps) {
19053
19075
  deps.log(` ${r.ref} \u2192 ${r.commit.slice(0, 12)}`);
19054
19076
  return r;
19055
19077
  });
19056
- const work = await fsp4.mkdtemp(path16.join(os5.tmpdir(), "hcm-method-"));
19078
+ const work = await fsp4.mkdtemp(path17.join(os5.tmpdir(), "hcm-method-"));
19057
19079
  try {
19058
- const checkout = path16.join(work, "pkg");
19080
+ const checkout = path17.join(work, "pkg");
19059
19081
  const { manifest: manifest2, manifestText } = await step(deps, 2, "\u53D6\u5305\uFF08\u7A00\u758F\u6D45 clone\uFF09", async () => {
19060
19082
  await deps.git(["clone", "--depth", "1", "--filter=blob:none", "--sparse", "--quiet", "--branch", resolved.ref, deps.repoUrl, checkout]);
19061
19083
  const head = (await deps.git(["-C", checkout, "rev-parse", "HEAD"], { timeoutMs: 1e4 })).trim();
@@ -19068,7 +19090,7 @@ async function runMethodPipeline(input, deps) {
19068
19090
  }
19069
19091
  let text2;
19070
19092
  try {
19071
- text2 = await fsp4.readFile(path16.join(checkout, "package.yml"), "utf8");
19093
+ text2 = await fsp4.readFile(path17.join(checkout, "package.yml"), "utf8");
19072
19094
  } catch {
19073
19095
  throw invalidPackage("package.yml", `${resolved.ref} \u7684\u6839\u76EE\u5F55\u6CA1\u6709 package.yml\uFF08\u8FD9\u4E2A tag \u4E0D\u662F\u6309\u65B9\u6CD5\u5305\u6253\u7684\uFF09`);
19074
19096
  }
@@ -19079,11 +19101,11 @@ async function runMethodPipeline(input, deps) {
19079
19101
  });
19080
19102
  const unlisted = await step(deps, 3, "\u6821\u9A8C\u6E05\u5355\u4E0E\u6458\u8981", async () => {
19081
19103
  for (const [i, entry] of manifest2.include.entries()) {
19082
- if (!existsSync4(path16.join(checkout, entry.replace(/\/$/, "")))) {
19104
+ if (!existsSync4(path17.join(checkout, entry.replace(/\/$/, "")))) {
19083
19105
  throw invalidPackage(`include[${i}]`, `include \u767B\u8BB0\u4E86 ${entry}\uFF0C\u4F46 ${resolved.ref} \u91CC\u6CA1\u6709\u5B83`);
19084
19106
  }
19085
19107
  }
19086
- const check = await verifyDigests(manifest2.files, (p) => path16.join(checkout, p));
19108
+ const check = await verifyDigests(manifest2.files, (p) => path17.join(checkout, p));
19087
19109
  if (check.missing.length) {
19088
19110
  throw invalidPackage("files", `\u6E05\u5355\u767B\u8BB0\u4E86\u3001\u5305\u91CC\u5374\u6CA1\u6709\uFF1A${naming(check.missing)}`);
19089
19111
  }
@@ -19104,7 +19126,7 @@ async function runMethodPipeline(input, deps) {
19104
19126
  for (const l of renderConflictBlocks(blocks)) deps.log(l);
19105
19127
  return blocks;
19106
19128
  });
19107
- const diff = input.mode === "update" ? await diffPackages(before ? path16.join(root, METHOD_DIR) : void 0, before?.manifest, checkout, manifest2) : void 0;
19129
+ const diff = input.mode === "update" ? await diffPackages(before ? path17.join(root, METHOD_DIR) : void 0, before?.manifest, checkout, manifest2) : void 0;
19108
19130
  if (diff) for (const l of renderDiff(diff)) deps.log(` ${l}`);
19109
19131
  const lock = {
19110
19132
  lockVersion: 1,
@@ -19116,29 +19138,29 @@ async function runMethodPipeline(input, deps) {
19116
19138
  skills: manifest2.skills.map((s) => s.id)
19117
19139
  };
19118
19140
  const nowIso = deps.now().toISOString();
19119
- const gitignorePath = path16.join(root, ".gitignore");
19141
+ const gitignorePath = path17.join(root, ".gitignore");
19120
19142
  const agentTargets = input.target === "codex" ? codexAgentFiles(root) : [];
19121
19143
  const gitignore = await step(deps, 5, "\u9884\u68C0\u53D7\u7BA1\u5757\u5E76\u7EF4\u62A4 .gitignore", async () => {
19122
19144
  await preflightManaged([
19123
19145
  { file: gitignorePath, begin: GITIGNORE_BEGIN, end: GITIGNORE_END, label: ".gitignore" },
19124
- ...agentTargets.map((file) => ({ file, begin: AGENTS_METHOD_BEGIN, end: AGENTS_METHOD_END, label: path16.basename(file) }))
19146
+ ...agentTargets.map((file) => ({ file, begin: AGENTS_METHOD_BEGIN, end: AGENTS_METHOD_END, label: path17.basename(file) }))
19125
19147
  ]);
19126
19148
  return writeManaged(gitignorePath, GITIGNORE_BEGIN, GITIGNORE_END, renderGitignoreBlock(), ".gitignore");
19127
19149
  });
19128
19150
  await step(deps, 6, `\u66FF\u6362 ${METHOD_DIR}/ \u5E76\u5199\u9501\u6587\u4EF6`, async () => {
19129
- const targetDir = path16.join(root, METHOD_DIR);
19130
- const staging = path16.join(root, `.${METHOD_DIR}.staging-${process.pid}`);
19131
- const old = path16.join(root, `.${METHOD_DIR}.old-${process.pid}`);
19151
+ const targetDir = path17.join(root, METHOD_DIR);
19152
+ const staging = path17.join(root, `.${METHOD_DIR}.staging-${process.pid}`);
19153
+ const old = path17.join(root, `.${METHOD_DIR}.old-${process.pid}`);
19132
19154
  await fsp4.rm(staging, { recursive: true, force: true });
19133
19155
  try {
19134
19156
  await fsp4.mkdir(staging, { recursive: true });
19135
19157
  for (const entry of manifest2.include) {
19136
19158
  const rel = entry.replace(/\/$/, "");
19137
- await fsp4.cp(path16.join(checkout, rel), path16.join(staging, rel), { recursive: true });
19159
+ await fsp4.cp(path17.join(checkout, rel), path17.join(staging, rel), { recursive: true });
19138
19160
  }
19139
- await fsp4.writeFile(path16.join(staging, METHOD_LOCK_FILE), renderLock(lock), "utf8");
19161
+ await fsp4.writeFile(path17.join(staging, METHOD_LOCK_FILE), renderLock(lock), "utf8");
19140
19162
  const state = { target: input.target, installedAt: nowIso, remoteCheckedAt: nowIso };
19141
- await fsp4.writeFile(path16.join(staging, METHOD_STATE_FILE), `${JSON.stringify(state, null, 2)}
19163
+ await fsp4.writeFile(path17.join(staging, METHOD_STATE_FILE), `${JSON.stringify(state, null, 2)}
19142
19164
  `, "utf8");
19143
19165
  const hadOld = existsSync4(targetDir);
19144
19166
  if (hadOld) {
@@ -19162,8 +19184,8 @@ async function runMethodPipeline(input, deps) {
19162
19184
  const refreshCopies = input.target === "claude" || await hasClaudeCopies(root);
19163
19185
  if (refreshCopies) copies = await installClaudeCopies(root, manifest2);
19164
19186
  for (const file of agentTargets) {
19165
- const block = renderMethodAgentsBlock(lock, await indexEntries(root, path16.dirname(file), manifest2));
19166
- files.push({ file: path16.relative(root, file), status: await writeManaged(file, AGENTS_METHOD_BEGIN, AGENTS_METHOD_END, block, path16.basename(file)) });
19187
+ const block = renderMethodAgentsBlock(lock, await indexEntries(root, path17.dirname(file), manifest2));
19188
+ files.push({ file: path17.relative(root, file), status: await writeManaged(file, AGENTS_METHOD_BEGIN, AGENTS_METHOD_END, block, path17.basename(file)) });
19167
19189
  }
19168
19190
  return { files, copies };
19169
19191
  });
@@ -19199,7 +19221,7 @@ async function runMethodPipeline(input, deps) {
19199
19221
  function renderInstallReport(r) {
19200
19222
  const out = [];
19201
19223
  const verb = r.mode === "update" ? "\u5DF2\u66F4\u65B0\u5230" : "\u5DF2\u88C5";
19202
- out.push(`${verb}\u65B9\u6CD5 ${r.package.version}\uFF08${r.ref} @ ${r.commit.slice(0, 12)}\uFF09\u2192 ${path16.join(r.root, METHOD_DIR)}/`);
19224
+ out.push(`${verb}\u65B9\u6CD5 ${r.package.version}\uFF08${r.ref} @ ${r.commit.slice(0, 12)}\uFF09\u2192 ${path17.join(r.root, METHOD_DIR)}/`);
19203
19225
  if (r.previous && r.previous.commit !== r.commit) out.push(` \u9501\u6587\u4EF6\uFF1A${r.previous.ref} @ ${r.previous.commit.slice(0, 12)} \u2192 ${r.ref} @ ${r.commit.slice(0, 12)}`);
19204
19226
  out.push(` \u6280\u80FD ${r.skills.length} \u4EFD\uFF1A${naming(r.skills, 6)}`);
19205
19227
  if (r.diff) for (const l of renderDiff(r.diff)) out.push(` ${l}`);
@@ -19247,7 +19269,7 @@ async function runMethodStatus(root, deps, opts = {}) {
19247
19269
  report.lock = lock;
19248
19270
  report.rows.push({ item: "\u9501\u5B9A", verdict: "ok", detail: `\u65B9\u6CD5 ${lock.package.version} \xB7 ${lock.ref} @ ${lock.commit.slice(0, 12)}\uFF08${lock.skills.length} \u4EFD\u6280\u80FD\uFF09` });
19249
19271
  const state = await readState(root);
19250
- const installed2 = await fsp4.readFile(path16.join(root, METHOD_DIR, "package.yml"), "utf8").catch(() => void 0);
19272
+ const installed2 = await fsp4.readFile(path17.join(root, METHOD_DIR, "package.yml"), "utf8").catch(() => void 0);
19251
19273
  if (installed2 === void 0) {
19252
19274
  report.rows.push({
19253
19275
  item: "\u5B89\u88C5",
@@ -19268,7 +19290,7 @@ async function runMethodStatus(root, deps, opts = {}) {
19268
19290
  code: CliErrorCode41.METHOD_DIGEST_MISMATCH
19269
19291
  });
19270
19292
  } else {
19271
- report.rows.push({ item: "\u5B89\u88C5", verdict: "ok", detail: `\u672C\u673A\u526F\u672C\u5C31\u662F\u9501\u5B9A\u7684\u90A3\u4E00\u7248\uFF08${path16.join(root, METHOD_DIR)}/\uFF09` });
19293
+ report.rows.push({ item: "\u5B89\u88C5", verdict: "ok", detail: `\u672C\u673A\u526F\u672C\u5C31\u662F\u9501\u5B9A\u7684\u90A3\u4E00\u7248\uFF08${path17.join(root, METHOD_DIR)}/\uFF09` });
19272
19294
  let manifest2;
19273
19295
  try {
19274
19296
  manifest2 = parsePackageManifest(installed2);
@@ -19276,17 +19298,17 @@ async function runMethodStatus(root, deps, opts = {}) {
19276
19298
  report.digest.note = `\u672C\u673A package.yml \u8BFB\u4E0D\u61C2\uFF1A${e.message}`;
19277
19299
  }
19278
19300
  if (manifest2) {
19279
- const main2 = await verifyDigests(manifest2.files, (p) => path16.join(root, METHOD_DIR, p));
19301
+ const main2 = await verifyDigests(manifest2.files, (p) => path17.join(root, METHOD_DIR, p));
19280
19302
  const copyEntries = [];
19281
19303
  const copyMap = /* @__PURE__ */ new Map();
19282
19304
  for (const s of manifest2.skills) {
19283
- const copyDir = path16.join(root, ".claude", "skills", s.id);
19305
+ const copyDir = path17.join(root, ".claude", "skills", s.id);
19284
19306
  if (!existsSync4(copyDir) && state?.target !== "claude") continue;
19285
- const prefix = `${path16.posix.dirname(s.path)}/`;
19307
+ const prefix = `${path17.posix.dirname(s.path)}/`;
19286
19308
  for (const f of manifest2.files.filter((x) => x.path.startsWith(prefix))) {
19287
19309
  const shown = `.claude/skills/${s.id}/${f.path.slice(prefix.length)}`;
19288
19310
  copyEntries.push({ ...f, path: shown });
19289
- copyMap.set(shown, path16.join(root, shown));
19311
+ copyMap.set(shown, path17.join(root, shown));
19290
19312
  }
19291
19313
  }
19292
19314
  const copies = await verifyDigests(copyEntries, (p) => copyMap.get(p));
@@ -19369,8 +19391,8 @@ async function runMethodStatus(root, deps, opts = {}) {
19369
19391
  });
19370
19392
  }
19371
19393
  for (const id of lock.skills) {
19372
- const by = path16.join(SKILLS_DIR, SKILLS_LOCAL_SUBDIR, id);
19373
- if (existsSync4(path16.join(root, by, "SKILL.md"))) report.shadowed.push({ id, by: `${by.split(path16.sep).join("/")}/` });
19394
+ const by = path17.join(SKILLS_DIR, SKILLS_LOCAL_SUBDIR, id);
19395
+ if (existsSync4(path17.join(root, by, "SKILL.md"))) report.shadowed.push({ id, by: `${by.split(path17.sep).join("/")}/` });
19374
19396
  }
19375
19397
  report.rows.push(report.shadowed.length ? {
19376
19398
  item: "\u906E\u853D",
@@ -19390,7 +19412,7 @@ async function runMethodStatus(root, deps, opts = {}) {
19390
19412
  }
19391
19413
  function renderMethodStatus(r) {
19392
19414
  const mark = { ok: "\u2705", warn: "\u26A0\uFE0F", fail: "\u274C" };
19393
- const out = [`\u65B9\u6CD5\u5305\uFF1A${path16.join(r.root, METHOD_DIR)}/`];
19415
+ const out = [`\u65B9\u6CD5\u5305\uFF1A${path17.join(r.root, METHOD_DIR)}/`];
19394
19416
  for (const row of r.rows) {
19395
19417
  out.push(`${mark[row.verdict]} ${row.item} ${row.detail}`);
19396
19418
  if (row.nextStep && row.verdict !== "ok") out.push(` \u2192 ${row.nextStep}`);
@@ -19489,8 +19511,8 @@ async function methodStatusCommand(args) {
19489
19511
 
19490
19512
  // src/commands/doctor/local-checks.ts
19491
19513
  import { promises as fs15 } from "fs";
19492
- import path17 from "path";
19493
- import axios6 from "axios";
19514
+ import path18 from "path";
19515
+ import axios7 from "axios";
19494
19516
  import { CliError as CliError41, CliErrorCode as CliErrorCode42, fetchSkillCatalog as fetchSkillCatalog3, fetchSkillMarkdown as fetchSkillMarkdown2, fetchSkillReference as fetchSkillReference2, normalizeReferences as normalizeReferences2, normalizeOrigin as normalizeOrigin6, resolveChironBase as resolveChironBase3 } from "@hcmai/sdk";
19495
19517
 
19496
19518
  // src/commands/doctor/result.ts
@@ -19606,13 +19628,13 @@ var version = async (ctx) => {
19606
19628
  var installed = async (ctx) => {
19607
19629
  let reading = "";
19608
19630
  const read = (baseDir) => {
19609
- reading = path17.join(baseDir, SKILLS_STATE_FILE);
19631
+ reading = path18.join(baseDir, SKILLS_STATE_FILE);
19610
19632
  return readSkillsState(baseDir, { strict: true });
19611
19633
  };
19612
19634
  try {
19613
19635
  const states = [];
19614
19636
  for (const [target2, folder] of [["codex", "hcm-skills/sync"], ["claude", ".claude/skills"]]) {
19615
- const baseDir = path17.join(ctx.root, folder);
19637
+ const baseDir = path18.join(ctx.root, folder);
19616
19638
  const state = await read(baseDir);
19617
19639
  if (state) states.push({ target: target2, baseDir, state });
19618
19640
  }
@@ -19625,16 +19647,16 @@ var installed = async (ctx) => {
19625
19647
  local = await readLocalSkills(localDir, { strict: true });
19626
19648
  } catch (error) {
19627
19649
  if (!(error instanceof SkillsDirUnreadable)) throw error;
19628
- return unknown("SKILLS_LOCAL_UNREADABLE", `${path17.relative(ctx.root, localDir)} \u8BFB\u4E0D\u4E86\uFF0C\u81EA\u5199\u6280\u80FD\u6570\u4E0D\u51FA\u6765\uFF1B${unreadableFix(error.code, error.detail)}\u540E\u91CD\u67E5`, {
19650
+ return unknown("SKILLS_LOCAL_UNREADABLE", `${path18.relative(ctx.root, localDir)} \u8BFB\u4E0D\u4E86\uFF0C\u81EA\u5199\u6280\u80FD\u6570\u4E0D\u51FA\u6765\uFF1B${unreadableFix(error.code, error.detail)}\u540E\u91CD\u67E5`, {
19629
19651
  note: `${error.where}\uFF1A${error.detail}`
19630
19652
  });
19631
19653
  }
19632
- const localNote = local.length > 0 ? `\uFF1B${path17.relative(ctx.root, localDir)}/ \u53E6\u6709 ${local.length} \u4EFD\u81EA\u5199\u6280\u80FD\uFF08\u4E0D\u8FDB\u9501\u6587\u4EF6\uFF0Csync \u4E0D\u7BA1\u5B83\u4EEC\uFF09` : "";
19654
+ const localNote = local.length > 0 ? `\uFF1B${path18.relative(ctx.root, localDir)}/ \u53E6\u6709 ${local.length} \u4EFD\u81EA\u5199\u6280\u80FD\uFF08\u4E0D\u8FDB\u9501\u6587\u4EF6\uFF0Csync \u4E0D\u7BA1\u5B83\u4EEC\uFF09` : "";
19633
19655
  const target = ctx.environments.find((e) => e.report.target);
19634
19656
  if (states.some((s) => s.state.endpoint && normalizeOrigin6(s.state.endpoint) !== normalizeOrigin6(target.config.endpoint)))
19635
19657
  return found("SKILLS_ENDPOINT_MISMATCH", void 0, { value: count });
19636
19658
  if (count === 0) {
19637
- const legacy = await read(path17.join(ctx.root, "hcm-skills"));
19659
+ const legacy = await read(path18.join(ctx.root, "hcm-skills"));
19638
19660
  if (legacy && Object.keys(legacy.skills).length > 0) return found("SKILLS_LEGACY_LAYOUT", void 0, { value: count, evidence: "ABSENT" });
19639
19661
  if (local.length > 0) {
19640
19662
  return pass(
@@ -19647,7 +19669,7 @@ var installed = async (ctx) => {
19647
19669
  if (states.length === 2 && keys(states[0]).length > 0 && keys(states[1]).length > 0 && keys(states[0]).sort().join("\0") !== keys(states[1]).sort().join("\0"))
19648
19670
  return found("SKILLS_SPLIT_LAYOUT", void 0, { value: count });
19649
19671
  return pass(
19650
- `${count} \u4E2A\u4EA7\u54C1\u6280\u80FD\uFF08\u4E24\u4EFD\u9501\u6587\u4EF6 skills \u952E\u7684\u5E76\u96C6\uFF09\uFF1B${states.map((s) => path17.relative(ctx.root, s.baseDir)).join("\u3001")}${localNote}`,
19672
+ `${count} \u4E2A\u4EA7\u54C1\u6280\u80FD\uFF08\u4E24\u4EFD\u9501\u6587\u4EF6 skills \u952E\u7684\u5E76\u96C6\uFF09\uFF1B${states.map((s) => path18.relative(ctx.root, s.baseDir)).join("\u3001")}${localNote}`,
19651
19673
  { value: count + local.length }
19652
19674
  );
19653
19675
  } catch (error) {
@@ -19665,7 +19687,7 @@ function hasProductSkills(states) {
19665
19687
  }
19666
19688
  async function inspectSkillsFresh(states, endpoint, signal) {
19667
19689
  if (!hasProductSkills(states)) return { level: "NOT_APPLICABLE", summary: NO_PRODUCT_SKILLS, note: "\u672A\u8BF7\u6C42\u6280\u80FD\u76EE\u5F55" };
19668
- const http = axios6.create({
19690
+ const http = axios7.create({
19669
19691
  baseURL: endpoint,
19670
19692
  timeout: 5e3,
19671
19693
  maxRedirects: 0,
@@ -19732,7 +19754,7 @@ var boundary = async (ctx) => {
19732
19754
  for (const name of ["AGENTS.md", "CLAUDE.md"]) {
19733
19755
  let text2;
19734
19756
  try {
19735
- text2 = await fs15.readFile(path17.join(ctx.root, name), "utf8");
19757
+ text2 = await fs15.readFile(path18.join(ctx.root, name), "utf8");
19736
19758
  } catch (error) {
19737
19759
  if (error.code === "ENOENT") continue;
19738
19760
  throw error;
@@ -19808,7 +19830,7 @@ var shadow = async (ctx) => {
19808
19830
  const localDir = skillsLocalDir(ctx.root);
19809
19831
  const undetermined = (error) => {
19810
19832
  const u = error instanceof SkillsDirUnreadable ? error : void 0;
19811
- const where = u ? path17.relative(ctx.root, u.where) : path17.relative(ctx.root, localDir);
19833
+ const where = u ? path18.relative(ctx.root, u.where) : path18.relative(ctx.root, localDir);
19812
19834
  const detail = u ? safeError(new Error(u.detail)) : safeError(error);
19813
19835
  return { summary: `${unreadableSideLabel(u?.side)}${u?.id ? ` \u91CC\u7684 ${u.id}` : ""} \u8BFB\u4E0D\u4E86`, note: `${where}\uFF1A${detail}`, fix: unreadableFix(u?.code, u?.detail ?? detail) };
19814
19836
  };
@@ -19821,7 +19843,7 @@ var shadow = async (ctx) => {
19821
19843
  }
19822
19844
  let c2;
19823
19845
  try {
19824
- c2 = await listClaudeShadowedSkills(path17.join(ctx.root, ".claude", "skills"), localDir);
19846
+ c2 = await listClaudeShadowedSkills(path18.join(ctx.root, ".claude", "skills"), localDir);
19825
19847
  } catch (error) {
19826
19848
  const x = undetermined(error);
19827
19849
  if (!r.shadowed.length) return unknown("SKILLS_LOCAL_UNREADABLE", `${x.summary}\uFF0C\u6CA1\u6CD5\u5224\u6709\u6CA1\u6709\u906E\u853D\u4EA7\u54C1\u6280\u80FD\uFF1B${x.fix}\u540E\u91CD\u67E5`, { note: x.note });
@@ -19834,7 +19856,7 @@ var shadow = async (ctx) => {
19834
19856
  const others = [[r, "sync/"], [c2, CLAUDE_SKILLS_DIR_LABEL]];
19835
19857
  const othersText = others.filter(([x]) => x.unreadable.length).map(([x, label]) => `\uFF1B${label} \u53E6\u6709 ${x.unreadable.length} \u6761\u8BFB\u4E0D\u4E86\u3001\u6CA1\u7B97\u8FDB\u53BB\uFF1A${describeUnreadable(x.unreadable)}`).join("");
19836
19858
  const unreadable = [...r.unreadable, ...c2.unreadable];
19837
- const raw = unreadable.map((x) => `${path17.relative(ctx.root, x.where)}\uFF1A${safeError(new Error(x.detail))}`).join("\uFF1B");
19859
+ const raw = unreadable.map((x) => `${path18.relative(ctx.root, x.where)}\uFF1A${safeError(new Error(x.detail))}`).join("\uFF1B");
19838
19860
  if (r.shadowed.length || c2.shadowed.length) {
19839
19861
  const parts = [];
19840
19862
  if (r.shadowed.length) parts.push(`${SKILLS_DIR}/${SKILLS_LOCAL_SUBDIR}/ \u906E\u853D\u4E86 ${r.shadowed.length} \u4EFD\u4EA7\u54C1\u6280\u80FD\uFF1A${describeShadows(r.shadowed)}`);
@@ -19869,11 +19891,11 @@ var localChecks = { project, credential, version, installed, fresh, shadow, boun
19869
19891
 
19870
19892
  // src/commands/doctor/connect-checks.ts
19871
19893
  init_auth_guard();
19872
- import axios8 from "axios";
19894
+ import axios9 from "axios";
19873
19895
  import { CliError as CliError42, IMPERSONATION_START_PATH, USER_LOOKUP_PATH, probeDoctorEndpoint, probeDoctorLayer, layerDetail, toPrincipal as toPrincipal3 } from "@hcmai/sdk";
19874
19896
 
19875
19897
  // src/commands/doctor/server-report.ts
19876
- import axios7 from "axios";
19898
+ import axios8 from "axios";
19877
19899
  import { classifyStatus } from "@hcmai/sdk";
19878
19900
  var optionalText2 = (value) => value === void 0 || value === null || typeof value === "string";
19879
19901
  var fullScope = { stage: null, only: [], skip: [], active: false };
@@ -19907,7 +19929,7 @@ var requestServerReport = async (endpoint, token, timeoutMs, budgetMs, signal, s
19907
19929
  ...scope.only.length ? { only: scope.only.join(",") } : {},
19908
19930
  ...scope.skip.length ? { skip: scope.skip.join(",") } : {}
19909
19931
  };
19910
- const res = scope.active ? await axios7.post("/api/system/health/report", { active: true, budgetMs, ...range }, options) : await axios7.get("/api/system/health/report", { ...options, params: { budgetMs, ...range } });
19932
+ const res = scope.active ? await axios8.post("/api/system/health/report", { active: true, budgetMs, ...range }, options) : await axios8.get("/api/system/health/report", { ...options, params: { budgetMs, ...range } });
19911
19933
  return {
19912
19934
  status: res.status,
19913
19935
  body: res.data,
@@ -19916,7 +19938,7 @@ var requestServerReport = async (endpoint, token, timeoutMs, budgetMs, signal, s
19916
19938
  };
19917
19939
  };
19918
19940
  function stoppedWaiting(error, signal) {
19919
- return signal.aborted || axios7.isAxiosError(error) && error.code === "ECONNABORTED";
19941
+ return signal.aborted || axios8.isAxiosError(error) && error.code === "ECONNABORTED";
19920
19942
  }
19921
19943
  function httpNote(out) {
19922
19944
  return `HTTP ${out.status < 0 ? "\u672A\u53D6\u5F97\u54CD\u5E94" : out.status}${out.headers["x-trace-id"] ? ` \xB7 traceId=${out.headers["x-trace-id"]}` : ""}`;
@@ -20257,11 +20279,11 @@ var identity = async (ctx, env2, execution) => {
20257
20279
  const code3 = detail.mismatch === "tenant" ? "TENANT_MISMATCH" : "IDENTITY_USER_MISMATCH";
20258
20280
  return found(code3, void 0, { note: `\u4EE3\u7406\u524D\u6838\u9A8C\u64CD\u4F5C\u8005\u65F6\u53D1\u73B0\u4E3B\u4F53\u4E0D\u7B26\uFF1A${safeError(error)}` });
20259
20281
  }
20260
- const status = axios8.isAxiosError(error) ? error.response?.status : void 0;
20261
- const requestPath = axios8.isAxiosError(error) ? error.config?.url ?? "" : "";
20282
+ const status = axios9.isAxiosError(error) ? error.response?.status : void 0;
20283
+ const requestPath = axios9.isAxiosError(error) ? error.config?.url ?? "" : "";
20262
20284
  const proxyStart = requestPath.endsWith(IMPERSONATION_START_PATH);
20263
20285
  const userLookup = requestPath.endsWith(USER_LOOKUP_PATH);
20264
- const envelope = axios8.isAxiosError(error) && obj(error.response?.data) && obj(error.response.data.error) ? error.response.data.error : void 0;
20286
+ const envelope = axios9.isAxiosError(error) && obj(error.response?.data) && obj(error.response.data.error) ? error.response.data.error : void 0;
20265
20287
  const targetMissing = status === 404 && proxyStart && envelope?.code === "NOT_FOUND";
20266
20288
  const targetAdvice = envelope?.details === "\u76EE\u6807\u7528\u6237\u4E0D\u5B58\u5728" ? "\u670D\u52A1\u7AEF\uFF1A\u76EE\u6807\u7528\u6237\u4E0D\u5B58\u5728\uFF1B\u6838\u5BF9\u5F53\u524D\u79DF\u6237\u4E0E\u76EE\u6807\u7528\u6237 UUID" : "\u670D\u52A1\u7AEF\u56DE 404 NOT_FOUND\uFF0C\u672A\u6307\u660E\u76EE\u6807\u7528\u6237\u4E0D\u5B58\u5728\uFF08\u4E5F\u53EF\u80FD\u662F\u540E\u7AEF\u6CA1\u6709\u4EE3\u7406\u63A5\u53E3\uFF09\uFF1B\u6838\u5BF9\u5F53\u524D\u79DF\u6237\u4E0E\u76EE\u6807\u7528\u6237 UUID\uFF0C\u5E76\u6838\u540E\u7AEF\u7248\u672C";
20267
20289
  const code2 = status === 403 || targetMissing || errorCode && ["SCOPE_FORBIDDEN", "IDENTITY_NOT_FOUND", "INVALID_ARGUMENT", "IDENTITY_NOT_IN_ENV", "IDENTITY_META_INCOMPLETE"].includes(errorCode) ? "AS_PROXY_DENIED" : errorCode === "AUTH_FAILED" ? "IDENTITY_NOT_LOGGED_IN" : status === 401 ? "TOKEN_REJECTED" : "IDENTITY_UNVERIFIED";
@@ -20557,8 +20579,8 @@ async function executeChecks(ctx, options = {}) {
20557
20579
  let timer;
20558
20580
  let proxy = false;
20559
20581
  let expire;
20560
- const timeout = new Promise((resolve7) => {
20561
- expire = resolve7;
20582
+ const timeout = new Promise((resolve8) => {
20583
+ expire = resolve8;
20562
20584
  });
20563
20585
  const arm = (ms) => {
20564
20586
  clearTimeout(timer);
@@ -20867,7 +20889,7 @@ function renderChironDoctor(report) {
20867
20889
 
20868
20890
  // src/commands/doctor/platform-ops.ts
20869
20891
  import { createHash as createHash8 } from "crypto";
20870
- import axios9 from "axios";
20892
+ import axios10 from "axios";
20871
20893
  import {
20872
20894
  classifyStatus as classifyStatus2,
20873
20895
  CliError as CliError43,
@@ -20937,7 +20959,7 @@ var placeholder = {
20937
20959
  };
20938
20960
  var OPS_DESCRIPTORS = [connectivity2, api, placeholder];
20939
20961
  var requestOpsReport = async (endpoint, key2, timeoutMs, budgetMs, signal, scope) => {
20940
- const res = await axios9.get(OPS_PATH, {
20962
+ const res = await axios10.get(OPS_PATH, {
20941
20963
  baseURL: endpoint,
20942
20964
  timeout: timeoutMs,
20943
20965
  signal,
@@ -21508,7 +21530,7 @@ var defaultServices = {
21508
21530
  pendingVerify: async (signal) => gapPendingVerify({ client: await createJiraClient2({ timeoutMs: 8e3 }) }, { signal }),
21509
21531
  skillsFresh: inspectSkillsFresh,
21510
21532
  asAuth: (...args) => ensureAsAuth(...args),
21511
- probe: (endpoint, token, signal) => httpProbe2(axios10.create({
21533
+ probe: (endpoint, token, signal) => httpProbe2(axios11.create({
21512
21534
  baseURL: endpoint,
21513
21535
  timeout: 5e3,
21514
21536
  maxRedirects: 0,
@@ -21611,11 +21633,11 @@ async function readCredential(envFlag, root, as) {
21611
21633
  return { resolved, identity: identity3, meta: meta2, token };
21612
21634
  }
21613
21635
  async function prepareContext(args, deps) {
21614
- const startedAt = Date.now(), root = path18.resolve(args.project ?? ".");
21636
+ const startedAt = Date.now(), root = path19.resolve(args.project ?? ".");
21615
21637
  let file;
21616
21638
  let projectObservation = found("ENV_FILE_MISSING", void 0, { evidence: "ABSENT" });
21617
21639
  try {
21618
- const text2 = await fs16.readFile(path18.join(root, "env.yaml"), "utf8");
21640
+ const text2 = await fs16.readFile(path19.join(root, "env.yaml"), "utf8");
21619
21641
  try {
21620
21642
  file = parseEnvYaml3(text2);
21621
21643
  projectObservation = pass("env.yaml \u53EF\u89E3\u6790");
@@ -21631,7 +21653,7 @@ async function prepareContext(args, deps) {
21631
21653
  if (args.env && (!file || !Object.hasOwn(file.environments, args.env))) {
21632
21654
  try {
21633
21655
  const resolved = await resolveEnvContext9({ envFlag: args.env, cwd: root }, process.env, await loadGlobalConfig12());
21634
- if (resolved.project?.path !== path18.join(root, "env.yaml")) throw new Error("\u672C\u673A\u69FD\u4E0D\u5C5E\u4E8E\u5F53\u524D\u9879\u76EE");
21656
+ if (resolved.project?.path !== path19.join(root, "env.yaml")) throw new Error("\u672C\u673A\u69FD\u4E0D\u5C5E\u4E8E\u5F53\u524D\u9879\u76EE");
21635
21657
  targetEnv = resolved.project.name;
21636
21658
  explicitSlot = resolved.name;
21637
21659
  } catch (error) {
@@ -21849,7 +21871,7 @@ import { spawnSync } from "child_process";
21849
21871
  import { accessSync, constants, readdirSync as readdirSync3 } from "fs";
21850
21872
  import fs17 from "fs/promises";
21851
21873
  import os6 from "os";
21852
- import path20 from "path";
21874
+ import path21 from "path";
21853
21875
  import { CliError as CliError47, CliErrorCode as CliErrorCode47, formatObject as formatObject34, HcmClient as HcmClient30, loadEnv as loadEnv6 } from "@hcmai/sdk";
21854
21876
  import { createRequire } from "module";
21855
21877
 
@@ -21916,8 +21938,8 @@ var CdpSession = class {
21916
21938
  send(method3, params = {}) {
21917
21939
  if (this.closed) return Promise.reject(new Error(`CDP socket \u5DF2\u5173\u95ED\uFF0C\u53D1\u4E0D\u4E86 ${method3}`));
21918
21940
  const id = this.nextId++;
21919
- return new Promise((resolve7, reject) => {
21920
- this.pending.set(id, { resolve: resolve7, reject, method: method3 });
21941
+ return new Promise((resolve8, reject) => {
21942
+ this.pending.set(id, { resolve: resolve8, reject, method: method3 });
21921
21943
  this.socket.send(JSON.stringify({ id, method: method3, params }));
21922
21944
  });
21923
21945
  }
@@ -21937,11 +21959,11 @@ var CdpSession = class {
21937
21959
  }
21938
21960
  /** 等一个事件,超时就 reject——「等 load 事件」不能无限等。无论哪种结束都摘掉监听器。 */
21939
21961
  waitFor(event, timeoutMs) {
21940
- return new Promise((resolve7, reject) => {
21962
+ return new Promise((resolve8, reject) => {
21941
21963
  const off = this.on(event, (params) => {
21942
21964
  clearTimeout(timer);
21943
21965
  off();
21944
- resolve7(params);
21966
+ resolve8(params);
21945
21967
  });
21946
21968
  const timer = setTimeout(() => {
21947
21969
  off();
@@ -22055,7 +22077,7 @@ var defaultCdpIo = {
22055
22077
  const text2 = await res.text();
22056
22078
  return text2 ? JSON.parse(text2) : null;
22057
22079
  },
22058
- openSocket: (wsUrl) => new Promise((resolve7, reject) => {
22080
+ openSocket: (wsUrl) => new Promise((resolve8, reject) => {
22059
22081
  const Ctor = globalThis.WebSocket;
22060
22082
  if (!Ctor) {
22061
22083
  reject(new CliError45({ code: CliErrorCode45.SERVER_ERROR, message: "\u8FD9\u4E2A Node \u6CA1\u6709\u5168\u5C40 WebSocket\uFF08\u9700\u8981 Node \u2265 22.4\uFF1B22.0\u201322.3 \u8981\u52A0 --experimental-websocket\uFF09" }));
@@ -22065,7 +22087,7 @@ var defaultCdpIo = {
22065
22087
  const timer = setTimeout(() => reject(new Error(`\u8FDE ${wsUrl} \u8D85\u8FC7 ${CDP_IO_TIMEOUT_MS}ms \u6CA1\u63E1\u4E0A\u624B`)), CDP_IO_TIMEOUT_MS);
22066
22088
  ws.addEventListener("open", () => {
22067
22089
  clearTimeout(timer);
22068
- resolve7(ws);
22090
+ resolve8(ws);
22069
22091
  });
22070
22092
  ws.addEventListener("error", (ev) => {
22071
22093
  clearTimeout(timer);
@@ -22080,17 +22102,17 @@ var defaultCdpIo = {
22080
22102
  };
22081
22103
 
22082
22104
  // src/commands/chiron-page-playwright.ts
22083
- import path19 from "path";
22105
+ import path20 from "path";
22084
22106
  import { CliError as CliError46, CliErrorCode as CliErrorCode46 } from "@hcmai/sdk";
22085
22107
  function playwrightCacheRoot(probe3) {
22086
22108
  const override = probe3.env.PLAYWRIGHT_BROWSERS_PATH?.trim();
22087
- if (override === "0" && probe3.packageRoot) return path19.join(probe3.packageRoot, ".local-browsers");
22088
- if (override && override !== "0") return path19.resolve(override);
22089
- if (probe3.platform === "darwin") return path19.join(probe3.homedir(), "Library", "Caches", "ms-playwright");
22109
+ if (override === "0" && probe3.packageRoot) return path20.join(probe3.packageRoot, ".local-browsers");
22110
+ if (override && override !== "0") return path20.resolve(override);
22111
+ if (probe3.platform === "darwin") return path20.join(probe3.homedir(), "Library", "Caches", "ms-playwright");
22090
22112
  if (probe3.platform === "win32") {
22091
- return path19.join(probe3.env.LOCALAPPDATA?.trim() || path19.join(probe3.homedir(), "AppData", "Local"), "ms-playwright");
22113
+ return path20.join(probe3.env.LOCALAPPDATA?.trim() || path20.join(probe3.homedir(), "AppData", "Local"), "ms-playwright");
22092
22114
  }
22093
- return path19.join(probe3.env.XDG_CACHE_HOME?.trim() || path19.join(probe3.homedir(), ".cache"), "ms-playwright");
22115
+ return path20.join(probe3.env.XDG_CACHE_HOME?.trim() || path20.join(probe3.homedir(), ".cache"), "ms-playwright");
22094
22116
  }
22095
22117
  function playwrightPlatformTag(probe3) {
22096
22118
  const arm = probe3.arch === "arm64";
@@ -22106,19 +22128,19 @@ function revisionOf(entry, prefix) {
22106
22128
  function candidateBinaries(probe3, kind) {
22107
22129
  const tag = playwrightPlatformTag(probe3);
22108
22130
  if (kind === "headless-shell") {
22109
- return [path19.join(`chrome-headless-shell-${tag}`, probe3.platform === "win32" ? "chrome-headless-shell.exe" : "chrome-headless-shell")];
22131
+ return [path20.join(`chrome-headless-shell-${tag}`, probe3.platform === "win32" ? "chrome-headless-shell.exe" : "chrome-headless-shell")];
22110
22132
  }
22111
22133
  if (probe3.platform === "darwin") {
22112
22134
  return [
22113
22135
  // Playwright ≥ 1.49:Chrome for Testing 的 .app
22114
- path19.join(`chrome-${tag}`, "Google Chrome for Testing.app", "Contents", "MacOS", "Google Chrome for Testing"),
22136
+ path20.join(`chrome-${tag}`, "Google Chrome for Testing.app", "Contents", "MacOS", "Google Chrome for Testing"),
22115
22137
  // ≤ 1.48:Chromium.app,目录名不分架构
22116
- path19.join("chrome-mac", "Chromium.app", "Contents", "MacOS", "Chromium"),
22117
- path19.join(`chrome-${tag}`, "Chromium.app", "Contents", "MacOS", "Chromium")
22138
+ path20.join("chrome-mac", "Chromium.app", "Contents", "MacOS", "Chromium"),
22139
+ path20.join(`chrome-${tag}`, "Chromium.app", "Contents", "MacOS", "Chromium")
22118
22140
  ];
22119
22141
  }
22120
- if (probe3.platform === "win32") return [path19.join("chrome-win64", "chrome.exe"), path19.join("chrome-win", "chrome.exe")];
22121
- return [path19.join(`chrome-${tag}`, "chrome"), path19.join("chrome-linux", "chrome")];
22142
+ if (probe3.platform === "win32") return [path20.join("chrome-win64", "chrome.exe"), path20.join("chrome-win", "chrome.exe")];
22143
+ return [path20.join(`chrome-${tag}`, "chrome"), path20.join("chrome-linux", "chrome")];
22122
22144
  }
22123
22145
  function discoverPlaywrightBrowser(probe3) {
22124
22146
  const explicit = probe3.env.HCM_PLAYWRIGHT_EXECUTABLE?.trim();
@@ -22136,8 +22158,8 @@ function discoverPlaywrightBrowser(probe3) {
22136
22158
  const revisions = entries.map((e) => ({ e, rev: revisionOf(e, prefix) })).filter((x) => x.rev !== null).sort((a, b) => b.rev - a.rev);
22137
22159
  for (const { e } of revisions) {
22138
22160
  for (const rel of candidateBinaries(probe3, kind)) {
22139
- const candidate = path19.join(root, e, rel);
22140
- if (probe3.executable(candidate)) return { executablePath: candidate, kind, from: path19.join(root, e) };
22161
+ const candidate = path20.join(root, e, rel);
22162
+ if (probe3.executable(candidate)) return { executablePath: candidate, kind, from: path20.join(root, e) };
22141
22163
  }
22142
22164
  }
22143
22165
  return null;
@@ -22239,10 +22261,10 @@ function resolveEvidenceTarget(projectRoot, out) {
22239
22261
  if (!out.endsWith(".png")) {
22240
22262
  throw new CliError47({ code: CliErrorCode47.INVALID_ARGUMENT, message: `--out \u8981\u4EE5 .png \u7ED3\u5C3E\uFF0C\u6536\u5230\u7684\u662F ${out}` });
22241
22263
  }
22242
- const root = path20.resolve(projectRoot);
22243
- const evidenceRoot = path20.join(root, EVIDENCE_DIR);
22244
- const absolute = path20.resolve(root, out);
22245
- if (absolute !== evidenceRoot && !absolute.startsWith(evidenceRoot + path20.sep)) {
22264
+ const root = path21.resolve(projectRoot);
22265
+ const evidenceRoot = path21.join(root, EVIDENCE_DIR);
22266
+ const absolute = path21.resolve(root, out);
22267
+ if (absolute !== evidenceRoot && !absolute.startsWith(evidenceRoot + path21.sep)) {
22246
22268
  throw new CliError47({
22247
22269
  code: CliErrorCode47.INVALID_ARGUMENT,
22248
22270
  message: `--out \u8981\u843D\u5728\u9879\u76EE\u7684 ${EVIDENCE_DIR}/ \u4E0B\uFF08${evidenceRoot}\uFF09\uFF0C\u6536\u5230\u7684\u662F ${absolute}`
@@ -22289,9 +22311,9 @@ function findChrome(probe3, override) {
22289
22311
  }
22290
22312
  async function assertInsideEvidence(deps, evidenceRoot, absolute) {
22291
22313
  const canonicalRoot = await deps.realpath(evidenceRoot);
22292
- const canonicalParent = await deps.realpath(path20.dirname(absolute));
22314
+ const canonicalParent = await deps.realpath(path21.dirname(absolute));
22293
22315
  if (canonicalRoot === null || canonicalParent === null) return;
22294
- if (canonicalParent !== canonicalRoot && !canonicalParent.startsWith(canonicalRoot + path20.sep)) {
22316
+ if (canonicalParent !== canonicalRoot && !canonicalParent.startsWith(canonicalRoot + path21.sep)) {
22295
22317
  throw new CliError47({
22296
22318
  code: CliErrorCode47.INVALID_ARGUMENT,
22297
22319
  message: `--out \u7684\u7236\u76EE\u5F55\u7ECF\u7B26\u53F7\u94FE\u63A5\u8DD1\u51FA\u4E86 ${EVIDENCE_DIR}/\uFF1A${canonicalParent}`
@@ -22310,7 +22332,7 @@ async function runChironPage(target, args, deps) {
22310
22332
  const reject = (args.rejectText ?? []).filter((t) => t.trim().length > 0);
22311
22333
  const viewport = parseViewport(args.size ?? "1440x900");
22312
22334
  const waitMs = parseWaitMs(args.waitMs);
22313
- const root = path20.resolve(args.project ?? ".");
22335
+ const root = path21.resolve(args.project ?? ".");
22314
22336
  const { evidenceRoot, absolute } = resolveEvidenceTarget(root, args.out);
22315
22337
  if (await deps.present(absolute)) {
22316
22338
  throw new CliError47({
@@ -22318,7 +22340,7 @@ async function runChironPage(target, args, deps) {
22318
22340
  message: `\u622A\u56FE\u5DF2\u5B58\u5728\uFF0C\u4E0D\u8986\u76D6\uFF1A${absolute}\u3002\u6362\u4E2A --out\uFF0C\u6216\u5148\u628A\u65E7\u8BC1\u636E\u632A\u8D70\u3002`
22319
22341
  });
22320
22342
  }
22321
- await deps.ensureDir(path20.dirname(absolute));
22343
+ await deps.ensureDir(path21.dirname(absolute));
22322
22344
  await assertInsideEvidence(deps, evidenceRoot, absolute);
22323
22345
  const endpoint = normalizeCdpEndpoint(args.cdp ?? deps.env.HCM_CHROME_CDP);
22324
22346
  const evalJs = args.eval?.trim() ? args.eval : void 0;
@@ -22436,7 +22458,7 @@ function safeStringify(value) {
22436
22458
  }
22437
22459
  function playwrightPackageRoot() {
22438
22460
  try {
22439
- return path20.dirname(createRequire(import.meta.url).resolve("playwright-core/package.json"));
22461
+ return path21.dirname(createRequire(import.meta.url).resolve("playwright-core/package.json"));
22440
22462
  } catch {
22441
22463
  return void 0;
22442
22464
  }
@@ -22528,7 +22550,7 @@ init_exit();
22528
22550
  import { spawnSync as spawnSync2 } from "child_process";
22529
22551
  import { randomUUID as randomUUID2 } from "crypto";
22530
22552
  import { promises as fs18 } from "fs";
22531
- import path21 from "path";
22553
+ import path22 from "path";
22532
22554
  import yaml5 from "js-yaml";
22533
22555
  import { formatObject as formatObject35 } from "@hcmai/sdk";
22534
22556
 
@@ -23511,7 +23533,7 @@ async function runCase(spec, root, opts = {}, deps = defaultDeps2) {
23511
23533
  continue;
23512
23534
  }
23513
23535
  if (c2.file) {
23514
- const file = path21.resolve(root, fill(c2.file));
23536
+ const file = path22.resolve(root, fill(c2.file));
23515
23537
  const want = c2.expect ?? {};
23516
23538
  const bad = [];
23517
23539
  if (want.xlsx_header || want.xlsx_min_rows !== void 0) {
@@ -23533,7 +23555,7 @@ async function runCase(spec, root, opts = {}, deps = defaultDeps2) {
23533
23555
  results.push(bad.length ? { name: c2.name, verdict: "fail", detail: bad.join("\uFF1B") } : { name: c2.name, verdict: "pass", detail: "" });
23534
23556
  continue;
23535
23557
  }
23536
- const out = path21.join(
23558
+ const out = path22.join(
23537
23559
  "evidence",
23538
23560
  "test",
23539
23561
  opts.evidenceRunId ?? "current",
@@ -23555,11 +23577,11 @@ async function runCase(spec, root, opts = {}, deps = defaultDeps2) {
23555
23577
  }
23556
23578
  async function loadCases(target) {
23557
23579
  const stat = await fs18.stat(target);
23558
- const files = stat.isDirectory() ? (await fs18.readdir(target)).filter((f) => /\.ya?ml$/.test(f)).sort().map((f) => path21.join(target, f)) : [target];
23580
+ const files = stat.isDirectory() ? (await fs18.readdir(target)).filter((f) => /\.ya?ml$/.test(f)).sort().map((f) => path22.join(target, f)) : [target];
23559
23581
  const out = [];
23560
23582
  for (const f of files) {
23561
23583
  const spec = yaml5.load(await fs18.readFile(f, "utf8"));
23562
- assertUsableSpec(spec, path21.basename(f));
23584
+ assertUsableSpec(spec, path22.basename(f));
23563
23585
  out.push({ file: f, spec });
23564
23586
  }
23565
23587
  if (out.length === 0) throw new Error(`${target} \u4E0B\u6CA1\u6709\u7528\u4F8B\uFF08*.yml\uFF09`);
@@ -23567,8 +23589,8 @@ async function loadCases(target) {
23567
23589
  }
23568
23590
  async function chironTestCommand(target, args, deps) {
23569
23591
  try {
23570
- const root = path21.resolve(args.project ?? ".");
23571
- const where = path21.resolve(root, target ?? "tests");
23592
+ const root = path22.resolve(args.project ?? ".");
23593
+ const where = path22.resolve(root, target ?? "tests");
23572
23594
  const cases2 = await loadCases(where);
23573
23595
  const report = [];
23574
23596
  let failed2 = 0;
@@ -23580,7 +23602,7 @@ async function chironTestCommand(target, args, deps) {
23580
23602
  deps
23581
23603
  );
23582
23604
  failed2 += results.filter((r) => r.verdict === "fail").length;
23583
- report.push({ case: spec.name, file: path21.relative(root, file), results });
23605
+ report.push({ case: spec.name, file: path22.relative(root, file), results });
23584
23606
  }
23585
23607
  const fmt = args.output ?? "table";
23586
23608
  if (fmt === "json" || fmt === "yaml") {
@@ -23721,7 +23743,7 @@ import {
23721
23743
  writeRisk
23722
23744
  } from "@hcmai/sdk";
23723
23745
  import { existsSync as existsSync5 } from "fs";
23724
- import * as path22 from "path";
23746
+ import * as path23 from "path";
23725
23747
  function premise(message, hint = "") {
23726
23748
  process.stderr.write(message + (hint ? `
23727
23749
  \u2192 ${hint}` : "") + "\n");
@@ -23748,13 +23770,13 @@ async function runSeedPlan(args, client4) {
23748
23770
  const reconDir = candidates[0].reconDir;
23749
23771
  if (candidates.length > 1) {
23750
23772
  process.stderr.write(
23751
- `\u26A0\uFE0F \u540C\u79DF\u6237\u4E0B\u6709 ${candidates.length} \u4EFD\u57FA\u7EBF\uFF0C\u672C\u8F6E\u8BFB\u7684\u662F \`${path22.basename(reconDir)}\`\uFF1A` + candidates.slice(1).map((c2) => `\`${path22.basename(c2.reconDir)}\``).join("\u3001") + " \u672A\u88AB\u8BFB\u53D6 \u2014\u2014 \u4E0D\u540C sourceKey \u7684\u4EA7\u7269**\u4E0D\u53EF\u4E92\u6362**\u3002\n"
23773
+ `\u26A0\uFE0F \u540C\u79DF\u6237\u4E0B\u6709 ${candidates.length} \u4EFD\u57FA\u7EBF\uFF0C\u672C\u8F6E\u8BFB\u7684\u662F \`${path23.basename(reconDir)}\`\uFF1A` + candidates.slice(1).map((c2) => `\`${path23.basename(c2.reconDir)}\``).join("\u3001") + " \u672A\u88AB\u8BFB\u53D6 \u2014\u2014 \u4E0D\u540C sourceKey \u7684\u4EA7\u7269**\u4E0D\u53EF\u4E92\u6362**\u3002\n"
23752
23774
  );
23753
23775
  }
23754
23776
  const round = inspectRound2(reconDir);
23755
23777
  process.stderr.write(roundWarning(round));
23756
23778
  const baseline = {
23757
- path: `${path22.basename(path22.dirname(reconDir))}/${path22.basename(reconDir)}`,
23779
+ path: `${path23.basename(path23.dirname(reconDir))}/${path23.basename(reconDir)}`,
23758
23780
  roundId: round.roundId ?? null
23759
23781
  };
23760
23782
  let exemptions = null;
@@ -24016,7 +24038,7 @@ async function deliverySeedVerifyCommand(args) {
24016
24038
  // src/commands/delivery-seed-find.ts
24017
24039
  import { existsSync as existsSync6 } from "fs";
24018
24040
  import { readFileSync as readFileSync9 } from "fs";
24019
- import * as path23 from "path";
24041
+ import * as path24 from "path";
24020
24042
  import {
24021
24043
  INIT_EXIT_CODES as INIT_EXIT_CODES2,
24022
24044
  ValueHints,
@@ -24030,10 +24052,10 @@ import {
24030
24052
  valuesRoundCaveat
24031
24053
  } from "@hcmai/sdk";
24032
24054
  function provenance(chosenReconDir, others) {
24033
- let line = `> \u57FA\u7EBF\uFF1A\`${path23.basename(chosenReconDir)}\`
24055
+ let line = `> \u57FA\u7EBF\uFF1A\`${path24.basename(chosenReconDir)}\`
24034
24056
  `;
24035
24057
  if (others.length > 0) {
24036
- line += `> \u26A0\uFE0F \u540C\u79DF\u6237\u4E0B\u53E6\u6709 ${others.length} \u4EFD\u57FA\u7EBF\u672A\u88AB\u8BFB\u53D6\uFF1A` + others.map((o) => `\`${path23.basename(o)}\``).join("\u3001") + " \u2014\u2014 \u4E0D\u540C sourceKey \u7684\u4EA7\u7269**\u4E0D\u53EF\u4E92\u6362**\u3002\n";
24058
+ line += `> \u26A0\uFE0F \u540C\u79DF\u6237\u4E0B\u53E6\u6709 ${others.length} \u4EFD\u57FA\u7EBF\u672A\u88AB\u8BFB\u53D6\uFF1A` + others.map((o) => `\`${path24.basename(o)}\``).join("\u3001") + " \u2014\u2014 \u4E0D\u540C sourceKey \u7684\u4EA7\u7269**\u4E0D\u53EF\u4E92\u6362**\u3002\n";
24037
24059
  }
24038
24060
  return `${line}
24039
24061
  `;
@@ -24370,7 +24392,7 @@ import {
24370
24392
  runTriageRound
24371
24393
  } from "@hcmai/sdk";
24372
24394
  import { mkdirSync as mkdirSync2, readFileSync as readFileSync11, writeFileSync as writeFileSync3 } from "fs";
24373
- import * as path24 from "path";
24395
+ import * as path25 from "path";
24374
24396
  var DEFAULT_CAPABILITIES3 = "default";
24375
24397
  function premise4(message, hint) {
24376
24398
  process.stderr.write(`\u{1F534} \u524D\u63D0\u4E0D\u6210\u7ACB\uFF1A${message}
@@ -24406,8 +24428,8 @@ function renderProblems(rows2) {
24406
24428
  `;
24407
24429
  }
24408
24430
  function writeTriageArtifact(outDir, body) {
24409
- const out = path24.join(outDir, "work", "triage.md");
24410
- mkdirSync2(path24.dirname(out), { recursive: true });
24431
+ const out = path25.join(outDir, "work", "triage.md");
24432
+ mkdirSync2(path25.dirname(out), { recursive: true });
24411
24433
  writeFileSync3(out, body, "utf8");
24412
24434
  return out;
24413
24435
  }
@@ -24906,7 +24928,7 @@ program.command("update <Model>").description("\u66F4\u65B0\u4E00\u6761 Model \u
24906
24928
  ).action((model, opts) => updateCommand(model, opts));
24907
24929
  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\u9879\u76EE\u73AF\u5883\u6216 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));
24908
24930
  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));
24909
- 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>", "\u672C\u6B21\u4F7F\u7528\u7684\u9879\u76EE\u73AF\u5883\u540D\u6216\u672C\u673A\u69FD\u540D").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((path25, opts) => openCommand(path25, opts));
24931
+ 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>", "\u672C\u6B21\u4F7F\u7528\u7684\u9879\u76EE\u73AF\u5883\u540D\u6216\u672C\u673A\u69FD\u540D").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((path26, opts) => openCommand(path26, opts));
24910
24932
  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");
24911
24933
  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>", "\u672C\u6B21\u4F7F\u7528\u7684\u9879\u76EE\u73AF\u5883\u540D\u6216\u672C\u673A\u69FD\u540D").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));
24912
24934
  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(