@hcmai/cli 0.14.4 → 0.15.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
@@ -6117,7 +6117,7 @@ function classifyInstalledSource(id, record, catalog) {
6117
6117
  return kind === "cli" ? "removed-in-cli" : "removed-upstream";
6118
6118
  }
6119
6119
  var SOURCE_STATUS_NOTE = {
6120
- "removed-upstream": "\u4EA7\u54C1\u8FD9\u4E00\u7248\u7684\u6280\u80FD\u76EE\u5F55\u91CC\u5DF2\u7ECF\u6CA1\u6709\u5B83\u4E86\uFF1B\u672C\u5730\u6587\u4EF6\u4FDD\u7559\u4E0D\u52A8",
6120
+ "removed-upstream": "\u4EA7\u54C1\u8FD9\u4E00\u7248\u7684\u6280\u80FD\u76EE\u5F55\u91CC\u5DF2\u7ECF\u6CA1\u6709\u5B83\u4E86",
6121
6121
  "removed-in-cli": "\u8FD9\u4E00\u7248 CLI \u4E0D\u518D\u81EA\u5E26\u5B83\uFF08\u591A\u534A\u662F\u88AB\u4EA7\u54C1\u6536\u7F16\u4E86\uFF0C\u8DD1 hcm skills list \u770B\u770B\uFF09",
6122
6122
  "not-checked": "\u672C\u8F6E\u6CA1\u8FDE\u7F51\u6838\u5BF9\u5B83\u7684\u6765\u6E90\uFF08--source cli\uFF09\uFF0C\u5B83\u662F\u4E0D\u662F\u8FD8\u5728\u4EA7\u54C1\u76EE\u5F55\u91CC\u8FD9\u4E00\u8D9F\u4E0D\u77E5\u9053",
6123
6123
  local: "\u672C\u5730\u6765\u6E90\uFF08install --from \u88C5\u7684\uFF09\uFF0Cupdate \u4E0D\u7BA1\u5B83\uFF1B\u8981\u66F4\u65B0\u5C31\u518D install --from \u4E00\u6B21"
@@ -7485,6 +7485,89 @@ async function readLocalSkills(localDir) {
7485
7485
  }
7486
7486
  return out;
7487
7487
  }
7488
+ async function resolveSkillPath(layout, id) {
7489
+ assertSafeSkillId(id);
7490
+ const at = async (dir) => {
7491
+ const file = path8.join(dir, id, "SKILL.md");
7492
+ return await fsp2.stat(file).then(() => file).catch(() => void 0);
7493
+ };
7494
+ const inSync = await at(layout.baseDir);
7495
+ const inLocal = layout.localDir ? await at(layout.localDir) : void 0;
7496
+ if (inLocal) {
7497
+ return {
7498
+ id,
7499
+ file: inLocal,
7500
+ half: "local",
7501
+ references: path8.join(layout.localDir, id, "references"),
7502
+ ...inSync ? { shadowed: inSync } : {}
7503
+ };
7504
+ }
7505
+ if (inSync) {
7506
+ return { id, file: inSync, half: "sync", references: path8.join(layout.baseDir, id, "references") };
7507
+ }
7508
+ const looked = [
7509
+ ...layout.localDir ? [`${layout.localDir}/${id}/SKILL.md`] : [],
7510
+ `${layout.baseDir}/${id}/SKILL.md`
7511
+ ];
7512
+ throw new CliError20({
7513
+ code: CliErrorCode19.INVALID_ARGUMENT,
7514
+ message: `\u8FD9\u4E2A\u9879\u76EE\u91CC\u6CA1\u6709\u6280\u80FD ${id}\u3002\u627E\u8FC7\uFF1A
7515
+ ${looked.join("\n ")}
7516
+ \u770B\u6709\u54EA\u4E9B\uFF1Ahcm skills list --installed\uFF1B\u6CA1\u88C5\u5C31\u5148 hcm chiron skills sync\u3002`
7517
+ });
7518
+ }
7519
+ async function skillsPathCommand(id, args) {
7520
+ try {
7521
+ const layout = await resolveInstallLayout(args);
7522
+ const resolved = await resolveSkillPath(layout, id);
7523
+ const fmt = args.output ?? "table";
7524
+ if (fmt === "json" || fmt === "yaml") {
7525
+ process.stdout.write(formatObject17(resolved, { format: fmt }) + "\n");
7526
+ process.exitCode = 0;
7527
+ return;
7528
+ }
7529
+ process.stderr.write(
7530
+ resolved.half === "local" ? `\u2192 ${SKILLS_LOCAL_SUBDIR}/ \u90A3\u4E00\u534A\uFF08\u4F60\u6539\u8FC7\u7684\u7248\u672C\uFF09` + (resolved.shadowed ? `\uFF0C\u5B83\u906E\u4F4F\u4E86 ${resolved.shadowed}
7531
+ ` : "\n") : `\u2192 ${SKILLS_SYNC_SUBDIR}/ \u90A3\u4E00\u534A\uFF08\u4EA7\u54C1\u7EF4\u62A4\uFF0C\u540C\u6B65\u4F1A\u66F4\u65B0\u5B83\uFF09
7532
+ `
7533
+ );
7534
+ process.stdout.write(`${args.refs ? resolved.references : resolved.file}
7535
+ `);
7536
+ process.exitCode = 0;
7537
+ } catch (e) {
7538
+ fail6(e, args);
7539
+ }
7540
+ }
7541
+ async function findShadowBypassingRefs(layout, shadowedIds) {
7542
+ if (shadowedIds.size === 0) return [];
7543
+ const hits = [];
7544
+ let ids;
7545
+ try {
7546
+ ids = (await fsp2.readdir(layout.baseDir, { withFileTypes: true })).filter((e) => e.isDirectory() && !e.name.startsWith(".")).map((e) => e.name);
7547
+ } catch {
7548
+ return [];
7549
+ }
7550
+ for (const from of ids.sort()) {
7551
+ const files = [path8.join(layout.baseDir, from, "SKILL.md")];
7552
+ const refDir = path8.join(layout.baseDir, from, "references");
7553
+ try {
7554
+ for (const e of await fsp2.readdir(refDir, { withFileTypes: true })) {
7555
+ if (e.isFile()) files.push(path8.join(refDir, e.name));
7556
+ }
7557
+ } catch {
7558
+ }
7559
+ for (const file of files) {
7560
+ const text = await fsp2.readFile(file, "utf8").catch(() => void 0);
7561
+ if (text === void 0) continue;
7562
+ for (const to of shadowedIds) {
7563
+ if (new RegExp(`\\.\\./(?:\\.\\./)*${to.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}/`).test(text)) {
7564
+ hits.push({ from, to, file });
7565
+ }
7566
+ }
7567
+ }
7568
+ }
7569
+ return hits;
7570
+ }
7488
7571
  async function syncAgentIndexes(layout, manifest2) {
7489
7572
  if (!layout.agentsFile) return [];
7490
7573
  const state = await readSkillsState(layout.baseDir);
@@ -7761,27 +7844,34 @@ async function planStaleReferences(state, documents, baseDir) {
7761
7844
  const byKey = (a, b) => `${a.id}/${a.path}`.localeCompare(`${b.id}/${b.path}`);
7762
7845
  return { remove: remove.sort(byKey), keptLocallyModified: keptLocallyModified.sort(byKey) };
7763
7846
  }
7764
- async function removeRenamedSkills(baseDir, renamed) {
7765
- if (renamed.length === 0) return [];
7847
+ async function removeSkillDirs(baseDir, ids) {
7848
+ if (ids.length === 0) return [];
7766
7849
  const kept = [];
7767
7850
  const state = await readSkillsState(baseDir);
7768
- for (const { from } of renamed) {
7769
- assertSafeSkillId(from);
7770
- const dir = path8.join(baseDir, from);
7851
+ for (const id of ids) {
7852
+ assertSafeSkillId(id);
7853
+ const dir = path8.join(baseDir, id);
7771
7854
  const resolved = path8.resolve(dir);
7772
- if (resolved !== path8.join(path8.resolve(baseDir), from)) continue;
7855
+ if (resolved !== path8.join(path8.resolve(baseDir), id)) continue;
7773
7856
  const hasSkillFile = await fsp2.stat(path8.join(dir, "SKILL.md")).then(() => true).catch(() => false);
7774
7857
  const exists2 = await fsp2.stat(dir).then(() => true).catch(() => false);
7775
7858
  if (exists2 && !hasSkillFile) {
7776
- kept.push({ from, kept: "\u76EE\u5F55\u91CC\u6CA1\u6709 SKILL.md\uFF0C\u50CF\u662F\u4F60\u81EA\u5DF1\u653E\u7684\u4E1C\u897F\uFF0C\u6CA1\u6709\u5220" });
7777
- } else if (exists2) {
7778
- await fsp2.rm(dir, { recursive: true, force: true });
7859
+ kept.push({ id, kept: "\u76EE\u5F55\u91CC\u6CA1\u6709 SKILL.md\uFF0C\u50CF\u662F\u4F60\u81EA\u5DF1\u653E\u7684\u4E1C\u897F\uFF0C\u6CA1\u6709\u5220" });
7860
+ continue;
7779
7861
  }
7780
- if (state?.skills[from] !== void 0) delete state.skills[from];
7862
+ if (exists2) await fsp2.rm(dir, { recursive: true, force: true });
7863
+ if (state?.skills[id] !== void 0) delete state.skills[id];
7781
7864
  }
7782
7865
  if (state) await writeSkillsState(baseDir, state);
7783
7866
  return kept;
7784
7867
  }
7868
+ async function removeRenamedSkills(baseDir, renamed) {
7869
+ const kept = await removeSkillDirs(baseDir, renamed.map((r) => r.from));
7870
+ return kept.map((k) => ({ from: k.id, kept: k.kept }));
7871
+ }
7872
+ async function removeOrphanSkills(baseDir, ids) {
7873
+ return await removeSkillDirs(baseDir, ids);
7874
+ }
7785
7875
  async function writeSkillDocuments(documents, baseDir, removals = []) {
7786
7876
  const staged = [];
7787
7877
  const removed = [];
@@ -7848,9 +7938,69 @@ async function recordInstalled(baseDir, documents, meta2) {
7848
7938
  await writeSkillsState(baseDir, state);
7849
7939
  return state;
7850
7940
  }
7941
+ function parsePruneMax(raw) {
7942
+ if (raw === void 0) return void 0;
7943
+ const text = typeof raw === "number" ? void 0 : raw.trim();
7944
+ const n = text === void 0 ? raw : text === "" ? Number.NaN : Number(text);
7945
+ if (!Number.isInteger(n) || n < 0) {
7946
+ throw new CliError20({
7947
+ code: CliErrorCode19.INVALID_ARGUMENT,
7948
+ message: `--prune-max \u8981\u4E00\u4E2A\u975E\u8D1F\u6574\u6570\uFF0C\u6536\u5230 ${JSON.stringify(raw)}\u30020 = \u8FD9\u4E00\u8D9F\u4E00\u4EFD\u90FD\u522B\u6E05\uFF1B\u4E0D\u7ED9\u8FD9\u4E2A\u53C2\u6570\u65F6\u4E0A\u9650\u662F\u300C${PRUNE_DEFAULT_MAX} \u4E0E\u5728\u518C\u4EFD\u6570\u4E00\u534A\u53D6\u5C0F\u300D\u3002`
7949
+ });
7950
+ }
7951
+ return n;
7952
+ }
7851
7953
  function invalid(message) {
7852
7954
  return new CliError20({ code: CliErrorCode19.INVALID_ARGUMENT, message });
7853
7955
  }
7956
+ var PRUNE_DEFAULT_MAX = 5;
7957
+ var PRUNE_MAX_SHARE = 0.5;
7958
+ function orphanPruneLimit(trackedCount, explicitMax) {
7959
+ if (explicitMax !== void 0) return explicitMax;
7960
+ return Math.min(PRUNE_DEFAULT_MAX, Math.floor(trackedCount * PRUNE_MAX_SHARE));
7961
+ }
7962
+ var PRUNABLE_STATUS = /* @__PURE__ */ new Set(["removed-upstream", "removed-in-cli"]);
7963
+ async function planOrphanPrune(options) {
7964
+ const { entries, state, baseDir, liveMarkdown, trackedCount, max } = options;
7965
+ const remove = [];
7966
+ const kept = [];
7967
+ for (const entry of entries) {
7968
+ if (!PRUNABLE_STATUS.has(entry.status)) continue;
7969
+ const id = entry.id;
7970
+ const record = state.skills[id];
7971
+ const onDisk = await readInstalled(baseDir, id);
7972
+ if (onDisk !== void 0 && record !== void 0) {
7973
+ let edited = sha2562(onDisk) !== record.sha256;
7974
+ for (const [refPath, recordedSha] of Object.entries(record.references ?? {})) {
7975
+ const installed = await readInstalledReference(baseDir, id, refPath);
7976
+ if (installed !== void 0 && sha2562(installed) !== recordedSha) edited = true;
7977
+ }
7978
+ if (edited) {
7979
+ kept.push({
7980
+ id,
7981
+ why: `\u672C\u5730\u6539\u8FC7\uFF0C\u6CA1\u6709\u5220\u3002\u4E0A\u6E38\u5DF2\u7ECF\u4E0D\u53D1\u5B83\u4E86\u2014\u2014\u76D8\u4E0A\u8FD9\u4EFD\u5C31\u662F\u552F\u4E00\u4E00\u4EFD\uFF0C\u60F3\u957F\u671F\u7559\u4F4F\u5C31\u632A\u5230 ${SKILLS_LOCAL_SUBDIR}/${id}/\uFF08\u90A3\u4E00\u4FA7 CLI \u4ECE\u4E0D\u5199\uFF09`
7982
+ });
7983
+ continue;
7984
+ }
7985
+ }
7986
+ const referrers = [...liveMarkdown].filter(([otherId, markdown]) => otherId !== id && /* 相对引用与同级链接两种形态 */
7987
+ (markdown.includes(`../${id}/`) || markdown.includes(`](${id}/`))).map(([otherId]) => otherId);
7988
+ if (referrers.length > 0) {
7989
+ kept.push({
7990
+ id,
7991
+ why: `\u8FD8\u6709 ${referrers.length} \u4EFD\u6D3B\u7740\u7684\u6280\u80FD\u5728\u5F15\u7528\u5B83\uFF08${referrers.join("\u3001")}\uFF09\uFF0C\u5220\u4E86\u5C31\u662F\u628A\u94FE\u63A5\u6307\u5411\u7A7A\u6C14`
7992
+ });
7993
+ continue;
7994
+ }
7995
+ remove.push({ id, status: entry.status });
7996
+ }
7997
+ const limit = orphanPruneLimit(trackedCount, max);
7998
+ if (remove.length > limit) {
7999
+ const why = max !== void 0 ? `\u4E00\u8D9F\u8981\u6E05 ${remove.length} \u4EFD\uFF0C\u8D85\u8FC7\u4F60\u7ED9\u7684\u4E0A\u9650 ${limit} \u4EFD` : limit < PRUNE_DEFAULT_MAX ? `\u4E00\u8D9F\u8981\u6E05 ${remove.length} \u4EFD\uFF0C\u8D85\u8FC7\u5728\u518C ${trackedCount} \u4EFD\u7684\u4E00\u534A\uFF08\u4E0A\u9650 ${limit} \u4EFD\uFF09` : `\u4E00\u8D9F\u8981\u6E05 ${remove.length} \u4EFD\uFF0C\u8D85\u8FC7\u4E0A\u9650 ${limit} \u4EFD`;
8000
+ return { remove: [], kept, refused: { count: remove.length, limit, why } };
8001
+ }
8002
+ return { remove, kept };
8003
+ }
7854
8004
  async function readInstalled(baseDir, id) {
7855
8005
  try {
7856
8006
  return await fsp2.readFile(path8.join(baseDir, id, "SKILL.md"), "utf8");
@@ -7995,7 +8145,21 @@ async function planSkillUpdate(options) {
7995
8145
  });
7996
8146
  }
7997
8147
  entries.sort((a, b) => a.id.localeCompare(b.id));
7998
- return { entries, documents, renamed: renamedPairs };
8148
+ const liveMarkdown = /* @__PURE__ */ new Map();
8149
+ for (const id of closure.keys()) {
8150
+ const pending = documents.find((d) => d.id === id);
8151
+ const markdown = pending?.markdown ?? await readInstalled(baseDir, id);
8152
+ if (markdown !== void 0) liveMarkdown.set(id, markdown);
8153
+ }
8154
+ const prune = await planOrphanPrune({
8155
+ entries,
8156
+ state,
8157
+ baseDir,
8158
+ liveMarkdown,
8159
+ trackedCount: Object.keys(state.skills).length,
8160
+ max: options.pruneMax
8161
+ });
8162
+ return { entries, documents, renamed: renamedPairs, prune };
7999
8163
  }
8000
8164
  var UPDATE_STATUS_LABEL = {
8001
8165
  updated: "\u5DF2\u66F4\u65B0",
@@ -8048,6 +8212,7 @@ async function skillsUpdateCommand(args) {
8048
8212
  baseDir: layout.baseDir,
8049
8213
  force: Boolean(args.force),
8050
8214
  all,
8215
+ pruneMax: parsePruneMax(args.pruneMax),
8051
8216
  fetchDocument: (skill) => fetchSkillDocument(http, skill, endpoint, base)
8052
8217
  });
8053
8218
  const stale = await planStaleReferences(state, plan.documents, layout.baseDir);
@@ -8066,6 +8231,7 @@ async function skillsUpdateCommand(args) {
8066
8231
  `);
8067
8232
  }
8068
8233
  }
8234
+ const pruneKept = !args.check && plan.prune.remove.length > 0 ? await removeOrphanSkills(layout.baseDir, plan.prune.remove.map((r) => r.id)) : [];
8069
8235
  const agentIndexes = !args.check && layout.agentsFile ? await syncAgentIndexes(layout, manifest2) : [];
8070
8236
  const changed = plan.entries.filter((e) => e.status === "updated" || e.status === "added");
8071
8237
  const fmt = args.output ?? "table";
@@ -8083,6 +8249,11 @@ async function skillsUpdateCommand(args) {
8083
8249
  },
8084
8250
  cliVersion: CLI_VERSION,
8085
8251
  staleReferences: stale,
8252
+ prune: {
8253
+ removed: plan.prune.remove.map((r) => r.id),
8254
+ kept: plan.prune.kept,
8255
+ refused: plan.prune.refused
8256
+ },
8086
8257
  entries: plan.entries
8087
8258
  }, { format: fmt }) + "\n");
8088
8259
  process.exitCode = 0;
@@ -8105,8 +8276,10 @@ async function skillsUpdateCommand(args) {
8105
8276
  const notChecked = plan.entries.filter((e) => e.status === "not-checked").length;
8106
8277
  const tail = [
8107
8278
  skipped > 0 ? `${skipped} \u4E2A\u672C\u5730\u6539\u8FC7\u88AB\u8DF3\u8FC7\uFF08--force \u8986\u76D6\uFF09` : "",
8108
- removed > 0 ? `${removed} \u4E2A\u4EA7\u54C1\u5DF2\u79FB\u9664\uFF08\u672C\u5730\u6587\u4EF6\u4FDD\u7559\uFF09` : "",
8109
- removedInCli > 0 ? `${removedInCli} \u4E2A\u8FD9\u4E00\u7248 CLI \u4E0D\u518D\u81EA\u5E26\uFF08\u672C\u5730\u6587\u4EF6\u4FDD\u7559\uFF09` : "",
8279
+ removed > 0 ? `${removed} \u4E2A\u4EA7\u54C1\u5DF2\u79FB\u9664` : "",
8280
+ removedInCli > 0 ? `${removedInCli} \u4E2A\u8FD9\u4E00\u7248 CLI \u4E0D\u518D\u81EA\u5E26` : "",
8281
+ plan.prune.remove.length > 0 ? `\u5176\u4E2D ${plan.prune.remove.length} \u4EFD${args.check ? "\u4F1A\u88AB" : "\u5DF2"}\u6E05\u6389` : "",
8282
+ plan.prune.kept.length + pruneKept.length > 0 ? `${plan.prune.kept.length + pruneKept.length} \u4EFD\u6CA1\u6E05\uFF08\u4E0A\u9762\u9010\u4E2A\u8BF4\u4E86\u4E3A\u4EC0\u4E48\uFF09` : "",
8110
8283
  notChecked > 0 ? `${notChecked} \u4E2A\u672C\u8F6E\u672A\u6838\uFF08\u90A3\u4E00\u534A\u8FD9\u8D9F\u6CA1\u770B\uFF09` : ""
8111
8284
  ].filter(Boolean).join("\uFF0C");
8112
8285
  const cliCount = plan.entries.filter(
@@ -8130,13 +8303,47 @@ async function skillsUpdateCommand(args) {
8130
8303
  `
8131
8304
  );
8132
8305
  }
8306
+ if (plan.prune.remove.length > 0) {
8307
+ process.stdout.write(
8308
+ ` ${args.check ? "\u4F1A\u6E05\u6389" : "\u5DF2\u6E05\u6389"} ${plan.prune.remove.length} \u4EFD\u4E0A\u6E38\u4E0D\u518D\u53D1\u7684\u6280\u80FD\uFF08${plan.prune.remove.map((r) => r.id).join("\u3001")}\uFF09
8309
+ `
8310
+ );
8311
+ }
8312
+ for (const k of plan.prune.kept) {
8313
+ process.stdout.write(` ! ${k.id} \u6CA1\u6E05\uFF1A${k.why}
8314
+ `);
8315
+ }
8316
+ for (const k of pruneKept) {
8317
+ process.stdout.write(` ! ${k.id} \u6CA1\u6E05\uFF1A${k.kept}
8318
+ `);
8319
+ }
8320
+ if (plan.prune.refused) {
8321
+ process.stdout.write(
8322
+ ` \u26A0\uFE0F \u5B64\u513F\u6E05\u7406\u6574\u6279\u62D2\u7EDD\uFF1A${plan.prune.refused.why}\u3002\u8FD9\u4E0D\u50CF\u6280\u80FD\u9000\u5F79\uFF0C\u50CF\u76EE\u5F55\u53D6\u6B8B\u4E86\u2014\u2014
8323
+ \u5148\u8DD1 hcm skills list \u770B\u770B\u76EE\u5F55\u662F\u4E0D\u662F\u5168\u7684\uFF1B\u786E\u8BA4\u65E0\u8BEF\u518D\u8DD1 hcm chiron skills sync --prune-max ${plan.prune.refused.count}
8324
+ `
8325
+ );
8326
+ }
8327
+ {
8328
+ const shadowedIds = new Set(
8329
+ (await readLocalSkills(layout.localDir)).map((x) => x.id).filter((id) => state.skills[id] !== void 0)
8330
+ );
8331
+ const bypass = await findShadowBypassingRefs(layout, shadowedIds);
8332
+ for (const hit of bypass) {
8333
+ process.stdout.write(
8334
+ ` \u26A0\uFE0F ${path8.relative(layout.baseDir, hit.file)} \u91CC\u7684 ../${hit.to}/ \u7ED5\u8FC7\u4E86\u906E\u853D\uFF1A\u4F60\u5728 ${SKILLS_LOCAL_SUBDIR}/${hit.to}/ \u6539\u8FC7\u5B83\uFF0C\u4F46\u987A\u7740\u8FD9\u6761\u76F8\u5BF9\u8DEF\u5F84\u8BFB\u5230\u7684\u662F ${SKILLS_SYNC_SUBDIR}/ \u91CC\u7684\u4EA7\u54C1\u539F\u7248
8335
+ \u6B63\u6587\u6539\u6210\u6309 id \u53D6\u5740\u5C31\u4E0D\u4F1A\u518D\u9519\uFF1Ahcm chiron skills path ${hit.to}
8336
+ `
8337
+ );
8338
+ }
8339
+ }
8133
8340
  if (stale.keptLocallyModified.length > 0) {
8134
8341
  process.stdout.write(
8135
8342
  ` ${stale.keptLocallyModified.length} \u4E2A\u4EA7\u54C1\u5DF2\u64A4\u6389\u4F46\u672C\u5730\u6539\u8FC7\u7684\u53C2\u8003\u6587\u4EF6\u4FDD\u7559\u4E86\uFF08${stale.keptLocallyModified.map((r) => `${r.id}/references/${r.path}`).join("\u3001")}\uFF09
8136
8343
  `
8137
8344
  );
8138
8345
  }
8139
- if (changed.length === 0 && skipped === 0 && removed === 0) {
8346
+ if (changed.length === 0 && skipped === 0 && removed === 0 && removedInCli === 0 && plan.prune.remove.length === 0) {
8140
8347
  process.stdout.write(args.check ? " \u5168\u90E8\u5DF2\u662F\u6700\u65B0\uFF08--check \u53EA\u770B\u4E0D\u52A8\uFF09\n" : " \u5168\u90E8\u5DF2\u662F\u6700\u65B0\uFF0C\u6CA1\u6709\u6539\u52A8\n");
8141
8348
  } else {
8142
8349
  const head = args.check ? changed.length > 0 ? `\u6709 ${changed.length} \u4E2A\u53EF\u4EE5\u66F4\u65B0\uFF0C\u53BB\u6389 --check \u5C31\u4F1A\u5199\u5165` : "\u6CA1\u6709\u53EF\u5199\u5165\u7684\u66F4\u65B0" : changed.length > 0 ? `\u5DF2\u66F4\u65B0 ${changed.length} \u4E2A` : "\u6CA1\u6709\u5199\u5165\u4EFB\u4F55\u6539\u52A8";
@@ -13584,7 +13791,8 @@ chiron.command("doctor").description(
13584
13791
  "\u6838\u5BF9\uFF1A\u672C\u673A\u767B\u5F55\u662F\u5426\u5BF9\u7740 env.yaml \u7684\u73AF\u5883\uFF08\u542B\u56DB\u6761\u951A\u70B9\uFF09/ \u6280\u80FD\u88C5\u6CA1\u88C5 / \u6848\u4F8B\u5E93 clone \u4E86\u6CA1 / Jira \u80FD\u4E0D\u80FD\u63D0\u5355"
13585
13792
  ).option("--project <dir>", "\u9879\u76EE\u6839\u76EE\u5F55", ".").option("--env <name>", "\u8986\u76D6\u8981\u6838\u7684\u73AF\u5883\u522B\u540D\uFF08\u9ED8\u8BA4\u53D6 env.yaml\uFF1B\u591A\u73AF\u5883\u9879\u76EE\u7528\u5B83\u6328\u4E2A\u63A2\uFF09").option("--as <identity>", "\u4E34\u65F6\u6362\u8EAB\u4EFD\u63A2\u951A\u70B9").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((opts) => chironDoctorCommand(opts));
13586
13793
  var chironSkills = chiron.command("skills").description("\u8FD9\u4E2A\u9879\u76EE\u4ED3\u7684\u6280\u80FD\uFF1A\u8DDF\u76EE\u6807\u73AF\u5883\u5BF9\u9F50");
13587
- chironSkills.command("sync").description("\u8BA9\u8FD9\u4E2A\u4ED3\u7684\u6280\u80FD\u8DDF\u76EE\u6807\u73AF\u5883\u5BF9\u9F50\uFF1A\u7B2C\u4E00\u6B21\u5C31\u88C5\u9F50\uFF0C\u4E4B\u540E\u6309\u4EA7\u54C1\u5F53\u524D\u5168\u96C6\u5BF9\u8D26\u3002\u5E42\u7B49\uFF0C\u4EA7\u54C1\u5347\u7EA7\u540E\u8DD1\u5B83").option("--only <id...>", "\u53EA\u8981\u8FD9\u51E0\u4E2A\u6280\u80FD\uFF08\u8FDE\u540C requires \u524D\u7F6E\uFF09\uFF0C\u4E0D\u8BA2\u9605\u5168\u96C6\uFF1B\u8BAD\u7EC3\u573A blind \u6863\u7528").option("--check", "\u53EA\u770B\u4F1A\u53D8\u4EC0\u4E48\uFF0C\u4E0D\u5199\u76D8").option("--target <agent>", "claude\uFF08.claude/skills/\uFF09| codex\uFF08hcm-skills/ + Agent \u7D22\u5F15\uFF09| auto", "auto").option("--global", "\u540C\u6B65\u7528\u6237\u7EA7\u76EE\u5F55\u800C\u975E\u5F53\u524D\u9879\u76EE").option("--dir <path>", "\u540C\u6B65\u6307\u5B9A\u76EE\u5F55").option("--from <dir>", "\u4ECE\u672C\u5730\u76EE\u5F55\u53D6\uFF08\u73B0\u573A\u6539\u8FC7\u7684\u7248\u672C\uFF09\uFF0C\u4E0D\u8D70\u7F51\u7EDC").option("--force", "\u8FDE\u672C\u5730\u6539\u8FC7\u7684\u6280\u80FD\u4E00\u8D77\u8986\u76D6\u6210\u4EA7\u54C1\u8FD9\u4E00\u7248").option("--source <kind>", "\u8FD9\u4E00\u8D9F\u770B\u54EA\u4E9B\u6765\u6E90\uFF1Acli\uFF08\u53EA\u770B\u81EA\u5E26\uFF0C\u4E0D\u8FDE\u7F51\uFF09| chiron | all", "all").option("--endpoint <url>", "\u6280\u80FD\u5E93\u5730\u5740\uFF08\u9ED8\u8BA4\u53D6\u9879\u76EE\u73AF\u5883\u6216\u5B89\u88C5\u65F6\u8BB0\u5F55\u7684\u5730\u5740\uFF09").option("--env <name>", "\u4ECE\u8BE5 env \u89E3\u6790 endpoint").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((opts) => skillsSyncCommand(opts));
13794
+ chironSkills.command("sync").description("\u8BA9\u8FD9\u4E2A\u4ED3\u7684\u6280\u80FD\u8DDF\u76EE\u6807\u73AF\u5883\u5BF9\u9F50\uFF1A\u7B2C\u4E00\u6B21\u5C31\u88C5\u9F50\uFF0C\u4E4B\u540E\u6309\u4EA7\u54C1\u5F53\u524D\u5168\u96C6\u5BF9\u8D26\u3002\u5E42\u7B49\uFF0C\u4EA7\u54C1\u5347\u7EA7\u540E\u8DD1\u5B83").option("--only <id...>", "\u53EA\u8981\u8FD9\u51E0\u4E2A\u6280\u80FD\uFF08\u8FDE\u540C requires \u524D\u7F6E\uFF09\uFF0C\u4E0D\u8BA2\u9605\u5168\u96C6\uFF1B\u8BAD\u7EC3\u573A blind \u6863\u7528").option("--check", "\u53EA\u770B\u4F1A\u53D8\u4EC0\u4E48\uFF0C\u4E0D\u5199\u76D8").option("--target <agent>", "claude\uFF08.claude/skills/\uFF09| codex\uFF08hcm-skills/ + Agent \u7D22\u5F15\uFF09| auto", "auto").option("--global", "\u540C\u6B65\u7528\u6237\u7EA7\u76EE\u5F55\u800C\u975E\u5F53\u524D\u9879\u76EE").option("--dir <path>", "\u540C\u6B65\u6307\u5B9A\u76EE\u5F55").option("--from <dir>", "\u4ECE\u672C\u5730\u76EE\u5F55\u53D6\uFF08\u73B0\u573A\u6539\u8FC7\u7684\u7248\u672C\uFF09\uFF0C\u4E0D\u8D70\u7F51\u7EDC").option("--force", "\u8FDE\u672C\u5730\u6539\u8FC7\u7684\u6280\u80FD\u4E00\u8D77\u8986\u76D6\u6210\u4EA7\u54C1\u8FD9\u4E00\u7248").option("--prune-max <n>", `\u4E00\u8D9F\u6700\u591A\u6E05\u51E0\u4EFD\u4E0A\u6E38\u4E0D\u518D\u53D1\u7684\u6280\u80FD\uFF0C\u8D85\u4E86\u6574\u6279\u62D2\u7EDD\uFF1B0 = \u4E00\u4EFD\u90FD\u522B\u6E05\uFF08\u7F3A\u7701 ${PRUNE_DEFAULT_MAX}\uFF09`).option("--source <kind>", "\u8FD9\u4E00\u8D9F\u770B\u54EA\u4E9B\u6765\u6E90\uFF1Acli\uFF08\u53EA\u770B\u81EA\u5E26\uFF0C\u4E0D\u8FDE\u7F51\uFF09| chiron | all", "all").option("--endpoint <url>", "\u6280\u80FD\u5E93\u5730\u5740\uFF08\u9ED8\u8BA4\u53D6\u9879\u76EE\u73AF\u5883\u6216\u5B89\u88C5\u65F6\u8BB0\u5F55\u7684\u5730\u5740\uFF09").option("--env <name>", "\u4ECE\u8BE5 env \u89E3\u6790 endpoint").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((opts) => skillsSyncCommand(opts));
13795
+ chironSkills.command("path <id>").description("\u6253\u5370\u8FD9\u4E2A id \u5728\u672C\u9879\u76EE\u5B9E\u9645\u751F\u6548\u90A3\u4E00\u4EFD\u7684\u8DEF\u5F84\uFF08local/ \u906E\u853D sync/\uFF09\uFF0C\u4F9B\u6280\u80FD\u6B63\u6587\u5F15\u7528\uFF0C\u514D\u5F97\u6B63\u6587\u5199\u6B7B\u76EE\u5F55\u5C42\u6570").option("--refs", "\u8981 references/ \u7684\u843D\u70B9\uFF0C\u4E0D\u662F SKILL.md").option("--target <agent>", "claude | codex | auto", "auto").option("--global", "\u770B\u7528\u6237\u7EA7\u76EE\u5F55").option("--dir <path>", "\u770B\u6307\u5B9A\u76EE\u5F55").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((id, opts) => skillsPathCommand(id, opts));
13588
13796
  var OUTPUT_OPT = ["--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table"];
13589
13797
  var projectEnv = chiron.command("env").description("\u7EF4\u62A4\u672C\u9879\u76EE env.yaml\uFF1B\u672C\u673A\u69FD\u7531 hcm env \u7BA1\u7406");
13590
13798
  projectEnv.command("list").description("\u5217\u51FA\u9879\u76EE\u73AF\u5883\u3001\u9ED8\u8BA4\u9879\u548C\u672C\u673A\u8EAB\u4EFD\u53EF\u7528\u6027\uFF08\u63A2\u4E0D\u5230\u65F6\u6807\u672A\u9A8C\u8BC1\uFF09").option("--project <dir>", "\u9879\u76EE\u76EE\u5F55\uFF08\u5411\u4E0A\u5BFB\u627E env.yaml\uFF09", ".").option(...OUTPUT_OPT).action((opts) => chironEnvCommand("list", opts));