@hcmai/cli 0.13.0 → 0.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -6370,6 +6370,14 @@ async function resolveBundledClosure(targetId, dir = bundledSkillsDir()) {
6370
6370
 
6371
6371
  // src/commands/skills.ts
6372
6372
  var SKILLS_STATE_FILE = ".hcm-skills.json";
6373
+ function resolveRenamedId(id, half) {
6374
+ if (half.entries.has(id)) return id;
6375
+ if (half.status !== "fetched") return id;
6376
+ for (const [current, entry] of half.entries) {
6377
+ if ((entry.meta.renamedFrom ?? []).includes(id)) return current;
6378
+ }
6379
+ return id;
6380
+ }
6373
6381
  function migrateSkillsState(state) {
6374
6382
  const skills2 = {};
6375
6383
  for (const [id, record] of Object.entries(state.skills ?? {})) {
@@ -6796,14 +6804,15 @@ async function skillsInstallCommand(id, args) {
6796
6804
  };
6797
6805
  const installBundled = async (one) => {
6798
6806
  const { documents: local, external } = await resolveBundledClosure(one);
6799
- for (const need of external) {
6807
+ for (const rawNeed of external) {
6808
+ const need = resolveRenamedId(rawNeed, catalog.chiron);
6800
6809
  if (catalog.chiron.status !== "fetched") {
6801
6810
  throw invalid(
6802
6811
  `\u81EA\u5E26\u6280\u80FD ${one} \u4F9D\u8D56\u777F\u620E\u6280\u80FD ${need}\uFF0C\u4F46\u8FD9\u4E00\u8D9F\u6CA1\u8FDE\u7F51\u53D6\u777F\u620E\u76EE\u5F55\uFF08--source ${source}\uFF09\u3002\u8054\u7F51\u540E\u91CD\u8DD1\uFF0C\u6216\u5148\u5355\u72EC\u88C5\u4E0A\u5B83\u3002`
6803
6812
  );
6804
6813
  }
6805
6814
  if (!catalog.chiron.entries.has(need)) {
6806
- throw invalid(`\u81EA\u5E26\u6280\u80FD ${one} \u4F9D\u8D56 ${need}\uFF0C\u4F46 ${endpoint} \u7684\u6280\u80FD\u76EE\u5F55\u91CC\u6CA1\u6709\u5B83`);
6815
+ throw invalid(`\u81EA\u5E26\u6280\u80FD ${one} \u4F9D\u8D56 ${rawNeed}${need !== rawNeed ? `\uFF08\u73B0\u540D ${need}\uFF09` : ""}\uFF0C\u4F46 ${endpoint} \u7684\u6280\u80FD\u76EE\u5F55\u91CC\u6CA1\u6709\u5B83`);
6807
6816
  }
6808
6817
  pushAll(
6809
6818
  await mapWithConcurrency(
@@ -6849,6 +6858,34 @@ async function skillsInstallCommand(id, args) {
6849
6858
  );
6850
6859
  }
6851
6860
  }
6861
+ if (args.check) {
6862
+ const fmtCheck = args.output ?? "table";
6863
+ const would = documents.map((d) => d.id).sort();
6864
+ if (fmtCheck === "json" || fmtCheck === "yaml") {
6865
+ process.stdout.write(formatObject16({
6866
+ dryRun: true,
6867
+ baseDir: layout.baseDir,
6868
+ target: layout.target,
6869
+ all,
6870
+ managed: false,
6871
+ wouldInstall: would,
6872
+ endpoint,
6873
+ base
6874
+ }, { format: fmtCheck }) + "\n");
6875
+ } else {
6876
+ process.stdout.write(`\u8FD9\u4E2A\u76EE\u5F55\u8FD8\u6CA1\u88C5\u8FC7\u6280\u80FD\uFF08${path6.join(layout.baseDir, SKILLS_STATE_FILE)} \u4E0D\u5B58\u5728\uFF09\u3002
6877
+ `);
6878
+ process.stdout.write(`--check\uFF1A\u4F1A\u88C5 ${would.length} \u4E2A\u6280\u80FD\u5230 ${layout.baseDir}\uFF0C\u5E76\u628A\u7D22\u5F15\u4E0E\u9879\u76EE\u8FB9\u754C\u5757\u5199\u8FDB ${layout.agentsFile ?? "AGENTS.md"}\u3002**\u672C\u6B21\u4E00\u4E2A\u5B57\u8282\u90FD\u6CA1\u5199\u3002**
6879
+ `);
6880
+ if (would.length > 0) {
6881
+ process.stdout.write(` ${would.slice(0, 8).join("\u3001")}${would.length > 8 ? ` \u7B49 ${would.length} \u4E2A` : ""}
6882
+ `);
6883
+ }
6884
+ process.stdout.write(" \u771F\u88C5\uFF1A\u53BB\u6389 --check \u91CD\u8DD1\u3002\n");
6885
+ }
6886
+ process.exitCode = 0;
6887
+ return;
6888
+ }
6852
6889
  const result = await installSkillDocuments(documents, requestedIds, layout.baseDir, Boolean(args.force), {
6853
6890
  endpoint,
6854
6891
  base,
@@ -7356,8 +7393,9 @@ async function planSkillUpdate(options) {
7356
7393
  }
7357
7394
  chironNeeded.add(item.id);
7358
7395
  }
7359
- for (const id of chironNeeded) {
7396
+ for (const rawId of chironNeeded) {
7360
7397
  if (!manifest2) continue;
7398
+ const id = resolveRenamedId(rawId, catalog.chiron);
7361
7399
  try {
7362
7400
  for (const skill of resolveSkillInstallOrder(manifest2, id)) {
7363
7401
  if (!closure.has(skill.id)) closure.set(skill.id, { kind: "chiron", skill });