@hcmai/cli 0.25.3 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2126,7 +2126,7 @@ async function runInkRepl(args) {
2126
2126
  try {
2127
2127
  const ctx = await getActiveAuthContextFromCli(args);
2128
2128
  assertDangerWrite(ctx.environmentSafety, "\u542F\u52A8\u4EA4\u4E92\u4F1A\u8BDD\uFF08\u53EF\u80FD\u6267\u884C\u4E1A\u52A1\u5199\u5165\uFF09");
2129
- const client3 = HcmClient10.fromAuthContext(ctx);
2129
+ const client4 = HcmClient10.fromAuthContext(ctx);
2130
2130
  let initialConversationId;
2131
2131
  if (args.resume && args.conversation) {
2132
2132
  throw new Error("--resume \u548C --conversation \u4E0D\u80FD\u540C\u65F6\u4F7F\u7528\uFF1B\u65B0\u547D\u4EE4\u8BF7\u7528 --resume <conversationId>");
@@ -2141,15 +2141,15 @@ async function runInkRepl(args) {
2141
2141
  }
2142
2142
  const ws = new WsClient({
2143
2143
  endpoint: conversationWebSocketEndpoint(ctx.endpoint),
2144
- getAccessToken: () => client3.getAccessToken(),
2145
- onTokenExpiring: () => client3.handleRefresh(),
2144
+ getAccessToken: () => client4.getAccessToken(),
2145
+ onTokenExpiring: () => client4.handleRefresh(),
2146
2146
  conversationId: initialConversationId
2147
2147
  });
2148
2148
  await ws.connect();
2149
2149
  const { waitUntilExit } = render(
2150
2150
  React3.createElement(ReplApp, {
2151
2151
  ws,
2152
- client: client3,
2152
+ client: client4,
2153
2153
  agentId: args.agent ?? DEFAULT_AGENT_ID2,
2154
2154
  env: ctx.env,
2155
2155
  identity: ctx.identity,
@@ -2236,7 +2236,7 @@ var init_readline = __esm({
2236
2236
 
2237
2237
  // src/index.ts
2238
2238
  import { Command } from "commander";
2239
- import { DATA_PACKAGE_FIXTURE_SCHEMA_V1, LEDGER_ONLY_FLAG as LEDGER_ONLY_FLAG2, migrateLegacyProfiles } from "@hcmai/sdk";
2239
+ import { COLUMN_SLOT_SQL_KEYS as COLUMN_SLOT_SQL_KEYS2, DATA_PACKAGE_FIXTURE_SCHEMA_V1, LEDGER_ONLY_FLAG as LEDGER_ONLY_FLAG2, migrateLegacyProfiles } from "@hcmai/sdk";
2240
2240
 
2241
2241
  // src/package-version.ts
2242
2242
  import { readFileSync } from "fs";
@@ -2429,11 +2429,11 @@ async function runOpen(target, args, deps) {
2429
2429
  }
2430
2430
  return { url, expiresIn };
2431
2431
  }
2432
- function mintBrowserTicket(client3, envName) {
2432
+ function mintBrowserTicket(client4, envName) {
2433
2433
  return async () => {
2434
2434
  let data;
2435
2435
  try {
2436
- const resp = await client3.raw().post(BROWSER_TICKET_PATH, {});
2436
+ const resp = await client4.raw().post(BROWSER_TICKET_PATH, {});
2437
2437
  data = resp.data?.data ?? resp.data ?? {};
2438
2438
  } catch (e) {
2439
2439
  const err = e;
@@ -2462,13 +2462,13 @@ async function openCommand(target, args) {
2462
2462
  try {
2463
2463
  const ctx = await getActiveAuthContextFromCli(args);
2464
2464
  const envCfg = await loadEnv(ctx.env);
2465
- const client3 = HcmClient.fromAuthContext(ctx);
2465
+ const client4 = HcmClient.fromAuthContext(ctx);
2466
2466
  await runOpen(
2467
2467
  target,
2468
2468
  { printUrl: args.printUrl, envName: ctx.env },
2469
2469
  {
2470
2470
  frontend: ctx.frontend ?? envCfg.frontend,
2471
- mintTicket: mintBrowserTicket(client3, ctx.env),
2471
+ mintTicket: mintBrowserTicket(client4, ctx.env),
2472
2472
  launch: launchBrowser,
2473
2473
  write: (line) => process.stdout.write(line)
2474
2474
  }
@@ -3403,9 +3403,9 @@ async function loginCommand(args) {
3403
3403
  }
3404
3404
  const err = e;
3405
3405
  if (err.isAxiosError) {
3406
- const { fromAxiosError: fromAxiosError28 } = await import("@hcmai/sdk");
3406
+ const { fromAxiosError: fromAxiosError29 } = await import("@hcmai/sdk");
3407
3407
  exitWithError(
3408
- fromAxiosError28(
3408
+ fromAxiosError29(
3409
3409
  e,
3410
3410
  envName
3411
3411
  )
@@ -3990,8 +3990,8 @@ import {
3990
3990
  async function queryCommand(model, args) {
3991
3991
  try {
3992
3992
  const dsl = buildQueryDsl(args);
3993
- const client3 = HcmClient2.fromAuthContext(await getActiveAuthContextFromCli(args));
3994
- const result = await client3.query(model, dsl);
3993
+ const client4 = HcmClient2.fromAuthContext(await getActiveAuthContextFromCli(args));
3994
+ const result = await client4.query(model, dsl);
3995
3995
  const fmt = args.output ?? "table";
3996
3996
  printQueryResult(result, fmt, dsl);
3997
3997
  } catch (e) {
@@ -4245,9 +4245,9 @@ async function actionCommand(spec, args) {
4245
4245
  required: false
4246
4246
  });
4247
4247
  if (params) input.params = params;
4248
- const client3 = HcmClient3.fromAuthContext(await getActiveAuthContextFromCli(args));
4248
+ const client4 = HcmClient3.fromAuthContext(await getActiveAuthContextFromCli(args));
4249
4249
  if (!explicitMethod || !explicitScope) {
4250
- const shape = await lookupActionShape(client3, model, action);
4250
+ const shape = await lookupActionShape(client4, model, action);
4251
4251
  if (shape) {
4252
4252
  if (!explicitMethod && shape.httpMethod) method3 = shape.httpMethod;
4253
4253
  if (!explicitScope && shape.scope) scope = shape.scope;
@@ -4255,7 +4255,7 @@ async function actionCommand(spec, args) {
4255
4255
  if (scope) input.scope = scope;
4256
4256
  }
4257
4257
  }
4258
- const result = await client3.action(model, action, input);
4258
+ const result = await client4.action(model, action, input);
4259
4259
  const fmt = args.output ?? "json";
4260
4260
  if (args.artifactOutput) {
4261
4261
  await emitArtifact(result, args.artifactOutput, { force: args.artifactForce }, fmt);
@@ -4319,9 +4319,9 @@ function normalizeScope(value) {
4319
4319
  message: `--scope \u53D6\u503C class | object\uFF0C\u6536\u5230 "${value}"`
4320
4320
  });
4321
4321
  }
4322
- async function lookupActionShape(client3, model, action) {
4322
+ async function lookupActionShape(client4, model, action) {
4323
4323
  try {
4324
- const described = await client3.describe(model);
4324
+ const described = await client4.describe(model);
4325
4325
  const named = described.actions.filter((a) => a.name === action);
4326
4326
  if (named.length !== 1) return void 0;
4327
4327
  const only = named[0];
@@ -4346,8 +4346,8 @@ async function createCommand(model, args) {
4346
4346
  inlineFlag: "--data",
4347
4347
  fileFlag: "--data-file"
4348
4348
  });
4349
- const client3 = HcmClient4.fromAuthContext(await getActiveAuthContextFromCli(args));
4350
- const res = await client3.create(model, data, { i18n: args.i18n });
4349
+ const client4 = HcmClient4.fromAuthContext(await getActiveAuthContextFromCli(args));
4350
+ const res = await client4.create(model, data, { i18n: args.i18n });
4351
4351
  const fmt = args.output ?? "json";
4352
4352
  if (fmt !== "json") process.stdout.write("\u2705 created\n");
4353
4353
  process.stdout.write(formatObject2(res, { format: fmt }) + "\n");
@@ -4381,8 +4381,8 @@ async function updateCommand(model, args) {
4381
4381
  inlineFlag: "--data",
4382
4382
  fileFlag: "--data-file"
4383
4383
  });
4384
- const client3 = HcmClient5.fromAuthContext(await getActiveAuthContextFromCli(args));
4385
- const result = await client3.update(model, args.id, data, { i18n: args.i18n });
4384
+ const client4 = HcmClient5.fromAuthContext(await getActiveAuthContextFromCli(args));
4385
+ const result = await client4.update(model, args.id, data, { i18n: args.i18n });
4386
4386
  const fmt = args.output ?? "json";
4387
4387
  if (fmt !== "json") process.stdout.write(`\u2705 ${model}#${args.id} \u5DF2\u66F4\u65B0
4388
4388
  `);
@@ -4632,8 +4632,8 @@ async function deleteCommand(model, args) {
4632
4632
  if (!args.id) {
4633
4633
  throw new CliError15({ code: CliErrorCode14.MISSING_FLAG, message: "--id <id> \u5FC5\u586B" });
4634
4634
  }
4635
- const client3 = HcmClient7.fromAuthContext(await getActiveAuthContextFromCli(args));
4636
- const res = await client3.remove(model, args.id);
4635
+ const client4 = HcmClient7.fromAuthContext(await getActiveAuthContextFromCli(args));
4636
+ const res = await client4.remove(model, args.id);
4637
4637
  const fmt = args.output ?? "json";
4638
4638
  if (fmt !== "json") process.stdout.write("\u2705 deleted\n");
4639
4639
  process.stdout.write(formatObject6(res, { format: fmt }) + "\n");
@@ -4688,8 +4688,8 @@ async function importCommand(path22, args) {
4688
4688
  updateOnly: !!args.updateOnly,
4689
4689
  onError: args.onError === "stop" ? "stop" : "continue"
4690
4690
  };
4691
- const client3 = opts.dryRun ? DRY_RUN_CLIENT : HcmClient8.fromAuthContext(await getActiveAuthContextFromCli(args));
4692
- const result = await runImport(client3, fixtures, opts);
4691
+ const client4 = opts.dryRun ? DRY_RUN_CLIENT : HcmClient8.fromAuthContext(await getActiveAuthContextFromCli(args));
4692
+ const result = await runImport(client4, fixtures, opts);
4693
4693
  for (const warning of result.warnings ?? []) process.stderr.write(`\u26A0 ${warning}
4694
4694
  `);
4695
4695
  if (args.report) writeFileSync(args.report, JSON.stringify(result, null, 2));
@@ -4736,8 +4736,8 @@ import {
4736
4736
  } from "@hcmai/sdk";
4737
4737
  async function describeCommand(model, args) {
4738
4738
  try {
4739
- const client3 = HcmClient9.fromAuthContext(await getActiveAuthContextFromCli(args));
4740
- const desc = await client3.describe(model, { verbose: !!args.verbose });
4739
+ const client4 = HcmClient9.fromAuthContext(await getActiveAuthContextFromCli(args));
4740
+ const desc = await client4.describe(model, { verbose: !!args.verbose });
4741
4741
  const fmt = args.output ?? "table";
4742
4742
  if (fmt !== "table") {
4743
4743
  process.stdout.write(formatObject8(desc, { format: fmt }) + "\n");
@@ -4866,29 +4866,29 @@ init_exit();
4866
4866
  init_impersonation_lifecycle();
4867
4867
  init_auth_guard();
4868
4868
  function parseInjectOn(s) {
4869
- const fail8 = (detail) => {
4869
+ const fail9 = (detail) => {
4870
4870
  throw new CliError16({
4871
4871
  code: CliErrorCode17.INVALID_ARGUMENT,
4872
4872
  message: `--inject-on \u683C\u5F0F <eventType>:<action>[:<arg>]\uFF0Caction \u2208 {interrupt, steer}\uFF08steer \u5FC5\u987B\u5E26 content\uFF09\uFF1B${detail}\uFF0C\u6536\u5230 "${s}"`
4873
4873
  });
4874
4874
  };
4875
4875
  const firstColon = s.indexOf(":");
4876
- if (firstColon < 0) return fail8("\u7F3A\u5C11 action \u6BB5");
4876
+ if (firstColon < 0) return fail9("\u7F3A\u5C11 action \u6BB5");
4877
4877
  const eventType = s.slice(0, firstColon);
4878
4878
  const rest = s.slice(firstColon + 1);
4879
4879
  const secondColon = rest.indexOf(":");
4880
4880
  const action = secondColon < 0 ? rest : rest.slice(0, secondColon);
4881
4881
  const arg = secondColon < 0 ? void 0 : rest.slice(secondColon + 1);
4882
- if (!eventType) return fail8("eventType \u6BB5\u4E3A\u7A7A");
4882
+ if (!eventType) return fail9("eventType \u6BB5\u4E3A\u7A7A");
4883
4883
  if (action === "interrupt") {
4884
- if (arg !== void 0) return fail8("interrupt \u4E0D\u63A5\u53D7 arg");
4884
+ if (arg !== void 0) return fail9("interrupt \u4E0D\u63A5\u53D7 arg");
4885
4885
  return { eventType, action: "interrupt" };
4886
4886
  }
4887
4887
  if (action === "steer") {
4888
- if (arg === void 0 || arg === "") return fail8("steer \u5FC5\u987B\u5E26 content\uFF08arg\uFF09");
4888
+ if (arg === void 0 || arg === "") return fail9("steer \u5FC5\u987B\u5E26 content\uFF08arg\uFF09");
4889
4889
  return { eventType, action: "steer", arg };
4890
4890
  }
4891
- return fail8(`\u672A\u77E5 action "${action}"`);
4891
+ return fail9(`\u672A\u77E5 action "${action}"`);
4892
4892
  }
4893
4893
  function parseOnConfirm(s) {
4894
4894
  if (s === "approve") return { decision: "approve" };
@@ -5071,8 +5071,8 @@ function lastAssistantMissDetail(target) {
5071
5071
  }
5072
5072
  async function printConversationEvents(conversationId, args) {
5073
5073
  const ctx = await getActiveAuthContextFromCli(args);
5074
- const client3 = HcmClient11.fromAuthContext(ctx);
5075
- const items = await fetchConversationTimelineStrict(client3.raw(), conversationId);
5074
+ const client4 = HcmClient11.fromAuthContext(ctx);
5075
+ const items = await fetchConversationTimelineStrict(client4.raw(), conversationId);
5076
5076
  const fmt = args.output ?? "text";
5077
5077
  if (args.raw) {
5078
5078
  for (const item of items) {
@@ -5104,9 +5104,9 @@ async function printConversationList(args) {
5104
5104
  });
5105
5105
  }
5106
5106
  const ctx = await getActiveAuthContextFromCli(args);
5107
- const client3 = HcmClient11.fromAuthContext(ctx);
5107
+ const client4 = HcmClient11.fromAuthContext(ctx);
5108
5108
  const limit = parsePositiveInt(args.limit, 10, "--limit");
5109
- const result = await fetchRecentConversations(client3.raw(), limit);
5109
+ const result = await fetchRecentConversations(client4.raw(), limit);
5110
5110
  const fmt = args.output ?? "text";
5111
5111
  if (fmt === "json") {
5112
5112
  process.stdout.write(formatObject9(result, { format: "json" }) + "\n");
@@ -5192,17 +5192,17 @@ async function chatCommand(prompt, args) {
5192
5192
  const ctx = await getActiveAuthContextFromCli(args);
5193
5193
  assertDangerWrite2(ctx.environmentSafety, "\u53D1\u9001\u6216\u7EE7\u7EED\u4F1A\u8BDD\uFF08\u53EF\u80FD\u6267\u884C\u4E1A\u52A1\u5199\u5165\uFF09");
5194
5194
  const wsUrl = conversationWebSocketEndpoint2(ctx.endpoint);
5195
- const client3 = HcmClient11.fromAuthContext(ctx);
5195
+ const client4 = HcmClient11.fromAuthContext(ctx);
5196
5196
  const stateKey = ctx.env;
5197
5197
  const agentId = args.agent ?? DEFAULT_AGENT_ID3;
5198
5198
  let resumeConversationId = requestedConversationId;
5199
5199
  const resumedExisting = !!resumeConversationId;
5200
5200
  if (!resumeConversationId) {
5201
- const conv = await createConversation2(client3.raw(), agentId);
5201
+ const conv = await createConversation2(client4.raw(), agentId);
5202
5202
  resumeConversationId = conv.id;
5203
5203
  }
5204
5204
  if (regenerateFromLastAssistant) {
5205
- const items = await fetchConversationTimeline2(client3.raw(), resumeConversationId);
5205
+ const items = await fetchConversationTimeline2(client4.raw(), resumeConversationId);
5206
5206
  const target = findLastAssistantTarget(items);
5207
5207
  if (target.seq == null) {
5208
5208
  throw new CliError16({
@@ -5214,8 +5214,8 @@ async function chatCommand(prompt, args) {
5214
5214
  }
5215
5215
  const ws = new WsClient2({
5216
5216
  endpoint: wsUrl,
5217
- getAccessToken: () => client3.getAccessToken(),
5218
- onTokenExpiring: () => client3.handleRefresh(),
5217
+ getAccessToken: () => client4.getAccessToken(),
5218
+ onTokenExpiring: () => client4.handleRefresh(),
5219
5219
  // issue #257:握手带上会话 id,后端才会绑控制通道并重投上次留下的未决暂停。
5220
5220
  // 会话 id 在上面几十行就定下来了(--resume 或刚 createConversation 出来的),
5221
5221
  // 建连时它一定已经就位。
@@ -5236,7 +5236,7 @@ async function chatCommand(prompt, args) {
5236
5236
  verboseTools: !!args.verboseTools,
5237
5237
  spinner: args.spinner === false ? false : isTty,
5238
5238
  color: args.color === false ? false : isTty,
5239
- apiBase: client3.endpoint
5239
+ apiBase: client4.endpoint
5240
5240
  });
5241
5241
  const presenter = new StreamPresenter2(renderer, {
5242
5242
  showToolCalls: args.showToolCalls !== false,
@@ -5250,7 +5250,7 @@ async function chatCommand(prompt, args) {
5250
5250
  });
5251
5251
  if (resumedExisting && isTty && fmt === "text" && !args.raw) {
5252
5252
  const { fetchConversationTimeline: fetchConversationTimeline3, buildResumeSummary: buildResumeSummary2 } = await import("@hcmai/sdk");
5253
- const items = await fetchConversationTimeline3(client3.raw(), resumeConversationId);
5253
+ const items = await fetchConversationTimeline3(client4.raw(), resumeConversationId);
5254
5254
  const summary = items ? buildResumeSummary2(resumeConversationId, items) : null;
5255
5255
  if (summary) renderer.showResumeContext(summary);
5256
5256
  }
@@ -5259,7 +5259,7 @@ async function chatCommand(prompt, args) {
5259
5259
  const { uploadDocument: uploadDocument3 } = await import("@hcmai/sdk");
5260
5260
  chatAttachments = [];
5261
5261
  for (const fp of args.attach) {
5262
- const meta2 = await uploadDocument3(client3.raw(), fp);
5262
+ const meta2 = await uploadDocument3(client4.raw(), fp);
5263
5263
  chatAttachments.push(meta2);
5264
5264
  if (fmt === "text" && !args.raw) process.stderr.write(`\u{1F4CE} \u5DF2\u4E0A\u4F20 ${meta2.fileName} (${meta2.documentId})
5265
5265
  `);
@@ -5272,7 +5272,7 @@ async function chatCommand(prompt, args) {
5272
5272
  const { uploadDocument: uploadDocument3 } = await import("@hcmai/sdk");
5273
5273
  chatAttachments = chatAttachments ?? [];
5274
5274
  for (const fp of inline.paths) {
5275
- const meta2 = await uploadDocument3(client3.raw(), fp);
5275
+ const meta2 = await uploadDocument3(client4.raw(), fp);
5276
5276
  chatAttachments.push(meta2);
5277
5277
  if (fmt === "text" && !args.raw) process.stderr.write(`\u{1F4CE} \u5DF2\u4E0A\u4F20 ${meta2.fileName} (${meta2.documentId})
5278
5278
  `);
@@ -5630,9 +5630,9 @@ async function interactionsListCommand(args) {
5630
5630
  );
5631
5631
  const json2 = args.output === "json";
5632
5632
  announceSource(source, conversationId, json2);
5633
- const client3 = HcmClient12.fromAuthContext(ctx);
5633
+ const client4 = HcmClient12.fromAuthContext(ctx);
5634
5634
  const agentId = args.agent ?? DEFAULT_AGENT_ID4;
5635
- const rows2 = await listPendingInteractions(client3.raw(), agentId, conversationId);
5635
+ const rows2 = await listPendingInteractions(client4.raw(), agentId, conversationId);
5636
5636
  if (json2) {
5637
5637
  process.stdout.write(
5638
5638
  formatObject10(
@@ -5660,11 +5660,11 @@ async function interactionsRespondCommand(action, interactionId, args) {
5660
5660
  const json2 = args.output === "json";
5661
5661
  announceSource(source, conversationId, json2);
5662
5662
  assertDangerWrite3(ctx.environmentSafety, "\u56DE\u5E94\u6682\u505C\uFF08\u6279\u51C6\u4F1A\u771F\u7684\u6267\u884C\u90A3\u4E2A\u5199\u64CD\u4F5C\uFF09");
5663
- const client3 = HcmClient12.fromAuthContext(ctx);
5663
+ const client4 = HcmClient12.fromAuthContext(ctx);
5664
5664
  ws = new WsClient3({
5665
5665
  endpoint: conversationWebSocketEndpoint3(ctx.endpoint),
5666
- getAccessToken: () => client3.getAccessToken(),
5667
- onTokenExpiring: () => client3.handleRefresh(),
5666
+ getAccessToken: () => client4.getAccessToken(),
5667
+ onTokenExpiring: () => client4.handleRefresh(),
5668
5668
  conversationId
5669
5669
  });
5670
5670
  await ws.connect();
@@ -5705,8 +5705,8 @@ import { HcmClient as HcmClient13 } from "@hcmai/sdk";
5705
5705
  async function downloadCommand(documentId, args) {
5706
5706
  try {
5707
5707
  const ctx = await getActiveAuthContextFromCli(args);
5708
- const client3 = HcmClient13.fromAuthContext(ctx);
5709
- const saved = await downloadDocument(client3.raw(), { documentId }, args.output);
5708
+ const client4 = HcmClient13.fromAuthContext(ctx);
5709
+ const saved = await downloadDocument(client4.raw(), { documentId }, args.output);
5710
5710
  process.stdout.write(saved + "\n");
5711
5711
  process.exitCode = 0;
5712
5712
  return;
@@ -5737,8 +5737,8 @@ import {
5737
5737
  } from "@hcmai/sdk";
5738
5738
  async function documentDeleteCommand(documentId, args) {
5739
5739
  try {
5740
- const client3 = HcmClient14.fromAuthContext(await getActiveAuthContextFromCli(args));
5741
- await deleteDocument(client3.raw(), documentId);
5740
+ const client4 = HcmClient14.fromAuthContext(await getActiveAuthContextFromCli(args));
5741
+ await deleteDocument(client4.raw(), documentId);
5742
5742
  process.stdout.write(formatObject11({ success: true, documentId }, { format: args.output ?? "json" }) + "\n");
5743
5743
  process.exitCode = 0;
5744
5744
  } catch (e) {
@@ -5890,8 +5890,8 @@ function printTraceEvents(traceId, agg) {
5890
5890
  `);
5891
5891
  process.stdout.write(formatRows5(rows2, { format: "table" }) + "\n");
5892
5892
  }
5893
- async function listRecentTraces(client3, limit) {
5894
- const http = client3.raw();
5893
+ async function listRecentTraces(client4, limit) {
5894
+ const http = client4.raw();
5895
5895
  try {
5896
5896
  const resp = await http.get("/api/trace/recent", { params: { limit } });
5897
5897
  const data = resp.data ?? {};
@@ -5910,12 +5910,12 @@ async function listRecentTraces(client3, limit) {
5910
5910
 
5911
5911
  `);
5912
5912
  }
5913
- await listRecentConversationsPg(client3, limit);
5913
+ await listRecentConversationsPg(client4, limit);
5914
5914
  }
5915
- async function listRecentConversationsPg(client3, limit) {
5915
+ async function listRecentConversationsPg(client4, limit) {
5916
5916
  let rows2;
5917
5917
  try {
5918
- const res = await client3.query("ConversationModel", {
5918
+ const res = await client4.query("ConversationModel", {
5919
5919
  sort: [{ field: "lastActiveAt", direction: "desc" }],
5920
5920
  limit
5921
5921
  });
@@ -6146,8 +6146,8 @@ async function gatherLlmTraceTree(http, rootConvId, maxDepth = 3) {
6146
6146
  }
6147
6147
  async function traceCommand(traceId, args) {
6148
6148
  try {
6149
- const client3 = HcmClient15.fromAuthContext(await getActiveAuthContextFromCli(args));
6150
- const http = client3.raw();
6149
+ const client4 = HcmClient15.fromAuthContext(await getActiveAuthContextFromCli(args));
6150
+ const http = client4.raw();
6151
6151
  const convId = args.conv ?? (args.llmCalls ? traceId ?? void 0 : void 0);
6152
6152
  if (convId) {
6153
6153
  if (args.raw || args.output === "json" || args.output === "yaml") {
@@ -6171,7 +6171,7 @@ async function traceCommand(traceId, args) {
6171
6171
  exitWithError("traceId is required for --events, --raw, and --span");
6172
6172
  return;
6173
6173
  }
6174
- await listRecentTraces(client3, parsePositiveInt2(args.limit, 10, "--limit"));
6174
+ await listRecentTraces(client4, parsePositiveInt2(args.limit, 10, "--limit"));
6175
6175
  process.exitCode = 0;
6176
6176
  return;
6177
6177
  }
@@ -6226,8 +6226,8 @@ import {
6226
6226
  clearMetaCache
6227
6227
  } from "@hcmai/sdk";
6228
6228
  async function withClient(args, fn) {
6229
- const client3 = HcmClient16.fromAuthContext(await getActiveAuthContextFromCli(args));
6230
- return fn(client3);
6229
+ const client4 = HcmClient16.fromAuthContext(await getActiveAuthContextFromCli(args));
6230
+ return fn(client4);
6231
6231
  }
6232
6232
  function emit(result, args, human) {
6233
6233
  const fmt = args.output ?? "json";
@@ -6285,8 +6285,8 @@ import {
6285
6285
  getScriptTask
6286
6286
  } from "@hcmai/sdk";
6287
6287
  async function withClient2(args, fn) {
6288
- const client3 = HcmClient17.fromAuthContext(await getActiveAuthContextFromCli(args));
6289
- return fn(client3);
6288
+ const client4 = HcmClient17.fromAuthContext(await getActiveAuthContextFromCli(args));
6289
+ return fn(client4);
6290
6290
  }
6291
6291
  function emit2(result, args, human) {
6292
6292
  const fmt = args.output ?? "json";
@@ -6396,9 +6396,9 @@ var DEFAULT_UPLOAD_CATEGORY = "attachment";
6396
6396
  async function uploadCommand(filePath2, args) {
6397
6397
  try {
6398
6398
  const ctx = await getActiveAuthContextFromCli(args);
6399
- const client3 = HcmClient18.fromAuthContext(ctx);
6399
+ const client4 = HcmClient18.fromAuthContext(ctx);
6400
6400
  const meta2 = await uploadDocument2(
6401
- client3.raw(),
6401
+ client4.raw(),
6402
6402
  filePath2,
6403
6403
  args.category ?? DEFAULT_UPLOAD_CATEGORY,
6404
6404
  args.model || args.originId || args.field ? { model: args.model ?? "", originId: args.originId ?? "", field: args.field ?? "", state: args.state } : void 0
@@ -6478,10 +6478,10 @@ async function datapackagePackCommand(packageDir, args) {
6478
6478
  async function datapackageInstallCommand(artifactPath, args) {
6479
6479
  try {
6480
6480
  const ctx = await getActiveAuthContextFromCli(args);
6481
- const client3 = HcmClient19.fromAuthContext(ctx);
6481
+ const client4 = HcmClient19.fromAuthContext(ctx);
6482
6482
  const fmt = args.output ?? "json";
6483
6483
  const human = fmt !== "json";
6484
- const accepted = await installDataPackageArtifactAsync(client3, artifactPath, {
6484
+ const accepted = await installDataPackageArtifactAsync(client4, artifactPath, {
6485
6485
  category: args.category ?? DEFAULT_ARTIFACT_CATEGORY
6486
6486
  });
6487
6487
  if (human) {
@@ -6504,7 +6504,7 @@ async function datapackageInstallCommand(artifactPath, args) {
6504
6504
  }
6505
6505
  const timeoutMs = Math.max(1, Number(args.timeout ?? DEFAULT_INSTALL_WAIT_SECONDS)) * 1e3;
6506
6506
  const showProgress = human && process.stderr.isTTY === true;
6507
- const { run: run3, timedOut } = await waitForInstallRun(client3, accepted.runId, {
6507
+ const { run: run3, timedOut } = await waitForInstallRun(client4, accepted.runId, {
6508
6508
  timeoutMs,
6509
6509
  onProgress: showProgress ? (r) => process.stderr.write(`\r${renderProgress(r)}`.padEnd(96)) : void 0
6510
6510
  });
@@ -6555,8 +6555,8 @@ async function datapackageInstallCommand(artifactPath, args) {
6555
6555
  async function datapackageStatusCommand(runId, args) {
6556
6556
  try {
6557
6557
  const ctx = await getActiveAuthContextFromCli(args);
6558
- const client3 = HcmClient19.fromAuthContext(ctx);
6559
- const run3 = await fetchInstallRun(client3, runId);
6558
+ const client4 = HcmClient19.fromAuthContext(ctx);
6559
+ const run3 = await fetchInstallRun(client4, runId);
6560
6560
  const fmt = args.output ?? "json";
6561
6561
  if (!run3) {
6562
6562
  if (fmt !== "json") {
@@ -7636,9 +7636,9 @@ async function skillsListCommand(keyword, args, cwd = process.cwd()) {
7636
7636
  let manifest2;
7637
7637
  let endpoint;
7638
7638
  if (source !== "cli") {
7639
- const client3 = await chironClient(args);
7640
- endpoint = client3.endpoint;
7641
- manifest2 = await fetchSkillCatalog(client3.http, client3.base);
7639
+ const client4 = await chironClient(args);
7640
+ endpoint = client4.endpoint;
7641
+ manifest2 = await fetchSkillCatalog(client4.http, client4.base);
7642
7642
  }
7643
7643
  const bundled = source === "chiron" ? void 0 : listBundledSkills();
7644
7644
  const catalog = buildUnifiedCatalog({ source, chironManifest: manifest2, bundled, cliVersion: CLI_VERSION });
@@ -7940,10 +7940,10 @@ async function skillsInstallCommand(id, args) {
7940
7940
  }),
7941
7941
  recorded: (await readSkillsState(layout.baseDir))?.endpoint
7942
7942
  });
7943
- const client3 = await beforeAnyWrite(chironClient({ ...args, endpoint: tracked }));
7944
- endpoint = client3.endpoint;
7945
- base = client3.base;
7946
- http = client3.http;
7943
+ const client4 = await beforeAnyWrite(chironClient({ ...args, endpoint: tracked }));
7944
+ endpoint = client4.endpoint;
7945
+ base = client4.base;
7946
+ http = client4.http;
7947
7947
  manifest2 = await beforeAnyWrite(fetchSkillCatalog(http, base));
7948
7948
  }
7949
7949
  const catalog = buildUnifiedCatalog({ source, chironManifest: manifest2, bundled, cliVersion: CLI_VERSION });
@@ -9064,9 +9064,9 @@ async function skillsUpdateCommand(args) {
9064
9064
  let base;
9065
9065
  let http;
9066
9066
  if (source !== "cli") {
9067
- const client3 = await beforeAnyWrite(chironClient({ ...args, endpoint }));
9068
- http = client3.http;
9069
- base = client3.base;
9067
+ const client4 = await beforeAnyWrite(chironClient({ ...args, endpoint }));
9068
+ http = client4.http;
9069
+ base = client4.base;
9070
9070
  manifest2 = await beforeAnyWrite(fetchSkillCatalog(http, base));
9071
9071
  }
9072
9072
  const bundled = source === "chiron" ? void 0 : listBundledSkills();
@@ -9386,10 +9386,10 @@ async function tenantResetCommand(args) {
9386
9386
  assertDangerWrite4(safety, "\u91CD\u7F6E\u79DF\u6237 PostgreSQL \u6570\u636E");
9387
9387
  const accessToken = await HcmClient20.fromAuthContext(ctx).getAccessToken();
9388
9388
  if (!accessToken) throw new CliError22({ code: CliErrorCode23.AUTH_FAILED, message: "\u5F53\u524D\u8EAB\u4EFD\u6CA1\u6709\u53EF\u8BFB\u53D6\u7684\u51ED\u636E\uFF0C\u672A\u53D1\u9001\u91CD\u7F6E\u3002" });
9389
- const client3 = new HcmClient20({ endpoint, tenantId, accessToken, profile: env2, environmentSafety: safety });
9390
- client3.raw().defaults.maxRedirects = 0;
9391
- client3.raw().defaults.__skipRetry = true;
9392
- const principal = await readSessionPrincipal2(client3.raw());
9389
+ const client4 = new HcmClient20({ endpoint, tenantId, accessToken, profile: env2, environmentSafety: safety });
9390
+ client4.raw().defaults.maxRedirects = 0;
9391
+ client4.raw().defaults.__skipRetry = true;
9392
+ const principal = await readSessionPrincipal2(client4.raw());
9393
9393
  if (principal.tenantId !== tenantId || principal.username !== "admin" || !principal.roles?.includes("admin.system") || principal.impersonated || principal.actSub != null) {
9394
9394
  throw new CliError22({
9395
9395
  code: CliErrorCode23.SCOPE_FORBIDDEN,
@@ -9410,7 +9410,7 @@ async function tenantResetCommand(args) {
9410
9410
  if (!/^y(es)?$/i.test(answer)) throw new CliError22({ code: CliErrorCode23.INVALID_ARGUMENT, message: "\u5DF2\u53D6\u6D88\uFF0C\u672A\u53D1\u9001\u91CD\u7F6E\u3002" });
9411
9411
  }
9412
9412
  attempted = true;
9413
- const receipt = await resetTenant(client3.raw(), tenantId);
9413
+ const receipt = await resetTenant(client4.raw(), tenantId);
9414
9414
  if (fmt === "table") process.stdout.write(
9415
9415
  `\u79DF\u6237 ${receipt.tenantId} \xB7 \u6D41\u6C34 ${receipt.runId}
9416
9416
  \u5220\u9664 ${receipt.deletedRows} \u884C / \u6D89\u53CA ${receipt.touchedTables} \u8868 / \u91CD\u5EFA ${receipt.restoredRows} \u884C
@@ -9620,10 +9620,10 @@ async function tenantReconcileCommand(args) {
9620
9620
  code: CliErrorCode24.AUTH_FAILED,
9621
9621
  message: "\u5F53\u524D\u8EAB\u4EFD\u6CA1\u6709\u53EF\u8BFB\u53D6\u7684\u51ED\u636E\uFF0C\u672A\u53D1\u9001\u8865\u8DD1\u3002"
9622
9622
  });
9623
- const client3 = new HcmClient21({ endpoint, tenantId, accessToken, profile: env2, environmentSafety: safety });
9624
- client3.raw().defaults.maxRedirects = 0;
9625
- client3.raw().defaults.__skipRetry = true;
9626
- const principal = await readSessionPrincipal3(client3.raw());
9623
+ const client4 = new HcmClient21({ endpoint, tenantId, accessToken, profile: env2, environmentSafety: safety });
9624
+ client4.raw().defaults.maxRedirects = 0;
9625
+ client4.raw().defaults.__skipRetry = true;
9626
+ const principal = await readSessionPrincipal3(client4.raw());
9627
9627
  if (principal.tenantId !== tenantId || tenantId === "__SYSTEM__" || !principal.roles?.includes("admin.system") || principal.impersonated || principal.actSub != null) {
9628
9628
  throw new CliError23({
9629
9629
  code: CliErrorCode24.SCOPE_FORBIDDEN,
@@ -9631,7 +9631,7 @@ async function tenantReconcileCommand(args) {
9631
9631
  context: { nextStep: "\u7531\u76EE\u6807\u79DF\u6237\u7BA1\u7406\u5458\u6838\u5BF9\u73AF\u5883\u3001\u79DF\u6237\u4E0E\u767B\u5F55\u4F1A\u8BDD\uFF1BAPI Token/OAuth \u59D4\u6258\u7531\u670D\u52A1\u7AEF\u62D2\u7EDD\u3002" }
9632
9632
  });
9633
9633
  }
9634
- process.stderr.write(`\u2192 \u8865\u8DD1\u76EE\u6807 ${client3.endpoint} \xB7 \u73AF\u5883 ${env2} \xB7 \u79DF\u6237 ${tenantId} \xB7 \u7528\u6237 ${principal.username}
9634
+ process.stderr.write(`\u2192 \u8865\u8DD1\u76EE\u6807 ${client4.endpoint} \xB7 \u73AF\u5883 ${env2} \xB7 \u79DF\u6237 ${tenantId} \xB7 \u7528\u6237 ${principal.username}
9635
9635
  \u5C06\u5F53\u524D\u79DF\u6237\u5404\u521D\u59CB\u5316\u7EC4\u4EF6\u5BF9\u9F50\u5230\u670D\u52A1\u7AEF\u6700\u65B0 catalog\uFF1B\u53EF\u80FD\u65B0\u589E\u9ED8\u8BA4\u8D44\u6E90\uFF0C\u4FDD\u7559\u89C4\u5219\u4EE5\u5404\u7EC4\u4EF6\u4E3A\u51C6\u3002\u6267\u884C\u524D\u5E94\u6309\u672C\u6B21\u6388\u6743\u4FDD\u5B58\u914D\u7F6E\u57FA\u7EBF\uFF1B\u4E0D\u91CD\u7F6E\u79DF\u6237\uFF0C\u4E0D\u63A5\u53D7\u6307\u5B9A\u79DF\u6237\u6216\u7248\u672C\u3002
9636
9636
  `);
9637
9637
  if (!args.yes) {
@@ -9647,13 +9647,13 @@ async function tenantReconcileCommand(args) {
9647
9647
  });
9648
9648
  }
9649
9649
  attempted = true;
9650
- const reconcile = await reconcileTenant(client3.raw(), tenantId);
9650
+ const reconcile = await reconcileTenant(client4.raw(), tenantId);
9651
9651
  let verification;
9652
9652
  if (!reconcile.success || reconcile.error != null || reconcile.results.some((r) => r.status !== "SUCCESS")) {
9653
9653
  verification = { status: "FAILED", reason: "\u670D\u52A1\u7AEF\u56DE\u6267\u5305\u542B\u672A\u6210\u529F\u7EC4\u4EF6\uFF1B\u672A\u5C06\u90E8\u5206\u6210\u529F\u5F53\u4F5C\u5B8C\u6210\u3002" };
9654
9654
  } else {
9655
9655
  try {
9656
- const report = await bootstrapReport(client3.raw());
9656
+ const report = await bootstrapReport(client4.raw());
9657
9657
  const value = report;
9658
9658
  const checks = Array.isArray(value?.results) ? value.results.filter((r) => r?.checkId === "tenant.bootstrap") : [];
9659
9659
  const verdict = checks.length === 1 ? checks[0]?.verdict : void 0;
@@ -10026,6 +10026,256 @@ async function metaValidateCommand(path22, args) {
10026
10026
  }
10027
10027
  }
10028
10028
 
10029
+ // src/commands/meta-column-slots.ts
10030
+ init_exit();
10031
+ init_auth_guard();
10032
+ import {
10033
+ HcmClient as HcmClient23,
10034
+ CliError as CliError25,
10035
+ CliErrorCode as CliErrorCode26,
10036
+ fromAxiosError as fromAxiosError22,
10037
+ formatObject as formatObject23,
10038
+ getColumnSlots,
10039
+ getColumnSlotSql,
10040
+ COLUMN_SLOT_SQL_KEYS,
10041
+ COLUMN_SLOT_REBIND_SQL_KEYS
10042
+ } from "@hcmai/sdk";
10043
+ var COLUMN_SLOT_SQL_PURPOSE = {
10044
+ countSlot: "\u69FD\u91CC\u672C\u79DF\u6237\u7684\u975E\u7A7A\u884C\u6570\uFF08\u7ED1\u5B9A\u524D\u987B\u4E3A 0\uFF09",
10045
+ flexToSlot: "\u628A flex \u91CC\u7684\u503C\u642C\u8FDB\u69FD",
10046
+ verifyFlexToSlot: "\u6838\u5BF9 flex \u4E0E\u69FD\u662F\u5426\u4E00\u81F4\uFF0C\u7ED3\u679C\u987B\u4E3A 0",
10047
+ slotToFlex: "\u628A\u69FD\u91CC\u7684\u503C\u5199\u56DE flex",
10048
+ removeFlexKey: "\u5220\u6389 flex \u91CC\u7684\u540C\u540D\u952E",
10049
+ clearSlot: "\u6E05\u7A7A\u672C\u79DF\u6237\u5728\u8FD9\u4E2A\u69FD\u91CC\u7684\u503C",
10050
+ moveFromSlot: "\u6539\u7ED1\uFF1A\u628A\u65E7\u69FD\u7684\u503C\u642C\u8FDB\u65B0\u69FD",
10051
+ verifyMoveFromSlot: "\u6539\u7ED1\u6838\u5BF9\uFF1A\u65B0\u65E7\u69FD\u662F\u5426\u4E00\u81F4\uFF0C\u7ED3\u679C\u987B\u4E3A 0",
10052
+ clearFromSlot: "\u6539\u7ED1\uFF1A\u6E05\u7A7A\u65E7\u69FD"
10053
+ };
10054
+ var STEP_ORDER = ["flexToColumn", "columnToFlex", "rebind"];
10055
+ var STEP_LABEL = {
10056
+ flexToColumn: "flex \u2192 \u5217\u69FD",
10057
+ columnToFlex: "\u5217\u69FD \u2192 flex",
10058
+ rebind: "\u6539\u7ED1\u522B\u7684\u69FD"
10059
+ };
10060
+ var isKnownKey = (key2) => COLUMN_SLOT_SQL_KEYS.includes(key2);
10061
+ function flagsOf(args) {
10062
+ return connFlags(args) + (args.workspace ? ` --workspace ${args.workspace}` : "");
10063
+ }
10064
+ function client3(args) {
10065
+ return getActiveAuthContextFromCli(args).then((ctx) => HcmClient23.fromAuthContext(ctx));
10066
+ }
10067
+ function formatOf(args) {
10068
+ return args.output === "json" || args.output === "yaml" ? args.output : "table";
10069
+ }
10070
+ function fail8(e, args) {
10071
+ const err = e;
10072
+ if (err?.isAxiosError) {
10073
+ const ce = fromAxiosError22(err, args.env);
10074
+ if (err.response?.status === 404 && !ce.context?.nextStep) {
10075
+ exitWithError(
10076
+ new CliError25({
10077
+ code: ce.code,
10078
+ message: ce.message,
10079
+ context: {
10080
+ ...ce.context,
10081
+ nextStep: "\u76EE\u6807\u73AF\u5883\u7684\u540E\u7AEF\u591A\u534A\u8FD8\u6CA1\u6709\u5217\u69FD\u63A5\u53E3\uFF08\u968F ADR-452 \u5217\u69FD\u767B\u8BB0\u8868\u53D1\u5E03\uFF09\uFF1A\u7528 `hcm version` \u770B\u540E\u7AEF\u7248\u672C"
10082
+ },
10083
+ traceId: ce.traceId,
10084
+ profile: ce.profile,
10085
+ cause: ce.cause
10086
+ })
10087
+ );
10088
+ }
10089
+ exitWithError(ce);
10090
+ }
10091
+ exitWithError(e);
10092
+ }
10093
+ function writeNotes(view, args) {
10094
+ if (view.degraded) {
10095
+ process.stderr.write(`\u26A0\uFE0F \u964D\u7EA7\uFF08degraded\uFF09\uFF1A${view.reason ?? "\u670D\u52A1\u7AEF\u6CA1\u7ED9\u539F\u56E0"}
10096
+ `);
10097
+ }
10098
+ if (view.source === "active" && !args.workspace) {
10099
+ process.stderr.write(
10100
+ "\u6765\u6E90 active\uFF1A\u8FD9\u6B21\u6CA1\u8FDB\u5F00\u53D1\u7A7A\u95F4\uFF08\u6CA1\u5E26 --workspace\uFF0C\u5F53\u524D\u8EAB\u4EFD\u4E5F\u6CA1\u6709\u5F00\u53D1\u6A21\u5F0F\u7ED1\u5B9A\uFF09\uFF0C\u53EA\u4FDD\u5B58\u5728\u5F00\u53D1\u7A7A\u95F4\u91CC\u7684\u5B57\u6BB5\u4E0E\u5360\u7528\u4E0D\u7B97\u5728\u5185\uFF1B\u8981\u770B\u5F00\u53D1\u7A7A\u95F4\u5C31\u52A0 --workspace <key>\n"
10101
+ );
10102
+ }
10103
+ if (view.nextStep) process.stderr.write(`\u4E0B\u4E00\u6B65\uFF1A${view.nextStep}
10104
+ `);
10105
+ }
10106
+ function columnWidth(values, header) {
10107
+ return Math.max(header.length, ...values.map((v) => v.length));
10108
+ }
10109
+ function renderColumnSlots(view, flags = "") {
10110
+ const lines = [`\u6A21\u578B ${view.model} \u2192 \u8868 ${view.table} \xB7 \u6765\u6E90 ${view.source}`];
10111
+ if (view.degraded) {
10112
+ lines.push(`\u26A0\uFE0F \u964D\u7EA7\uFF08${view.reason ?? "\u670D\u52A1\u7AEF\u6CA1\u7ED9\u539F\u56E0"}\uFF09\uFF1A\u7ED3\u679C\u53EF\u80FD\u4E0D\u5168\uFF0C\u53EF\u9009\u69FD\u53EF\u80FD\u504F\u5C11`);
10113
+ }
10114
+ lines.push("", `\u53EF\u9009\u69FD\uFF08${view.slots.length}\uFF09\uFF1A`);
10115
+ if (view.slots.length === 0) lines.push(" \uFF08\u65E0\uFF09");
10116
+ else {
10117
+ const w = columnWidth(view.slots.map((s) => s.column), "COLUMN");
10118
+ lines.push(` ${"COLUMN".padEnd(w)} TYPE`);
10119
+ for (const s of view.slots) lines.push(` ${s.column.padEnd(w)} ${s.type}`);
10120
+ }
10121
+ lines.push("", `\u5DF2\u5360\u7528\uFF08${view.occupied.length}\uFF09\uFF1A`);
10122
+ if (view.occupied.length === 0) lines.push(" \uFF08\u65E0\uFF09");
10123
+ else {
10124
+ const w = columnWidth(view.occupied.map((s) => s.column), "COLUMN");
10125
+ const t = columnWidth(view.occupied.map((s) => s.type), "TYPE");
10126
+ lines.push(` ${"COLUMN".padEnd(w)} ${"TYPE".padEnd(t)} MODEL.FIELD`);
10127
+ for (const s of view.occupied) lines.push(` ${s.column.padEnd(w)} ${s.type.padEnd(t)} ${s.model}.${s.field}`);
10128
+ }
10129
+ const reasons = Object.entries(view.unavailableByReason ?? {});
10130
+ const total = reasons.reduce((n, [, c2]) => n + (Number(c2) || 0), 0);
10131
+ lines.push("", `\u4E0D\u53EF\u7528\u69FD\uFF08${total}\uFF0C\u6309\u539F\u56E0\u8BA1\u6570\uFF09\uFF1A`);
10132
+ if (reasons.length === 0) lines.push(" \uFF08\u65E0\uFF09");
10133
+ else {
10134
+ const w = columnWidth(reasons.map(([r]) => r), "REASON");
10135
+ for (const [reason, count] of reasons) lines.push(` ${reason.padEnd(w)} ${count}`);
10136
+ }
10137
+ lines.push(
10138
+ "",
10139
+ `\u53D6\u642C\u6570\u636E / \u6E05\u6570\u636E\u7684 SQL\uFF1A\`hcm meta column-slot-sql ${view.model} <\u5B57\u6BB5\u952E> --slot <\u69FD>${flags}\`\uFF08\u6539\u7ED1\u518D\u52A0 --from-slot <\u65E7\u69FD>\uFF09`
10140
+ );
10141
+ return lines.join("\n");
10142
+ }
10143
+ function sqlText(view, key2) {
10144
+ const text = view.sql[key2];
10145
+ return typeof text === "string" && text.trim() ? text : void 0;
10146
+ }
10147
+ function unavailableReason(view, key2) {
10148
+ const reason = view.unavailable?.[key2];
10149
+ if (typeof reason === "string" && reason.trim()) return reason;
10150
+ return view.sql[key2] === "" ? "\u670D\u52A1\u7AEF\u7ED9\u4E86\u7A7A\u4E32\uFF0C\u4E5F\u6CA1\u8BF4\u539F\u56E0" : "\u670D\u52A1\u7AEF\u6CA1\u7ED9\u539F\u56E0";
10151
+ }
10152
+ function sqlKeysOf(view) {
10153
+ const present = Object.keys(view.sql);
10154
+ return [...COLUMN_SLOT_SQL_KEYS.filter((k) => present.includes(k)), ...present.filter((k) => !isKnownKey(k))];
10155
+ }
10156
+ function renderColumnSlotSql(view) {
10157
+ const lines = [];
10158
+ const typeNote = [view.fieldType ? `type ${view.fieldType}` : void 0, view.storage ? `\u5B58\u50A8 ${view.storage}` : void 0].filter(Boolean).join(" \xB7 ");
10159
+ lines.push(`\u79DF\u6237 ${view.tenantId} \xB7 ${view.model}.${view.field}${typeNote ? `\uFF08${typeNote}\uFF09` : ""}`);
10160
+ lines.push(`\u8868 ${view.table} \xB7 \u6765\u6E90 ${view.source}`);
10161
+ const target = `${view.slot}${view.slotType ? `\uFF08${view.slotType}\uFF09` : ""}`;
10162
+ lines.push(
10163
+ view.fromSlot ? `\u69FD\uFF1A\u6539\u7ED1 ${view.fromSlot} \u2192 ${target} \xB7 \u5143\u6570\u636E\u5F53\u524D\u7ED1\u5B9A ${view.currentSlot ?? "\u65E0"}` : `\u69FD\uFF1A\u5F53\u524D ${view.currentSlot ?? "\u65E0\uFF08flex\uFF09"} \u2192 \u76EE\u6807 ${target}`
10164
+ );
10165
+ const disc = Object.entries(view.discriminator ?? {});
10166
+ lines.push(
10167
+ `\u533A\u5206\u6761\u4EF6\uFF1A${disc.length ? disc.map(([c2, v]) => `${c2} = ${v}`).join(" AND ") : "\u65E0\uFF08\u6BCF\u53E5\u53EA\u6309 tenant_id \u9650\u5B9A\uFF09"}`
10168
+ );
10169
+ lines.push(`\u65B9\u8A00\uFF1A${view.dialect ?? "\u670D\u52A1\u7AEF\u6CA1\u7ED9"}`);
10170
+ if (view.degraded) lines.push(`\u26A0\uFE0F \u964D\u7EA7\uFF1A${view.reason ?? "\u670D\u52A1\u7AEF\u6CA1\u7ED9\u539F\u56E0"}`);
10171
+ if (view.jsonSqlUnavailable) lines.push(`\u26A0\uFE0F JSON \u7C7B\u8BED\u53E5\u4E0D\u53EF\u7528\uFF1A${view.jsonSqlUnavailable}`);
10172
+ lines.push("", "\u53EF\u7528\u6027\uFF1A");
10173
+ const availability = Object.entries(view.availability ?? {});
10174
+ if (availability.length === 0) lines.push(" \uFF08\u670D\u52A1\u7AEF\u6CA1\u7ED9\uFF09");
10175
+ else {
10176
+ const w = columnWidth(availability.map(([s]) => s), "");
10177
+ for (const [slot, a] of availability) {
10178
+ if (a?.available) lines.push(` ${slot.padEnd(w)} \u53EF\u7528`);
10179
+ else {
10180
+ lines.push(` ${slot.padEnd(w)} \u4E0D\u53EF\u7528\uFF08${a?.reason ?? "\u670D\u52A1\u7AEF\u6CA1\u7ED9\u539F\u56E0"}\uFF09`);
10181
+ if (a?.nextStep) lines.push(` ${"".padEnd(w)} \u4E0B\u4E00\u6B65\uFF1A${a.nextStep}`);
10182
+ }
10183
+ }
10184
+ }
10185
+ lines.push("", "SQL\uFF08\u9010\u53E5\uFF1B\u7ED9\u4E0D\u51FA\u7684\u5199\u660E\u539F\u56E0\uFF09\uFF1A");
10186
+ for (const key2 of sqlKeysOf(view)) {
10187
+ const purpose = isKnownKey(key2) ? COLUMN_SLOT_SQL_PURPOSE[key2] : "\u672C\u7248 CLI \u4E0D\u8BA4\u8BC6\u8FD9\u53E5\u7684\u7528\u9014\uFF0C\u89C1\u4E0B\u65B9\u6D41\u7A0B";
10188
+ const text = sqlText(view, key2);
10189
+ lines.push("", `-- ${key2} \xB7 ${purpose}`, text ?? `\uFF08\u4E0D\u53EF\u7528\uFF1A${unavailableReason(view, key2)}\uFF09`);
10190
+ }
10191
+ const steps = view.steps ?? {};
10192
+ const stepKeys = [...STEP_ORDER.filter((k) => k in steps), ...Object.keys(steps).filter((k) => !STEP_ORDER.includes(k))];
10193
+ lines.push("", "\u6D41\u7A0B\uFF1A");
10194
+ if (stepKeys.length === 0) lines.push(" \uFF08\u670D\u52A1\u7AEF\u6CA1\u7ED9\uFF09");
10195
+ for (const k of stepKeys) lines.push(` ${k}\uFF08${STEP_LABEL[k] ?? k}\uFF09\uFF1A${steps[k]}`);
10196
+ return lines.join("\n");
10197
+ }
10198
+ async function metaColumnSlotsCommand(model, args) {
10199
+ try {
10200
+ const c2 = await client3(args);
10201
+ const view = await getColumnSlots(c2.raw(), model, { workspaceKey: args.workspace });
10202
+ const fmt = formatOf(args);
10203
+ process.stdout.write(
10204
+ (fmt === "table" ? renderColumnSlots(view, flagsOf(args)) : formatObject23(view, { format: fmt })) + "\n"
10205
+ );
10206
+ writeNotes(view, args);
10207
+ process.exitCode = 0;
10208
+ } catch (e) {
10209
+ fail8(e, args);
10210
+ }
10211
+ }
10212
+ async function metaColumnSlotSqlCommand(model, field, args) {
10213
+ try {
10214
+ const only = args.only;
10215
+ if (only !== void 0) {
10216
+ if (!isKnownKey(only)) {
10217
+ throw new CliError25({
10218
+ code: CliErrorCode26.INVALID_ARGUMENT,
10219
+ message: `--only ${only} \u4E0D\u662F\u8BA4\u5F97\u7684 SQL \u952E`,
10220
+ context: { nextStep: `\u53EF\u9009\uFF1A${COLUMN_SLOT_SQL_KEYS.join(" / ")}` }
10221
+ });
10222
+ }
10223
+ if (COLUMN_SLOT_REBIND_SQL_KEYS.includes(only) && !args.fromSlot) {
10224
+ throw new CliError25({
10225
+ code: CliErrorCode26.INVALID_ARGUMENT,
10226
+ message: `${only} \u662F\u6539\u7ED1\u4E09\u53E5\u4E4B\u4E00\uFF0C\u53EA\u5728\u5E26 --from-slot \u65F6\u624D\u7ED9\u51FA`,
10227
+ context: { nextStep: "\u52A0 --from-slot <\u65E7\u69FD> \u91CD\u8DD1\uFF08--slot \u5199\u65B0\u69FD\uFF09" }
10228
+ });
10229
+ }
10230
+ }
10231
+ const c2 = await client3(args);
10232
+ const view = await getColumnSlotSql(
10233
+ c2.raw(),
10234
+ { model, field, slot: args.slot, fromSlot: args.fromSlot },
10235
+ { workspaceKey: args.workspace }
10236
+ );
10237
+ if (only !== void 0) {
10238
+ if (!(only in view.sql)) {
10239
+ throw new CliError25({
10240
+ code: CliErrorCode26.PROTOCOL_UNSUPPORTED,
10241
+ message: `\u670D\u52A1\u7AEF\u54CD\u5E94\u91CC\u6CA1\u6709 sql.${only}\uFF08\u53EA\u6709\uFF1A${Object.keys(view.sql).join(" / ") || "\u65E0"}\uFF09`,
10242
+ context: {
10243
+ reasonCode: "COLUMN_SLOT_SQL_KEY_MISSING",
10244
+ nextStep: "\u53BB\u6389 --only \u770B\u6574\u4EFD\u8F93\u51FA\uFF1B\u7528 `hcm version` \u6838\u5BF9\u540E\u7AEF\u7248\u672C"
10245
+ }
10246
+ });
10247
+ }
10248
+ const text = sqlText(view, only);
10249
+ if (text === void 0) {
10250
+ throw new CliError25({
10251
+ code: CliErrorCode26.BUSINESS_RULE_VIOLATION,
10252
+ message: `sql.${only} \u7ED9\u4E0D\u51FA\uFF1A${unavailableReason(view, only)}`,
10253
+ context: {
10254
+ reasonCode: "COLUMN_SLOT_SQL_UNAVAILABLE",
10255
+ nextStep: view.degraded && view.nextStep ? view.nextStep : "\u53BB\u6389 --only \u770B\u6574\u4EFD\u8F93\u51FA\uFF08\u5404\u53E5\u539F\u56E0\u3001\u53EF\u7528\u6027\u4E0E\u6D41\u7A0B\uFF09"
10256
+ }
10257
+ });
10258
+ }
10259
+ process.stdout.write(text.endsWith("\n") ? text : text + "\n");
10260
+ } else {
10261
+ const fmt = formatOf(args);
10262
+ process.stdout.write((fmt === "table" ? renderColumnSlotSql(view) : formatObject23(view, { format: fmt })) + "\n");
10263
+ }
10264
+ if (only !== void 0 || formatOf(args) !== "table") {
10265
+ for (const [slot, a] of Object.entries(view.availability ?? {})) {
10266
+ if (a && !a.available) {
10267
+ process.stderr.write(`\u26A0\uFE0F \u69FD ${slot} \u672C\u5B9E\u4F8B\u4E0D\u53EF\u7528\uFF08${a.reason ?? "\u670D\u52A1\u7AEF\u6CA1\u7ED9\u539F\u56E0"}\uFF09${a.nextStep ? `\uFF1A${a.nextStep}` : ""}
10268
+ `);
10269
+ }
10270
+ }
10271
+ }
10272
+ writeNotes(view, args);
10273
+ process.exitCode = 0;
10274
+ } catch (e) {
10275
+ fail8(e, args);
10276
+ }
10277
+ }
10278
+
10029
10279
  // src/commands/workspace.ts
10030
10280
  init_exit();
10031
10281
  import * as crypto from "crypto";
@@ -10038,10 +10288,10 @@ import {
10038
10288
  createWorkspaceFile,
10039
10289
  deleteWorkspaceFile,
10040
10290
  formatMiniVerifyReport,
10041
- formatObject as formatObject24,
10291
+ formatObject as formatObject25,
10042
10292
  formatRows as formatRows6,
10043
10293
  getMiniStatus,
10044
- HcmClient as HcmClient23,
10294
+ HcmClient as HcmClient24,
10045
10295
  initMiniAppProject,
10046
10296
  inferMiniWritableTemplateOptionsFromModel,
10047
10297
  listWorkspaceFiles,
@@ -10056,14 +10306,14 @@ import {
10056
10306
  validateMiniProject,
10057
10307
  validateMetaContent as validateMetaContent2,
10058
10308
  validateWorkspaceFiles,
10059
- fromAxiosError as fromAxiosError23,
10060
- CliError as CliError26,
10061
- CliErrorCode as CliErrorCode27
10309
+ fromAxiosError as fromAxiosError24,
10310
+ CliError as CliError27,
10311
+ CliErrorCode as CliErrorCode28
10062
10312
  } from "@hcmai/sdk";
10063
10313
 
10064
10314
  // src/commands/workspace-push-progress.ts
10065
10315
  import { isAxiosError } from "axios";
10066
- import { CliError as CliError25, CliErrorCode as CliErrorCode26, fromAxiosError as fromAxiosError22 } from "@hcmai/sdk";
10316
+ import { CliError as CliError26, CliErrorCode as CliErrorCode27, fromAxiosError as fromAxiosError23 } from "@hcmai/sdk";
10067
10317
  var PUSH_DEADLINE_MS = 3e5;
10068
10318
  var HEARTBEAT_MS = 1e4;
10069
10319
  async function withWorkspacePushProgress(run3, profile) {
@@ -10091,8 +10341,8 @@ async function withWorkspacePushProgress(run3, profile) {
10091
10341
  let timer;
10092
10342
  const deadline = new Promise((_, reject) => {
10093
10343
  timer = setTimeout(() => {
10094
- failure2 = new CliError25({
10095
- code: CliErrorCode26.TIMEOUT,
10344
+ failure2 = new CliError26({
10345
+ code: CliErrorCode27.TIMEOUT,
10096
10346
  message: `workspace push \u6574\u4F53\u671F\u9650\u5DF2\u5230\uFF08300 \u79D2\uFF09\uFF1B\u7B49\u5F85 ${requestLabel()}\u3002\u670D\u52A1\u7AEF\u63D0\u4EA4\u72B6\u6001\u672A\u77E5\u3002`,
10097
10347
  traceId: traceId(),
10098
10348
  profile,
@@ -10133,8 +10383,8 @@ async function withWorkspacePushProgress(run3, profile) {
10133
10383
  return await Promise.race([operation, deadline]);
10134
10384
  } catch (error) {
10135
10385
  if (!isAxiosError(error)) throw error;
10136
- const translated = fromAxiosError22(error, profile);
10137
- throw new CliError25({
10386
+ const translated = fromAxiosError23(error, profile);
10387
+ throw new CliError26({
10138
10388
  code: translated.code,
10139
10389
  message: translated.message,
10140
10390
  traceId: translated.traceId,
@@ -10147,7 +10397,7 @@ async function withWorkspacePushProgress(run3, profile) {
10147
10397
  } : {},
10148
10398
  nextStep: [
10149
10399
  translated.context?.nextStep,
10150
- translated.code === CliErrorCode26.AUTH_FAILED ? `\u5148 hcm login --env ${profile ?? "<\u73AF\u5883>"} --username <\u771F\u5B9E\u767B\u5F55\u8D26\u53F7> --password-stdin\uFF0C\u518D hcm workspace active\uFF1B\u8BA4\u8BC1\u672A\u901A\u8FC7\u4E0D\u80FD\u636E\u6B64\u5224\u65AD\u5DE5\u4F5C\u533A\u5931\u6548\u3002` : void 0,
10400
+ translated.code === CliErrorCode27.AUTH_FAILED ? `\u5148 hcm login --env ${profile ?? "<\u73AF\u5883>"} --username <\u771F\u5B9E\u767B\u5F55\u8D26\u53F7> --password-stdin\uFF0C\u518D hcm workspace active\uFF1B\u8BA4\u8BC1\u672A\u901A\u8FC7\u4E0D\u80FD\u636E\u6B64\u5224\u65AD\u5DE5\u4F5C\u533A\u5931\u6548\u3002` : void 0,
10151
10401
  recovery2
10152
10402
  ].filter(Boolean).join(" ")
10153
10403
  }
@@ -10191,11 +10441,11 @@ function boolValue(value) {
10191
10441
  // src/commands/workspace-rebase.ts
10192
10442
  import * as fs8 from "fs/promises";
10193
10443
  import * as path9 from "path";
10194
- import { formatObject as formatObject23 } from "@hcmai/sdk";
10444
+ import { formatObject as formatObject24 } from "@hcmai/sdk";
10195
10445
  async function runWorkspaceRebase(workspaceKey, args, connect) {
10196
10446
  const plan = args.plan && !args.dryRun ? readPlan(JSON.parse(await fs8.readFile(args.plan, "utf8"))) : void 0;
10197
- const client3 = await connect();
10198
- const workspaces = await client3.query("TenantExtensionWorkspace", {
10447
+ const client4 = await connect();
10448
+ const workspaces = await client4.query("TenantExtensionWorkspace", {
10199
10449
  filter: { workspaceKey },
10200
10450
  fields: ["id", "workspaceKey"],
10201
10451
  limit: 2
@@ -10206,7 +10456,7 @@ async function runWorkspaceRebase(workspaceKey, args, connect) {
10206
10456
  const id = requiredText(workspaces.rows[0].id, "workspace model id");
10207
10457
  const action = `/api/models/TenantExtensionWorkspace/${encodeURIComponent(id)}/action`;
10208
10458
  if (plan) {
10209
- const response2 = await client3.raw().post(`${action}/resolve-conflicts`, { form: plan });
10459
+ const response2 = await client4.raw().post(`${action}/resolve-conflicts`, { form: plan });
10210
10460
  const result = actionPayload(response2.data);
10211
10461
  const expected = new Set(plan.resolutions.map((item) => item.relativePath));
10212
10462
  if (result.workspaceKey !== workspaceKey || !Array.isArray(result.resolvedPaths) || result.resolvedPaths.length !== expected.size || new Set(result.resolvedPaths).size !== expected.size || result.resolvedPaths.some((item) => typeof item !== "string" || !expected.has(item)) || !nonnegativeInteger(result.remainingConflicts)) {
@@ -10223,7 +10473,7 @@ async function runWorkspaceRebase(workspaceKey, args, connect) {
10223
10473
  ]);
10224
10474
  return;
10225
10475
  }
10226
- const response = await client3.raw().get(`${action}/preview-rebase`);
10476
+ const response = await client4.raw().get(`${action}/preview-rebase`);
10227
10477
  const preview = readPreview(actionPayload(response.data), workspaceKey);
10228
10478
  if (args.plan) {
10229
10479
  const draft = {
@@ -10326,7 +10576,7 @@ function filePath(value) {
10326
10576
  return text;
10327
10577
  }
10328
10578
  function writeResult(result, format = "table", lines) {
10329
- process.stdout.write((format === "table" ? lines.join("\n") : formatObject23(result, { format })) + "\n");
10579
+ process.stdout.write((format === "table" ? lines.join("\n") : formatObject24(result, { format })) + "\n");
10330
10580
  }
10331
10581
 
10332
10582
  // src/commands/workspace.ts
@@ -10348,9 +10598,9 @@ var RAW_WORKSPACE_EXCLUDED_DIRS = /* @__PURE__ */ new Set([
10348
10598
  var RAW_WORKSPACE_EXCLUDED_FILES = /* @__PURE__ */ new Set([WORKSPACE_CONTEXT_FILE, ".DS_Store"]);
10349
10599
  async function workspaceListCommand(args) {
10350
10600
  try {
10351
- const client3 = HcmClient23.fromAuthContext(await getActiveAuthContextFromCli(args));
10601
+ const client4 = HcmClient24.fromAuthContext(await getActiveAuthContextFromCli(args));
10352
10602
  const limit = parsePositiveInt3(args.limit, 50, "--limit");
10353
- const result = await client3.query("TenantExtensionWorkspace", {
10603
+ const result = await client4.query("TenantExtensionWorkspace", {
10354
10604
  keyword: args.keyword,
10355
10605
  fields: [
10356
10606
  "workspaceKey",
@@ -10381,8 +10631,8 @@ async function workspaceActiveCommand(args) {
10381
10631
  const ctx = await getActiveAuthContextFromCli(args, {
10382
10632
  fallbackEnv: localContext?.profile
10383
10633
  });
10384
- const client3 = HcmClient23.fromAuthContext(ctx);
10385
- const binding = await readWorkspaceDevModeBinding(client3);
10634
+ const client4 = HcmClient24.fromAuthContext(ctx);
10635
+ const binding = await readWorkspaceDevModeBinding(client4);
10386
10636
  const activeWorkspaceKey = binding.enabled ? optionalText(binding.workspaceKey) : null;
10387
10637
  const bindingUpdatedAt = typeof binding.updatedAt === "number" && Number.isFinite(binding.updatedAt) && binding.updatedAt > 0 && binding.updatedAt <= 864e13 ? binding.updatedAt : null;
10388
10638
  const view = {
@@ -10393,9 +10643,9 @@ async function workspaceActiveCommand(args) {
10393
10643
  localWorkspaceKey: localContext?.workspaceKey ?? null,
10394
10644
  matchesLocal: activeWorkspaceKey && localContext?.workspaceKey ? activeWorkspaceKey === localContext.workspaceKey : null,
10395
10645
  nextCommand: workspaceActiveNextCommand(activeWorkspaceKey),
10396
- profile: client3.profile,
10397
- tenantId: client3.tenantId,
10398
- endpoint: client3.endpoint,
10646
+ profile: client4.profile,
10647
+ tenantId: client4.tenantId,
10648
+ endpoint: client4.endpoint,
10399
10649
  rootDir
10400
10650
  };
10401
10651
  writeWorkspaceActiveResult(view, args.output ?? "table");
@@ -10414,12 +10664,12 @@ async function workspaceBindCommand(workspaceKey, args) {
10414
10664
  `${WORKSPACE_CONTEXT_FILE} already binds workspace '${existing.workspaceKey}'; use --force to rebind`
10415
10665
  );
10416
10666
  }
10417
- const client3 = await loadProfileClient(args);
10667
+ const client4 = await loadProfileClient(args);
10418
10668
  const context = buildWorkspaceContext({
10419
10669
  workspaceKey,
10420
- profile: args.env ?? args.profile ?? client3?.profile,
10421
- tenantId: args.tenant ?? client3?.tenantId,
10422
- endpoint: args.endpoint ?? client3?.endpoint
10670
+ profile: args.env ?? args.profile ?? client4?.profile,
10671
+ tenantId: args.tenant ?? client4?.tenantId,
10672
+ endpoint: args.endpoint ?? client4?.endpoint
10423
10673
  });
10424
10674
  await fs9.mkdir(rootDir, { recursive: true });
10425
10675
  await writeWorkspaceContext(rootDir, context);
@@ -10439,9 +10689,9 @@ async function workspaceCreateCommand(workspaceKey, args) {
10439
10689
  `${WORKSPACE_CONTEXT_FILE} already binds workspace '${existing.workspaceKey}'; use --force to rebind`
10440
10690
  );
10441
10691
  }
10442
- const client3 = HcmClient23.fromAuthContext(await getActiveAuthContextFromCli(args));
10692
+ const client4 = HcmClient24.fromAuthContext(await getActiveAuthContextFromCli(args));
10443
10693
  const normalizedWorkspaceKey = normalizeWorkspaceKey(workspaceKey);
10444
- const resp = await client3.raw().post("/api/models/TenantExtensionWorkspace", {
10694
+ const resp = await client4.raw().post("/api/models/TenantExtensionWorkspace", {
10445
10695
  workspaceKey: normalizedWorkspaceKey,
10446
10696
  description: args.description ?? ""
10447
10697
  });
@@ -10449,14 +10699,14 @@ async function workspaceCreateCommand(workspaceKey, args) {
10449
10699
  const id = stringOptional(created.id);
10450
10700
  let activated = false;
10451
10701
  if (args.activate) {
10452
- await setDevModeBinding(client3, normalizedWorkspaceKey);
10702
+ await setDevModeBinding(client4, normalizedWorkspaceKey);
10453
10703
  activated = true;
10454
10704
  }
10455
10705
  const context = buildWorkspaceContext({
10456
10706
  workspaceKey: normalizedWorkspaceKey,
10457
- profile: args.profile ?? client3.profile,
10458
- tenantId: client3.tenantId,
10459
- endpoint: client3.endpoint
10707
+ profile: args.profile ?? client4.profile,
10708
+ tenantId: client4.tenantId,
10709
+ endpoint: client4.endpoint
10460
10710
  });
10461
10711
  await fs9.mkdir(rootDir, { recursive: true });
10462
10712
  await writeWorkspaceContext(rootDir, context);
@@ -10466,8 +10716,8 @@ async function workspaceCreateCommand(workspaceKey, args) {
10466
10716
  id: id ?? "-",
10467
10717
  rootDir,
10468
10718
  activated,
10469
- profile: client3.profile,
10470
- tenantId: client3.tenantId
10719
+ profile: client4.profile,
10720
+ tenantId: client4.tenantId
10471
10721
  },
10472
10722
  args.output ?? "table"
10473
10723
  );
@@ -10481,7 +10731,7 @@ async function workspaceRebaseCommand(args) {
10481
10731
  try {
10482
10732
  const existing = await readWorkspaceContext(resolveRootDir(args.dir));
10483
10733
  const workspaceKey = normalizeWorkspaceKey(args.workspace ?? existing?.workspaceKey ?? "");
10484
- await runWorkspaceRebase(workspaceKey, args, async () => HcmClient23.fromAuthContext(
10734
+ await runWorkspaceRebase(workspaceKey, args, async () => HcmClient24.fromAuthContext(
10485
10735
  await getActiveAuthContextFromCli(args, { fallbackEnv: existing?.profile })
10486
10736
  ));
10487
10737
  process.exitCode = 0;
@@ -10499,16 +10749,16 @@ async function workspacePullCommand(args) {
10499
10749
  `workspace key is required; pass --workspace <key> or run hcm workspace bind <key> first`
10500
10750
  );
10501
10751
  }
10502
- const client3 = HcmClient23.fromAuthContext(
10752
+ const client4 = HcmClient24.fromAuthContext(
10503
10753
  await getActiveAuthContextFromCli(args, { fallbackEnv: existing?.profile })
10504
10754
  );
10505
10755
  const context = buildWorkspaceContext({
10506
10756
  workspaceKey,
10507
- profile: client3.profile ?? args.env ?? args.profile ?? existing?.profile,
10508
- tenantId: client3.tenantId ?? existing?.tenantId,
10509
- endpoint: client3.endpoint ?? existing?.endpoint
10757
+ profile: client4.profile ?? args.env ?? args.profile ?? existing?.profile,
10758
+ tenantId: client4.tenantId ?? existing?.tenantId,
10759
+ endpoint: client4.endpoint ?? existing?.endpoint
10510
10760
  });
10511
- const files = await listWorkspaceFilesForSync(client3.raw(), workspaceKey);
10761
+ const files = await listWorkspaceFilesForSync(client4.raw(), workspaceKey);
10512
10762
  const localFiles = await readWorkspaceRawLocalFiles(rootDir);
10513
10763
  const remotePaths = new Set(files.data.map((file) => file.relativePath));
10514
10764
  const manifest2 = await readWorkspaceRawManifest(rootDir, context, true);
@@ -10516,8 +10766,8 @@ async function workspacePullCommand(args) {
10516
10766
  const previous = sameTarget ? workspaceRawBaselineByPath(manifest2) : /* @__PURE__ */ new Map();
10517
10767
  const remoteDeleted = localFiles.filter((file) => previous.has(file.localPath) && !remotePaths.has(file.localPath));
10518
10768
  if (remoteDeleted.length) {
10519
- throw new CliError26({
10520
- code: CliErrorCode27.BUSINESS_RULE_VIOLATION,
10769
+ throw new CliError27({
10770
+ code: CliErrorCode28.BUSINESS_RULE_VIOLATION,
10521
10771
  message: `\u8FDC\u7AEF\u5DF2\u5220\u9664\u66FE\u540C\u6B65\u7684\u6587\u4EF6\uFF0C\u672C\u5730\u4ECD\u4FDD\u7559\u5185\u5BB9\uFF1A${remoteDeleted.map((file) => file.localPath).join(", ")}\u3002\u672A\u91CD\u5EFA\u540C\u6B65\u57FA\u7EBF\u3002`,
10522
10772
  context: {
10523
10773
  reason: "WORKSPACE_REMOTE_FILE_DELETED",
@@ -10536,12 +10786,12 @@ async function workspacePullCommand(args) {
10536
10786
  const pulledMiniApps = [];
10537
10787
  for (const appCode of miniApps) {
10538
10788
  const result = await pullMiniAppProject({
10539
- http: client3.raw(),
10789
+ http: client4.raw(),
10540
10790
  appCode,
10541
10791
  workspaceKey,
10542
10792
  targetDir: path10.join(rootDir, MINI_APPS_DIR, appCode),
10543
- tenantId: client3.tenantId,
10544
- endpoint: client3.endpoint,
10793
+ tenantId: client4.tenantId,
10794
+ endpoint: client4.endpoint,
10545
10795
  profile: context.profile,
10546
10796
  force: !!args.force
10547
10797
  });
@@ -10553,10 +10803,10 @@ async function workspacePullCommand(args) {
10553
10803
  const pulledRawFiles = [];
10554
10804
  const snapshots = [];
10555
10805
  for (const file of rawFiles) {
10556
- const content = await loadWorkspaceFileContent(client3.raw(), file.id);
10806
+ const content = await loadWorkspaceFileContent(client4.raw(), file.id);
10557
10807
  if (content.workspaceKey !== workspaceKey || content.relativePath !== file.relativePath) {
10558
- throw new CliError26({
10559
- code: CliErrorCode27.NETWORK_ERROR,
10808
+ throw new CliError27({
10809
+ code: CliErrorCode28.NETWORK_ERROR,
10560
10810
  message: `load-content \u56DE\u6267\u4E0E\u76EE\u6807\u5DE5\u4F5C\u533A\u6216\u6587\u4EF6\u4E0D\u7B26\uFF1A${file.relativePath}`,
10561
10811
  context: {
10562
10812
  reason: "INVALID_WORKSPACE_FILE_CONTENT",
@@ -10606,12 +10856,12 @@ async function workspaceAddMiniCommand(appCode, args) {
10606
10856
  const templateKind = parseTemplateKind(args.template);
10607
10857
  validateWritableOptions(templateKind, args);
10608
10858
  const model = parseModelKey(args.model);
10609
- const client3 = await loadProfileClient({
10859
+ const client4 = await loadProfileClient({
10610
10860
  ...args,
10611
10861
  env: args.env ?? args.profile ?? context.profile
10612
10862
  });
10613
10863
  const autoOptions = await resolveWritableAutoOptions({
10614
- client: client3,
10864
+ client: client4,
10615
10865
  templateKind,
10616
10866
  model,
10617
10867
  fields: args.fields,
@@ -10630,9 +10880,9 @@ async function workspaceAddMiniCommand(appCode, args) {
10630
10880
  writableDefaults: autoOptions.defaults ?? parseJsonObject(args.defaults, "--defaults"),
10631
10881
  writableTodayDefaultFields: autoOptions.todayDefaultFields,
10632
10882
  requiredScopes: parseScopes(args.scopes),
10633
- tenantId: args.tenant ?? client3?.tenantId ?? context.tenantId,
10634
- endpoint: client3?.endpoint ?? context.endpoint,
10635
- profile: args.env ?? args.profile ?? client3?.profile ?? context.profile,
10883
+ tenantId: args.tenant ?? client4?.tenantId ?? context.tenantId,
10884
+ endpoint: client4?.endpoint ?? context.endpoint,
10885
+ profile: args.env ?? args.profile ?? client4?.profile ?? context.profile,
10636
10886
  force: !!args.force
10637
10887
  });
10638
10888
  writeWorkspaceAddMiniResult(result, rootDir, args.output ?? "table");
@@ -10664,15 +10914,15 @@ async function workspaceRmCommand(relativePath, args) {
10664
10914
  const manifest2 = await readWorkspaceRawManifest(rootDir, context);
10665
10915
  let manifestEntry = workspaceRawBaselineByPath(manifest2).get(normalized);
10666
10916
  if (!manifestEntry) {
10667
- const client3 = HcmClient23.fromAuthContext(await getActiveAuthContextFromCli(
10917
+ const client4 = HcmClient24.fromAuthContext(await getActiveAuthContextFromCli(
10668
10918
  args,
10669
10919
  { fallbackEnv: context.profile }
10670
10920
  ));
10671
- const remote = (await listWorkspaceFilesForSync(client3.raw(), context.workspaceKey)).data.find(
10921
+ const remote = (await listWorkspaceFilesForSync(client4.raw(), context.workspaceKey)).data.find(
10672
10922
  (file) => file.relativePath === normalized
10673
10923
  );
10674
10924
  if (remote) {
10675
- const content = await loadWorkspaceFileContent(client3.raw(), remote.id);
10925
+ const content = await loadWorkspaceFileContent(client4.raw(), remote.id);
10676
10926
  manifestEntry = {
10677
10927
  localPath: normalized,
10678
10928
  remotePath: remote.relativePath,
@@ -10689,7 +10939,7 @@ async function workspaceRmCommand(relativePath, args) {
10689
10939
  if (!stat) {
10690
10940
  if (manifestEntry) {
10691
10941
  process.stdout.write(
10692
- formatObject24(
10942
+ formatObject25(
10693
10943
  {
10694
10944
  workspaceKey: context.workspaceKey,
10695
10945
  file: normalized,
@@ -10714,7 +10964,7 @@ async function workspaceRmCommand(relativePath, args) {
10714
10964
  next: `hcm workspace push --dir ${args.dir ?? "."}`
10715
10965
  };
10716
10966
  if (args.output === "json" || args.output === "yaml") {
10717
- process.stdout.write(formatObject24(result, { format: args.output }) + "\n");
10967
+ process.stdout.write(formatObject25(result, { format: args.output }) + "\n");
10718
10968
  } else {
10719
10969
  process.stdout.write(`workspace file staged for deletion: ${normalized}
10720
10970
  `);
@@ -10761,7 +11011,7 @@ async function workspaceStatusCommand(args) {
10761
11011
  }
10762
11012
  if (args.output === "json" || args.output === "yaml") {
10763
11013
  process.stdout.write(
10764
- formatObject24({ rootDir, miniApps: rows2 }, { format: args.output }) + "\n"
11014
+ formatObject25({ rootDir, miniApps: rows2 }, { format: args.output }) + "\n"
10765
11015
  );
10766
11016
  } else {
10767
11017
  process.stdout.write(formatRows6(rows2, { format: "table" }) + "\n");
@@ -10822,26 +11072,26 @@ async function workspacePushCommand(args) {
10822
11072
  for (const app of miniApps) {
10823
11073
  const validation = await validateMiniProject(app.dir);
10824
11074
  if (!validation.valid) {
10825
- throw new CliError26({
10826
- code: CliErrorCode27.INVALID_ARGUMENT,
11075
+ throw new CliError27({
11076
+ code: CliErrorCode28.INVALID_ARGUMENT,
10827
11077
  message: `mini app ${app.appCode} validation failed: ${validation.errors.join("; ")}`
10828
11078
  });
10829
11079
  }
10830
11080
  }
10831
- const client3 = HcmClient23.fromAuthContext(
11081
+ const client4 = HcmClient24.fromAuthContext(
10832
11082
  await getActiveAuthContextFromCli(args, { fallbackEnv: context.profile })
10833
11083
  );
10834
- profile = client3.profile ?? profile;
10835
- bindHttp(client3.raw());
11084
+ profile = client4.profile ?? profile;
11085
+ bindHttp(client4.raw());
10836
11086
  if (!args.dryRun) {
10837
- requireWorkspaceActivation(await probeActiveWorkspaceKey(client3), context.workspaceKey);
11087
+ requireWorkspaceActivation(await probeActiveWorkspaceKey(client4), context.workspaceKey);
10838
11088
  }
10839
11089
  const miniPlans = [];
10840
11090
  for (const app of miniApps) {
10841
- miniPlans.push({ app, plan: await pushMiniAppProject({ http: client3.raw(), rootDir: app.dir, dryRun: true }) });
11091
+ miniPlans.push({ app, plan: await pushMiniAppProject({ http: client4.raw(), rootDir: app.dir, dryRun: true }) });
10842
11092
  }
10843
11093
  const rawResult = await pushWorkspaceRawFiles({
10844
- http: client3.raw(),
11094
+ http: client4.raw(),
10845
11095
  rootDir,
10846
11096
  context,
10847
11097
  dryRun: !!args.dryRun,
@@ -10854,7 +11104,7 @@ async function workspacePushCommand(args) {
10854
11104
  const results = [];
10855
11105
  for (const { app, plan } of miniPlans) {
10856
11106
  const result = args.dryRun ? plan : await pushMiniAppProject({
10857
- http: client3.raw(),
11107
+ http: client4.raw(),
10858
11108
  rootDir: app.dir,
10859
11109
  dryRun: false
10860
11110
  });
@@ -10863,7 +11113,7 @@ async function workspacePushCommand(args) {
10863
11113
  assertRunning();
10864
11114
  writeWorkspacePushResult(rawResult, results, args.output ?? "table");
10865
11115
  if (!args.dryRun) {
10866
- requireWorkspaceActivation(await probeActiveWorkspaceKey(client3), context.workspaceKey, true);
11116
+ requireWorkspaceActivation(await probeActiveWorkspaceKey(client4), context.workspaceKey, true);
10867
11117
  }
10868
11118
  const preflightBlocks = !!args.dryRun && !!rawResult.preflight && (rawResult.preflight.status === "failed" || rawResult.preflight.status === "unavailable");
10869
11119
  process.exitCode = rawResult.conflicts.length || preflightBlocks || results.some((item) => item.result.conflicts.length) ? 3 : 0;
@@ -10871,8 +11121,8 @@ async function workspacePushCommand(args) {
10871
11121
  return;
10872
11122
  } catch (e) {
10873
11123
  let failure2 = e;
10874
- if (e instanceof CliError26 && pushProgress && !e.context?.push) {
10875
- failure2 = new CliError26({
11124
+ if (e instanceof CliError27 && pushProgress && !e.context?.push) {
11125
+ failure2 = new CliError27({
10876
11126
  code: e.code,
10877
11127
  message: e.message,
10878
11128
  traceId: e.traceId,
@@ -10909,7 +11159,7 @@ async function workspacePreviewCommand(args) {
10909
11159
  );
10910
11160
  }
10911
11161
  if (args.output === "json" || args.output === "yaml") {
10912
- process.stdout.write(formatObject24(rows2, { format: args.output }) + "\n");
11162
+ process.stdout.write(formatObject25(rows2, { format: args.output }) + "\n");
10913
11163
  } else {
10914
11164
  process.stdout.write(formatRows6(rows2, { format: "table" }) + "\n");
10915
11165
  }
@@ -10929,8 +11179,8 @@ async function workspaceVerifyCommand(args) {
10929
11179
  ...args,
10930
11180
  env: args.env ?? args.profile ?? context.profile
10931
11181
  };
10932
- const client3 = await loadProfileClient(authArgs);
10933
- const smokeAccessToken = args.smoke ? await loadSmokeAccessToken(client3, authArgs) : null;
11182
+ const client4 = await loadProfileClient(authArgs);
11183
+ const smokeAccessToken = args.smoke ? await loadSmokeAccessToken(client4, authArgs) : null;
10934
11184
  const rawStatus = await getWorkspaceRawStatus(rootDir, context);
10935
11185
  const miniPlans = [];
10936
11186
  for (const app of miniApps) {
@@ -10939,11 +11189,11 @@ async function workspaceVerifyCommand(args) {
10939
11189
  let planSkipped;
10940
11190
  if (!validation.valid) {
10941
11191
  planSkipped = "validation failed";
10942
- } else if (!client3) {
11192
+ } else if (!client4) {
10943
11193
  planSkipped = "profile not configured";
10944
11194
  } else {
10945
11195
  try {
10946
- plan = await pushMiniAppProject({ http: client3.raw(), rootDir: app.dir, dryRun: true });
11196
+ plan = await pushMiniAppProject({ http: client4.raw(), rootDir: app.dir, dryRun: true });
10947
11197
  } catch (planErr) {
10948
11198
  planSkipped = planErr.message ?? "push dry-run failed";
10949
11199
  }
@@ -10955,12 +11205,12 @@ async function workspaceVerifyCommand(args) {
10955
11205
  );
10956
11206
  let rawPlan = null;
10957
11207
  let rawPlanSkipped;
10958
- if (!client3) {
11208
+ if (!client4) {
10959
11209
  rawPlanSkipped = "profile not configured";
10960
11210
  } else {
10961
11211
  try {
10962
11212
  rawPlan = await pushWorkspaceRawFiles({
10963
- http: client3.raw(),
11213
+ http: client4.raw(),
10964
11214
  rootDir,
10965
11215
  context,
10966
11216
  dryRun: true,
@@ -11057,8 +11307,8 @@ async function assertWorkspacePushRoot(rootDir) {
11057
11307
  }
11058
11308
  if (!insideMiniApp && (!workspaceRoot || workspaceRoot === realRoot)) return;
11059
11309
  const target = workspaceRoot ? quoteWorkspaceArg(workspaceRoot) : "<workspace-root>";
11060
- throw new CliError26({
11061
- code: CliErrorCode27.INVALID_ARGUMENT,
11310
+ throw new CliError27({
11311
+ code: CliErrorCode28.INVALID_ARGUMENT,
11062
11312
  message: `workspace push \u5FC5\u987B\u4ECE workspace \u6839\u76EE\u5F55\u6267\u884C\uFF0C\u5F53\u524D\u76EE\u5F55 ${rootDir} \u662F${insideMiniApp ? "\u8F7B\u5E94\u7528\u76EE\u5F55\u6216\u5176\u5B50\u76EE\u5F55" : "\u5DE5\u4F5C\u533A\u5B50\u76EE\u5F55"}\uFF1B\u7EE7\u7EED\u4F1A\u8DF3\u8FC7\u8F7B\u5E94\u7528\u90E8\u7F72\u3002`,
11063
11313
  context: {
11064
11314
  nextStep: `${workspaceRoot ? `workspace \u6839\u76EE\u5F55\uFF1A${workspaceRoot}\u3002` : `\u672A\u627E\u5230\u4E0A\u5C42 ${WORKSPACE_CONTEXT_FILE}\uFF1B\u8BF7\u5148\u5B9A\u4F4D\u5305\u542B mini_apps/ \u7684 workspace \u6839\u76EE\u5F55\u3002`}\u6267\u884C hcm workspace push --dir ${target}\uFF0C\u4FDD\u7559\u539F\u6709 --env/--as \u7B49\u9009\u9879\u3002`
@@ -11127,8 +11377,8 @@ async function readWorkspaceRawManifest(rootDir, context, forPull = false) {
11127
11377
  if (!forPull) {
11128
11378
  try {
11129
11379
  await fs9.access(path10.join(rootDir, WORKSPACE_STATE_DIR, WORKSPACE_PULL_INCOMPLETE_FILE));
11130
- throw new CliError26({
11131
- code: CliErrorCode27.BUSINESS_RULE_VIOLATION,
11380
+ throw new CliError27({
11381
+ code: CliErrorCode28.BUSINESS_RULE_VIOLATION,
11132
11382
  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",
11133
11383
  context: {
11134
11384
  reason: "WORKSPACE_PULL_INCOMPLETE",
@@ -11253,8 +11503,8 @@ async function pushWorkspaceRawFiles(args) {
11253
11503
  );
11254
11504
  if (args.dryRun) return result;
11255
11505
  if (result.preflight.status === "failed") {
11256
- throw new CliError26({
11257
- code: CliErrorCode27.INVALID_ARGUMENT,
11506
+ throw new CliError27({
11507
+ code: CliErrorCode28.INVALID_ARGUMENT,
11258
11508
  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
11259
11509
  ${formatPreflightIssues(result.preflight.issues, " ")}`,
11260
11510
  profile: args.profile ?? args.context.profile,
@@ -11339,29 +11589,29 @@ ${formatPreflightIssues(result.preflight.issues, " ")}`,
11339
11589
  checkpointSaved
11340
11590
  });
11341
11591
  } catch (error) {
11342
- const translated = error?.isAxiosError ? fromAxiosError23(error, args.profile ?? args.context.profile) : error;
11592
+ const translated = error?.isAxiosError ? fromAxiosError24(error, args.profile ?? args.context.profile) : error;
11343
11593
  const push = progress();
11344
11594
  args.onProgress?.(push);
11345
- throw new CliError26({
11346
- code: translated instanceof CliError26 ? translated.code : CliErrorCode27.INVALID_ARGUMENT,
11595
+ throw new CliError27({
11596
+ code: translated instanceof CliError27 ? translated.code : CliErrorCode28.INVALID_ARGUMENT,
11347
11597
  message: translated instanceof Error ? translated.message : String(translated),
11348
- traceId: translated instanceof CliError26 ? translated.traceId : void 0,
11349
- profile: translated instanceof CliError26 ? translated.profile : args.profile ?? args.context.profile,
11598
+ traceId: translated instanceof CliError27 ? translated.traceId : void 0,
11599
+ profile: translated instanceof CliError27 ? translated.profile : args.profile ?? args.context.profile,
11350
11600
  cause: error,
11351
11601
  context: {
11352
- ...translated instanceof CliError26 ? translated.context : {},
11602
+ ...translated instanceof CliError27 ? translated.context : {},
11353
11603
  workspaceKey: args.context.workspaceKey,
11354
11604
  push,
11355
11605
  details: {
11356
- serverDetails: translated instanceof CliError26 ? translated.context?.details : void 0,
11606
+ serverDetails: translated instanceof CliError27 ? translated.context?.details : void 0,
11357
11607
  push
11358
11608
  },
11359
11609
  note: [
11360
- translated instanceof CliError26 ? translated.context?.note : void 0,
11610
+ translated instanceof CliError27 ? translated.context?.note : void 0,
11361
11611
  "\u9010\u6587\u4EF6\u63A8\u9001\u53EF\u80FD\u5DF2\u90E8\u5206\u5199\u5165\uFF1Bcommitted \u662F\u5DF2\u6536\u5230\u6210\u529F\u56DE\u6267\u7684\u6587\u4EF6\uFF0CUNKNOWN \u4E0D\u80FD\u5F53\u4F5C\u672A\u5199\u5165\u3002"
11362
11612
  ].filter(Boolean).join(" "),
11363
11613
  nextStep: [
11364
- translated instanceof CliError26 ? translated.context?.nextStep : void 0,
11614
+ translated instanceof CliError27 ? translated.context?.nextStep : void 0,
11365
11615
  "\u5DF2\u786E\u8BA4\u6587\u4EF6\u7684\u8FDB\u5EA6\u9010\u9879\u4FDD\u5B58\uFF1B\u4FEE\u6B63\u5931\u8D25\u6587\u4EF6\u540E\u5148 push --dry-run \u68C0\u67E5\uFF0C\u518D\u666E\u901A push \u7EED\u8DD1\u3002\u5F53\u524D\u5931\u8D25\u9879 checkpointSaved=false \u6216\u63D0\u4EA4\u72B6\u6001 UNKNOWN \u65F6\u987B\u56DE\u8BFB\u6838\u5BF9\uFF1B\u82E5\u6709\u771F\u5B9E\u8FDC\u7AEF\u51B2\u7A81\uFF0C\u5148 pull \u5230\u65B0\u7684\u7A7A\u76EE\u5F55\u6838\u5BF9\u5E76\u5408\u5E76\uFF0C\u7981\u6B62\u5F3A\u5236\u8986\u76D6\u3002"
11366
11616
  ].filter(Boolean).join(" ")
11367
11617
  }
@@ -11412,7 +11662,7 @@ async function preflightWorkspacePlan(http, workspaceKey, operations, localFiles
11412
11662
  return { status: "passed", sent, checked: verdict.checked, issues: [] };
11413
11663
  } catch (error) {
11414
11664
  const status = error?.response?.status;
11415
- const translated = error?.isAxiosError ? fromAxiosError23(error, profile) : error;
11665
+ const translated = error?.isAxiosError ? fromAxiosError24(error, profile) : error;
11416
11666
  const detail = translated instanceof Error ? translated.message : String(translated);
11417
11667
  return {
11418
11668
  status: "unavailable",
@@ -11492,8 +11742,8 @@ function formatPreflightSummary(preflight, indent2 = "") {
11492
11742
  async function listWorkspaceFilesForSync(http, workspaceKey) {
11493
11743
  const list = await listWorkspaceFiles(http, workspaceKey, { pageSize: 5e3 });
11494
11744
  if (list.total !== list.data.length || new Set(list.data.map((file) => file.relativePath)).size !== list.data.length) {
11495
- throw new CliError26({
11496
- code: CliErrorCode27.NETWORK_ERROR,
11745
+ throw new CliError27({
11746
+ code: CliErrorCode28.NETWORK_ERROR,
11497
11747
  message: `\u5DE5\u4F5C\u533A\u8FDC\u7AEF\u6587\u4EF6\u6E05\u5355\u4E0D\u5B8C\u6574\uFF1A\u6536\u5230 ${list.data.length} \u6761\uFF0C\u603B\u6570 ${list.total}\uFF0C\u65E0\u6CD5\u5224\u5B9A\u6587\u4EF6\u662F\u5426\u7F3A\u5931\u3002`,
11498
11748
  context: {
11499
11749
  reason: "INCOMPLETE_WORKSPACE_FILE_LIST",
@@ -11509,8 +11759,8 @@ async function listWorkspaceFilesForSync(http, workspaceKey) {
11509
11759
  return true;
11510
11760
  }
11511
11761
  })) {
11512
- throw new CliError26({
11513
- code: CliErrorCode27.NETWORK_ERROR,
11762
+ throw new CliError27({
11763
+ code: CliErrorCode28.NETWORK_ERROR,
11514
11764
  message: "\u5DE5\u4F5C\u533A\u6587\u4EF6\u5217\u8868\u542B\u6709\u65E0\u6548\u7684 ID\u3001\u5DE5\u4F5C\u533A\u6216\u6587\u4EF6\u8DEF\u5F84\u3002",
11515
11765
  context: { reason: "INVALID_WORKSPACE_FILE_LIST", nextStep: "\u6838\u5BF9\u76EE\u6807\u5DE5\u4F5C\u533A\u6587\u4EF6\u5217\u8868\u540E\u91CD\u8BD5\uFF1B\u4E0D\u80FD\u7528\u65E0\u6548\u8BB0\u5F55\u5224\u65AD\u8FDC\u7AEF\u5B58\u5728\u6027\u3002" }
11516
11766
  });
@@ -11692,15 +11942,15 @@ async function readMiniStatusSafely(app) {
11692
11942
  async function loadProfileClient(args) {
11693
11943
  try {
11694
11944
  const ctx = await getActiveAuthContextFromCli(args);
11695
- return HcmClient23.fromAuthContext(ctx);
11945
+ return HcmClient24.fromAuthContext(ctx);
11696
11946
  } catch (e) {
11697
11947
  if (args.env || args.profile) throw e;
11698
11948
  return null;
11699
11949
  }
11700
11950
  }
11701
- async function loadSmokeAccessToken(client3, args) {
11951
+ async function loadSmokeAccessToken(client4, args) {
11702
11952
  try {
11703
- const smokeClient = client3 ?? await loadProfileClient(args);
11953
+ const smokeClient = client4 ?? await loadProfileClient(args);
11704
11954
  return smokeClient ? smokeClient.getAccessToken() : null;
11705
11955
  } catch {
11706
11956
  return null;
@@ -11859,7 +12109,7 @@ function optionalText(value) {
11859
12109
  }
11860
12110
  function writeWorkspaceListResult(rows2, format, total) {
11861
12111
  if (format !== "table") {
11862
- process.stdout.write(formatObject24({ rows: rows2, total }, { format }) + "\n");
12112
+ process.stdout.write(formatObject25({ rows: rows2, total }, { format }) + "\n");
11863
12113
  return;
11864
12114
  }
11865
12115
  process.stdout.write(formatRows6(toWorkspaceListRows(rows2), { format: "table" }) + "\n");
@@ -11870,7 +12120,7 @@ function writeWorkspaceListResult(rows2, format, total) {
11870
12120
  }
11871
12121
  function writeWorkspaceActiveResult(view, format) {
11872
12122
  if (format !== "table") {
11873
- process.stdout.write(formatObject24(view, { format }) + "\n");
12123
+ process.stdout.write(formatObject25(view, { format }) + "\n");
11874
12124
  return;
11875
12125
  }
11876
12126
  const rows2 = [
@@ -11895,7 +12145,7 @@ function writeWorkspaceActiveResult(view, format) {
11895
12145
  }
11896
12146
  function writeWorkspaceBindResult(context, rootDir, format) {
11897
12147
  if (format !== "table") {
11898
- process.stdout.write(formatObject24({ ...context, rootDir }, { format }) + "\n");
12148
+ process.stdout.write(formatObject25({ ...context, rootDir }, { format }) + "\n");
11899
12149
  return;
11900
12150
  }
11901
12151
  process.stdout.write(
@@ -11909,7 +12159,7 @@ function writeWorkspaceBindResult(context, rootDir, format) {
11909
12159
  }
11910
12160
  function writeWorkspaceCreateResult(result, format) {
11911
12161
  if (format !== "table") {
11912
- process.stdout.write(formatObject24(result, { format }) + "\n");
12162
+ process.stdout.write(formatObject25(result, { format }) + "\n");
11913
12163
  return;
11914
12164
  }
11915
12165
  process.stdout.write(
@@ -11925,7 +12175,7 @@ function writeWorkspaceCreateResult(result, format) {
11925
12175
  }
11926
12176
  function writeWorkspacePullResult(result, format) {
11927
12177
  if (format !== "table") {
11928
- process.stdout.write(formatObject24(result, { format }) + "\n");
12178
+ process.stdout.write(formatObject25(result, { format }) + "\n");
11929
12179
  return;
11930
12180
  }
11931
12181
  const lines = [
@@ -11945,7 +12195,7 @@ function writeWorkspacePullResult(result, format) {
11945
12195
  }
11946
12196
  function writeWorkspaceAddMiniResult(result, rootDir, format) {
11947
12197
  if (format !== "table") {
11948
- process.stdout.write(formatObject24({ ...result, workspaceRoot: rootDir }, { format }) + "\n");
12198
+ process.stdout.write(formatObject25({ ...result, workspaceRoot: rootDir }, { format }) + "\n");
11949
12199
  return;
11950
12200
  }
11951
12201
  process.stdout.write(
@@ -11961,7 +12211,7 @@ function writeWorkspaceAddMiniResult(result, rootDir, format) {
11961
12211
  function writeWorkspaceValidateResult(results, format) {
11962
12212
  if (format !== "table") {
11963
12213
  process.stdout.write(
11964
- formatObject24(
12214
+ formatObject25(
11965
12215
  results.map((item) => ({ artifact: item.artifact, ...item.result })),
11966
12216
  { format }
11967
12217
  ) + "\n"
@@ -11989,7 +12239,7 @@ ${item.artifact}
11989
12239
  function writeWorkspacePushResult(rawResult, results, format) {
11990
12240
  if (format !== "table") {
11991
12241
  process.stdout.write(
11992
- formatObject24(
12242
+ formatObject25(
11993
12243
  {
11994
12244
  // 预检覆盖整份计划(workspace 文件 + 轻应用文件),放在顶层。
11995
12245
  preflight: rawResult.preflight ?? null,
@@ -12054,7 +12304,7 @@ function writeWorkspaceVerifyResult(context, rootDir, raw, reports, format) {
12054
12304
  const preflight = raw.plan?.preflight ?? null;
12055
12305
  if (format === "json") {
12056
12306
  process.stdout.write(
12057
- formatObject24(
12307
+ formatObject25(
12058
12308
  {
12059
12309
  ok,
12060
12310
  workspaceKey: context.workspaceKey,
@@ -12082,7 +12332,7 @@ function writeWorkspaceVerifyResult(context, rootDir, raw, reports, format) {
12082
12332
  }
12083
12333
  if (format !== "table") {
12084
12334
  process.stdout.write(
12085
- formatObject24(
12335
+ formatObject25(
12086
12336
  {
12087
12337
  ok,
12088
12338
  workspaceKey: context.workspaceKey,
@@ -12138,14 +12388,14 @@ function quoteWorkspaceArg(value) {
12138
12388
  }
12139
12389
  function exitWorkspaceError(err, profile, operation) {
12140
12390
  const maybeAxios = err;
12141
- const translated = maybeAxios?.isAxiosError ? fromAxiosError23(err, profile) : err;
12142
- if (translated instanceof CliError26 && operation && translated.context?.status === 409 && ["WORKSPACE_REVISION_CONFLICT", "DEPLOY_IN_PROGRESS"].includes(String(translated.context.responseCode))) {
12391
+ const translated = maybeAxios?.isAxiosError ? fromAxiosError24(err, profile) : err;
12392
+ if (translated instanceof CliError27 && operation && translated.context?.status === 409 && ["WORKSPACE_REVISION_CONFLICT", "DEPLOY_IN_PROGRESS"].includes(String(translated.context.responseCode))) {
12143
12393
  const scope = `${profile ? ` --env ${quoteWorkspaceArg(profile)}` : ""}${operation.as ? ` --as ${quoteWorkspaceArg(operation.as)}` : ""}`;
12144
12394
  const active = "hcm workspace active" + scope + (operation.dir ? ` --dir ${quoteWorkspaceArg(operation.dir)}` : "");
12145
12395
  const deployment = translated.context.responseCode === "DEPLOY_IN_PROGRESS" ? `\u6709\u53D1\u5E03\u67E5\u8BE2\u6743\u9650\u65F6\uFF0C\u6267\u884C hcm query TenantExtensionRelease --fields id,workspaceKey,deploymentStatus --limit 20${scope} \u67E5\u770B\u53EF\u89C1\u90E8\u7F72\u8BB0\u5F55\uFF1B\u7A7A\u7ED3\u679C\u4E0D\u80FD\u8BC1\u660E\u9501\u5DF2\u91CA\u653E\u3002` : void 0;
12146
12396
  const rebase = translated.context.responseCode === "WORKSPACE_REVISION_CONFLICT" ? `\u82E5\u670D\u52A1\u7AEF\u8BE6\u60C5\u786E\u8BA4 workspace \u4E0E active \u7684\u4FEE\u8BA2\u51B2\u7A81\uFF0C\u6267\u884C hcm workspace rebase --workspace ${quoteWorkspaceArg(operation.workspaceKey)} --dry-run${scope}\uFF0C\u518D\u7528 --dry-run --plan '<\u65B0\u8BA1\u5212\u6587\u4EF6>' \u751F\u6210\u9010\u8DEF\u5F84\u89E3\u51B3\u8349\u6848\u3002pull \u53EA\u6062\u590D\u672C\u5730\u5FEB\u7167\uFF0C\u4E0D\u66F4\u65B0\u670D\u52A1\u7AEF baseline\uFF1B\u4E0D\u8981\u5220\u9664\u91CD\u5EFA\u6587\u4EF6\u6216\u6574\u4E2A\u5F00\u53D1\u7A7A\u95F4\u6765\u5237\u65B0\u57FA\u7EBF\u3002` : void 0;
12147
12397
  const retry = operation.command === "activate" ? `\u6309\u670D\u52A1\u7AEF\u8BE6\u60C5\u5B8C\u6210\u5904\u7406\u5E76\u786E\u8BA4\u76EE\u6807\u5DE5\u4F5C\u533A\u540E\uFF0C\u518D\u6267\u884C hcm workspace activate ${quoteWorkspaceArg(operation.workspaceKey)}${scope}\u3002` : `\u4FDD\u7559\u672C\u5730\u76EE\u5F55 ${operation.dir}\uFF1B\u6267\u884C hcm workspace pull --workspace ${quoteWorkspaceArg(operation.workspaceKey)} --dir '<\u65B0\u7684\u7A7A\u76EE\u5F55>'${scope}\uFF0C\u6BD4\u5BF9\u540E\u628A\u5F85\u4FDD\u7559\u4FEE\u6539\uFF08\u542B\u5220\u9664\u610F\u56FE\uFF09\u5408\u5E76\u5230\u65B0\u76EE\u5F55\uFF0C\u518D\u6267\u884C hcm workspace push --dir '<\u65B0\u7684\u7A7A\u76EE\u5F55>' --dry-run${scope}\uFF0C\u6838\u5BF9\u8BA1\u5212\u540E\u5728\u65B0\u76EE\u5F55\u53BB\u6389 --dry-run \u63A8\u9001\u3002\u539F\u76EE\u5F55\u4FDD\u7559\u5907\u4EFD\uFF0C\u4E0D\u8981\u8986\u76D6\u6216\u7EE7\u7EED\u4F7F\u7528\u65E7\u57FA\u7EBF\u63A8\u9001\u3002`;
12148
- exitWithError(new CliError26({
12398
+ exitWithError(new CliError27({
12149
12399
  code: translated.code,
12150
12400
  message: translated.message,
12151
12401
  traceId: translated.traceId,
@@ -12158,8 +12408,8 @@ function exitWorkspaceError(err, profile, operation) {
12158
12408
  }
12159
12409
  }));
12160
12410
  }
12161
- if (translated instanceof CliError26 && translated.code === CliErrorCode27.AUTH_FAILED) {
12162
- exitWithError(new CliError26({
12411
+ if (translated instanceof CliError27 && translated.code === CliErrorCode28.AUTH_FAILED) {
12412
+ exitWithError(new CliError27({
12163
12413
  code: translated.code,
12164
12414
  message: translated.message,
12165
12415
  traceId: translated.traceId,
@@ -12170,8 +12420,8 @@ function exitWorkspaceError(err, profile, operation) {
12170
12420
  }
12171
12421
  exitWithError(translated);
12172
12422
  }
12173
- async function readWorkspaceDevModeBinding(client3) {
12174
- const response = await client3.raw().get("/api/tenant-extension/dev-mode");
12423
+ async function readWorkspaceDevModeBinding(client4) {
12424
+ const response = await client4.raw().get("/api/tenant-extension/dev-mode");
12175
12425
  if (response.data?.success === false) {
12176
12426
  throw new Error("\u5F00\u53D1\u6001\u72B6\u6001\u67E5\u8BE2\u5931\u8D25\uFF0C\u4E0D\u80FD\u5224\u65AD\u662F\u5426\u5DF2\u6FC0\u6D3B\uFF1B\u8BF7\u68C0\u67E5 /api/tenant-extension/dev-mode \u54CD\u5E94\u3002");
12177
12427
  }
@@ -12181,20 +12431,20 @@ async function readWorkspaceDevModeBinding(client3) {
12181
12431
  }
12182
12432
  return binding;
12183
12433
  }
12184
- async function probeActiveWorkspaceKey(client3) {
12185
- const binding = await readWorkspaceDevModeBinding(client3);
12434
+ async function probeActiveWorkspaceKey(client4) {
12435
+ const binding = await readWorkspaceDevModeBinding(client4);
12186
12436
  return binding.enabled ? optionalText(binding.workspaceKey) : null;
12187
12437
  }
12188
12438
  function requireWorkspaceActivation(activeKey, workspaceKey, afterPush = false) {
12189
12439
  if (activeKey === workspaceKey) return;
12190
- throw new CliError26({
12191
- code: CliErrorCode27.INVALID_ARGUMENT,
12440
+ throw new CliError27({
12441
+ code: CliErrorCode28.INVALID_ARGUMENT,
12192
12442
  message: (afterPush ? "\u63A8\u9001\u540E\u7ED1\u5B9A\u5DF2\u53D8\u5316\uFF0C\u6587\u4EF6\u53EF\u80FD\u5DF2\u4FDD\u5B58\u4E3A\u8349\u7A3F\uFF1B" : "") + (activeKey ? `\u5F53\u524D\u8EAB\u4EFD\u6FC0\u6D3B\u7684\u662F "${activeKey}"\uFF0C\u4E0D\u662F\u672C\u7A7A\u95F4 "${workspaceKey}"\uFF1B\u672C\u7A7A\u95F4\u5185\u5BB9\u5C1A\u672A\u7528\u4E8E\u5F00\u53D1\u9884\u89C8\u3002` : `\u5F53\u524D\u8EAB\u4EFD\u672A\u6FC0\u6D3B\u5F00\u53D1\u7A7A\u95F4 "${workspaceKey}"\uFF1B\u672C\u7A7A\u95F4\u5185\u5BB9\u5C1A\u672A\u7528\u4E8E\u5F00\u53D1\u9884\u89C8\u3002`),
12193
12443
  context: { workspaceKey, activeWorkspaceKey: activeKey, nextStep: `hcm workspace activate ${workspaceKey}` }
12194
12444
  });
12195
12445
  }
12196
- async function setDevModeBinding(client3, workspaceKey) {
12197
- await client3.raw().put("/api/tenant-extension/dev-mode", {
12446
+ async function setDevModeBinding(client4, workspaceKey) {
12447
+ await client4.raw().put("/api/tenant-extension/dev-mode", {
12198
12448
  enabled: true,
12199
12449
  workspaceKey
12200
12450
  });
@@ -12209,8 +12459,8 @@ function unwrapWorkspaceActionPayload(response) {
12209
12459
  if (envelope.result && typeof envelope.result === "object") return envelope.result;
12210
12460
  return response;
12211
12461
  }
12212
- async function requestWorkspaceDeactivation(client3) {
12213
- const response = await client3.action(
12462
+ async function requestWorkspaceDeactivation(client4) {
12463
+ const response = await client4.action(
12214
12464
  "TenantExtensionWorkspace",
12215
12465
  "unbind-current-user",
12216
12466
  { method: "POST", scope: "class" }
@@ -12225,11 +12475,11 @@ async function workspaceActivateCommand(workspaceKey, args) {
12225
12475
  let recovery2;
12226
12476
  let profile = args.env ?? args.profile;
12227
12477
  try {
12228
- const client3 = HcmClient23.fromAuthContext(await getActiveAuthContextFromCli(args));
12229
- profile = client3.profile ?? profile;
12478
+ const client4 = HcmClient24.fromAuthContext(await getActiveAuthContextFromCli(args));
12479
+ profile = client4.profile ?? profile;
12230
12480
  const key2 = normalizeWorkspaceKey(workspaceKey);
12231
12481
  recovery2 = { command: "activate", workspaceKey: key2, as: args.as };
12232
- await setDevModeBinding(client3, key2);
12482
+ await setDevModeBinding(client4, key2);
12233
12483
  const fmt = args.output ?? "table";
12234
12484
  if (fmt === "table") {
12235
12485
  process.stdout.write(`workspace activated: ${key2}
@@ -12237,7 +12487,7 @@ async function workspaceActivateCommand(workspaceKey, args) {
12237
12487
  process.stdout.write("\u8BE5\u7A7A\u95F4\u7684 metas / scripts / menus / mini_apps \u73B0\u5DF2\u5728\u5F53\u524D\u79DF\u6237\u751F\u6548\u3002\n");
12238
12488
  } else {
12239
12489
  process.stdout.write(
12240
- formatObject24({ workspaceKey: key2, activated: true }, { format: fmt }) + "\n"
12490
+ formatObject25({ workspaceKey: key2, activated: true }, { format: fmt }) + "\n"
12241
12491
  );
12242
12492
  }
12243
12493
  process.exitCode = 0;
@@ -12248,15 +12498,15 @@ async function workspaceActivateCommand(workspaceKey, args) {
12248
12498
  }
12249
12499
  async function workspaceDeactivateCommand(args) {
12250
12500
  try {
12251
- const client3 = HcmClient23.fromAuthContext(await getActiveAuthContextFromCli(args));
12252
- const binding = await requestWorkspaceDeactivation(client3);
12501
+ const client4 = HcmClient24.fromAuthContext(await getActiveAuthContextFromCli(args));
12502
+ const binding = await requestWorkspaceDeactivation(client4);
12253
12503
  const result = { ...binding, deactivated: true };
12254
12504
  const fmt = args.output ?? "table";
12255
12505
  if (fmt === "table") {
12256
12506
  process.stdout.write("workspace deactivated\n");
12257
12507
  process.stdout.write("\u5F53\u524D\u8EAB\u4EFD\u5DF2\u9000\u51FA\u5F00\u53D1\u8005\u6A21\u5F0F\uFF1B\u5F00\u53D1\u7A7A\u95F4\u3001\u672C\u5730\u6587\u4EF6\u4E0E\u5DF2\u53D1\u5E03\u8D44\u4EA7\u5747\u672A\u5220\u9664\u3002\n");
12258
12508
  } else {
12259
- process.stdout.write(formatObject24(result, { format: fmt }) + "\n");
12509
+ process.stdout.write(formatObject25(result, { format: fmt }) + "\n");
12260
12510
  }
12261
12511
  process.exitCode = 0;
12262
12512
  return;
@@ -12270,11 +12520,11 @@ init_exit();
12270
12520
  import axios5 from "axios";
12271
12521
  import {
12272
12522
  AUTH_INFO_PATH,
12273
- CliError as CliError27,
12274
- CliErrorCode as CliErrorCode28,
12275
- formatObject as formatObject25,
12523
+ CliError as CliError28,
12524
+ CliErrorCode as CliErrorCode29,
12525
+ formatObject as formatObject26,
12276
12526
  formatRows as formatRows7,
12277
- fromAxiosError as fromAxiosError24,
12527
+ fromAxiosError as fromAxiosError25,
12278
12528
  loadEnv as loadEnv4,
12279
12529
  saveEnv as saveEnv3,
12280
12530
  loadIdentity as loadIdentity4,
@@ -12298,8 +12548,8 @@ async function inspectIdentity(name, fetcher = fetchAuthInfo) {
12298
12548
  const env2 = await loadEnv4(meta2.env);
12299
12549
  const accessToken = await TokenStore4.forIdentity(name).getStoredAccessToken();
12300
12550
  if (!accessToken) {
12301
- throw new CliError27({
12302
- code: CliErrorCode28.AUTH_FAILED,
12551
+ throw new CliError28({
12552
+ code: CliErrorCode29.AUTH_FAILED,
12303
12553
  message: `identity '${name}' \u6CA1\u6709\u53EF\u8BFB\u53D6\u7684\u6301\u4E45\u5316 token`,
12304
12554
  context: { nextStep: `\u91CD\u65B0\u767B\u5F55\u8BE5\u8EAB\u4EFD\uFF1Ahcm login --env ${meta2.env} --name ${name}` }
12305
12555
  });
@@ -12327,9 +12577,9 @@ async function inspectIdentity(name, fetcher = fetchAuthInfo) {
12327
12577
  async function identityShow(name, args) {
12328
12578
  try {
12329
12579
  const details = await inspectIdentity(name);
12330
- return exitOk(formatObject25(details, { format: args.output ?? "json" }));
12580
+ return exitOk(formatObject26(details, { format: args.output ?? "json" }));
12331
12581
  } catch (e) {
12332
- exitWithError(axios5.isAxiosError(e) ? fromAxiosError24(e, name) : e);
12582
+ exitWithError(axios5.isAxiosError(e) ? fromAxiosError25(e, name) : e);
12333
12583
  }
12334
12584
  }
12335
12585
  async function identityList(args) {
@@ -12339,7 +12589,7 @@ async function identityList(args) {
12339
12589
  const names = await listIdentities4(filter);
12340
12590
  const fmt = args.output ?? "table";
12341
12591
  if (names.length === 0) {
12342
- return exitOk(fmt === "table" ? "(no identities)" : formatObject25([], { format: fmt }));
12592
+ return exitOk(fmt === "table" ? "(no identities)" : formatObject26([], { format: fmt }));
12343
12593
  }
12344
12594
  const rows2 = [];
12345
12595
  for (const n of names) {
@@ -12353,7 +12603,7 @@ async function identityList(args) {
12353
12603
  isDefault: env2?.defaultIdentity === n
12354
12604
  });
12355
12605
  }
12356
- return exitOk(fmt === "table" ? formatRows7(rows2, { format: fmt }) : formatObject25(rows2, { format: fmt }));
12606
+ return exitOk(fmt === "table" ? formatRows7(rows2, { format: fmt }) : formatObject26(rows2, { format: fmt }));
12357
12607
  } catch (e) {
12358
12608
  exitWithError(e);
12359
12609
  }
@@ -12362,8 +12612,8 @@ async function identityUse(name) {
12362
12612
  try {
12363
12613
  const meta2 = await loadIdentity4(name);
12364
12614
  const env2 = await loadEnv4(meta2.env).catch(() => {
12365
- throw new CliError27({
12366
- code: CliErrorCode28.IDENTITY_NOT_IN_ENV,
12615
+ throw new CliError28({
12616
+ code: CliErrorCode29.IDENTITY_NOT_IN_ENV,
12367
12617
  message: `identity '${name}' references env '${meta2.env}' which no longer exists. Re-create the env, or remove this orphan: hcm identity remove ${name}`
12368
12618
  });
12369
12619
  });
@@ -12403,11 +12653,11 @@ init_exit();
12403
12653
  import { promises as fs10 } from "fs";
12404
12654
  import path11 from "path";
12405
12655
  import {
12406
- CliError as CliError28,
12407
- CliErrorCode as CliErrorCode29,
12408
- HcmClient as HcmClient24,
12656
+ CliError as CliError29,
12657
+ CliErrorCode as CliErrorCode30,
12658
+ HcmClient as HcmClient25,
12409
12659
  fetchReconIdentity,
12410
- formatObject as formatObject26,
12660
+ formatObject as formatObject27,
12411
12661
  httpProbe,
12412
12662
  isTempEnv as isTempEnv3,
12413
12663
  assertNotReservedEnvName as assertNotReservedEnvName2,
@@ -12420,8 +12670,8 @@ import {
12420
12670
  } from "@hcmai/sdk";
12421
12671
  async function probeTokenTenant(envName, requested) {
12422
12672
  const ctx = await getActiveAuthContextFromCli({ env: envName });
12423
- const client3 = HcmClient24.fromAuthContext(ctx);
12424
- const identity3 = await fetchReconIdentity(httpProbe(client3.raw(), "default"), requested);
12673
+ const client4 = HcmClient25.fromAuthContext(ctx);
12674
+ const identity3 = await fetchReconIdentity(httpProbe(client4.raw(), "default"), requested);
12425
12675
  return identity3?.tenantId ? String(identity3.tenantId) : void 0;
12426
12676
  }
12427
12677
  async function syncSkillsForInit(root, envName, sync2 = skillsSyncCommand) {
@@ -12465,8 +12715,8 @@ async function resolveInitEnv(root, args, deps) {
12465
12715
  if (existing && path11.dirname(existing.path) === path11.resolve(root)) {
12466
12716
  const name2 = args.env ?? existing.config.default;
12467
12717
  const env2 = existing.config.environments[name2];
12468
- if (!env2) throw new CliError28({
12469
- code: CliErrorCode29.INVALID_ARGUMENT,
12718
+ if (!env2) throw new CliError29({
12719
+ code: CliErrorCode30.INVALID_ARGUMENT,
12470
12720
  message: `${existing.path} \u91CC\u6CA1\u6709\u73AF\u5883 '${name2}'\uFF0C\u53EA\u6709\uFF1A${Object.keys(existing.config.environments).join("\u3001")}`,
12471
12721
  // env add 的 endpoint / frontend / tenant 都是必填,少一个照抄就是 required option 报错。
12472
12722
  context: { nextStep: `hcm chiron env add ${name2} --endpoint <\u540E\u7AEF\u5730\u5740> --frontend <\u524D\u7AEF\u5730\u5740> --tenant <\u79DF\u6237\u53F7>` }
@@ -12476,8 +12726,8 @@ async function resolveInitEnv(root, args, deps) {
12476
12726
  }
12477
12727
  if (args.env) {
12478
12728
  const config3 = await loadEnv5(args.env).catch(() => null);
12479
- if (!config3?.endpoint) throw new CliError28({
12480
- code: CliErrorCode29.ENV_NOT_FOUND,
12729
+ if (!config3?.endpoint) throw new CliError29({
12730
+ code: CliErrorCode30.ENV_NOT_FOUND,
12481
12731
  message: `\u672C\u673A\u6CA1\u6709\u540D\u53EB '${args.env}' \u7684\u73AF\u5883\u3002`,
12482
12732
  context: { nextStep: "`hcm env list` \u770B\u6709\u54EA\u4E9B\uFF1B\u6216\u5B8C\u5168\u663E\u5F0F\u5730\u5EFA\uFF1A`hcm chiron init --endpoint <\u540E\u7AEF\u5730\u5740> --tenant <\u79DF\u6237\u53F7>`" }
12483
12733
  });
@@ -12487,14 +12737,14 @@ async function resolveInitEnv(root, args, deps) {
12487
12737
  const name = g.activeEnv;
12488
12738
  const config2 = name ? await loadEnv5(name).catch(() => null) : null;
12489
12739
  const explicitPaths = " hcm chiron init --env <\u672C\u673A\u73AF\u5883\u540D>\uFF08hcm env list \u770B\u6709\u54EA\u4E9B\uFF09\n hcm chiron init --endpoint <\u540E\u7AEF\u5730\u5740> --tenant <\u79DF\u6237\u53F7>\uFF08\u5B8C\u5168\u663E\u5F0F\uFF0C\u4E0D\u9700\u8981\u5148\u767B\u5F55\uFF09";
12490
- if (!config2?.endpoint) throw new CliError28({
12491
- code: CliErrorCode29.ENV_NOT_FOUND,
12740
+ if (!config2?.endpoint) throw new CliError29({
12741
+ code: CliErrorCode30.ENV_NOT_FOUND,
12492
12742
  message: "\u6CA1\u8BF4\u8FD9\u4E2A\u9879\u76EE\u5BF9\u7740\u54EA\u4E2A\u73AF\u5883\uFF0C\u672C\u673A\u4E5F\u6CA1\u6709\u53EF\u7528\u7684\u6D3B\u52A8\u73AF\u5883\u3002",
12493
12743
  context: { nextStep: `\u4E8C\u9009\u4E00\uFF1A
12494
12744
  ${explicitPaths}` }
12495
12745
  });
12496
- if (isTempEnv3(name)) throw new CliError28({
12497
- code: CliErrorCode29.INVALID_ARGUMENT,
12746
+ if (isTempEnv3(name)) throw new CliError29({
12747
+ code: CliErrorCode30.INVALID_ARGUMENT,
12498
12748
  message: `\u672C\u673A\u6D3B\u52A8\u73AF\u5883\u662F\u4E34\u65F6\u7684\uFF08${config2.endpoint}\uFF09\uFF0C\u8FD8\u6CA1\u6709\u540D\u5B57\u3002\u9879\u76EE\u8981\u7ED1\u4E00\u4E2A\u7A33\u5B9A\u7684\u73AF\u5883\uFF0C\u5426\u5219\u4E0B\u4E00\u6B21 hcm login --code \u8986\u76D6\u5B83\u4E4B\u540E\uFF0C\u4ED3\u91CC\u8BB0\u7684\u5C31\u5BF9\u4E0D\u4E0A\u4E86\u3002`,
12499
12749
  context: { nextStep: `\u5148\u7ED9\u5B83\u8D77\u4E2A\u540D\u5B57\uFF1Ahcm env save <name>\uFF1B\u6216\u76F4\u63A5\u663E\u5F0F\u5EFA\uFF1A
12500
12750
  ${explicitPaths}` }
@@ -12502,8 +12752,8 @@ ${explicitPaths}` }
12502
12752
  const summary = `${name} \xB7 ${config2.endpoint} \xB7 \u79DF\u6237 ${config2.tenantId ?? "1"}`;
12503
12753
  if (!args.yes) {
12504
12754
  const ok = deps.isTty() && deps.confirm ? await deps.confirm(`\u6CA1\u6307\u5B9A\u73AF\u5883\uFF0C\u7528\u672C\u673A\u5F53\u524D\u6D3B\u52A8\u7684 ${summary} \u5417\uFF1F[y/N] `) : false;
12505
- if (!ok) throw new CliError28({
12506
- code: CliErrorCode29.INVALID_ARGUMENT,
12755
+ if (!ok) throw new CliError29({
12756
+ code: CliErrorCode30.INVALID_ARGUMENT,
12507
12757
  message: `\u6CA1\u786E\u8BA4\u8981\u7528\u672C\u673A\u6D3B\u52A8\u73AF\u5883\uFF08${summary}\uFF09\u3002\u9879\u76EE\u73AF\u5883\u4F1A\u63D0\u4EA4\u8FDB\u4ED3\u3001\u5F71\u54CD\u6240\u6709\u534F\u4F5C\u8005\uFF0C\u4E0D\u9760\u4E0A\u4E00\u6761\u547D\u4EE4\u7684\u526F\u4F5C\u7528\u51B3\u5B9A\u3002`,
12508
12758
  context: { nextStep: `\u786E\u8BA4\u5C31\u52A0 --yes\uFF1B\u6216\u660E\u8BF4\uFF1A
12509
12759
  ${explicitPaths}` }
@@ -12519,24 +12769,24 @@ async function scaffoldChironProject(root, env2, envName) {
12519
12769
  const document2 = parseEnvYaml(existing);
12520
12770
  const recorded = Object.values(document2.environments).find((candidate) => candidate.endpoint === env2.endpoint && candidate.tenant === env2.tenant) ?? document2.environments[document2.default];
12521
12771
  if (recorded.endpoint !== env2.endpoint) {
12522
- throw new CliError28({
12523
- code: CliErrorCode29.INVALID_ARGUMENT,
12772
+ throw new CliError29({
12773
+ code: CliErrorCode30.INVALID_ARGUMENT,
12524
12774
  message: `${ENV_FILE} \u6307\u5411 ${recorded.endpoint}\uFF0C\u800C\u4F60\u5F53\u524D\u767B\u5F55\u7684\u662F ${env2.endpoint}\uFF08env '${envName}'\uFF09\u3002
12525
12775
  \u8981\u7528\u8FD9\u4E2A\u9879\u76EE\u7684\u73AF\u5883\uFF1Ahcm login ${recorded.endpoint} --code <\u914D\u5BF9\u7801>\uFF0C\u518D\u91CD\u8DD1 hcm chiron init
12526
12776
  \u8981\u628A\u9879\u76EE\u6539\u5230\u4F60\u767B\u5F55\u7684\u73AF\u5883\uFF1A\u5220\u6389 ${ENV_FILE} \u540E\u91CD\u8DD1\uFF08\u8FD9\u4F1A\u5F71\u54CD\u6240\u6709\u534F\u4F5C\u8005\uFF0C\u5148\u8DDF\u8D1F\u8D23\u4EBA\u786E\u8BA4\uFF09`
12527
12777
  });
12528
12778
  }
12529
12779
  if (recorded.tenant !== env2.tenant) {
12530
- throw new CliError28({
12531
- code: CliErrorCode29.INVALID_ARGUMENT,
12780
+ throw new CliError29({
12781
+ code: CliErrorCode30.INVALID_ARGUMENT,
12532
12782
  message: `${ENV_FILE} \u662F\u79DF\u6237 ${recorded.tenant}\uFF0C\u800C\u4F60\u767B\u5F55\u7684\u8EAB\u4EFD\u5C5E\u4E8E\u79DF\u6237 ${env2.tenant}\u3002
12533
12783
  \u7528\u9879\u76EE\u79DF\u6237\u7684\u914D\u5BF9\u7801\u91CD\u65B0\u767B\u5F55\uFF1Ahcm login ${env2.endpoint} --code <\u914D\u5BF9\u7801>\uFF0C\u518D\u91CD\u8DD1 hcm chiron init`
12534
12784
  });
12535
12785
  }
12536
12786
  result.preserved.push(ENV_FILE);
12537
12787
  } else {
12538
- if (!envName.trim() || envName.trim() !== envName) throw new CliError28({
12539
- code: CliErrorCode29.INVALID_ARGUMENT,
12788
+ if (!envName.trim() || envName.trim() !== envName) throw new CliError29({
12789
+ code: CliErrorCode30.INVALID_ARGUMENT,
12540
12790
  message: `\u73AF\u5883\u540D '${envName}' \u4E0D\u80FD\u5199\u5165 ${ENV_FILE}\uFF1A\u73AF\u5883\u540D\u5FC5\u987B\u975E\u7A7A\u4E14\u4E0D\u80FD\u542B\u9996\u5C3E\u7A7A\u767D\u3002`,
12541
12791
  context: { nextStep: "\u6362\u4E00\u4E2A\u6CA1\u6709\u9996\u5C3E\u7A7A\u767D\u7684\u73AF\u5883\u540D\uFF0C\u518D\u8FD0\u884C hcm chiron init --env <\u73AF\u5883\u540D>\uFF08\u6216 hcm chiron init --endpoint <\u540E\u7AEF\u5730\u5740> --env <\u73AF\u5883\u540D>\uFF09" }
12542
12792
  });
@@ -12549,8 +12799,8 @@ async function scaffoldChironProject(root, env2, envName) {
12549
12799
  try {
12550
12800
  const written = parseEnvYaml(await fs10.readFile(envFile, "utf8"));
12551
12801
  if (written.default !== envName || Object.keys(written.environments).length !== 1 || !Object.hasOwn(written.environments, envName)) {
12552
- throw new CliError28({
12553
- code: CliErrorCode29.CONFIG_PARSE_ERROR,
12802
+ throw new CliError29({
12803
+ code: CliErrorCode30.CONFIG_PARSE_ERROR,
12554
12804
  message: `${ENV_FILE} \u5199\u5165\u540E\u73AF\u5883\u540D\u4E0E\u56DE\u6267 '${envName}' \u4E0D\u4E00\u81F4\u3002`,
12555
12805
  context: { nextStep: `\u6838\u5BF9 ${ENV_FILE} \u7684 default \u4E0E environments \u952E\uFF0C\u518D\u91CD\u8DD1 hcm chiron init` }
12556
12806
  });
@@ -12628,7 +12878,7 @@ async function chironInitCommand(args, deps) {
12628
12878
  const result = await runChironInit(args, deps);
12629
12879
  const fmt = args.output ?? "table";
12630
12880
  if (fmt === "json" || fmt === "yaml") {
12631
- process.stdout.write(formatObject26(result, { format: fmt }) + "\n");
12881
+ process.stdout.write(formatObject27(result, { format: fmt }) + "\n");
12632
12882
  } else {
12633
12883
  const mark = { verified: "\u2705", mismatch: "\u274C", unreachable: "\u26A0\uFE0F", skipped: "\xB7" }[result.tenantCheck.status];
12634
12884
  process.stdout.write(
@@ -12650,9 +12900,9 @@ async function chironInitCommand(args, deps) {
12650
12900
  // src/commands/gap.ts
12651
12901
  import { readFileSync as readFileSync6 } from "fs";
12652
12902
  import {
12653
- CliErrorCode as CliErrorCode32,
12903
+ CliErrorCode as CliErrorCode33,
12654
12904
  createHttpClient as createHttpClient4,
12655
- formatObject as formatObject27,
12905
+ formatObject as formatObject28,
12656
12906
  loadGlobalConfig as loadGlobalConfig10,
12657
12907
  resolveEnvContext as resolveEnvContext7,
12658
12908
  printResolvedEnvironment as printResolvedEnvironment7,
@@ -12662,14 +12912,14 @@ init_exit();
12662
12912
  import { createJiraClient } from "@hcmai/sdk";
12663
12913
 
12664
12914
  // src/jira/gaps.ts
12665
- import { CASES_REPO_SLUG as CASES_REPO_SLUG3, CliError as CliError30, CliErrorCode as CliErrorCode31, describeNonBmpHits, findNonBmpChars, firstLine as firstLine3, repoIssueUrl } from "@hcmai/sdk";
12915
+ import { CASES_REPO_SLUG as CASES_REPO_SLUG3, CliError as CliError31, CliErrorCode as CliErrorCode32, describeNonBmpHits, findNonBmpChars, firstLine as firstLine3, repoIssueUrl } from "@hcmai/sdk";
12666
12916
  import { linkedRepoRefs, parseRef as parseRef2 } from "@hcmai/sdk";
12667
12917
 
12668
12918
  // src/jira/gap-verify.ts
12669
12919
  import {
12670
12920
  CASES_REPO_SLUG as CASES_REPO_SLUG2,
12671
- CliError as CliError29,
12672
- CliErrorCode as CliErrorCode30,
12921
+ CliError as CliError30,
12922
+ CliErrorCode as CliErrorCode31,
12673
12923
  JiraHttpError,
12674
12924
  JiraNonBmpContentError,
12675
12925
  NON_BMP_RULE_NOTE,
@@ -12704,14 +12954,14 @@ var VERIFY_PLAN = {
12704
12954
  function parseVerifyResult(raw) {
12705
12955
  const v = String(raw ?? "").trim().toLowerCase();
12706
12956
  if (VERIFY_RESULTS.includes(v)) return v;
12707
- throw new CliError29({
12708
- code: raw === void 0 ? CliErrorCode30.MISSING_FLAG : CliErrorCode30.INVALID_ARGUMENT,
12957
+ throw new CliError30({
12958
+ code: raw === void 0 ? CliErrorCode31.MISSING_FLAG : CliErrorCode31.INVALID_ARGUMENT,
12709
12959
  message: `--result \u53EA\u80FD\u662F pass / fail / partial\uFF0C\u7ED9\u7684\u662F\u300C${raw ?? "\uFF08\u6CA1\u7ED9\uFF09"}\u300D`,
12710
12960
  context: { nextStep: "pass = \u539F\u6545\u969C\u5728\u76EE\u6807\u73AF\u5883\u4E0D\u518D\u51FA\u73B0\uFF1Bfail = \u4ECD\u7136\u590D\u73B0\u6216\u9A8C\u51FA\u6CA1\u901A\u8FC7\u7684\uFF1Bpartial = \u53EA\u9A8C\u4E86\u4E00\u90E8\u5206\u3001\u9A8C\u8FC7\u7684\u90FD\u901A\u8FC7\uFF08\u4E0D\u5173\u5355\uFF09\u3002" }
12711
12961
  });
12712
12962
  }
12713
12963
  function verifyFailure(reasonCode, code2, written, message, nextStep, extra = {}, cause) {
12714
- return new CliError29({ code: code2, message: `${message}${WRITTEN_TAG[written]}`, context: { reasonCode, written, nextStep, ...extra }, cause });
12964
+ return new CliError30({ code: code2, message: `${message}${WRITTEN_TAG[written]}`, context: { reasonCode, written, nextStep, ...extra }, cause });
12715
12965
  }
12716
12966
  function who(u) {
12717
12967
  if (!u) return "\uFF08\u5355\u4E0A\u6CA1\u6709\uFF09";
@@ -12801,7 +13051,7 @@ function writeFailure(e, key2, what) {
12801
13051
  if (e instanceof JiraNonBmpContentError) {
12802
13052
  return verifyFailure(
12803
13053
  "non-bmp-content",
12804
- CliErrorCode30.INVALID_ARGUMENT,
13054
+ CliErrorCode31.INVALID_ARGUMENT,
12805
13055
  "no",
12806
13056
  `\u8FD9\u6B21${what}\u4E00\u4E2A\u5B57\u90FD\u6CA1\u53D1\u51FA\u53BB\uFF1A\u6B63\u6587\u91CC\u6709 ${e.hits.length} \u5904 Jira \u5B58\u4E0D\u4E0B\u7684\u5B57\u7B26`,
12807
13057
  // 🔴 清单落 nextStep,不落 cause:CliError 渲染 cause 时 formatCause 截到 300 字,
@@ -12812,7 +13062,7 @@ ${nonBmpHitLines(e.hits)}`,
12812
13062
  );
12813
13063
  }
12814
13064
  if (e instanceof JiraHttpError && e.status >= 400 && e.status < 500) {
12815
- return verifyFailure("write-rejected", CliErrorCode30.BUSINESS_RULE_VIOLATION, "no", `Jira \u4EE5 ${e.status} \u62D2\u7EDD\u4E86\u8FD9\u6B21${what}`, rejectNextStep(e.status, key2), {
13065
+ return verifyFailure("write-rejected", CliErrorCode31.BUSINESS_RULE_VIOLATION, "no", `Jira \u4EE5 ${e.status} \u62D2\u7EDD\u4E86\u8FD9\u6B21${what}`, rejectNextStep(e.status, key2), {
12816
13066
  key: key2,
12817
13067
  status: e.status,
12818
13068
  details: e.message
@@ -12820,7 +13070,7 @@ ${nonBmpHitLines(e.hits)}`,
12820
13070
  }
12821
13071
  return verifyFailure(
12822
13072
  "write-unconfirmed",
12823
- CliErrorCode30.NETWORK_ERROR,
13073
+ CliErrorCode31.NETWORK_ERROR,
12824
13074
  "unknown",
12825
13075
  `${what}\u8BF7\u6C42\u6CA1\u5F97\u5230\u786E\u8BA4\uFF08${unconfirmedWhy(e)}\uFF09`,
12826
13076
  `\u5148\u7528 \`hcm chiron gap status ${key2}\` \u4E0E \`hcm chiron gap comments ${key2}\` \u6838\u5BF9\u5199\u8FDB\u53BB\u6CA1\u6709\uFF0C\u518D\u51B3\u5B9A\u8981\u4E0D\u8981\u91CD\u8DD1\u2014\u2014partial \u91CD\u8DD1\u4F1A\u591A\u4E00\u6761\u8BC4\u8BBA\u3002`,
@@ -12828,57 +13078,57 @@ ${nonBmpHitLines(e.hits)}`,
12828
13078
  e
12829
13079
  );
12830
13080
  }
12831
- async function claimTransitionComment(client3, key2, me, header, body, beforeIds) {
13081
+ async function claimTransitionComment(client4, key2, me, header, body, beforeIds) {
12832
13082
  try {
12833
- const hit = (await client3.comments(key2)).filter((c2) => !beforeIds.has(c2.id) && sameUser(c2.author, me) && firstLine2(c2.body ?? "") === header).at(-1);
12834
- return hit?.id ? { body, found: true, id: hit.id, url: client3.commentUrl(key2, hit.id) } : { body, found: false, note: `\u6D41\u8F6C\u5DF2\u63D0\u4EA4\uFF0C\u4F46\u56DE\u8BFB\u8BC4\u8BBA\u6CA1\u8BA4\u9886\u5230\u8FD9\u4E00\u6761\uFF08\u63A5\u53E3\u4E0D\u56DE\u8BC4\u8BBA id\uFF09\uFF1B\u4EE5 \`hcm chiron gap comments ${key2}\` \u4E3A\u51C6\u3002` };
13083
+ const hit = (await client4.comments(key2)).filter((c2) => !beforeIds.has(c2.id) && sameUser(c2.author, me) && firstLine2(c2.body ?? "") === header).at(-1);
13084
+ return hit?.id ? { body, found: true, id: hit.id, url: client4.commentUrl(key2, hit.id) } : { body, found: false, note: `\u6D41\u8F6C\u5DF2\u63D0\u4EA4\uFF0C\u4F46\u56DE\u8BFB\u8BC4\u8BBA\u6CA1\u8BA4\u9886\u5230\u8FD9\u4E00\u6761\uFF08\u63A5\u53E3\u4E0D\u56DE\u8BC4\u8BBA id\uFF09\uFF1B\u4EE5 \`hcm chiron gap comments ${key2}\` \u4E3A\u51C6\u3002` };
12835
13085
  } catch (e) {
12836
13086
  const why = e instanceof Error ? e.message.split("\n")[0] : String(e);
12837
13087
  return { body, found: false, note: `\u6D41\u8F6C\u5DF2\u63D0\u4EA4\uFF0C\u4F46\u56DE\u8BFB\u8BC4\u8BBA\u5931\u8D25\uFF08${why}\uFF09\uFF1B\u4EE5 \`hcm chiron gap comments ${key2}\` \u4E3A\u51C6\u3002` };
12838
13088
  }
12839
13089
  }
12840
13090
  var snapshotOf = (i) => ({ status: i.fields.status?.name, resolution: i.fields.resolution?.name ?? null });
12841
- async function gapVerify({ client: client3 }, ref, o, casesSlug = CASES_REPO_SLUG2) {
12842
- const parsed = parseRef(ref, client3.project, casesSlug);
13091
+ async function gapVerify({ client: client4 }, ref, o, casesSlug = CASES_REPO_SLUG2) {
13092
+ const parsed = parseRef(ref, client4.project, casesSlug);
12843
13093
  if (!parsed || parsed.kind !== "jira") {
12844
13094
  throw verifyFailure(
12845
13095
  "not-jira-key",
12846
- CliErrorCode30.INVALID_ARGUMENT,
13096
+ CliErrorCode31.INVALID_ARGUMENT,
12847
13097
  "no",
12848
13098
  parsed && parsed.kind === "repo" ? `${parsed.repo}#${parsed.number} \u662F\u4EA7\u54C1\u4ED3\u7F16\u53F7\uFF0C\u9A8C\u6536\u8981\u843D\u5728 Jira \u5355\u4E0A` : `\u770B\u4E0D\u61C2 ${ref}`,
12849
13099
  "\u7ED9 Jira \u5355\u53F7\uFF08HCMNX-12 \u6216\u88F8\u6570\u5B57 12\uFF09\u2014\u2014\u5C31\u662F `hcm chiron gap submit` \u56DE\u6267\u91CC\u7684\u90A3\u4E2A\u7F16\u53F7\u3002"
12850
13100
  );
12851
13101
  }
12852
13102
  const key2 = parsed.key;
12853
- const inProject = (k) => k.startsWith(`${client3.project}-`);
13103
+ const inProject = (k) => k.startsWith(`${client4.project}-`);
12854
13104
  const wrongProject = (k) => verifyFailure(
12855
13105
  "wrong-project",
12856
- CliErrorCode30.INVALID_ARGUMENT,
13106
+ CliErrorCode31.INVALID_ARGUMENT,
12857
13107
  "no",
12858
- `${k} \u4E0D\u5728 ${client3.project} \u9879\u76EE\u91CC\uFF0C\u9A8C\u6536\u53EA\u5199 ${client3.project} \u7684\u5355`,
12859
- `\u7ED9 ${client3.project} \u7684\u5355\u53F7\uFF08\`hcm chiron gap submit\` \u56DE\u6267\u91CC\u7684\u90A3\u4E2A\uFF09\u3002\u522B\u7684\u9879\u76EE\u7684\u5355\u8FD9\u6761\u547D\u4EE4\u4E0D\u78B0\u2014\u2014\u90A3\u91CC\u7684\u72B6\u6001\u540D\u4E0E\u6D41\u8F6C\u540D\u548C ${client3.project} \u540C\u5F62\uFF0C\u5199\u9519\u4E86\u4F1A\u628A\u522B\u5904\u7684\u5355\u5173\u6389\u3002`,
12860
- { key: k, project: client3.project }
13108
+ `${k} \u4E0D\u5728 ${client4.project} \u9879\u76EE\u91CC\uFF0C\u9A8C\u6536\u53EA\u5199 ${client4.project} \u7684\u5355`,
13109
+ `\u7ED9 ${client4.project} \u7684\u5355\u53F7\uFF08\`hcm chiron gap submit\` \u56DE\u6267\u91CC\u7684\u90A3\u4E2A\uFF09\u3002\u522B\u7684\u9879\u76EE\u7684\u5355\u8FD9\u6761\u547D\u4EE4\u4E0D\u78B0\u2014\u2014\u90A3\u91CC\u7684\u72B6\u6001\u540D\u4E0E\u6D41\u8F6C\u540D\u548C ${client4.project} \u540C\u5F62\uFF0C\u5199\u9519\u4E86\u4F1A\u628A\u522B\u5904\u7684\u5355\u5173\u6389\u3002`,
13110
+ { key: k, project: client4.project }
12861
13111
  );
12862
13112
  if (!inProject(key2)) throw wrongProject(key2);
12863
13113
  const evidence = o.evidence.trim();
12864
13114
  if (evidence.length < EVIDENCE_MIN) {
12865
13115
  throw verifyFailure(
12866
13116
  "evidence-too-short",
12867
- CliErrorCode30.INVALID_ARGUMENT,
13117
+ CliErrorCode31.INVALID_ARGUMENT,
12868
13118
  "no",
12869
13119
  `\u9A8C\u6536\u8BC1\u636E\u81F3\u5C11 ${EVIDENCE_MIN} \u4E2A\u5B57\uFF0C\u7ED9\u7684\u662F ${evidence.length} \u4E2A\u5B57`,
12870
13120
  "\u5199\u6E05\uFF1A\u54EA\u4E2A\u73AF\u5883\u3001\u54EA\u4E2A\u7248\u672C\uFF08`hcm version`\uFF09\u3001\u6309\u6280\u80FD\u8DD1\u4E86\u4EC0\u4E48\u3001\u770B\u5230\u4E86\u4EC0\u4E48\uFF1B\u8BC1\u636E\u6587\u4EF6\u653E\u5728 evidence/ \u4E0B\u5E76\u5199\u4E0A\u8DEF\u5F84\u3002",
12871
13121
  { key: key2 }
12872
13122
  );
12873
13123
  }
12874
- const [issue, me] = await Promise.all([client3.issue(key2), client3.myself()]);
13124
+ const [issue, me] = await Promise.all([client4.issue(key2), client4.myself()]);
12875
13125
  if (!inProject(issue.key)) throw wrongProject(issue.key);
12876
13126
  const before = snapshotOf(issue);
12877
13127
  const status = before.status;
12878
13128
  const reporter = issue.fields.reporter;
12879
13129
  const base = {
12880
13130
  key: key2,
12881
- url: client3.browseUrl(key2),
13131
+ url: client4.browseUrl(key2),
12882
13132
  summary: issue.fields.summary ?? "",
12883
13133
  result: o.result,
12884
13134
  reporter: who(reporter),
@@ -12890,7 +13140,7 @@ async function gapVerify({ client: client3 }, ref, o, casesSlug = CASES_REPO_SLU
12890
13140
  if (!sameUser(reporter, me)) {
12891
13141
  throw verifyFailure(
12892
13142
  "not-reporter",
12893
- CliErrorCode30.BUSINESS_RULE_VIOLATION,
13143
+ CliErrorCode31.BUSINESS_RULE_VIOLATION,
12894
13144
  "no",
12895
13145
  `\u53EA\u6709\u63D0\u5355\u4EBA\u80FD\u9A8C\u6536 ${key2}\uFF1A\u63D0\u5355\u4EBA\u662F ${who(reporter)}\uFF0C\u5F53\u524D\u8EAB\u4EFD\u662F ${who(me)}`,
12896
13146
  // 重复单上的 pass:提单人跑了也一个字不写(见下面 ②),叫人去找提单人是一跳死路
@@ -12905,7 +13155,7 @@ async function gapVerify({ client: client3 }, ref, o, casesSlug = CASES_REPO_SLU
12905
13155
  if (status !== FIXED_STATUS) {
12906
13156
  throw verifyFailure(
12907
13157
  "status-not-fixed",
12908
- CliErrorCode30.BUSINESS_RULE_VIOLATION,
13158
+ CliErrorCode31.BUSINESS_RULE_VIOLATION,
12909
13159
  "no",
12910
13160
  `${key2} \u7684\u72B6\u6001\u662F\u300C${status ?? "?"}\u300D\uFF0C\u9A8C\u6536\u53EA\u5728\u300C${FIXED_STATUS}\u300D\u4E0A\u505A`,
12911
13161
  notFixedNextStep(key2, before, o.result),
@@ -12917,7 +13167,7 @@ async function gapVerify({ client: client3 }, ref, o, casesSlug = CASES_REPO_SLU
12917
13167
  let comments;
12918
13168
  let readReason;
12919
13169
  try {
12920
- comments = await client3.comments(key2);
13170
+ comments = await client4.comments(key2);
12921
13171
  } catch (e) {
12922
13172
  readReason = e instanceof Error ? e.message.split("\n")[0] : String(e);
12923
13173
  }
@@ -12931,7 +13181,7 @@ async function gapVerify({ client: client3 }, ref, o, casesSlug = CASES_REPO_SLU
12931
13181
  } else if (o.fingerprint.revision < fixRevision) {
12932
13182
  const environmentRevision = o.fingerprint.revision;
12933
13183
  const message = `\u73AF\u5883\u5C1A\u672A\u5305\u542B\u4FEE\u590D\uFF08\u5F53\u524D r${environmentRevision} < \u4FEE\u590D r${fixRevision}\uFF09\uFF0C\u8BF7\u7B49\u90E8\u7F72\u540E\u590D\u9A8C\uFF1B\u81EA\u67E5 curl <env>/api/version/backend`;
12934
- throw verifyFailure("env-behind-fix", CliErrorCode30.BUSINESS_RULE_VIOLATION, "no", message, message, { key: key2, fixRevision, environmentRevision });
13184
+ throw verifyFailure("env-behind-fix", CliErrorCode31.BUSINESS_RULE_VIOLATION, "no", message, message, { key: key2, fixRevision, environmentRevision });
12935
13185
  } else {
12936
13186
  const environmentRevision = o.fingerprint.revision;
12937
13187
  versionComparison = { status: "passed", text: `\u7248\u672C\u6BD4\u5BF9\uFF1A\u73AF\u5883 r${environmentRevision} \u2265 \u4FEE\u590D r${fixRevision}`, fixRevision, environmentRevision };
@@ -12943,13 +13193,13 @@ async function gapVerify({ client: client3 }, ref, o, casesSlug = CASES_REPO_SLU
12943
13193
  let requiredChecked;
12944
13194
  if (plan.transition) {
12945
13195
  const want = plan.transition;
12946
- const list = await client3.transitions(key2);
13196
+ const list = await client4.transitions(key2);
12947
13197
  transition = list.find((t) => t.name === want.name && t.to?.name === want.to);
12948
13198
  if (!transition) {
12949
13199
  const available = list.map((t) => `${t.name}\u2192${t.to?.name ?? "?"}`);
12950
13200
  throw verifyFailure(
12951
13201
  "transition-unavailable",
12952
- CliErrorCode30.BUSINESS_RULE_VIOLATION,
13202
+ CliErrorCode31.BUSINESS_RULE_VIOLATION,
12953
13203
  "no",
12954
13204
  `${key2} \u4E0A\u670D\u52A1\u7AEF\u6B64\u523B\u4E0D\u7ED9\u300C${want.name}\u2192${want.to}\u300D\u8FD9\u6761\u6D41\u8F6C\uFF08\u53EF\u7528\uFF1A${available.join(" / ") || "\uFF08\u65E0\uFF09"}\uFF09`,
12955
13205
  "\u591A\u534A\u662F\u5DE5\u4F5C\u6D41\u88AB\u6539\u8FC7\uFF0C\u6216\u4F60\u7684\u8D26\u53F7\u5728\u8FD9\u4E2A\u9879\u76EE\u4E0A\u6CA1\u6709\u8FD9\u6761\u6D41\u8F6C\u7684\u6743\u9650\u3002\u628A\u8FD9\u6BB5\u8F93\u51FA\u53D1\u7ED9\u4EA7\u54C1\u4FA7\u5206\u8BCA\u4EBA\uFF1B\u522B\u81EA\u5DF1\u62FC HTTP\uFF0C\u4E5F\u522B\u6539\u95EE\u9898\u7C7B\u578B\u7ED5\u8FC7\u3002",
@@ -12961,7 +13211,7 @@ async function gapVerify({ client: client3 }, ref, o, casesSlug = CASES_REPO_SLU
12961
13211
  else if (req.missing.length) {
12962
13212
  throw verifyFailure(
12963
13213
  "required-fields-missing",
12964
- CliErrorCode30.BUSINESS_RULE_VIOLATION,
13214
+ CliErrorCode31.BUSINESS_RULE_VIOLATION,
12965
13215
  "no",
12966
13216
  `\u300C${transition.name}\u300D\u8981\u6C42\u8FD9\u4E9B\u5B57\u6BB5\u6709\u503C\uFF0C${key2} \u4E0A\u662F\u7A7A\u7684\uFF1A${req.missing.join("\u3001")}`,
12967
13217
  "\u8FD9\u4E9B\u5B57\u6BB5\u7531\u4EA7\u54C1\u4FA7\u7EF4\u62A4\uFF0C\u8BF7\u5206\u8BCA\u4EBA\u8865\u9F50\u540E\u518D\u8DD1\uFF1BCLI \u4E0D\u4EE3\u586B\uFF0C\u4E5F\u522B\u628A\u7ECF\u529E\u4EBA\u6216\u4FEE\u590D\u4EBA\u731C\u6210 Bug\u5F15\u5165\u4EBA\u3002",
@@ -12990,20 +13240,20 @@ async function gapVerify({ client: client3 }, ref, o, casesSlug = CASES_REPO_SLU
12990
13240
  }
12991
13241
  if (transition) {
12992
13242
  const what = `\u6D41\u8F6C\u300C${transition.name}\u300D\u4E0E\u8BC4\u8BBA`;
12993
- const beforeIds = new Set((await client3.comments(key2)).map((c2) => c2.id));
13243
+ const beforeIds = new Set((await client4.comments(key2)).map((c2) => c2.id));
12994
13244
  try {
12995
- await client3.transitionById(key2, transition.id, body);
13245
+ await client4.transitionById(key2, transition.id, body);
12996
13246
  } catch (e) {
12997
13247
  throw writeFailure(e, key2, what);
12998
13248
  }
12999
- const comment2 = await claimTransitionComment(client3, key2, me, plan.header, body, beforeIds);
13249
+ const comment2 = await claimTransitionComment(client4, key2, me, plan.header, body, beforeIds);
13000
13250
  let after2;
13001
13251
  try {
13002
- after2 = snapshotOf(await client3.issue(key2, ["status", "resolution"]));
13252
+ after2 = snapshotOf(await client4.issue(key2, ["status", "resolution"]));
13003
13253
  } catch (e) {
13004
13254
  throw verifyFailure(
13005
13255
  "readback-failed",
13006
- CliErrorCode30.NETWORK_ERROR,
13256
+ CliErrorCode31.NETWORK_ERROR,
13007
13257
  "yes",
13008
13258
  `${what}\u5DF2\u88AB Jira \u63A5\u53D7\uFF0C\u4F46\u56DE\u8BFB ${key2} \u5931\u8D25\uFF0C\u843D\u5230\u4EC0\u4E48\u72B6\u6001\u6CA1\u786E\u8BA4`,
13009
13259
  `\u7528 \`hcm chiron gap status ${key2}\` \u770B\u7ED3\u679C\uFF1B\u522B\u76F4\u63A5\u91CD\u8DD1\uFF08\u4F1A\u518D\u5199\u4E00\u6761\u8BC4\u8BBA\uFF09\u3002`,
@@ -13017,7 +13267,7 @@ async function gapVerify({ client: client3 }, ref, o, casesSlug = CASES_REPO_SLU
13017
13267
  const did = plan.outcome === "closed" ? "\u5173\u5355" : "\u9000\u56DE";
13018
13268
  throw verifyFailure(
13019
13269
  "readback-mismatch",
13020
- CliErrorCode30.SERVER_ERROR,
13270
+ CliErrorCode31.SERVER_ERROR,
13021
13271
  "yes",
13022
13272
  after2.status !== expected ? `${what}\u5DF2\u88AB Jira \u63A5\u53D7\uFF0C\u4F46\u56DE\u8BFB ${key2} \u7684\u72B6\u6001\u662F\u300C${after2.status ?? "?"}\u300D\uFF0C\u9884\u671F\u300C${expected}\u300D` : `${what}\u5DF2\u88AB Jira \u63A5\u53D7\uFF0C${key2} \u56DE\u5230\u4E86\u300C${expected}\u300D\uFF0C\u4F46 resolution \u8FD8\u662F\u300C${after2.resolution}\u300D\u2014\u2014\u5B83\u4F1A\u4ECE\u300C\u672A\u89E3\u51B3\u300D\u7684\u67E5\u8BE2\u91CC\u6D88\u5931`,
13023
13273
  after2.status !== expected ? `\u4EE5 \`hcm chiron gap status ${key2}\` \u4E3A\u51C6\uFF0C\u522B\u5F53\u6210\u5DF2\u7ECF${did}\uFF1B\u628A\u8FD9\u6BB5\u8F93\u51FA\u53D1\u7ED9\u4EA7\u54C1\u4FA7\u5206\u8BCA\u4EBA\u3002` : "\u8BF7\u4EA7\u54C1\u4FA7\u5206\u8BCA\u4EBA\u6E05\u6389\u8FD9\u5355\u7684 resolution\uFF08\u300C\u672A\u89E3\u51B3\u300D\u8FD9\u6761\u6D41\u8F6C\u672C\u6765\u4F1A\u6E05\uFF0C\u6CA1\u6E05\u8BF4\u660E\u5DE5\u4F5C\u6D41\u88AB\u6539\u8FC7\uFF09\uFF1B\u628A\u8FD9\u6BB5\u8F93\u51FA\u53D1\u7ED9\u4ED6\u3002",
@@ -13039,17 +13289,17 @@ async function gapVerify({ client: client3 }, ref, o, casesSlug = CASES_REPO_SLU
13039
13289
  }
13040
13290
  let written;
13041
13291
  try {
13042
- written = await client3.addComment(key2, body);
13292
+ written = await client4.addComment(key2, body);
13043
13293
  } catch (e) {
13044
13294
  throw writeFailure(e, key2, "\u8BC4\u8BBA");
13045
13295
  }
13046
13296
  let listed;
13047
13297
  try {
13048
- listed = await client3.comments(key2);
13298
+ listed = await client4.comments(key2);
13049
13299
  } catch (e) {
13050
13300
  throw verifyFailure(
13051
13301
  "readback-failed",
13052
- CliErrorCode30.NETWORK_ERROR,
13302
+ CliErrorCode31.NETWORK_ERROR,
13053
13303
  "yes",
13054
13304
  `\u8BC4\u8BBA\u5DF2\u88AB Jira \u63A5\u53D7\uFF0C\u4F46\u56DE\u8BFB ${key2} \u7684\u8BC4\u8BBA\u5931\u8D25\uFF0C\u6CA1\u786E\u8BA4\u5B83\u5728`,
13055
13305
  `\u7528 \`hcm chiron gap comments ${key2}\` \u770B\u5B83\u5728\u4E0D\u5728\uFF1B\u522B\u76F4\u63A5\u91CD\u8DD1\uFF08\u4F1A\u518D\u5199\u4E00\u6761\uFF09\u3002`,
@@ -13063,19 +13313,19 @@ async function gapVerify({ client: client3 }, ref, o, casesSlug = CASES_REPO_SLU
13063
13313
  } else if (!listed.some((c2) => c2.id === written.id)) {
13064
13314
  throw verifyFailure(
13065
13315
  "readback-mismatch",
13066
- CliErrorCode30.SERVER_ERROR,
13316
+ CliErrorCode31.SERVER_ERROR,
13067
13317
  "yes",
13068
13318
  `Jira \u56DE\u4E86\u8BC4\u8BBA ${written.id}\uFF0C\u4F46\u56DE\u8BFB ${key2} \u7684\u8BC4\u8BBA\u91CC\u6CA1\u6709\u5B83`,
13069
13319
  `\u7528 \`hcm chiron gap comments ${key2}\` \u6838\u5BF9\uFF1B\u522B\u76F4\u63A5\u91CD\u8DD1\uFF0C\u628A\u8FD9\u6BB5\u8F93\u51FA\u53D1\u7ED9\u4EA7\u54C1\u4FA7\u5206\u8BCA\u4EBA\u3002`,
13070
13320
  { key: key2, comment: written.id }
13071
13321
  );
13072
13322
  } else {
13073
- comment = { body, found: true, id: written.id, url: client3.commentUrl(key2, written.id) };
13323
+ comment = { body, found: true, id: written.id, url: client4.commentUrl(key2, written.id) };
13074
13324
  }
13075
13325
  let after;
13076
13326
  let aside = "";
13077
13327
  try {
13078
- after = snapshotOf(await client3.issue(key2, ["status", "resolution"]));
13328
+ after = snapshotOf(await client4.issue(key2, ["status", "resolution"]));
13079
13329
  if (after.status !== FIXED_STATUS) aside = `\uFF08\u56DE\u8BFB\u65F6\u5355\u5B50\u5DF2\u662F\u300C${after.status ?? "?"}\u300D\u2014\u2014\u8BC4\u8BBA\u5199\u8FDB\u53BB\u4E4B\u540E\u6709\u4EBA\u52A8\u8FC7\u5B83\uFF0C\u4EE5 \`hcm chiron gap status ${key2}\` \u4E3A\u51C6\u3002\uFF09`;
13080
13330
  } catch (e) {
13081
13331
  const why = e instanceof Error ? e.message.split("\n")[0] : String(e);
@@ -13174,7 +13424,7 @@ var reporterFields = (who2) => !who2 ? {} : who2.reportedByYou === null ? { repo
13174
13424
  var reporterCheckOf = (c2) => c2.reportedByYou === void 0 ? void 0 : c2.reportedByYou === null ? { reportedByYou: null, why: c2.reportedByYouUnknown ?? "\u539F\u56E0\u672A\u77E5" } : { reportedByYou: c2.reportedByYou, ...c2.reportedByYouBasis ? { basis: c2.reportedByYouBasis } : {} };
13175
13425
  var gapDedupeJql = (project2) => `project = ${project2} AND (resolution = Unresolved OR status = "${FIXED_STATUS}" OR (status = "${CLOSED_STATUS}" AND resolved >= -90d)) ORDER BY created DESC`;
13176
13426
  var GAP_DEDUPE_SCOPE = "\u672A\u89E3\u51B3 + \u5DF2\u4FEE\u590D + \u8FD1 90 \u5929 CLOSE";
13177
- function findGapCandidates(issues, g, client3) {
13427
+ function findGapCandidates(issues, g, client4) {
13178
13428
  const summary = gapSummary(g);
13179
13429
  const code2 = isMissingCode(g.error_code) ? void 0 : g.error_code;
13180
13430
  const out = [];
@@ -13199,7 +13449,7 @@ function findGapCandidates(issues, g, client3) {
13199
13449
  summary: t,
13200
13450
  status: i.fields.status?.name,
13201
13451
  resolution: i.fields.resolution?.name,
13202
- url: client3.browseUrl(i.key),
13452
+ url: client4.browseUrl(i.key),
13203
13453
  reason,
13204
13454
  ...score !== void 0 ? { score } : {}
13205
13455
  });
@@ -13363,18 +13613,18 @@ next_step=\u8BA9 Jira \u7BA1\u7406\u5458\u628A\u8FD9\u4E9B\u5B57\u6BB5\u6539\u62
13363
13613
  }
13364
13614
  return { fields, type, keyTag, summary: gapSummary(g), module: `${module}/${g.module_detail || MODULE_DEFAULT_CHILD[module]}` };
13365
13615
  }
13366
- async function withSituation(client3, c2, fingerprint, reporter) {
13616
+ async function withSituation(client4, c2, fingerprint, reporter) {
13367
13617
  if (!isFixedCandidate(c2)) return { ...c2, ...classifyCandidate(c2, void 0, fingerprint) };
13368
13618
  const who2 = c2.status === FIXED_STATUS ? await reporter() : void 0;
13369
13619
  try {
13370
- return { ...c2, ...classifyCandidate(c2, fixRevisionFromComments(await client3.comments(c2.key)), fingerprint, void 0, who2), ...reporterFields(who2) };
13620
+ return { ...c2, ...classifyCandidate(c2, fixRevisionFromComments(await client4.comments(c2.key)), fingerprint, void 0, who2), ...reporterFields(who2) };
13371
13621
  } catch (e) {
13372
13622
  return { ...c2, ...classifyCandidate(c2, void 0, fingerprint, firstLine3(String(e.message ?? e)), who2), ...reporterFields(who2) };
13373
13623
  }
13374
13624
  }
13375
- function reporterChecker(client3) {
13625
+ function reporterChecker(client4) {
13376
13626
  let me;
13377
- const myself = () => me ??= client3.myself();
13627
+ const myself = () => me ??= client4.myself();
13378
13628
  const check = async (reporter) => {
13379
13629
  let you;
13380
13630
  try {
@@ -13431,16 +13681,16 @@ localWorkaround: ${localWorkaroundText(g)}
13431
13681
  \u4E25\u91CD\u5EA6\uFF1A${g.severity}` + (target?.advice && comparesVersions(target.situation) ? `
13432
13682
 
13433
13683
  \u7248\u672C\u5224\u65AD\uFF1A${target.advice}` : "");
13434
- async function gapSubmit({ client: client3 }, g, opts) {
13684
+ async function gapSubmit({ client: client4 }, g, opts) {
13435
13685
  const summary = gapSummary(g);
13436
- const scope = await client3.searchAll(gapDedupeJql(client3.project), { fields: ["summary", "status", "resolution", "reporter"] });
13686
+ const scope = await client4.searchAll(gapDedupeJql(client4.project), { fields: ["summary", "status", "resolution", "reporter"] });
13437
13687
  const scanned = { scope: GAP_DEDUPE_SCOPE, count: scope.issues.length, total: scope.total, truncated: scope.truncated };
13438
- const raw = findGapCandidates(scope.issues, g, client3);
13688
+ const raw = findGapCandidates(scope.issues, g, client4);
13439
13689
  const reporters = new Map(scope.issues.map((i) => [i.key, i.fields.reporter]));
13440
- const who2 = reporterChecker(client3);
13690
+ const who2 = reporterChecker(client4);
13441
13691
  const candidates = [];
13442
13692
  for (const c2 of raw.slice(0, MAX_CANDIDATES)) {
13443
- const judged = await withSituation(client3, c2, opts.fingerprint, () => who2.check(reporters.get(c2.key)));
13693
+ const judged = await withSituation(client4, c2, opts.fingerprint, () => who2.check(reporters.get(c2.key)));
13444
13694
  candidates.push({ ...judged, appendable: !appendRefused(judged) });
13445
13695
  }
13446
13696
  const base = {
@@ -13453,17 +13703,17 @@ async function gapSubmit({ client: client3 }, g, opts) {
13453
13703
  localWorkaroundStated: Boolean(g.local_workaround?.trim())
13454
13704
  };
13455
13705
  if (opts.appendTo) {
13456
- const parsed = parseRef2(opts.appendTo, client3.project);
13457
- if (!parsed || parsed.kind !== "jira" || !parsed.key.startsWith(`${client3.project}-`)) {
13458
- throw new CliError30({ code: CliErrorCode31.INVALID_ARGUMENT, message: `--append-to \u8981\u7ED9 ${client3.project} \u7684\u5355\u53F7\uFF08\u5982 ${client3.project}-5\uFF09\uFF0C\u6536\u5230\u300C${opts.appendTo}\u300D` });
13706
+ const parsed = parseRef2(opts.appendTo, client4.project);
13707
+ if (!parsed || parsed.kind !== "jira" || !parsed.key.startsWith(`${client4.project}-`)) {
13708
+ throw new CliError31({ code: CliErrorCode32.INVALID_ARGUMENT, message: `--append-to \u8981\u7ED9 ${client4.project} \u7684\u5355\u53F7\uFF08\u5982 ${client4.project}-5\uFF09\uFF0C\u6536\u5230\u300C${opts.appendTo}\u300D` });
13459
13709
  }
13460
- const issue = await client3.issue(parsed.key, ["summary", "status", "resolution", "reporter"]);
13461
- const target = await withSituation(client3, {
13710
+ const issue = await client4.issue(parsed.key, ["summary", "status", "resolution", "reporter"]);
13711
+ const target = await withSituation(client4, {
13462
13712
  key: parsed.key,
13463
13713
  summary: issue.fields.summary ?? "",
13464
13714
  status: issue.fields.status?.name,
13465
13715
  resolution: issue.fields.resolution?.name,
13466
- url: client3.browseUrl(parsed.key),
13716
+ url: client4.browseUrl(parsed.key),
13467
13717
  ...(() => {
13468
13718
  const hit = raw.find((c2) => c2.key === parsed.key);
13469
13719
  return hit ? { reason: hit.reason, ...hit.score !== void 0 ? { score: hit.score } : {} } : { reason: "named" };
@@ -13471,8 +13721,8 @@ async function gapSubmit({ client: client3 }, g, opts) {
13471
13721
  }, opts.fingerprint, () => who2.check(issue.fields.reporter));
13472
13722
  if (appendRefused(target)) {
13473
13723
  const why = target.status === CLOSED_STATUS ? "\u8FD9\u5355\u5DF2\u5173\u95ED\uFF08\u7EC8\u6001\uFF09\uFF0C\u8FFD\u52A0\u7684\u73B0\u573A\u5206\u8BCA\u770B\u4E0D\u5230" : target.situation === "duplicate" ? "\u8FD9\u5F20\u88AB\u5224\u4E3A\u91CD\u590D\u5355\uFF0C\u73B0\u573A\u8BE5\u8BB0\u5728\u5B83\u6307\u5411\u7684\u539F\u5355\u4E0A" : target.status !== FIXED_STATUS ? "\u4F60\u7684\u73AF\u5883\u5DF2\u542B\u4FEE\u590D\u4ECD\u590D\u73B0\uFF0C\u7591\u4F3C\u56DE\u5F52\uFF0C\u8981\u65B0\u5F00\u5E76\u5F15\u7528\u539F\u5355" : target.reportedByYou === true ? "\u4F60\u7684\u73AF\u5883\u5DF2\u542B\u4FEE\u590D\u4ECD\u590D\u73B0\uFF0C\u7591\u4F3C\u56DE\u5F52\uFF1B\u539F\u5355\u8FD8\u505C\u5728\u300C\u5DF2\u4FEE\u590D\u300D\uFF0C\u4F60\u662F\u63D0\u5355\u4EBA\uFF0C\u590D\u9A8C\u7ED3\u8BBA\u8BE5\u9000\u56DE\u539F\u5355" : target.reportedByYou === false ? "\u4F60\u7684\u73AF\u5883\u5DF2\u542B\u4FEE\u590D\u4ECD\u590D\u73B0\uFF0C\u7591\u4F3C\u56DE\u5F52\uFF1B\u4F60\u4E0D\u662F\u539F\u5355\u63D0\u5355\u4EBA\u3001\u9000\u4E0D\u4E86\u539F\u5355\uFF0C\u8981\u65B0\u5F00\u5E76\u5F15\u7528\u539F\u5355" : "\u4F60\u7684\u73AF\u5883\u5DF2\u542B\u4FEE\u590D\u4ECD\u590D\u73B0\uFF0C\u7591\u4F3C\u56DE\u5F52\uFF1B\u6309\u4E0B\u4E00\u6B65\u8D70\uFF08\u539F\u5355\u63D0\u5355\u4EBA\u9000\u56DE\u539F\u5355\uFF0C\u4E0D\u662F\u63D0\u5355\u4EBA\u624D\u65B0\u5F00\uFF09";
13474
- throw new CliError30({
13475
- code: CliErrorCode31.BUSINESS_RULE_VIOLATION,
13724
+ throw new CliError31({
13725
+ code: CliErrorCode32.BUSINESS_RULE_VIOLATION,
13476
13726
  message: `\u6CA1\u6709\u5F80 ${parsed.key} \u8FFD\u52A0\uFF1A${why}`,
13477
13727
  context: {
13478
13728
  reasonCode: "append-refused",
@@ -13496,7 +13746,7 @@ async function gapSubmit({ client: client3 }, g, opts) {
13496
13746
  nextStep: `\u6CA1\u6709\u5199 Jira\u3002\u53BB\u6389 --dry-run \u5C31\u4F1A\u5F80 ${parsed.key} \u8FFD\u52A0\u8FD9\u4E00\u6BB5\u300C\u53C8\u4E00\u4E2A\u73B0\u573A\u300D\u3002`
13497
13747
  };
13498
13748
  }
13499
- await client3.addComment(parsed.key, appendBody(g, opts.fingerprint.text, target));
13749
+ await client4.addComment(parsed.key, appendBody(g, opts.fingerprint.text, target));
13500
13750
  return {
13501
13751
  ...base,
13502
13752
  outcome: "appended",
@@ -13517,12 +13767,12 @@ async function gapSubmit({ client: client3 }, g, opts) {
13517
13767
  nextStep: `\u6CA1\u6709\u63D0\u4EA4\u3002${partial}${choose}\uFF1B\u60F3\u5148\u770B\u4F1A\u5199\u4EC0\u4E48\u518D\u52A0 --dry-run\u3002`
13518
13768
  };
13519
13769
  }
13520
- const [types, me, project2] = await Promise.all([client3.createMeta(), who2.myself(), client3.projectInfo()]);
13770
+ const [types, me, project2] = await Promise.all([client4.createMeta(), who2.myself(), client4.projectInfo()]);
13521
13771
  const built = buildGapFields(g, {
13522
13772
  types,
13523
13773
  me: me.name ?? me.key ?? "",
13524
13774
  assignee: opts.assigneeOverride || project2.lead?.name || project2.lead?.key,
13525
- project: client3.project,
13775
+ project: client4.project,
13526
13776
  fingerprintText: opts.fingerprint.text,
13527
13777
  issuetypeOverride: opts.issuetypeOverride,
13528
13778
  dedupeNote: renderDedupeNote(candidates, raw.length)
@@ -13538,42 +13788,42 @@ async function gapSubmit({ client: client3 }, g, opts) {
13538
13788
  nextStep: "\u6CA1\u6709\u5199 Jira\u3002\u53BB\u6389 --dry-run \u5C31\u4F1A\u6309\u4E0A\u9762\u7684\u6982\u8981\u3001\u7C7B\u578B\u548C\u6A21\u5757\u65B0\u5F00\u3002"
13539
13789
  };
13540
13790
  }
13541
- const created = await client3.createIssue(built.fields);
13791
+ const created = await client4.createIssue(built.fields);
13542
13792
  return {
13543
13793
  ...base,
13544
13794
  outcome: "created",
13545
13795
  key: created.key,
13546
- url: client3.browseUrl(created.key),
13796
+ url: client4.browseUrl(created.key),
13547
13797
  summary: built.summary,
13548
13798
  type: built.type.name,
13549
13799
  module: built.module,
13550
13800
  nextStep: `\u7F3A\u53E3\u5DF2\u63D0\uFF0C\u7F16\u53F7 ${created.key}\uFF1B\u5148\u7528\u66FF\u4EE3\u6CD5\u300C${g.alternative}\u300D\u7EE7\u7EED\uFF0C\u4EA7\u54C1\u5206\u8BCA\u540E\u4F1A\u5728\u90A3\u5355\u91CC\u56DE\u590D\u3002\u62A5\u544A\u91CC\u5199\u300CBLOCKED \xB7 \u5DF2\u63D0 ${created.key} \xB7 \u66FF\u4EE3\u6CD5\uFF1A${g.alternative}\u300D\u3002`
13551
13801
  };
13552
13802
  }
13553
- function searchRow(client3, i) {
13803
+ function searchRow(client4, i) {
13554
13804
  const state = i.fields.status?.name, resolution = i.fields.resolution?.name;
13555
13805
  const advice = terminalGapHint({ key: i.key, status: state, resolution });
13556
- return { where: "Jira", id: i.key, title: i.fields.summary ?? "", state, resolution, url: client3.browseUrl(i.key), ...advice ? { advice } : {} };
13806
+ return { where: "Jira", id: i.key, title: i.fields.summary ?? "", state, resolution, url: client4.browseUrl(i.key), ...advice ? { advice } : {} };
13557
13807
  }
13558
- async function gapSearch({ client: client3 }, keywords, { includeClosed = true } = {}) {
13808
+ async function gapSearch({ client: client4 }, keywords, { includeClosed = true } = {}) {
13559
13809
  const rows2 = [];
13560
13810
  let jiraError;
13561
13811
  let truncated;
13562
13812
  try {
13563
13813
  for (const kw of keywords) {
13564
13814
  const safe = kw.replace(/["\\]/g, " ").trim();
13565
- const jql = `project = ${client3.project} AND text ~ "${safe}"${includeClosed ? "" : " AND resolution = Unresolved"} ORDER BY updated DESC`;
13566
- for (const i of await client3.search(jql, { max: 15 })) {
13567
- rows2.push(searchRow(client3, i));
13815
+ const jql = `project = ${client4.project} AND text ~ "${safe}"${includeClosed ? "" : " AND resolution = Unresolved"} ORDER BY updated DESC`;
13816
+ for (const i of await client4.search(jql, { max: 15 })) {
13817
+ rows2.push(searchRow(client4, i));
13568
13818
  }
13569
13819
  }
13570
13820
  if (!rows2.length) {
13571
- const jql = includeClosed ? gapDedupeJql(client3.project) : `project = ${client3.project} AND resolution = Unresolved ORDER BY created DESC`;
13572
- const scope = await client3.searchAll(jql, { fields: ["summary", "status", "resolution"] });
13821
+ const jql = includeClosed ? gapDedupeJql(client4.project) : `project = ${client4.project} AND resolution = Unresolved ORDER BY created DESC`;
13822
+ const scope = await client4.searchAll(jql, { fields: ["summary", "status", "resolution"] });
13573
13823
  if (scope.truncated) truncated = { count: scope.issues.length, total: scope.total };
13574
13824
  for (const i of scope.issues) {
13575
13825
  if (keywords.some((k) => (i.fields.summary ?? "").includes(k))) {
13576
- rows2.push(searchRow(client3, i));
13826
+ rows2.push(searchRow(client4, i));
13577
13827
  }
13578
13828
  }
13579
13829
  }
@@ -13602,11 +13852,11 @@ function lastEnteredStatus(histories, status) {
13602
13852
  }
13603
13853
  var unparseableEntries = (histories, status) => histories.filter((h) => entersStatus(h, status) && !Number.isFinite(Date.parse(h.created ?? ""))).map((h) => String(h.created ?? "\uFF08\u7A7A\uFF09"));
13604
13854
  var PENDING_VERIFY_CONCURRENCY = 4;
13605
- async function gapPendingVerify({ client: client3 }, { now = Date.now(), signal } = {}) {
13606
- const jql = pendingVerifyJql(client3.project);
13855
+ async function gapPendingVerify({ client: client4 }, { now = Date.now(), signal } = {}) {
13856
+ const jql = pendingVerifyJql(client4.project);
13607
13857
  let pre;
13608
13858
  try {
13609
- pre = await client3.searchAll(jql, { fields: ["summary", "status"] });
13859
+ pre = await client4.searchAll(jql, { fields: ["summary", "status"] });
13610
13860
  } catch (e) {
13611
13861
  return {
13612
13862
  complete: false,
@@ -13622,7 +13872,7 @@ async function gapPendingVerify({ client: client3 }, { now = Date.now(), signal
13622
13872
  const undetermined = [];
13623
13873
  const recentlyRefixed = [];
13624
13874
  const judge = async (i) => {
13625
- const base = { key: i.key, summary: i.fields.summary ?? "", url: client3.browseUrl(i.key) };
13875
+ const base = { key: i.key, summary: i.fields.summary ?? "", url: client4.browseUrl(i.key) };
13626
13876
  let reason;
13627
13877
  let fixedAt;
13628
13878
  let bad = [];
@@ -13631,7 +13881,7 @@ async function gapPendingVerify({ client: client3 }, { now = Date.now(), signal
13631
13881
  return;
13632
13882
  }
13633
13883
  try {
13634
- const cl = await client3.changelog(i.key);
13884
+ const cl = await client4.changelog(i.key);
13635
13885
  if (cl.total === null) reason = "Jira \u6CA1\u62A5 changelog \u603B\u6570\uFF0C\u4E0D\u77E5\u9053\u5386\u53F2\u5168\u4E0D\u5168";
13636
13886
  else if (cl.returned < cl.total) reason = `changelog \u53EA\u8FD4\u56DE\u4E86 ${cl.returned}/${cl.total} \u6761\uFF0C\u6700\u540E\u4E00\u6B21\u8FDB\u5165\u300C${FIXED_STATUS}\u300D\u53EF\u80FD\u5728\u6CA1\u8FD4\u56DE\u7684\u90A3\u90E8\u5206\u91CC`;
13637
13887
  else if ((bad = unparseableEntries(cl.histories, FIXED_STATUS)).length) reason = `changelog \u91CC\u6709 ${bad.length} \u6B21\u8FDB\u5165\u300C${FIXED_STATUS}\u300D\u7684\u65F6\u95F4\u8BFB\u4E0D\u51FA\uFF08${bad[0]}\uFF09\uFF0C\u4E0D\u77E5\u9053\u6700\u540E\u4E00\u6B21\u662F\u54EA\u6B21`;
@@ -13693,7 +13943,7 @@ function commentTime(c2, index) {
13693
13943
  function sortComments(cs) {
13694
13944
  return cs.map((c2, i) => ({ c: c2, i, t: commentTime(c2, i) })).sort((a, b) => a.t - b.t || a.i - b.i).map((x) => x.c);
13695
13945
  }
13696
- function toView(client3, key2, c2) {
13946
+ function toView(client4, key2, c2) {
13697
13947
  const { headline, truncated } = commentHeadline(c2.body);
13698
13948
  return {
13699
13949
  id: c2.id,
@@ -13702,22 +13952,22 @@ function toView(client3, key2, c2) {
13702
13952
  author: c2.author?.displayName ?? c2.author?.name ?? "?",
13703
13953
  headline,
13704
13954
  truncated,
13705
- url: c2.id ? client3.commentUrl(key2, c2.id) : void 0
13955
+ url: c2.id ? client4.commentUrl(key2, c2.id) : void 0
13706
13956
  };
13707
13957
  }
13708
- async function gapStatus({ client: client3 }, ref, casesSlug = CASES_REPO_SLUG3) {
13709
- const parsed = parseRef2(ref, client3.project, casesSlug);
13958
+ async function gapStatus({ client: client4 }, ref, casesSlug = CASES_REPO_SLUG3) {
13959
+ const parsed = parseRef2(ref, client4.project, casesSlug);
13710
13960
  if (!parsed) throw new Error(`\u770B\u4E0D\u61C2 ${ref}\uFF1A\u7ED9 Jira \u5355\u53F7\uFF08HCMNX-12\uFF09`);
13711
13961
  if (parsed.kind === "repo") {
13712
13962
  throw new Error(
13713
13963
  `${parsed.repo}#${parsed.number} \u662F\u4EA7\u54C1\u4ED3\u7F16\u53F7\uFF0C\u987E\u95EE\u4FA7\u67E5\u4E0D\u5230\u5B83\u7684\u72B6\u6001\uFF08\u6CA1\u6709\u90A3\u4E2A\u4ED3\u7684\u8BFB\u6743\u9650\uFF09\u3002next_step=\u7528 Jira \u5355\u53F7\u67E5\uFF08HCMNX-12\uFF09\u3002\u4EA7\u54C1\u4FA7\u7684\u8FDB\u5C55\u4F1A\u56DE\u5199\u5230 Jira \u5355\u4E0A\uFF0C\u90A3\u662F\u4EA7\u54C1\u5BF9\u5916\u7684\u7EDF\u4E00\u9762\u3002`
13714
13964
  );
13715
13965
  }
13716
- const issue = await client3.issue(parsed.key);
13717
- const cs = sortComments(await client3.comments(parsed.key));
13966
+ const issue = await client4.issue(parsed.key);
13967
+ const cs = sortComments(await client4.comments(parsed.key));
13718
13968
  const status = issue.fields.status?.name;
13719
13969
  const resolution = issue.fields.resolution?.name;
13720
- const lines = [`Jira ${issue.key} [${status}${resolution ? "\xB7" + resolution : ""}${issue.fields.priority ? " " + issue.fields.priority.name : ""}] ${issue.fields.summary ?? ""}`, ` ${client3.browseUrl(issue.key)}`];
13970
+ const lines = [`Jira ${issue.key} [${status}${resolution ? "\xB7" + resolution : ""}${issue.fields.priority ? " " + issue.fields.priority.name : ""}] ${issue.fields.summary ?? ""}`, ` ${client4.browseUrl(issue.key)}`];
13721
13971
  const productRaw = [...cs].reverse().find((c2) => PRODUCT_HANDLING_KEYWORDS.test(c2.body ?? ""));
13722
13972
  const latestRaw = cs.at(-1);
13723
13973
  const fullText = `\u5168\u6587\uFF1A\`hcm chiron gap comments ${issue.key}\``;
@@ -13730,11 +13980,11 @@ async function gapStatus({ client: client3 }, ref, casesSlug = CASES_REPO_SLUG3)
13730
13980
  let latestComment;
13731
13981
  let sameAsProduct;
13732
13982
  if (productRaw) {
13733
- latestProductComment = toView(client3, issue.key, productRaw);
13983
+ latestProductComment = toView(client4, issue.key, productRaw);
13734
13984
  latestProductComment.matchedKeyword = PRODUCT_HANDLING_KEYWORDS.exec(productRaw.body ?? "")?.[0];
13735
13985
  }
13736
13986
  if (latestRaw) {
13737
- latestComment = toView(client3, issue.key, latestRaw);
13987
+ latestComment = toView(client4, issue.key, latestRaw);
13738
13988
  sameAsProduct = !!productRaw && productRaw === latestRaw;
13739
13989
  if (!isAutoNotice(latestRaw.body)) latestComment.signal = classifyFollowUp(latestComment.headline);
13740
13990
  }
@@ -13747,7 +13997,7 @@ async function gapStatus({ client: client3 }, ref, casesSlug = CASES_REPO_SLUG3)
13747
13997
  if (latestComment) lines.push(...render2(`\u6700\u65B0\u8BC4\u8BBA\uFF08${stamp(latestComment)}\uFF09`, latestComment));
13748
13998
  }
13749
13999
  if (!latestComment) lines.push(" \u8FD8\u6CA1\u6709\u4EBA\u5904\u7406\uFF08\u4EA7\u54C1\u4FA7\u6BCF\u5468\u6E05\u4E00\u6B21\uFF1B\u963B\u65AD\u7EA7\u8BF7\u5728\u9879\u76EE\u7FA4\u91CC\u70B9\u540D\u8D1F\u8D23\u4EBA\uFF09");
13750
- const remote = (await client3.remoteLinks(parsed.key)).map((l) => l.object?.url ?? "").join("\n");
14000
+ const remote = (await client4.remoteLinks(parsed.key)).map((l) => l.object?.url ?? "").join("\n");
13751
14001
  const links = linkedRepoRefs(`${remote}
13752
14002
  ${issue.fields.description ?? ""}
13753
14003
  ${cs.map((c2) => c2.body ?? "").join("\n")}`).map((l) => ({
@@ -13798,21 +14048,21 @@ ${cs.map((c2) => c2.body ?? "").join("\n")}`).map((l) => ({
13798
14048
  if (!sameAsProduct) nextStep += ` \u53E6\uFF1A\u6709\u4E00\u6761\u6BD4\u4EA7\u54C1\u4FA7\u5904\u7406\u66F4\u65B0\u7684\u8BC4\u8BBA\u2014\u2014${cite}${tail}\uFF0C\u5148\u770B\u5B83\u3002`;
13799
14049
  }
13800
14050
  }
13801
- return { ref, lines, nextStep, jira: { key: issue.key, status, resolution, url: client3.browseUrl(issue.key) }, links, latestProductComment, latestComment, sameAsProduct };
14051
+ return { ref, lines, nextStep, jira: { key: issue.key, status, resolution, url: client4.browseUrl(issue.key) }, links, latestProductComment, latestComment, sameAsProduct };
13802
14052
  }
13803
- async function gapComments({ client: client3 }, ref, { limit } = {}, casesSlug = CASES_REPO_SLUG3) {
13804
- const parsed = parseRef2(ref, client3.project, casesSlug);
14053
+ async function gapComments({ client: client4 }, ref, { limit } = {}, casesSlug = CASES_REPO_SLUG3) {
14054
+ const parsed = parseRef2(ref, client4.project, casesSlug);
13805
14055
  if (!parsed) throw new Error(`\u770B\u4E0D\u61C2 ${ref}\uFF1A\u7ED9 Jira \u5355\u53F7\uFF08HCMNX-12\uFF09`);
13806
14056
  if (parsed.kind === "repo") {
13807
14057
  throw new Error(`${parsed.repo}#${parsed.number} \u662F\u4EA7\u54C1\u4ED3\u7F16\u53F7\uFF0C\u987E\u95EE\u4FA7\u8BFB\u4E0D\u5230\u5B83\u7684\u8BC4\u8BBA\uFF08\u6CA1\u6709\u90A3\u4E2A\u4ED3\u7684\u8BFB\u6743\u9650\uFF09\u3002next_step=\u7528 Jira \u5355\u53F7\uFF08HCMNX-12\uFF09\u3002`);
13808
14058
  }
13809
14059
  if (limit !== void 0 && (!Number.isInteger(limit) || limit < 1)) throw new Error(`--limit \u8981\u662F\u6B63\u6574\u6570\uFF0C\u7ED9\u7684\u662F ${String(limit)}`);
13810
- const all = sortComments(await client3.comments(parsed.key));
14060
+ const all = sortComments(await client4.comments(parsed.key));
13811
14061
  const picked = limit !== void 0 ? all.slice(-limit) : all;
13812
14062
  return {
13813
14063
  ref,
13814
14064
  key: parsed.key,
13815
- url: client3.browseUrl(parsed.key),
14065
+ url: client4.browseUrl(parsed.key),
13816
14066
  total: all.length,
13817
14067
  shown: picked.length,
13818
14068
  comments: picked.map((c2) => ({
@@ -13821,7 +14071,7 @@ async function gapComments({ client: client3 }, ref, { limit } = {}, casesSlug =
13821
14071
  when: commentWhen(c2.created),
13822
14072
  author: c2.author?.displayName ?? c2.author?.name ?? "?",
13823
14073
  body: (c2.body ?? "").trim(),
13824
- url: c2.id ? client3.commentUrl(parsed.key, c2.id) : void 0
14074
+ url: c2.id ? client4.commentUrl(parsed.key, c2.id) : void 0
13825
14075
  }))
13826
14076
  };
13827
14077
  }
@@ -13832,7 +14082,7 @@ async function gapDeps(deps) {
13832
14082
  return { client: await deps.client() };
13833
14083
  }
13834
14084
  function emit5(fmt, data, text) {
13835
- if (fmt === "json" || fmt === "yaml") process.stdout.write(formatObject27(data, { format: fmt }) + "\n");
14085
+ if (fmt === "json" || fmt === "yaml") process.stdout.write(formatObject28(data, { format: fmt }) + "\n");
13836
14086
  else process.stdout.write(text() + "\n");
13837
14087
  }
13838
14088
  async function run2(fn) {
@@ -14008,7 +14258,7 @@ function readEvidence(opts, stdinIsTTY = !!process.stdin.isTTY, readStdin2 = ()
14008
14258
  if (opts.file !== void 0 && opts.body !== void 0) {
14009
14259
  throw verifyFailure(
14010
14260
  "evidence-ambiguous",
14011
- CliErrorCode32.INVALID_ARGUMENT,
14261
+ CliErrorCode33.INVALID_ARGUMENT,
14012
14262
  "no",
14013
14263
  "--body \u4E0E --file \u540C\u65F6\u7ED9\u4E86\uFF0C\u4E0D\u77E5\u9053\u8BE5\u7528\u54EA\u4EFD\u505A\u9A8C\u6536\u8BC1\u636E",
14014
14264
  "\u53EA\u7559\u4E00\u4E2A\uFF1A\u77ED\u8BC1\u636E\u7528 --body\uFF0C\u957F\u8BC1\u636E\u5199\u8FDB\u6587\u4EF6\u7528 --file\u3002"
@@ -14020,7 +14270,7 @@ function readEvidence(opts, stdinIsTTY = !!process.stdin.isTTY, readStdin2 = ()
14020
14270
  } catch (e) {
14021
14271
  throw verifyFailure(
14022
14272
  "evidence-unreadable",
14023
- CliErrorCode32.INVALID_ARGUMENT,
14273
+ CliErrorCode33.INVALID_ARGUMENT,
14024
14274
  "no",
14025
14275
  `\u8BFB\u4E0D\u5230\u8BC1\u636E\u6587\u4EF6 ${opts.file}`,
14026
14276
  "\u6838\u5BF9\u8DEF\u5F84\u4E0E\u6743\u9650\uFF1B\u8BC1\u636E\u6587\u4EF6\u4E00\u822C\u653E\u5728\u9879\u76EE\u4ED3\u7684 evidence/ \u4E0B\u3002",
@@ -14033,7 +14283,7 @@ function readEvidence(opts, stdinIsTTY = !!process.stdin.isTTY, readStdin2 = ()
14033
14283
  if (stdinIsTTY) {
14034
14284
  throw verifyFailure(
14035
14285
  "evidence-missing",
14036
- CliErrorCode32.INVALID_ARGUMENT,
14286
+ CliErrorCode33.INVALID_ARGUMENT,
14037
14287
  "no",
14038
14288
  "\u6CA1\u7ED9\u9A8C\u6536\u8BC1\u636E",
14039
14289
  "\u7528 --body <\u6587\u672C> \u6216 --file <\u6587\u4EF6> \u7ED9\u51FA\uFF1A\u54EA\u4E2A\u73AF\u5883\u3001\u54EA\u4E2A\u7248\u672C\u3001\u6309\u6280\u80FD\u8DD1\u4E86\u4EC0\u4E48\u3001\u770B\u5230\u4E86\u4EC0\u4E48\u3002"
@@ -14093,9 +14343,9 @@ import { promises as fs13 } from "fs";
14093
14343
  import path15 from "path";
14094
14344
  import axios10 from "axios";
14095
14345
  import {
14096
- CliError as CliError36,
14097
- CliErrorCode as CliErrorCode37,
14098
- formatObject as formatObject30,
14346
+ CliError as CliError37,
14347
+ CliErrorCode as CliErrorCode38,
14348
+ formatObject as formatObject31,
14099
14349
  httpProbe as httpProbe2,
14100
14350
  listEnvs as listEnvs2,
14101
14351
  loadGlobalConfig as loadGlobalConfig12,
@@ -14119,12 +14369,12 @@ import yaml from "js-yaml";
14119
14369
  import {
14120
14370
  AUTH_INFO_PATH as AUTH_INFO_PATH2,
14121
14371
  assertNotReservedEnvName as assertNotReservedEnvName3,
14122
- CliError as CliError31,
14123
- CliErrorCode as CliErrorCode33,
14372
+ CliError as CliError32,
14373
+ CliErrorCode as CliErrorCode34,
14124
14374
  discoverProjectEnv as discoverProjectEnv6,
14125
14375
  ENV_FILE as ENV_FILE2,
14126
14376
  findEnvByEndpoint as findEnvByEndpoint5,
14127
- formatObject as formatObject28,
14377
+ formatObject as formatObject29,
14128
14378
  listIdentities as listIdentities6,
14129
14379
  parseEnvYaml as parseEnvYaml2,
14130
14380
  renderEnvYaml as renderEnvYaml2,
@@ -14143,7 +14393,7 @@ function summarizeReasons(reasons) {
14143
14393
  return reasons.length === 1 ? reasons[0] : `${reasons[0]} \u7B49 ${reasons.length} \u6761\uFF08--output json \u770B\u5168\u90E8\uFF09`;
14144
14394
  }
14145
14395
  function invalid2(message, nextStep) {
14146
- throw new CliError31({ code: CliErrorCode33.INVALID_ARGUMENT, message, context: { nextStep } });
14396
+ throw new CliError32({ code: CliErrorCode34.INVALID_ARGUMENT, message, context: { nextStep } });
14147
14397
  }
14148
14398
  function required(value, label) {
14149
14399
  if (!value?.trim()) invalid2(`${label} \u4E0D\u80FD\u4E3A\u7A7A\uFF1B\u914D\u7F6E\u672A\u5199\u5165\u3002`, `\u8BF7\u63D0\u4F9B\u975E\u7A7A\u7684 ${label}`);
@@ -14330,7 +14580,7 @@ async function runChironEnv(action, args = {}) {
14330
14580
  return report;
14331
14581
  }
14332
14582
  function formatChironEnvReport(report, output = "table") {
14333
- if (output !== "table") return formatObject28(report, { format: output });
14583
+ if (output !== "table") return formatObject29(report, { format: output });
14334
14584
  const lines = [
14335
14585
  report.action === "list" ? `\u9879\u76EE\u73AF\u5883\uFF1A${report.path}` : `\u5DF2\u5199\u5165\uFF1A${report.path}`,
14336
14586
  formatTable(report.environments.map((env2) => ({
@@ -14367,8 +14617,8 @@ import os5 from "os";
14367
14617
  import path13 from "path";
14368
14618
  import yaml2 from "js-yaml";
14369
14619
  import {
14370
- CliError as CliError32,
14371
- CliErrorCode as CliErrorCode34,
14620
+ CliError as CliError33,
14621
+ CliErrorCode as CliErrorCode35,
14372
14622
  METHOD_REPO_DISPLAY,
14373
14623
  METHOD_REPO_URL,
14374
14624
  assertSafeSkillId as assertSafeSkillId2,
@@ -14376,7 +14626,7 @@ import {
14376
14626
  discoverProjectEnv as discoverProjectEnv7,
14377
14627
  fetchSkillCatalog as fetchSkillCatalog2,
14378
14628
  flattenSkills as flattenSkills2,
14379
- formatObject as formatObject29,
14629
+ formatObject as formatObject30,
14380
14630
  parseSkillFrontmatter as parseSkillFrontmatter3,
14381
14631
  resolveChironBase as resolveChironBase2
14382
14632
  } from "@hcmai/sdk";
@@ -14409,8 +14659,8 @@ function gitErrorText(e) {
14409
14659
  function classifyGitFailure(e, repoDisplay) {
14410
14660
  const err = e;
14411
14661
  if (err.code === "ENOENT") {
14412
- return new CliError32({
14413
- code: CliErrorCode34.METHOD_GIT_UNAVAILABLE,
14662
+ return new CliError33({
14663
+ code: CliErrorCode35.METHOD_GIT_UNAVAILABLE,
14414
14664
  message: "\u672C\u673A\u627E\u4E0D\u5230 git\uFF0C\u53D6\u65B9\u6CD5\u5305\u9760\u5B83",
14415
14665
  context: { nextStep: "\u88C5\u4E0A git\uFF08`git --version` \u80FD\u8DD1\u901A\uFF09\uFF0C\u518D\u91CD\u8DD1\u8FD9\u6761\u547D\u4EE4" }
14416
14666
  });
@@ -14418,15 +14668,15 @@ function classifyGitFailure(e, repoDisplay) {
14418
14668
  const text = gitErrorText(e);
14419
14669
  const head = text.split("\n").filter(Boolean).slice(-3).join(" / ").slice(0, 400);
14420
14670
  if (err.code === "ETIMEDOUT" || err.signal === "SIGTERM") {
14421
- return new CliError32({
14422
- code: CliErrorCode34.METHOD_SOURCE_NETWORK,
14671
+ return new CliError33({
14672
+ code: CliErrorCode35.METHOD_SOURCE_NETWORK,
14423
14673
  message: `git \u5728\u65F6\u9650\u5185\u6CA1\u6709\u8FD4\u56DE\uFF08${repoDisplay}\uFF09`,
14424
14674
  context: { nextStep: "\u67E5\u7F51\u7EDC\u6216\u4EE3\u7406\u540E\u91CD\u8DD1\uFF1B\u5DF2\u88C5\u7684\u65B9\u6CD5\u5305\u79BB\u7EBF\u53EF\u8BFB\uFF0C`hcm chiron method status` \u7167\u5E38\u80FD\u7528" }
14425
14675
  });
14426
14676
  }
14427
14677
  if (/could not read Username|Authentication failed|terminal prompts disabled|returned error: 401|HTTP Basic: Access denied|invalid credentials|Permission denied \(publickey/i.test(text)) {
14428
- return new CliError32({
14429
- code: CliErrorCode34.METHOD_SOURCE_AUTH_REQUIRED,
14678
+ return new CliError33({
14679
+ code: CliErrorCode35.METHOD_SOURCE_AUTH_REQUIRED,
14430
14680
  message: `\u65B9\u6CD5\u8BBA\u4ED3\u8981\u8BA4\u8BC1\uFF0C\u672C\u673A\u6CA1\u6709\u53EF\u7528\u7684 git \u51ED\u636E\uFF08${repoDisplay}\uFF09\uFF1A${head}`,
14431
14681
  context: { nextStep: "`cnb login` \u4E4B\u540E\u91CD\u8DD1\u3002\u65B9\u6CD5\u5305\u8D70\u7684\u662F git \u51ED\u636E\uFF0C\u4E0D\u662F `hcm login`" }
14432
14682
  });
@@ -14434,8 +14684,8 @@ function classifyGitFailure(e, repoDisplay) {
14434
14684
  const notFound = /returned error: 404|Repository not found|repository '.*' not found|does not appear to be a git repository/i.test(text);
14435
14685
  if (/returned error: 403|403 Forbidden|access denied|not authorized/i.test(text) || notFound) {
14436
14686
  const overridden = Boolean(process.env.HCM_METHOD_REPO?.trim() || process.env.HCM_METHOD_REPO_URL?.trim());
14437
- return new CliError32({
14438
- code: CliErrorCode34.METHOD_SOURCE_FORBIDDEN,
14687
+ return new CliError33({
14688
+ code: CliErrorCode35.METHOD_SOURCE_FORBIDDEN,
14439
14689
  message: `\u51ED\u636E\u6709\u6548\u4F46\u8BFB\u4E0D\u5230\u65B9\u6CD5\u8BBA\u4ED3 ${repoDisplay}\uFF1A${head}` + (notFound ? "\uFF08\u8FDC\u7AEF\u5BF9\u65E0\u6743\u8BBF\u95EE\u7684\u79C1\u6709\u4ED3\u4E5F\u53EF\u80FD\u56DE 404\uFF0C\u6240\u4EE5\u8FD9\u91CC\u4E0D\u628A\u5B83\u5224\u6210\u300C\u4ED3\u4E0D\u5B58\u5728\u300D\uFF09" : ""),
14440
14690
  context: {
14441
14691
  nextStep: "\u627E\u77E5\u8BC6\u7EC4\u7EC7\u7BA1\u7406\u5458\u628A\u4F60\u52A0\u8FDB\u65B9\u6CD5\u8BBA\u4ED3\uFF08\u8981\u4EE3\u7801\u8BFB\u6743\u9650\uFF09" + (overridden ? "\uFF1B\u4F60\u8BBE\u4E86 HCM_METHOD_REPO / HCM_METHOD_REPO_URL\uFF0C\u5148\u6838\u5BF9\u62FC\u5199" : "")
@@ -14443,14 +14693,14 @@ function classifyGitFailure(e, repoDisplay) {
14443
14693
  });
14444
14694
  }
14445
14695
  if (/Could not resolve host|Failed to connect|Connection refused|Connection timed out|Operation timed out|Network is unreachable|Could not connect|SSL|TLS|timed out/i.test(text)) {
14446
- return new CliError32({
14447
- code: CliErrorCode34.METHOD_SOURCE_NETWORK,
14696
+ return new CliError33({
14697
+ code: CliErrorCode35.METHOD_SOURCE_NETWORK,
14448
14698
  message: `\u8FDE\u4E0D\u4E0A\u65B9\u6CD5\u8BBA\u4ED3\uFF08${repoDisplay}\uFF09\uFF1A${head}`,
14449
14699
  context: { nextStep: "\u67E5\u7F51\u7EDC\u6216\u4EE3\u7406\u540E\u91CD\u8DD1\uFF1B\u5DF2\u88C5\u7684\u65B9\u6CD5\u5305\u79BB\u7EBF\u53EF\u8BFB\uFF0C`hcm chiron method status` \u7167\u5E38\u80FD\u7528" }
14450
14700
  });
14451
14701
  }
14452
- return new CliError32({
14453
- code: CliErrorCode34.METHOD_SOURCE_GIT_FAILED,
14702
+ return new CliError33({
14703
+ code: CliErrorCode35.METHOD_SOURCE_GIT_FAILED,
14454
14704
  message: `git \u5931\u8D25\u4E86\uFF0C\u539F\u56E0\u4E0D\u5728\u8BA4\u8BC1 / \u6743\u9650 / \u7F51\u7EDC\u4E09\u7C7B\u91CC\uFF08${repoDisplay}\uFF09\uFF1A${head}`,
14455
14705
  context: { nextStep: `\u81EA\u5DF1\u8DD1\u4E00\u6B21 \`git ls-remote --tags <\u65B9\u6CD5\u8BBA\u4ED3\u5730\u5740>\` \u770B\u539F\u8BDD\uFF1B\u628A\u4E0A\u9762\u8FD9\u6BB5\u8FDE\u540C \`git --version\` \u62A5\u7ED9 CLI \u7EF4\u62A4\u8005` }
14456
14706
  });
@@ -14554,8 +14804,8 @@ function resolveRef(tags, ref, deps) {
14554
14804
  if (ref === void 0) {
14555
14805
  const latest = versions[0];
14556
14806
  if (!latest) {
14557
- throw new CliError32({
14558
- code: CliErrorCode34.METHOD_REF_NOT_FOUND,
14807
+ throw new CliError33({
14808
+ code: CliErrorCode35.METHOD_REF_NOT_FOUND,
14559
14809
  message: `\u65B9\u6CD5\u8BBA\u4ED3 ${deps.repoDisplay} \u91CC\u4E00\u4E2A vX.Y.Z \u5F62\u5F0F\u7684\u7248\u672C tag \u90FD\u6CA1\u6709`,
14560
14810
  context: { nextStep: tags.size ? `\u4ED3\u91CC\u6709\u8FD9\u4E9B tag\uFF1A${[...tags.keys()].slice(0, 10).join("\u3001")}\uFF0C\u7528 --ref \u6307\u5B9A\u4E00\u4E2A` : "\u65B9\u6CD5\u8BBA\u4ED3\u8FD8\u6CA1\u53D1\u8FC7\u7248\uFF0C\u627E\u65B9\u6CD5\u8D1F\u8D23\u4EBA\u786E\u8BA4" }
14561
14811
  });
@@ -14564,8 +14814,8 @@ function resolveRef(tags, ref, deps) {
14564
14814
  }
14565
14815
  const name = tags.has(ref) ? ref : tags.has(`v${ref}`) ? `v${ref}` : void 0;
14566
14816
  if (!name) {
14567
- throw new CliError32({
14568
- code: CliErrorCode34.METHOD_REF_NOT_FOUND,
14817
+ throw new CliError33({
14818
+ code: CliErrorCode35.METHOD_REF_NOT_FOUND,
14569
14819
  message: `\u65B9\u6CD5\u8BBA\u4ED3 ${deps.repoDisplay} \u91CC\u6CA1\u6709 tag ${ref}`,
14570
14820
  context: { nextStep: versions.length ? `\u53EF\u7528\u7684\u7248\u672C tag\uFF1A${versions.slice(0, 10).join("\u3001")}` : "\u65B9\u6CD5\u8BBA\u4ED3\u8FD8\u6CA1\u53D1\u8FC7\u7248\uFF0C\u627E\u65B9\u6CD5\u8D1F\u8D23\u4EBA\u786E\u8BA4" }
14571
14821
  });
@@ -14573,8 +14823,8 @@ function resolveRef(tags, ref, deps) {
14573
14823
  return { ref: name, commit: tags.get(name) };
14574
14824
  }
14575
14825
  function invalidPackage(field, message) {
14576
- return new CliError32({
14577
- code: CliErrorCode34.METHOD_PACKAGE_INVALID,
14826
+ return new CliError33({
14827
+ code: CliErrorCode35.METHOD_PACKAGE_INVALID,
14578
14828
  message: `\u65B9\u6CD5\u5305\u6E05\u5355 package.yml \u4E0D\u5408\u683C\uFF1A${message}`,
14579
14829
  context: { field, nextStep: "\u8FD9\u662F\u65B9\u6CD5\u5305\u7684\u7F3A\u9677\uFF0C\u4E0D\u662F\u672C\u673A\u95EE\u9898\uFF1A\u628A\u8FD9\u6BB5\u62A5\u7ED9\u65B9\u6CD5\u8BBA\u4ED3\u8D1F\u8D23\u4EBA\u3002\u5DF2\u88C5\u7684\u65B9\u6CD5\u5305\uFF08\u5982\u6709\uFF09\u4FDD\u6301\u539F\u6837\uFF0C\u6CA1\u52A8" }
14580
14830
  });
@@ -14598,8 +14848,8 @@ function parsePackageManifest(text) {
14598
14848
  throw invalidPackage("schemaVersion", "\u7F3A schemaVersion\uFF08\u6574\u6570\uFF09");
14599
14849
  }
14600
14850
  if (!KNOWN_PACKAGE_SCHEMA_VERSIONS.includes(m.schemaVersion)) {
14601
- throw new CliError32({
14602
- code: CliErrorCode34.METHOD_PACKAGE_SCHEMA_UNSUPPORTED,
14851
+ throw new CliError33({
14852
+ code: CliErrorCode35.METHOD_PACKAGE_SCHEMA_UNSUPPORTED,
14603
14853
  message: `\u65B9\u6CD5\u5305\u6E05\u5355\u7684\u683C\u5F0F\u7248\u672C schemaVersion=${m.schemaVersion}\uFF0C\u8FD9\u7248 CLI\uFF08${CLI_VERSION}\uFF09\u53EA\u8BA4\u8BC6 ${KNOWN_PACKAGE_SCHEMA_VERSIONS.join(" / ")}`,
14604
14854
  context: { nextStep: "\u5347\u7EA7 CLI\uFF1A`npm install --global @hcmai/cli@latest`\uFF08\u6216 `hcm upgrade`\uFF09\uFF0C\u518D\u91CD\u8DD1\u3002\u5DF2\u88C5\u7684\u65B9\u6CD5\u5305\uFF08\u5982\u6709\uFF09\u4FDD\u6301\u539F\u6837\uFF0C\u6CA1\u52A8" }
14605
14855
  });
@@ -14813,7 +15063,7 @@ async function checkMethodConflicts(methodIds, root, online, deps) {
14813
15063
  b.conflicts = b.compared.filter((id) => wanted.has(id)).map((id) => ({ id, other: where }));
14814
15064
  }
14815
15065
  } catch (e) {
14816
- const reason = e instanceof CliError32 && typeof e.context?.reason === "string" ? `\uFF1A${e.context.reason}` : "";
15066
+ const reason = e instanceof CliError33 && typeof e.context?.reason === "string" ? `\uFF1A${e.context.reason}` : "";
14817
15067
  b.note = `\u53D6\u4E0D\u5230 ${online.endpoint} \u7684\u5728\u7EBF\u76EE\u5F55\uFF08${e.message.split("\n")[0]}${reason}\uFF09\uFF0C\u5728\u7EBF\u76EE\u5F55\u672A\u6BD4\u5BF9`;
14818
15068
  }
14819
15069
  }
@@ -14836,8 +15086,8 @@ function renderConflictBlocks(blocks) {
14836
15086
  }
14837
15087
  function conflictError(blocks, pkg, commit) {
14838
15088
  const hits = blocks.flatMap((b) => b.conflicts);
14839
- return new CliError32({
14840
- code: CliErrorCode34.SKILL_ID_CONFLICT,
15089
+ return new CliError33({
15090
+ code: CliErrorCode35.SKILL_ID_CONFLICT,
14841
15091
  message: "\u65B9\u6CD5\u5305\u91CC\u7684\u6280\u80FD id \u4E0E\u5DF2\u6709\u6765\u6E90\u540C\u540D\uFF0C\u62D2\u88C5\uFF1A\n" + hits.map((c2) => ` \xB7 \`${c2.id}\`\uFF1A\u65B9\u6CD5 ${pkg.version} @${commit.slice(0, 12)} \u2194 ${c2.other}`).join("\n") + "\n\u672C\u8D9F\u51B2\u7A81\u68C0\u67E5\uFF1A\n" + renderConflictBlocks(blocks).join("\n"),
14842
15092
  context: {
14843
15093
  nextStep: `\u62A5\u65B9\u6CD5\u8D1F\u8D23\u4EBA\u6539\u540D\u3002\`${METHOD_SKILL_PREFIX}\` \u524D\u7F00\u53EA\u7ED9\u65B9\u6CD5\u6765\u6E90\uFF0C\u7EA6\u5B9A\u751F\u6548\u65F6\u4E0D\u8BE5\u649E\u540D\uFF1B\u649E\u4E86\u8BF4\u660E\u6709\u4E00\u8FB9\u8FDD\u53CD\u4E86\u524D\u7F00\u7EA6\u5B9A\u3002\u5DF2\u88C5\u7684\u65B9\u6CD5\u5305\uFF08\u5982\u6709\uFF09\u4FDD\u6301\u539F\u6837\uFF0C\u6CA1\u52A8`,
@@ -14852,8 +15102,8 @@ function upsertManagedBlock(existing, begin, end, block, label) {
14852
15102
  const finish = existing.indexOf(end);
14853
15103
  const malformed = start < 0 !== finish < 0 || start >= 0 && (finish < start || existing.lastIndexOf(begin) !== start || existing.lastIndexOf(end) !== finish);
14854
15104
  if (malformed) {
14855
- throw new CliError32({
14856
- code: CliErrorCode34.METHOD_MANAGED_BLOCK_CORRUPT,
15105
+ throw new CliError33({
15106
+ code: CliErrorCode35.METHOD_MANAGED_BLOCK_CORRUPT,
14857
15107
  message: `${label} \u91CC\u65B9\u6CD5\u53D7\u7BA1\u5757\u7684\u6807\u8BB0\u635F\u574F\u6216\u91CD\u590D\uFF08${begin} \u2026 ${end}\uFF09\uFF0C\u62D2\u7EDD\u8986\u76D6`,
14858
15108
  context: { nextStep: `\u624B\u5DE5\u628A ${label} \u91CC\u8FD9\u4E24\u884C\u6807\u8BB0\u4FEE\u6210\u5404\u51FA\u73B0\u4E00\u6B21\u3001begin \u5728\u524D\uFF08\u6216\u8FDE\u540C\u4E2D\u95F4\u5185\u5BB9\u6574\u6BB5\u5220\u6389\uFF09\uFF0C\u518D\u91CD\u8DD1` }
14859
15109
  });
@@ -14917,8 +15167,8 @@ async function readLock(root) {
14917
15167
  if (e.code === "ENOENT") return void 0;
14918
15168
  throw e;
14919
15169
  }
14920
- const bad = (why) => new CliError32({
14921
- code: CliErrorCode34.METHOD_LOCK_INVALID,
15170
+ const bad = (why) => new CliError33({
15171
+ code: CliErrorCode35.METHOD_LOCK_INVALID,
14922
15172
  message: `\u9501\u6587\u4EF6 ${METHOD_DIR}/${METHOD_LOCK_FILE} \u8BFB\u4E0D\u61C2\uFF1A${why}`,
14923
15173
  context: { nextStep: "\u591A\u534A\u662F\u5408\u5E76\u51B2\u7A81\u7559\u4E0B\u7684\u6807\u8BB0\uFF1A\u6309\u9879\u76EE PR \u91CC\u60F3\u8981\u7684\u90A3\u4E00\u7248\u89E3\u51B3\u51B2\u7A81\uFF08\u6216 `git checkout` \u56DE\u4E0A\u4E00\u7248\uFF09\uFF0C\u518D\u8DD1 `hcm chiron method status`" }
14924
15174
  });
@@ -14958,7 +15208,7 @@ async function resolveMethodRoot(project2, log) {
14958
15208
  async function resolveTarget(root, requested) {
14959
15209
  if (requested === "claude" || requested === "codex") return requested;
14960
15210
  if (requested !== void 0 && requested !== "auto") {
14961
- throw new CliError32({ code: CliErrorCode34.INVALID_ARGUMENT, message: `--target \u53EA\u8BA4 claude / codex / auto\uFF0C\u6536\u5230 ${requested}` });
15211
+ throw new CliError33({ code: CliErrorCode35.INVALID_ARGUMENT, message: `--target \u53EA\u8BA4 claude / codex / auto\uFF0C\u6536\u5230 ${requested}` });
14962
15212
  }
14963
15213
  return (await readState(root))?.target ?? await detectTarget(root) ?? "claude";
14964
15214
  }
@@ -15100,8 +15350,8 @@ async function runMethodPipeline(input, deps) {
15100
15350
  const tags = await listRemoteTags(deps);
15101
15351
  const r = resolveRef(tags, input.ref, deps);
15102
15352
  if (input.expectCommit && r.commit !== input.expectCommit) {
15103
- throw new CliError32({
15104
- code: CliErrorCode34.METHOD_TAG_MOVED,
15353
+ throw new CliError33({
15354
+ code: CliErrorCode35.METHOD_TAG_MOVED,
15105
15355
  message: `\u9501\u6587\u4EF6\u9501\u5B9A ${r.ref} @ ${input.expectCommit}\uFF0C\u800C\u8FD9\u4E2A tag \u73B0\u5728\u6307\u5411 ${r.commit}\uFF08tag \u88AB\u79FB\u52A8\u8FC7\uFF09`,
15106
15356
  context: { nextStep: "\u627E\u65B9\u6CD5\u8D1F\u8D23\u4EBA\u786E\u8BA4\u8FD9\u4E2A tag \u4E3A\u4EC0\u4E48\u88AB\u79FB\u52A8\u3002\u786E\u8BA4\u8981\u8DDF\u65B0\u5185\u5BB9\u5C31 `hcm chiron method update --ref <tag>`\uFF08\u9501\u6587\u4EF6\u7684\u53D8\u66F4\u8D70\u9879\u76EE PR \u8BC4\u5BA1\uFF09" }
15107
15357
  });
@@ -15116,8 +15366,8 @@ async function runMethodPipeline(input, deps) {
15116
15366
  await deps.git(["clone", "--depth", "1", "--filter=blob:none", "--sparse", "--quiet", "--branch", resolved.ref, deps.repoUrl, checkout]);
15117
15367
  const head = (await deps.git(["-C", checkout, "rev-parse", "HEAD"], { timeoutMs: 1e4 })).trim();
15118
15368
  if (head !== resolved.commit) {
15119
- throw new CliError32({
15120
- code: CliErrorCode34.METHOD_TAG_MOVED,
15369
+ throw new CliError33({
15370
+ code: CliErrorCode35.METHOD_TAG_MOVED,
15121
15371
  message: `\u89E3\u6790\u65F6 ${resolved.ref} \u6307\u5411 ${resolved.commit}\uFF0C\u53D6\u4E0B\u6765\u7684\u5374\u662F ${head}\uFF08tag \u5728\u8FD9\u51E0\u79D2\u91CC\u88AB\u79FB\u52A8\u4E86\uFF09`,
15122
15372
  context: { nextStep: "\u91CD\u8DD1\u4E00\u6B21\uFF1B\u518D\u51FA\u73B0\u5C31\u627E\u65B9\u6CD5\u8D1F\u8D23\u4EBA\u786E\u8BA4\u8FD9\u4E2A tag \u4E3A\u4EC0\u4E48\u5728\u52A8" }
15123
15373
  });
@@ -15296,7 +15546,7 @@ async function runMethodStatus(root, deps, opts = {}) {
15296
15546
  verdict: "fail",
15297
15547
  detail: `\u6CA1\u6709 ${METHOD_DIR}/${METHOD_LOCK_FILE}\uFF1A\u8FD9\u4E2A\u9879\u76EE\u8FD8\u6CA1\u88C5\u65B9\u6CD5\u5305`,
15298
15548
  nextStep: "\u6709\u77E5\u8BC6\u7EC4\u7EC7\u6388\u6743\u5C31\u8DD1 `hcm chiron method install`\uFF1B\u6CA1\u6709\u6388\u6743\u53EF\u4EE5\u8DF3\u8FC7\uFF0C\u4E0D\u5F71\u54CD\u4EA7\u54C1\u64CD\u4F5C",
15299
- code: CliErrorCode34.METHOD_NOT_INSTALLED
15549
+ code: CliErrorCode35.METHOD_NOT_INSTALLED
15300
15550
  });
15301
15551
  return done();
15302
15552
  }
@@ -15310,7 +15560,7 @@ async function runMethodStatus(root, deps, opts = {}) {
15310
15560
  verdict: "fail",
15311
15561
  detail: "\u9501\u6587\u4EF6\u5728\uFF0C\u4F46\u672C\u673A\u6CA1\u6709\u65B9\u6CD5\u5305\u526F\u672C\uFF08\u521A clone \u4E0B\u6765\u7684\u9879\u76EE\u4ED3\u5C31\u662F\u8FD9\u6837\uFF09",
15312
15562
  nextStep: "`hcm chiron method install`\uFF08\u6309\u9501\u6587\u4EF6\u7684\u7248\u672C\u88C5\uFF09",
15313
- code: CliErrorCode34.METHOD_NOT_INSTALLED
15563
+ code: CliErrorCode35.METHOD_NOT_INSTALLED
15314
15564
  });
15315
15565
  } else {
15316
15566
  report.installed.present = true;
@@ -15321,7 +15571,7 @@ async function runMethodStatus(root, deps, opts = {}) {
15321
15571
  verdict: "fail",
15322
15572
  detail: "\u672C\u673A\u526F\u672C\u7684 package.yml \u4E0E\u9501\u6587\u4EF6\u8BB0\u7684\u6458\u8981\u4E0D\u4E00\u81F4\uFF1A\u88C5\u7684\u4E0D\u662F\u9501\u5B9A\u7684\u90A3\u4E00\u7248",
15323
15573
  nextStep: "`hcm chiron method install`\uFF08\u6309\u9501\u6587\u4EF6\u7684 commit \u91CD\u88C5\uFF09",
15324
- code: CliErrorCode34.METHOD_DIGEST_MISMATCH
15574
+ code: CliErrorCode35.METHOD_DIGEST_MISMATCH
15325
15575
  });
15326
15576
  } else {
15327
15577
  report.rows.push({ item: "\u5B89\u88C5", verdict: "ok", detail: `\u672C\u673A\u526F\u672C\u5C31\u662F\u9501\u5B9A\u7684\u90A3\u4E00\u7248\uFF08${path13.join(root, METHOD_DIR)}/\uFF09` });
@@ -15365,13 +15615,13 @@ async function runMethodStatus(root, deps, opts = {}) {
15365
15615
  verdict: "fail",
15366
15616
  detail: `${bad.length} \u4EFD .claude/skills \u65B9\u6CD5\u526F\u672C\u4E0E\u9501\u5B9A\u7248\u672C\u4E0D\u7B26\uFF08\u8FD9\u53F0\u673A\u5668\u73B0\u5728\u7684 target \u662F ${state.target}\uFF0C\u8FD9\u4E9B\u526F\u672C\u662F\u4E4B\u524D\u7528 claude \u76EE\u6807\u88C5\u65F6\u7559\u4E0B\u7684\uFF09\uFF1A${listing}`,
15367
15617
  nextStep: "`hcm chiron method install`\uFF08\u4F1A\u4E00\u5E76\u5237\u65B0 .claude/skills \u4E0B\u5DF2\u6709\u7684\u65B9\u6CD5\u526F\u672C\uFF09\uFF1B\u4E0D\u518D\u7528 Claude Code \u5C31\u5220\u6389 `.claude/skills/method-*/`",
15368
- code: CliErrorCode34.METHOD_DIGEST_MISMATCH
15618
+ code: CliErrorCode35.METHOD_DIGEST_MISMATCH
15369
15619
  } : {
15370
15620
  item: "\u6458\u8981",
15371
15621
  verdict: "fail",
15372
15622
  detail: `${bad.length} \u4EFD\u6587\u4EF6\u4E0E\u6E05\u5355\u4E0D\u7B26\uFF1A${listing}`,
15373
15623
  nextStep: "`hcm chiron method install`\uFF08\u6309\u9501\u6587\u4EF6\u7684 commit \u91CD\u88C5\uFF0C\u672C\u673A\u6539\u52A8\u4F1A\u88AB\u8986\u76D6\uFF1B\u8981\u6539\u65B9\u6CD5\u5C31\u53BB\u65B9\u6CD5\u8BBA\u4ED3\u63D0\uFF09",
15374
- code: CliErrorCode34.METHOD_DIGEST_MISMATCH
15624
+ code: CliErrorCode35.METHOD_DIGEST_MISMATCH
15375
15625
  });
15376
15626
  } else {
15377
15627
  report.rows.push({
@@ -15394,7 +15644,7 @@ async function runMethodStatus(root, deps, opts = {}) {
15394
15644
  verdict: "warn",
15395
15645
  detail: `tag ${lock.ref} \u73B0\u5728\u6307\u5411 ${report.remote.lockedTagCommit.slice(0, 12)}\uFF0C\u9501\u5B9A\u7684\u662F ${lock.commit.slice(0, 12)}\uFF08tag \u88AB\u79FB\u52A8\u8FC7\uFF1B\u672C\u673A\u526F\u672C\u4EE5\u9501\u5B9A\u7684 commit \u4E3A\u51C6\uFF09`,
15396
15646
  nextStep: "\u627E\u65B9\u6CD5\u8D1F\u8D23\u4EBA\u786E\u8BA4 tag \u4E3A\u4EC0\u4E48\u88AB\u79FB\u52A8\uFF1B\u8981\u8DDF\u65B0\u5185\u5BB9\u5C31 `hcm chiron method update --ref <tag>`",
15397
- code: CliErrorCode34.METHOD_TAG_MOVED
15647
+ code: CliErrorCode35.METHOD_TAG_MOVED
15398
15648
  });
15399
15649
  } else if (!SEMVER_TAG.test(lock.ref) || !report.remote.latestTag) {
15400
15650
  report.remote.undetermined = !SEMVER_TAG.test(lock.ref) ? `\u9501\u5B9A\u7684 ref ${lock.ref} \u4E0D\u662F vX.Y.Z \u7248\u672C tag\uFF0C\u65E0\u6CD5\u5224\u65AD\u662F\u5426\u843D\u540E\uFF08\u8FDC\u7AEF\u6700\u65B0\u7248\u672C tag\uFF1A${report.remote.latestTag ?? "\u65E0"}\uFF09` : "\u8FDC\u7AEF\u4E00\u4E2A vX.Y.Z \u7248\u672C tag \u90FD\u6CA1\u6709\uFF0C\u65E0\u6CD5\u5224\u65AD\u662F\u5426\u843D\u540E";
@@ -15439,7 +15689,7 @@ async function runMethodStatus(root, deps, opts = {}) {
15439
15689
  const hits = report.conflictCheck.flatMap((b) => b.conflicts);
15440
15690
  const unchecked = report.conflictCheck.filter((b) => !b.checked);
15441
15691
  const summary = report.conflictCheck.map((b) => b.checked ? `${b.label}\uFF1A\u5DF2\u6BD4\u5BF9 ${b.compared.length} \u4E2A${b.conflicts.length ? `\uFF0C\u540C\u540D ${b.conflicts.map((c2) => c2.id).join("\u3001")}` : "\uFF0C\u65E0\u540C\u540D"}` : `${b.label}\uFF1A\u672A\u6BD4\u5BF9\uFF08${b.note}\uFF09`).join("\uFF1B");
15442
- report.rows.push(hits.length ? { item: "\u51B2\u7A81", verdict: "fail", detail: summary, nextStep: "\u62A5\u65B9\u6CD5\u8D1F\u8D23\u4EBA\u6539\u540D\uFF08method- \u524D\u7F00\u53EA\u7ED9\u65B9\u6CD5\u6765\u6E90\uFF09", code: CliErrorCode34.SKILL_ID_CONFLICT } : unchecked.length ? { item: "\u51B2\u7A81", verdict: "warn", detail: `${summary}\u2014\u2014\u6CA1\u6BD4\u5BF9\u7684\u5757\u4E0A\u4E0D\u80FD\u8BF4\u300C\u65E0\u51B2\u7A81\u300D` } : { item: "\u51B2\u7A81", verdict: "ok", detail: summary });
15692
+ report.rows.push(hits.length ? { item: "\u51B2\u7A81", verdict: "fail", detail: summary, nextStep: "\u62A5\u65B9\u6CD5\u8D1F\u8D23\u4EBA\u6539\u540D\uFF08method- \u524D\u7F00\u53EA\u7ED9\u65B9\u6CD5\u6765\u6E90\uFF09", code: CliErrorCode35.SKILL_ID_CONFLICT } : unchecked.length ? { item: "\u51B2\u7A81", verdict: "warn", detail: `${summary}\u2014\u2014\u6CA1\u6BD4\u5BF9\u7684\u5757\u4E0A\u4E0D\u80FD\u8BF4\u300C\u65E0\u51B2\u7A81\u300D` } : { item: "\u51B2\u7A81", verdict: "ok", detail: summary });
15443
15693
  }
15444
15694
  report.rows.push(report.remote.checked ? { item: "\u6765\u6E90", verdict: "ok", detail: `\u5728\u7EBF\uFF1Agit \u51ED\u636E\u8BA4\u8BC1\u53D6 tag\uFF0Ccommit \u56FA\u5B9A\uFF08${lock.repo}\uFF09` } : { item: "\u6765\u6E90", verdict: "warn", detail: "\u79BB\u7EBF\uFF1A\u53EA\u6838\u4E86\u672C\u673A\u526F\u672C\u7684\u6458\u8981\uFF0C\u6CA1\u4E0E\u8FDC\u7AEF\u6838\u5BF9 tag" });
15445
15695
  return done();
@@ -15458,10 +15708,10 @@ async function inspectMethodForDoctor(root, deps = quietDeps()) {
15458
15708
  const row = (item) => s.rows.find((r) => r.item === item);
15459
15709
  const lockRow = row("\u9501\u5B9A");
15460
15710
  if (!s.lock) {
15461
- return lockRow.code === CliErrorCode34.METHOD_NOT_INSTALLED ? { verdict: "warn", detail: "\u672A\u5B89\u88C5\uFF08\u9879\u76EE\u91CC\u6CA1\u6709\u65B9\u6CD5\u5305\u9501\u6587\u4EF6\uFF09", nextStep: "\u6709\u77E5\u8BC6\u7EC4\u7EC7\u6388\u6743\u5C31\u8DD1 `hcm chiron method install`\uFF1B\u6CA1\u6709\u6388\u6743\u53EF\u4EE5\u8DF3\u8FC7\uFF0C\u4E0D\u5F71\u54CD\u4EA7\u54C1\u64CD\u4F5C" } : { verdict: "warn", detail: `\u65E0\u6CD5\u5224\u65AD\uFF1A${lockRow.detail}`, nextStep: lockRow.nextStep };
15711
+ return lockRow.code === CliErrorCode35.METHOD_NOT_INSTALLED ? { verdict: "warn", detail: "\u672A\u5B89\u88C5\uFF08\u9879\u76EE\u91CC\u6CA1\u6709\u65B9\u6CD5\u5305\u9501\u6587\u4EF6\uFF09", nextStep: "\u6709\u77E5\u8BC6\u7EC4\u7EC7\u6388\u6743\u5C31\u8DD1 `hcm chiron method install`\uFF1B\u6CA1\u6709\u6388\u6743\u53EF\u4EE5\u8DF3\u8FC7\uFF0C\u4E0D\u5F71\u54CD\u4EA7\u54C1\u64CD\u4F5C" } : { verdict: "warn", detail: `\u65E0\u6CD5\u5224\u65AD\uFF1A${lockRow.detail}`, nextStep: lockRow.nextStep };
15462
15712
  }
15463
15713
  const install = row("\u5B89\u88C5");
15464
- if (install?.code === CliErrorCode34.METHOD_NOT_INSTALLED) {
15714
+ if (install?.code === CliErrorCode35.METHOD_NOT_INSTALLED) {
15465
15715
  return { verdict: "warn", detail: `\u672A\u5B89\u88C5\uFF08\u9501\u6587\u4EF6\u9501\u5B9A\u65B9\u6CD5 ${s.lock.package.version} \xB7 ${s.lock.ref}\uFF0C\u672C\u673A\u8FD8\u6CA1\u6709\u65B9\u6CD5\u5305\u526F\u672C\uFF09`, nextStep: "\u6709\u77E5\u8BC6\u7EC4\u7EC7\u6388\u6743\u5C31\u8DD1 `hcm chiron method install`\uFF08\u6309\u9501\u6587\u4EF6\u7684\u7248\u672C\u88C5\uFF09\uFF1B\u6CA1\u6709\u6388\u6743\u53EF\u4EE5\u8DF3\u8FC7\uFF0C\u4E0D\u5F71\u54CD\u4EA7\u54C1\u64CD\u4F5C" };
15466
15716
  }
15467
15717
  const local = [install, row("\u6458\u8981")].find((r) => r && r.verdict === "fail");
@@ -15478,7 +15728,7 @@ function quietDeps() {
15478
15728
  } };
15479
15729
  }
15480
15730
  function emit6(output, data, text) {
15481
- if (output === "json" || output === "yaml") process.stdout.write(formatObject29(data, { format: output }) + "\n");
15731
+ if (output === "json" || output === "yaml") process.stdout.write(formatObject30(data, { format: output }) + "\n");
15482
15732
  else process.stdout.write(text() + "\n");
15483
15733
  }
15484
15734
  async function runMethodInstall(args, deps = defaultMethodDeps()) {
@@ -15494,8 +15744,8 @@ async function runMethodUpdate(args, deps = defaultMethodDeps()) {
15494
15744
  const { root, rootSource } = await resolveMethodRoot(args.project, deps.log);
15495
15745
  const lock = await readLock(root);
15496
15746
  if (!lock) {
15497
- throw new CliError32({
15498
- code: CliErrorCode34.METHOD_NOT_INSTALLED,
15747
+ throw new CliError33({
15748
+ code: CliErrorCode35.METHOD_NOT_INSTALLED,
15499
15749
  message: `${root} \u91CC\u6CA1\u6709 ${METHOD_DIR}/${METHOD_LOCK_FILE}\uFF1A\u8FD9\u4E2A\u9879\u76EE\u8FD8\u6CA1\u88C5\u65B9\u6CD5\u5305\uFF0C\u6CA1\u6709\u53EF\u4EE5\u66F4\u65B0\u7684\u8D77\u70B9`,
15500
15750
  context: { nextStep: "`hcm chiron method install`\uFF08\u88C5\u6700\u65B0\u7684\u7248\u672C tag\uFF09" }
15501
15751
  });
@@ -15545,7 +15795,7 @@ async function methodStatusCommand(args) {
15545
15795
  import { promises as fs12 } from "fs";
15546
15796
  import path14 from "path";
15547
15797
  import axios6 from "axios";
15548
- import { CliError as CliError33, CliErrorCode as CliErrorCode35, fetchSkillCatalog as fetchSkillCatalog3, fetchSkillMarkdown as fetchSkillMarkdown2, fetchSkillReference as fetchSkillReference2, normalizeReferences as normalizeReferences2, normalizeOrigin as normalizeOrigin6, resolveChironBase as resolveChironBase3 } from "@hcmai/sdk";
15798
+ import { CliError as CliError34, CliErrorCode as CliErrorCode36, fetchSkillCatalog as fetchSkillCatalog3, fetchSkillMarkdown as fetchSkillMarkdown2, fetchSkillReference as fetchSkillReference2, normalizeReferences as normalizeReferences2, normalizeOrigin as normalizeOrigin6, resolveChironBase as resolveChironBase3 } from "@hcmai/sdk";
15549
15799
 
15550
15800
  // src/commands/doctor/result.ts
15551
15801
  import { createHash as createHash7 } from "crypto";
@@ -15730,7 +15980,7 @@ async function inspectSkillsFresh(states, endpoint, signal) {
15730
15980
  const entries = plans.flatMap((p) => p.plan.entries);
15731
15981
  return classifySkillFreshness(states.length, entries, plans.flatMap((p) => p.mismatched));
15732
15982
  } catch (error) {
15733
- if (error instanceof CliError33 && error.code === CliErrorCode35.SKILL_CATALOG_UNAVAILABLE) {
15983
+ if (error instanceof CliError34 && error.code === CliErrorCode36.SKILL_CATALOG_UNAVAILABLE) {
15734
15984
  const reason = typeof error.context?.reason === "string" ? `\uFF1A${error.context.reason}` : "";
15735
15985
  const next = typeof error.context?.nextStep === "string" ? error.context.nextStep : void 0;
15736
15986
  return unknown("SKILLS_CATALOG_UNAVAILABLE", `\u670D\u52A1\u7AEF\u6280\u80FD\u76EE\u5F55\u4E0D\u53EF\u7528\uFF08${error.message}${reason}\uFF09\uFF0C\u672C\u8F6E\u6CA1\u6CD5\u5BF9\u8D26`, next ? { note: next } : {});
@@ -15864,7 +16114,7 @@ var localChecks = { project, credential, version, installed, fresh, shadow, boun
15864
16114
  // src/commands/doctor/connect-checks.ts
15865
16115
  init_auth_guard();
15866
16116
  import axios8 from "axios";
15867
- import { CliError as CliError34, IMPERSONATION_START_PATH, USER_LOOKUP_PATH, probeDoctorEndpoint, probeDoctorLayer, layerDetail, toPrincipal as toPrincipal3 } from "@hcmai/sdk";
16117
+ import { CliError as CliError35, IMPERSONATION_START_PATH, USER_LOOKUP_PATH, probeDoctorEndpoint, probeDoctorLayer, layerDetail, toPrincipal as toPrincipal3 } from "@hcmai/sdk";
15868
16118
 
15869
16119
  // src/commands/doctor/server-report.ts
15870
16120
  import axios7 from "axios";
@@ -16240,8 +16490,8 @@ var identity = async (ctx, env2, execution) => {
16240
16490
  if (execution.signal.aborted) await e.close?.();
16241
16491
  return observation;
16242
16492
  } catch (error) {
16243
- const detail = error instanceof CliError34 ? error.context : void 0;
16244
- const errorCode = error instanceof CliError34 ? error.code : void 0;
16493
+ const detail = error instanceof CliError35 ? error.context : void 0;
16494
+ const errorCode = error instanceof CliError35 ? error.code : void 0;
16245
16495
  const actorStep = error !== null && typeof error === "object" ? error[AS_ACTOR_STEP] : void 0;
16246
16496
  if (actorStep) {
16247
16497
  const actorCode = actorStep === "meta" || actorStep === "env" ? "IDENTITY_META_INVALID" : actorStep === "resolve" && errorCode === "IDENTITY_NOT_FOUND" ? "IDENTITY_NOT_LOGGED_IN" : "IDENTITY_UNVERIFIED";
@@ -16857,8 +17107,8 @@ import { createHash as createHash8 } from "crypto";
16857
17107
  import axios9 from "axios";
16858
17108
  import {
16859
17109
  classifyStatus as classifyStatus2,
16860
- CliError as CliError35,
16861
- CliErrorCode as CliErrorCode36,
17110
+ CliError as CliError36,
17111
+ CliErrorCode as CliErrorCode37,
16862
17112
  loadGlobalConfig as loadGlobalConfig11,
16863
17113
  printResolvedEnvironment as printResolvedEnvironment8,
16864
17114
  resolveEnvContext as resolveEnvContext8
@@ -16966,11 +17216,11 @@ async function readPlatformOpsKey(args, io = {
16966
17216
  } else if (io.isTTY) {
16967
17217
  source = "tty";
16968
17218
  key2 = await io.prompt();
16969
- } else throw new CliError35({ code: CliErrorCode36.INVALID_ARGUMENT, message: blank ? "HCM_PLATFORM_OPS_KEY \u5DF2\u8BBE\u7F6E\u4F46\u5168\u662F\u7A7A\u767D\uFF0C\u5DF2\u5FFD\u7565\uFF1A\u628A\u5BC6\u94A5\u5199\u8FDB\u8BE5\u53D8\u91CF\u3001\u4F7F\u7528 --platform-ops-key-stdin\uFF0C\u6216\u5728 TTY \u4EA4\u4E92\u8F93\u5165" : "\u7F3A\u5C11\u8FD0\u7EF4\u5BC6\u94A5\uFF1A\u8BBE\u7F6E HCM_PLATFORM_OPS_KEY\u3001\u4F7F\u7528 --platform-ops-key-stdin\uFF0C\u6216\u5728 TTY \u4EA4\u4E92\u8F93\u5165" });
17219
+ } else throw new CliError36({ code: CliErrorCode37.INVALID_ARGUMENT, message: blank ? "HCM_PLATFORM_OPS_KEY \u5DF2\u8BBE\u7F6E\u4F46\u5168\u662F\u7A7A\u767D\uFF0C\u5DF2\u5FFD\u7565\uFF1A\u628A\u5BC6\u94A5\u5199\u8FDB\u8BE5\u53D8\u91CF\u3001\u4F7F\u7528 --platform-ops-key-stdin\uFF0C\u6216\u5728 TTY \u4EA4\u4E92\u8F93\u5165" : "\u7F3A\u5C11\u8FD0\u7EF4\u5BC6\u94A5\uFF1A\u8BBE\u7F6E HCM_PLATFORM_OPS_KEY\u3001\u4F7F\u7528 --platform-ops-key-stdin\uFF0C\u6216\u5728 TTY \u4EA4\u4E92\u8F93\u5165" });
16970
17220
  if (blank) io.stderr(`HCM_PLATFORM_OPS_KEY \u5168\u662F\u7A7A\u767D\uFF0C\u5DF2\u5FFD\u7565\uFF1B\u6539\u4ECE ${source} \u8BFB\u53D6
16971
17221
  `);
16972
17222
  key2 = key2.trim();
16973
- if (!key2) throw new CliError35({ code: CliErrorCode36.INVALID_ARGUMENT, message: "\u8FD0\u7EF4\u5BC6\u94A5\u4E3A\u7A7A" });
17223
+ if (!key2) throw new CliError36({ code: CliErrorCode37.INVALID_ARGUMENT, message: "\u8FD0\u7EF4\u5BC6\u94A5\u4E3A\u7A7A" });
16974
17224
  io.stderr(`\u8FD0\u7EF4\u5BC6\u94A5\u6765\u6E90\uFF1A${source} \xB7 \u6307\u7EB9 ${opsKeyFingerprint(key2)}
16975
17225
  `);
16976
17226
  return { key: key2, source };
@@ -16979,12 +17229,12 @@ var split = (value) => (Array.isArray(value) ? value : value ? [value] : []).fla
16979
17229
  function scopeFor(args) {
16980
17230
  const only = split(args.only), skip = split(args.skip);
16981
17231
  for (const token of [...only, ...skip]) if (!("platform.".startsWith(token) || token.startsWith("platform.")))
16982
- throw new CliError35({
16983
- code: CliErrorCode36.INVALID_ARGUMENT,
17232
+ throw new CliError36({
17233
+ code: CliErrorCode37.INVALID_ARGUMENT,
16984
17234
  message: `\u8FD0\u7EF4\u89C6\u56FE\u53EA\u770B\u5E73\u53F0\u5C42\uFF1A--only / --skip \u53EA\u63A5\u53D7 platform \u524D\u7F00\uFF0C\u6536\u5230 ${token}`
16985
17235
  });
16986
- if (skip.some((token) => "platform.".startsWith(token))) throw new CliError35({
16987
- code: CliErrorCode36.INVALID_ARGUMENT,
17236
+ if (skip.some((token) => "platform.".startsWith(token))) throw new CliError36({
17237
+ code: CliErrorCode37.INVALID_ARGUMENT,
16988
17238
  message: "\u6392\u9664\u4E86\u5E73\u53F0\u5C42\uFF0C\u8FD0\u7EF4\u89C6\u56FE\u6CA1\u6709\u53EF\u770B\u7684\u68C0\u67E5"
16989
17239
  });
16990
17240
  return {
@@ -17140,7 +17390,7 @@ function failure(ctx, env2, health, key2) {
17140
17390
  }
17141
17391
  var ENV_HINT = "hcm env list \u67E5\u770B\u53EF\u9009\u73AF\u5883\uFF1Bhcm env add <\u540D> --endpoint <url> \u767B\u8BB0";
17142
17392
  function resolverMessage(error) {
17143
- if (error instanceof CliError35 && error.code === CliErrorCode36.NO_ACTIVE_ENV) return "\u672A\u9009\u5B9A\u73AF\u5883\uFF1A\u7528 --env <\u540D> \u6307\u5B9A";
17393
+ if (error instanceof CliError36 && error.code === CliErrorCode37.NO_ACTIVE_ENV) return "\u672A\u9009\u5B9A\u73AF\u5883\uFF1A\u7528 --env <\u540D> \u6307\u5B9A";
17144
17394
  return (error instanceof Error ? error.message : safeError(error)).replace(/\s*(&&\s*)?hcm\s+login\b[^;;\n]*/gi, "");
17145
17395
  }
17146
17396
  async function runPlatformOps(args, services, readKey = readPlatformOpsKey, onReport) {
@@ -17149,10 +17399,10 @@ async function runPlatformOps(args, services, readKey = readPlatformOpsKey, onRe
17149
17399
  try {
17150
17400
  resolved = await resolveEnvContext8({ envFlag: args.env }, process.env, await loadGlobalConfig11());
17151
17401
  } catch (error2) {
17152
- throw new CliError35({ code: CliErrorCode36.INVALID_ARGUMENT, message: `${resolverMessage(error2)}\uFF1B${ENV_HINT}` });
17402
+ throw new CliError36({ code: CliErrorCode37.INVALID_ARGUMENT, message: `${resolverMessage(error2)}\uFF1B${ENV_HINT}` });
17153
17403
  }
17154
- if (!resolved.config.endpoint) throw new CliError35({
17155
- code: CliErrorCode36.INVALID_ARGUMENT,
17404
+ if (!resolved.config.endpoint) throw new CliError36({
17405
+ code: CliErrorCode37.INVALID_ARGUMENT,
17156
17406
  message: `\u672A\u89E3\u6790\u5230 endpoint\uFF1B${ENV_HINT}`
17157
17407
  });
17158
17408
  printResolvedEnvironment8(resolved);
@@ -17198,8 +17448,8 @@ async function runPlatformOps(args, services, readKey = readPlatformOpsKey, onRe
17198
17448
  const error = out && object(out.body) && object(out.body.error) ? out.body.error : void 0;
17199
17449
  if (out?.status === 400 && error?.code === "HEALTH_REPORT_INVALID_PARAM") {
17200
17450
  const trace = out.headers["x-trace-id"];
17201
- throw new CliError35({
17202
- code: CliErrorCode36.INVALID_ARGUMENT,
17451
+ throw new CliError36({
17452
+ code: CliErrorCode37.INVALID_ARGUMENT,
17203
17453
  message: `${typeof error.message === "string" ? redact(error.message, key2) : "\u8FD0\u7EF4\u68C0\u67E5\u8303\u56F4\u65E0\u6548"}${scope.only.length || scope.skip.length ? "\uFF1B\u53BB\u6389 --only / --skip \u91CD\u8DD1 hcm chiron doctor --platform-ops \u53EF\u770B\u5230\u5168\u90E8\u5E73\u53F0\u68C0\u67E5" : `\uFF1B\u672C\u6B21\u6CA1\u6709\u5E26 --only / --skip\uFF0C\u53C2\u6570\u4ECD\u88AB\u5224\u65E0\u6548\uFF0C\u5C5E\u670D\u52A1\u7AEF\u7F3A\u9677\uFF1A\u9644 traceId ${trace || "\uFF08\u54CD\u5E94\u672A\u5E26\uFF0C\u9644\u672C\u6B21\u65F6\u95F4\u4E0E\u73AF\u5883\u540D\uFF09"} \u8054\u7CFB\u7814\u53D1`}`
17204
17454
  });
17205
17455
  }
@@ -17506,13 +17756,13 @@ var defaultServices = {
17506
17756
  };
17507
17757
  function validate(args) {
17508
17758
  for (const [key2, value, choices] of [["output", args.output, ["table", "json", "yaml"]], ["fail-on", args.failOn, ["blocked", "risks"]]])
17509
- if (value !== void 0 && !choices.includes(value)) throw new CliError36({
17510
- code: CliErrorCode37.INVALID_ARGUMENT,
17759
+ if (value !== void 0 && !choices.includes(value)) throw new CliError37({
17760
+ code: CliErrorCode38.INVALID_ARGUMENT,
17511
17761
  message: `--${key2} \u53EA\u63A5\u53D7 ${choices.join(" / ")}\uFF0C\u6536\u5230 ${value}`
17512
17762
  });
17513
17763
  const stages = ["handover", "baseline", "configure", "migrate", "integrate", "golive", "operate"];
17514
- if (args.stage !== void 0 && !stages.includes(args.stage.toLowerCase())) throw new CliError36({
17515
- code: CliErrorCode37.INVALID_ARGUMENT,
17764
+ if (args.stage !== void 0 && !stages.includes(args.stage.toLowerCase())) throw new CliError37({
17765
+ code: CliErrorCode38.INVALID_ARGUMENT,
17516
17766
  message: `--stage \u53EA\u63A5\u53D7 ${stages.join(" / ")}\uFF0C\u6536\u5230 ${args.stage}`
17517
17767
  });
17518
17768
  if (args.platformOpsKeyStdin && !args.platformOps) invalidScope("--platform-ops-key-stdin \u53EA\u80FD\u4E0E --platform-ops \u540C\u7528");
@@ -17533,7 +17783,7 @@ var tokens = (value) => (Array.isArray(value) ? value : value ? [value] : []).fl
17533
17783
  var matches = (id, only, skip) => (!only.length || only.some((t) => id.startsWith(t))) && !skip.some((t) => id.startsWith(t));
17534
17784
  var serverCandidate = (t) => ["platform.", "tenant."].some((prefix) => prefix.startsWith(t) || t.startsWith(prefix));
17535
17785
  function invalidScope(message) {
17536
- throw new CliError36({ code: CliErrorCode37.INVALID_ARGUMENT, message });
17786
+ throw new CliError37({ code: CliErrorCode38.INVALID_ARGUMENT, message });
17537
17787
  }
17538
17788
  function scopeFor2(args, catalog) {
17539
17789
  const only = tokens(args.only), skip = tokens(args.skip), stage = args.stage?.toLowerCase() ?? null;
@@ -17568,7 +17818,7 @@ async function readCredential(envFlag, root, as) {
17568
17818
  try {
17569
17819
  resolved = await resolveEnvContext9({ envFlag, cwd: root }, process.env, await loadGlobalConfig12());
17570
17820
  } catch (error) {
17571
- if (error instanceof CliError36 && error.code === CliErrorCode37.ENV_NOT_FOUND) return { resolved: null };
17821
+ if (error instanceof CliError37 && error.code === CliErrorCode38.ENV_NOT_FOUND) return { resolved: null };
17572
17822
  throw error;
17573
17823
  }
17574
17824
  if (as) return { resolved };
@@ -17577,14 +17827,14 @@ async function readCredential(envFlag, root, as) {
17577
17827
  try {
17578
17828
  identity3 = await resolveActiveIdentity2({}, process.env, resolved.name);
17579
17829
  } catch (error) {
17580
- if (error instanceof CliError36 && error.code === CliErrorCode37.IDENTITY_NOT_FOUND) return { resolved, error: found("IDENTITY_NOT_LOGGED_IN") };
17830
+ if (error instanceof CliError37 && error.code === CliErrorCode38.IDENTITY_NOT_FOUND) return { resolved, error: found("IDENTITY_NOT_LOGGED_IN") };
17581
17831
  throw error;
17582
17832
  }
17583
17833
  let meta2;
17584
17834
  try {
17585
17835
  meta2 = await loadIdentity5(identity3);
17586
17836
  } catch (error) {
17587
- if (error instanceof CliError36 && error.code === CliErrorCode37.IDENTITY_NOT_FOUND) return { resolved, identity: identity3, error: found("IDENTITY_META_INVALID", `\u8EAB\u4EFD ${identity3} \u7684\u5143\u6570\u636E\u4E0D\u5B58\u5728\uFF1B\u91CD\u65B0\u767B\u5F55\u4FEE\u590D`) };
17837
+ if (error instanceof CliError37 && error.code === CliErrorCode38.IDENTITY_NOT_FOUND) return { resolved, identity: identity3, error: found("IDENTITY_META_INVALID", `\u8EAB\u4EFD ${identity3} \u7684\u5143\u6570\u636E\u4E0D\u5B58\u5728\uFF1B\u91CD\u65B0\u767B\u5F55\u4FEE\u590D`) };
17588
17838
  throw error;
17589
17839
  }
17590
17840
  if (!meta2.env || meta2.env !== resolved.name) return {
@@ -17626,7 +17876,7 @@ async function prepareContext(args, deps) {
17626
17876
  const detail = `${safeError(error)}\uFF1B\u53EF\u9009\u73AF\u5883\uFF1A${available.join(", ") || "\uFF08\u65E0\uFF09"}`;
17627
17877
  projectObservation = found("ENV_NOT_RESOLVED", detail);
17628
17878
  targetEnv = null;
17629
- const slotMissing = error instanceof CliError36 && error.code === CliErrorCode37.ENV_NOT_FOUND;
17879
+ const slotMissing = error instanceof CliError37 && error.code === CliErrorCode38.ENV_NOT_FOUND;
17630
17880
  const project2 = args.project !== void 0 ? ` --project ${quote(root)}` : "";
17631
17881
  const step2 = file ? `hcm chiron env add ${quote(args.env)} --endpoint <\u540E\u7AEF\u5730\u5740> --frontend <\u524D\u7AEF\u5730\u5740> --tenant <\u79DF\u6237\u53F7>${project2}` : slotMissing ? `hcm chiron init --env ${quote(args.env)} --endpoint <\u540E\u7AEF\u5730\u5740> --tenant <\u79DF\u6237\u53F7>${project2}` : `hcm chiron init --env ${quote(args.env)}${project2}`;
17632
17882
  if (slotMissing || error instanceof Error && error.message === "\u672C\u673A\u69FD\u4E0D\u5C5E\u4E8E\u5F53\u524D\u9879\u76EE")
@@ -17794,12 +18044,12 @@ async function chironDoctorCommand(args, deps) {
17794
18044
  }
17795
18045
  }
17796
18046
  const data = explainOpsCatalog(args.explain, descriptorReport);
17797
- process.stdout.write((args.output === "json" || args.output === "yaml" ? formatObject30(data, { format: args.output }) : renderCatalogExplanation(data)) + "\n");
18047
+ process.stdout.write((args.output === "json" || args.output === "yaml" ? formatObject31(data, { format: args.output }) : renderCatalogExplanation(data)) + "\n");
17798
18048
  process.exitCode = 0;
17799
18049
  return;
17800
18050
  }
17801
18051
  const report2 = await runPlatformOps(args, { ...defaultServices, ...deps });
17802
- process.stdout.write((args.output === "json" || args.output === "yaml" ? formatObject30(report2, { format: args.output }) : renderChironDoctor(report2)) + "\n");
18052
+ process.stdout.write((args.output === "json" || args.output === "yaml" ? formatObject31(report2, { format: args.output }) : renderChironDoctor(report2)) + "\n");
17803
18053
  process.exitCode = conclude(report2.results, { total: report2.coverage.total, failOn: args.failOn ?? "blocked" }).exitCode;
17804
18054
  return;
17805
18055
  }
@@ -17811,12 +18061,12 @@ async function chironDoctorCommand(args, deps) {
17811
18061
  if (!listing.server.known) process.stderr.write(`\u670D\u52A1\u7AEF\u76EE\u5F55${"partial" in listing.server ? "\u4E0D\u5168" : "\u672A\u53D6\u5230"}\uFF1A${listing.server.reason}
17812
18062
  `);
17813
18063
  }
17814
- process.stdout.write((args.output === "json" || args.output === "yaml" ? formatObject30(data, { format: args.output }) : args.list ? renderCatalogList(data) : renderCatalogExplanation(data)) + "\n");
18064
+ process.stdout.write((args.output === "json" || args.output === "yaml" ? formatObject31(data, { format: args.output }) : args.list ? renderCatalogList(data) : renderCatalogExplanation(data)) + "\n");
17815
18065
  process.exitCode = 0;
17816
18066
  return;
17817
18067
  }
17818
18068
  const report = await runChironDoctor(args, deps);
17819
- process.stdout.write((args.output === "json" || args.output === "yaml" ? formatObject30(report, { format: args.output }) : renderChironDoctor(report)) + "\n");
18069
+ process.stdout.write((args.output === "json" || args.output === "yaml" ? formatObject31(report, { format: args.output }) : renderChironDoctor(report)) + "\n");
17820
18070
  process.exitCode = conclude(report.results, {
17821
18071
  total: report.coverage.total,
17822
18072
  failOn: args.failOn ?? "blocked",
@@ -17837,11 +18087,11 @@ import { accessSync, constants, readdirSync as readdirSync3 } from "fs";
17837
18087
  import fs14 from "fs/promises";
17838
18088
  import os6 from "os";
17839
18089
  import path17 from "path";
17840
- import { CliError as CliError39, CliErrorCode as CliErrorCode40, formatObject as formatObject31, HcmClient as HcmClient25, loadEnv as loadEnv6 } from "@hcmai/sdk";
18090
+ import { CliError as CliError40, CliErrorCode as CliErrorCode41, formatObject as formatObject32, HcmClient as HcmClient26, loadEnv as loadEnv6 } from "@hcmai/sdk";
17841
18091
  import { createRequire } from "module";
17842
18092
 
17843
18093
  // src/commands/chiron-page-cdp.ts
17844
- import { CliError as CliError37, CliErrorCode as CliErrorCode38 } from "@hcmai/sdk";
18094
+ import { CliError as CliError38, CliErrorCode as CliErrorCode39 } from "@hcmai/sdk";
17845
18095
 
17846
18096
  // src/commands/chiron-page-shared.ts
17847
18097
  function redactTicket(text) {
@@ -17877,14 +18127,14 @@ function normalizeCdpEndpoint(raw) {
17877
18127
  try {
17878
18128
  url = new URL(candidate);
17879
18129
  } catch {
17880
- throw new CliError37({ code: CliErrorCode38.INVALID_ARGUMENT, message: `--cdp \u8981\u5199\u6210 http://\u4E3B\u673A:\u7AEF\u53E3\uFF08Chrome \u7684 --remote-debugging-port\uFF09\uFF0C\u6536\u5230\u7684\u662F ${text}` });
18130
+ throw new CliError38({ code: CliErrorCode39.INVALID_ARGUMENT, message: `--cdp \u8981\u5199\u6210 http://\u4E3B\u673A:\u7AEF\u53E3\uFF08Chrome \u7684 --remote-debugging-port\uFF09\uFF0C\u6536\u5230\u7684\u662F ${text}` });
17881
18131
  }
17882
18132
  const protocol = url.protocol === "wss:" ? "https:" : url.protocol === "ws:" ? "http:" : url.protocol;
17883
18133
  if (protocol !== "http:" && protocol !== "https:") {
17884
- throw new CliError37({ code: CliErrorCode38.INVALID_ARGUMENT, message: `--cdp \u53EA\u8BA4 http(s) \u6216 ws(s) \u7AEF\u70B9\uFF0C\u6536\u5230\u7684\u662F ${text}` });
18134
+ throw new CliError38({ code: CliErrorCode39.INVALID_ARGUMENT, message: `--cdp \u53EA\u8BA4 http(s) \u6216 ws(s) \u7AEF\u70B9\uFF0C\u6536\u5230\u7684\u662F ${text}` });
17885
18135
  }
17886
18136
  if (!url.port) {
17887
- throw new CliError37({ code: CliErrorCode38.INVALID_ARGUMENT, message: `--cdp \u8981\u5E26\u7AEF\u53E3\uFF08Chrome \u542F\u52A8\u65F6 --remote-debugging-port=<\u7AEF\u53E3> \u7684\u90A3\u4E2A\uFF09\uFF0C\u6536\u5230\u7684\u662F ${text}` });
18137
+ throw new CliError38({ code: CliErrorCode39.INVALID_ARGUMENT, message: `--cdp \u8981\u5E26\u7AEF\u53E3\uFF08Chrome \u542F\u52A8\u65F6 --remote-debugging-port=<\u7AEF\u53E3> \u7684\u90A3\u4E2A\uFF09\uFF0C\u6536\u5230\u7684\u662F ${text}` });
17888
18138
  }
17889
18139
  return `${protocol}//${url.hostname}:${url.port}`;
17890
18140
  }
@@ -17981,8 +18231,8 @@ async function captureViaCdp(input, io) {
17981
18231
  const browser = version2?.Browser ? String(version2.Browser) : `attached ${input.endpoint}`;
17982
18232
  const target = await io.fetchJson(`${input.endpoint}/json/new?about:blank`, "PUT");
17983
18233
  if (!target?.id || !target.webSocketDebuggerUrl) {
17984
- throw new CliError37({
17985
- code: CliErrorCode38.SERVER_ERROR,
18234
+ throw new CliError38({
18235
+ code: CliErrorCode39.SERVER_ERROR,
17986
18236
  message: `${input.endpoint}/json/new \u6CA1\u6709\u7ED9\u51FA\u6807\u7B7E\u9875\uFF08id / webSocketDebuggerUrl \u7F3A\u5931\uFF09`,
17987
18237
  context: { nextStep: "\u786E\u8BA4 Chrome \u662F\u5E26 --remote-debugging-port \u8D77\u7684\uFF0C\u4E14 --cdp \u6307\u5230\u7684\u662F\u5B83" }
17988
18238
  });
@@ -18012,7 +18262,7 @@ async function captureViaCdp(input, io) {
18012
18262
  });
18013
18263
  if (r.exceptionDetails) {
18014
18264
  const why = r.exceptionDetails.exception?.description ?? r.exceptionDetails.text ?? "unknown";
18015
- throw new CliError37({ code: CliErrorCode38.INVALID_ARGUMENT, message: `--eval \u5728\u9875\u9762\u91CC\u629B\u4E86\u5F02\u5E38\uFF1A${redactTicket(why.split("\n")[0] ?? why)}` });
18265
+ throw new CliError38({ code: CliErrorCode39.INVALID_ARGUMENT, message: `--eval \u5728\u9875\u9762\u91CC\u629B\u4E86\u5F02\u5E38\uFF1A${redactTicket(why.split("\n")[0] ?? why)}` });
18016
18266
  }
18017
18267
  evalResult = r.result && "value" in r.result ? toPlainJson(r.result.value) : toPlainJson(r.result?.description);
18018
18268
  }
@@ -18023,7 +18273,7 @@ async function captureViaCdp(input, io) {
18023
18273
  const dom = typeof domReply.result?.value === "string" ? domReply.result.value : "";
18024
18274
  const shot = await session.send("Page.captureScreenshot", { format: "png" });
18025
18275
  if (!shot.data) {
18026
- throw new CliError37({ code: CliErrorCode38.SERVER_ERROR, message: "Page.captureScreenshot \u6CA1\u6709\u8FD4\u56DE\u56FE\u50CF\u6570\u636E" });
18276
+ throw new CliError38({ code: CliErrorCode39.SERVER_ERROR, message: "Page.captureScreenshot \u6CA1\u6709\u8FD4\u56DE\u56FE\u50CF\u6570\u636E" });
18027
18277
  }
18028
18278
  await io.writeFile(input.screenshot, Buffer.from(shot.data, "base64"));
18029
18279
  return { dom, browser, evalResult, navigated, minted };
@@ -18045,7 +18295,7 @@ var defaultCdpIo = {
18045
18295
  openSocket: (wsUrl) => new Promise((resolve4, reject) => {
18046
18296
  const Ctor = globalThis.WebSocket;
18047
18297
  if (!Ctor) {
18048
- reject(new CliError37({ code: CliErrorCode38.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" }));
18298
+ reject(new CliError38({ code: CliErrorCode39.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" }));
18049
18299
  return;
18050
18300
  }
18051
18301
  const ws = new Ctor(wsUrl);
@@ -18068,7 +18318,7 @@ var defaultCdpIo = {
18068
18318
 
18069
18319
  // src/commands/chiron-page-playwright.ts
18070
18320
  import path16 from "path";
18071
- import { CliError as CliError38, CliErrorCode as CliErrorCode39 } from "@hcmai/sdk";
18321
+ import { CliError as CliError39, CliErrorCode as CliErrorCode40 } from "@hcmai/sdk";
18072
18322
  function playwrightCacheRoot(probe2) {
18073
18323
  const override = probe2.env.PLAYWRIGHT_BROWSERS_PATH?.trim();
18074
18324
  if (override === "0" && probe2.packageRoot) return path16.join(probe2.packageRoot, ".local-browsers");
@@ -18111,8 +18361,8 @@ function discoverPlaywrightBrowser(probe2) {
18111
18361
  const explicit = probe2.env.HCM_PLAYWRIGHT_EXECUTABLE?.trim();
18112
18362
  if (explicit) {
18113
18363
  if (probe2.executable(explicit)) return { executablePath: explicit, kind: "explicit", from: "HCM_PLAYWRIGHT_EXECUTABLE" };
18114
- throw new CliError38({
18115
- code: CliErrorCode39.INVALID_ARGUMENT,
18364
+ throw new CliError39({
18365
+ code: CliErrorCode40.INVALID_ARGUMENT,
18116
18366
  message: `HCM_PLAYWRIGHT_EXECUTABLE \u6307\u7684\u6587\u4EF6\u4E0D\u53EF\u6267\u884C\uFF1A${explicit}`,
18117
18367
  context: { nextStep: "\u6307\u5230 Playwright \u88C5\u7684 chrome-headless-shell / chrome \u4E8C\u8FDB\u5236\uFF0C\u6216\u53BB\u6389\u8FD9\u4E2A\u53D8\u91CF\u8BA9 CLI \u81EA\u5DF1\u627E" }
18118
18368
  });
@@ -18154,8 +18404,8 @@ async function captureViaPlaywright(input) {
18154
18404
  }
18155
18405
  }
18156
18406
  if (!browser) {
18157
- throw new CliError38({
18158
- code: CliErrorCode39.SERVER_ERROR,
18407
+ throw new CliError39({
18408
+ code: CliErrorCode40.SERVER_ERROR,
18159
18409
  message: `Playwright \u8D77\u4E0D\u4E86\u6D4F\u89C8\u5668\uFF1A${failures.join("\uFF1B")}`,
18160
18410
  context: {
18161
18411
  nextStep: "\u88C5\u4E00\u4EFD Playwright \u7684 Chromium\uFF1Anpx playwright install chromium-headless-shell\uFF08\u6216 chromium\uFF09\uFF1B\u5DF2\u7ECF\u88C5\u4E86\u4F46\u4E0D\u5728\u7F3A\u7701\u7F13\u5B58\u76EE\u5F55\u5C31 export PLAYWRIGHT_BROWSERS_PATH=<\u76EE\u5F55> \u6216 HCM_PLAYWRIGHT_EXECUTABLE=<\u4E8C\u8FDB\u5236>\uFF1B\u6C99\u7BB1\u8FDE headless shell \u90FD\u8D77\u4E0D\u4E86\u65F6\uFF0C\u5728\u6C99\u7BB1\u5916\u8D77 Chrome \u5E76\u7528 --cdp \u8FDE"
@@ -18175,7 +18425,7 @@ async function captureViaPlaywright(input) {
18175
18425
  evalResult = toPlainJson(await page.evaluate(wrapEvalBody(input.evalJs)));
18176
18426
  } catch (e) {
18177
18427
  const why = (e instanceof Error ? e.message : String(e)).split("\n")[0] ?? "";
18178
- throw new CliError38({ code: CliErrorCode39.INVALID_ARGUMENT, message: `--eval \u5728\u9875\u9762\u91CC\u629B\u4E86\u5F02\u5E38\uFF1A${redactTicket(why)}` });
18428
+ throw new CliError39({ code: CliErrorCode40.INVALID_ARGUMENT, message: `--eval \u5728\u9875\u9762\u91CC\u629B\u4E86\u5F02\u5E38\uFF1A${redactTicket(why)}` });
18179
18429
  }
18180
18430
  }
18181
18431
  const dom = await page.content();
@@ -18199,13 +18449,13 @@ function judgePageContent(input) {
18199
18449
  function parseViewport(size) {
18200
18450
  const m = /^(\d+)x(\d+)$/.exec(size.trim());
18201
18451
  if (!m) {
18202
- throw new CliError39({ code: CliErrorCode40.INVALID_ARGUMENT, message: `--size \u8981\u5199\u6210 <\u5BBD>x<\u9AD8>\uFF0C\u4F8B\u5982 1440x900\uFF0C\u6536\u5230\u7684\u662F ${size}` });
18452
+ throw new CliError40({ code: CliErrorCode41.INVALID_ARGUMENT, message: `--size \u8981\u5199\u6210 <\u5BBD>x<\u9AD8>\uFF0C\u4F8B\u5982 1440x900\uFF0C\u6536\u5230\u7684\u662F ${size}` });
18203
18453
  }
18204
18454
  const width = Number(m[1]);
18205
18455
  const height = Number(m[2]);
18206
18456
  if (width < VIEWPORT_MIN.width || width > VIEWPORT_MAX.width || height < VIEWPORT_MIN.height || height > VIEWPORT_MAX.height) {
18207
- throw new CliError39({
18208
- code: CliErrorCode40.INVALID_ARGUMENT,
18457
+ throw new CliError40({
18458
+ code: CliErrorCode41.INVALID_ARGUMENT,
18209
18459
  message: `--size \u8D85\u51FA\u8303\u56F4\uFF1A\u5BBD ${VIEWPORT_MIN.width}..${VIEWPORT_MAX.width}\u3001\u9AD8 ${VIEWPORT_MIN.height}..${VIEWPORT_MAX.height}\uFF0C\u6536\u5230\u7684\u662F ${size}`
18210
18460
  });
18211
18461
  }
@@ -18215,23 +18465,23 @@ function parseWaitMs(raw) {
18215
18465
  if (raw === void 0) return 1e4;
18216
18466
  const value = typeof raw === "number" ? raw : Number(raw);
18217
18467
  if (!Number.isInteger(value) || value < 0 || value > WAIT_MS_MAX) {
18218
- throw new CliError39({ code: CliErrorCode40.INVALID_ARGUMENT, message: `--wait-ms \u8981\u662F 0..${WAIT_MS_MAX} \u7684\u6574\u6570\uFF0C\u6536\u5230\u7684\u662F ${raw}` });
18468
+ throw new CliError40({ code: CliErrorCode41.INVALID_ARGUMENT, message: `--wait-ms \u8981\u662F 0..${WAIT_MS_MAX} \u7684\u6574\u6570\uFF0C\u6536\u5230\u7684\u662F ${raw}` });
18219
18469
  }
18220
18470
  return value;
18221
18471
  }
18222
18472
  function resolveEvidenceTarget(projectRoot, out) {
18223
18473
  if (!out?.trim()) {
18224
- throw new CliError39({ code: CliErrorCode40.MISSING_FLAG, message: `\u8981\u4F20 --out <${EVIDENCE_DIR}/\u2026/\u622A\u56FE.png>\uFF1A\u622A\u56FE\u843D\u5728\u54EA\u513F\u5FC5\u987B\u662F\u4F60\u5B9A\u7684\uFF0C\u4E0D\u7531\u547D\u4EE4\u731C` });
18474
+ throw new CliError40({ code: CliErrorCode41.MISSING_FLAG, message: `\u8981\u4F20 --out <${EVIDENCE_DIR}/\u2026/\u622A\u56FE.png>\uFF1A\u622A\u56FE\u843D\u5728\u54EA\u513F\u5FC5\u987B\u662F\u4F60\u5B9A\u7684\uFF0C\u4E0D\u7531\u547D\u4EE4\u731C` });
18225
18475
  }
18226
18476
  if (!out.endsWith(".png")) {
18227
- throw new CliError39({ code: CliErrorCode40.INVALID_ARGUMENT, message: `--out \u8981\u4EE5 .png \u7ED3\u5C3E\uFF0C\u6536\u5230\u7684\u662F ${out}` });
18477
+ throw new CliError40({ code: CliErrorCode41.INVALID_ARGUMENT, message: `--out \u8981\u4EE5 .png \u7ED3\u5C3E\uFF0C\u6536\u5230\u7684\u662F ${out}` });
18228
18478
  }
18229
18479
  const root = path17.resolve(projectRoot);
18230
18480
  const evidenceRoot = path17.join(root, EVIDENCE_DIR);
18231
18481
  const absolute = path17.resolve(root, out);
18232
18482
  if (absolute !== evidenceRoot && !absolute.startsWith(evidenceRoot + path17.sep)) {
18233
- throw new CliError39({
18234
- code: CliErrorCode40.INVALID_ARGUMENT,
18483
+ throw new CliError40({
18484
+ code: CliErrorCode41.INVALID_ARGUMENT,
18235
18485
  message: `--out \u8981\u843D\u5728\u9879\u76EE\u7684 ${EVIDENCE_DIR}/ \u4E0B\uFF08${evidenceRoot}\uFF09\uFF0C\u6536\u5230\u7684\u662F ${absolute}`
18236
18486
  });
18237
18487
  }
@@ -18279,8 +18529,8 @@ async function assertInsideEvidence(deps, evidenceRoot, absolute) {
18279
18529
  const canonicalParent = await deps.realpath(path17.dirname(absolute));
18280
18530
  if (canonicalRoot === null || canonicalParent === null) return;
18281
18531
  if (canonicalParent !== canonicalRoot && !canonicalParent.startsWith(canonicalRoot + path17.sep)) {
18282
- throw new CliError39({
18283
- code: CliErrorCode40.INVALID_ARGUMENT,
18532
+ throw new CliError40({
18533
+ code: CliErrorCode41.INVALID_ARGUMENT,
18284
18534
  message: `--out \u7684\u7236\u76EE\u5F55\u7ECF\u7B26\u53F7\u94FE\u63A5\u8DD1\u51FA\u4E86 ${EVIDENCE_DIR}/\uFF1A${canonicalParent}`
18285
18535
  });
18286
18536
  }
@@ -18289,8 +18539,8 @@ async function runChironPage(target, args, deps) {
18289
18539
  const sitePath = normalizeTarget(target);
18290
18540
  const expect = (args.expectText ?? []).filter((t) => t.trim().length > 0);
18291
18541
  if (expect.length === 0) {
18292
- throw new CliError39({
18293
- code: CliErrorCode40.MISSING_FLAG,
18542
+ throw new CliError40({
18543
+ code: CliErrorCode41.MISSING_FLAG,
18294
18544
  message: "\u81F3\u5C11\u8981\u4F20\u4E00\u6761 --expect-text\uFF08\u9875\u9762\u4E0A\u5FC5\u987B\u51FA\u73B0\u7684\u6587\u672C\uFF09\u3002\u53EA\u5224\u300C\u622A\u51FA\u56FE\u4E86\u300D\u4E0D\u7B97\u9A8C\u6536\uFF1A\u767B\u5F55\u9875\u3001\u62A5\u9519\u9875\u3001\u767D\u5C4F\u90FD\u80FD\u622A\u51FA\u56FE\u3002"
18295
18545
  });
18296
18546
  }
@@ -18300,8 +18550,8 @@ async function runChironPage(target, args, deps) {
18300
18550
  const root = path17.resolve(args.project ?? ".");
18301
18551
  const { evidenceRoot, absolute } = resolveEvidenceTarget(root, args.out);
18302
18552
  if (await deps.present(absolute)) {
18303
- throw new CliError39({
18304
- code: CliErrorCode40.INVALID_ARGUMENT,
18553
+ throw new CliError40({
18554
+ code: CliErrorCode41.INVALID_ARGUMENT,
18305
18555
  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`
18306
18556
  });
18307
18557
  }
@@ -18313,8 +18563,8 @@ async function runChironPage(target, args, deps) {
18313
18563
  const playwrightBrowser = endpoint || forceSpawn ? null : deps.findPlaywrightBrowser();
18314
18564
  const usePlaywright = !endpoint && !forceSpawn && (playwrightBrowser !== null || evalJs !== void 0);
18315
18565
  if (evalJs && !endpoint && !usePlaywright) {
18316
- throw new CliError39({
18317
- code: CliErrorCode40.INVALID_ARGUMENT,
18566
+ throw new CliError40({
18567
+ code: CliErrorCode41.INVALID_ARGUMENT,
18318
18568
  message: "--eval \u9700\u8981 Playwright \u6216 --cdp\uFF1A\u8001\u7684 spawn \u8DEF\u5F84\u53EA\u4F1A --dump-dom\uFF0C\u585E\u4E0D\u8FDB\u811A\u672C\u3002",
18319
18569
  context: { nextStep: "npx playwright install chromium-headless-shell\uFF0C\u6216\u5728\u6C99\u7BB1\u5916\u8D77 Chrome \u7528 --cdp \u8FDE" }
18320
18570
  });
@@ -18332,10 +18582,10 @@ async function runChironPage(target, args, deps) {
18332
18582
  try {
18333
18583
  captured = endpoint ? await deps.captureAttached({ endpoint, viewport, waitMs, evalJs, screenshot: absolute, mintUrl: mint }) : await deps.capturePlaywright({ viewport, waitMs, evalJs, screenshot: absolute, browser: playwrightBrowser, mintUrl: mint });
18334
18584
  } catch (e) {
18335
- if (e instanceof CliError39) throw new CliError39({ code: e.code, message: redactTicket(e.message), context: e.context });
18585
+ if (e instanceof CliError40) throw new CliError40({ code: e.code, message: redactTicket(e.message), context: e.context });
18336
18586
  const where = endpoint ? `\u8FDE\u5230 ${endpoint} \u7684 Chrome` : "Playwright \u8D77\u7684\u6D4F\u89C8\u5668";
18337
- throw new CliError39({
18338
- code: CliErrorCode40.SERVER_ERROR,
18587
+ throw new CliError40({
18588
+ code: CliErrorCode41.SERVER_ERROR,
18339
18589
  message: `${where}\u6CA1\u8DD1\u5B8C\uFF1A${redactTicket(e instanceof Error ? e.message : String(e))}`,
18340
18590
  context: {
18341
18591
  nextStep: endpoint ? `\u6838\u4E00\u773C ${endpoint}/json/version \u80FD\u4E0D\u80FD\u6253\u5F00\uFF1BChrome \u8981\u5E26 --remote-debugging-port \u8D77\uFF0C\u4E14\u6C99\u7BB1\u653E\u884C\u4E86\u8FD9\u4E2A\u7AEF\u53E3` : "npx playwright install chromium-headless-shell \u540E\u91CD\u8DD1\uFF1B\u6216 HCM_CHIRON_PAGE_DRIVER=spawn \u8D70\u8001\u8DEF\u5F84\u5BF9\u7167"
@@ -18351,8 +18601,8 @@ async function runChironPage(target, args, deps) {
18351
18601
  mode = "spawn";
18352
18602
  const browser = deps.findBrowser();
18353
18603
  if (!browser) {
18354
- throw new CliError39({
18355
- code: CliErrorCode40.INVALID_ARGUMENT,
18604
+ throw new CliError40({
18605
+ code: CliErrorCode41.INVALID_ARGUMENT,
18356
18606
  message: "\u672C\u673A\u627E\u4E0D\u5230 Playwright \u7684 Chromium\uFF0C\u4E5F\u627E\u4E0D\u5230 Chrome/Chromium\uFF0C\u622A\u4E0D\u4E86\u56FE\u3002",
18357
18607
  context: { nextStep: "npx playwright install chromium-headless-shell\uFF08\u6C99\u7BB1\u91CC\u4E5F\u80FD\u8DD1\uFF09\uFF1B\u6216\u88C5\u4E00\u4E2A Chrome / HCM_CHROME_BIN=/\u7EDD\u5BF9\u8DEF\u5F84\uFF1B\u6216\u5728\u6C99\u7BB1\u5916\u8D77 Chrome \u7528 --cdp \u8FDE" }
18358
18608
  });
@@ -18360,8 +18610,8 @@ async function runChironPage(target, args, deps) {
18360
18610
  minted = await mint();
18361
18611
  const result = deps.capture({ browser, argv: chromeArgv({ viewport, waitMs, screenshot: absolute, url: minted.url, isRoot: process.getuid?.() === 0 }) });
18362
18612
  if (!result.ok) {
18363
- throw new CliError39({
18364
- code: CliErrorCode40.SERVER_ERROR,
18613
+ throw new CliError40({
18614
+ code: CliErrorCode41.SERVER_ERROR,
18365
18615
  message: `\u6D4F\u89C8\u5668\u6CA1\u8DD1\u5B8C\uFF1A${redactTicket(result.stderr.trim().split("\n").slice(-1)[0] ?? "\u65E0\u8F93\u51FA")}`,
18366
18616
  context: { nextStep: spawnFailureNextStep(browser, result, deps.platform) }
18367
18617
  });
@@ -18371,7 +18621,7 @@ async function runChironPage(target, args, deps) {
18371
18621
  }
18372
18622
  const bytes = await deps.present(absolute) ? await deps.sizeOf(absolute) : 0;
18373
18623
  if (bytes === 0) {
18374
- throw new CliError39({ code: CliErrorCode40.SERVER_ERROR, message: `\u6D4F\u89C8\u5668\u6CA1\u5199\u51FA\u975E\u7A7A PNG\uFF1A${absolute}` });
18624
+ throw new CliError40({ code: CliErrorCode41.SERVER_ERROR, message: `\u6D4F\u89C8\u5668\u6CA1\u5199\u51FA\u975E\u7A7A PNG\uFF1A${absolute}` });
18375
18625
  }
18376
18626
  const verdict = judgePageContent({ dom, expect, reject });
18377
18627
  return {
@@ -18434,14 +18684,14 @@ var defaultChironPageDeps = {
18434
18684
  const envCfg = await loadEnv6(ctx.env);
18435
18685
  const frontend = ctx.frontend ?? envCfg.frontend;
18436
18686
  if (!frontend?.trim()) {
18437
- throw new CliError39({
18438
- code: CliErrorCode40.INVALID_ARGUMENT,
18687
+ throw new CliError40({
18688
+ code: CliErrorCode41.INVALID_ARGUMENT,
18439
18689
  message: `env '${ctx.env}' \u6CA1\u914D\u524D\u7AEF\u5730\u5740\uFF0C\u5F00\u4E0D\u4E86\u9875\u9762\u3002`,
18440
18690
  context: { nextStep: `hcm env edit frontend <\u524D\u7AEF\u5730\u5740> --env ${ctx.env}` }
18441
18691
  });
18442
18692
  }
18443
- const client3 = HcmClient25.fromAuthContext(ctx);
18444
- const { ticket } = await mintBrowserTicket(client3, ctx.env)();
18693
+ const client4 = HcmClient26.fromAuthContext(ctx);
18694
+ const { ticket } = await mintBrowserTicket(client4, ctx.env)();
18445
18695
  return { url: buildBrowserLoginUrl(frontend, ticket, sitePath), environment: ctx.env, identity: ctx.identity ?? null };
18446
18696
  },
18447
18697
  findBrowser: () => findChrome(
@@ -18502,7 +18752,7 @@ async function chironPageCommand(target, args, deps = defaultChironPageDeps) {
18502
18752
  try {
18503
18753
  const receipt = await runChironPage(target, args, deps);
18504
18754
  const fmt = args.output ?? "table";
18505
- if (fmt === "json" || fmt === "yaml") process.stdout.write(formatObject31(receipt, { format: fmt }) + "\n");
18755
+ if (fmt === "json" || fmt === "yaml") process.stdout.write(formatObject32(receipt, { format: fmt }) + "\n");
18506
18756
  else process.stdout.write(renderChironPage(receipt) + "\n");
18507
18757
  process.exitCode = receipt.ok ? 0 : 3;
18508
18758
  } catch (e) {
@@ -18517,11 +18767,11 @@ import { randomUUID as randomUUID2 } from "crypto";
18517
18767
  import { promises as fs15 } from "fs";
18518
18768
  import path18 from "path";
18519
18769
  import yaml3 from "js-yaml";
18520
- import { formatObject as formatObject32 } from "@hcmai/sdk";
18770
+ import { formatObject as formatObject33 } from "@hcmai/sdk";
18521
18771
 
18522
18772
  // src/commands/delivery-action-policy.ts
18523
18773
  init_auth_guard();
18524
- import { HcmClient as HcmClient26, classifyEffect } from "@hcmai/sdk";
18774
+ import { HcmClient as HcmClient27, classifyEffect } from "@hcmai/sdk";
18525
18775
 
18526
18776
  // src/commands/delivery.ts
18527
18777
  import { createHash as createHash9 } from "crypto";
@@ -19116,7 +19366,7 @@ async function resolveCoreAction(request) {
19116
19366
  as: request.identity,
19117
19367
  profile: request.profile
19118
19368
  });
19119
- const description = await HcmClient26.fromAuthContext(auth).describe(request.model);
19369
+ const description = await HcmClient27.fromAuthContext(auth).describe(request.model);
19120
19370
  const named = description.actions.filter((action) => action.name === request.action);
19121
19371
  if (named.length === 0) {
19122
19372
  const degraded = description.effectiveActionsAvailable ? "" : `\u26A0\uFE0F \u672C\u6B21\u6BD4\u5BF9\u4E0D\u542B\u811A\u672C Action\u2014\u2014${description.effectiveActionsNote ?? "\u539F\u56E0\u672A\u77E5"}\u3002`;
@@ -19558,7 +19808,7 @@ async function chironTestCommand(target, args, deps) {
19558
19808
  }
19559
19809
  const fmt = args.output ?? "table";
19560
19810
  if (fmt === "json" || fmt === "yaml") {
19561
- process.stdout.write(formatObject32({ ok: failed2 === 0, failed: failed2, cases: report }, { format: fmt }) + "\n");
19811
+ process.stdout.write(formatObject33({ ok: failed2 === 0, failed: failed2, cases: report }, { format: fmt }) + "\n");
19562
19812
  } else {
19563
19813
  for (const c2 of report) {
19564
19814
  process.stdout.write(`
@@ -19587,12 +19837,12 @@ ${failed2} \u6761\u6CA1\u8FC7\u2014\u2014\u4E0A\u9762\u6BCF\u6761\u90FD\u5199\u4
19587
19837
  init_auth_guard();
19588
19838
  init_exit();
19589
19839
  import {
19590
- HcmClient as HcmClient27,
19840
+ HcmClient as HcmClient28,
19591
19841
  ReconLayout,
19592
19842
  ROUND_EXIT_CODES,
19593
19843
  computeReconSourceKey,
19594
- formatObject as formatObject33,
19595
- fromAxiosError as fromAxiosError25,
19844
+ formatObject as formatObject34,
19845
+ fromAxiosError as fromAxiosError26,
19596
19846
  httpProbe as httpProbe3,
19597
19847
  inspectRound,
19598
19848
  renderRound,
@@ -19602,8 +19852,8 @@ var DEFAULT_CAPABILITIES = "default";
19602
19852
  async function deliveryReconCommand(args) {
19603
19853
  try {
19604
19854
  const ctx = await getActiveAuthContextFromCli(args);
19605
- const client3 = HcmClient27.fromAuthContext(ctx);
19606
- const probe2 = httpProbe3(client3.raw(), args.capabilities ?? DEFAULT_CAPABILITIES);
19855
+ const client4 = HcmClient28.fromAuthContext(ctx);
19856
+ const probe2 = httpProbe3(client4.raw(), args.capabilities ?? DEFAULT_CAPABILITIES);
19607
19857
  const sourceKey = await computeReconSourceKey(probe2);
19608
19858
  const layout = new ReconLayout(args.out ?? ".", ctx.tenantId, sourceKey);
19609
19859
  const summary = await runRecon(probe2, layout, {
@@ -19611,10 +19861,10 @@ async function deliveryReconCommand(args) {
19611
19861
  onlyModel: args.model ?? null,
19612
19862
  identity: ctx.tenantId ? { requestedTenantId: ctx.tenantId } : null
19613
19863
  });
19614
- process.stdout.write(formatObject33(summary, { format: args.output ?? "json" }) + "\n");
19864
+ process.stdout.write(formatObject34(summary, { format: args.output ?? "json" }) + "\n");
19615
19865
  } catch (e) {
19616
19866
  const err = e;
19617
- if (err?.isAxiosError) exitWithError(fromAxiosError25(err, args.env));
19867
+ if (err?.isAxiosError) exitWithError(fromAxiosError26(err, args.env));
19618
19868
  exitWithError(e);
19619
19869
  process.exit(1);
19620
19870
  }
@@ -19625,7 +19875,7 @@ async function deliveryReconRoundCommand(args) {
19625
19875
  const result = inspectRound(args.dir ?? ".");
19626
19876
  const fmt = args.output ?? "json";
19627
19877
  if (fmt !== "json") process.stdout.write(renderRound(result));
19628
- process.stdout.write(formatObject33(result, { format: fmt }) + "\n");
19878
+ process.stdout.write(formatObject34(result, { format: fmt }) + "\n");
19629
19879
  code2 = ROUND_EXIT_CODES[result.state];
19630
19880
  } catch (e) {
19631
19881
  exitWithError(e);
@@ -19645,7 +19895,7 @@ import {
19645
19895
  DRY_RUN_TAIL,
19646
19896
  DriftDetected,
19647
19897
  FORCE_STALE_FLAG,
19648
- HcmClient as HcmClient28,
19898
+ HcmClient as HcmClient29,
19649
19899
  fetchReconIdentity as fetchReconIdentity2,
19650
19900
  INIT_EXIT_CODES,
19651
19901
  JOURNAL_STOP_KINDS,
@@ -19701,9 +19951,9 @@ function premise(message, hint = "") {
19701
19951
  \u2192 ${hint}` : "") + "\n");
19702
19952
  return INIT_EXIT_CODES.premise;
19703
19953
  }
19704
- async function runSeedPlan(args, client3) {
19954
+ async function runSeedPlan(args, client4) {
19705
19955
  const out = args.out ?? ".";
19706
- const tenant2 = tenantOf(client3);
19956
+ const tenant2 = tenantOf(client4);
19707
19957
  const work = seedWorkDir({ out, tenant: tenant2, work: args.work ?? null, mapping: args.mapping ?? null });
19708
19958
  const mappingPath = seedMappingPath({ out, tenant: tenant2, mapping: args.mapping ?? null }, work);
19709
19959
  if (!existsSync4(mappingPath)) {
@@ -19743,7 +19993,7 @@ async function runSeedPlan(args, client3) {
19743
19993
  let plan;
19744
19994
  let risk;
19745
19995
  try {
19746
- plan = await planFromArtifacts(client3, mappingPath, args.sourceDir, { baseline });
19996
+ plan = await planFromArtifacts(client4, mappingPath, args.sourceDir, { baseline });
19747
19997
  risk = await riskFromArtifacts(mappingPath, reconDir, {
19748
19998
  sourceDir: args.sourceDir,
19749
19999
  exemptions,
@@ -19769,8 +20019,8 @@ async function runSeedPlan(args, client3) {
19769
20019
  for (const line of planProblemLines(plan, risk)) process.stderr.write(line + "\n");
19770
20020
  return planRc(plan, risk);
19771
20021
  }
19772
- function tenantOf(client3) {
19773
- const t = client3?.tenantId;
20022
+ function tenantOf(client4) {
20023
+ const t = client4?.tenantId;
19774
20024
  return t === void 0 || t === null ? "" : String(t);
19775
20025
  }
19776
20026
  async function authOrSignpost(args, cmd) {
@@ -19785,11 +20035,11 @@ async function authOrSignpost(args, cmd) {
19785
20035
  }
19786
20036
  async function deliverySeedPlanCommand(args) {
19787
20037
  const ctx = await authOrSignpost(args, "plan");
19788
- const client3 = HcmClient28.fromAuthContext(ctx);
19789
- process.exitCode = await runSeedPlan(args, seedClient(client3, ctx));
20038
+ const client4 = HcmClient29.fromAuthContext(ctx);
20039
+ process.exitCode = await runSeedPlan(args, seedClient(client4, ctx));
19790
20040
  }
19791
- function seedClient(client3, ctx) {
19792
- const raw = client3.raw();
20041
+ function seedClient(client4, ctx) {
20042
+ const raw = client4.raw();
19793
20043
  const wrap = async (send) => {
19794
20044
  try {
19795
20045
  const res = await send();
@@ -19819,8 +20069,8 @@ function seedClient(client3, ctx) {
19819
20069
  post: (p, body) => wrap(() => raw.post(p, body))
19820
20070
  };
19821
20071
  }
19822
- async function seedVerifyClient(client3, ctx) {
19823
- const base = seedClient(client3, ctx);
20072
+ async function seedVerifyClient(client4, ctx) {
20073
+ const base = seedClient(client4, ctx);
19824
20074
  const identity3 = await fetchReconIdentity2(base, String(ctx.tenantId ?? ""));
19825
20075
  return { ...base, identity: identity3 };
19826
20076
  }
@@ -19833,9 +20083,9 @@ function lowerCaseHeaders(headers) {
19833
20083
  return out;
19834
20084
  }
19835
20085
  var DEFAULT_CAPABILITIES2 = "default";
19836
- async function runSeedApply(args, client3) {
20086
+ async function runSeedApply(args, client4) {
19837
20087
  const out = args.out ?? ".";
19838
- const tenant2 = tenantOf(client3);
20088
+ const tenant2 = tenantOf(client4);
19839
20089
  const work = seedWorkDir({ out, tenant: tenant2, work: args.work ?? null, mapping: args.mapping ?? null });
19840
20090
  const mappingPath = seedMappingPath({ out, tenant: tenant2, mapping: args.mapping ?? null }, work);
19841
20091
  let plan;
@@ -19893,7 +20143,7 @@ async function runSeedApply(args, client3) {
19893
20143
  }
19894
20144
  }
19895
20145
  const [recorded, loadCause] = loadRecordedFingerprint(out, plan.baseline?.path ?? null);
19896
- const current = await computeFingerprint(client3);
20146
+ const current = await computeFingerprint(client4);
19897
20147
  const verdict = judgeDrift(recorded, current, { baseline: plan.baseline?.path ?? null, loadCause });
19898
20148
  let note;
19899
20149
  try {
@@ -19925,7 +20175,7 @@ async function runSeedApply(args, client3) {
19925
20175
  `);
19926
20176
  let report;
19927
20177
  try {
19928
- report = await applyPlan(client3, plan, mapping, journal, {
20178
+ report = await applyPlan(client4, plan, mapping, journal, {
19929
20179
  dryRun: !args.execute,
19930
20180
  sample: args.sample ?? null,
19931
20181
  onRequestSpent: lease.heartbeatIfDue.bind(lease)
@@ -19959,12 +20209,12 @@ async function runSeedApply(args, client3) {
19959
20209
  }
19960
20210
  async function deliverySeedApplyCommand(args) {
19961
20211
  const ctx = await authOrSignpost(args, "apply");
19962
- const client3 = HcmClient28.fromAuthContext(ctx);
19963
- process.exitCode = await runSeedApply(args, seedClient(client3, ctx));
20212
+ const client4 = HcmClient29.fromAuthContext(ctx);
20213
+ process.exitCode = await runSeedApply(args, seedClient(client4, ctx));
19964
20214
  }
19965
- async function runSeedVerify(args, client3) {
20215
+ async function runSeedVerify(args, client4) {
19966
20216
  const out = args.out ?? ".";
19967
- const tenant2 = tenantOf(client3);
20217
+ const tenant2 = tenantOf(client4);
19968
20218
  const work = seedWorkDir({ out, tenant: tenant2, work: args.work ?? null, mapping: args.mapping ?? null });
19969
20219
  let delivery;
19970
20220
  try {
@@ -19973,7 +20223,7 @@ async function runSeedVerify(args, client3) {
19973
20223
  if (e instanceof JournalError) return premise(`\u53F0\u8D26\u8BFB\u4E0D\u56DE\u6765\uFF1A[${e.reason}] ${e.message}`, e.hint ?? "");
19974
20224
  throw e;
19975
20225
  }
19976
- const recon2 = isZeroNetwork(args) ? notAsked(delivery) : await buildReconciliation(delivery, client3);
20226
+ const recon2 = isZeroNetwork(args) ? notAsked(delivery) : await buildReconciliation(delivery, client4);
19977
20227
  process.stdout.write(verifyText(delivery, recon2));
19978
20228
  return verifyRc(delivery, recon2);
19979
20229
  }
@@ -19983,8 +20233,8 @@ async function deliverySeedVerifyCommand(args) {
19983
20233
  return;
19984
20234
  }
19985
20235
  const ctx = await authOrSignpost(args, "verify");
19986
- const client3 = HcmClient28.fromAuthContext(ctx);
19987
- process.exitCode = await runSeedVerify(args, await seedVerifyClient(client3, ctx));
20236
+ const client4 = HcmClient29.fromAuthContext(ctx);
20237
+ process.exitCode = await runSeedVerify(args, await seedVerifyClient(client4, ctx));
19988
20238
  }
19989
20239
 
19990
20240
  // src/commands/delivery-seed-find.ts
@@ -20098,7 +20348,7 @@ import {
20098
20348
  CHANGE_STATES,
20099
20349
  CHANGE_UNKNOWN,
20100
20350
  CODE_WORDS,
20101
- HcmClient as HcmClient29,
20351
+ HcmClient as HcmClient30,
20102
20352
  INIT_EXIT_CODES as INIT_EXIT_CODES3,
20103
20353
  META_WRITE_STEPS,
20104
20354
  META_VERIFY_STEPS,
@@ -20237,7 +20487,7 @@ function premise3(what, hint) {
20237
20487
  `);
20238
20488
  return INIT_EXIT_CODES3.premise;
20239
20489
  }
20240
- async function runDeliveryMeta(args, client3) {
20490
+ async function runDeliveryMeta(args, client4) {
20241
20491
  let content;
20242
20492
  try {
20243
20493
  content = readFileSync9(args.contentFile, "utf-8");
@@ -20248,7 +20498,7 @@ async function runDeliveryMeta(args, client3) {
20248
20498
  );
20249
20499
  }
20250
20500
  const workDir = seedWorkDir2({ out: args.out, tenant: String(args.tenant ?? ""), work: args.work });
20251
- const change = await runMetaChange(client3, {
20501
+ const change = await runMetaChange(client4, {
20252
20502
  layer: args.layer,
20253
20503
  workspaceKey: args.workspace,
20254
20504
  model: args.model,
@@ -20262,7 +20512,7 @@ async function runDeliveryMeta(args, client3) {
20262
20512
  let verifyCode = args.verifyActive ? VERIFY_NOT_REACHED : VERIFY_NOT_ASKED;
20263
20513
  if (args.verifyActive && change.ok) {
20264
20514
  try {
20265
- verify = await runActiveVerify(client3, {
20515
+ verify = await runActiveVerify(client4, {
20266
20516
  model: args.model,
20267
20517
  workspaceKey: args.workspace,
20268
20518
  expectFields: args.expectField
@@ -20284,8 +20534,8 @@ async function runDeliveryMeta(args, client3) {
20284
20534
  }
20285
20535
  return rc;
20286
20536
  }
20287
- function metaClient(client3, ctx) {
20288
- const raw = client3.raw();
20537
+ function metaClient(client4, ctx) {
20538
+ const raw = client4.raw();
20289
20539
  const wrap = async (send) => {
20290
20540
  try {
20291
20541
  const res = await send();
@@ -20326,10 +20576,10 @@ function lowerCaseHeaders2(headers) {
20326
20576
  }
20327
20577
  async function deliveryMetaCommand(args) {
20328
20578
  const ctx = await getActiveAuthContextFromCli(args);
20329
- const client3 = HcmClient29.fromAuthContext(ctx);
20579
+ const client4 = HcmClient30.fromAuthContext(ctx);
20330
20580
  process.exitCode = await runDeliveryMeta(
20331
20581
  { ...args, tenant: args.tenant ?? String(ctx.tenantId ?? "") },
20332
- metaClient(client3, ctx)
20582
+ metaClient(client4, ctx)
20333
20583
  );
20334
20584
  }
20335
20585
 
@@ -20338,7 +20588,7 @@ init_auth_guard();
20338
20588
  init_exit();
20339
20589
  import {
20340
20590
  computeReconSourceKey as computeReconSourceKey2,
20341
- HcmClient as HcmClient30,
20591
+ HcmClient as HcmClient31,
20342
20592
  httpProbe as httpProbe4,
20343
20593
  ReconLayout as ReconLayout2,
20344
20594
  runTriageRound
@@ -20394,8 +20644,8 @@ async function runTriage(args) {
20394
20644
  return premise4(e instanceof Error ? e.message : String(e), REQUESTS_SHAPE);
20395
20645
  }
20396
20646
  const ctx = await getActiveAuthContextFromCli(args);
20397
- const client3 = HcmClient30.fromAuthContext(ctx);
20398
- const probe2 = httpProbe4(client3.raw(), args.capabilities ?? DEFAULT_CAPABILITIES3);
20647
+ const client4 = HcmClient31.fromAuthContext(ctx);
20648
+ const probe2 = httpProbe4(client4.raw(), args.capabilities ?? DEFAULT_CAPABILITIES3);
20399
20649
  const artifactsDir = args.recon ?? new ReconLayout2(args.out ?? ".", ctx.tenantId, await computeReconSourceKey2(probe2)).dir;
20400
20650
  const result = await runTriageRound(probe2, artifactsDir, entriesIn);
20401
20651
  if (result.body === null) {
@@ -20423,25 +20673,25 @@ async function deliveryTriageCommand(args) {
20423
20673
  init_auth_guard();
20424
20674
  init_exit();
20425
20675
  import {
20426
- HcmClient as HcmClient31,
20676
+ HcmClient as HcmClient32,
20427
20677
  adminResetPassword,
20428
- formatObject as formatObject34,
20429
- fromAxiosError as fromAxiosError26,
20430
- CliError as CliError40,
20431
- CliErrorCode as CliErrorCode41
20678
+ formatObject as formatObject35,
20679
+ fromAxiosError as fromAxiosError27,
20680
+ CliError as CliError41,
20681
+ CliErrorCode as CliErrorCode42
20432
20682
  } from "@hcmai/sdk";
20433
20683
  function buildAdminResetPasswordRequest(args, password) {
20434
20684
  const hasId = Boolean(args.id);
20435
20685
  const hasUsername = Boolean(args.username);
20436
20686
  if (hasId === hasUsername) {
20437
- throw new CliError40({
20438
- code: CliErrorCode41.INVALID_ARGUMENT,
20687
+ throw new CliError41({
20688
+ code: CliErrorCode42.INVALID_ARGUMENT,
20439
20689
  message: "--id <uuid> \u4E0E --username <user> \u5FC5\u987B\u4E14\u53EA\u80FD\u63D0\u4F9B\u4E00\u4E2A"
20440
20690
  });
20441
20691
  }
20442
20692
  if (!password) {
20443
- throw new CliError40({
20444
- code: CliErrorCode41.INVALID_ARGUMENT,
20693
+ throw new CliError41({
20694
+ code: CliErrorCode42.INVALID_ARGUMENT,
20445
20695
  message: "\u65B0\u5BC6\u7801\u4E0D\u80FD\u4E3A\u7A7A"
20446
20696
  });
20447
20697
  }
@@ -20457,12 +20707,12 @@ async function userResetPasswordCommand(args) {
20457
20707
  try {
20458
20708
  const password = args.passwordStdin ? await readSecretFromStdin() : await promptPasswordTwice();
20459
20709
  const request = buildAdminResetPasswordRequest(args, password);
20460
- const client3 = HcmClient31.fromAuthContext(await getActiveAuthContextFromCli(args));
20461
- const result = await adminResetPassword(client3.raw(), request);
20462
- process.stdout.write(formatObject34(result, { format: args.output ?? "json" }) + "\n");
20710
+ const client4 = HcmClient32.fromAuthContext(await getActiveAuthContextFromCli(args));
20711
+ const result = await adminResetPassword(client4.raw(), request);
20712
+ process.stdout.write(formatObject35(result, { format: args.output ?? "json" }) + "\n");
20463
20713
  } catch (cause) {
20464
20714
  const err = cause;
20465
- if (err?.isAxiosError) exitWithError(fromAxiosError26(err, args.env));
20715
+ if (err?.isAxiosError) exitWithError(fromAxiosError27(err, args.env));
20466
20716
  exitWithError(cause);
20467
20717
  }
20468
20718
  }
@@ -20470,8 +20720,8 @@ async function promptPasswordTwice() {
20470
20720
  const password = await promptSecret("\u65B0\u5BC6\u7801: ");
20471
20721
  const confirmation = await promptSecret("\u518D\u6B21\u8F93\u5165\u65B0\u5BC6\u7801: ");
20472
20722
  if (password !== confirmation) {
20473
- throw new CliError40({
20474
- code: CliErrorCode41.INVALID_ARGUMENT,
20723
+ throw new CliError41({
20724
+ code: CliErrorCode42.INVALID_ARGUMENT,
20475
20725
  message: "\u4E24\u6B21\u8F93\u5165\u7684\u65B0\u5BC6\u7801\u4E0D\u4E00\u81F4"
20476
20726
  });
20477
20727
  }
@@ -20482,19 +20732,19 @@ async function promptPasswordTwice() {
20482
20732
  init_exit();
20483
20733
  init_auth_guard();
20484
20734
  import {
20485
- HcmClient as HcmClient32,
20486
- formatObject as formatObject35,
20487
- fromAxiosError as fromAxiosError27
20735
+ HcmClient as HcmClient33,
20736
+ formatObject as formatObject36,
20737
+ fromAxiosError as fromAxiosError28
20488
20738
  } from "@hcmai/sdk";
20489
20739
  async function modelsCommand(keyword, args) {
20490
20740
  try {
20491
- const client3 = HcmClient32.fromAuthContext(await getActiveAuthContextFromCli(args));
20492
- const all = await client3.listModels();
20741
+ const client4 = HcmClient33.fromAuthContext(await getActiveAuthContextFromCli(args));
20742
+ const all = await client4.listModels();
20493
20743
  const needle = keyword?.trim().toLowerCase();
20494
20744
  const rows2 = (needle ? all.filter((m) => JSON.stringify(m).toLowerCase().includes(needle)) : all).sort((a, b) => key(a).localeCompare(key(b)));
20495
20745
  const fmt = args.output ?? "table";
20496
20746
  if (fmt !== "table") {
20497
- process.stdout.write(formatObject35({ total: rows2.length, models: rows2 }, { format: fmt }) + "\n");
20747
+ process.stdout.write(formatObject36({ total: rows2.length, models: rows2 }, { format: fmt }) + "\n");
20498
20748
  process.exitCode = 0;
20499
20749
  return;
20500
20750
  }
@@ -20521,7 +20771,7 @@ async function modelsCommand(keyword, args) {
20521
20771
  return;
20522
20772
  } catch (e) {
20523
20773
  const err = e;
20524
- if (err?.isAxiosError) exitWithError(fromAxiosError27(err, args.profile));
20774
+ if (err?.isAxiosError) exitWithError(fromAxiosError28(err, args.profile));
20525
20775
  exitWithError(e);
20526
20776
  }
20527
20777
  }
@@ -20822,6 +21072,12 @@ meta.command("validate <path>").description(
20822
21072
  "\u96F6\u7F51\u7EDC\uFF1A\u6309 core \u4ED3\u7684 JSON Schema \u9A8C\u4E00\u4EFD meta \u539F\u6587\uFF08path \u53EA\u7528\u6765\u6311 schema\uFF0C\u4E0D\u53D1\u8BF7\u6C42\uFF09"
20823
21073
  ).requiredOption("--file <file>", "\u8981\u9A8C\u7684\u539F\u6587\uFF08- \u8868\u793A stdin\uFF09").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((p, opts) => metaValidateCommand(p, opts));
20824
21074
  meta.command("delete <path>").description("\u5220\u9664 meta\uFF08\u4E0D\u53EF\u9006\uFF0C\u9ED8\u8BA4\u8FC7\u786E\u8BA4\u95F8\uFF09").option("-y, --yes", "\u8DF3\u8FC7\u786E\u8BA4").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", "json").action((p, opts) => metaDeleteCommand(p, opts));
21075
+ var COLUMN_SLOT_HELP = "\n\u8BF4\u660E\uFF1A\u8FD9\u662F\u79DF\u6237\u5185\u53EA\u8BFB\u63A5\u53E3\uFF08\u53EA\u53D1 GET\uFF0C\u79DF\u6237\u7531\u5F53\u524D\u4EE4\u724C\u51B3\u5B9A\uFF09\uFF0C\u4E0D\u6539\u4EFB\u4F55\u4E1C\u897F\u3002\n\u69FD\u7684\u767B\u8BB0 / \u590D\u6838 / \u6458\u9664\u662F\u5E73\u53F0\u65B9\u6301\u5E73\u53F0\u5BC6\u94A5\u505A\u7684\u8DE8\u79DF\u6237\u64CD\u4F5C\uFF0CCLI \u4E0D\u63D0\u4F9B\uFF0C\u987E\u95EE\u4E5F\u4E0D\u505A\uFF1A\u6CA1\u6709\u5408\u9002\u7684\u69FD\uFF0C\u5C31\u628A\u6A21\u578B\u3001\u8868\u540D\u3001\u8981\u7684\u69FD\u7C7B\u578B\u4EA4\u7ED9\u5E73\u53F0\u65B9\u3002\n\u6765\u6E90\uFF1A\u5E26 --workspace \u770B\u8BE5\u5F00\u53D1\u7A7A\u95F4\uFF08\u53E0\u52A0 active\uFF09\uFF1B\u4E0D\u5E26\u65F6\u6309\u5F53\u524D\u8EAB\u4EFD\u7684\u5F00\u53D1\u6A21\u5F0F\u7ED1\u5B9A\uFF08hcm workspace activate\uFF09\uFF0C\u6CA1\u7ED1\u5B9A\u5C31\u662F active\u3002\u8F93\u51FA\u91CC\u7684\u300C\u6765\u6E90\u300D\u8BF4\u660E\u8FD9\u6B21\u5B9E\u9645\u7528\u7684\u662F\u54EA\u4E00\u5C42\u3002\n";
21076
+ meta.command("column-slots <Model>").description("\u53EA\u8BFB\uFF1A\u67E5\u6A21\u578B\u5BBF\u4E3B\u8868\u4E0A\u672C\u79DF\u6237\u53EF\u9009 / \u5DF2\u5360\u7528 / \u4E0D\u53EF\u7528\u7684\u7269\u7406\u5217\u69FD\uFF08\u79DF\u6237\u5185\uFF09").option("--workspace <key>", "\u5F00\u53D1\u7A7A\u95F4 key\uFF1A\u5E26 X-Workspace-Key \u770B\u8BE5\u5F00\u53D1\u7A7A\u95F4\uFF1B\u4E0D\u5E26\u6309\u5F53\u524D\u5F00\u53D1\u6A21\u5F0F\u7ED1\u5B9A").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\uFF08json / yaml \u539F\u6837\u7ED9\u670D\u52A1\u7AEF data\uFF09", "table").addHelpText("after", COLUMN_SLOT_HELP).action((model, opts) => metaColumnSlotsCommand(model, opts));
21077
+ meta.command("column-slot-sql <Model> <field>").description("\u53EA\u8BFB\uFF1A\u6309\u672C\u79DF\u6237\u7ED9\u51FA\u8BE5\u5B57\u6BB5\u5728\u5217\u69FD\u4E0E flex \u4E4B\u95F4\u642C\u6570\u636E / \u6E05\u6570\u636E\u7684 SQL \u539F\u53E5\uFF08\u670D\u52A1\u7AEF\u4E0E CLI \u90FD\u4E0D\u6267\u884C\uFF0C\u4EA4 DBA\uFF09").option("--slot <column>", "\u76EE\u6807\u69FD ext_*\uFF08flex \u5B57\u6BB5\u5FC5\u586B\uFF1B\u5217\u69FD\u5B57\u6BB5\u7F3A\u7701\u53D6\u5F53\u524D\u7ED1\u5B9A\u7684\u69FD\uFF09").option("--from-slot <column>", "\u6539\u7ED1\u65F6\u7684\u65E7\u69FD ext_*\uFF1A\u53E6\u7ED9 moveFromSlot / verifyMoveFromSlot / clearFromSlot \u4E09\u53E5").option(
21078
+ "--only <key>",
21079
+ `\u53EA\u8F93\u51FA\u8FD9\u4E00\u53E5 SQL \u539F\u6587\uFF08\u65E0\u88C5\u9970\uFF0C\u53EF\u91CD\u5B9A\u5411\u7ED9 DBA\uFF1B\u5FFD\u7565 --output\uFF09\uFF1A${COLUMN_SLOT_SQL_KEYS2.join(" | ")}\uFF1B\u8BE5\u53E5\u7ED9\u4E0D\u51FA\u65F6\u975E\u96F6\u9000\u51FA\u5E76\u5728 stderr \u8BF4\u539F\u56E0`
21080
+ ).option("--workspace <key>", "\u5F00\u53D1\u7A7A\u95F4 key\uFF1A\u5E26 X-Workspace-Key \u770B\u8BE5\u5F00\u53D1\u7A7A\u95F4\uFF1B\u4E0D\u5E26\u6309\u5F53\u524D\u5F00\u53D1\u6A21\u5F0F\u7ED1\u5B9A").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\uFF08json / yaml \u539F\u6837\u7ED9\u670D\u52A1\u7AEF data\uFF09", "table").addHelpText("after", COLUMN_SLOT_HELP).action((model, field, opts) => metaColumnSlotSqlCommand(model, field, opts));
20825
21081
  var skills = program.command("skills").description("\u4EA4\u4ED8\u6280\u80FD\uFF1A\u777F\u620E Chiron \u6280\u80FD\u5E93 + CLI \u81EA\u5E26\u6280\u80FD\uFF08\u514D\u8BA4\u8BC1\uFF0C\u65E0\u9700\u5148 login\uFF09");
20826
21082
  skills.command("list [keyword]").description("\u5217\u51FA\u76EE\u6807\u73AF\u5883\u8FD9\u4E00\u7248\u7684\u4EA4\u4ED8\u6280\u80FD\uFF1B--installed \u6539\u770B\u672C\u5730\u88C5\u4E86\u54EA\u4E9B\uFF08\u4E0D\u8FDE\u7F51\uFF09").option("--installed", "\u53EA\u770B\u672C\u5730\u5DF2\u88C5\u7684\u6280\u80FD\uFF08\u8BFB .hcm-skills.json\uFF0C\u4E0D\u8FDE\u7F51\uFF09").option("--target <agent>", "\u914D\u5408 --installed\uFF1Aclaude | codex | auto", "auto").option("--global", "\u914D\u5408 --installed\uFF1A\u770B\u7528\u6237\u7EA7\u76EE\u5F55").option("--dir <path>", "\u914D\u5408 --installed\uFF1A\u770B\u6307\u5B9A\u76EE\u5F55").option("--category <key>", "\u53EA\u770B\u67D0\u4E2A\u5206\u7C7B").option(
20827
21083
  "--stage <key>",