@hcmai/cli 0.13.1 → 0.13.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
@@ -6991,18 +6991,35 @@ async function syncAgentIndexes(layout, manifest2) {
6991
6991
  const results = [];
6992
6992
  for (const file of files) {
6993
6993
  const agentsDir = path6.dirname(file);
6994
- const entries = Object.keys(state.skills).sort().map((id) => {
6994
+ const entries = await Promise.all(Object.keys(state.skills).sort().map(async (id) => {
6995
6995
  const known = catalog.get(id);
6996
6996
  const absolute = path6.join(layout.baseDir, id, "SKILL.md");
6997
6997
  let relative2 = path6.relative(agentsDir, absolute);
6998
6998
  if (!relative2.startsWith(".")) relative2 = `./${relative2}`;
6999
+ let title = known?.title;
7000
+ let description = known?.description;
7001
+ if (title === void 0 || description === void 0) {
7002
+ const markdown = await readInstalled(layout.baseDir, id);
7003
+ if (markdown !== void 0) {
7004
+ try {
7005
+ const frontmatter = parseSkillFrontmatter2(markdown, id);
7006
+ const localTitle = frontmatter.title;
7007
+ const localDescription = frontmatter.description;
7008
+ if (title === void 0 && typeof localTitle === "string" && localTitle.trim()) title = localTitle.trim();
7009
+ if (description === void 0 && typeof localDescription === "string" && localDescription.trim()) {
7010
+ description = localDescription.trim();
7011
+ }
7012
+ } catch {
7013
+ }
7014
+ }
7015
+ }
6999
7016
  return {
7000
7017
  id,
7001
- title: known?.title ?? id,
7002
- description: known?.description ?? "",
7018
+ title: title ?? id,
7019
+ description: description ?? "",
7003
7020
  relativePath: relative2.split(path6.sep).join("/")
7004
7021
  };
7005
- });
7022
+ }));
7006
7023
  const status = await upsertAgentsBlock(file, renderAgentsBlock(entries));
7007
7024
  const before = await fsp2.readFile(file, "utf8").catch(() => "");
7008
7025
  const merged = mergeBoundaryBlock(before, manifest2?.agentBoundary);
@@ -7085,7 +7102,11 @@ function renderAgentsBlock(entries) {
7085
7102
  ];
7086
7103
  for (const e of entries) {
7087
7104
  lines.push(`- \`${e.relativePath}\` \u2014 **${e.title}**`);
7088
- if (e.description) lines.push(` ${e.description}`);
7105
+ if (e.description) {
7106
+ lines.push(` ${e.description}`);
7107
+ } else {
7108
+ lines.push(" \uFF08\u67E5\u4E0D\u5230\u63CF\u8FF0\uFF1A\u4EA7\u54C1\u76EE\u5F55\u91CC\u6CA1\u6709\u5B83\uFF0C\u76D8\u4E0A\u90A3\u4EFD SKILL.md \u7684 frontmatter \u4E5F\u6CA1\u7ED9\u3002\u8981\u7528\u5B83\u5C31\u5148\u6253\u5F00\u8BFB\u4E00\u773C\u3002\uFF09");
7109
+ }
7089
7110
  }
7090
7111
  lines.push("", AGENTS_BLOCK_END);
7091
7112
  return lines.join("\n");
@@ -7413,10 +7434,11 @@ async function planSkillUpdate(options) {
7413
7434
  const fetch2 = async () => item.kind === "cli" ? await fetchBundled(id) : await fetchDocument(item.skill);
7414
7435
  if (onDisk === void 0) {
7415
7436
  documents.push(await fetch2());
7437
+ const renamedFromId = renamedPairs.find((pair) => pair.to === id)?.from;
7416
7438
  entries.push({
7417
7439
  id,
7418
7440
  status: "added",
7419
- note: record ? "\u672C\u5730\u6587\u4EF6\u7F3A\u5931\uFF0C\u91CD\u65B0\u88C5\u56DE" : all ? "\u4EA7\u54C1\u8FD9\u4E00\u7248\u65B0\u589E\u7684\u6280\u80FD" : "\u4EA7\u54C1\u65B0\u589E\u7684\u524D\u7F6E\u6280\u80FD"
7441
+ note: renamedFromId ? `${renamedFromId} \u6539\u540D\u540E\u7684\u65B0\u540D\uFF0C\u5185\u5BB9\u642C\u5230\u4E86\u8FD9\u91CC` : record ? "\u672C\u5730\u6587\u4EF6\u7F3A\u5931\uFF0C\u91CD\u65B0\u88C5\u56DE" : all ? "\u4EA7\u54C1\u8FD9\u4E00\u7248\u65B0\u589E\u7684\u6280\u80FD" : "\u4EA7\u54C1\u65B0\u589E\u7684\u524D\u7F6E\u6280\u80FD"
7420
7442
  });
7421
7443
  continue;
7422
7444
  }