@hcmai/cli 0.15.12 → 0.15.14

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
@@ -4612,7 +4612,8 @@ function collectYmlFiles(path19) {
4612
4612
  var DRY_RUN_CLIENT = {
4613
4613
  findIdByKey: async () => null,
4614
4614
  create: async () => ({ id: "" }),
4615
- update: async () => ({})
4615
+ update: async () => ({}),
4616
+ fieldKeys: async () => []
4616
4617
  };
4617
4618
  async function importCommand(path19, args) {
4618
4619
  try {
@@ -4635,6 +4636,23 @@ async function importCommand(path19, args) {
4635
4636
  `
4636
4637
  );
4637
4638
  process.stdout.write(formatObject7(result, { format: fmt }) + "\n");
4639
+ const unmappedRows = result.rows.filter((r) => r.unmappedFields?.length);
4640
+ if (unmappedRows.length > 0) {
4641
+ const keys = [...new Set(unmappedRows.flatMap((r) => r.unmappedFields ?? []))].sort();
4642
+ process.stderr.write(
4643
+ `\u26A0 ${unmappedRows.length} \u884C\u91CC\u6709\u76EE\u6807\u6A21\u578B\u4E0D\u8BA4\u8BC6\u7684\u5B57\u6BB5\u540D\uFF1A${keys.join(" / ")}
4644
+ \u8FD9\u4E9B\u952E\u670D\u52A1\u7AEF\u8FDE\u8BFB\u90FD\u4E0D\u8BFB\uFF0C\u503C\u4E0D\u4F1A\u843D\u5E93\uFF08\u62A5\u544A\u91CC\u8BE5\u884C\u7684 status \u4ECD\u662F\u88AB\u63A5\u53D7\u7684\u90A3\u4E2A\uFF09\u3002
4645
+ next_step=hcm describe <Model> \u6838\u5BF9\u771F\u540D\u540E\u6539\u8F7D\u8377\u91CD\u8DD1\uFF1B\u771F\u540D\u5E26\u4E0B\u5212\u7EBF\u7684\u8981\u539F\u6837\u5199\uFF0C\u522B\u8F6C\u9A7C\u5CF0\u3002
4646
+ `
4647
+ );
4648
+ }
4649
+ if (result.fieldNamesUnverified.length > 0) {
4650
+ process.stderr.write(
4651
+ `\u26A0 \u8FD9\u4E9B\u6A21\u578B\u7684\u5B57\u6BB5\u6E05\u5355\u6CA1\u8BFB\u5230\uFF0C\u5B57\u6BB5\u540D\u6309\u8001\u89C4\u5219\uFF08\u4E00\u5F8B\u8F6C\u9A7C\u5CF0\uFF09\u53D1\u51FA\u3001\u672A\u505A\u6821\u9A8C\uFF1A${result.fieldNamesUnverified.join(" / ")}
4652
+ next_step=\u771F\u540D\u5E26\u4E0B\u5212\u7EBF\u7684\u5B57\u6BB5\u53EF\u80FD\u88AB\u9759\u9ED8\u4E22\u5F03\uFF0C\u5199\u540E\u56DE\u8BFB\u4E00\u6B21\u6838\u5BF9\uFF1B\u6216\u6362\u542B /meta \u6743\u9650\u7684\u8EAB\u4EFD\u91CD\u8DD1\u3002
4653
+ `
4654
+ );
4655
+ }
4638
4656
  process.exitCode = result.failed > 0 ? 3 : 0;
4639
4657
  return;
4640
4658
  } catch (e) {
@@ -11387,7 +11405,7 @@ init_exit();
11387
11405
  import { createJiraClient } from "@hcmai/sdk";
11388
11406
 
11389
11407
  // src/jira/gaps.ts
11390
- import { CASES_REPO_SLUG as CASES_REPO_SLUG2, repoIssueUrl } from "@hcmai/sdk";
11408
+ import { CASES_REPO_SLUG as CASES_REPO_SLUG2, describeNonBmpHits, findNonBmpChars, repoIssueUrl } from "@hcmai/sdk";
11391
11409
  import { linkedRepoRefs, parseRef } from "@hcmai/sdk";
11392
11410
  var MIN_LEN = [
11393
11411
  ["title", 8],
@@ -11411,6 +11429,8 @@ function validateGapInput(x) {
11411
11429
  if (!["\u963B\u65AD", "\u6709\u66FF\u4EE3\u6CD5", "\u63AA\u8F9E\u7EA7"].includes(String(g.severity))) problems.push("severity \u53EA\u80FD\u662F \u963B\u65AD / \u6709\u66FF\u4EE3\u6CD5 / \u63AA\u8F9E\u7EA7");
11412
11430
  if (!["\u7F3A\u9677", "\u7F3A\u80FD\u529B"].includes(String(g.kind))) problems.push("kind \u53EA\u80FD\u662F \u7F3A\u9677\uFF08\u6545\u969C\uFF09/ \u7F3A\u80FD\u529B\uFF08\u9700\u6C42\uFF09");
11413
11431
  if (g.module !== void 0 && !["HCM-Core", "HCM-Cloud", "\u4EA7\u54C1\u652F\u6301"].includes(String(g.module))) problems.push("module \u53EA\u80FD\u662F HCM-Core / HCM-Cloud / \u4EA7\u54C1\u652F\u6301");
11432
+ const nonBmp = findNonBmpChars(g);
11433
+ if (nonBmp.length) problems.push(describeNonBmpHits(nonBmp).split("\n").join("\n "));
11414
11434
  if (problems.length) throw new Error(`\u7F3A\u53E3\u8F7D\u8377\u4E0D\u5408\u683C\uFF0C\u6CA1\u6709\u63D0\uFF1A
11415
11435
  ${problems.join("\n ")}`);
11416
11436
  return g;
@@ -11773,7 +11793,17 @@ async function gapComments({ client: client3 }, ref, { limit } = {}, casesSlug =
11773
11793
  }
11774
11794
 
11775
11795
  // src/jira/gap-verify.ts
11776
- import { CASES_REPO_SLUG as CASES_REPO_SLUG3, CliError as CliError26, CliErrorCode as CliErrorCode27, JiraHttpError, firstLine as firstLine2, parseRef as parseRef2 } from "@hcmai/sdk";
11796
+ import {
11797
+ CASES_REPO_SLUG as CASES_REPO_SLUG3,
11798
+ CliError as CliError26,
11799
+ CliErrorCode as CliErrorCode27,
11800
+ JiraHttpError,
11801
+ JiraNonBmpContentError,
11802
+ NON_BMP_RULE_NOTE,
11803
+ firstLine as firstLine2,
11804
+ nonBmpHitLines,
11805
+ parseRef as parseRef2
11806
+ } from "@hcmai/sdk";
11777
11807
  var VERIFY_RESULTS = ["pass", "fail", "partial"];
11778
11808
  var WRITTEN_TAG = { no: "\u3010\u672A\u5199\u5165\u3011", yes: "\u3010\u5DF2\u5199\u5165\u3011", unknown: "\u3010\u5199\u6CA1\u5199\u4E0D\u786E\u5B9A\u3011" };
11779
11809
  var FIXED_STATUS = "\u5DF2\u4FEE\u590D";
@@ -11869,6 +11899,19 @@ function unconfirmedWhy(e) {
11869
11899
  return name;
11870
11900
  }
11871
11901
  function writeFailure(e, key2, what) {
11902
+ if (e instanceof JiraNonBmpContentError) {
11903
+ return verifyFailure(
11904
+ "non-bmp-content",
11905
+ CliErrorCode27.INVALID_ARGUMENT,
11906
+ "no",
11907
+ `\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`,
11908
+ // 🔴 清单落 nextStep,不落 cause:CliError 渲染 cause 时 formatCause 截到 300 字,
11909
+ // 三处命中就会把「该怎么改」整段截掉——那正是顾问唯一需要的那段。
11910
+ `\u6362\u6389\u4E0B\u9762\u8FD9\u4E9B\u5B57\u7B26\u518D\u91CD\u8DD1\uFF08${NON_BMP_RULE_NOTE}\uFF09\uFF1A
11911
+ ${nonBmpHitLines(e.hits)}`,
11912
+ { key: key2, hits: e.hits }
11913
+ );
11914
+ }
11872
11915
  if (e instanceof JiraHttpError && e.status >= 400 && e.status < 500) {
11873
11916
  return verifyFailure("write-rejected", CliErrorCode27.BUSINESS_RULE_VIOLATION, "no", `Jira \u4EE5 ${e.status} \u62D2\u7EDD\u4E86\u8FD9\u6B21${what}`, rejectNextStep(e.status, key2), {
11874
11917
  key: key2,