@hcmai/cli 0.15.0 → 0.15.2

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
@@ -4600,7 +4600,8 @@ import {
4600
4600
  fetchConversationTimeline as fetchConversationTimeline2,
4601
4601
  fetchConversationTimelineStrict,
4602
4602
  fetchRecentConversations,
4603
- findLastAssistantSeq,
4603
+ findLastAssistantTarget,
4604
+ SUPERSEDED_STATUS,
4604
4605
  CliError as CliError16,
4605
4606
  CliErrorCode as CliErrorCode15,
4606
4607
  parseInteractionRequest as parseInteractionRequest2,
@@ -4719,21 +4720,39 @@ function eventScope(value) {
4719
4720
  if (value.subLoop === false) return "root";
4720
4721
  return "-";
4721
4722
  }
4723
+ function toolState(tool) {
4724
+ return String(tool?.state ?? "").toLowerCase();
4725
+ }
4722
4726
  function eventStatus(value) {
4723
- if (typeof value.status === "string" && value.status.trim()) return oneLine(value.status, 18);
4727
+ if (typeof value.status === "string" && value.status.trim()) return oneLine(value.status, 26);
4724
4728
  if (value.live === true) return "live";
4725
4729
  const tools = value.tools;
4726
4730
  if (Array.isArray(tools) && tools.length) {
4727
- if (tools.some((tool) => String(tool.state ?? "").toLowerCase() === "failed")) {
4728
- return "failed";
4729
- }
4730
- if (tools.some((tool) => String(tool.state ?? "").toLowerCase() === "running")) {
4731
- return "running";
4732
- }
4731
+ if (tools.some((tool) => toolState(tool) === "error")) return "failed";
4732
+ if (tools.some((tool) => toolState(tool) === "halted")) return "halted";
4733
+ if (tools.some((tool) => toolState(tool) === "running")) return "running";
4733
4734
  return "done";
4734
4735
  }
4735
4736
  return "-";
4736
4737
  }
4738
+ function asRecord(value) {
4739
+ return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
4740
+ }
4741
+ function readSubToolStats(tool) {
4742
+ const t = asRecord(tool);
4743
+ if (!t) return void 0;
4744
+ const candidate = asRecord(t.subToolStats);
4745
+ if (!candidate) return void 0;
4746
+ const total = candidate.total;
4747
+ const failed2 = candidate.failed;
4748
+ if (typeof total !== "number" || typeof failed2 !== "number") return void 0;
4749
+ return { total, failed: failed2, errorCodes: candidate.errorCodes };
4750
+ }
4751
+ function formatSubToolStats(tool) {
4752
+ const stats = readSubToolStats(tool);
4753
+ if (!stats) return "";
4754
+ return `(sub ${stats.total} tool${stats.total === 1 ? "" : "s"} \xB7 ${stats.failed} failed)`;
4755
+ }
4737
4756
  function stableJson(value) {
4738
4757
  try {
4739
4758
  return JSON.stringify(value);
@@ -4741,19 +4760,31 @@ function stableJson(value) {
4741
4760
  return String(value ?? "");
4742
4761
  }
4743
4762
  }
4744
- function eventPreview(value) {
4763
+ function firstText(value) {
4745
4764
  for (const key2 of ["text", "content", "summary", "question", "detail", "message"]) {
4746
- if (typeof value[key2] === "string" && value[key2].trim()) return oneLine(value[key2], 86);
4765
+ const v = value[key2];
4766
+ if (typeof v === "string" && v.trim()) return v;
4767
+ }
4768
+ return void 0;
4769
+ }
4770
+ function guardRedirectPreview(value) {
4771
+ const cause = typeof value.cause === "string" && value.cause.trim() ? value.cause : "";
4772
+ const body = firstText(value) ?? "";
4773
+ return oneLine(`\u27F2 \u6253\u56DE ${body}${cause ? ` \xB7 ${cause}` : ""}`, 86);
4774
+ }
4775
+ function eventPreview(value) {
4776
+ if (value.kind === "guard-redirect") return guardRedirectPreview(value);
4777
+ const text = firstText(value);
4778
+ if (text !== void 0) {
4779
+ const superseded = value.kind === "chat-text" && value.status === SUPERSEDED_STATUS;
4780
+ return superseded ? `\u2298 ${oneLine(text, 84)}` : oneLine(text, 86);
4747
4781
  }
4748
4782
  const tools = value.tools;
4749
4783
  if (Array.isArray(tools) && tools.length) {
4750
- return oneLine(
4751
- tools.map((tool) => {
4752
- const t = tool;
4753
- return `${String(t.toolName ?? t.name ?? "-")}:${String(t.state ?? t.status ?? "-")}`;
4754
- }).join(" \xB7 "),
4755
- 86
4756
- );
4784
+ const list = tools;
4785
+ const prefix = list.map((t) => formatSubToolStats(t)).filter((s) => s !== "").join(" ");
4786
+ const body = list.map((t) => `${String(t.toolName ?? t.name ?? "-")}:${String(t.state ?? t.status ?? "-")}`).join(" \xB7 ");
4787
+ return oneLine(prefix ? `${prefix} ${body}` : body, 86);
4757
4788
  }
4758
4789
  const activityLog = value.activityLog;
4759
4790
  if (Array.isArray(activityLog) && activityLog.length) {
@@ -4769,6 +4800,24 @@ function eventPreview(value) {
4769
4800
  if (part && typeof part === "object") return oneLine(stableJson(part), 86);
4770
4801
  return oneLine(stableJson(value), 86);
4771
4802
  }
4803
+ function buildEventRows(items) {
4804
+ return items.map((item) => {
4805
+ const value = item;
4806
+ return {
4807
+ SEQ: value.seq ?? "-",
4808
+ KIND: oneLine(value.kind, 18),
4809
+ AGENT: eventAgent(value),
4810
+ SCOPE: eventScope(value),
4811
+ STATUS: eventStatus(value),
4812
+ EVENT: eventPreview(value)
4813
+ };
4814
+ });
4815
+ }
4816
+ function lastAssistantMissDetail(target) {
4817
+ const head = target.reason === "superseded-only" ? "\u672C\u8F6E\u7684\u7EC8\u7B54\u88AB\u5F15\u64CE\u5B88\u536B\u6253\u56DE\uFF08SUPERSEDED\uFF09\uFF0C\u4ECE\u672A\u4EA4\u4ED8\u7ED9\u7528\u6237" : target.reason === "no-answer-in-turn" ? "\u672C\u8F6E\u6CA1\u6709\u5DF2\u4EA4\u4ED8\u7684\u7EC8\u7B54\uFF08\u4E2D\u65AD\u6216\u4ECD\u5728\u8DD1\uFF09" : "\u8BE5\u4F1A\u8BDD\u7684 timeline \u6CA1\u6709\u53EF\u7528\u6761\u76EE";
4818
+ if (target.earlierSeq === void 0) return head;
4819
+ return `${head}\uFF1B\u8DE8\u8F6E\u56DE\u9000\u4F1A\u8FDE\u672C\u8F6E\u63D0\u95EE\u4E00\u8D77\u4F5C\u5E9F\uFF0C\u4E0D\u81EA\u52A8\u505A\u2014\u2014\u786E\u9700\u56DE\u9000\u5230\u4E0A\u4E00\u8F6E\u8BF7\u663E\u5F0F\u4F20 --regenerate-from ${target.earlierSeq}`;
4820
+ }
4772
4821
  async function printConversationEvents(conversationId, args) {
4773
4822
  const ctx = await getActiveAuthContextFromCli(args);
4774
4823
  const client3 = HcmClient11.fromAuthContext(ctx);
@@ -4790,18 +4839,7 @@ async function printConversationEvents(conversationId, args) {
4790
4839
  process.stdout.write("No timeline events.\n");
4791
4840
  return;
4792
4841
  }
4793
- const rows2 = items.map((item) => {
4794
- const value = item;
4795
- return {
4796
- SEQ: value.seq ?? "-",
4797
- KIND: oneLine(value.kind, 18),
4798
- AGENT: eventAgent(value),
4799
- SCOPE: eventScope(value),
4800
- STATUS: eventStatus(value),
4801
- EVENT: eventPreview(value)
4802
- };
4803
- });
4804
- process.stdout.write(formatRows3(rows2, { format: "table" }) + "\n");
4842
+ process.stdout.write(formatRows3(buildEventRows(items), { format: "table" }) + "\n");
4805
4843
  process.stdout.write(`Showing ${items.length} event${items.length === 1 ? "" : "s"}.
4806
4844
  `);
4807
4845
  process.stdout.write(`raw: hcm chat --events ${conversationId} --raw
@@ -4914,14 +4952,14 @@ async function chatCommand(prompt, args) {
4914
4952
  }
4915
4953
  if (regenerateFromLastAssistant) {
4916
4954
  const items = await fetchConversationTimeline2(client3.raw(), resumeConversationId);
4917
- const lastSeq = findLastAssistantSeq(items);
4918
- if (lastSeq == null) {
4955
+ const target = findLastAssistantTarget(items);
4956
+ if (target.seq == null) {
4919
4957
  throw new CliError16({
4920
4958
  code: CliErrorCode15.BUSINESS_RULE_VIOLATION,
4921
- message: `--regenerate-from last-assistant \u627E\u4E0D\u5230\u53EF\u91CD\u8DD1\u7684 chat-text seq: conversation=${resumeConversationId}`
4959
+ message: `--regenerate-from last-assistant \u627E\u4E0D\u5230\u53EF\u91CD\u8DD1\u7684 chat-text seq: conversation=${resumeConversationId}\uFF08${lastAssistantMissDetail(target)}\uFF09`
4922
4960
  });
4923
4961
  }
4924
- regenerateFromSeq = lastSeq;
4962
+ regenerateFromSeq = target.seq;
4925
4963
  }
4926
4964
  const ws = new WsClient2({
4927
4965
  endpoint: wsUrl,
@@ -5474,9 +5512,9 @@ function printLlmTraceTree(nodes) {
5474
5512
  const root = nodes[0];
5475
5513
  const childCount = nodes.length - 1;
5476
5514
  if (!root.rows.length && childCount === 0) {
5477
- process.stdout.write(`No LLM calls for conversation ${root.convId}.
5478
- `);
5479
- process.stdout.write("next: \u786E\u8BA4 convId \u6B63\u786E\uFF0C\u6216\u8BE5\u4F1A\u8BDD\u5C1A\u65E0 LLM \u8C03\u7528\u843D\u5E93\uFF08dev always-on\uFF0CADR-134 D2\uFF09\u3002\n");
5515
+ for (const line of describeLlmTraceEmpty(root.convId, root.envelope)) {
5516
+ process.stdout.write(line + "\n");
5517
+ }
5480
5518
  return;
5481
5519
  }
5482
5520
  for (const node of nodes) {
@@ -5499,14 +5537,80 @@ ${" ".repeat(node.depth)}\u2514\u2500 \u59D4\u6D3E \u2192 ${node.label} \xB7 ${
5499
5537
  if (table.length) {
5500
5538
  process.stdout.write(formatRows4(table, { format: "table" }) + "\n");
5501
5539
  } else {
5502
- process.stdout.write("\uFF08\u65E0 LLM \u8C03\u7528\uFF09\n");
5540
+ const why = envelopeReason(node.envelope);
5541
+ process.stdout.write(`\uFF08\u65E0 LLM \u8C03\u7528${why ? ` \xB7 ${short(why, 60)}` : ""}\uFF09
5542
+ `);
5503
5543
  }
5504
5544
  }
5505
5545
  process.stdout.write("\nnext: hcm trace --conv <convId> --raw\uFF08\u770B\u5B8C\u6574\u9010\u8C03\u7528 JSON\uFF09\n");
5506
5546
  }
5547
+ function normalizeLlmTraceBody(body) {
5548
+ if (Array.isArray(body)) return { rows: body };
5549
+ if (body === null || body === void 0 || body === "") return { rows: [] };
5550
+ if (body && typeof body === "object") {
5551
+ const obj = body;
5552
+ if (Array.isArray(obj.rows)) {
5553
+ return { rows: obj.rows, envelope: obj };
5554
+ }
5555
+ }
5556
+ throw new Error("llm-trace \u54CD\u5E94\u65E2\u4E0D\u662F\u6570\u7EC4\u4E5F\u4E0D\u662F\u542B rows \u7684\u4FE1\u5C01\uFF0C\u65E0\u6CD5\u5224\u5B9A\u884C\u6570");
5557
+ }
5558
+ function asRecord2(value) {
5559
+ return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
5560
+ }
5561
+ function asText(value) {
5562
+ return typeof value === "string" && value.trim() ? value.trim() : void 0;
5563
+ }
5564
+ function envelopeReason(envelope) {
5565
+ return envelope ? asText(envelope.reason) : void 0;
5566
+ }
5567
+ function unfold(text) {
5568
+ return text.replace(/\s+/g, " ").trim();
5569
+ }
5570
+ var WRITER_LOSS_KEYS = ["failed", "discardedNoTenant", "discardedQueueFull"];
5571
+ function writerCountsLine(envelope) {
5572
+ const writer = asRecord2(asRecord2(envelope.capture)?.writer);
5573
+ if (!writer) return void 0;
5574
+ const parts = Object.entries(writer).filter(([, v]) => typeof v === "number" || typeof v === "string").map(([k, v]) => `${k}=${v}`);
5575
+ if (!parts.length) return void 0;
5576
+ const lossy = WRITER_LOSS_KEYS.some((k) => typeof writer[k] === "number" && writer[k] > 0);
5577
+ if (!lossy && asText(envelope.code) !== "CAPTURE_MISSING_DESPITE_JOURNAL") return void 0;
5578
+ return `writer: ${parts.join(" ")}`;
5579
+ }
5580
+ function describeLlmTraceEmpty(convId, envelope) {
5581
+ const lines = [`No LLM calls for conversation ${convId}.`];
5582
+ if (!envelope) {
5583
+ lines.push("\u540E\u7AEF\u672A\u8FD4\u56DE\u81EA\u9648\uFF0C\u539F\u56E0\u65E0\u6CD5\u5224\u5B9A\u3002");
5584
+ lines.push(
5585
+ "next: \u5148\u6838\u5BF9 convId \u4E0E\u5F53\u524D\u767B\u5F55\u79DF\u6237/\u8EAB\u4EFD\uFF08--env/--as\uFF09\uFF1B\u82E5\u786E\u8BA4\u65E0\u8BEF\uFF0C\u5347\u7EA7\u540E\u7AEF\u81F3\u542B #2539 \u7684\u7248\u672C\u53EF\u62FF\u5230\u670D\u52A1\u7AEF\u81EA\u9648\u3002"
5586
+ );
5587
+ return lines;
5588
+ }
5589
+ const facts = [];
5590
+ const code = asText(envelope.code);
5591
+ const reason = envelopeReason(envelope);
5592
+ const nextStep = asText(envelope.nextStep);
5593
+ const tenantId = asText(asRecord2(envelope.scope)?.tenantId);
5594
+ const visible = asRecord2(envelope.conversation)?.visible;
5595
+ const retention = asText(asRecord2(envelope.capture)?.retention);
5596
+ const writerLine = writerCountsLine(envelope);
5597
+ if (code) lines.push(`code: ${code}`);
5598
+ if (reason) lines.push(`reason: ${unfold(reason)}`);
5599
+ if (tenantId) facts.push(`tenant ${tenantId}`);
5600
+ if (typeof visible === "boolean") facts.push(`conversation: ${visible ? "visible" : "not visible"}`);
5601
+ if (retention) facts.push(`retention ${retention}`);
5602
+ if (facts.length) lines.push(facts.join(" \xB7 "));
5603
+ if (writerLine) lines.push(writerLine);
5604
+ if (nextStep) lines.push(`next: ${unfold(nextStep)}`);
5605
+ if (lines.length === 1) lines.push("\u670D\u52A1\u7AEF\u8FD4\u56DE\u4E86\u4FE1\u5C01\u4F46\u6CA1\u7ED9\u539F\u56E0\uFF0C\u539F\u56E0\u65E0\u6CD5\u5224\u5B9A\u3002");
5606
+ return lines;
5607
+ }
5507
5608
  async function fetchLlmTrace(http, convId) {
5508
- const resp = await http.get(`/api/moirai/conversations/${encodeURIComponent(convId)}/llm-trace`);
5509
- return resp.data ?? [];
5609
+ const resp = await http.get(
5610
+ `/api/moirai/conversations/${encodeURIComponent(convId)}/llm-trace`,
5611
+ { params: { envelope: "true" } }
5612
+ );
5613
+ return normalizeLlmTraceBody(resp.data);
5510
5614
  }
5511
5615
  function extractChildConvs(items) {
5512
5616
  const out = [];
@@ -5546,7 +5650,8 @@ async function gatherLlmTraceTree(http, rootConvId, maxDepth = 3) {
5546
5650
  async function walk(convId, depth, label) {
5547
5651
  if (visited.has(convId) || depth > maxDepth) return;
5548
5652
  visited.add(convId);
5549
- nodes.push({ convId, depth, label, rows: await fetchLlmTrace(http, convId) });
5653
+ const body = await fetchLlmTrace(http, convId);
5654
+ nodes.push({ convId, depth, label, rows: body.rows, envelope: body.envelope });
5550
5655
  if (depth === maxDepth) return;
5551
5656
  for (const c of await fetchChildConvs(http, convId)) {
5552
5657
  await walk(c.childConvId, depth + 1, c.label);
@@ -5562,9 +5667,14 @@ async function traceCommand(traceId, args) {
5562
5667
  const convId = args.conv ?? (args.llmCalls ? traceId ?? void 0 : void 0);
5563
5668
  if (convId) {
5564
5669
  if (args.raw || args.output === "json" || args.output === "yaml") {
5565
- const rows2 = await fetchLlmTrace(http, convId);
5670
+ const body = await fetchLlmTrace(http, convId);
5566
5671
  const fmt = args.raw ? "json" : args.output;
5567
- process.stdout.write(formatObject10(rows2, { format: fmt }) + "\n");
5672
+ process.stdout.write(formatObject10(body.rows, { format: fmt }) + "\n");
5673
+ if (!body.rows.length) {
5674
+ for (const line of describeLlmTraceEmpty(convId, body.envelope)) {
5675
+ process.stderr.write(line + "\n");
5676
+ }
5677
+ }
5568
5678
  process.exitCode = 0;
5569
5679
  return;
5570
5680
  }
@@ -6199,7 +6309,7 @@ var BUILTIN_BOUNDARY = [
6199
6309
  "- \u5199\u6388\u6743\u53EA\u8BA4\u9879\u76EE\u8D1F\u8D23\u4EBA\u5728**\u672C\u6B21\u5BF9\u8BDD\u6216\u4EFB\u52A1\u4E66**\u91CC\u7684\u660E\u786E\u6279\u51C6\uFF1B\u5BA2\u6237\u53E3\u5934\u8981\u6C42\u6216\u7FA4\u6D88\u606F\u4E0D\u662F\u6267\u884C\u6388\u6743\u3002",
6200
6310
  "- \u5199\u524D\u5FC5\u987B\u8BF4\u660E\u5BF9\u8C61\u3001\u8303\u56F4\u3001\u5F71\u54CD\u4E0E\u56DE\u9000\u5E76\u53D6\u5F97\u672C\u6B21\u660E\u786E\u786E\u8BA4\u3002\u975E\u4EA4\u4E92\u8FD0\u884C\u62FF\u4E0D\u5230\u786E\u8BA4\u65F6**\u505C\u5728\u8BA1\u5212\u3001\u4E0D\u8981\u5199**\uFF0C\u7ED3\u8BBA\u5FC5\u987B\u4E3A `BLOCKED` \u5E76\u9644\u8BA1\u5212\u3002",
6201
6311
  "- \u76EE\u5F55\u7EA6\u5B9A\uFF1A`requirements/` \u5BA2\u6237\u9700\u6C42 \xB7 `deliverables/` \u4EA4\u4ED8\u7269 \xB7 `evidence/` \u622A\u56FE\u4E0E\u6536\u636E \xB7 `cases/` \u6C89\u6DC0\u7684\u6848\u4F8B \xB7 `gaps/` \u4EA7\u54C1\u505A\u4E0D\u5230\u7684\u53F0\u8D26 \xB7 `decisions/` \u51B3\u7B56 \xB7 `customer-docs/` \u5BA2\u6237\u8D44\u6599 \xB7 `work/` \u53D8\u66F4\u4E0E\u56DE\u6EDA\u8BF4\u660E\u3002",
6202
- "- \u649E\u5230\u4EA7\u54C1\u505A\u4E0D\u5230\uFF1A\u5148\u5199 `gaps/` \u53F0\u8D26\u5E76\u7B54\u6E05\u4E09\u95EE\uFF0C\u7528 `hcm chiron gap search` \u67E5\u91CD\uFF0C\u7ECF\u987E\u95EE\u786E\u8BA4\u540E `hcm chiron gap submit` \u63D0\u5230 Jira\uFF08\u4EA7\u54C1\u5BF9\u5916\u7684\u7EDF\u4E00\u9762\uFF09\uFF0C\u62A5\u544A\u5199 `BLOCKED \xB7 \u5DF2\u63D0 <\u5355\u53F7> \xB7 \u66FF\u4EE3\u6CD5`\uFF1B\u4E4B\u540E\u7528 `hcm chiron gap status` \u67E5\u8FDB\u5EA6\u3002",
6312
+ "- \u649E\u5230\u4EA7\u54C1\u505A\u4E0D\u5230\uFF1A\u5148\u5199 `gaps/` \u53F0\u8D26\u5E76\u7B54\u6E05\u4E09\u95EE\uFF0C\u7528 `hcm chiron gap search` \u67E5\u91CD\uFF0C\u7ECF\u987E\u95EE\u786E\u8BA4\u540E `hcm chiron gap submit` \u63D0\u5230 Jira\uFF08\u4EA7\u54C1\u5BF9\u5916\u7684\u7EDF\u4E00\u9762\uFF09\uFF0C\u62A5\u544A\u5199 `BLOCKED \xB7 \u5DF2\u63D0 <\u5355\u53F7> \xB7 \u66FF\u4EE3\u6CD5`\uFF1B\u4E4B\u540E\u7528 `hcm chiron gap status` \u67E5\u8FDB\u5EA6\uFF08\u5B83\u53EA\u7ED9\u6BCF\u6761\u8BC4\u8BBA\u7684\u9996\u884C\uFF0C\u90E8\u7F72 / \u9A8C\u6536\u7ED3\u8BBA\u7684\u5168\u6587\u7528 `hcm chiron gap comments` \u770B\uFF09\u3002",
6203
6313
  "- \u9875\u9762\u9A8C\u6536\u7EDF\u4E00\u7528 `hcm chiron page </\u8DEF\u5F84> --expect-text <\u9875\u9762\u4E0A\u5FC5\u987B\u51FA\u73B0\u7684\u6587\u672C> --out evidence/\u2026.png`\uFF1B\u53EA\u622A\u5230\u56FE\u4E0D\u7B97\u901A\u8FC7\u3002",
6204
6314
  "- \u4EFB\u4F55\u51ED\u636E\u3001\u914D\u5BF9\u7801\u3001\u4EE4\u724C\u3001\u5BA2\u6237\u5BC6\u7801\u90FD\u4E0D\u5F97\u5199\u5165\u4ED3\u5E93\u3001\u547D\u4EE4\u53C2\u6570\u6216\u4EA4\u4ED8\u6587\u6863\u3002"
6205
6315
  ].join("\n");
@@ -9084,7 +9194,7 @@ async function workspaceCreateCommand(workspaceKey, args) {
9084
9194
  workspaceKey: normalizedWorkspaceKey,
9085
9195
  description: args.description ?? ""
9086
9196
  });
9087
- const created = asRecord(unwrapData(resp.data));
9197
+ const created = asRecord3(unwrapData(resp.data));
9088
9198
  const id = stringOptional(created.id);
9089
9199
  let activated = false;
9090
9200
  if (args.activate) {
@@ -10085,7 +10195,7 @@ function stringRequired(value, field) {
10085
10195
  function stringOptional(value) {
10086
10196
  return typeof value === "string" && value.trim() ? value : void 0;
10087
10197
  }
10088
- function asRecord(value) {
10198
+ function asRecord3(value) {
10089
10199
  return value && typeof value === "object" ? value : {};
10090
10200
  }
10091
10201
  function unwrapData(value) {
@@ -11056,6 +11166,46 @@ async function gapSearch({ client: client3 }, keywords, { includeClosed = true }
11056
11166
  const seen = /* @__PURE__ */ new Set();
11057
11167
  return { rows: rows2.filter((r) => seen.has(r.id) ? false : (seen.add(r.id), true)), jiraError };
11058
11168
  }
11169
+ var PRODUCT_HANDLING_KEYWORDS = /分诊|已转|已修|合入|不做|重复|改技能|产品侧|代码库已关闭/;
11170
+ var HEADLINE_MAX = 300;
11171
+ function commentWhen(created) {
11172
+ const m = /^(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2})/.exec(created ?? "");
11173
+ return m ? `${m[1]} ${m[2]}` : created ?? "?";
11174
+ }
11175
+ function commentHeadline(body) {
11176
+ const lines = (body ?? "").split("\n").map((l) => l.trim()).filter(Boolean);
11177
+ const first = lines[0] ?? "";
11178
+ const cut = first.length > HEADLINE_MAX;
11179
+ return { headline: cut ? first.slice(0, HEADLINE_MAX) + "\u2026" : first, truncated: cut || lines.length > 1 };
11180
+ }
11181
+ function classifyFollowUp(headline) {
11182
+ if (/阻塞|阻断|未通过|不通过|没通过|没过|退回|失败|(仍|还是|依旧)(然)?(能|可)?复现/.test(headline)) return "blocked";
11183
+ if (/部分(通过|验证|复验|验收|可用)|只(验证|验|测)了/.test(headline)) return "partial";
11184
+ if (/(?<![等待])(复验|验收|验证|复测|回归)(已)?通过(?!\s*(才|后|再))|验证无误/.test(headline)) return "passed";
11185
+ if (/已(经)?(部署|发布|上线|跑)|(部署|发布)(完成|好了)|升级到|更新到/.test(headline)) return "deployed";
11186
+ return void 0;
11187
+ }
11188
+ var AUTO_NOTICE = /^(代码库已关闭:|已在代码库登记:)/;
11189
+ var isAutoNotice = (body) => AUTO_NOTICE.test((body ?? "").trim());
11190
+ function commentTime(c, index) {
11191
+ const t = Date.parse(c.created ?? "");
11192
+ return Number.isNaN(t) ? index : t;
11193
+ }
11194
+ function sortComments(cs) {
11195
+ return cs.map((c, i) => ({ c, i, t: commentTime(c, i) })).sort((a, b) => a.t - b.t || a.i - b.i).map((x) => x.c);
11196
+ }
11197
+ function toView(client3, key2, c) {
11198
+ const { headline, truncated } = commentHeadline(c.body);
11199
+ return {
11200
+ id: c.id,
11201
+ created: c.created,
11202
+ when: commentWhen(c.created),
11203
+ author: c.author?.displayName ?? c.author?.name ?? "?",
11204
+ headline,
11205
+ truncated,
11206
+ url: c.id ? client3.commentUrl(key2, c.id) : void 0
11207
+ };
11208
+ }
11059
11209
  async function gapStatus({ client: client3 }, ref, casesSlug = CASES_REPO_SLUG2) {
11060
11210
  const parsed = parseRef(ref, client3.project, casesSlug);
11061
11211
  if (!parsed) throw new Error(`\u770B\u4E0D\u61C2 ${ref}\uFF1A\u7ED9 Jira \u5355\u53F7\uFF08HCMNX-12\uFF09`);
@@ -11065,14 +11215,39 @@ async function gapStatus({ client: client3 }, ref, casesSlug = CASES_REPO_SLUG2)
11065
11215
  );
11066
11216
  }
11067
11217
  const issue = await client3.issue(parsed.key);
11068
- const cs = await client3.comments(parsed.key);
11218
+ const cs = sortComments(await client3.comments(parsed.key));
11069
11219
  const status = issue.fields.status?.name;
11070
11220
  const resolution = issue.fields.resolution?.name;
11071
11221
  const lines = [`Jira ${issue.key} [${status}${resolution ? "\xB7" + resolution : ""}${issue.fields.priority ? " " + issue.fields.priority.name : ""}] ${issue.fields.summary ?? ""}`, ` ${client3.browseUrl(issue.key)}`];
11072
- const keyComments = cs.filter((c) => /分诊|已转|已修|合入|不做|重复|改技能|产品侧|代码库已关闭/.test(c.body ?? ""));
11073
- const last = (keyComments.length ? keyComments : cs).at(-1);
11074
- if (last) lines.push(` \u6700\u65B0\u5904\u7406\uFF08${String(last.created ?? "").slice(0, 10)} ${last.author?.displayName ?? "?"}\uFF09\uFF1A${(last.body ?? "").split("\n").find((l) => l.trim()) ?? ""}`.slice(0, 400));
11075
- else 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");
11222
+ const productRaw = [...cs].reverse().find((c) => PRODUCT_HANDLING_KEYWORDS.test(c.body ?? ""));
11223
+ const latestRaw = cs.at(-1);
11224
+ const fullText = `\u5168\u6587\uFF1A\`hcm chiron gap comments ${issue.key}\``;
11225
+ const render2 = (label, v) => [
11226
+ ` ${label}\uFF1A${v.headline}${v.truncated ? `\uFF08\u5DF2\u622A\u65AD\uFF0C${fullText}\uFF09` : ""}`,
11227
+ ...v.url ? [` ${v.url}`] : []
11228
+ ];
11229
+ const stamp = (v) => `${v.when} ${v.author}`;
11230
+ let latestProductComment;
11231
+ let latestComment;
11232
+ let sameAsProduct;
11233
+ if (productRaw) {
11234
+ latestProductComment = toView(client3, issue.key, productRaw);
11235
+ latestProductComment.matchedKeyword = PRODUCT_HANDLING_KEYWORDS.exec(productRaw.body ?? "")?.[0];
11236
+ }
11237
+ if (latestRaw) {
11238
+ latestComment = toView(client3, issue.key, latestRaw);
11239
+ sameAsProduct = !!productRaw && productRaw === latestRaw;
11240
+ if (!isAutoNotice(latestRaw.body)) latestComment.signal = classifyFollowUp(latestComment.headline);
11241
+ }
11242
+ const hit = `\u547D\u4E2D\u300C${latestProductComment?.matchedKeyword ?? "?"}\u300D`;
11243
+ if (latestProductComment && latestComment && sameAsProduct) {
11244
+ lines.push(...render2(`\u6700\u65B0\u5904\u7406\uFF08\u65E2\u662F\u4EA7\u54C1\u4FA7\u5904\u7406\u3014${hit}\u3015\u4E5F\u662F\u6700\u65B0\u8BC4\u8BBA\uFF1B${stamp(latestComment)}\uFF09`, latestComment));
11245
+ } else {
11246
+ if (latestProductComment) lines.push(...render2(`\u4EA7\u54C1\u4FA7\u5904\u7406\uFF08${hit}\uFF1B${stamp(latestProductComment)}\uFF09`, latestProductComment));
11247
+ else if (latestComment) lines.push(" \u8FD8\u6CA1\u6709\u4EA7\u54C1\u4FA7\u5904\u7406\u8BC4\u8BBA\uFF08\u5206\u8BCA / \u5DF2\u8F6C / \u5408\u5165 / \u4EE3\u7801\u5E93\u5DF2\u5173\u95ED \u8FD9\u7C7B\u5173\u952E\u8BCD\u4E00\u6761\u90FD\u6CA1\u547D\u4E2D\uFF09");
11248
+ if (latestComment) lines.push(...render2(`\u6700\u65B0\u8BC4\u8BBA\uFF08${stamp(latestComment)}\uFF09`, latestComment));
11249
+ }
11250
+ 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");
11076
11251
  const remote = (await client3.remoteLinks(parsed.key)).map((l) => l.object?.url ?? "").join("\n");
11077
11252
  const links = linkedRepoRefs(`${remote}
11078
11253
  ${issue.fields.description ?? ""}
@@ -11095,7 +11270,52 @@ ${cs.map((c) => c.body ?? "").join("\n")}`).map((l) => ({
11095
11270
  else if (status && status !== "\u65B0\u589E") {
11096
11271
  nextStep = `\u8FD9\u5355\u5728\u300C${status}\u300D\u2014\u2014**\u672C\u6D41\u7A0B\u6CA1\u5B9A\u4E49\u8FD9\u4E2A\u72B6\u6001**\uFF08\u591A\u534A\u662F\u5DE5\u4F5C\u6D41\u53C8\u52A0\u4E86\u72B6\u6001\uFF0C\u6216\u65B9\u6848 12100 \u88AB\u5207\u8D70\u4E86\uFF09\u3002\u6309 Jira \u7684\u5DE5\u4F5C\u6D41\u5B83\u8FD8\u5728\u4EA7\u54C1\u4FA7\u624B\u4E0A\uFF0C\u4E0D\u662F\u5728\u7B49\u4F60\u3002\u5148\u6309\u66FF\u4EE3\u6CD5\u7EE7\u7EED\u4EA4\u4ED8\uFF1B\u60F3\u77E5\u9053\u5177\u4F53\u8FDB\u5C55\u5C31\u5728\u5355\u4E0B\u95EE\u4E00\u53E5\uFF0C\u6216\u8BA9\u5206\u8BCA\u4EBA\u628A\u5B83\u63A8\u5230\u6536\u5355\u6D41\u7A0B\u91CC\u7684\u72B6\u6001\u4E0A\u3002`;
11097
11272
  } else nextStep = `\u7B49\u5206\u8BCA\u3002\u5148\u6309\u66FF\u4EE3\u6CD5\u7EE7\u7EED\u4EA4\u4ED8\uFF0C\u62A5\u544A\u5199 BLOCKED \xB7 \u5DF2\u63D0 ${issue.key}\u3002`;
11098
- return { ref, lines, nextStep, jira: { key: issue.key, status, resolution, url: client3.browseUrl(issue.key) }, links };
11273
+ if (latestComment && !resolution) {
11274
+ const cite = `${latestComment.when} ${latestComment.author}\uFF1A\u300C${latestComment.headline}\u300D`;
11275
+ const tail = latestComment.truncated ? `\uFF08${fullText}\uFF09` : "";
11276
+ switch (latestComment.signal) {
11277
+ case "passed":
11278
+ nextStep = `\u76EE\u6807\u73AF\u5883\u5DF2\u590D\u9A8C\u901A\u8FC7\u2014\u2014${cite}${tail}\u3002Jira \u72B6\u6001\u8FD8\u505C\u5728\u300C${status ?? "?"}\u300D\u53EA\u8BF4\u660E\u4EA7\u54C1\u4FA7\u8FD8\u6CA1\u8D70\u5173\u5355\u6D41\u8F6C\uFF0C\u4E0D\u4EE3\u8868\u8FD8\u6CA1\u90E8\u7F72\uFF1B\u8DD1 \`hcm chiron skills sync\` \u540E\u6309\u6280\u80FD\u76F4\u63A5\u7528\uFF0C\u4E0D\u5FC5\u518D\u7B49\u90E8\u7F72\u590D\u9A8C\u3002`;
11279
+ break;
11280
+ case "deployed":
11281
+ nextStep = `\u76EE\u6807\u73AF\u5883\u5DF2\u90E8\u7F72\u5230\u542B\u4FEE\u590D\u7684\u7248\u672C\u2014\u2014${cite}${tail}\u3002\u8DD1 \`hcm chiron skills sync\`\uFF0C\u6309\u6280\u80FD\u590D\u9A8C\u4E00\u6B21\uFF0C\u628A\u7ED3\u679C\u56DE\u5230\u8FD9\u5355\u4E0B\u3002`;
11282
+ break;
11283
+ case "partial":
11284
+ nextStep = `\u590D\u9A8C\u90E8\u5206\u901A\u8FC7\u2014\u2014${cite}${tail}\u3002\u5DF2\u9A8C\u7684\u90E8\u5206\u53EF\u4EE5\u7528\uFF1B\u6CA1\u9A8C\u5230\u7684\u5206\u652F\u7EE7\u7EED\u7528\u66FF\u4EE3\u6CD5\uFF0C\u628A\u6CA1\u8FC7\u7684\u5199\u8FDB\u8FD9\u5355\u8BA9\u4EA7\u54C1\u4FA7\u63A5\u7740\u5904\u7406\u3002`;
11285
+ break;
11286
+ case "blocked":
11287
+ nextStep = `\u590D\u9A8C\u6CA1\u8FC7 / \u88AB\u963B\u585E\u2014\u2014${cite}${tail}\u3002\u7403\u56DE\u5230\u4EA7\u54C1\u4FA7\uFF1A\u7EE7\u7EED\u7528\u66FF\u4EE3\u6CD5\u4EA4\u4ED8\uFF0C\u8FDB\u5C55\u770B\u8FD9\u5355\u540E\u7EED\u8BC4\u8BBA\u3002`;
11288
+ break;
11289
+ default:
11290
+ 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`;
11291
+ }
11292
+ }
11293
+ return { ref, lines, nextStep, jira: { key: issue.key, status, resolution, url: client3.browseUrl(issue.key) }, links, latestProductComment, latestComment, sameAsProduct };
11294
+ }
11295
+ async function gapComments({ client: client3 }, ref, { limit } = {}, casesSlug = CASES_REPO_SLUG2) {
11296
+ const parsed = parseRef(ref, client3.project, casesSlug);
11297
+ if (!parsed) throw new Error(`\u770B\u4E0D\u61C2 ${ref}\uFF1A\u7ED9 Jira \u5355\u53F7\uFF08HCMNX-12\uFF09`);
11298
+ if (parsed.kind === "repo") {
11299
+ 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`);
11300
+ }
11301
+ if (limit !== void 0 && (!Number.isInteger(limit) || limit < 1)) throw new Error(`--limit \u8981\u662F\u6B63\u6574\u6570\uFF0C\u7ED9\u7684\u662F ${String(limit)}`);
11302
+ const all = sortComments(await client3.comments(parsed.key));
11303
+ const picked = limit !== void 0 ? all.slice(-limit) : all;
11304
+ return {
11305
+ ref,
11306
+ key: parsed.key,
11307
+ url: client3.browseUrl(parsed.key),
11308
+ total: all.length,
11309
+ shown: picked.length,
11310
+ comments: picked.map((c) => ({
11311
+ id: c.id,
11312
+ created: c.created,
11313
+ when: commentWhen(c.created),
11314
+ author: c.author?.displayName ?? c.author?.name ?? "?",
11315
+ body: (c.body ?? "").trim(),
11316
+ url: c.id ? client3.commentUrl(parsed.key, c.id) : void 0
11317
+ }))
11318
+ };
11099
11319
  }
11100
11320
 
11101
11321
  // src/commands/gap.ts
@@ -11134,6 +11354,33 @@ async function gapStatusCommand(ref, args, deps = defaultDeps) {
11134
11354
  emit5(args.output, r, () => [...r.lines, `\u4E0B\u4E00\u6B65\uFF1A${r.nextStep}`].join("\n"));
11135
11355
  });
11136
11356
  }
11357
+ function parseLimit(raw) {
11358
+ if (raw === void 0) return void 0;
11359
+ const n = typeof raw === "number" ? raw : Number(String(raw).trim());
11360
+ if (!Number.isInteger(n) || n < 1) throw new Error(`--limit \u8981\u662F\u6B63\u6574\u6570\uFF0C\u7ED9\u7684\u662F\u300C${String(raw)}\u300D`);
11361
+ return n;
11362
+ }
11363
+ function renderGapComments(r) {
11364
+ const scope = r.shown < r.total ? `\u53EA\u663E\u793A\u6700\u8FD1 ${r.shown} \u6761\uFF0C\u6309\u65F6\u95F4\u6B63\u5E8F\uFF1B\u53BB\u6389 --limit \u770B\u5168\u90E8` : "\u6309\u65F6\u95F4\u6B63\u5E8F";
11365
+ const head = `Jira ${r.key} \u8BC4\u8BBA ${r.total} \u6761\uFF08${scope}\uFF09
11366
+ ${r.url}`;
11367
+ if (!r.total) return `${head}
11368
+ \u8FD9\u5355\u4E0B\u8FD8\u6CA1\u6709\u8BC4\u8BBA\u3002`;
11369
+ return [
11370
+ head,
11371
+ ...r.comments.map((c) => `
11372
+ \u2500\u2500 ${c.when} ${c.author}${c.id ? ` \xB7 \u8BC4\u8BBA ${c.id}` : ""} \u2500\u2500
11373
+ ${c.body}${c.url ? `
11374
+ ${c.url}` : ""}`)
11375
+ ].join("\n");
11376
+ }
11377
+ async function gapCommentsCommand(ref, args, deps = defaultDeps) {
11378
+ await run2(async () => {
11379
+ const limit = parseLimit(args.limit);
11380
+ const r = await gapComments(await gapDeps(deps), ref, { limit });
11381
+ emit5(args.output, r, () => renderGapComments(r));
11382
+ });
11383
+ }
11137
11384
  async function fingerprintText(env2) {
11138
11385
  try {
11139
11386
  const g = await loadGlobalConfig10();
@@ -13799,9 +14046,10 @@ projectEnv.command("list").description("\u5217\u51FA\u9879\u76EE\u73AF\u5883\u30
13799
14046
  projectEnv.command("add <name>").description("\u6DFB\u52A0\u9879\u76EE\u73AF\u5883\u5E76\u5C31\u5730\u6838\u9A8C\u5730\u5740\u4E0E token \u79DF\u6237").requiredOption("--endpoint <url>", "\u540E\u7AEF\u5B8C\u6574 URL").requiredOption("--frontend <url>", "\u524D\u7AEF\u5B8C\u6574 URL").requiredOption("--tenant <id>", "\u79DF\u6237").option("--danger", "\u5199\u64CD\u4F5C\u8981\u6C42\u663E\u5F0F --allow-danger").option("--default", "\u8BBE\u4E3A\u9879\u76EE\u9ED8\u8BA4\u73AF\u5883").option("--project <dir>", "\u9879\u76EE\u76EE\u5F55\uFF08\u5411\u4E0A\u5BFB\u627E env.yaml\uFF09", ".").option(...OUTPUT_OPT).action((name, opts) => chironEnvCommand("add", { ...opts, name }));
13800
14047
  projectEnv.command("edit <name> <field> <value>").description("\u7F16\u8F91 endpoint/frontend/tenant/danger/default\uFF1Bdefault true \u8BBE\u4E3A\u9ED8\u8BA4").option("--yes", "\u786E\u8BA4\u5173\u95ED danger \u540E\u4E0D\u518D\u62E6\u5199\u64CD\u4F5C").option("--project <dir>", "\u9879\u76EE\u76EE\u5F55\uFF08\u5411\u4E0A\u5BFB\u627E env.yaml\uFF09", ".").option(...OUTPUT_OPT).action((name, field, value, opts) => chironEnvCommand("edit", { ...opts, name, field, value }));
13801
14048
  projectEnv.command("remove <name>").description("\u5220\u9664\u9879\u76EE\u73AF\u5883\uFF1B\u9ED8\u8BA4\u9879\u987B\u5148\u6539\u5230\u5176\u4ED6\u73AF\u5883").option("--project <dir>", "\u9879\u76EE\u76EE\u5F55\uFF08\u5411\u4E0A\u5BFB\u627E env.yaml\uFF09", ".").option(...OUTPUT_OPT).action((name, opts) => chironEnvCommand("remove", { ...opts, name }));
13802
- var gap = chiron.command("gap").description("\u7F3A\u53E3\uFF1A\u649E\u5230\u300C\u4EA7\u54C1\u505A\u4E0D\u5230\u300D\u65F6\u7684\u7EDF\u4E00\u51FA\u53E3\uFF0C\u8FDB Jira\uFF08HCMNX\uFF09\u2014\u2014\u67E5\u91CD search / \u67E5\u8FDB\u5EA6 status / \u63D0\u7F3A\u53E3 submit");
14049
+ var gap = chiron.command("gap").description("\u7F3A\u53E3\uFF1A\u649E\u5230\u300C\u4EA7\u54C1\u505A\u4E0D\u5230\u300D\u65F6\u7684\u7EDF\u4E00\u51FA\u53E3\uFF0C\u8FDB Jira\uFF08HCMNX\uFF09\u2014\u2014\u67E5\u91CD search / \u67E5\u8FDB\u5EA6 status / \u8BFB\u8BC4\u8BBA comments / \u63D0\u7F3A\u53E3 submit");
13803
14050
  gap.command("search").description("\u67E5\u91CD\uFF1A\u6309\u9519\u8BEF\u7801 / Model / Action / \u4E00\u53E5\u73B0\u8C61\u67E5 Jira\uFF0C\u5E26\u56DE\u7F16\u53F7\u4E0E\u72B6\u6001").argument("<keywords...>", "\u5173\u952E\u8BCD\uFF0C\u6BCF\u4E2A\u5355\u72EC\u67E5\u4E00\u6B21").option("--no-include-closed", "\u53EA\u67E5\u672A\u89E3\u51B3\u7684").option(...OUTPUT_OPT).action((keywords, opts) => gapSearchCommand(keywords, opts));
13804
- gap.command("status").description("\u67E5\u8FDB\u5EA6\uFF1A\u7ED9 Jira \u5355\u53F7\uFF08HCMNX-12 \u6216\u88F8\u6570\u5B57 12\uFF09").argument("<ref>", "Jira \u5355\u53F7").option(...OUTPUT_OPT).action((ref, opts) => gapStatusCommand(ref, opts));
14051
+ gap.command("status").description("\u67E5\u8FDB\u5EA6\uFF1A\u7ED9 Jira \u5355\u53F7\uFF08HCMNX-12 \u6216\u88F8\u6570\u5B57 12\uFF09\u3002\u4EA7\u54C1\u4FA7\u6700\u65B0\u5904\u7406\u4E0E\u6700\u65B0\u8BC4\u8BBA\u5404\u7ED9\u9996\u884C\uFF0C\u5168\u6587\u770B comments").argument("<ref>", "Jira \u5355\u53F7").option(...OUTPUT_OPT).action((ref, opts) => gapStatusCommand(ref, opts));
14052
+ gap.command("comments").description("\u8BFB\u8BC4\u8BBA\uFF1A\u6309\u65F6\u95F4\u6B63\u5E8F\u5217\u51FA\u8FD9\u5355\u4E0B\u7684\u8BC4\u8BBA\u2014\u2014\u65F6\u95F4\uFF08\u5230\u5206\u949F\uFF09/ \u4F5C\u8005 / \u5168\u6587 / \u8BC4\u8BBA\u6C38\u4E45\u94FE\u63A5").argument("<ref>", "Jira \u5355\u53F7").option("--limit <n>", "\u53EA\u770B\u6700\u8FD1 N \u6761\uFF08\u4ECD\u6309\u65F6\u95F4\u6B63\u5E8F\uFF09").option(...OUTPUT_OPT).action((ref, opts) => gapCommentsCommand(ref, opts));
13805
14053
  gap.command("submit").description("\u63D0\u7F3A\u53E3\uFF1A\u5148\u67E5\u91CD\uFF08\u540C\u4E00\u7F3A\u53E3\u8FFD\u52A0\u300C\u53C8\u4E00\u4E2A\u73B0\u573A\u300D\uFF09\uFF0C\u5426\u5219\u6309 HCMNX \u5FC5\u586B\u683C\u65B0\u5F00\uFF1B\u8F7D\u8377 JSON \u8D70 --file \u6216\u6807\u51C6\u8F93\u5165").option("--file <path>", "\u7F3A\u53E3\u8F7D\u8377 JSON\uFF08title/phenomenon/repro/expected/alternative/q_*/severity/kind/module\u2026\uFF09").option("--env <name>", "\u53D6\u73AF\u5883\u6307\u7EB9\u7528\u7684\u73AF\u5883\u522B\u540D\uFF08\u7F3A\u7701 activeEnv\uFF09").option("--fingerprint <text>", "\u76F4\u63A5\u7ED9\u6307\u7EB9\u6587\u672C\uFF08\u8BAD\u7EC3\u573A\u4ECE \u573A.yml \u53D6\u65F6\u7528\uFF09\uFF0C\u4E0D\u518D\u73B0\u67E5").option("--issuetype <name>", "\u8986\u76D6 issuetype\uFF08\u7F3A\u7701\u6309 kind \u9009 \u6545\u969C / \u9700\u6C42\uFF09").option("--assignee <user>", "\u8986\u76D6\u7ECF\u529E\u4EBA\uFF08\u7F3A\u7701\u9879\u76EE\u8D1F\u8D23\u4EBA\uFF09").option(...OUTPUT_OPT).action((opts) => gapSubmitCommand(opts));
13806
14054
  var kase = chiron.command("case").description("\u516C\u5171\u6848\u4F8B\u5E93\uFF1A\u67E5 search / \u770B show / \u5BF9\u6307\u7EB9 match / \u9879\u76EE\u6848\u4F8B\u4E0A\u884C submit");
13807
14055
  kase.command("search").description("\u6309\u5BA2\u6237\u539F\u8BDD / \u9519\u8BEF\u7801 / Model / \u6280\u80FD\u627E\u516C\u5171\u6848\u4F8B\uFF0C\u5E76\u6309\u5F53\u524D\u73AF\u5883\u6307\u7EB9\u6807\u5339\u914D").argument("<query>", "\u4E00\u53E5\u8BDD\u6216\u5173\u952E\u8BCD").option("--top-k <n>", "\u53D6\u524D\u51E0\u6761\uFF081-10\uFF09", "5").option("--refresh", "\u5FFD\u7565\u672C\u673A\u7D22\u5F15\u7F13\u5B58\uFF08\u9ED8\u8BA4\u5B58\u4E00\u5C0F\u65F6\uFF09\uFF0C\u73B0\u62C9\u4E00\u4EFD \u2014\u2014 \u6848\u4F8B\u521A\u5408\u8FDB\u6848\u4F8B\u5E93\u65F6\u7528").option("--env <name>", "\u7528\u54EA\u4E2A\u73AF\u5883\u7684\u540E\u7AEF\u6307\u7EB9\u6BD4\u5BF9\uFF08\u4E0D\u7ED9\u5C31\u6807\u300C\u672A\u6BD4\u5BF9\u300D\uFF0C\u4E0D\u5047\u88C5\u5339\u914D\uFF09").option(...OUTPUT_OPT).action((query, opts) => caseSearchCommand(query, { ...opts, topK: Number(opts.topK) }));