@hcmai/cli 0.27.1 → 0.27.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
@@ -4309,6 +4309,14 @@ function printQueryResult(result, fmt, dsl = {}) {
4309
4309
  process.stderr.write(`\u63D0\u793A [${w.code}]${text2 ? " " + text2 : ""}
4310
4310
  `);
4311
4311
  }
4312
+ for (const m of result.match ?? []) {
4313
+ const total = m.includedTotal ?? m.included.length;
4314
+ const listed = m.listedInWarning ?? m.included.length;
4315
+ if (m.included.length <= listed && total <= listed) continue;
4316
+ process.stderr.write(
4317
+ `match \u53D6\u503C\u5168\u96C6 [${m.field}]\uFF08\u5171 ${total} \u4E2A\uFF0C\u63D0\u793A\u6B63\u6587\u53EA\u5217\u4E86\u524D ${listed} \u4E2A\uFF09\uFF1A` + m.included.map((hit) => `"${hit.value}"`).join("\u3001") + "\n"
4318
+ );
4319
+ }
4312
4320
  if (fmt === "table" && result.total !== void 0) {
4313
4321
  process.stdout.write(`Showing ${result.rows.length} of ${result.total} results.
4314
4322
  `);
@@ -5107,7 +5115,13 @@ function formatDescriptionTable(desc, verbose = false) {
5107
5115
  );
5108
5116
  }
5109
5117
  if (desc.relations.length) {
5110
- lines.push(`relations: ${desc.relations.map((r) => `${r.key}(via ${r.via})`).join(", ")}`);
5118
+ lines.push(`relations: ${desc.relations.map((r) => {
5119
+ const target = r.target ? ` \u2192 ${r.target}` : "";
5120
+ const card = r.cardinality ? `, ${r.cardinality}${r.cardinality === "many" ? "\uFF08\u4EC5 exists\uFF09" : ""}` : "";
5121
+ const filter = r.filter ? `, \u8FC7\u6EE4 ${r.filter}` : "";
5122
+ const declared = r.declaredIn && r.declaredIn !== desc.model && !r.auto ? `, \u58F0\u660E\u4E8E ${r.declaredIn}` : "";
5123
+ return `${r.key}(via ${r.via}${target}${card}${filter}${declared})`;
5124
+ }).join(", ")}`);
5111
5125
  }
5112
5126
  return lines.join("\n");
5113
5127
  }
@@ -16418,16 +16432,37 @@ var installed = async (ctx) => {
16418
16432
  ctx.skills = states;
16419
16433
  const keys = (s) => Object.keys(s.state.skills);
16420
16434
  const count = new Set(states.flatMap(keys)).size;
16435
+ const localDir = skillsLocalDir(ctx.root);
16436
+ let local;
16437
+ try {
16438
+ local = await readLocalSkills(localDir, { strict: true });
16439
+ } catch (error) {
16440
+ if (!(error instanceof SkillsDirUnreadable)) throw error;
16441
+ return unknown("SKILLS_LOCAL_UNREADABLE", `${path15.relative(ctx.root, localDir)} \u8BFB\u4E0D\u4E86\uFF0C\u81EA\u5199\u6280\u80FD\u6570\u4E0D\u51FA\u6765\uFF1B${unreadableFix(error.code, error.detail)}\u540E\u91CD\u67E5`, {
16442
+ note: `${error.where}\uFF1A${error.detail}`
16443
+ });
16444
+ }
16445
+ const localNote = local.length > 0 ? `\uFF1B${path15.relative(ctx.root, localDir)}/ \u53E6\u6709 ${local.length} \u4EFD\u81EA\u5199\u6280\u80FD\uFF08\u4E0D\u8FDB\u9501\u6587\u4EF6\uFF0Csync \u4E0D\u7BA1\u5B83\u4EEC\uFF09` : "";
16421
16446
  const target = ctx.environments.find((e) => e.report.target);
16422
16447
  if (states.some((s) => s.state.endpoint && normalizeOrigin6(s.state.endpoint) !== normalizeOrigin6(target.config.endpoint)))
16423
16448
  return found("SKILLS_ENDPOINT_MISMATCH", void 0, { value: count });
16424
16449
  if (count === 0) {
16425
16450
  const legacy = await read(path15.join(ctx.root, "hcm-skills"));
16426
- return found(legacy && Object.keys(legacy.skills).length > 0 ? "SKILLS_LEGACY_LAYOUT" : "SKILLS_EMPTY", void 0, { value: count, evidence: "ABSENT" });
16451
+ if (legacy && Object.keys(legacy.skills).length > 0) return found("SKILLS_LEGACY_LAYOUT", void 0, { value: count, evidence: "ABSENT" });
16452
+ if (local.length > 0) {
16453
+ return pass(
16454
+ `0 \u4E2A\u4EA7\u54C1\u6280\u80FD\uFF08hcm-skills/sync/ \u4E0E .claude/skills/ \u90FD\u6CA1\u6709\u9501\u6587\u4EF6\uFF09${localNote}\uFF1B\u8981\u88C5\u4EA7\u54C1\u6280\u80FD\u518D\u8DD1 sync`,
16455
+ { value: local.length }
16456
+ );
16457
+ }
16458
+ return found("SKILLS_EMPTY", void 0, { value: count, evidence: "ABSENT" });
16427
16459
  }
16428
16460
  if (states.length === 2 && keys(states[0]).length > 0 && keys(states[1]).length > 0 && keys(states[0]).sort().join("\0") !== keys(states[1]).sort().join("\0"))
16429
16461
  return found("SKILLS_SPLIT_LAYOUT", void 0, { value: count });
16430
- return pass(`${count} \u4E2A\u6280\u80FD\uFF08\u4E24\u4EFD\u9501\u6587\u4EF6 skills \u952E\u7684\u5E76\u96C6\uFF09\uFF1B${states.map((s) => path15.relative(ctx.root, s.baseDir)).join("\u3001")}`, { value: count });
16462
+ return pass(
16463
+ `${count} \u4E2A\u4EA7\u54C1\u6280\u80FD\uFF08\u4E24\u4EFD\u9501\u6587\u4EF6 skills \u952E\u7684\u5E76\u96C6\uFF09\uFF1B${states.map((s) => path15.relative(ctx.root, s.baseDir)).join("\u3001")}${localNote}`,
16464
+ { value: count + local.length }
16465
+ );
16431
16466
  } catch (error) {
16432
16467
  return unknown("SKILLS_STATE_UNREADABLE", void 0, {
16433
16468
  note: `${reading}\uFF1A${safeError(error)}\uFF1B\u5148\u4FEE\u590D\u9501\u6587\u4EF6 JSON \u6216\u8BFB\u53D6\u6743\u9650\uFF08\u53EF\u4ECE\u5907\u4EFD\u6062\u590D\uFF09\uFF0C\u518D\u6309\u4E0B\u4E00\u6B65\u540C\u6B65\u5E76\u91CD\u8DD1\u4F53\u68C0`
@@ -17112,7 +17147,7 @@ var CODE_TABLE = {
17112
17147
  CLI_LATEST_UNKNOWN: c("\u53D6\u4E0D\u5230 npm \u6700\u65B0\u7248\u672C\uFF1B\u68C0\u67E5 registry \u7F51\u7EDC\u540E\u91CD\u8BD5"),
17113
17148
  CLI_VERSION_UNPARSEABLE: c("\u7248\u672C\u53F7\u4E0D\u662F X.Y.Z\uFF0C\u6BD4\u4E0D\u4E86\u65B0\u65E7\uFF1B\u5BF9\u7167 hcm --version \u4E0E npm view @hcmai/cli version --registry https://registry.npmjs.org \u7684\u539F\u6837\u8F93\u51FA\uFF0C\u91CD\u88C5\u672C\u673A CLI \u6216\u62A5\u7ED9 CLI \u7EF4\u62A4\u65B9\u540E\u91CD\u67E5"),
17114
17149
  SKILLS_STATE_UNREADABLE: c("\u6280\u80FD\u9501\u6587\u4EF6\u65E0\u6CD5\u8BFB\u53D6\uFF1B\u4FEE\u590D\u6587\u4EF6\u540E\u540C\u6B65\u91CD\u67E5", "WARN", "FDE", both),
17115
- SKILLS_EMPTY: c("\u4E24\u79CD\u5E03\u5C40\u4E0B\u6280\u80FD\u5747\u4E3A\u7A7A", "CRITICAL", "FDE", both),
17150
+ SKILLS_EMPTY: c("\u4E24\u79CD\u5E03\u5C40\u7684\u9501\u6587\u4EF6\u4E0E hcm-skills/local/ \u90FD\u6CA1\u6709\u6280\u80FD", "CRITICAL", "FDE", both),
17116
17151
  SKILLS_LEGACY_LAYOUT: c("\u4EC5\u6709\u65E7\u6241\u5E73\u5E03\u5C40\u7684\u6280\u80FD", "WARN", "FDE", (e) => sync(e, "codex")),
17117
17152
  SKILLS_SPLIT_LAYOUT: c("\u4E24\u79CD\u5E03\u5C40\u7684\u6280\u80FD\u96C6\u5408\u4E0D\u540C", "WARN", "FDE", both),
17118
17153
  SKILLS_ENDPOINT_MISMATCH: c("\u6280\u80FD\u9501\u6587\u4EF6\u7684 endpoint \u4E0E\u76EE\u6807\u4E0D\u7B26", "CRITICAL", "FDE", both),
@@ -17200,7 +17235,7 @@ var CHECKS = [
17200
17235
  descriptor("local.project.env", "\u9879\u76EE\u73AF\u5883", [], ["ENV_FILE_MISSING", "ENV_FILE_INVALID", "ENV_NOT_RESOLVED"], 5e3, localChecks.project),
17201
17236
  descriptor("local.credential", "\u672C\u673A\u51ED\u636E\u69FD", ["local.project.env"], ["CREDENTIAL_MISSING"], 5e3, localChecks.credential),
17202
17237
  descriptor("local.cli.version", "CLI \u7248\u672C", [], ["CLI_OUTDATED", "CLI_LATEST_UNKNOWN", "CLI_VERSION_UNPARSEABLE"], 1e4, localChecks.version),
17203
- descriptor("local.skills.installed", "\u6280\u80FD", ["local.project.env"], ["SKILLS_STATE_UNREADABLE", "SKILLS_EMPTY", "SKILLS_LEGACY_LAYOUT", "SKILLS_SPLIT_LAYOUT", "SKILLS_ENDPOINT_MISMATCH"], 5e3, localChecks.installed),
17238
+ descriptor("local.skills.installed", "\u6280\u80FD", ["local.project.env"], ["SKILLS_STATE_UNREADABLE", "SKILLS_EMPTY", "SKILLS_LEGACY_LAYOUT", "SKILLS_SPLIT_LAYOUT", "SKILLS_ENDPOINT_MISMATCH", "SKILLS_LOCAL_UNREADABLE"], 5e3, localChecks.installed),
17204
17239
  descriptor("local.skills.fresh", "\u6280\u80FD\u65B0\u9C9C\u5EA6", ["local.skills.installed"], ["SKILLS_STALE", "SKILLS_LOCALLY_MODIFIED", "SKILLS_CATALOG_UNCHECKED", "SKILLS_CATALOG_UNAVAILABLE"], 1e4, localChecks.fresh),
17205
17240
  descriptor("local.skills.shadow", "\u672C\u5730\u906E\u853D", [], ["SKILLS_LOCAL_SHADOW", "SKILLS_LOCAL_UNREADABLE"], 5e3, localChecks.shadow),
17206
17241
  descriptor("local.boundary", "\u9879\u76EE\u8FB9\u754C", [], ["BOUNDARY_MISSING", "BOUNDARY_FALLBACK"], 5e3, localChecks.boundary),
@@ -17997,7 +18032,7 @@ var localCriterion = {
17997
18032
  "local.project.env": "env.yaml \u5B58\u5728\u3001\u53EF\u89E3\u6790\uFF0C\u76EE\u6807\u73AF\u5883\u80FD\u89E3\u6790\u5230\u9879\u76EE\u73AF\u5883",
17998
18033
  "local.credential": "\u6BCF\u4E2A\u9879\u76EE\u73AF\u5883\u6709\u5339\u914D endpoint \u4E0E\u79DF\u6237\u7684\u672C\u673A\u51ED\u636E\u69FD",
17999
18034
  "local.cli.version": "\u4E0E npm \u6700\u65B0 CLI \u7248\u672C\u6BD4\u8F83",
18000
- "local.skills.installed": "\u4E24\u79CD\u5E03\u5C40\u7684\u6280\u80FD\u5E76\u96C6\u3001\u9501\u6587\u4EF6\u4E0E\u76EE\u6807\u73AF\u5883\u4E00\u81F4",
18035
+ "local.skills.installed": "\u4E24\u79CD\u5E03\u5C40\u7684\u9501\u6587\u4EF6\u5E76\u96C6\u52A0 hcm-skills/local/ \u81EA\u5199\u6280\u80FD\u3001\u9501\u6587\u4EF6\u4E0E\u76EE\u6807\u73AF\u5883\u4E00\u81F4",
18001
18036
  "local.skills.fresh": "\u672C\u673A\u6280\u80FD\u4E0E\u76EE\u6807\u73AF\u5883\u7684\u4EA7\u54C1\u6280\u80FD\u76EE\u5F55\u5BF9\u8D26",
18002
18037
  "local.skills.shadow": "hcm-skills/local/ \u91CC\u4E0E hcm-skills/sync/ \u540C id \u7684\u6280\u80FD\uFF08\u540C\u540D\u65F6\u751F\u6548\u7684\u662F local/\uFF0C\u4EA7\u54C1\u7248\u88AB\u538B\u4F4F\uFF09\uFF1B\u6709\u5C31 WARN \u5E76\u5217\u51FA id \u4E0E local \u90A3\u4EFD\u7684\u9996\u884C\u8BF4\u660E\u3002local/ \u8BFB\u4E0D\u4E86\u3001\u6216 sync/ \u91CC\u4E0E local/ \u540C id \u7684\u90A3\u4EFD\u8BFB\u4E0D\u4E86\uFF0C\u5224 UNDETERMINED\uFF1Bsync/ \u91CC\u4E0E local/ \u65E0\u5173\u7684\u6761\u76EE\u8BFB\u4E0D\u4E86\u4E0D\u6321\u7ED3\u8BBA\uFF0C\u6458\u8981\u5217\u51FA\u3001note \u5E26\u539F\u59CB\u62A5\u9519\uFF1Bsync/ \u8BFB\u5F97\u4E86\u7684\u4E00\u4EFD\u90FD\u6CA1\u6709\u53C8\u6709\u8BFB\u4E0D\u4E86\u7684\uFF0C\u5224 UNDETERMINED",
18003
18038
  "local.boundary": "\u9879\u76EE\u8FB9\u754C\u5757\u5B58\u5728\uFF0C\u4E14\u4E0D\u662F CLI fallback \u526F\u672C",