@hcmai/cli 0.30.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");
@@ -4905,6 +4905,8 @@ init_exit();
4905
4905
  init_auth_guard();
4906
4906
  import {
4907
4907
  HcmClient as HcmClient5,
4908
+ assessActionVerification,
4909
+ fetchActionVerification,
4908
4910
  formatObject as formatObject3,
4909
4911
  fromAxiosError as fromAxiosError6,
4910
4912
  CliError as CliError15,
@@ -4913,6 +4915,7 @@ import {
4913
4915
 
4914
4916
  // src/utils/json-input.ts
4915
4917
  import * as fs2 from "fs/promises";
4918
+ import * as path3 from "path";
4916
4919
  import { CliError as CliError13, CliErrorCode as CliErrorCode11 } from "@hcmai/sdk";
4917
4920
  async function readJsonObjectInput(options) {
4918
4921
  const { inline, file, inlineFlag, fileFlag, required: required2 = true } = options;
@@ -4931,10 +4934,14 @@ async function readJsonObjectInput(options) {
4931
4934
  }
4932
4935
  let raw;
4933
4936
  let sourceFlag;
4937
+ let fileContext;
4934
4938
  if (file) {
4935
4939
  sourceFlag = fileFlag;
4936
4940
  try {
4937
- 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 };
4938
4945
  } catch (error) {
4939
4946
  throw new CliError13({
4940
4947
  code: CliErrorCode11.INVALID_ARGUMENT,
@@ -4945,19 +4952,26 @@ async function readJsonObjectInput(options) {
4945
4952
  sourceFlag = inlineFlag;
4946
4953
  raw = inline;
4947
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
+ };
4948
4960
  let parsed;
4949
4961
  try {
4950
4962
  parsed = JSON.parse(raw);
4951
- } catch (error) {
4963
+ } catch {
4952
4964
  throw new CliError13({
4953
4965
  code: CliErrorCode11.INVALID_JSON,
4954
- 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
4955
4968
  });
4956
4969
  }
4957
4970
  if (parsed === null || Array.isArray(parsed) || typeof parsed !== "object") {
4958
4971
  throw new CliError13({
4959
4972
  code: CliErrorCode11.INVALID_JSON,
4960
- message: `${sourceFlag}: \u9876\u5C42\u5FC5\u987B\u662F JSON \u5BF9\u8C61`
4973
+ message: `${source}: \u9876\u5C42\u5FC5\u987B\u662F JSON \u5BF9\u8C61`,
4974
+ context
4961
4975
  });
4962
4976
  }
4963
4977
  return parsed;
@@ -4967,7 +4981,7 @@ async function readJsonObjectInput(options) {
4967
4981
  import { createHash as createHash2 } from "crypto";
4968
4982
  import { CliError as CliError14, CliErrorCode as CliErrorCode12 } from "@hcmai/sdk";
4969
4983
  import { promises as fs3 } from "fs";
4970
- import path3 from "path";
4984
+ import path4 from "path";
4971
4985
  var MAX_ARTIFACT_BYTES = 10 * 1024 * 1024;
4972
4986
  var ARTIFACT_ENCODING_BASE64 = "base64";
4973
4987
  var SHA256_HEX = /^[0-9a-f]{64}$/;
@@ -4999,7 +5013,7 @@ function parseArtifactEnvelope(data) {
4999
5013
  }
5000
5014
  var fail = (message, nextStep) => new CliError14({ code: CliErrorCode12.INVALID_ARGUMENT, message, context: { nextStep } });
5001
5015
  async function writeArtifact(artifact, target, opts = {}) {
5002
- const abs = path3.resolve(target);
5016
+ const abs = path4.resolve(target);
5003
5017
  const stat = await fs3.lstat(abs).catch(() => null);
5004
5018
  if (stat) {
5005
5019
  if (stat.isSymbolicLink()) {
@@ -5028,9 +5042,9 @@ async function writeArtifact(artifact, target, opts = {}) {
5028
5042
  if (digest !== artifact.sha256) {
5029
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");
5030
5044
  }
5031
- const dir = path3.dirname(abs);
5045
+ const dir = path4.dirname(abs);
5032
5046
  await fs3.mkdir(dir, { recursive: true });
5033
- const tmp = path3.join(dir, `.tmp-artifact-${process.pid}-${Date.now()}`);
5047
+ const tmp = path4.join(dir, `.tmp-artifact-${process.pid}-${Date.now()}`);
5034
5048
  try {
5035
5049
  await fs3.writeFile(tmp, bytes, { mode: 384, flag: "wx" });
5036
5050
  await fs3.rename(tmp, abs);
@@ -5092,13 +5106,19 @@ async function actionCommand(spec, args) {
5092
5106
  if (scope) input.scope = scope;
5093
5107
  }
5094
5108
  }
5109
+ const declaration = args.verify ? await fetchActionVerification(client4.raw(), model, action) : void 0;
5095
5110
  const result = await client4.action(model, action, input);
5096
5111
  const fmt = args.output ?? "json";
5097
5112
  if (args.artifactOutput) {
5098
5113
  await emitArtifact(result, args.artifactOutput, { force: args.artifactForce }, fmt);
5099
- return;
5114
+ } else {
5115
+ printActionResult(result, fmt);
5116
+ }
5117
+ if (declaration) {
5118
+ const verdict = assessActionVerification(declaration, { model, action });
5119
+ process.stderr.write(verdict.lines.join("\n") + "\n");
5120
+ process.exitCode = verdict.exitCode;
5100
5121
  }
5101
- printActionResult(result, fmt);
5102
5122
  } catch (e) {
5103
5123
  const err = e;
5104
5124
  if (err?.isAxiosError) {
@@ -5174,7 +5194,7 @@ async function lookupActionShape(client4, model, action) {
5174
5194
  // src/commands/create.ts
5175
5195
  init_exit();
5176
5196
  init_auth_guard();
5177
- import { HcmClient as HcmClient6, formatObject as formatObject4, fromAxiosError as fromAxiosError7 } from "@hcmai/sdk";
5197
+ import { HcmClient as HcmClient6, assessWriteVerification, stripVerifyEchoKeys, formatObject as formatObject4, fromAxiosError as fromAxiosError7 } from "@hcmai/sdk";
5178
5198
  async function createCommand(model, args) {
5179
5199
  try {
5180
5200
  const data = await readJsonObjectInput({
@@ -5184,11 +5204,23 @@ async function createCommand(model, args) {
5184
5204
  fileFlag: "--data-file"
5185
5205
  });
5186
5206
  const client4 = HcmClient6.fromAuthContext(await getActiveAuthContextFromCli(args));
5187
- const res = await client4.create(model, data, { i18n: args.i18n });
5207
+ const { data: payload, stripped } = args.verify ? stripVerifyEchoKeys(data) : { data, stripped: [] };
5208
+ if (stripped.length) {
5209
+ process.stderr.write(`\u5199\u540E\u6838\u9A8C\uFF1Adata \u91CC\u7684 ${stripped.join(" / ")} \u662F\u4E0A\u4E00\u6B21 --verify \u7684\u8F93\u51FA\u3001\u4E0D\u662F\u5B57\u6BB5\uFF0C\u5DF2\u5254\u6389\u4E0D\u9001
5210
+ `);
5211
+ }
5212
+ const res = await client4.create(model, payload, { i18n: args.i18n, ...args.verify ? { verify: true } : {} });
5188
5213
  const fmt = args.output ?? "json";
5189
5214
  if (fmt !== "json") process.stdout.write("\u2705 created\n");
5190
- process.stdout.write(formatObject4(res, { format: fmt }) + "\n");
5191
- process.exitCode = 0;
5215
+ if (!args.verify) {
5216
+ process.stdout.write(formatObject4(res, { format: fmt }) + "\n");
5217
+ process.exitCode = 0;
5218
+ return;
5219
+ }
5220
+ const verdict = assessWriteVerification(res, { model, id: typeof res?.id === "string" ? res.id : void 0, command: "create" });
5221
+ process.stdout.write(formatObject4({ ...res, verifyExitReason: verdict.verifyExitReason }, { format: fmt }) + "\n");
5222
+ process.stderr.write(verdict.lines.join("\n") + "\n");
5223
+ process.exitCode = verdict.exitCode;
5192
5224
  return;
5193
5225
  } catch (e) {
5194
5226
  const err = e;
@@ -5202,6 +5234,8 @@ init_exit();
5202
5234
  init_auth_guard();
5203
5235
  import {
5204
5236
  HcmClient as HcmClient7,
5237
+ assessWriteVerification as assessWriteVerification2,
5238
+ stripVerifyEchoKeys as stripVerifyEchoKeys2,
5205
5239
  formatObject as formatObject5,
5206
5240
  fromAxiosError as fromAxiosError8,
5207
5241
  CliError as CliError16,
@@ -5219,12 +5253,24 @@ async function updateCommand(model, args) {
5219
5253
  fileFlag: "--data-file"
5220
5254
  });
5221
5255
  const client4 = HcmClient7.fromAuthContext(await getActiveAuthContextFromCli(args));
5222
- const result = await client4.update(model, args.id, data, { i18n: args.i18n });
5256
+ const { data: payload, stripped } = args.verify ? stripVerifyEchoKeys2(data) : { data, stripped: [] };
5257
+ if (stripped.length) {
5258
+ process.stderr.write(`\u5199\u540E\u6838\u9A8C\uFF1Adata \u91CC\u7684 ${stripped.join(" / ")} \u662F\u4E0A\u4E00\u6B21 --verify \u7684\u8F93\u51FA\u3001\u4E0D\u662F\u5B57\u6BB5\uFF0C\u5DF2\u5254\u6389\u4E0D\u9001
5259
+ `);
5260
+ }
5261
+ const result = await client4.update(model, args.id, payload, { i18n: args.i18n, ...args.verify ? { verify: true } : {} });
5223
5262
  const fmt = args.output ?? "json";
5224
5263
  if (fmt !== "json") process.stdout.write(`\u2705 ${model}#${args.id} \u5DF2\u66F4\u65B0
5225
5264
  `);
5226
- process.stdout.write(formatObject5(result, { format: fmt }) + "\n");
5227
- process.exitCode = 0;
5265
+ if (!args.verify) {
5266
+ process.stdout.write(formatObject5(result, { format: fmt }) + "\n");
5267
+ process.exitCode = 0;
5268
+ return;
5269
+ }
5270
+ const verdict = assessWriteVerification2(result, { model, id: args.id, command: "update" });
5271
+ process.stdout.write(formatObject5({ ...result, verifyExitReason: verdict.verifyExitReason }, { format: fmt }) + "\n");
5272
+ process.stderr.write(verdict.lines.join("\n") + "\n");
5273
+ process.exitCode = verdict.exitCode;
5228
5274
  return;
5229
5275
  } catch (e) {
5230
5276
  const err = e;
@@ -5497,11 +5543,12 @@ import {
5497
5543
  HcmClient as HcmClient10,
5498
5544
  parseFixture,
5499
5545
  runImport,
5546
+ importExitCode,
5500
5547
  formatObject as formatObject9,
5501
5548
  fromAxiosError as fromAxiosError12
5502
5549
  } from "@hcmai/sdk";
5503
- function collectYmlFiles(path25) {
5504
- if (statSync(path25).isFile()) return [path25];
5550
+ function collectYmlFiles(path26) {
5551
+ if (statSync(path26).isFile()) return [path26];
5505
5552
  const out = [];
5506
5553
  const walk = (dir) => {
5507
5554
  for (const name of readdirSync(dir).sort()) {
@@ -5510,7 +5557,7 @@ function collectYmlFiles(path25) {
5510
5557
  else if (full.endsWith(".yml") || full.endsWith(".yaml")) out.push(full);
5511
5558
  }
5512
5559
  };
5513
- walk(path25);
5560
+ walk(path26);
5514
5561
  return out.sort();
5515
5562
  }
5516
5563
  var DRY_RUN_CLIENT = {
@@ -5519,17 +5566,21 @@ var DRY_RUN_CLIENT = {
5519
5566
  update: async () => ({}),
5520
5567
  fieldKeys: async () => []
5521
5568
  };
5522
- async function importCommand(path25, args) {
5569
+ async function importCommand(path26, args) {
5523
5570
  try {
5524
- const files = collectYmlFiles(path25);
5571
+ const files = collectYmlFiles(path26);
5525
5572
  const fixtures = files.map(
5526
5573
  (f) => parseFixture(readFileSync3(f, "utf8"), relative2(process.cwd(), f))
5527
5574
  );
5528
5575
  const opts = {
5529
5576
  dryRun: !!args.dryRun,
5530
5577
  updateOnly: !!args.updateOnly,
5531
- onError: args.onError === "stop" ? "stop" : "continue"
5578
+ onError: args.onError === "stop" ? "stop" : "continue",
5579
+ ...args.verify ? { verify: true } : {}
5532
5580
  };
5581
+ if (args.verify && opts.dryRun) {
5582
+ process.stderr.write("\u5199\u540E\u6838\u9A8C\uFF1Adry-run \u4E0D\u5199\u5165\uFF0C--verify \u8FD9\u6B21\u4E0D\u751F\u6548\uFF08\u6CA1\u5199\u5C31\u6CA1\u5F97\u6838\uFF09\n");
5583
+ }
5533
5584
  const client4 = opts.dryRun ? DRY_RUN_CLIENT : HcmClient10.fromAuthContext(await getActiveAuthContextFromCli(args));
5534
5585
  const result = await runImport(client4, fixtures, opts);
5535
5586
  for (const warning of result.warnings ?? []) process.stderr.write(`\u26A0 ${warning}
@@ -5548,8 +5599,7 @@ async function importCommand(path25, args) {
5548
5599
  process.stderr.write(
5549
5600
  `\u26A0 ${unmappedRows.length} \u884C\u91CC\u6709\u76EE\u6807\u6A21\u578B\u4E0D\u8BA4\u8BC6\u7684\u5B57\u6BB5\u540D\uFF1A${keys.join(" / ")}
5550
5601
  \u8FD9\u4E9B\u952E\u670D\u52A1\u7AEF\u8FDE\u8BFB\u90FD\u4E0D\u8BFB\uFF0C\u503C\u4E0D\u4F1A\u843D\u5E93\uFF08\u62A5\u544A\u91CC\u8BE5\u884C\u7684 status \u4ECD\u662F\u88AB\u63A5\u53D7\u7684\u90A3\u4E2A\uFF09\u3002
5551
- next_step=hcm describe <Model> \u6838\u5BF9\u771F\u540D\u540E\u6539\u8F7D\u8377\u91CD\u8DD1\uFF1B\u771F\u540D\u5E26\u4E0B\u5212\u7EBF\u7684\u8981\u539F\u6837\u5199\uFF0C\u522B\u8F6C\u9A7C\u5CF0\u3002
5552
- `
5602
+ ` + (opts.verify && !opts.dryRun ? " next_step=hcm describe <Model> \u6838\u5BF9\u771F\u540D\u540E\u6539\u8F7D\u8377\uFF0C\u7528 --update-only \u53EA\u91CD\u5BFC\u8FD9\u51E0\u884C\uFF08\u4E0D\u8981\u6574\u4EFD\u91CD\u8DD1\uFF09\uFF1B\u771F\u540D\u5E26\u4E0B\u5212\u7EBF\u7684\u8981\u539F\u6837\u5199\uFF0C\u522B\u8F6C\u9A7C\u5CF0\u3002\n" : " next_step=hcm describe <Model> \u6838\u5BF9\u771F\u540D\u540E\u6539\u8F7D\u8377\u91CD\u8DD1\uFF1B\u771F\u540D\u5E26\u4E0B\u5212\u7EBF\u7684\u8981\u539F\u6837\u5199\uFF0C\u522B\u8F6C\u9A7C\u5CF0\u3002\n")
5553
5603
  );
5554
5604
  }
5555
5605
  if (result.fieldNamesUnverified.length > 0) {
@@ -5559,7 +5609,14 @@ async function importCommand(path25, args) {
5559
5609
  `
5560
5610
  );
5561
5611
  }
5562
- process.exitCode = result.failed > 0 ? 3 : 0;
5612
+ if (result.stoppedOn) {
5613
+ const { model, key: key2, cause, notAttempted } = result.stoppedOn;
5614
+ const why = cause === "verify-mismatch" ? "\u6838\u9A8C\u5931\u8D25\uFF08\u5DF2\u5199\u5165\u3001\u4E0E\u5E93\u91CC\u5BF9\u4E0D\u4E0A\uFF09" : opts.dryRun ? "\u6821\u9A8C\u5931\u8D25" : "\u5199\u5165\u5931\u8D25";
5615
+ process.stderr.write(`\u23F9 \u6309 --on-error stop \u505C\u5728 ${model}:${key2}\uFF08${why}\uFF09\uFF0C\u540E\u9762 ${notAttempted} \u884C\u6CA1${opts.dryRun ? "\u8DD1" : "\u5199"}
5616
+ `);
5617
+ }
5618
+ if (result.verification) printVerification(result);
5619
+ process.exitCode = importExitCode(result);
5563
5620
  return;
5564
5621
  } catch (e) {
5565
5622
  const err = e;
@@ -5567,6 +5624,76 @@ async function importCommand(path25, args) {
5567
5624
  exitWithError(e);
5568
5625
  }
5569
5626
  }
5627
+ var IMPORT_NEXT_STEP = {
5628
+ NOT_A_FIELD: "\u5B57\u6BB5\u540D\u5199\u9519\uFF08hcm describe <Model> \u6838\u5BF9\u771F\u540D\uFF09\uFF1A\u6539\u6E90\u6570\u636E\u540E\u7528 --update-only \u53EA\u91CD\u5BFC\u8FD9\u51E0\u884C",
5629
+ CONTAINER_KEYS_DROPPED: "\u6574\u4EFD\u9001\u5BB9\u5668\u6E05\u6389\u4E86\u5B50\u952E\uFF1A\u8865\u56DE\u5B50\u952E\uFF08\u6216\u6539\u6210\u53EA\u9001\u8981\u6539\u7684\u9876\u5C42\u952E\uFF09\u540E\u7528 --update-only \u53EA\u91CD\u5BFC\u8FD9\u51E0\u884C",
5630
+ VALUE_DIFFERS: "\u5E93\u91CC\u5B58\u7684\u503C\u548C\u9001\u7684\u4E0D\u4E00\u6837\uFF1A\u4EE5\u5E93\u91CC\u7684\u503C\u4E3A\u51C6\u6539\u672C\u5730\u6E90\uFF0C\u4E0D\u8981\u91CD\u5BFC\uFF08\u56DE\u8BFB\u524D\u540E\u82E5\u6709\u4ED6\u4EBA\u4FEE\u6539\uFF0C\u4EE5\u6700\u65B0\u503C\u4E3A\u51C6\uFF09",
5631
+ VALUE_NOT_STORED: "\u503C\u6CA1\u5B58\u8FDB\u53BB\uFF1A\u4E0D\u8981\u91CD\u5BFC\uFF0C\u62A5\u7ED9\u4EA7\u54C1\u4FA7\uFF08\u9644 --report \u91CC\u8FD9\u51E0\u884C\uFF09",
5632
+ NOT_FOUND_ON_READBACK: "\u5199\u5B8C\u6309 id \u8BFB\u4E0D\u5230\uFF1A\u{1F534} \u4E0D\u8981\u91CD\u5BFC\uFF08\u4F1A\u518D\u5EFA\u4E00\u6761\uFF09\uFF0C\u7528\u6709\u6743\u9650\u7684\u8D26\u53F7\u6309 id \u67E5\u4E00\u6B21"
5633
+ };
5634
+ var importNextStep = (reason) => (reason && IMPORT_NEXT_STEP[reason]) ?? `${reason ?? "\u670D\u52A1\u7AEF\u6CA1\u7ED9\u539F\u56E0\u7801"}\uFF1A\u6309 id \u624B\u5DE5\u6838\u5BF9\uFF0C\u4E0D\u8981\u91CD\u5BFC`;
5635
+ var MAX_NAMED_ROWS = 20;
5636
+ function printVerification(result) {
5637
+ const v = result.verification;
5638
+ process.stderr.write(
5639
+ `\u{1F50E} verify: \u6838\u9A8C\u901A\u8FC7=${v.verified} \u6838\u9A8C\u5931\u8D25=${v.mismatched} \u672A\u6838\u9A8C=${v.unverified}` + (v.skippedNotVerified ? `\uFF08\u53E6\u6709 ${v.skippedNotVerified} \u884C\u5DF2\u5B58\u5728\u3001\u88AB\u8DF3\u8FC7\uFF0C\u6CA1\u5199\u5165\u3001\u4E0D\u6838\u9A8C\uFF09` : "") + (result.failed ? `\uFF08\u53E6\u6709 ${result.failed} \u884C\u5199\u5165\u5931\u8D25\uFF0C\u6CA1\u6838\uFF09` : "") + "\n"
5640
+ );
5641
+ const label = (r) => `${r.model}:${r.key}`;
5642
+ const one = (f) => {
5643
+ const extra = [
5644
+ ...f.reason ? [f.reason] : [],
5645
+ ...f.droppedKeys?.length ? [`\u88AB\u6E05\u6389\uFF1A${f.droppedKeys.join("\u3001")}`] : [],
5646
+ ...(f.leaves ?? []).map((l) => `${l.path} ${l.reason ?? l.status ?? ""}`.trim())
5647
+ ];
5648
+ return extra.length ? `${f.field}\uFF08${extra.join("\uFF1B")}\uFF09` : f.field;
5649
+ };
5650
+ const fieldText = (r) => {
5651
+ const fields = r.verification?.fields ?? [];
5652
+ const bad = fields.filter((f) => f.status !== "UNVERIFIABLE").map(one).join(" / ");
5653
+ const unchecked = fields.filter((f) => f.status === "UNVERIFIABLE").map(one).join(" / ");
5654
+ return [bad, unchecked ? `\u6CA1\u6838\u6210\uFF1A${unchecked}` : ""].filter(Boolean).join("\uFF1B");
5655
+ };
5656
+ const mismatched = result.rows.filter((r) => r.verification?.exitCode === 6);
5657
+ for (const r of mismatched.slice(0, MAX_NAMED_ROWS)) {
5658
+ const fields = fieldText(r);
5659
+ const notes = [
5660
+ ...r.verification?.reason ? [`\u6574\u4F53 ${r.verification.reason}`] : [],
5661
+ ...r.verification?.status === "LEGACY_UNKNOWN_FIELDS" ? ["\u65E7 Core \u6CA1\u6709\u6838\u9A8C\u5757\uFF0C\u7ED3\u8BBA\u6765\u81EA\u672A\u77E5\u952E\u56DE\u6267"] : [],
5662
+ ...r.verification?.fieldsTruncated ? ["\u670D\u52A1\u7AEF\u622A\u65AD\u4E86\u5B57\u6BB5\u6E05\u5355\uFF0C\u4E0A\u9762\u4E0D\u662F\u5168\u90E8"] : [],
5663
+ ...r.verification?.fieldNamesIncomplete ? ["\u672A\u77E5\u952E\u540D\u5355\u6CA1\u67E5\u5168\uFF0C\u53EF\u80FD\u8FD8\u6709\u522B\u7684\u9519\u540D\u952E"] : []
5664
+ ];
5665
+ process.stderr.write(` \u2717 ${label(r)}\uFF1A${fields || "\uFF08\u6CA1\u6709\u53EF\u8BFB\u7684\u5B57\u6BB5\u540D\uFF09"}${notes.length ? `\uFF1B${notes.join("\uFF1B")}` : ""}
5666
+ `);
5667
+ }
5668
+ if (mismatched.length > MAX_NAMED_ROWS) {
5669
+ process.stderr.write(` \u2026\u53E6\u6709 ${mismatched.length - MAX_NAMED_ROWS} \u884C\u6838\u9A8C\u5931\u8D25\uFF0C\u9010\u884C\u89C1 --report \u6216 stdout \u7684 rows[].verification
5670
+ `);
5671
+ }
5672
+ const unverified = result.rows.filter((r) => r.verification?.exitCode === 7);
5673
+ if (unverified.length) {
5674
+ const tally = /* @__PURE__ */ new Map();
5675
+ for (const r of unverified) {
5676
+ const why = r.verification?.reason ?? r.verification?.status ?? "?";
5677
+ tally.set(why, (tally.get(why) ?? 0) + 1);
5678
+ }
5679
+ process.stderr.write(` \u672A\u6838\u9A8C ${unverified.length} \u884C\uFF0C\u539F\u56E0\uFF1A${[...tally].map(([k, n]) => `${k}\xD7${n}`).join("\uFF0C")}\uFF1B\u9010\u884C\u89C1 --report
5680
+ `);
5681
+ }
5682
+ if (mismatched.length) {
5683
+ const byStep = /* @__PURE__ */ new Map();
5684
+ for (const r of mismatched) {
5685
+ const bad = (r.verification?.fields ?? []).filter((f) => f.status !== "UNVERIFIABLE").map((f) => f.reason);
5686
+ const reasons = new Set(bad.length ? bad : [r.verification?.reason]);
5687
+ for (const step2 of new Set([...reasons].map(importNextStep))) byStep.set(step2, (byStep.get(step2) ?? 0) + 1);
5688
+ }
5689
+ for (const [step2, n] of byStep) process.stderr.write(` \xB7 ${n} \u884C\uFF1A${step2}
5690
+ `);
5691
+ process.stderr.write("\u4E0B\u4E00\u6B65\uFF1A\u6838\u9A8C\u5931\u8D25\u7684\u884C\u5DF2\u7ECF\u5199\u5165\uFF0C\u{1F534} \u4E0D\u8981\u6574\u4EFD\u91CD\u8DD1\uFF08\u5DF2\u5B58\u5728\u7684\u884C\u4F1A\u88AB\u8DF3\u8FC7\uFF0C\u8BFB\u4E0D\u5230\u7684\u884C\u4F1A\u518D\u5EFA\u4E00\u6761\uFF09\uFF1B\u6309\u4E0A\u9762\u6BCF\u79CD\u539F\u56E0\u5404\u81EA\u5904\u7406\n");
5692
+ } else if (unverified.length) {
5693
+ const legacyOnly = unverified.every((r) => r.verification?.status === "LEGACY_NO_VERIFICATION");
5694
+ process.stderr.write(legacyOnly ? "\u4E0B\u4E00\u6B65\uFF1ACore \u7248\u672C\u65E9\u4E8E\u5199\u540E\u6838\u9A8C\u4E0A\u7EBF\uFF08\u6CA1\u6536\u5230\u6838\u9A8C\u5757\uFF09\uFF0C\u5347\u7EA7 Core \u540E --verify \u624D\u6709\u7ED3\u8BBA\uFF1B\u5DF2\u5199\u5165\u7684\u884C\u4E0D\u8981\u56E0\u6B64\u91CD\u8DD1\n" : "\u4E0B\u4E00\u6B65\uFF1A\u5DF2\u5199\u5165\u3001\u6CA1\u6838\u6210\u7684\u884C\u6309\u539F\u56E0\u624B\u5DE5\u6838\u5BF9\uFF1B\u4E0D\u8981\u56E0\u4E3A\u300C\u672A\u6838\u9A8C\u300D\u6574\u4EFD\u91CD\u8DD1\n");
5695
+ }
5696
+ }
5570
5697
 
5571
5698
  // src/commands/describe.ts
5572
5699
  init_exit();
@@ -6205,11 +6332,11 @@ async function chatCommand(prompt, args) {
6205
6332
  lastConversationId: handle.conversationId,
6206
6333
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
6207
6334
  });
6208
- await new Promise((resolve7) => {
6335
+ await new Promise((resolve8) => {
6209
6336
  if (process.stdout.writableNeedDrain) {
6210
- process.stdout.once("drain", resolve7);
6337
+ process.stdout.once("drain", resolve8);
6211
6338
  } else {
6212
- resolve7();
6339
+ resolve8();
6213
6340
  }
6214
6341
  });
6215
6342
  process.exitCode = 0;
@@ -6278,11 +6405,11 @@ async function chatCommand(prompt, args) {
6278
6405
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
6279
6406
  });
6280
6407
  process.removeListener("SIGINT", sigintHandler);
6281
- await new Promise((resolve7) => {
6408
+ await new Promise((resolve8) => {
6282
6409
  if (process.stdout.writableNeedDrain) {
6283
- process.stdout.once("drain", resolve7);
6410
+ process.stdout.once("drain", resolve8);
6284
6411
  } else {
6285
- resolve7();
6412
+ resolve8();
6286
6413
  }
6287
6414
  });
6288
6415
  process.exitCode = result.status === "interrupted" ? 130 : 0;
@@ -7546,7 +7673,7 @@ function emit3(payload, fmt) {
7546
7673
  init_exit();
7547
7674
  init_auth_guard();
7548
7675
  import { promises as fs7 } from "fs";
7549
- import * as path5 from "path";
7676
+ import * as path6 from "path";
7550
7677
  import yaml from "js-yaml";
7551
7678
  import { HcmClient as HcmClient22, fromAxiosError as fromAxiosError21, CliError as CliError23, CliErrorCode as CliErrorCode23, stripDefinitionIds, columnSlotsToFlex, redactDescriptiveUuids, removeActionsUsingScripts, stripUnknownFieldKeysForPath } from "@hcmai/sdk";
7552
7679
 
@@ -7632,10 +7759,10 @@ function createLaneApi(http) {
7632
7759
  }
7633
7760
  return out.filter((x) => x.name);
7634
7761
  },
7635
- async tenantMetaGet(path25) {
7636
- 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 } });
7637
7764
  const d = resp.data?.data ?? resp.data;
7638
- 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`);
7639
7766
  return { content: d.content, sourceKind: d.source?.kind };
7640
7767
  }
7641
7768
  };
@@ -8333,7 +8460,7 @@ async function resolvePackageIdentity(api2, opts) {
8333
8460
  async function envExportConfigCommand(args) {
8334
8461
  try {
8335
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>" } });
8336
- const outDir = path5.resolve(args.out);
8463
+ const outDir = path6.resolve(args.out);
8337
8464
  const columnSlots = args.columnSlots ?? "to-flex";
8338
8465
  if (columnSlots !== "to-flex" && columnSlots !== "keep") {
8339
8466
  throw new CliError23({
@@ -8357,12 +8484,12 @@ async function envExportConfigCommand(args) {
8357
8484
  `)
8358
8485
  });
8359
8486
  if (args.force) {
8360
- await fs7.rm(path5.join(outDir, "data"), { recursive: true, force: true });
8361
- 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 });
8362
8489
  }
8363
8490
  for (const [rel, content] of result.files) {
8364
- const abs = path5.join(outDir, rel);
8365
- await fs7.mkdir(path5.dirname(abs), { recursive: true });
8491
+ const abs = path6.join(outDir, rel);
8492
+ await fs7.mkdir(path6.dirname(abs), { recursive: true });
8366
8493
  await fs7.writeFile(abs, content, "utf8");
8367
8494
  }
8368
8495
  const r = result.report;
@@ -8388,7 +8515,7 @@ async function envExportConfigCommand(args) {
8388
8515
  }, null, 2) + "\n");
8389
8516
  process.stderr.write(renderColumnSlots(r.columnSlots));
8390
8517
  if (r.status === "DEGRADED") {
8391
- 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
8392
8519
  `);
8393
8520
  }
8394
8521
  process.stderr.write(renderNextSteps(outDir, r));
@@ -8436,7 +8563,7 @@ function renderNextSteps(outDir, r) {
8436
8563
  init_exit();
8437
8564
  init_auth_guard();
8438
8565
  import { promises as fs8 } from "fs";
8439
- import * as path6 from "path";
8566
+ import * as path7 from "path";
8440
8567
  import yaml2 from "js-yaml";
8441
8568
  import { HcmClient as HcmClient23, fromAxiosError as fromAxiosError22, CliError as CliError24, CliErrorCode as CliErrorCode24 } from "@hcmai/sdk";
8442
8569
  var FINGERPRINT_MODELS = ["Employee", "OrgUnit", "Position", "Assignment"];
@@ -9106,7 +9233,7 @@ async function envFingerprintCommand(args) {
9106
9233
  `) });
9107
9234
  assertRedLine(fp, fieldMetas);
9108
9235
  const text2 = yaml2.dump(fp, { lineWidth: -1, noRefs: true });
9109
- const outFile = path6.resolve(args.out);
9236
+ const outFile = path7.resolve(args.out);
9110
9237
  await fs8.writeFile(outFile, text2, "utf8");
9111
9238
  const summary = {
9112
9239
  out: outFile,
@@ -9162,8 +9289,9 @@ async function envFingerprintCommand(args) {
9162
9289
  init_exit();
9163
9290
  import { promises as fsp2 } from "fs";
9164
9291
  import os3 from "os";
9165
- import path11 from "path";
9292
+ import path12 from "path";
9166
9293
  import { createHash as createHash4 } from "crypto";
9294
+ import axios4 from "axios";
9167
9295
  import {
9168
9296
  createHttpClient as createHttpClient2,
9169
9297
  fetchSkillCatalog,
@@ -9383,7 +9511,7 @@ function boundaryFallbackLine(reason, notFetchedBy) {
9383
9511
 
9384
9512
  // src/commands/chiron-project.ts
9385
9513
  import { promises as fs10 } from "fs";
9386
- import path8 from "path";
9514
+ import path9 from "path";
9387
9515
 
9388
9516
  // src/commands/chiron-case.ts
9389
9517
  init_exit();
@@ -9391,10 +9519,10 @@ import { execFile } from "child_process";
9391
9519
  import { promisify } from "util";
9392
9520
  import { cpSync, existsSync, mkdirSync, mkdtempSync, readFileSync as readFileSync5, rmSync, statSync as statSync3, writeFileSync as writeFileSync2 } from "fs";
9393
9521
  import os2 from "os";
9394
- import path7 from "path";
9522
+ import path8 from "path";
9395
9523
  import { CASES_REPO_SLUG, CASES_REPO_URL, CNB_ORIGIN, CliError as CliError26, CliErrorCode as CliErrorCode26, formatObject as formatObject19 } from "@hcmai/sdk";
9396
- var casesCacheDir = () => process.env.HCM_CASES_CACHE?.trim() || path7.join(os2.homedir(), ".cache", "hcm", "chiron-cases");
9397
- 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");
9398
9526
  var INDEX_TTL_MS = 60 * 60 * 1e3;
9399
9527
  var fail5 = (message, nextStep, context = {}) => new CliError26({ code: CliErrorCode26.INVALID_ARGUMENT, message, context: { nextStep, ...context } });
9400
9528
  var execFileAsync = promisify(execFile);
@@ -9406,7 +9534,7 @@ function stderrCause(stderr) {
9406
9534
  }
9407
9535
  var runCaseProcess = async (cmd, args, opts = {}) => {
9408
9536
  const { timeoutMs, label: given, ...rest } = opts;
9409
- 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();
9410
9538
  try {
9411
9539
  const pending = execFileAsync(cmd, args, { encoding: "utf8", maxBuffer: 1 << 26, timeout: timeoutMs ?? 0, ...rest });
9412
9540
  pending.child.stdin?.end();
@@ -9432,8 +9560,8 @@ var CNB_NOT_FOUND = "\u627E\u4E0D\u5230 cnb \u53EF\u6267\u884C\u6587\u4EF6\uFF08
9432
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";
9433
9561
  var CNB_NETWORK_CAUSE = /ECONN\w*|ENOTFOUND|EAI_AGAIN|ETIMEDOUT|fetch failed|socket|TLS/i;
9434
9562
  var CNB_LOGIN_CAUSE = /未登录|登录凭证|登录失效|cnb login|unauthori[sz]ed/i;
9435
- var windowsPathDirs = (pathVar, p = path7) => pathVar.split(";").map((d) => d.trim().replace(/^"(.*)"$/, "$1")).filter((d) => p.isAbsolute(d));
9436
- 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) {
9437
9565
  const rel = /"%~?dp0%?[\\/]([^"%]+\.[cm]?js)"/i.exec(text2)?.[1];
9438
9566
  return rel ? p.join(dir, ...rel.split(/[\\/]/)) : /"([A-Za-z]:[\\/][^"%]+\.[cm]?js)"/.exec(text2)?.[1];
9439
9567
  }
@@ -9451,9 +9579,9 @@ function resolveCnb() {
9451
9579
  return r;
9452
9580
  };
9453
9581
  for (const dir of dirs) {
9454
- const exe = path7.join(dir, "cnb.exe");
9582
+ const exe = path8.join(dir, "cnb.exe");
9455
9583
  if (existsSync(exe)) return use({ cmd: exe, prefix: [] });
9456
- 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))) {
9457
9585
  let text2;
9458
9586
  try {
9459
9587
  text2 = readFileSync5(shim, "utf8");
@@ -9462,7 +9590,7 @@ function resolveCnb() {
9462
9590
  continue;
9463
9591
  }
9464
9592
  if (/^\s*volta run %~n0 %\*\s*$/im.test(text2)) {
9465
- 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));
9466
9594
  if (volta) return use({ cmd: volta, prefix: ["run", "cnb"] });
9467
9595
  blocked ??= `\u627E\u5230\u4E86 Volta \u7684 ${shim}\uFF0C\u4F46 PATH \u91CC\u6CA1\u6709 volta.exe`;
9468
9596
  continue;
@@ -9560,7 +9688,7 @@ async function loadIndex(opts = {}) {
9560
9688
  const cases2 = JSON.parse(text2).cases;
9561
9689
  const fetchedAt = (/* @__PURE__ */ new Date()).toISOString();
9562
9690
  if (opts.writeCache !== false) {
9563
- mkdirSync(path7.dirname(file), { recursive: true });
9691
+ mkdirSync(path8.dirname(file), { recursive: true });
9564
9692
  writeFileSync2(file, text2);
9565
9693
  }
9566
9694
  return { cases: cases2, source: "live", fetchedAt };
@@ -9740,16 +9868,16 @@ async function caseMatchCommand(args) {
9740
9868
  }
9741
9869
  async function caseSubmitCommand(dir, args) {
9742
9870
  await guard(async () => {
9743
- const src = path7.resolve(dir);
9744
- if (!existsSync(path7.join(src, "case.yml"))) {
9871
+ const src = path8.resolve(dir);
9872
+ if (!existsSync(path8.join(src, "case.yml"))) {
9745
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");
9746
9874
  }
9747
- const yamlText = readFileSync5(path7.join(src, "case.yml"), "utf8");
9875
+ const yamlText = readFileSync5(path8.join(src, "case.yml"), "utf8");
9748
9876
  const id = /^\s*(?:id|case_id):\s*(\S+)/m.exec(yamlText)?.[1];
9749
9877
  if (!id) throw fail5("case.yml \u91CC\u6CA1\u6709 id", "case.yml \u9876\u5C42\u8981\u6709 `id: CASE-YYYYMMDD-xxx`\u3002");
9750
- const work = mkdtempSync(path7.join(os2.tmpdir(), "hcm-case-submit-"));
9878
+ const work = mkdtempSync(path8.join(os2.tmpdir(), "hcm-case-submit-"));
9751
9879
  try {
9752
- const repo = path7.join(work, "chiron-cases");
9880
+ const repo = path8.join(work, "chiron-cases");
9753
9881
  try {
9754
9882
  await run("git", ["clone", "--depth", "1", "--filter=blob:none", "--quiet", CASES_REPO_URL, repo]);
9755
9883
  } catch (e) {
@@ -9760,10 +9888,10 @@ async function caseSubmitCommand(dir, args) {
9760
9888
  }
9761
9889
  const branch = `case/${id}-submit`;
9762
9890
  await run("git", ["-C", repo, "checkout", "-q", "-B", branch]);
9763
- const dst = path7.join(repo, "cases", args.category, id);
9891
+ const dst = path8.join(repo, "cases", args.category, id);
9764
9892
  cpSync(src, dst, { recursive: true, filter: (p) => !p.includes("node_modules") });
9765
- mkdirSync(path7.join(dst, "evidence"), { recursive: true });
9766
- 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");
9767
9895
  doc = /^\s*tier:/m.test(doc) ? doc.replace(/^\s*tier:.*$/m, "tier: public") : `tier: public
9768
9896
  ${doc}`;
9769
9897
  doc = /^\s*category:/m.test(doc) ? doc.replace(/^\s*category:.*$/m, `category: ${args.category}`) : `category: ${args.category}
@@ -9772,7 +9900,7 @@ ${doc}`;
9772
9900
  ${doc}`;
9773
9901
  if (!/^\s*status:/m.test(doc)) doc = `status: approved
9774
9902
  ${doc}`;
9775
- writeFileSync2(path7.join(dst, "case.yml"), doc);
9903
+ writeFileSync2(path8.join(dst, "case.yml"), doc);
9776
9904
  await run("python3", ["scripts/render-readme.py", dst], { cwd: repo });
9777
9905
  let lint;
9778
9906
  try {
@@ -9828,10 +9956,10 @@ var SKILLS_DIR = "hcm-skills";
9828
9956
  var SKILLS_SYNC_SUBDIR = "sync";
9829
9957
  var SKILLS_LOCAL_SUBDIR = "local";
9830
9958
  function skillsSyncDir(root) {
9831
- return path8.join(root, SKILLS_DIR, SKILLS_SYNC_SUBDIR);
9959
+ return path9.join(root, SKILLS_DIR, SKILLS_SYNC_SUBDIR);
9832
9960
  }
9833
9961
  function skillsLocalDir(root) {
9834
- return path8.join(root, SKILLS_DIR, SKILLS_LOCAL_SUBDIR);
9962
+ return path9.join(root, SKILLS_DIR, SKILLS_LOCAL_SUBDIR);
9835
9963
  }
9836
9964
  var CHIRON_PROJECT_DIRECTORIES = [
9837
9965
  "work",
@@ -9927,13 +10055,13 @@ async function inspectJira(opts = {}) {
9927
10055
 
9928
10056
  // src/commands/skills-bundled.ts
9929
10057
  import { existsSync as existsSync3, statSync as statSync5, promises as fsp } from "fs";
9930
- import * as path10 from "path";
10058
+ import * as path11 from "path";
9931
10059
  import { CliError as CliError27, CliErrorCode as CliErrorCode27, assertSafeReferencePath, parseSkillRequirements } from "@hcmai/sdk";
9932
10060
 
9933
10061
  // src/commands/skills-manifest.ts
9934
10062
  import { readFileSync as readFileSync6, readdirSync as readdirSync2, statSync as statSync4, existsSync as existsSync2 } from "fs";
9935
10063
  import { createHash as createHash3 } from "crypto";
9936
- import * as path9 from "path";
10064
+ import * as path10 from "path";
9937
10065
  import { fileURLToPath } from "url";
9938
10066
  import { formatObject as formatObject20, parseSkillFrontmatter } from "@hcmai/sdk";
9939
10067
  function collectCommandSurface(root) {
@@ -9952,8 +10080,8 @@ function collectCommandSurface(root) {
9952
10080
  return out.sort((a, b) => a.path.localeCompare(b.path));
9953
10081
  }
9954
10082
  function bundledSkillsDir() {
9955
- const here = path9.dirname(fileURLToPath(import.meta.url));
9956
- return path9.join(here, "skills");
10083
+ const here = path10.dirname(fileURLToPath(import.meta.url));
10084
+ return path10.join(here, "skills");
9957
10085
  }
9958
10086
  function sha256(buf) {
9959
10087
  return createHash3("sha256").update(buf).digest("hex");
@@ -9961,7 +10089,7 @@ function sha256(buf) {
9961
10089
  function listFiles(dir, rel = "") {
9962
10090
  const out = [];
9963
10091
  for (const name of readdirSync2(dir)) {
9964
- const p = path9.join(dir, name);
10092
+ const p = path10.join(dir, name);
9965
10093
  const r = rel ? `${rel}/${name}` : name;
9966
10094
  if (statSync4(p).isDirectory()) out.push(...listFiles(p, r));
9967
10095
  else out.push(r);
@@ -9972,17 +10100,17 @@ function collectBundledSkills(dir = bundledSkillsDir()) {
9972
10100
  if (!existsSync2(dir)) return [];
9973
10101
  const out = [];
9974
10102
  for (const id of readdirSync2(dir).sort()) {
9975
- const skillDir = path9.join(dir, id);
10103
+ const skillDir = path10.join(dir, id);
9976
10104
  if (!statSync4(skillDir).isDirectory()) continue;
9977
10105
  const files = listFiles(skillDir).sort();
9978
10106
  if (!files.includes("SKILL.md")) continue;
9979
10107
  let bytes = 0;
9980
10108
  const fileRows = files.map((rel) => {
9981
- const buf = readFileSync6(path9.join(skillDir, rel));
10109
+ const buf = readFileSync6(path10.join(skillDir, rel));
9982
10110
  bytes += buf.byteLength;
9983
10111
  return { path: rel, bytes: buf.byteLength, sha256: sha256(buf) };
9984
10112
  });
9985
- const body = readFileSync6(path9.join(skillDir, "SKILL.md"), "utf8");
10113
+ const body = readFileSync6(path10.join(skillDir, "SKILL.md"), "utf8");
9986
10114
  const fm = parseSkillFrontmatter(body, id);
9987
10115
  out.push({
9988
10116
  id,
@@ -10044,7 +10172,7 @@ function unreachable(id, detail) {
10044
10172
  });
10045
10173
  }
10046
10174
  async function readBundledReferences(skillDir) {
10047
- const root = path10.join(skillDir, "references");
10175
+ const root = path11.join(skillDir, "references");
10048
10176
  const out = [];
10049
10177
  const walk = async (dir, prefix) => {
10050
10178
  let items;
@@ -10057,22 +10185,22 @@ async function readBundledReferences(skillDir) {
10057
10185
  for (const item of items.sort((a, b) => a.name.localeCompare(b.name))) {
10058
10186
  const relative3 = prefix ? `${prefix}/${item.name}` : item.name;
10059
10187
  if (item.isDirectory()) {
10060
- await walk(path10.join(dir, item.name), relative3);
10188
+ await walk(path11.join(dir, item.name), relative3);
10061
10189
  continue;
10062
10190
  }
10063
10191
  if (!item.isFile()) continue;
10064
10192
  assertSafeReferencePath(relative3);
10065
- 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") });
10066
10194
  }
10067
10195
  };
10068
10196
  await walk(root, "");
10069
10197
  return out;
10070
10198
  }
10071
10199
  async function readBundledSkillDocument(id, dir = bundledSkillsDir()) {
10072
- const skillDir = path10.join(dir, id);
10200
+ const skillDir = path11.join(dir, id);
10073
10201
  let markdown;
10074
10202
  try {
10075
- markdown = await fsp.readFile(path10.join(skillDir, "SKILL.md"), "utf8");
10203
+ markdown = await fsp.readFile(path11.join(skillDir, "SKILL.md"), "utf8");
10076
10204
  } catch (cause) {
10077
10205
  if (cause?.code === "ENOENT") throw unreachable(id, "SKILL.md \u4E0D\u5B58\u5728");
10078
10206
  throw cause;
@@ -10224,9 +10352,9 @@ async function exists(target) {
10224
10352
  }
10225
10353
  }
10226
10354
  async function detectTarget(cwd) {
10227
- if (await exists(path11.join(cwd, ".claude"))) return "claude";
10228
- if (await exists(path11.join(cwd, "AGENTS.md"))) return "codex";
10229
- 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";
10230
10358
  return void 0;
10231
10359
  }
10232
10360
  var DIR_ROOT_WRITE_TARGETS = ["AGENTS.md", "CLAUDE.md", SKILLS_STATE_FILE];
@@ -10239,15 +10367,15 @@ async function assertDirWriteTargetsConfined(dir) {
10239
10367
  throw cause;
10240
10368
  }
10241
10369
  for (const name of DIR_ROOT_WRITE_TARGETS) {
10242
- const file = path11.join(root, name);
10370
+ const file = path12.join(root, name);
10243
10371
  const stat = await fsp2.lstat(file).catch((cause) => {
10244
10372
  if (cause.code === "ENOENT") return null;
10245
10373
  throw cause;
10246
10374
  });
10247
10375
  if (!stat?.isSymbolicLink()) continue;
10248
10376
  const destination = await fsp2.realpath(file).catch(() => null);
10249
- const relative3 = destination === null ? null : path11.relative(root, destination);
10250
- 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)) {
10251
10379
  throw new CliError28({
10252
10380
  code: CliErrorCode28.INVALID_ARGUMENT,
10253
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`,
@@ -10259,22 +10387,22 @@ async function assertDirWriteTargetsConfined(dir) {
10259
10387
  async function resolveInstallLayout(args, cwd = process.cwd(), forWrite = false) {
10260
10388
  const requested = parseSkillTarget(args.target);
10261
10389
  const target = requested ?? await detectTarget(cwd) ?? "claude";
10262
- const explicitDir = args.dir ? path11.resolve(args.dir) : void 0;
10390
+ const explicitDir = args.dir ? path12.resolve(args.dir) : void 0;
10263
10391
  if (explicitDir && forWrite) await assertDirWriteTargetsConfined(explicitDir);
10264
10392
  if (target === "codex") {
10265
- const root = explicitDir ?? (args.global ? path11.join(os3.homedir(), ".codex") : cwd);
10266
- 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");
10267
10395
  return {
10268
10396
  target,
10269
10397
  baseDir: explicitDir ?? skillsSyncDir(root),
10270
10398
  localDir: explicitDir ? void 0 : skillsLocalDir(root),
10271
- agentsFile: path11.join(root, "AGENTS.md"),
10399
+ agentsFile: path12.join(root, "AGENTS.md"),
10272
10400
  companionAgentFiles: (explicitDir || !args.global) && await exists(claudeFile) ? [claudeFile] : []
10273
10401
  };
10274
10402
  }
10275
10403
  return {
10276
10404
  target,
10277
- 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"))
10278
10406
  };
10279
10407
  }
10280
10408
  async function chironClient(args, options = {}) {
@@ -10313,7 +10441,16 @@ async function beforeAnyWrite(step2) {
10313
10441
  function fail6(e, args) {
10314
10442
  const err = e;
10315
10443
  if (err?.response?.status === 404) {
10316
- 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
+ ));
10317
10454
  }
10318
10455
  if (err?.isAxiosError) exitWithError(fromAxiosError23(err, args.env));
10319
10456
  exitWithError(e);
@@ -10473,7 +10610,7 @@ async function listInstalledSkills(keyword, args, cwd = process.cwd()) {
10473
10610
  process.exitCode = 0;
10474
10611
  return;
10475
10612
  }
10476
- 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
10477
10614
  `);
10478
10615
  process.stdout.write(" \u5168\u90E8\u88C5\u9F50\uFF1Ahcm chiron skills sync\n");
10479
10616
  process.exitCode = 0;
@@ -10504,7 +10641,7 @@ async function listInstalledSkills(keyword, args, cwd = process.cwd()) {
10504
10641
  id: x.id,
10505
10642
  title: x.title,
10506
10643
  sourceKind: "local",
10507
- 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("/"),
10508
10645
  direct: true,
10509
10646
  installedAt: void 0,
10510
10647
  status: "installed"
@@ -10662,7 +10799,7 @@ async function skillsInstallCommand(id, args) {
10662
10799
  let manifest2;
10663
10800
  let conflictNote;
10664
10801
  if (args.from) {
10665
- const root = path11.resolve(args.from);
10802
+ const root = path12.resolve(args.from);
10666
10803
  requestedIds = all ? await listLocalSkillIds(root) : [id];
10667
10804
  const seen = /* @__PURE__ */ new Set();
10668
10805
  documents = [];
@@ -10812,7 +10949,7 @@ async function skillsInstallCommand(id, args) {
10812
10949
  agentIndexes: agentIndexes2
10813
10950
  }, { format: fmtCheck }) + "\n");
10814
10951
  } else {
10815
- 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
10816
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
10817
10954
  `);
10818
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**
@@ -10840,7 +10977,7 @@ async function skillsInstallCommand(id, args) {
10840
10977
  if (fmt === "json" || fmt === "yaml") {
10841
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");
10842
10979
  } else {
10843
- 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")}`;
10844
10981
  process.stdout.write(`${headline}
10845
10982
  `);
10846
10983
  if (result.installed.length > 0) {
@@ -10859,17 +10996,17 @@ async function skillsInstallCommand(id, args) {
10859
10996
  `);
10860
10997
  }
10861
10998
  for (const index of agentIndexes) {
10862
- const reader = path11.basename(index.file) === "CLAUDE.md" ? "Claude Code" : "Codex";
10999
+ const reader = path12.basename(index.file) === "CLAUDE.md" ? "Claude Code" : "Codex";
10863
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
10864
11001
  `);
10865
11002
  }
10866
11003
  const fallback = agentIndexes.find((i) => i.boundary === "cli-fallback");
10867
11004
  if (fallback) {
10868
- 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"}`;
10869
11006
  process.stdout.write(` ${boundaryFallbackLine(fallback.boundaryFallbackReason, by)}
10870
11007
  `);
10871
11008
  }
10872
- 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}`)}
10873
11010
  `);
10874
11011
  if (conflictNote) process.stdout.write(` \u26A0\uFE0F ${conflictNote}
10875
11012
  `);
@@ -10906,7 +11043,7 @@ async function listLocalSkillIds(root) {
10906
11043
  const ids = [];
10907
11044
  for (const entry of entries) {
10908
11045
  if (!entry.isDirectory()) continue;
10909
- 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);
10910
11047
  }
10911
11048
  if (ids.length === 0) throw invalid(`\u672C\u5730\u76EE\u5F55\u91CC\u6CA1\u6709\u4EFB\u4F55 <id>/SKILL.md\uFF1A${root}`);
10912
11049
  return ids.sort();
@@ -10927,7 +11064,7 @@ async function fetchSkillDocument(http, skill, endpoint, base) {
10927
11064
  }
10928
11065
  async function ensureLocalSlot(localDir) {
10929
11066
  if (!localDir) return;
10930
- const keep = path11.join(localDir, ".gitkeep");
11067
+ const keep = path12.join(localDir, ".gitkeep");
10931
11068
  if (await fsp2.stat(localDir).then(() => true).catch(() => false)) return;
10932
11069
  await fsp2.mkdir(localDir, { recursive: true });
10933
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");
@@ -10936,7 +11073,7 @@ var isNotFound = (e) => ["ENOENT", "ENOTDIR"].includes(String(e?.code));
10936
11073
  var SkillsDirUnreadable = class extends Error {
10937
11074
  /** `claude`:`.claude/skills/` 那一半(产品版,双布局下与 local/ 对照遮蔽时才读,#399)。 */
10938
11075
  constructor(side, dir, id, cause) {
10939
- 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);
10940
11077
  super(`${where}\uFF1A${detail}`);
10941
11078
  this.side = side;
10942
11079
  this.id = id;
@@ -10965,7 +11102,7 @@ function unreadableFix(code2, detail) {
10965
11102
  if (code2 === "EACCES" || code2 === "EPERM") return "\u6CA1\u6709\u8BFB\u53D6\u6743\u9650\uFF0C\u4FEE\u597D\u6743\u9650";
10966
11103
  return `\u8BFB\u53D6\u62A5 ${code2 ?? (detail || "\u672A\u77E5\u9519\u8BEF")}\uFF0C\u6309\u8FD9\u4E2A\u62A5\u9519\u4FEE\u597D`;
10967
11104
  }
10968
- 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");
10969
11106
  async function readLocalSkills(localDir, { strict = false } = {}) {
10970
11107
  if (!localDir) return [];
10971
11108
  let names;
@@ -10977,7 +11114,7 @@ async function readLocalSkills(localDir, { strict = false } = {}) {
10977
11114
  }
10978
11115
  const out = [];
10979
11116
  for (const id of names.sort()) {
10980
- const absolute = path11.join(localDir, id, "SKILL.md");
11117
+ const absolute = path12.join(localDir, id, "SKILL.md");
10981
11118
  let markdown;
10982
11119
  try {
10983
11120
  markdown = await fsp2.readFile(absolute, "utf8");
@@ -11010,7 +11147,7 @@ async function listShadowedSkills(layout, productSide = "sync", tracked) {
11010
11147
  const isProduct = async (id) => {
11011
11148
  if (tracked && !tracked.has(id)) return false;
11012
11149
  try {
11013
- await fsp2.stat(path11.join(layout.baseDir, id, "SKILL.md"));
11150
+ await fsp2.stat(path12.join(layout.baseDir, id, "SKILL.md"));
11014
11151
  return true;
11015
11152
  } catch (e) {
11016
11153
  if (!isNotFound(e)) throw new SkillsDirUnreadable(productSide, layout.baseDir, id, e);
@@ -11035,7 +11172,7 @@ async function listShadowedSkills(layout, productSide = "sync", tracked) {
11035
11172
  }
11036
11173
  const shadowed = [];
11037
11174
  for (const s of locals) {
11038
- 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 });
11039
11176
  }
11040
11177
  return { local: locals.length, product, shadowed, unreadable };
11041
11178
  }
@@ -11064,7 +11201,7 @@ var CLAUDE_SKILLS_DIR_LABEL = ".claude/skills/";
11064
11201
  async function readClaudeLocalIndex(root) {
11065
11202
  let text2;
11066
11203
  try {
11067
- text2 = await fsp2.readFile(path11.join(root, "CLAUDE.md"), "utf8");
11204
+ text2 = await fsp2.readFile(path12.join(root, "CLAUDE.md"), "utf8");
11068
11205
  } catch (e) {
11069
11206
  if (isNotFound(e)) return { kind: "no-file" };
11070
11207
  return { kind: "unreadable", detail: e instanceof Error ? e.message : String(e) };
@@ -11143,7 +11280,7 @@ async function reportClaudeShadows(claudeDir, root) {
11143
11280
  async function resolveSkillPath(layout, id) {
11144
11281
  assertSafeSkillId(id);
11145
11282
  const at = async (dir) => {
11146
- const file = path11.join(dir, id, "SKILL.md");
11283
+ const file = path12.join(dir, id, "SKILL.md");
11147
11284
  return await fsp2.stat(file).then(() => file).catch(() => void 0);
11148
11285
  };
11149
11286
  const inSync = await at(layout.baseDir);
@@ -11153,12 +11290,12 @@ async function resolveSkillPath(layout, id) {
11153
11290
  id,
11154
11291
  file: inLocal,
11155
11292
  half: "local",
11156
- references: path11.join(layout.localDir, id, "references"),
11293
+ references: path12.join(layout.localDir, id, "references"),
11157
11294
  ...inSync ? { shadowed: inSync } : {}
11158
11295
  };
11159
11296
  }
11160
11297
  if (inSync) {
11161
- 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") };
11162
11299
  }
11163
11300
  const looked = [
11164
11301
  ...layout.localDir ? [`${layout.localDir}/${id}/SKILL.md`] : [],
@@ -11203,11 +11340,11 @@ async function findShadowBypassingRefs(layout, shadowedIds) {
11203
11340
  return [];
11204
11341
  }
11205
11342
  for (const from of ids.sort()) {
11206
- const files = [path11.join(layout.baseDir, from, "SKILL.md")];
11207
- 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");
11208
11345
  try {
11209
11346
  for (const e of await fsp2.readdir(refDir, { withFileTypes: true })) {
11210
- if (e.isFile()) files.push(path11.join(refDir, e.name));
11347
+ if (e.isFile()) files.push(path12.join(refDir, e.name));
11211
11348
  }
11212
11349
  } catch {
11213
11350
  }
@@ -11236,11 +11373,11 @@ async function syncAgentIndexes(layout, manifest2) {
11236
11373
  const files = [layout.agentsFile, ...layout.companionAgentFiles ?? []];
11237
11374
  const results = [];
11238
11375
  for (const file of files) {
11239
- const agentsDir = path11.dirname(file);
11376
+ const agentsDir = path12.dirname(file);
11240
11377
  const managed = await Promise.all(Object.keys(state?.skills ?? {}).sort().map(async (id) => {
11241
11378
  const known = catalog.get(id);
11242
- const absolute = path11.join(layout.baseDir, id, "SKILL.md");
11243
- let relative3 = path11.relative(agentsDir, absolute);
11379
+ const absolute = path12.join(layout.baseDir, id, "SKILL.md");
11380
+ let relative3 = path12.relative(agentsDir, absolute);
11244
11381
  if (!relative3.startsWith(".")) relative3 = `./${relative3}`;
11245
11382
  let title = known?.title;
11246
11383
  let description = known?.description;
@@ -11263,19 +11400,19 @@ async function syncAgentIndexes(layout, manifest2) {
11263
11400
  id,
11264
11401
  title: title ?? id,
11265
11402
  description: description ?? "",
11266
- relativePath: relative3.split(path11.sep).join("/")
11403
+ relativePath: relative3.split(path12.sep).join("/")
11267
11404
  };
11268
11405
  }));
11269
11406
  const shadowed = new Set(local.map((x) => x.id));
11270
11407
  const localEntries = local.map((x) => {
11271
- let relative3 = path11.relative(agentsDir, x.absolute);
11408
+ let relative3 = path12.relative(agentsDir, x.absolute);
11272
11409
  if (!relative3.startsWith(".")) relative3 = `./${relative3}`;
11273
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` : "";
11274
11411
  return {
11275
11412
  id: x.id,
11276
11413
  title: x.title,
11277
11414
  description: x.description ? `${x.description}${covers}` : covers,
11278
- relativePath: relative3.split(path11.sep).join("/")
11415
+ relativePath: relative3.split(path12.sep).join("/")
11279
11416
  };
11280
11417
  });
11281
11418
  const entries = [...managed.filter((m) => !shadowed.has(m.id)), ...localEntries].sort((a, b) => a.id.localeCompare(b.id));
@@ -11306,7 +11443,7 @@ async function resolveLocalSkillDocuments(sourceRoot, targetId, options = {}) {
11306
11443
  throw invalid(`\u6280\u80FD\u4F9D\u8D56\u5B58\u5728\u73AF: ${[...pathStack.slice(Math.max(0, start)), id].join(" -> ")}`);
11307
11444
  }
11308
11445
  assertSafeSkillId(id);
11309
- const local = path11.join(sourceRoot, id, "SKILL.md");
11446
+ const local = path12.join(sourceRoot, id, "SKILL.md");
11310
11447
  let markdown;
11311
11448
  try {
11312
11449
  markdown = await fsp2.readFile(local, "utf8");
@@ -11316,7 +11453,7 @@ async function resolveLocalSkillDocuments(sourceRoot, targetId, options = {}) {
11316
11453
  options.onSatisfiedElsewhere?.(id, requiredBy);
11317
11454
  return;
11318
11455
  }
11319
- 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)}`);
11320
11457
  }
11321
11458
  throw cause;
11322
11459
  }
@@ -11328,7 +11465,7 @@ async function resolveLocalSkillDocuments(sourceRoot, targetId, options = {}) {
11328
11465
  markdown,
11329
11466
  source: local,
11330
11467
  sourceKind: "local",
11331
- references: await readLocalReferences(path11.join(sourceRoot, id))
11468
+ references: await readLocalReferences(path12.join(sourceRoot, id))
11332
11469
  };
11333
11470
  for (const required2 of parseSkillRequirements2(markdown, id)) {
11334
11471
  await visit(required2, id);
@@ -11342,7 +11479,7 @@ async function resolveLocalSkillDocuments(sourceRoot, targetId, options = {}) {
11342
11479
  }
11343
11480
  async function readSkillsState(baseDir, options = {}) {
11344
11481
  try {
11345
- 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");
11346
11483
  const parsed = JSON.parse(raw);
11347
11484
  if (options.strict && (!parsed || typeof parsed !== "object" || !parsed.skills || typeof parsed.skills !== "object" || Array.isArray(parsed.skills)))
11348
11485
  throw new Error("skills \u5FC5\u987B\u662F\u5BF9\u8C61");
@@ -11355,7 +11492,7 @@ async function readSkillsState(baseDir, options = {}) {
11355
11492
  }
11356
11493
  async function writeSkillsState(baseDir, state) {
11357
11494
  await fsp2.mkdir(baseDir, { recursive: true });
11358
- const file = path11.join(baseDir, SKILLS_STATE_FILE);
11495
+ const file = path12.join(baseDir, SKILLS_STATE_FILE);
11359
11496
  const temp = `${file}.${process.pid}.tmp`;
11360
11497
  await fsp2.writeFile(temp, JSON.stringify(state, null, 2) + "\n", "utf8");
11361
11498
  await fsp2.rename(temp, file);
@@ -11388,7 +11525,7 @@ async function upsertAgentsBlock(agentsFile, block) {
11388
11525
  existing = await fsp2.readFile(agentsFile, "utf8");
11389
11526
  } catch (cause) {
11390
11527
  if (cause?.code !== "ENOENT") throw cause;
11391
- await fsp2.mkdir(path11.dirname(agentsFile), { recursive: true });
11528
+ await fsp2.mkdir(path12.dirname(agentsFile), { recursive: true });
11392
11529
  await fsp2.writeFile(agentsFile, block + "\n", "utf8");
11393
11530
  return "created";
11394
11531
  }
@@ -11414,7 +11551,7 @@ async function installSkillDocuments(documents, requestedIds, baseDir, force, me
11414
11551
  if (!document2.markdown.trim()) throw invalid(`\u6280\u80FD ${document2.id} \u5185\u5BB9\u4E3A\u7A7A`);
11415
11552
  return {
11416
11553
  ...document2,
11417
- target: path11.join(baseDir, document2.id, "SKILL.md"),
11554
+ target: path12.join(baseDir, document2.id, "SKILL.md"),
11418
11555
  bytes: Buffer.byteLength(document2.markdown)
11419
11556
  };
11420
11557
  });
@@ -11467,7 +11604,7 @@ async function sameOnDisk(baseDir, candidate) {
11467
11604
  return true;
11468
11605
  }
11469
11606
  async function readLocalReferences(skillDir) {
11470
- const root = path11.join(skillDir, "references");
11607
+ const root = path12.join(skillDir, "references");
11471
11608
  const out = [];
11472
11609
  const walk = async (dir, prefix) => {
11473
11610
  let items;
@@ -11480,12 +11617,12 @@ async function readLocalReferences(skillDir) {
11480
11617
  for (const item of items.sort((a, b) => a.name.localeCompare(b.name))) {
11481
11618
  const relative3 = prefix ? `${prefix}/${item.name}` : item.name;
11482
11619
  if (item.isDirectory()) {
11483
- await walk(path11.join(dir, item.name), relative3);
11620
+ await walk(path12.join(dir, item.name), relative3);
11484
11621
  continue;
11485
11622
  }
11486
11623
  if (!item.isFile()) continue;
11487
11624
  assertSafeReferencePath2(relative3);
11488
- 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") });
11489
11626
  }
11490
11627
  };
11491
11628
  await walk(root, "");
@@ -11517,10 +11654,10 @@ async function removeSkillDirs(baseDir, ids) {
11517
11654
  const state = await readSkillsState(baseDir);
11518
11655
  for (const id of ids) {
11519
11656
  assertSafeSkillId(id);
11520
- const dir = path11.join(baseDir, id);
11521
- const resolved = path11.resolve(dir);
11522
- if (resolved !== path11.join(path11.resolve(baseDir), id)) continue;
11523
- 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);
11524
11661
  const exists2 = await fsp2.stat(dir).then(() => true).catch(() => false);
11525
11662
  if (exists2 && !hasSkillFile) {
11526
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" });
@@ -11544,15 +11681,15 @@ async function writeSkillDocuments(documents, baseDir, removals = []) {
11544
11681
  const removed = [];
11545
11682
  try {
11546
11683
  for (const document2 of documents) {
11547
- const target = path11.join(baseDir, document2.id, "SKILL.md");
11548
- await fsp2.mkdir(path11.dirname(target), { recursive: true });
11549
- 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`);
11550
11687
  await fsp2.writeFile(temp, document2.markdown, "utf8");
11551
11688
  staged.push({ temp, target });
11552
11689
  for (const reference of document2.references ?? []) {
11553
11690
  assertSafeReferencePath2(reference.path);
11554
- const referenceTarget = path11.join(baseDir, document2.id, "references", reference.path);
11555
- 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 });
11556
11693
  const referenceTemp = `${referenceTarget}.${process.pid}.${Date.now()}.tmp`;
11557
11694
  await fsp2.writeFile(referenceTemp, reference.content, "utf8");
11558
11695
  staged.push({ temp: referenceTemp, target: referenceTarget });
@@ -11560,7 +11697,7 @@ async function writeSkillDocuments(documents, baseDir, removals = []) {
11560
11697
  }
11561
11698
  for (const stale of removals) {
11562
11699
  assertSafeReferencePath2(stale.path);
11563
- const original = path11.join(baseDir, stale.id, "references", stale.path);
11700
+ const original = path12.join(baseDir, stale.id, "references", stale.path);
11564
11701
  const parked = `${original}.${process.pid}.${Date.now()}.removed`;
11565
11702
  await fsp2.rename(original, parked);
11566
11703
  removed.push({ parked, original });
@@ -11670,7 +11807,7 @@ async function planOrphanPrune(options) {
11670
11807
  }
11671
11808
  async function readInstalled(baseDir, id) {
11672
11809
  try {
11673
- return await fsp2.readFile(path11.join(baseDir, id, "SKILL.md"), "utf8");
11810
+ return await fsp2.readFile(path12.join(baseDir, id, "SKILL.md"), "utf8");
11674
11811
  } catch (cause) {
11675
11812
  if (cause?.code === "ENOENT") return void 0;
11676
11813
  throw cause;
@@ -11678,7 +11815,7 @@ async function readInstalled(baseDir, id) {
11678
11815
  }
11679
11816
  async function readInstalledReference(baseDir, id, relative3) {
11680
11817
  try {
11681
- return await fsp2.readFile(path11.join(baseDir, id, "references", relative3), "utf8");
11818
+ return await fsp2.readFile(path12.join(baseDir, id, "references", relative3), "utf8");
11682
11819
  } catch (cause) {
11683
11820
  if (cause?.code === "ENOENT") return void 0;
11684
11821
  throw cause;
@@ -11696,7 +11833,7 @@ function installConflictAdvice(where) {
11696
11833
  if (where.half === "product") {
11697
11834
  const product = displayDir(where.productDir);
11698
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";
11699
- 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>`;
11700
11837
  }
11701
11838
  if (where.half === "local") {
11702
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`;
@@ -11717,8 +11854,8 @@ function reconcileAdvice(layout, args) {
11717
11854
  return where.half === "product" && where.target === "claude" ? (id) => skillLocalModificationAdvice(id, "claude") : (id) => skillLocalModificationAdvice(id);
11718
11855
  }
11719
11856
  function displayDir(dir) {
11720
- const relative3 = path11.relative(process.cwd(), dir);
11721
- 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;
11722
11859
  }
11723
11860
  async function compareInstalledWithSource(baseDir, id, record3, onDisk, source, force, advice = skillLocalModificationAdvice) {
11724
11861
  let differsFromSource = source.markdown !== onDisk;
@@ -11769,11 +11906,11 @@ async function planLocalSkillUpdate(options) {
11769
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` : "")
11770
11907
  });
11771
11908
  }
11772
- 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`;
11773
11910
  for (const [id, document2] of closure) {
11774
11911
  const record3 = state.skills[id];
11775
11912
  const onDisk = await readInstalled(baseDir, id);
11776
- const withoutReferences = !await exists(path11.join(root, id, "references"));
11913
+ const withoutReferences = !await exists(path12.join(root, id, "references"));
11777
11914
  if (withoutReferences && record3 && Object.keys(record3.references ?? {}).length > 0) {
11778
11915
  let onDiskCount = 0;
11779
11916
  for (const relative3 of Object.keys(record3.references ?? {})) {
@@ -12031,7 +12168,7 @@ async function requireManagedState(layout) {
12031
12168
  if (!state || Object.keys(state.skills).length === 0) {
12032
12169
  throw new CliError28({
12033
12170
  code: CliErrorCode28.INVALID_ARGUMENT,
12034
- 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`
12035
12172
  });
12036
12173
  }
12037
12174
  return state;
@@ -12040,7 +12177,7 @@ async function skillsUpdateFromLocalCommand(args) {
12040
12177
  try {
12041
12178
  const layout = await resolveInstallLayout(args, process.cwd(), true);
12042
12179
  const state = await requireManagedState(layout);
12043
- const root = path11.resolve(args.from);
12180
+ const root = path12.resolve(args.from);
12044
12181
  const ignored = [args.endpoint ? "--endpoint" : "", args.env ? "--env" : "", args.pruneMax !== void 0 ? "--prune-max" : ""].filter(Boolean);
12045
12182
  if (ignored.length > 0) {
12046
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
@@ -12116,7 +12253,7 @@ async function skillsUpdateFromLocalCommand(args) {
12116
12253
  }
12117
12254
  process.stdout.write("\n");
12118
12255
  for (const index of agentIndexes) {
12119
- const reader = path11.basename(index.file) === "CLAUDE.md" ? "Claude Code" : "Codex";
12256
+ const reader = path12.basename(index.file) === "CLAUDE.md" ? "Claude Code" : "Codex";
12120
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
12121
12258
  `);
12122
12259
  }
@@ -12138,7 +12275,7 @@ async function skillsUpdateFromLocalCommand(args) {
12138
12275
  );
12139
12276
  }
12140
12277
  for (const item of plan.referencesNotProvided) {
12141
- 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");
12142
12279
  }
12143
12280
  const tail = [
12144
12281
  skipped > 0 ? `${skipped} \u4E2A\u672C\u5730\u6539\u8FC7\u88AB\u8DF3\u8FC7\uFF08--force \u8986\u76D6\uFF09` : "",
@@ -12302,7 +12439,7 @@ async function skillsUpdateCommand(args) {
12302
12439
  if (conflictNote) process.stdout.write(` \u26A0\uFE0F ${conflictNote}
12303
12440
  `);
12304
12441
  for (const index of agentIndexes) {
12305
- const reader = path11.basename(index.file) === "CLAUDE.md" ? "Claude Code" : "Codex";
12442
+ const reader = path12.basename(index.file) === "CLAUDE.md" ? "Claude Code" : "Codex";
12306
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
12307
12444
  `);
12308
12445
  }
@@ -12345,7 +12482,7 @@ async function skillsUpdateCommand(args) {
12345
12482
  const bypass = await findShadowBypassingRefs(layout, shadowedIds);
12346
12483
  for (const hit of bypass) {
12347
12484
  process.stdout.write(
12348
- ` \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
12349
12486
  \u6B63\u6587\u6539\u6210\u6309 id \u53D6\u5740\u5C31\u4E0D\u4F1A\u518D\u9519\uFF1Ahcm chiron skills path ${hit.to}
12350
12487
  `
12351
12488
  );
@@ -12373,13 +12510,13 @@ async function skillsUpdateCommand(args) {
12373
12510
  async function detectLegacyFlatLayout(layout) {
12374
12511
  if (!layout.localDir) return void 0;
12375
12512
  if (await readSkillsState(layout.baseDir)) return void 0;
12376
- const legacyRoot = path11.dirname(layout.baseDir);
12513
+ const legacyRoot = path12.dirname(layout.baseDir);
12377
12514
  return await readSkillsState(legacyRoot) ? legacyRoot : void 0;
12378
12515
  }
12379
12516
  async function migrateFlatSkillsLayout(skillsRoot) {
12380
- const legacyState = path11.join(skillsRoot, SKILLS_STATE_FILE);
12381
- const syncDir = path11.join(skillsRoot, SKILLS_SYNC_SUBDIR);
12382
- 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);
12383
12520
  const hasLegacy = await fsp2.stat(legacyState).then(() => true).catch(() => false);
12384
12521
  if (!hasLegacy) return { moved: [], migrated: false };
12385
12522
  const state = await readSkillsState(skillsRoot);
@@ -12396,23 +12533,23 @@ async function migrateFlatSkillsLayout(skillsRoot) {
12396
12533
  }
12397
12534
  const moved = [];
12398
12535
  for (const id of names) {
12399
- 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);
12400
12537
  if (!hasSkill) continue;
12401
12538
  const to = owned.has(id) ? "sync" : "local";
12402
- const target = path11.join(to === "sync" ? syncDir : localDir, id);
12539
+ const target = path12.join(to === "sync" ? syncDir : localDir, id);
12403
12540
  if (await fsp2.stat(target).then(() => true).catch(() => false)) {
12404
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`);
12405
12542
  }
12406
- await fsp2.mkdir(path11.dirname(target), { recursive: true });
12543
+ await fsp2.mkdir(path12.dirname(target), { recursive: true });
12407
12544
  try {
12408
- await fsp2.rename(path11.join(skillsRoot, id), target);
12545
+ await fsp2.rename(path12.join(skillsRoot, id), target);
12409
12546
  } catch (cause) {
12410
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`);
12411
12548
  }
12412
12549
  moved.push({ id, to });
12413
12550
  }
12414
12551
  await fsp2.mkdir(syncDir, { recursive: true });
12415
- await fsp2.rename(legacyState, path11.join(syncDir, SKILLS_STATE_FILE));
12552
+ await fsp2.rename(legacyState, path12.join(syncDir, SKILLS_STATE_FILE));
12416
12553
  return { moved, migrated: true };
12417
12554
  }
12418
12555
  function assertSyncArgs(args) {
@@ -12436,7 +12573,7 @@ var defaultSkillsSyncDeps = {
12436
12573
  migrate: async (args) => {
12437
12574
  const layout = await resolveInstallLayout(args).catch(() => null);
12438
12575
  if (!layout || !layout.localDir) return { moved: [], migrated: false };
12439
- return migrateFlatSkillsLayout(path11.dirname(layout.baseDir));
12576
+ return migrateFlatSkillsLayout(path12.dirname(layout.baseDir));
12440
12577
  }
12441
12578
  };
12442
12579
  async function skillsSyncCommand(args, deps = defaultSkillsSyncDeps) {
@@ -12750,19 +12887,19 @@ import {
12750
12887
  CliErrorCode as CliErrorCode30,
12751
12888
  fromAxiosError as fromAxiosError25
12752
12889
  } from "@hcmai/sdk";
12753
- import axios4 from "axios";
12890
+ import axios5 from "axios";
12754
12891
  init_exit();
12755
12892
  async function bootstrapReport(http) {
12756
12893
  const read = () => http.get("/api/system/health/report", { params: { only: "tenant.bootstrap" } });
12757
12894
  try {
12758
12895
  return (await read()).data;
12759
12896
  } catch (error) {
12760
- const wait = axios4.isAxiosError(error) ? Number(error.response?.headers["retry-after"]) : NaN;
12761
- 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;
12762
12899
  const waitSeconds = Math.ceil(wait) + 1;
12763
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
12764
12901
  `);
12765
- await new Promise((resolve7) => setTimeout(resolve7, waitSeconds * 1e3));
12902
+ await new Promise((resolve8) => setTimeout(resolve8, waitSeconds * 1e3));
12766
12903
  return (await read()).data;
12767
12904
  }
12768
12905
  }
@@ -12837,7 +12974,7 @@ async function tenantReconcileCommand(args) {
12837
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" } : {}
12838
12975
  };
12839
12976
  } catch (error) {
12840
- const translated = axios4.isAxiosError(error) ? fromAxiosError25(error, env2) : error;
12977
+ const translated = axios5.isAxiosError(error) ? fromAxiosError25(error, env2) : error;
12841
12978
  verification = { status: "UNDETERMINED", reason: translated instanceof Error ? translated.message : "\u521D\u59CB\u5316\u590D\u9A8C\u5931\u8D25\uFF0C\u539F\u56E0\u672A\u77E5" };
12842
12979
  }
12843
12980
  }
@@ -12858,7 +12995,7 @@ async function tenantReconcileCommand(args) {
12858
12995
  process.exitCode = verification.status === "PASS" ? 0 : 3;
12859
12996
  } catch (error) {
12860
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");
12861
- exitWithError(axios4.isAxiosError(error) ? fromAxiosError25(error, args.env) : error);
12998
+ exitWithError(axios5.isAxiosError(error) ? fromAxiosError25(error, args.env) : error);
12862
12999
  }
12863
13000
  }
12864
13001
 
@@ -12924,10 +13061,10 @@ async function metaListCommand(args) {
12924
13061
  fail7(e, args, "read");
12925
13062
  }
12926
13063
  }
12927
- async function metaGetCommand(path25, args) {
13064
+ async function metaGetCommand(path26, args) {
12928
13065
  try {
12929
13066
  const c2 = await client2(args);
12930
- const content = await getTenantMeta(c2.raw(), path25);
13067
+ const content = await getTenantMeta(c2.raw(), path26);
12931
13068
  process.stdout.write(content.endsWith("\n") ? content : content + "\n");
12932
13069
  process.exitCode = 0;
12933
13070
  return;
@@ -12936,8 +13073,8 @@ async function metaGetCommand(path25, args) {
12936
13073
  }
12937
13074
  }
12938
13075
  var PROBEABLE_META_TYPES = /* @__PURE__ */ new Set(["model", "list", "info", "view", "filter", "page", "wiz", "impexp"]);
12939
- function parseMetaPath(path25) {
12940
- const base = path25.split(/[\\/]/).pop() ?? path25;
13076
+ function parseMetaPath(path26) {
13077
+ const base = path26.split(/[\\/]/).pop() ?? path26;
12941
13078
  if (!/\.(yml|yaml)$/i.test(base)) return {};
12942
13079
  const parts = base.replace(/\.(yml|yaml)$/i, "").split(".");
12943
13080
  return { model: parts[0] || void 0, kind: parts[1] ?? "model", state: parts[2] };
@@ -12954,10 +13091,10 @@ function unverifiableReason(e) {
12954
13091
  if (st == null) return `\u8BF7\u6C42\u6CA1\u53D1\u51FA\u53BB\u6216\u6CA1\u56DE\u6765\uFF08${err.code ?? err.message ?? "\u672A\u77E5"}\uFF09`;
12955
13092
  return void 0;
12956
13093
  }
12957
- async function verifyAfterWrite(c2, path25) {
12958
- const { model, kind, state } = parseMetaPath(path25);
13094
+ async function verifyAfterWrite(c2, path26) {
13095
+ const { model, kind, state } = parseMetaPath(path26);
12959
13096
  if (!model || !kind) {
12960
- 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` };
12961
13098
  }
12962
13099
  try {
12963
13100
  await clearMetaCache2(c2.raw(), model, {});
@@ -13002,7 +13139,7 @@ async function verifyAfterWrite(c2, path25) {
13002
13139
  }
13003
13140
  return { status: "ok" };
13004
13141
  }
13005
- async function metaSetCommand(path25, args) {
13142
+ async function metaSetCommand(path26, args) {
13006
13143
  try {
13007
13144
  if (!args.file) {
13008
13145
  throw new CliError31({
@@ -13010,17 +13147,17 @@ async function metaSetCommand(path25, args) {
13010
13147
  message: "--file <path> \u5FC5\u586B\uFF08\u4ECE\u6587\u4EF6\u8BFB\u53D6 meta \u539F\u6587\uFF1B\u7528 - \u8868\u793A stdin\uFF09"
13011
13148
  });
13012
13149
  }
13013
- const content = args.file === "-" ? await new Promise((resolve7, reject) => {
13150
+ const content = args.file === "-" ? await new Promise((resolve8, reject) => {
13014
13151
  let buf = "";
13015
13152
  process.stdin.setEncoding("utf8");
13016
13153
  process.stdin.on("data", (d) => buf += d);
13017
- process.stdin.on("end", () => resolve7(buf));
13154
+ process.stdin.on("end", () => resolve8(buf));
13018
13155
  process.stdin.on("error", reject);
13019
13156
  }) : await fsp3.readFile(args.file, "utf8");
13020
13157
  if (!args.skipValidate) {
13021
- const result2 = validateMetaContent(path25, content);
13158
+ const result2 = validateMetaContent(path26, content);
13022
13159
  if (result2.issues.length > 0) {
13023
- 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
13024
13161
  `);
13025
13162
  process.stderr.write(formatMetaIssues(result2, " ") + "\n");
13026
13163
  }
@@ -13039,13 +13176,13 @@ async function metaSetCommand(path25, args) {
13039
13176
  if (dryFmt === "json" || dryFmt === "yaml") {
13040
13177
  process.stdout.write(
13041
13178
  formatObject24(
13042
- { dryRun: true, path: path25, bytes: Buffer.byteLength(content), content },
13179
+ { dryRun: true, path: path26, bytes: Buffer.byteLength(content), content },
13043
13180
  { format: dryFmt }
13044
13181
  ) + "\n"
13045
13182
  );
13046
13183
  } else {
13047
13184
  process.stdout.write(
13048
- `[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
13049
13186
  ---
13050
13187
  ${content}
13051
13188
  `
@@ -13059,13 +13196,13 @@ ${content}
13059
13196
  let backupState = "unknown";
13060
13197
  let backupWhy;
13061
13198
  try {
13062
- const prev = await getTenantMeta(c2.raw(), path25);
13199
+ const prev = await getTenantMeta(c2.raw(), path26);
13063
13200
  if (!prev || prev.trim() === "") {
13064
13201
  backupState = "absent";
13065
13202
  } else {
13066
13203
  backupFile = nodePath.join(
13067
13204
  os4.tmpdir(),
13068
- `hcm-meta-backup-${Date.now()}-${path25.replace(/[\\/]/g, "_")}`
13205
+ `hcm-meta-backup-${Date.now()}-${path26.replace(/[\\/]/g, "_")}`
13069
13206
  );
13070
13207
  await fsp3.writeFile(backupFile, prev, "utf8");
13071
13208
  backupState = "saved";
@@ -13080,22 +13217,22 @@ ${content}
13080
13217
  backupWhy = `HTTP ${st ?? "-"}${err.code ? ` ${err.code}` : ""}${err.message ? `\uFF1A${err.message}` : ""}`;
13081
13218
  }
13082
13219
  }
13083
- const result = await saveTenantMeta(c2.raw(), path25, content);
13220
+ const result = await saveTenantMeta(c2.raw(), path26, content);
13084
13221
  const fmt = args.output ?? "json";
13085
- if (fmt !== "json") process.stdout.write(`\u2705 \u5DF2\u5199\u5165 ${path25}
13222
+ if (fmt !== "json") process.stdout.write(`\u2705 \u5DF2\u5199\u5165 ${path26}
13086
13223
  `);
13087
13224
  const restoreHint = backupState === "saved" && backupFile ? ` \u65E7\u5185\u5BB9\u5DF2\u5B58\uFF1A${backupFile}
13088
- \u653E\u56DE\u53BB\uFF1Ahcm meta set ${path25} --file ${backupFile}${connFlags(args)}
13089
- ` : 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)}
13090
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
13091
- \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)}
13092
13229
  `;
13093
13230
  if (args.verify === false) {
13094
13231
  process.stderr.write(
13095
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
13096
13233
  );
13097
13234
  } else {
13098
- const outcome = await verifyAfterWrite(c2, path25);
13235
+ const outcome = await verifyAfterWrite(c2, path26);
13099
13236
  if (outcome.status === "broken") {
13100
13237
  const human = explainJacksonError(outcome.raw);
13101
13238
  process.stderr.write(
@@ -13129,23 +13266,23 @@ ${content}
13129
13266
  fail7(e, args);
13130
13267
  }
13131
13268
  }
13132
- async function metaDeleteCommand(path25, args) {
13269
+ async function metaDeleteCommand(path26, args) {
13133
13270
  try {
13134
13271
  if (!args.yes) {
13135
13272
  requireTerminalForPrompt(
13136
- `\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`,
13137
- `\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)}`
13138
13275
  );
13139
- 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`);
13140
13277
  if (!ok) {
13141
13278
  process.stderr.write("\u5DF2\u53D6\u6D88\n");
13142
13279
  process.exit(1);
13143
13280
  }
13144
13281
  }
13145
13282
  const c2 = await client2(args);
13146
- const result = await deleteTenantMeta(c2.raw(), path25);
13283
+ const result = await deleteTenantMeta(c2.raw(), path26);
13147
13284
  const fmt = args.output ?? "json";
13148
- 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}
13149
13286
  `);
13150
13287
  process.stdout.write(formatObject24(result, { format: fmt }) + "\n");
13151
13288
  process.exitCode = 0;
@@ -13154,7 +13291,7 @@ async function metaDeleteCommand(path25, args) {
13154
13291
  fail7(e, args);
13155
13292
  }
13156
13293
  }
13157
- async function metaValidateCommand(path25, args) {
13294
+ async function metaValidateCommand(path26, args) {
13158
13295
  try {
13159
13296
  if (!args.file) {
13160
13297
  throw new CliError31({
@@ -13162,20 +13299,20 @@ async function metaValidateCommand(path25, args) {
13162
13299
  message: "--file <path> \u5FC5\u586B\uFF08\u8981\u9A8C\u7684\u90A3\u4EFD\u539F\u6587\uFF1B\u7528 - \u8868\u793A stdin\uFF09"
13163
13300
  });
13164
13301
  }
13165
- const content = args.file === "-" ? await new Promise((resolve7, reject) => {
13302
+ const content = args.file === "-" ? await new Promise((resolve8, reject) => {
13166
13303
  let buf = "";
13167
13304
  process.stdin.setEncoding("utf8");
13168
13305
  process.stdin.on("data", (d) => buf += d);
13169
- process.stdin.on("end", () => resolve7(buf));
13306
+ process.stdin.on("end", () => resolve8(buf));
13170
13307
  process.stdin.on("error", reject);
13171
13308
  }) : await fsp3.readFile(args.file, "utf8");
13172
- const result = validateMetaContent(path25, content);
13309
+ const result = validateMetaContent(path26, content);
13173
13310
  const fmt = args.output ?? "table";
13174
13311
  if (fmt === "json" || fmt === "yaml") {
13175
13312
  process.stdout.write(
13176
13313
  formatObject24(
13177
13314
  {
13178
- path: path25,
13315
+ path: path26,
13179
13316
  kind: result.kind,
13180
13317
  schemaKnown: result.schemaKnown,
13181
13318
  schemaSourceCommit: META_SCHEMA_SOURCE_COMMIT,
@@ -13187,7 +13324,7 @@ async function metaValidateCommand(path25, args) {
13187
13324
  );
13188
13325
  } else {
13189
13326
  process.stdout.write(
13190
- `\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
13191
13328
  `
13192
13329
  );
13193
13330
  process.stdout.write(
@@ -13459,7 +13596,7 @@ async function metaColumnSlotSqlCommand(model, field, args) {
13459
13596
  init_exit();
13460
13597
  import * as crypto from "crypto";
13461
13598
  import * as fs12 from "fs/promises";
13462
- import * as path13 from "path";
13599
+ import * as path14 from "path";
13463
13600
  import {
13464
13601
  buildMiniPreviewTargets,
13465
13602
  buildMiniVerifyAgentReport,
@@ -13623,7 +13760,7 @@ function boolValue(value) {
13623
13760
 
13624
13761
  // src/commands/workspace-rebase.ts
13625
13762
  import * as fs11 from "fs/promises";
13626
- import * as path12 from "path";
13763
+ import * as path13 from "path";
13627
13764
  import { formatObject as formatObject26 } from "@hcmai/sdk";
13628
13765
  async function runWorkspaceRebase(workspaceKey, args, connect2) {
13629
13766
  const plan = args.plan && !args.dryRun ? readPlan(JSON.parse(await fs11.readFile(args.plan, "utf8"))) : void 0;
@@ -13668,8 +13805,8 @@ async function runWorkspaceRebase(workspaceKey, args, connect2) {
13668
13805
  content: file.workspaceContent
13669
13806
  }))
13670
13807
  };
13671
- await fs11.writeFile(path12.resolve(args.plan), JSON.stringify(draft, null, 2) + "\n", { flag: "wx", mode: 384 });
13672
- 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
13673
13810
  `);
13674
13811
  } else {
13675
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");
@@ -13753,7 +13890,7 @@ function nonnegativeInteger2(value) {
13753
13890
  }
13754
13891
  function filePath(value) {
13755
13892
  const text2 = requiredText(value, "relativePath");
13756
- 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 === "..")) {
13757
13894
  throw new Error(`relativePath \u5FC5\u987B\u662F\u5B89\u5168\u7684\u76F8\u5BF9\u6587\u4EF6\u8DEF\u5F84\uFF1A${text2}`);
13758
13895
  }
13759
13896
  return text2;
@@ -13762,6 +13899,168 @@ function writeResult2(result, format = "table", lines) {
13762
13899
  process.stdout.write((format === "table" ? lines.join("\n") : formatObject26(result, { format })) + "\n");
13763
13900
  }
13764
13901
 
13902
+ // src/commands/workspace-preflight.ts
13903
+ import {
13904
+ toWorkspacePreflightIssue
13905
+ } from "@hcmai/sdk";
13906
+ var COVERAGE_STATUSES = /* @__PURE__ */ new Set(["CHECKED", "NOT_TRIGGERED", "UNAVAILABLE"]);
13907
+ function isAppPackagePath(relativePath) {
13908
+ return relativePath.startsWith("apps/") || relativePath.startsWith("mini_apps/");
13909
+ }
13910
+ var isRecord = (v) => !!v && typeof v === "object" && !Array.isArray(v);
13911
+ var nonEmpty = (v) => typeof v === "string" && v.trim().length > 0;
13912
+ function declaresProtocol2(protocol) {
13913
+ return typeof protocol.protocolVersion === "number" && protocol.protocolVersion >= 2 || protocol.hasCoverage || protocol.hasReleaseIssues;
13914
+ }
13915
+ function protocol2Defects(protocol) {
13916
+ const defects = [];
13917
+ if (!(typeof protocol.protocolVersion === "number" && protocol.protocolVersion >= 2)) {
13918
+ defects.push("\u7F3A protocolVersion \u2265 2");
13919
+ }
13920
+ const view = isRecord(protocol.coverage) ? protocol.coverage.miniAppFinalView : void 0;
13921
+ if (!isRecord(view)) {
13922
+ defects.push("\u7F3A coverage.miniAppFinalView");
13923
+ } else if (!COVERAGE_STATUSES.has(view.status)) {
13924
+ defects.push(`coverage.miniAppFinalView.status \u8BA4\u4E0D\u51FA\uFF08${view.status === void 0 ? "\u7F3A" : JSON.stringify(view.status)}\uFF09`);
13925
+ } else if (view.status !== "CHECKED") {
13926
+ if (!nonEmpty(view.reason)) defects.push(`${view.status} \u5374\u6CA1\u6709 reason`);
13927
+ if (!nonEmpty(view.nextStep)) defects.push(`${view.status} \u5374\u6CA1\u6709 nextStep`);
13928
+ }
13929
+ if (!protocol.hasReleaseIssues || !Array.isArray(protocol.releaseIssues)) {
13930
+ defects.push("\u7F3A releaseIssues \u6216\u5B83\u4E0D\u662F\u6570\u7EC4");
13931
+ } else if (isRecord(view) && view.status === "NOT_TRIGGERED" && protocol.releaseIssues.length) {
13932
+ defects.push("NOT_TRIGGERED \u5374\u5E26\u975E\u7A7A releaseIssues");
13933
+ }
13934
+ return defects;
13935
+ }
13936
+ function classifyPreflightReceipt(verdict, sent) {
13937
+ const { protocol } = verdict;
13938
+ const sentPaths = [...sent.writtenPaths, ...sent.deletedPaths];
13939
+ const releaseIssues = (Array.isArray(protocol.releaseIssues) ? protocol.releaseIssues : []).map(toWorkspacePreflightIssue).map((issue) => ({ ...issue, nextStep: releaseIssueNextStep(issue, sent.deletedPaths) }));
13940
+ const declared = declaresProtocol2(protocol);
13941
+ const coverage = isRecord(protocol.coverage) ? protocol.coverage : void 0;
13942
+ const base = { releaseIssues, ...coverage ? { coverage } : {} };
13943
+ if (!verdict.ok) return { row: 2, status: "failed", blocksPush: true, ...base };
13944
+ if (verdict.checked !== sentPaths.length) {
13945
+ return {
13946
+ row: 3,
13947
+ status: "unavailable",
13948
+ blocksPush: false,
13949
+ ...base,
13950
+ reason: `\u670D\u52A1\u7AEF\u53EA\u68C0\u67E5\u4E86 ${verdict.checked}/${sentPaths.length} \u4E2A\u6587\u4EF6\uFF0C\u7ED3\u8BBA\u4E0D\u8986\u76D6\u6574\u4EFD\u8BA1\u5212`,
13951
+ nextStep: "\u628A\u8FD9\u6761\u8F93\u51FA\u8FDE\u540C\u670D\u52A1\u7AEF\u7248\u672C\uFF08hcm version\uFF09\u62A5\u7ED9\u4EA7\u54C1\u4FA7\uFF1B\u5728\u6B64\u4E4B\u524D\u4EE5\u771F\u5B9E push \u7684\u7ED3\u679C\u4E3A\u51C6\u3002"
13952
+ };
13953
+ }
13954
+ if (declared) {
13955
+ const defects = protocol2Defects(protocol);
13956
+ if (defects.length) {
13957
+ return {
13958
+ row: 4,
13959
+ status: "release-unchecked",
13960
+ blocksPush: false,
13961
+ ...base,
13962
+ reason: `\u56DE\u6267\u4E0D\u7B26\u5408\u9884\u68C0\u534F\u8BAE 2\uFF1A${defects.join("\uFF1B")}`,
13963
+ nextStep: "\u628A\u8FD9\u6761\u8F93\u51FA\u8FDE\u540C\u670D\u52A1\u7AEF\u7248\u672C\uFF08hcm version\uFF09\u62A5\u7ED9\u4EA7\u54C1\u4FA7\uFF1B\u5728\u6B64\u4E4B\u524D\u53D1\u5E03\u671F\u7684\u8F7B\u5E94\u7528\u68C0\u67E5\u4EE5 release-plan \u7684\u7ED3\u679C\u4E3A\u51C6\u3002"
13964
+ };
13965
+ }
13966
+ const view = protocol.coverage.miniAppFinalView;
13967
+ const status = view.status;
13968
+ if (releaseIssues.length) {
13969
+ return {
13970
+ row: 5,
13971
+ status: "release-blocked",
13972
+ blocksPush: false,
13973
+ ...base,
13974
+ reason: `\u53D1\u5E03\u4F1A\u88AB ${releaseIssues.length} \u5904\u95EE\u9898\u6321\u4F4F\uFF08\u4E0D\u662F\u8FD9\u6B21\u63A8\u9001\u5E26\u8FDB\u6765\u7684\uFF0Cpush \u4E0D\u62E6\uFF09` + (status === "UNAVAILABLE" ? `\uFF1B\u53E6\u6709\u90E8\u5206\u6CA1\u67E5\u6210\uFF1A${view.reason}` : ""),
13975
+ nextStep: "\u53D1\u5E03\u524D\u6309\u6BCF\u6761\u95EE\u9898\u7684\u4E0B\u4E00\u6B65\u6539\u597D\uFF0C\u518D\u8DD1 hcm workspace verify" + (status === "UNAVAILABLE" ? `\uFF1B\u6CA1\u67E5\u6210\u7684\u90E8\u5206\uFF1A${view.nextStep}` : "")
13976
+ };
13977
+ }
13978
+ if (status === "CHECKED") return { row: 6, status: "passed", blocksPush: false, ...base };
13979
+ if (status === "NOT_TRIGGERED") {
13980
+ return {
13981
+ row: 7,
13982
+ status: "passed",
13983
+ blocksPush: false,
13984
+ ...base,
13985
+ ...view.reason === "NO_APP_CANDIDATES" ? { notice: view.nextStep } : {}
13986
+ };
13987
+ }
13988
+ return {
13989
+ row: 8,
13990
+ status: "release-unchecked",
13991
+ blocksPush: false,
13992
+ ...base,
13993
+ reason: `\u53D1\u5E03\u671F\u8F7B\u5E94\u7528\u68C0\u67E5\u6CA1\u505A\u6210\uFF08${view.reason}\uFF09`,
13994
+ nextStep: view.nextStep
13995
+ };
13996
+ }
13997
+ const undeclared = (reason) => ({ miniAppFinalView: "UNDECLARED", reason });
13998
+ if (sentPaths.some(isAppPackagePath)) {
13999
+ const reason = "\u56DE\u6267\u672A\u58F0\u660E\u534F\u8BAE 2\uFF08\u591A\u534A\u662F Core \u65E9\u4E8E core-4e\uFF09\uFF0C\u6CA1\u67E5\u8F7B\u5E94\u7528\u6700\u7EC8\u89C6\u56FE";
14000
+ return {
14001
+ row: 9,
14002
+ status: "release-unchecked",
14003
+ blocksPush: false,
14004
+ releaseIssues,
14005
+ coverage: undeclared(reason),
14006
+ reason,
14007
+ nextStep: "\u53D1\u5E03\u524D\u7528 hcm workspace release-plan <version> \u67E5\u8F7B\u5E94\u7528\u7684\u53D1\u5E03\u671F\u89C4\u5219\uFF08SDK \u7248\u672C\u7B49\uFF09\uFF1Bpush \u7167\u5E38\uFF1BCore \u90E8\u7F72 core-4e \u4E4B\u540E verify \u4F1A\u76F4\u63A5\u62A5\u8FD9\u4E00\u5C42\u3002"
14008
+ };
14009
+ }
14010
+ return {
14011
+ row: 10,
14012
+ status: "passed",
14013
+ blocksPush: false,
14014
+ releaseIssues,
14015
+ coverage: undeclared("Core \u672A\u58F0\u660E\u8986\u76D6\uFF1B\u672C\u6B21\u9001\u68C0\u4E0D\u542B\u5E94\u7528\u5305\u8DEF\u5F84\uFF0C\u6309\u4ECA\u5929\u5224\u901A\u8FC7")
14016
+ };
14017
+ }
14018
+ function releaseIssueNextStep(issue, deletedPaths) {
14019
+ const data = isRecord(issue.data) ? issue.data : {};
14020
+ const app = appDirOf(issue.path);
14021
+ if (data.source === "ACTIVE" && app && deletedPaths.some((p) => p.startsWith(app))) {
14022
+ return "CLI \u63A8\u9001\u7684\u5220\u9664\u4E0D\u4F1A\u5220 active \u91CC\u7684\u5E94\u7528\uFF1B\u4E0B\u7EBF\u5E94\u7528\u8D70\u663E\u5F0F\u5220\u9664\uFF08_deleted.manifest / \u53D1\u5E03\u4FA7\u5220\u9664\uFF09\uFF0C\u4E0D\u8981\u9760\u5220\u672C\u5730\u6587\u4EF6";
14023
+ }
14024
+ if (issue.errCode === "SDK_VERSION_MISMATCH") {
14025
+ return `\u628A ${issue.path ?? "manifest.json"} \u7684 sdkVersion \u6539\u6210 ${String(data.requiredSdkVersion ?? "\u670D\u52A1\u7AEF\u8981\u6C42\u7684\u7248\u672C\uFF08\u56DE\u6267\u6CA1\u7ED9\uFF09")}\uFF0C\u91CD\u8DD1 hcm workspace verify \u786E\u8BA4\u901A\u8FC7\uFF0C\u518D hcm workspace push`;
14026
+ }
14027
+ return "\u6309\u4E0A\u9762\u7684\u62A5\u9519\u6539\u597D\u540E\u91CD\u8DD1 hcm workspace verify";
14028
+ }
14029
+ function appDirOf(path26) {
14030
+ const m = path26 ? /^(mini_apps|apps)\/([^/]+)\//.exec(path26) : null;
14031
+ return m ? `${m[1]}/${m[2]}/` : void 0;
14032
+ }
14033
+ function formatCoverageDetail(coverage) {
14034
+ const view = isRecord(coverage?.miniAppFinalView) ? coverage.miniAppFinalView : void 0;
14035
+ if (!view || view.status !== "UNAVAILABLE" || view.detail === void 0 || view.detail === null) return void 0;
14036
+ const detail = view.detail;
14037
+ if (!isRecord(detail)) return `detail: ${JSON.stringify(detail)}`;
14038
+ const known = ["errCode", "message", "exceptionType", "traceId"].filter((key2) => nonEmpty(detail[key2]));
14039
+ if (!known.length) {
14040
+ const raw = JSON.stringify(detail);
14041
+ return `detail: ${raw.length > 400 ? `${raw.slice(0, 400)}\u2026\uFF08\u5DF2\u622A\u65AD\uFF0C\u5168\u6587\u5728 --output json \u7684 coverage \u91CC\uFF09` : raw}`;
14042
+ }
14043
+ return "detail: " + [
14044
+ nonEmpty(detail.errCode) ? `[${detail.errCode}]` : "",
14045
+ nonEmpty(detail.message) ? detail.message : "",
14046
+ nonEmpty(detail.exceptionType) ? detail.exceptionType : "",
14047
+ nonEmpty(detail.traceId) ? `(traceId=${detail.traceId})` : ""
14048
+ ].filter(Boolean).join(" ");
14049
+ }
14050
+ function formatReleaseIssues(issues, indent2 = "") {
14051
+ return issues.map((issue) => {
14052
+ const data = isRecord(issue.data) ? issue.data : {};
14053
+ const app = appDirOf(issue.path)?.split("/")[1];
14054
+ const sdk = data.actualSdkVersion !== void 0 || data.requiredSdkVersion !== void 0 ? ` sdkVersion ${String(data.actualSdkVersion ?? "\uFF08\u672A\u7ED9\uFF09")} \u2192 ${String(data.requiredSdkVersion ?? "\uFF08\u672A\u7ED9\uFF09")}` : "";
14055
+ const source = typeof data.source === "string" ? ` \u6765\u6E90 ${data.source}` : "";
14056
+ return [
14057
+ `${indent2}\u2717 ${app ? `${app} ` : ""}${issue.path ?? "(\u6574\u6279)"} [${issue.errCode ?? "ERROR"}]${sdk}${source}`,
14058
+ `${indent2} \u21B3 ${issue.message}`,
14059
+ `${indent2} \u21B3 \u4E0B\u4E00\u6B65\uFF1A${issue.nextStep}`
14060
+ ].join("\n");
14061
+ }).join("\n");
14062
+ }
14063
+
13765
14064
  // src/commands/workspace.ts
13766
14065
  var DEFAULT_FRONTEND_URL = "http://127.0.0.1:5179";
13767
14066
  var WORKSPACE_CONTEXT_FILE = "hcm.workspace.json";
@@ -13966,9 +14265,9 @@ async function workspacePullCommand(args) {
13966
14265
  });
13967
14266
  }
13968
14267
  await fs12.mkdir(rootDir, { recursive: true });
13969
- await fs12.mkdir(path13.join(rootDir, WORKSPACE_STATE_DIR), { recursive: true });
14268
+ await fs12.mkdir(path14.join(rootDir, WORKSPACE_STATE_DIR), { recursive: true });
13970
14269
  await fs12.writeFile(
13971
- path13.join(rootDir, WORKSPACE_STATE_DIR, WORKSPACE_PULL_INCOMPLETE_FILE),
14270
+ path14.join(rootDir, WORKSPACE_STATE_DIR, WORKSPACE_PULL_INCOMPLETE_FILE),
13972
14271
  JSON.stringify(context, null, 2) + "\n"
13973
14272
  );
13974
14273
  const pulledMiniApps = [];
@@ -13977,7 +14276,7 @@ async function workspacePullCommand(args) {
13977
14276
  http: client4.raw(),
13978
14277
  appCode,
13979
14278
  workspaceKey,
13980
- targetDir: path13.join(rootDir, MINI_APPS_DIR, appCode),
14279
+ targetDir: path14.join(rootDir, MINI_APPS_DIR, appCode),
13981
14280
  tenantId: client4.tenantId,
13982
14281
  endpoint: client4.endpoint,
13983
14282
  profile: context.profile,
@@ -14002,7 +14301,7 @@ async function workspacePullCommand(args) {
14002
14301
  }
14003
14302
  });
14004
14303
  }
14005
- const target = path13.join(rootDir, content.relativePath);
14304
+ const target = path14.join(rootDir, content.relativePath);
14006
14305
  await writeTextFile(target, content.content, !!args.force);
14007
14306
  pulledRawFiles.push(content.relativePath);
14008
14307
  snapshots.push({
@@ -14016,7 +14315,7 @@ async function workspacePullCommand(args) {
14016
14315
  }
14017
14316
  await writeWorkspaceRawState(rootDir, context, snapshots);
14018
14317
  await writeWorkspaceContext(rootDir, context);
14019
- 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));
14020
14319
  writeWorkspacePullResult(
14021
14320
  {
14022
14321
  workspaceKey,
@@ -14059,7 +14358,7 @@ async function workspaceAddMiniCommand(appCode, args) {
14059
14358
  const result = await initMiniAppProject({
14060
14359
  appCode,
14061
14360
  workspaceKey: context.workspaceKey,
14062
- targetDir: path13.join(rootDir, MINI_APPS_DIR, appCode),
14361
+ targetDir: path14.join(rootDir, MINI_APPS_DIR, appCode),
14063
14362
  name: args.name,
14064
14363
  runtimeSdkVersion: args.sdkVersion,
14065
14364
  defaultSurface: parseSurface(args.surface),
@@ -14086,7 +14385,7 @@ async function workspaceRmCommand(relativePath, args) {
14086
14385
  const rootDir = resolveRootDir(args.dir);
14087
14386
  const context = await requireWorkspaceContext(rootDir);
14088
14387
  const normalized = normalizeWorkspaceRmPath(relativePath);
14089
- const absolutePath = path13.join(rootDir, ...normalized.split("/"));
14388
+ const absolutePath = path14.join(rootDir, ...normalized.split("/"));
14090
14389
  let stat;
14091
14390
  try {
14092
14391
  stat = await fs12.lstat(absolutePath);
@@ -14216,7 +14515,7 @@ async function workspaceValidateCommand(args) {
14216
14515
  const rootDir = resolveRootDir(args.dir);
14217
14516
  await requireWorkspaceContext(rootDir);
14218
14517
  const miniApps = await discoverMiniApps(rootDir);
14219
- const metaFiles = await readWorkspaceRawLocalFiles(path13.join(rootDir, "metas"));
14518
+ const metaFiles = await readWorkspaceRawLocalFiles(path14.join(rootDir, "metas"));
14220
14519
  const metaResults = metaFiles.filter((file) => /\.ya?ml$/i.test(file.localPath)).map((file) => {
14221
14520
  const artifact = `meta:metas/${file.localPath}`;
14222
14521
  const validation = validateMetaContent2(`metas/${file.localPath}`, file.content);
@@ -14307,7 +14606,7 @@ async function workspacePushCommand(args) {
14307
14606
  if (!args.dryRun) {
14308
14607
  requireWorkspaceActivation(await probeActiveWorkspaceKey(client4), context.workspaceKey, true);
14309
14608
  }
14310
- const preflightBlocks = !!args.dryRun && !!rawResult.preflight && (rawResult.preflight.status === "failed" || rawResult.preflight.status === "unavailable");
14609
+ const preflightBlocks = !!args.dryRun && !!rawResult.preflight && !workspacePreflightOk(rawResult.preflight);
14311
14610
  process.exitCode = rawResult.conflicts.length || preflightBlocks || results.some((item) => item.result.conflicts.length) ? 3 : 0;
14312
14611
  }, args.env ?? args.profile);
14313
14612
  return;
@@ -14427,7 +14726,7 @@ async function workspaceVerifyCommand(args) {
14427
14726
  accessToken: smokeAccessToken
14428
14727
  }) : null;
14429
14728
  const preflight = miniAppPreflight(rawPlan?.preflight, validation.appCode ?? app.appCode, miniCandidates);
14430
- const ok = validation.valid && !!plan && plan.conflicts.length === 0 && (!smoke || smoke.ok) && preflight?.status !== "failed";
14729
+ const ok = validation.valid && !!plan && plan.conflicts.length === 0 && (!smoke || smoke.ok) && preflight?.status !== "failed" && preflight?.status !== "release-blocked";
14431
14730
  const report = {
14432
14731
  ok,
14433
14732
  validate: validation,
@@ -14452,7 +14751,7 @@ async function workspaceVerifyCommand(args) {
14452
14751
  reports,
14453
14752
  args.output ?? "table"
14454
14753
  );
14455
- process.exitCode = workspaceVerifyOk(rawPlan, reports) ? 0 : rawPlan?.preflight?.status === "unavailable" && workspaceRawPlanOk(rawPlan) && reports.every((item) => item.report.ok) ? 3 : 1;
14754
+ process.exitCode = workspaceVerifyOk(rawPlan, reports) ? 0 : (rawPlan?.preflight?.status === "unavailable" || rawPlan?.preflight?.status === "release-unchecked") && workspaceRawPlanOk(rawPlan) && reports.every((item) => item.report.ok) ? 3 : 1;
14456
14755
  return;
14457
14756
  } catch (e) {
14458
14757
  exitWorkspaceError(e, args.env ?? args.profile);
@@ -14469,7 +14768,7 @@ function removedMiniCommand() {
14469
14768
  );
14470
14769
  }
14471
14770
  function resolveRootDir(dir) {
14472
- return path13.resolve(dir ?? ".");
14771
+ return path14.resolve(dir ?? ".");
14473
14772
  }
14474
14773
  async function workspacePathExists(file) {
14475
14774
  try {
@@ -14486,11 +14785,11 @@ async function assertWorkspacePushRoot(rootDir) {
14486
14785
  let insideMiniApp = false;
14487
14786
  let dir = realRoot;
14488
14787
  for (; ; ) {
14489
- const parent = path13.dirname(dir);
14490
- const appsDir = path13.basename(dir) === MINI_APPS_DIR ? dir : path13.basename(parent) === MINI_APPS_DIR ? parent : void 0;
14491
- 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));
14492
14791
  insideMiniApp ||= miniDir;
14493
- if (!miniDir && await workspacePathExists(path13.join(dir, WORKSPACE_CONTEXT_FILE))) {
14792
+ if (!miniDir && await workspacePathExists(path14.join(dir, WORKSPACE_CONTEXT_FILE))) {
14494
14793
  workspaceRoot = dir;
14495
14794
  break;
14496
14795
  }
@@ -14521,7 +14820,7 @@ function buildWorkspaceContext(args) {
14521
14820
  async function readWorkspaceContext(rootDir) {
14522
14821
  try {
14523
14822
  const parsed = JSON.parse(
14524
- await fs12.readFile(path13.join(rootDir, WORKSPACE_CONTEXT_FILE), "utf-8")
14823
+ await fs12.readFile(path14.join(rootDir, WORKSPACE_CONTEXT_FILE), "utf-8")
14525
14824
  );
14526
14825
  if (parsed.kind !== WORKSPACE_CONTEXT_KIND || parsed.version !== WORKSPACE_CONTEXT_VERSION) {
14527
14826
  throw new Error(`${WORKSPACE_CONTEXT_FILE} is not an HCM workspace context`);
@@ -14551,7 +14850,7 @@ async function requireWorkspaceContext(rootDir) {
14551
14850
  }
14552
14851
  async function writeWorkspaceContext(rootDir, context) {
14553
14852
  await fs12.writeFile(
14554
- path13.join(rootDir, WORKSPACE_CONTEXT_FILE),
14853
+ path14.join(rootDir, WORKSPACE_CONTEXT_FILE),
14555
14854
  JSON.stringify(context, null, 2) + "\n"
14556
14855
  );
14557
14856
  }
@@ -14562,13 +14861,13 @@ async function writeTextFile(file, content, force) {
14562
14861
  } catch (e) {
14563
14862
  if (e.code !== "ENOENT") throw e;
14564
14863
  }
14565
- await fs12.mkdir(path13.dirname(file), { recursive: true });
14864
+ await fs12.mkdir(path14.dirname(file), { recursive: true });
14566
14865
  await fs12.writeFile(file, content);
14567
14866
  }
14568
14867
  async function readWorkspaceRawManifest(rootDir, context, forPull = false) {
14569
14868
  if (!forPull) {
14570
14869
  try {
14571
- 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));
14572
14871
  throw new CliError34({
14573
14872
  code: CliErrorCode34.BUSINESS_RULE_VIOLATION,
14574
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",
@@ -14584,7 +14883,7 @@ async function readWorkspaceRawManifest(rootDir, context, forPull = false) {
14584
14883
  try {
14585
14884
  const parsed = JSON.parse(
14586
14885
  await fs12.readFile(
14587
- path13.join(rootDir, WORKSPACE_STATE_DIR, WORKSPACE_PULL_MANIFEST_FILE),
14886
+ path14.join(rootDir, WORKSPACE_STATE_DIR, WORKSPACE_PULL_MANIFEST_FILE),
14588
14887
  "utf-8"
14589
14888
  )
14590
14889
  );
@@ -14622,9 +14921,9 @@ function workspaceRawBaselineByPath(manifest2) {
14622
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]));
14623
14922
  }
14624
14923
  async function writeWorkspaceRawManifest(rootDir, manifest2) {
14625
- const stateDir = path13.join(rootDir, WORKSPACE_STATE_DIR);
14924
+ const stateDir = path14.join(rootDir, WORKSPACE_STATE_DIR);
14626
14925
  await fs12.mkdir(stateDir, { recursive: true });
14627
- const target = path13.join(stateDir, WORKSPACE_PULL_MANIFEST_FILE);
14926
+ const target = path14.join(stateDir, WORKSPACE_PULL_MANIFEST_FILE);
14628
14927
  const temporary = `${target}.${crypto.randomUUID()}.tmp`;
14629
14928
  try {
14630
14929
  await fs12.writeFile(temporary, JSON.stringify(manifest2, null, 2) + "\n", { encoding: "utf8", flag: "wx" });
@@ -14640,7 +14939,7 @@ async function readWorkspaceRawLocalFiles(rootDir) {
14640
14939
  return files;
14641
14940
  }
14642
14941
  async function walkWorkspaceRawFiles(rootDir, relativeDir, files) {
14643
- const absoluteDir = path13.join(rootDir, relativeDir);
14942
+ const absoluteDir = path14.join(rootDir, relativeDir);
14644
14943
  let entries;
14645
14944
  try {
14646
14945
  entries = await fs12.readdir(absoluteDir, { withFileTypes: true });
@@ -14652,8 +14951,8 @@ async function walkWorkspaceRawFiles(rootDir, relativeDir, files) {
14652
14951
  if (entry.isDirectory() && RAW_WORKSPACE_EXCLUDED_DIRS.has(entry.name)) continue;
14653
14952
  if (entry.isFile() && RAW_WORKSPACE_EXCLUDED_FILES.has(entry.name)) continue;
14654
14953
  if (!relativeDir && isProtectedWorkspacePath(entry.name)) continue;
14655
- const localPath = normalizeRelativePath(path13.posix.join(toPosix(relativeDir), entry.name));
14656
- const absolutePath = path13.join(rootDir, localPath);
14954
+ const localPath = normalizeRelativePath(path14.posix.join(toPosix(relativeDir), entry.name));
14955
+ const absolutePath = path14.join(rootDir, localPath);
14657
14956
  if (entry.isDirectory()) {
14658
14957
  await walkWorkspaceRawFiles(rootDir, localPath, files);
14659
14958
  continue;
@@ -14735,7 +15034,9 @@ async function pushWorkspaceRawFiles(args) {
14735
15034
  throw new CliError34({
14736
15035
  code: CliErrorCode34.INVALID_ARGUMENT,
14737
15036
  message: `\u670D\u52A1\u7AEF\u9884\u68C0\u672A\u901A\u8FC7\uFF0C\u672C\u6B21\u6CA1\u6709\u5199\u5165\u4EFB\u4F55\u6587\u4EF6\uFF1A${result.preflight.issues.length} \u5904\u95EE\u9898
14738
- ${formatPreflightIssues(result.preflight.issues, " ")}`,
15037
+ ${formatPreflightIssues(result.preflight.issues, " ")}` + (result.preflight.releaseIssues?.length ? `
15038
+ \u53E6\u6709 ${result.preflight.releaseIssues.length} \u5904\u53D1\u5E03\u671F\u95EE\u9898\uFF08\u4E0D\u662F\u8FD9\u6B21\u63A8\u9001\u5E26\u8FDB\u6765\u7684\uFF09\uFF1A
15039
+ ${formatReleaseIssues(result.preflight.releaseIssues, " ")}` : ""),
14739
15040
  profile: args.profile ?? args.context.profile,
14740
15041
  context: {
14741
15042
  reason: "WORKSPACE_PREFLIGHT_FAILED",
@@ -14748,6 +15049,17 @@ ${formatPreflightIssues(result.preflight.issues, " ")}`,
14748
15049
  if (result.preflight.status === "unavailable") {
14749
15050
  process.stderr.write(`\u26A0 \u670D\u52A1\u7AEF\u9884\u68C0\u4E0D\u53EF\u7528\uFF08${result.preflight.reason}\uFF09\uFF0C\u6309\u9010\u6587\u4EF6\u5199\u5165\u7EE7\u7EED\uFF1B\u4E2D\u9014\u88AB\u62D2\u65F6\u524D\u9762\u7684\u6587\u4EF6\u5DF2\u7ECF\u5199\u5165\u3002
14750
15051
  `);
15052
+ if (result.preflight.releaseIssues?.length) {
15053
+ process.stderr.write(`${formatReleaseIssues(result.preflight.releaseIssues, " ")}
15054
+ `);
15055
+ }
15056
+ }
15057
+ if (result.preflight.status === "release-blocked" || result.preflight.status === "release-unchecked") {
15058
+ const detail = formatCoverageDetail(result.preflight.coverage);
15059
+ process.stderr.write(`\u26A0 \u5199\u5165\u94FE\u9884\u68C0\u5DF2\u901A\u8FC7\uFF1B${result.preflight.reason}\uFF0C\u6309\u8BA1\u5212\u5199\u5165\u3002\u4E0B\u4E00\u6B65\uFF1A${result.preflight.nextStep}
15060
+ ` + (detail ? ` ${detail}
15061
+ ` : "") + (result.preflight.releaseIssues?.length ? `${formatReleaseIssues(result.preflight.releaseIssues, " ")}
15062
+ ` : ""));
14751
15063
  }
14752
15064
  if (plan.conflicts.length) return result;
14753
15065
  const localByPath = new Map(localFiles.map((file) => [file.localPath, file]));
@@ -14919,46 +15231,51 @@ async function preflightWorkspacePlan(http, workspaceKey, operations, localFiles
14919
15231
  deletedPaths.push(...extra.deletedPaths);
14920
15232
  const sent = files.length + deletedPaths.length;
14921
15233
  if (sent === 0) {
14922
- return { status: "nothing-to-check", sent, checked: 0, issues: [], reason: "\u8BA1\u5212\u91CC\u6CA1\u6709\u8981\u5199\u5165\u6216\u5220\u9664\u7684\u6587\u4EF6" };
14923
- }
14924
- try {
14925
- const verdict = await validateWorkspaceFiles(http, workspaceKey, files, deletedPaths);
14926
- const warnings = verdict.warnings ? { warnings: verdict.warnings } : {};
14927
- if (!verdict.ok) {
14928
- return {
14929
- status: "failed",
14930
- sent,
14931
- checked: verdict.checked,
14932
- issues: verdict.issues,
14933
- ...warnings,
14934
- nextStep: preflightFailureNextStep(verdict.issues)
14935
- };
14936
- }
14937
- if (verdict.checked !== sent) {
14938
- return {
14939
- status: "unavailable",
14940
- sent,
14941
- checked: verdict.checked,
14942
- issues: [],
14943
- ...warnings,
14944
- reason: `\u670D\u52A1\u7AEF\u53EA\u68C0\u67E5\u4E86 ${verdict.checked}/${sent} \u4E2A\u6587\u4EF6\uFF0C\u7ED3\u8BBA\u4E0D\u8986\u76D6\u6574\u4EFD\u8BA1\u5212`,
14945
- nextStep: "\u628A\u8FD9\u6761\u8F93\u51FA\u8FDE\u540C\u670D\u52A1\u7AEF\u7248\u672C\uFF08hcm version\uFF09\u62A5\u7ED9\u4EA7\u54C1\u4FA7\uFF1B\u5728\u6B64\u4E4B\u524D\u4EE5\u771F\u5B9E push \u7684\u7ED3\u679C\u4E3A\u51C6\u3002"
14946
- };
14947
- }
14948
- return { status: "passed", sent, checked: verdict.checked, issues: [], ...warnings };
14949
- } catch (error) {
14950
- const status = error?.response?.status;
14951
- const translated = error?.isAxiosError ? fromAxiosError29(error, profile) : error;
14952
- const detail = translated instanceof Error ? translated.message : String(translated);
14953
15234
  return {
14954
- status: "unavailable",
15235
+ status: "nothing-to-check",
15236
+ blocksPush: false,
14955
15237
  sent,
14956
- checked: null,
15238
+ checked: 0,
14957
15239
  issues: [],
14958
- reason: status === 404 ? "\u670D\u52A1\u7AEF\u6CA1\u6709 validate-files \u9884\u68C0\uFF08\u670D\u52A1\u7AEF\u7248\u672C\u65E9\u4E8E HCMNX-328\uFF09" : `\u9884\u68C0\u8C03\u7528\u5931\u8D25\uFF1A${detail}`,
14959
- nextStep: status === 404 ? "\u670D\u52A1\u7AEF\u5347\u7EA7\u524D\uFF0Cverify / push --dry-run \u53EA\u80FD\u7ED9\u51FA\u672C\u5730\u540C\u6B65\u8BA1\u5212\uFF1B\u4EE5\u771F\u5B9E push \u7684\u7ED3\u679C\u4E3A\u51C6\u3002" : "\u786E\u8BA4\u767B\u5F55\u4E0E\u7F51\u7EDC\u540E\u91CD\u8DD1 hcm workspace verify\u3002"
15240
+ reason: "\u8BA1\u5212\u91CC\u6CA1\u6709\u8981\u5199\u5165\u6216\u5220\u9664\u7684\u6587\u4EF6"
14960
15241
  };
14961
15242
  }
15243
+ let verdict;
15244
+ try {
15245
+ verdict = await validateWorkspaceFiles(http, workspaceKey, files, deletedPaths);
15246
+ } catch (error) {
15247
+ return preflightCallFailure(error, sent, profile);
15248
+ }
15249
+ const judged = classifyPreflightReceipt(verdict, { writtenPaths: files.map((file) => file.relativePath), deletedPaths });
15250
+ if (judged.notice) process.stderr.write(`\u2139 \u670D\u52A1\u7AEF\u9884\u68C0\uFF1A${judged.notice}
15251
+ `);
15252
+ return {
15253
+ status: judged.status,
15254
+ blocksPush: judged.blocksPush,
15255
+ sent,
15256
+ checked: verdict.checked,
15257
+ issues: judged.status === "failed" ? verdict.issues : [],
15258
+ ...verdict.warnings ? { warnings: verdict.warnings } : {},
15259
+ // 服务端给了数组(含空数组)就原样带出,「给了 []」与老 Core「没给」在 JSON 里分得开
15260
+ ...Array.isArray(verdict.protocol.releaseIssues) ? { releaseIssues: judged.releaseIssues } : {},
15261
+ ...judged.coverage ? { coverage: judged.coverage } : {},
15262
+ ...judged.reason ? { reason: judged.reason } : {},
15263
+ ...judged.status === "failed" ? { nextStep: preflightFailureNextStep(verdict.issues) } : judged.nextStep ? { nextStep: judged.nextStep } : {}
15264
+ };
15265
+ }
15266
+ function preflightCallFailure(error, sent, profile) {
15267
+ const status = error?.response?.status;
15268
+ const translated = error?.isAxiosError ? fromAxiosError29(error, profile) : error;
15269
+ const detail = translated instanceof Error ? translated.message : String(translated);
15270
+ return {
15271
+ status: "unavailable",
15272
+ blocksPush: false,
15273
+ sent,
15274
+ checked: null,
15275
+ issues: [],
15276
+ reason: status === 404 ? "\u670D\u52A1\u7AEF\u6CA1\u6709 validate-files \u9884\u68C0\uFF08\u670D\u52A1\u7AEF\u7248\u672C\u65E9\u4E8E HCMNX-328\uFF09" : `\u9884\u68C0\u8C03\u7528\u5931\u8D25\uFF1A${detail}`,
15277
+ nextStep: status === 404 ? "\u670D\u52A1\u7AEF\u5347\u7EA7\u524D\uFF0Cverify / push --dry-run \u53EA\u80FD\u7ED9\u51FA\u672C\u5730\u540C\u6B65\u8BA1\u5212\uFF1B\u4EE5\u771F\u5B9E push \u7684\u7ED3\u679C\u4E3A\u51C6\u3002" : "\u786E\u8BA4\u767B\u5F55\u4E0E\u7F51\u7EDC\u540E\u91CD\u8DD1 hcm workspace verify\u3002"
15278
+ };
14962
15279
  }
14963
15280
  async function collectMiniPreflightCandidates(plans) {
14964
15281
  const candidates = { files: [], deletedPaths: [] };
@@ -14977,7 +15294,14 @@ function miniAppPreflight(preflight, appCode, candidates) {
14977
15294
  const issues = preflight.issues.filter((issue) => issue.path === null || issue.path.startsWith(prefix)).map((issue) => ({ path: issue.path, errCode: issue.errCode, message: issue.message }));
14978
15295
  if (issues.length) return { status: "failed", sent, issues };
14979
15296
  if (!sent) return { status: "nothing-to-check", sent, issues };
14980
- return { status: preflight.status === "failed" ? "passed" : preflight.status, sent, issues };
15297
+ const releaseIssues = (preflight.releaseIssues ?? []).filter((issue) => appDirOf(issue.path) === prefix).map((issue) => ({ path: issue.path, errCode: issue.errCode, message: issue.message }));
15298
+ if (releaseIssues.length) return { status: "release-blocked", sent, issues, releaseIssues };
15299
+ if (preflight.status === "failed") return { status: "passed", sent, issues };
15300
+ if (preflight.status === "release-blocked") {
15301
+ const view = preflight.coverage?.miniAppFinalView;
15302
+ return { status: view?.status === "UNAVAILABLE" ? "release-unchecked" : "passed", sent, issues };
15303
+ }
15304
+ return { status: preflight.status, sent, issues };
14981
15305
  }
14982
15306
  function formatPreflightIssues(issues, indent2 = "") {
14983
15307
  return issues.map((issue) => {
@@ -15027,9 +15351,15 @@ function withoutPreflight(result) {
15027
15351
  return rest;
15028
15352
  }
15029
15353
  function formatPreflightSummary(preflight, indent2 = "") {
15030
- const head = preflight.status === "passed" ? `server preflight: OK (${preflight.checked}/${preflight.sent} checked)` : preflight.status === "failed" ? `server preflight: FAIL (${preflight.issues.length} issues in ${preflight.checked}/${preflight.sent} checked)` : preflight.status === "unavailable" ? `server preflight: UNAVAILABLE \u2014 ${preflight.reason}\uFF08\u4E0D\u662F\u901A\u8FC7\uFF09` : `server preflight: nothing to check (${preflight.reason})`;
15354
+ const head = preflight.status === "passed" ? `server preflight: OK (${preflight.checked}/${preflight.sent} checked)` : preflight.status === "failed" ? `server preflight: FAIL (${preflight.issues.length} issues in ${preflight.checked}/${preflight.sent} checked)` : preflight.status === "unavailable" ? `server preflight: UNAVAILABLE \u2014 ${preflight.reason}\uFF08\u4E0D\u662F\u901A\u8FC7\uFF09` : preflight.status === "release-blocked" ? `server preflight: RELEASE-BLOCKED \u2014 \u5199\u5165\u94FE\u9884\u68C0\u901A\u8FC7\uFF08${preflight.checked}/${preflight.sent} checked\uFF09\uFF0C${preflight.reason}` : preflight.status === "release-unchecked" ? `server preflight: RELEASE-UNCHECKED \u2014 \u5199\u5165\u94FE\u9884\u68C0\u901A\u8FC7\uFF08${preflight.checked}/${preflight.sent} checked\uFF09\uFF0C${preflight.reason}\uFF08\u4E0D\u662F\u901A\u8FC7\uFF09` : `server preflight: nothing to check (${preflight.reason})`;
15031
15355
  const lines = [`${indent2}${head}`];
15356
+ const detail = preflight.status === "release-blocked" || preflight.status === "release-unchecked" ? formatCoverageDetail(preflight.coverage) : void 0;
15357
+ if (detail) lines.push(`${indent2} ${detail}`);
15032
15358
  if (preflight.issues.length) lines.push(formatPreflightIssues(preflight.issues, `${indent2} `));
15359
+ if (preflight.releaseIssues?.length) {
15360
+ lines.push(`${indent2} release issues: ${preflight.releaseIssues.length}\uFF08\u4E0D\u662F\u8FD9\u6B21\u63A8\u9001\u5E26\u8FDB\u6765\u7684\uFF0C\u53D1\u5E03\u4F1A\u88AB\u6321\u4F4F\uFF09`);
15361
+ lines.push(formatReleaseIssues(preflight.releaseIssues, `${indent2} `));
15362
+ }
15033
15363
  if (preflight.warnings?.length) {
15034
15364
  lines.push(`${indent2} warnings: ${preflight.warnings.length}\uFF08\u4E0D\u5F71\u54CD\u901A\u8FC7\u4E0E\u5426\uFF0C\u6309\u4E0B\u4E00\u6B65\u5904\u7406\uFF09`);
15035
15365
  lines.push(formatPreflightWarnings(preflight.warnings, `${indent2} `));
@@ -15232,7 +15562,7 @@ function workspaceRawConflict(entry, reason) {
15232
15562
  };
15233
15563
  }
15234
15564
  async function discoverMiniApps(rootDir) {
15235
- const appsRoot = path13.join(rootDir, MINI_APPS_DIR);
15565
+ const appsRoot = path14.join(rootDir, MINI_APPS_DIR);
15236
15566
  let entries;
15237
15567
  try {
15238
15568
  entries = await fs12.readdir(appsRoot, { withFileTypes: true });
@@ -15240,7 +15570,7 @@ async function discoverMiniApps(rootDir) {
15240
15570
  if (e.code === "ENOENT") return [];
15241
15571
  throw e;
15242
15572
  }
15243
- 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));
15244
15574
  }
15245
15575
  function detectRemoteMiniApps(files) {
15246
15576
  const appCodes = /* @__PURE__ */ new Set();
@@ -15425,7 +15755,7 @@ function normalizeWorkspaceKey(value) {
15425
15755
  return key2;
15426
15756
  }
15427
15757
  function normalizeWorkspaceRmPath(value) {
15428
- if (path13.isAbsolute(value) || /^[A-Za-z]:[\\/]/.test(value)) {
15758
+ if (path14.isAbsolute(value) || /^[A-Za-z]:[\\/]/.test(value)) {
15429
15759
  throw new Error("workspace rm path must be relative to the bound workspace");
15430
15760
  }
15431
15761
  const normalized = normalizeRelativePath(value);
@@ -15447,7 +15777,7 @@ function normalizeRelativePath(value) {
15447
15777
  return normalized;
15448
15778
  }
15449
15779
  function toPosix(value) {
15450
- return value.split(path13.sep).join("/");
15780
+ return value.split(path14.sep).join("/");
15451
15781
  }
15452
15782
  function sha2563(content) {
15453
15783
  return crypto.createHash("sha256").update(content, "utf-8").digest("hex");
@@ -15895,7 +16225,7 @@ async function workspaceDeactivateCommand(args) {
15895
16225
 
15896
16226
  // src/commands/identity.ts
15897
16227
  init_exit();
15898
- import axios5 from "axios";
16228
+ import axios6 from "axios";
15899
16229
  import {
15900
16230
  AUTH_INFO_PATH,
15901
16231
  CliError as CliError35,
@@ -15915,7 +16245,7 @@ import {
15915
16245
  toPrincipal
15916
16246
  } from "@hcmai/sdk";
15917
16247
  var fetchAuthInfo = async (endpoint, accessToken) => {
15918
- const response = await axios5.get(`${endpoint.replace(/\/$/, "")}${AUTH_INFO_PATH}`, {
16248
+ const response = await axios6.get(`${endpoint.replace(/\/$/, "")}${AUTH_INFO_PATH}`, {
15919
16249
  headers: { Authorization: `Bearer ${accessToken}` },
15920
16250
  timeout: 3e4
15921
16251
  });
@@ -15957,7 +16287,7 @@ async function identityShow(name, args) {
15957
16287
  const details = await inspectIdentity(name);
15958
16288
  return exitOk(formatObject28(details, { format: args.output ?? "json" }));
15959
16289
  } catch (e) {
15960
- exitWithError(axios5.isAxiosError(e) ? fromAxiosError30(e, name) : e);
16290
+ exitWithError(axios6.isAxiosError(e) ? fromAxiosError30(e, name) : e);
15961
16291
  }
15962
16292
  }
15963
16293
  async function identityList(args) {
@@ -16029,7 +16359,7 @@ async function identityRemove(name) {
16029
16359
  init_auth_guard();
16030
16360
  init_exit();
16031
16361
  import { promises as fs13 } from "fs";
16032
- import path14 from "path";
16362
+ import path15 from "path";
16033
16363
  import {
16034
16364
  CliError as CliError36,
16035
16365
  CliErrorCode as CliErrorCode36,
@@ -16090,7 +16420,7 @@ async function resolveInitEnv(root, args, deps) {
16090
16420
  };
16091
16421
  }
16092
16422
  const existing = await discoverProjectEnv5(root);
16093
- if (existing && path14.dirname(existing.path) === path14.resolve(root)) {
16423
+ if (existing && path15.dirname(existing.path) === path15.resolve(root)) {
16094
16424
  const name2 = args.env ?? existing.config.default;
16095
16425
  const env2 = existing.config.environments[name2];
16096
16426
  if (!env2) throw new CliError36({
@@ -16141,7 +16471,7 @@ ${explicitPaths}` }
16141
16471
  }
16142
16472
  async function scaffoldChironProject(root, env2, envName) {
16143
16473
  const result = { created: [], updated: [], preserved: [] };
16144
- const envFile = path14.join(root, ENV_FILE);
16474
+ const envFile = path15.join(root, ENV_FILE);
16145
16475
  const existing = await fs13.readFile(envFile, "utf8").catch(() => null);
16146
16476
  if (existing !== null) {
16147
16477
  const document2 = parseEnvYaml(existing);
@@ -16190,14 +16520,14 @@ async function scaffoldChironProject(root, env2, envName) {
16190
16520
  result.created.push(ENV_FILE);
16191
16521
  }
16192
16522
  for (const directory of CHIRON_PROJECT_DIRECTORIES) {
16193
- const absolute = path14.join(root, directory);
16523
+ const absolute = path15.join(root, directory);
16194
16524
  await ensureDirectory(absolute);
16195
- await writeIfAbsent(path14.join(absolute, ".gitkeep"), "", result, `${directory}/.gitkeep`);
16525
+ await writeIfAbsent(path15.join(absolute, ".gitkeep"), "", result, `${directory}/.gitkeep`);
16196
16526
  }
16197
16527
  return result;
16198
16528
  }
16199
16529
  async function runChironInit(args, deps = defaultChironInitDeps) {
16200
- const root = path14.resolve(args.project ?? ".");
16530
+ const root = path15.resolve(args.project ?? ".");
16201
16531
  const say = (line) => process.stderr.write(`[chiron init] ${line}
16202
16532
  `);
16203
16533
  const choice = await resolveInitEnv(root, args, deps);
@@ -16290,8 +16620,8 @@ init_exit();
16290
16620
  import { createJiraClient } from "@hcmai/sdk";
16291
16621
 
16292
16622
  // src/jira/gaps.ts
16293
- import { CASES_REPO_SLUG as CASES_REPO_SLUG3, CliError as CliError38, CliErrorCode as CliErrorCode38, describeNonBmpHits, findNonBmpChars, firstLine as firstLine3, repoIssueUrl } from "@hcmai/sdk";
16294
- import { linkedRepoRefs, parseRef as parseRef2 } from "@hcmai/sdk";
16623
+ import { CASES_REPO_SLUG as CASES_REPO_SLUG3, CliError as CliError38, CliErrorCode as CliErrorCode38, describeNonBmpHits, findNonBmpChars, firstLine as firstLine3 } from "@hcmai/sdk";
16624
+ import { linkedRepoRefs, parseRef as parseRef2, refId, refUrl } from "@hcmai/sdk";
16295
16625
 
16296
16626
  // src/jira/gap-verify.ts
16297
16627
  import {
@@ -17390,9 +17720,9 @@ async function gapStatus({ client: client4 }, ref, casesSlug = CASES_REPO_SLUG3)
17390
17720
  ${issue.fields.description ?? ""}
17391
17721
  ${cs.map((c2) => c2.body ?? "").join("\n")}`).map((l) => ({
17392
17722
  ...l,
17393
- url: repoIssueUrl(l.repo, l.number)
17723
+ url: refUrl(l)
17394
17724
  }));
17395
- for (const p of links) lines.push(`\u5DF2\u767B\u8BB0\u4EE3\u7801\u5E93\u6761\u76EE ${p.repo}#${p.number}`, ` ${p.url}`);
17725
+ for (const p of links) lines.push(`\u5DF2\u767B\u8BB0\u4EE3\u7801\u5E93\u6761\u76EE ${refId(p)}`, ` ${p.url}`);
17396
17726
  let nextStep;
17397
17727
  const verifyCmd = `\`hcm chiron gap verify ${issue.key} --result pass|fail|partial --body <\u8BC1\u636E>\``;
17398
17728
  if (status === "\u5DF2\u4FEE\u590D") {
@@ -17728,8 +18058,8 @@ async function gapVerifyCommand(ref, args, deps = defaultDeps) {
17728
18058
 
17729
18059
  // src/commands/chiron-doctor.ts
17730
18060
  import { promises as fs16 } from "fs";
17731
- import path18 from "path";
17732
- import axios10 from "axios";
18061
+ import path19 from "path";
18062
+ import axios11 from "axios";
17733
18063
  import {
17734
18064
  CliError as CliError44,
17735
18065
  CliErrorCode as CliErrorCode44,
@@ -17752,7 +18082,7 @@ init_auth_guard();
17752
18082
  // src/commands/chiron-env.ts
17753
18083
  init_exit();
17754
18084
  import { promises as fs14 } from "fs";
17755
- import path15 from "path";
18085
+ import path16 from "path";
17756
18086
  import yaml3 from "js-yaml";
17757
18087
  import {
17758
18088
  AUTH_INFO_PATH as AUTH_INFO_PATH2,
@@ -17902,9 +18232,9 @@ async function runChironEnv(action, args = {}) {
17902
18232
  if (args.output && !["table", "json", "yaml"].includes(args.output)) {
17903
18233
  invalid2(`\u672A\u77E5\u8F93\u51FA\u683C\u5F0F '${args.output}'\uFF0C\u914D\u7F6E\u672A\u5199\u5165\u3002`, "\u4F7F\u7528 --output table\u3001json \u6216 yaml");
17904
18234
  }
17905
- const root = path15.resolve(args.project ?? ".");
18235
+ const root = path16.resolve(args.project ?? ".");
17906
18236
  const discovered = await discoverProjectEnv6(root);
17907
- const file = discovered?.path ?? path15.join(root, ENV_FILE2);
18237
+ const file = discovered?.path ?? path16.join(root, ENV_FILE2);
17908
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>");
17909
18239
  const original = discovered ? await fs14.readFile(file, "utf8") : null;
17910
18240
  const config2 = original ? parseEnvYaml2(original) : { default: "", environments: {} };
@@ -18002,7 +18332,7 @@ import { promisify as promisify2 } from "util";
18002
18332
  import { createHash as createHash6 } from "crypto";
18003
18333
  import { existsSync as existsSync4, promises as fsp4 } from "fs";
18004
18334
  import os5 from "os";
18005
- import path16 from "path";
18335
+ import path17 from "path";
18006
18336
  import yaml4 from "js-yaml";
18007
18337
  import {
18008
18338
  CliError as CliError40,
@@ -18175,7 +18505,7 @@ function latestVersionTag(tags) {
18175
18505
  return [...tags.keys()].filter((t) => SEMVER_TAG.test(t)).sort(compareTags).pop();
18176
18506
  }
18177
18507
  async function listRemoteTags(deps) {
18178
- 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-"));
18179
18509
  try {
18180
18510
  await deps.git(["init", "--quiet", context], { timeoutMs: 1e4 });
18181
18511
  await deps.git(["remote", "add", "origin", deps.repoUrl], { cwd: context, timeoutMs: 1e4 });
@@ -18326,10 +18656,10 @@ function parsePackageManifest(text2) {
18326
18656
  async function sha256File(file) {
18327
18657
  return createHash6("sha256").update(await fsp4.readFile(file)).digest("hex");
18328
18658
  }
18329
- async function verifyDigests(entries, resolve7) {
18659
+ async function verifyDigests(entries, resolve8) {
18330
18660
  const out = { files: entries.length, mismatched: [], missing: [] };
18331
18661
  for (const f of entries) {
18332
- const abs = resolve7(f.path);
18662
+ const abs = resolve8(f.path);
18333
18663
  if (!existsSync4(abs)) {
18334
18664
  out.missing.push(f.path);
18335
18665
  continue;
@@ -18343,7 +18673,7 @@ async function listFilesUnder(root, rel) {
18343
18673
  const walk = async (dirRel) => {
18344
18674
  let items;
18345
18675
  try {
18346
- items = await fsp4.readdir(path16.join(root, dirRel), { withFileTypes: true });
18676
+ items = await fsp4.readdir(path17.join(root, dirRel), { withFileTypes: true });
18347
18677
  } catch {
18348
18678
  return;
18349
18679
  }
@@ -18364,9 +18694,9 @@ var BLOCK_LABEL = {
18364
18694
  "online-catalog": "\u5728\u7EBF\u4EA7\u54C1\u76EE\u5F55"
18365
18695
  };
18366
18696
  var PROJECT_SKILL_STATE_FILES = [
18367
- path16.join(SKILLS_DIR, SKILLS_SYNC_SUBDIR, SKILLS_STATE_FILE),
18368
- path16.join(SKILLS_DIR, SKILLS_STATE_FILE),
18369
- 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)
18370
18700
  ];
18371
18701
  async function onlineTargetFor(root) {
18372
18702
  try {
@@ -18406,7 +18736,7 @@ async function checkMethodConflicts(methodIds, root, online, deps) {
18406
18736
  const unreadable = [];
18407
18737
  const owners = /* @__PURE__ */ new Map();
18408
18738
  for (const rel of PROJECT_SKILL_STATE_FILES) {
18409
- const file = path16.join(root, rel);
18739
+ const file = path17.join(root, rel);
18410
18740
  if (!existsSync4(file)) continue;
18411
18741
  found2.push(rel);
18412
18742
  try {
@@ -18414,20 +18744,20 @@ async function checkMethodConflicts(methodIds, root, online, deps) {
18414
18744
  for (const [id, rec] of Object.entries(state.skills ?? {})) {
18415
18745
  if (!owners.has(id)) {
18416
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"}`;
18417
- 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`);
18418
18748
  }
18419
18749
  }
18420
18750
  } catch (e) {
18421
- 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`);
18422
18752
  }
18423
18753
  }
18424
18754
  if (found2.length === 0) {
18425
18755
  b.note = "\u672C\u9879\u76EE\u8FD8\u6CA1\u88C5\u4EA7\u54C1\u6280\u80FD\uFF0C\u4EA7\u54C1\u4FA7\u672A\u6BD4\u5BF9";
18426
18756
  } else if (owners.size === 0) {
18427
- 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`;
18428
18758
  } else {
18429
18759
  b.checked = true;
18430
- 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");
18431
18761
  b.compared = [...owners.keys()].sort();
18432
18762
  b.conflicts = b.compared.filter((id) => wanted.has(id)).map((id) => ({ id, other: owners.get(id) }));
18433
18763
  if (unreadable.length) b.note = `\u53E6\u6709\u6E05\u5355\u8BFB\u4E0D\u61C2\u3001\u6CA1\u7B97\u8FDB\u6765\uFF1A${unreadable.join("\uFF1B")}`;
@@ -18547,7 +18877,7 @@ function renderLock(lock) {
18547
18877
  `;
18548
18878
  }
18549
18879
  async function readLock(root) {
18550
- const file = path16.join(root, METHOD_DIR, METHOD_LOCK_FILE);
18880
+ const file = path17.join(root, METHOD_DIR, METHOD_LOCK_FILE);
18551
18881
  let text2;
18552
18882
  try {
18553
18883
  text2 = await fsp4.readFile(file, "utf8");
@@ -18575,17 +18905,17 @@ async function readLock(root) {
18575
18905
  }
18576
18906
  async function readState(root) {
18577
18907
  try {
18578
- 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"));
18579
18909
  } catch {
18580
18910
  return void 0;
18581
18911
  }
18582
18912
  }
18583
18913
  async function resolveMethodRoot(project2, log) {
18584
- if (project2 !== void 0) return { root: path16.resolve(project2), rootSource: "--project" };
18914
+ if (project2 !== void 0) return { root: path17.resolve(project2), rootSource: "--project" };
18585
18915
  const cwd = process.cwd();
18586
18916
  try {
18587
18917
  const found2 = await discoverProjectEnv7(cwd);
18588
- if (found2) return { root: path16.dirname(found2.path), rootSource: "env.yaml" };
18918
+ if (found2) return { root: path17.dirname(found2.path), rootSource: "env.yaml" };
18589
18919
  } catch (e) {
18590
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}`);
18591
18921
  return { root: cwd, rootSource: "cwd" };
@@ -18599,13 +18929,13 @@ async function resolveTarget(root, requested) {
18599
18929
  return (await readState(root))?.target ?? await detectTarget(root) ?? "claude";
18600
18930
  }
18601
18931
  function skillFileSig(manifest2, skill) {
18602
- const dir = `${path16.posix.dirname(skill.path)}/`;
18932
+ const dir = `${path17.posix.dirname(skill.path)}/`;
18603
18933
  return manifest2.files.filter((f) => f.path.startsWith(dir)).map((f) => `${f.path}:${f.sha256}`).sort().join("\n");
18604
18934
  }
18605
18935
  async function readCriteria(dir) {
18606
18936
  let text2;
18607
18937
  try {
18608
- text2 = await fsp4.readFile(path16.join(dir, GATES_FILE), "utf8");
18938
+ text2 = await fsp4.readFile(path17.join(dir, GATES_FILE), "utf8");
18609
18939
  } catch {
18610
18940
  return { reason: `\u6CA1\u6709 ${GATES_FILE}` };
18611
18941
  }
@@ -18673,7 +19003,7 @@ async function step(deps, n, label, fn) {
18673
19003
  }
18674
19004
  async function readInstalledManifest(root) {
18675
19005
  try {
18676
- 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");
18677
19007
  return { text: text2, manifest: parsePackageManifest(text2) };
18678
19008
  } catch {
18679
19009
  return void 0;
@@ -18682,31 +19012,31 @@ async function readInstalledManifest(root) {
18682
19012
  var sha256Text = (t) => createHash6("sha256").update(t, "utf8").digest("hex");
18683
19013
  async function hasClaudeCopies(root) {
18684
19014
  try {
18685
- 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));
18686
19016
  } catch {
18687
19017
  return false;
18688
19018
  }
18689
19019
  }
18690
19020
  function codexAgentFiles(root) {
18691
- const files = [path16.join(root, "AGENTS.md")];
18692
- 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"));
18693
19023
  return files;
18694
19024
  }
18695
19025
  async function installClaudeCopies(root, manifest2) {
18696
- const skillsRoot = path16.join(root, ".claude", "skills");
19026
+ const skillsRoot = path17.join(root, ".claude", "skills");
18697
19027
  await fsp4.mkdir(skillsRoot, { recursive: true });
18698
19028
  const ids = new Set(manifest2.skills.map((s) => s.id));
18699
19029
  const written = [];
18700
19030
  for (const s of manifest2.skills) {
18701
- const dst = path16.join(skillsRoot, s.id);
19031
+ const dst = path17.join(skillsRoot, s.id);
18702
19032
  await fsp4.rm(dst, { recursive: true, force: true });
18703
- 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 });
18704
19034
  written.push(`.claude/skills/${s.id}/`);
18705
19035
  }
18706
19036
  const pruned = [];
18707
19037
  for (const it of await fsp4.readdir(skillsRoot, { withFileTypes: true })) {
18708
19038
  if (it.isDirectory() && it.name.startsWith(METHOD_SKILL_PREFIX) && !ids.has(it.name)) {
18709
- 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 });
18710
19040
  pruned.push(`.claude/skills/${it.name}/`);
18711
19041
  }
18712
19042
  }
@@ -18715,14 +19045,14 @@ async function installClaudeCopies(root, manifest2) {
18715
19045
  async function indexEntries(root, agentsDir, manifest2) {
18716
19046
  const out = [];
18717
19047
  for (const s of manifest2.skills) {
18718
- const abs = path16.join(root, METHOD_DIR, s.path);
19048
+ const abs = path17.join(root, METHOD_DIR, s.path);
18719
19049
  let description = "";
18720
19050
  try {
18721
19051
  const fm = parseSkillFrontmatter3(await fsp4.readFile(abs, "utf8"), s.id);
18722
19052
  if (typeof fm.description === "string") description = fm.description.trim().replace(/\s+/g, " ");
18723
19053
  } catch {
18724
19054
  }
18725
- let rel = path16.relative(agentsDir, abs).split(path16.sep).join("/");
19055
+ let rel = path17.relative(agentsDir, abs).split(path17.sep).join("/");
18726
19056
  if (!rel.startsWith(".")) rel = `./${rel}`;
18727
19057
  out.push({ id: s.id, title: s.title, description, phases: s.phases, relativePath: rel });
18728
19058
  }
@@ -18745,9 +19075,9 @@ async function runMethodPipeline(input, deps) {
18745
19075
  deps.log(` ${r.ref} \u2192 ${r.commit.slice(0, 12)}`);
18746
19076
  return r;
18747
19077
  });
18748
- const work = await fsp4.mkdtemp(path16.join(os5.tmpdir(), "hcm-method-"));
19078
+ const work = await fsp4.mkdtemp(path17.join(os5.tmpdir(), "hcm-method-"));
18749
19079
  try {
18750
- const checkout = path16.join(work, "pkg");
19080
+ const checkout = path17.join(work, "pkg");
18751
19081
  const { manifest: manifest2, manifestText } = await step(deps, 2, "\u53D6\u5305\uFF08\u7A00\u758F\u6D45 clone\uFF09", async () => {
18752
19082
  await deps.git(["clone", "--depth", "1", "--filter=blob:none", "--sparse", "--quiet", "--branch", resolved.ref, deps.repoUrl, checkout]);
18753
19083
  const head = (await deps.git(["-C", checkout, "rev-parse", "HEAD"], { timeoutMs: 1e4 })).trim();
@@ -18760,7 +19090,7 @@ async function runMethodPipeline(input, deps) {
18760
19090
  }
18761
19091
  let text2;
18762
19092
  try {
18763
- text2 = await fsp4.readFile(path16.join(checkout, "package.yml"), "utf8");
19093
+ text2 = await fsp4.readFile(path17.join(checkout, "package.yml"), "utf8");
18764
19094
  } catch {
18765
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`);
18766
19096
  }
@@ -18771,11 +19101,11 @@ async function runMethodPipeline(input, deps) {
18771
19101
  });
18772
19102
  const unlisted = await step(deps, 3, "\u6821\u9A8C\u6E05\u5355\u4E0E\u6458\u8981", async () => {
18773
19103
  for (const [i, entry] of manifest2.include.entries()) {
18774
- if (!existsSync4(path16.join(checkout, entry.replace(/\/$/, "")))) {
19104
+ if (!existsSync4(path17.join(checkout, entry.replace(/\/$/, "")))) {
18775
19105
  throw invalidPackage(`include[${i}]`, `include \u767B\u8BB0\u4E86 ${entry}\uFF0C\u4F46 ${resolved.ref} \u91CC\u6CA1\u6709\u5B83`);
18776
19106
  }
18777
19107
  }
18778
- const check = await verifyDigests(manifest2.files, (p) => path16.join(checkout, p));
19108
+ const check = await verifyDigests(manifest2.files, (p) => path17.join(checkout, p));
18779
19109
  if (check.missing.length) {
18780
19110
  throw invalidPackage("files", `\u6E05\u5355\u767B\u8BB0\u4E86\u3001\u5305\u91CC\u5374\u6CA1\u6709\uFF1A${naming(check.missing)}`);
18781
19111
  }
@@ -18796,7 +19126,7 @@ async function runMethodPipeline(input, deps) {
18796
19126
  for (const l of renderConflictBlocks(blocks)) deps.log(l);
18797
19127
  return blocks;
18798
19128
  });
18799
- 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;
18800
19130
  if (diff) for (const l of renderDiff(diff)) deps.log(` ${l}`);
18801
19131
  const lock = {
18802
19132
  lockVersion: 1,
@@ -18808,29 +19138,29 @@ async function runMethodPipeline(input, deps) {
18808
19138
  skills: manifest2.skills.map((s) => s.id)
18809
19139
  };
18810
19140
  const nowIso = deps.now().toISOString();
18811
- const gitignorePath = path16.join(root, ".gitignore");
19141
+ const gitignorePath = path17.join(root, ".gitignore");
18812
19142
  const agentTargets = input.target === "codex" ? codexAgentFiles(root) : [];
18813
19143
  const gitignore = await step(deps, 5, "\u9884\u68C0\u53D7\u7BA1\u5757\u5E76\u7EF4\u62A4 .gitignore", async () => {
18814
19144
  await preflightManaged([
18815
19145
  { file: gitignorePath, begin: GITIGNORE_BEGIN, end: GITIGNORE_END, label: ".gitignore" },
18816
- ...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) }))
18817
19147
  ]);
18818
19148
  return writeManaged(gitignorePath, GITIGNORE_BEGIN, GITIGNORE_END, renderGitignoreBlock(), ".gitignore");
18819
19149
  });
18820
19150
  await step(deps, 6, `\u66FF\u6362 ${METHOD_DIR}/ \u5E76\u5199\u9501\u6587\u4EF6`, async () => {
18821
- const targetDir = path16.join(root, METHOD_DIR);
18822
- const staging = path16.join(root, `.${METHOD_DIR}.staging-${process.pid}`);
18823
- 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}`);
18824
19154
  await fsp4.rm(staging, { recursive: true, force: true });
18825
19155
  try {
18826
19156
  await fsp4.mkdir(staging, { recursive: true });
18827
19157
  for (const entry of manifest2.include) {
18828
19158
  const rel = entry.replace(/\/$/, "");
18829
- 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 });
18830
19160
  }
18831
- 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");
18832
19162
  const state = { target: input.target, installedAt: nowIso, remoteCheckedAt: nowIso };
18833
- 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)}
18834
19164
  `, "utf8");
18835
19165
  const hadOld = existsSync4(targetDir);
18836
19166
  if (hadOld) {
@@ -18854,8 +19184,8 @@ async function runMethodPipeline(input, deps) {
18854
19184
  const refreshCopies = input.target === "claude" || await hasClaudeCopies(root);
18855
19185
  if (refreshCopies) copies = await installClaudeCopies(root, manifest2);
18856
19186
  for (const file of agentTargets) {
18857
- const block = renderMethodAgentsBlock(lock, await indexEntries(root, path16.dirname(file), manifest2));
18858
- 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)) });
18859
19189
  }
18860
19190
  return { files, copies };
18861
19191
  });
@@ -18891,7 +19221,7 @@ async function runMethodPipeline(input, deps) {
18891
19221
  function renderInstallReport(r) {
18892
19222
  const out = [];
18893
19223
  const verb = r.mode === "update" ? "\u5DF2\u66F4\u65B0\u5230" : "\u5DF2\u88C5";
18894
- 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)}/`);
18895
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)}`);
18896
19226
  out.push(` \u6280\u80FD ${r.skills.length} \u4EFD\uFF1A${naming(r.skills, 6)}`);
18897
19227
  if (r.diff) for (const l of renderDiff(r.diff)) out.push(` ${l}`);
@@ -18939,7 +19269,7 @@ async function runMethodStatus(root, deps, opts = {}) {
18939
19269
  report.lock = lock;
18940
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` });
18941
19271
  const state = await readState(root);
18942
- 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);
18943
19273
  if (installed2 === void 0) {
18944
19274
  report.rows.push({
18945
19275
  item: "\u5B89\u88C5",
@@ -18960,7 +19290,7 @@ async function runMethodStatus(root, deps, opts = {}) {
18960
19290
  code: CliErrorCode41.METHOD_DIGEST_MISMATCH
18961
19291
  });
18962
19292
  } else {
18963
- 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` });
18964
19294
  let manifest2;
18965
19295
  try {
18966
19296
  manifest2 = parsePackageManifest(installed2);
@@ -18968,17 +19298,17 @@ async function runMethodStatus(root, deps, opts = {}) {
18968
19298
  report.digest.note = `\u672C\u673A package.yml \u8BFB\u4E0D\u61C2\uFF1A${e.message}`;
18969
19299
  }
18970
19300
  if (manifest2) {
18971
- 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));
18972
19302
  const copyEntries = [];
18973
19303
  const copyMap = /* @__PURE__ */ new Map();
18974
19304
  for (const s of manifest2.skills) {
18975
- const copyDir = path16.join(root, ".claude", "skills", s.id);
19305
+ const copyDir = path17.join(root, ".claude", "skills", s.id);
18976
19306
  if (!existsSync4(copyDir) && state?.target !== "claude") continue;
18977
- const prefix = `${path16.posix.dirname(s.path)}/`;
19307
+ const prefix = `${path17.posix.dirname(s.path)}/`;
18978
19308
  for (const f of manifest2.files.filter((x) => x.path.startsWith(prefix))) {
18979
19309
  const shown = `.claude/skills/${s.id}/${f.path.slice(prefix.length)}`;
18980
19310
  copyEntries.push({ ...f, path: shown });
18981
- copyMap.set(shown, path16.join(root, shown));
19311
+ copyMap.set(shown, path17.join(root, shown));
18982
19312
  }
18983
19313
  }
18984
19314
  const copies = await verifyDigests(copyEntries, (p) => copyMap.get(p));
@@ -19061,8 +19391,8 @@ async function runMethodStatus(root, deps, opts = {}) {
19061
19391
  });
19062
19392
  }
19063
19393
  for (const id of lock.skills) {
19064
- const by = path16.join(SKILLS_DIR, SKILLS_LOCAL_SUBDIR, id);
19065
- 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("/")}/` });
19066
19396
  }
19067
19397
  report.rows.push(report.shadowed.length ? {
19068
19398
  item: "\u906E\u853D",
@@ -19082,7 +19412,7 @@ async function runMethodStatus(root, deps, opts = {}) {
19082
19412
  }
19083
19413
  function renderMethodStatus(r) {
19084
19414
  const mark = { ok: "\u2705", warn: "\u26A0\uFE0F", fail: "\u274C" };
19085
- 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)}/`];
19086
19416
  for (const row of r.rows) {
19087
19417
  out.push(`${mark[row.verdict]} ${row.item} ${row.detail}`);
19088
19418
  if (row.nextStep && row.verdict !== "ok") out.push(` \u2192 ${row.nextStep}`);
@@ -19181,8 +19511,8 @@ async function methodStatusCommand(args) {
19181
19511
 
19182
19512
  // src/commands/doctor/local-checks.ts
19183
19513
  import { promises as fs15 } from "fs";
19184
- import path17 from "path";
19185
- import axios6 from "axios";
19514
+ import path18 from "path";
19515
+ import axios7 from "axios";
19186
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";
19187
19517
 
19188
19518
  // src/commands/doctor/result.ts
@@ -19298,13 +19628,13 @@ var version = async (ctx) => {
19298
19628
  var installed = async (ctx) => {
19299
19629
  let reading = "";
19300
19630
  const read = (baseDir) => {
19301
- reading = path17.join(baseDir, SKILLS_STATE_FILE);
19631
+ reading = path18.join(baseDir, SKILLS_STATE_FILE);
19302
19632
  return readSkillsState(baseDir, { strict: true });
19303
19633
  };
19304
19634
  try {
19305
19635
  const states = [];
19306
19636
  for (const [target2, folder] of [["codex", "hcm-skills/sync"], ["claude", ".claude/skills"]]) {
19307
- const baseDir = path17.join(ctx.root, folder);
19637
+ const baseDir = path18.join(ctx.root, folder);
19308
19638
  const state = await read(baseDir);
19309
19639
  if (state) states.push({ target: target2, baseDir, state });
19310
19640
  }
@@ -19317,16 +19647,16 @@ var installed = async (ctx) => {
19317
19647
  local = await readLocalSkills(localDir, { strict: true });
19318
19648
  } catch (error) {
19319
19649
  if (!(error instanceof SkillsDirUnreadable)) throw error;
19320
- 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`, {
19321
19651
  note: `${error.where}\uFF1A${error.detail}`
19322
19652
  });
19323
19653
  }
19324
- 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` : "";
19325
19655
  const target = ctx.environments.find((e) => e.report.target);
19326
19656
  if (states.some((s) => s.state.endpoint && normalizeOrigin6(s.state.endpoint) !== normalizeOrigin6(target.config.endpoint)))
19327
19657
  return found("SKILLS_ENDPOINT_MISMATCH", void 0, { value: count });
19328
19658
  if (count === 0) {
19329
- const legacy = await read(path17.join(ctx.root, "hcm-skills"));
19659
+ const legacy = await read(path18.join(ctx.root, "hcm-skills"));
19330
19660
  if (legacy && Object.keys(legacy.skills).length > 0) return found("SKILLS_LEGACY_LAYOUT", void 0, { value: count, evidence: "ABSENT" });
19331
19661
  if (local.length > 0) {
19332
19662
  return pass(
@@ -19339,7 +19669,7 @@ var installed = async (ctx) => {
19339
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"))
19340
19670
  return found("SKILLS_SPLIT_LAYOUT", void 0, { value: count });
19341
19671
  return pass(
19342
- `${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}`,
19343
19673
  { value: count + local.length }
19344
19674
  );
19345
19675
  } catch (error) {
@@ -19357,7 +19687,7 @@ function hasProductSkills(states) {
19357
19687
  }
19358
19688
  async function inspectSkillsFresh(states, endpoint, signal) {
19359
19689
  if (!hasProductSkills(states)) return { level: "NOT_APPLICABLE", summary: NO_PRODUCT_SKILLS, note: "\u672A\u8BF7\u6C42\u6280\u80FD\u76EE\u5F55" };
19360
- const http = axios6.create({
19690
+ const http = axios7.create({
19361
19691
  baseURL: endpoint,
19362
19692
  timeout: 5e3,
19363
19693
  maxRedirects: 0,
@@ -19424,7 +19754,7 @@ var boundary = async (ctx) => {
19424
19754
  for (const name of ["AGENTS.md", "CLAUDE.md"]) {
19425
19755
  let text2;
19426
19756
  try {
19427
- text2 = await fs15.readFile(path17.join(ctx.root, name), "utf8");
19757
+ text2 = await fs15.readFile(path18.join(ctx.root, name), "utf8");
19428
19758
  } catch (error) {
19429
19759
  if (error.code === "ENOENT") continue;
19430
19760
  throw error;
@@ -19500,7 +19830,7 @@ var shadow = async (ctx) => {
19500
19830
  const localDir = skillsLocalDir(ctx.root);
19501
19831
  const undetermined = (error) => {
19502
19832
  const u = error instanceof SkillsDirUnreadable ? error : void 0;
19503
- 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);
19504
19834
  const detail = u ? safeError(new Error(u.detail)) : safeError(error);
19505
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) };
19506
19836
  };
@@ -19513,7 +19843,7 @@ var shadow = async (ctx) => {
19513
19843
  }
19514
19844
  let c2;
19515
19845
  try {
19516
- c2 = await listClaudeShadowedSkills(path17.join(ctx.root, ".claude", "skills"), localDir);
19846
+ c2 = await listClaudeShadowedSkills(path18.join(ctx.root, ".claude", "skills"), localDir);
19517
19847
  } catch (error) {
19518
19848
  const x = undetermined(error);
19519
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 });
@@ -19526,7 +19856,7 @@ var shadow = async (ctx) => {
19526
19856
  const others = [[r, "sync/"], [c2, CLAUDE_SKILLS_DIR_LABEL]];
19527
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("");
19528
19858
  const unreadable = [...r.unreadable, ...c2.unreadable];
19529
- 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");
19530
19860
  if (r.shadowed.length || c2.shadowed.length) {
19531
19861
  const parts = [];
19532
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)}`);
@@ -19561,11 +19891,11 @@ var localChecks = { project, credential, version, installed, fresh, shadow, boun
19561
19891
 
19562
19892
  // src/commands/doctor/connect-checks.ts
19563
19893
  init_auth_guard();
19564
- import axios8 from "axios";
19894
+ import axios9 from "axios";
19565
19895
  import { CliError as CliError42, IMPERSONATION_START_PATH, USER_LOOKUP_PATH, probeDoctorEndpoint, probeDoctorLayer, layerDetail, toPrincipal as toPrincipal3 } from "@hcmai/sdk";
19566
19896
 
19567
19897
  // src/commands/doctor/server-report.ts
19568
- import axios7 from "axios";
19898
+ import axios8 from "axios";
19569
19899
  import { classifyStatus } from "@hcmai/sdk";
19570
19900
  var optionalText2 = (value) => value === void 0 || value === null || typeof value === "string";
19571
19901
  var fullScope = { stage: null, only: [], skip: [], active: false };
@@ -19599,7 +19929,7 @@ var requestServerReport = async (endpoint, token, timeoutMs, budgetMs, signal, s
19599
19929
  ...scope.only.length ? { only: scope.only.join(",") } : {},
19600
19930
  ...scope.skip.length ? { skip: scope.skip.join(",") } : {}
19601
19931
  };
19602
- 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 } });
19603
19933
  return {
19604
19934
  status: res.status,
19605
19935
  body: res.data,
@@ -19608,7 +19938,7 @@ var requestServerReport = async (endpoint, token, timeoutMs, budgetMs, signal, s
19608
19938
  };
19609
19939
  };
19610
19940
  function stoppedWaiting(error, signal) {
19611
- return signal.aborted || axios7.isAxiosError(error) && error.code === "ECONNABORTED";
19941
+ return signal.aborted || axios8.isAxiosError(error) && error.code === "ECONNABORTED";
19612
19942
  }
19613
19943
  function httpNote(out) {
19614
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"]}` : ""}`;
@@ -19949,11 +20279,11 @@ var identity = async (ctx, env2, execution) => {
19949
20279
  const code3 = detail.mismatch === "tenant" ? "TENANT_MISMATCH" : "IDENTITY_USER_MISMATCH";
19950
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)}` });
19951
20281
  }
19952
- const status = axios8.isAxiosError(error) ? error.response?.status : void 0;
19953
- 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 ?? "" : "";
19954
20284
  const proxyStart = requestPath.endsWith(IMPERSONATION_START_PATH);
19955
20285
  const userLookup = requestPath.endsWith(USER_LOOKUP_PATH);
19956
- 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;
19957
20287
  const targetMissing = status === 404 && proxyStart && envelope?.code === "NOT_FOUND";
19958
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";
19959
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";
@@ -20249,8 +20579,8 @@ async function executeChecks(ctx, options = {}) {
20249
20579
  let timer;
20250
20580
  let proxy = false;
20251
20581
  let expire;
20252
- const timeout = new Promise((resolve7) => {
20253
- expire = resolve7;
20582
+ const timeout = new Promise((resolve8) => {
20583
+ expire = resolve8;
20254
20584
  });
20255
20585
  const arm = (ms) => {
20256
20586
  clearTimeout(timer);
@@ -20559,7 +20889,7 @@ function renderChironDoctor(report) {
20559
20889
 
20560
20890
  // src/commands/doctor/platform-ops.ts
20561
20891
  import { createHash as createHash8 } from "crypto";
20562
- import axios9 from "axios";
20892
+ import axios10 from "axios";
20563
20893
  import {
20564
20894
  classifyStatus as classifyStatus2,
20565
20895
  CliError as CliError43,
@@ -20629,7 +20959,7 @@ var placeholder = {
20629
20959
  };
20630
20960
  var OPS_DESCRIPTORS = [connectivity2, api, placeholder];
20631
20961
  var requestOpsReport = async (endpoint, key2, timeoutMs, budgetMs, signal, scope) => {
20632
- const res = await axios9.get(OPS_PATH, {
20962
+ const res = await axios10.get(OPS_PATH, {
20633
20963
  baseURL: endpoint,
20634
20964
  timeout: timeoutMs,
20635
20965
  signal,
@@ -21200,7 +21530,7 @@ var defaultServices = {
21200
21530
  pendingVerify: async (signal) => gapPendingVerify({ client: await createJiraClient2({ timeoutMs: 8e3 }) }, { signal }),
21201
21531
  skillsFresh: inspectSkillsFresh,
21202
21532
  asAuth: (...args) => ensureAsAuth(...args),
21203
- probe: (endpoint, token, signal) => httpProbe2(axios10.create({
21533
+ probe: (endpoint, token, signal) => httpProbe2(axios11.create({
21204
21534
  baseURL: endpoint,
21205
21535
  timeout: 5e3,
21206
21536
  maxRedirects: 0,
@@ -21303,11 +21633,11 @@ async function readCredential(envFlag, root, as) {
21303
21633
  return { resolved, identity: identity3, meta: meta2, token };
21304
21634
  }
21305
21635
  async function prepareContext(args, deps) {
21306
- const startedAt = Date.now(), root = path18.resolve(args.project ?? ".");
21636
+ const startedAt = Date.now(), root = path19.resolve(args.project ?? ".");
21307
21637
  let file;
21308
21638
  let projectObservation = found("ENV_FILE_MISSING", void 0, { evidence: "ABSENT" });
21309
21639
  try {
21310
- const text2 = await fs16.readFile(path18.join(root, "env.yaml"), "utf8");
21640
+ const text2 = await fs16.readFile(path19.join(root, "env.yaml"), "utf8");
21311
21641
  try {
21312
21642
  file = parseEnvYaml3(text2);
21313
21643
  projectObservation = pass("env.yaml \u53EF\u89E3\u6790");
@@ -21323,7 +21653,7 @@ async function prepareContext(args, deps) {
21323
21653
  if (args.env && (!file || !Object.hasOwn(file.environments, args.env))) {
21324
21654
  try {
21325
21655
  const resolved = await resolveEnvContext9({ envFlag: args.env, cwd: root }, process.env, await loadGlobalConfig12());
21326
- 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");
21327
21657
  targetEnv = resolved.project.name;
21328
21658
  explicitSlot = resolved.name;
21329
21659
  } catch (error) {
@@ -21541,7 +21871,7 @@ import { spawnSync } from "child_process";
21541
21871
  import { accessSync, constants, readdirSync as readdirSync3 } from "fs";
21542
21872
  import fs17 from "fs/promises";
21543
21873
  import os6 from "os";
21544
- import path20 from "path";
21874
+ import path21 from "path";
21545
21875
  import { CliError as CliError47, CliErrorCode as CliErrorCode47, formatObject as formatObject34, HcmClient as HcmClient30, loadEnv as loadEnv6 } from "@hcmai/sdk";
21546
21876
  import { createRequire } from "module";
21547
21877
 
@@ -21608,8 +21938,8 @@ var CdpSession = class {
21608
21938
  send(method3, params = {}) {
21609
21939
  if (this.closed) return Promise.reject(new Error(`CDP socket \u5DF2\u5173\u95ED\uFF0C\u53D1\u4E0D\u4E86 ${method3}`));
21610
21940
  const id = this.nextId++;
21611
- return new Promise((resolve7, reject) => {
21612
- 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 });
21613
21943
  this.socket.send(JSON.stringify({ id, method: method3, params }));
21614
21944
  });
21615
21945
  }
@@ -21629,11 +21959,11 @@ var CdpSession = class {
21629
21959
  }
21630
21960
  /** 等一个事件,超时就 reject——「等 load 事件」不能无限等。无论哪种结束都摘掉监听器。 */
21631
21961
  waitFor(event, timeoutMs) {
21632
- return new Promise((resolve7, reject) => {
21962
+ return new Promise((resolve8, reject) => {
21633
21963
  const off = this.on(event, (params) => {
21634
21964
  clearTimeout(timer);
21635
21965
  off();
21636
- resolve7(params);
21966
+ resolve8(params);
21637
21967
  });
21638
21968
  const timer = setTimeout(() => {
21639
21969
  off();
@@ -21747,7 +22077,7 @@ var defaultCdpIo = {
21747
22077
  const text2 = await res.text();
21748
22078
  return text2 ? JSON.parse(text2) : null;
21749
22079
  },
21750
- openSocket: (wsUrl) => new Promise((resolve7, reject) => {
22080
+ openSocket: (wsUrl) => new Promise((resolve8, reject) => {
21751
22081
  const Ctor = globalThis.WebSocket;
21752
22082
  if (!Ctor) {
21753
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" }));
@@ -21757,7 +22087,7 @@ var defaultCdpIo = {
21757
22087
  const timer = setTimeout(() => reject(new Error(`\u8FDE ${wsUrl} \u8D85\u8FC7 ${CDP_IO_TIMEOUT_MS}ms \u6CA1\u63E1\u4E0A\u624B`)), CDP_IO_TIMEOUT_MS);
21758
22088
  ws.addEventListener("open", () => {
21759
22089
  clearTimeout(timer);
21760
- resolve7(ws);
22090
+ resolve8(ws);
21761
22091
  });
21762
22092
  ws.addEventListener("error", (ev) => {
21763
22093
  clearTimeout(timer);
@@ -21772,17 +22102,17 @@ var defaultCdpIo = {
21772
22102
  };
21773
22103
 
21774
22104
  // src/commands/chiron-page-playwright.ts
21775
- import path19 from "path";
22105
+ import path20 from "path";
21776
22106
  import { CliError as CliError46, CliErrorCode as CliErrorCode46 } from "@hcmai/sdk";
21777
22107
  function playwrightCacheRoot(probe3) {
21778
22108
  const override = probe3.env.PLAYWRIGHT_BROWSERS_PATH?.trim();
21779
- if (override === "0" && probe3.packageRoot) return path19.join(probe3.packageRoot, ".local-browsers");
21780
- if (override && override !== "0") return path19.resolve(override);
21781
- 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");
21782
22112
  if (probe3.platform === "win32") {
21783
- 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");
21784
22114
  }
21785
- 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");
21786
22116
  }
21787
22117
  function playwrightPlatformTag(probe3) {
21788
22118
  const arm = probe3.arch === "arm64";
@@ -21798,19 +22128,19 @@ function revisionOf(entry, prefix) {
21798
22128
  function candidateBinaries(probe3, kind) {
21799
22129
  const tag = playwrightPlatformTag(probe3);
21800
22130
  if (kind === "headless-shell") {
21801
- 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")];
21802
22132
  }
21803
22133
  if (probe3.platform === "darwin") {
21804
22134
  return [
21805
22135
  // Playwright ≥ 1.49:Chrome for Testing 的 .app
21806
- 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"),
21807
22137
  // ≤ 1.48:Chromium.app,目录名不分架构
21808
- path19.join("chrome-mac", "Chromium.app", "Contents", "MacOS", "Chromium"),
21809
- 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")
21810
22140
  ];
21811
22141
  }
21812
- if (probe3.platform === "win32") return [path19.join("chrome-win64", "chrome.exe"), path19.join("chrome-win", "chrome.exe")];
21813
- 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")];
21814
22144
  }
21815
22145
  function discoverPlaywrightBrowser(probe3) {
21816
22146
  const explicit = probe3.env.HCM_PLAYWRIGHT_EXECUTABLE?.trim();
@@ -21828,8 +22158,8 @@ function discoverPlaywrightBrowser(probe3) {
21828
22158
  const revisions = entries.map((e) => ({ e, rev: revisionOf(e, prefix) })).filter((x) => x.rev !== null).sort((a, b) => b.rev - a.rev);
21829
22159
  for (const { e } of revisions) {
21830
22160
  for (const rel of candidateBinaries(probe3, kind)) {
21831
- const candidate = path19.join(root, e, rel);
21832
- 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) };
21833
22163
  }
21834
22164
  }
21835
22165
  return null;
@@ -21931,10 +22261,10 @@ function resolveEvidenceTarget(projectRoot, out) {
21931
22261
  if (!out.endsWith(".png")) {
21932
22262
  throw new CliError47({ code: CliErrorCode47.INVALID_ARGUMENT, message: `--out \u8981\u4EE5 .png \u7ED3\u5C3E\uFF0C\u6536\u5230\u7684\u662F ${out}` });
21933
22263
  }
21934
- const root = path20.resolve(projectRoot);
21935
- const evidenceRoot = path20.join(root, EVIDENCE_DIR);
21936
- const absolute = path20.resolve(root, out);
21937
- 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)) {
21938
22268
  throw new CliError47({
21939
22269
  code: CliErrorCode47.INVALID_ARGUMENT,
21940
22270
  message: `--out \u8981\u843D\u5728\u9879\u76EE\u7684 ${EVIDENCE_DIR}/ \u4E0B\uFF08${evidenceRoot}\uFF09\uFF0C\u6536\u5230\u7684\u662F ${absolute}`
@@ -21981,9 +22311,9 @@ function findChrome(probe3, override) {
21981
22311
  }
21982
22312
  async function assertInsideEvidence(deps, evidenceRoot, absolute) {
21983
22313
  const canonicalRoot = await deps.realpath(evidenceRoot);
21984
- const canonicalParent = await deps.realpath(path20.dirname(absolute));
22314
+ const canonicalParent = await deps.realpath(path21.dirname(absolute));
21985
22315
  if (canonicalRoot === null || canonicalParent === null) return;
21986
- if (canonicalParent !== canonicalRoot && !canonicalParent.startsWith(canonicalRoot + path20.sep)) {
22316
+ if (canonicalParent !== canonicalRoot && !canonicalParent.startsWith(canonicalRoot + path21.sep)) {
21987
22317
  throw new CliError47({
21988
22318
  code: CliErrorCode47.INVALID_ARGUMENT,
21989
22319
  message: `--out \u7684\u7236\u76EE\u5F55\u7ECF\u7B26\u53F7\u94FE\u63A5\u8DD1\u51FA\u4E86 ${EVIDENCE_DIR}/\uFF1A${canonicalParent}`
@@ -22002,7 +22332,7 @@ async function runChironPage(target, args, deps) {
22002
22332
  const reject = (args.rejectText ?? []).filter((t) => t.trim().length > 0);
22003
22333
  const viewport = parseViewport(args.size ?? "1440x900");
22004
22334
  const waitMs = parseWaitMs(args.waitMs);
22005
- const root = path20.resolve(args.project ?? ".");
22335
+ const root = path21.resolve(args.project ?? ".");
22006
22336
  const { evidenceRoot, absolute } = resolveEvidenceTarget(root, args.out);
22007
22337
  if (await deps.present(absolute)) {
22008
22338
  throw new CliError47({
@@ -22010,7 +22340,7 @@ async function runChironPage(target, args, deps) {
22010
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`
22011
22341
  });
22012
22342
  }
22013
- await deps.ensureDir(path20.dirname(absolute));
22343
+ await deps.ensureDir(path21.dirname(absolute));
22014
22344
  await assertInsideEvidence(deps, evidenceRoot, absolute);
22015
22345
  const endpoint = normalizeCdpEndpoint(args.cdp ?? deps.env.HCM_CHROME_CDP);
22016
22346
  const evalJs = args.eval?.trim() ? args.eval : void 0;
@@ -22128,7 +22458,7 @@ function safeStringify(value) {
22128
22458
  }
22129
22459
  function playwrightPackageRoot() {
22130
22460
  try {
22131
- 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"));
22132
22462
  } catch {
22133
22463
  return void 0;
22134
22464
  }
@@ -22220,7 +22550,7 @@ init_exit();
22220
22550
  import { spawnSync as spawnSync2 } from "child_process";
22221
22551
  import { randomUUID as randomUUID2 } from "crypto";
22222
22552
  import { promises as fs18 } from "fs";
22223
- import path21 from "path";
22553
+ import path22 from "path";
22224
22554
  import yaml5 from "js-yaml";
22225
22555
  import { formatObject as formatObject35 } from "@hcmai/sdk";
22226
22556
 
@@ -23203,7 +23533,7 @@ async function runCase(spec, root, opts = {}, deps = defaultDeps2) {
23203
23533
  continue;
23204
23534
  }
23205
23535
  if (c2.file) {
23206
- const file = path21.resolve(root, fill(c2.file));
23536
+ const file = path22.resolve(root, fill(c2.file));
23207
23537
  const want = c2.expect ?? {};
23208
23538
  const bad = [];
23209
23539
  if (want.xlsx_header || want.xlsx_min_rows !== void 0) {
@@ -23225,7 +23555,7 @@ async function runCase(spec, root, opts = {}, deps = defaultDeps2) {
23225
23555
  results.push(bad.length ? { name: c2.name, verdict: "fail", detail: bad.join("\uFF1B") } : { name: c2.name, verdict: "pass", detail: "" });
23226
23556
  continue;
23227
23557
  }
23228
- const out = path21.join(
23558
+ const out = path22.join(
23229
23559
  "evidence",
23230
23560
  "test",
23231
23561
  opts.evidenceRunId ?? "current",
@@ -23247,11 +23577,11 @@ async function runCase(spec, root, opts = {}, deps = defaultDeps2) {
23247
23577
  }
23248
23578
  async function loadCases(target) {
23249
23579
  const stat = await fs18.stat(target);
23250
- 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];
23251
23581
  const out = [];
23252
23582
  for (const f of files) {
23253
23583
  const spec = yaml5.load(await fs18.readFile(f, "utf8"));
23254
- assertUsableSpec(spec, path21.basename(f));
23584
+ assertUsableSpec(spec, path22.basename(f));
23255
23585
  out.push({ file: f, spec });
23256
23586
  }
23257
23587
  if (out.length === 0) throw new Error(`${target} \u4E0B\u6CA1\u6709\u7528\u4F8B\uFF08*.yml\uFF09`);
@@ -23259,8 +23589,8 @@ async function loadCases(target) {
23259
23589
  }
23260
23590
  async function chironTestCommand(target, args, deps) {
23261
23591
  try {
23262
- const root = path21.resolve(args.project ?? ".");
23263
- const where = path21.resolve(root, target ?? "tests");
23592
+ const root = path22.resolve(args.project ?? ".");
23593
+ const where = path22.resolve(root, target ?? "tests");
23264
23594
  const cases2 = await loadCases(where);
23265
23595
  const report = [];
23266
23596
  let failed2 = 0;
@@ -23272,7 +23602,7 @@ async function chironTestCommand(target, args, deps) {
23272
23602
  deps
23273
23603
  );
23274
23604
  failed2 += results.filter((r) => r.verdict === "fail").length;
23275
- report.push({ case: spec.name, file: path21.relative(root, file), results });
23605
+ report.push({ case: spec.name, file: path22.relative(root, file), results });
23276
23606
  }
23277
23607
  const fmt = args.output ?? "table";
23278
23608
  if (fmt === "json" || fmt === "yaml") {
@@ -23413,7 +23743,7 @@ import {
23413
23743
  writeRisk
23414
23744
  } from "@hcmai/sdk";
23415
23745
  import { existsSync as existsSync5 } from "fs";
23416
- import * as path22 from "path";
23746
+ import * as path23 from "path";
23417
23747
  function premise(message, hint = "") {
23418
23748
  process.stderr.write(message + (hint ? `
23419
23749
  \u2192 ${hint}` : "") + "\n");
@@ -23440,13 +23770,13 @@ async function runSeedPlan(args, client4) {
23440
23770
  const reconDir = candidates[0].reconDir;
23441
23771
  if (candidates.length > 1) {
23442
23772
  process.stderr.write(
23443
- `\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"
23444
23774
  );
23445
23775
  }
23446
23776
  const round = inspectRound2(reconDir);
23447
23777
  process.stderr.write(roundWarning(round));
23448
23778
  const baseline = {
23449
- path: `${path22.basename(path22.dirname(reconDir))}/${path22.basename(reconDir)}`,
23779
+ path: `${path23.basename(path23.dirname(reconDir))}/${path23.basename(reconDir)}`,
23450
23780
  roundId: round.roundId ?? null
23451
23781
  };
23452
23782
  let exemptions = null;
@@ -23708,7 +24038,7 @@ async function deliverySeedVerifyCommand(args) {
23708
24038
  // src/commands/delivery-seed-find.ts
23709
24039
  import { existsSync as existsSync6 } from "fs";
23710
24040
  import { readFileSync as readFileSync9 } from "fs";
23711
- import * as path23 from "path";
24041
+ import * as path24 from "path";
23712
24042
  import {
23713
24043
  INIT_EXIT_CODES as INIT_EXIT_CODES2,
23714
24044
  ValueHints,
@@ -23722,10 +24052,10 @@ import {
23722
24052
  valuesRoundCaveat
23723
24053
  } from "@hcmai/sdk";
23724
24054
  function provenance(chosenReconDir, others) {
23725
- let line = `> \u57FA\u7EBF\uFF1A\`${path23.basename(chosenReconDir)}\`
24055
+ let line = `> \u57FA\u7EBF\uFF1A\`${path24.basename(chosenReconDir)}\`
23726
24056
  `;
23727
24057
  if (others.length > 0) {
23728
- 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";
23729
24059
  }
23730
24060
  return `${line}
23731
24061
  `;
@@ -24062,7 +24392,7 @@ import {
24062
24392
  runTriageRound
24063
24393
  } from "@hcmai/sdk";
24064
24394
  import { mkdirSync as mkdirSync2, readFileSync as readFileSync11, writeFileSync as writeFileSync3 } from "fs";
24065
- import * as path24 from "path";
24395
+ import * as path25 from "path";
24066
24396
  var DEFAULT_CAPABILITIES3 = "default";
24067
24397
  function premise4(message, hint) {
24068
24398
  process.stderr.write(`\u{1F534} \u524D\u63D0\u4E0D\u6210\u7ACB\uFF1A${message}
@@ -24098,8 +24428,8 @@ function renderProblems(rows2) {
24098
24428
  `;
24099
24429
  }
24100
24430
  function writeTriageArtifact(outDir, body) {
24101
- const out = path24.join(outDir, "work", "triage.md");
24102
- mkdirSync2(path24.dirname(out), { recursive: true });
24431
+ const out = path25.join(outDir, "work", "triage.md");
24432
+ mkdirSync2(path25.dirname(out), { recursive: true });
24103
24433
  writeFileSync3(out, body, "utf8");
24104
24434
  return out;
24105
24435
  }
@@ -24429,13 +24759,22 @@ program.command("action <Model.Action>").description("\u8C03\u7528 Model \u4E0A\
24429
24759
  ).option("--params <JSON>", `Action \u5165\u53C2 JSON\uFF0C\u4F8B\u5982 '{"effectDate":"2026-06-01"}'`).option("--params-file <path>", "\u4ECE UTF-8 JSON \u6587\u4EF6\u8BFB\u53D6 Action \u5165\u53C2\uFF08\u4E0E --params \u4E92\u65A5\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").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").option(
24430
24760
  "--artifact-output <path>",
24431
24761
  "\u628A\u6807\u51C6\u53EA\u8BFB\u5236\u54C1\uFF08Core ActionArtifact\uFF09\u843D\u5230\u8FD9\u4E2A**\u6587\u4EF6**\u8DEF\u5F84\uFF1B\u53EA\u8BA4\u516C\u5171\u5951\u7EA6\u4FE1\u5C01\uFF0C\u4E0D\u731C\u5B57\u6BB5\uFF0C\u4E5F\u4E0D\u6539\u53D8\u98CE\u9669\u5224\u6863"
24432
- ).option("--artifact-force", "\u76EE\u6807\u5DF2\u5B58\u5728\u65F6\u624D\u9700\u8981\u5B83\u2014\u2014\u9ED8\u8BA4\u62D2\u7EDD\u8986\u76D6\uFF0C\u514D\u5F97\u628A\u4E0A\u4E00\u8F6E\u7684\u8BC1\u636E\u6084\u6084\u6362\u6389").action((spec, opts) => actionCommand(spec, opts));
24762
+ ).option("--artifact-force", "\u76EE\u6807\u5DF2\u5B58\u5728\u65F6\u624D\u9700\u8981\u5B83\u2014\u2014\u9ED8\u8BA4\u62D2\u7EDD\u8986\u76D6\uFF0C\u514D\u5F97\u628A\u4E0A\u4E00\u8F6E\u7684\u8BC1\u636E\u6084\u6084\u6362\u6389").option(
24763
+ "--verify",
24764
+ "\u8BFB\u8FD9\u4E2A action \u7684\u6838\u9A8C\u58F0\u660E\uFF08/actions \u7684 verification\uFF09\uFF1A\u9996\u671F\u4E0D\u56DE\u8BFB\uFF0C\u6267\u884C\u6210\u529F\u540E\u4E00\u5F8B\u9000 7\uFF08\u5DF2\u6267\u884C\u3001\u672A\u6838\u9A8C\uFF09\uFF0Cstderr \u8BF4\u6E05\u4E3A\u4EC0\u4E48\u6838\u4E0D\u4E86\u3001\u53BB\u54EA\u67E5\uFF1B\u6267\u884C\u5931\u8D25\u6CBF\u7528\u539F\u9000\u51FA\u7801"
24765
+ ).action((spec, opts) => actionCommand(spec, opts));
24433
24766
  program.command("create <Model>").description("\u521B\u5EFA\u4E00\u6761 Model \u8BB0\u5F55\uFF08\u8D70\u540E\u7AEF\u5B8C\u6574\u6821\u9A8C\uFF09").option("--data <JSON>", `\u8BB0\u5F55\u5B57\u6BB5 JSON\uFF0C\u4F8B\u5982 '{"code":"ORG_SALES","name":"\u9500\u552E\u90E8"}'`).option("--data-file <path>", "\u4ECE UTF-8 JSON \u6587\u4EF6\u8BFB\u53D6\u8BB0\u5F55\u5B57\u6BB5\uFF08\u4E0E --data \u4E92\u65A5\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").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").option(
24434
24767
  "--i18n",
24435
24768
  "\u591A\u8BED\u8A00\u5B57\u6BB5\u6309 Map \u5B8C\u6574\u66FF\u6362\uFF08\u952E\u7528 zh-CN / en-US \u8FDE\u5B57\u7B26\u5F62\uFF09\uFF1B\u4E0D\u4F20\u5219\u6309\u5B57\u7B26\u4E32\u53EA\u6539\u5F53\u524D\u8BED\u8A00"
24769
+ ).option(
24770
+ "--verify",
24771
+ "\u5199\u540E\u6838\u9A8C\uFF1A\u670D\u52A1\u7AEF\u6309\u540C\u4E00\u6761\u8BFB\u94FE\u56DE\u8BFB\u3001\u9010\u5B57\u6BB5\u6BD4\u5BF9\uFF08\u7ED3\u8BBA\u5728 writeVerification\uFF0Cstderr \u9010\u5B57\u6BB5\u8BF4\u660E\uFF09\u3002\u9000\u51FA\u7801 0 \u6838\u9A8C\u901A\u8FC7\uFF1B6 \u5DF2\u5199\u5165\u4F46\u4E0E\u5E93\u91CC\u5BF9\u4E0D\u4E0A\uFF08\u4E0D\u8981\u91CD\u8DD1\uFF09\uFF1B7 \u5DF2\u5199\u5165\u3001\u6838\u9A8C\u505A\u4E0D\u4E86\u6216\u53EA\u505A\u4E86\u4E00\u90E8\u5206"
24436
24772
  ).action((m, opts) => createCommand(m, opts));
24437
24773
  program.command("delete <Model>").description("\u5220\u9664\u4E00\u6761 Model \u8BB0\u5F55\uFF08\u8D70\u540E\u7AEF\u5B8C\u6574\u6821\u9A8C\uFF1B\u90E8\u5206 Model \u4F1A\u6267\u884C\u4E1A\u52A1\u64A4\u9500\uFF09").option("--id <id>", "\u76EE\u6807\u5B9E\u4F53 ID\uFF08\u5FC5\u586B\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").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").action((m, opts) => deleteCommand(m, opts));
24438
- program.command("import <path>").description("\u6CE8\u5165\u5B89\u88C5\u5305\u6570\u636E fixture v1\uFF08\u76EE\u5F55\u6216\u5355\u6587\u4EF6\uFF0C\u5355\u4E00\u4E1A\u52A1\u952E\uFF09").option("--dry-run", "\u53EA\u8DD1\u5BA2\u6237\u7AEF\u9759\u6001\u6821\u9A8C\uFF0C\u4E0D\u843D\u5E93\uFF08\u89C1 spec \xA78 \u9650\u5236\uFF09").option("--update-only", "\u5DF2\u5B58\u5728\uFF08\u6309 key_field\uFF09\u5219 PUT \u66F4\u65B0\uFF0C\u5426\u5219 create").option("--on-error <mode>", "stop | continue\uFF08\u9ED8\u8BA4 continue\uFF09", "continue").option("--report <path>", "\u5199 JSON \u6CE8\u5165\u62A5\u544A\uFF08\u9010\u884C\u7ED3\u679C + key\u2192id \u6620\u5C04\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").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").addHelpText("after", `
24774
+ program.command("import <path>").description("\u6CE8\u5165\u5B89\u88C5\u5305\u6570\u636E fixture v1\uFF08\u76EE\u5F55\u6216\u5355\u6587\u4EF6\uFF0C\u5355\u4E00\u4E1A\u52A1\u952E\uFF09").option("--dry-run", "\u53EA\u8DD1\u5BA2\u6237\u7AEF\u9759\u6001\u6821\u9A8C\uFF0C\u4E0D\u843D\u5E93\uFF08\u89C1 spec \xA78 \u9650\u5236\uFF09").option("--update-only", "\u5DF2\u5B58\u5728\uFF08\u6309 key_field\uFF09\u5219 PUT \u66F4\u65B0\uFF0C\u5426\u5219 create").option("--on-error <mode>", "stop | continue\uFF08\u9ED8\u8BA4 continue\uFF09", "continue").option("--report <path>", "\u5199 JSON \u6CE8\u5165\u62A5\u544A\uFF08\u9010\u884C\u7ED3\u679C + key\u2192id \u6620\u5C04\uFF09").option(
24775
+ "--verify",
24776
+ "\u5199\u540E\u6838\u9A8C\uFF1A\u6BCF\u4E2A\u8981\u5199\u7684\u884C\u5E26 verify=true\uFF0C\u62A5\u544A\u6BCF\u884C\u52A0 verification\uFF1B\u9000\u51FA\u7801 6\uFF08\u6709\u4E00\u884C\u4E0E\u5E93\u91CC\u5BF9\u4E0D\u4E0A\uFF0C\u4E0D\u8981\u91CD\u8DD1\uFF09 > 3\uFF08\u6709\u4E00\u884C\u5199\u5165\u5931\u8D25\uFF09> 7\uFF08\u6709\u4E00\u884C\u6CA1\u6838\u6210\uFF09> 0\u3002\u5EFA\u8BAE\u914D --on-error stop\uFF1A\u6838\u9A8C\u5931\u8D25\u4E0E\u5199\u5165\u5931\u8D25\u4E00\u6837\u505C\u4E0B"
24777
+ ).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").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").addHelpText("after", `
24439
24778
  \u516C\u5171 schema\uFF1A${DATA_PACKAGE_FIXTURE_SCHEMA_V1.$id}
24440
24779
  ${DATA_PACKAGE_FIXTURE_SCHEMA_V1.properties.key_field.description}
24441
24780
  ${DATA_PACKAGE_FIXTURE_SCHEMA_V1.properties.key.description}
@@ -24520,7 +24859,7 @@ workspace.command("validate").description("\u6821\u9A8C\u5F00\u53D1\u7A7A\u95F4\
24520
24859
  workspace.command("push").description("\u628A\u672C\u5730\u5F00\u53D1\u7A7A\u95F4 artifact \u63A8\u9001\u56DE\u79DF\u6237\u5F00\u53D1\u7A7A\u95F4\uFF1B\u5199\u5165\u524D\u5148\u8BA9\u670D\u52A1\u7AEF\u6309\u771F\u5B9E\u5199\u5165\u94FE\u9884\u68C0\u6574\u4EFD\u8BA1\u5212\uFF08\u542B mini_apps\uFF09\uFF0C\u6709\u95EE\u9898\u4E00\u4E2A\u6587\u4EF6\u90FD\u4E0D\u5199\uFF1Braw \u8981\u6C42 Core \u6761\u4EF6\u5199\u5165\u534F\u8BAE 1\uFF1Bmini \u4EC5\u6821\u9A8C\u6E05\u5355\u5B8C\u6574\u6027\uFF0C\u4ECD\u6309\u65E7\u9010\u6587\u4EF6\u65B9\u5F0F\u5199\u5165\uFF0C\u4E0D\u627F\u8BFA\u6574\u4E2A\u7A7A\u95F4\u5B89\u5168\u7EED\u4F20").option("--dir <path>", "\u5DE5\u4F5C\u7A7A\u95F4\u672C\u5730\u76EE\u5F55", ".").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").option("--dry-run", "\u53EA\u8BA1\u7B97\u5F85\u6267\u884C\u7684\u64CD\u4F5C\u5E76\u505A\u670D\u52A1\u7AEF\u53EA\u8BFB\u9884\u68C0\uFF0C\u4E0D\u5199\u8FDC\u7AEF\u6587\u4EF6\uFF1B\u9884\u68C0\u6709\u95EE\u9898\u6216\u62FF\u4E0D\u5230\u7ED3\u8BBA\u65F6\u9000\u51FA\u7801 3").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((opts) => workspacePushCommand(opts));
24521
24860
  workspace.command("preview").description("\u6253\u5370\u5F00\u53D1\u7A7A\u95F4\u4E2D\u8F7B\u5E94\u7528 artifact \u7684\u9884\u89C8 URL").option("--dir <path>", "\u5DE5\u4F5C\u7A7A\u95F4\u672C\u5730\u76EE\u5F55", ".").option("--frontend <url>", "\u524D\u7AEF\u5730\u5740", "http://127.0.0.1:5179").option("--surface <surface>", "\u5C55\u793A\u54EA\u79CD\u5F62\u6001\uFF1Aall | bare | standalone | embedded", "all").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((opts) => workspacePreviewCommand(opts));
24522
24861
  workspace.command("verify").description(
24523
- "\u4E00\u952E\u9A8C\u6536\uFF1A\u4E32\u8054 validate + status + push --dry-run\uFF08\u542B\u670D\u52A1\u7AEF\u53EA\u8BFB\u9884\u68C0\uFF09+ preview\uFF0C\u5168\u7A0B\u4E0D\u5199\u8FDC\u7AEF\uFF0Cpush \u524D\u5FC5\u8DD1\uFF1B\u9000\u51FA\u7801 0 \u901A\u8FC7 / 1 \u53D1\u73B0\u95EE\u9898 / 3 \u670D\u52A1\u7AEF\u9884\u68C0\u62FF\u4E0D\u5230\u7ED3\u8BBA\uFF08\u4E0D\u662F\u901A\u8FC7\uFF09"
24862
+ "\u4E00\u952E\u9A8C\u6536\uFF1A\u4E32\u8054 validate + status + push --dry-run\uFF08\u542B\u670D\u52A1\u7AEF\u53EA\u8BFB\u9884\u68C0\uFF09+ preview\uFF0C\u5168\u7A0B\u4E0D\u5199\u8FDC\u7AEF\uFF0Cpush \u524D\u5FC5\u8DD1\uFF1B\u9000\u51FA\u7801 0 \u901A\u8FC7 / 1 \u53D1\u73B0\u95EE\u9898\uFF08\u542B\u53D1\u5E03\u4F1A\u88AB\u6321\u4F4F\uFF1Arelease-blocked\uFF09/ 3 \u670D\u52A1\u7AEF\u9884\u68C0\u62FF\u4E0D\u5230\u7ED3\u8BBA\u6216\u53D1\u5E03\u671F\u8F7B\u5E94\u7528\u68C0\u67E5\u6CA1\u505A\u6210\uFF08unavailable / release-unchecked\uFF0C\u4E0D\u662F\u901A\u8FC7\uFF09"
24524
24863
  ).option("--dir <path>", "\u5DE5\u4F5C\u7A7A\u95F4\u672C\u5730\u76EE\u5F55", ".").option("--env <name>", "\u4E34\u65F6\u5207\u73AF\u5883\uFF08\u8986\u76D6 activeEnv\uFF0Cdry-run \u9636\u6BB5\u9700\u8981\uFF09").option("--as <identity>", "\u4E34\u65F6\u6362\u8EAB\u4EFD\uFF08\u8986\u76D6 env defaultIdentity\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--profile <name>", "[deprecated] \u7528 --env \u66FF\u4EE3").option("--frontend <url>", "\u524D\u7AEF\u5730\u5740", "http://127.0.0.1:5179").option("--surface <surface>", "\u9884\u89C8\u5F62\u6001\uFF1Aall | bare | standalone | embedded", "all").option("--smoke", "\u5BF9\u9884\u89C8\u5165\u53E3\u4E0E\u57FA\u7840\u8D44\u6E90\u6267\u884C\u53EA\u8BFB HTTP GET \u53EF\u8FBE\u68C0\u67E5").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((opts) => workspaceVerifyCommand(opts));
24525
24864
  program.command("trace [traceId]").description("\u67E5\u770B trace\uFF1A\u4E0D\u4F20 traceId \u5217\u6700\u8FD1\u8BB0\u5F55\uFF0C\u4F20 traceId \u663E\u793A\u4EBA\u7C7B\u53EF\u8BFB\u8BE6\u60C5").option("--conv <convId>", "\u67E5\u4F1A\u8BDD\u7684 LLM \u9010\u8C03\u7528 trace\uFF08PG llm_call_trace\uFF0CADR-134 D2\uFF09").option("--llm-calls", "\u628A\u4F4D\u7F6E\u53C2\u5F53 convId \u67E5 LLM \u9010\u8C03\u7528\uFF08\u7B49\u4EF7 --conv <convId>\uFF09").option("--span <N>", "\u67E5\u770B\u7B2C N \u4E2A span \u7684\u8BE6\u60C5").option("-n, --limit <N>", "\u5217\u8868\u6A21\u5F0F\u663E\u793A\u6761\u6570", "10").option("--events", "\u6309\u4E8B\u4EF6\u65F6\u95F4\u7EBF\u5C55\u793A spans/logs/LLM \u5185\u5BB9\u6458\u8981").option("--raw", "\u8F93\u51FA\u539F\u59CB trace \u805A\u5408 JSON\uFF08\u534F\u8BAE/P0 \u8C03\u8BD5\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").option("--output <fmt>", "\u517C\u5BB9\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml\uFF1B\u8C03\u8BD5\u539F\u6587\u4F18\u5148\u7528 --raw", "table").action((traceId, opts) => traceCommand(traceId ?? null, opts));
24526
24865
  program.command("mini").description("\u5DF2\u79FB\u9664\uFF1A\u8BF7\u6539\u7528 hcm workspace").allowUnknownOption(true).allowExcessArguments(true).argument("[args...]").action(() => removedMiniCommand());
@@ -24583,10 +24922,13 @@ skills.command("show <id>").description("\u6253\u5370\u6280\u80FD\u539F\u6587\uF
24583
24922
  program.command("update <Model>").description("\u66F4\u65B0\u4E00\u6761 Model \u8BB0\u5F55\uFF08\u8D70\u540E\u7AEF\u5B8C\u6574\u6821\u9A8C\uFF09\u3002\u5347\u7EA7 CLI \u8BF7\u7528 `hcm upgrade`").requiredOption("--id <id>", "\u8BB0\u5F55 ID").option("--data <JSON>", `\u8981\u66F4\u65B0\u7684\u5B57\u6BB5 JSON\uFF0C\u4F8B\u5982 '{"name":"\u65B0\u540D\u79F0"}'`).option("--data-file <path>", "\u4ECE UTF-8 JSON \u6587\u4EF6\u8BFB\u53D6\u66F4\u65B0\u5B57\u6BB5\uFF08\u4E0E --data \u4E92\u65A5\uFF09").option("--env <name>", "\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("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").option(
24584
24923
  "--i18n",
24585
24924
  "\u591A\u8BED\u8A00\u5B57\u6BB5\u6309 Map \u5B8C\u6574\u66FF\u6362\uFF08\u952E\u7528 zh-CN / en-US \u8FDE\u5B57\u7B26\u5F62\uFF09\uFF1B\u4E0D\u4F20\u5219\u6309\u5B57\u7B26\u4E32\u53EA\u6539\u5F53\u524D\u8BED\u8A00"
24925
+ ).option(
24926
+ "--verify",
24927
+ "\u5199\u540E\u6838\u9A8C\uFF1A\u670D\u52A1\u7AEF\u6309\u540C\u4E00\u6761\u8BFB\u94FE\u56DE\u8BFB\u3001\u9010\u5B57\u6BB5\u6BD4\u5BF9\uFF08\u7ED3\u8BBA\u5728 writeVerification\uFF0Cstderr \u9010\u5B57\u6BB5\u8BF4\u660E\uFF09\u3002\u9000\u51FA\u7801 0 \u6838\u9A8C\u901A\u8FC7\uFF1B6 \u5DF2\u5199\u5165\u4F46\u4E0E\u5E93\u91CC\u5BF9\u4E0D\u4E0A\uFF08\u4E0D\u8981\u91CD\u8DD1\uFF09\uFF1B7 \u5DF2\u5199\u5165\u3001\u6838\u9A8C\u505A\u4E0D\u4E86\u6216\u53EA\u505A\u4E86\u4E00\u90E8\u5206"
24586
24928
  ).action((model, opts) => updateCommand(model, opts));
24587
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));
24588
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));
24589
- 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));
24590
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");
24591
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));
24592
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(