@lichao0223/lobehub-cli 0.0.91 → 0.0.93

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
@@ -267616,7 +267616,7 @@ const execFileAsync$2 = promisify(execFile);
267616
267616
  const PROJECT_FILE_GLOB_LIMIT = 5e3;
267617
267617
  const PROJECT_FILE_SEARCH_DEFAULT_LIMIT = 100;
267618
267618
  const PROJECT_DIRECTORY_LIST_LIMIT = 1e3;
267619
- const toPosixRelativePath$1 = (filePath) => filePath.split(path.sep).join("/");
267619
+ const toPosixRelativePath = (filePath) => filePath.split(path.sep).join("/");
267620
267620
  /** Parent of a posix index path (`a/b/c.ts` → `a/b/`), or null at the root. */
267621
267621
  const getParentRelativePath = (relativePath) => {
267622
267622
  const cleaned = relativePath.endsWith("/") ? relativePath.slice(0, -1) : relativePath;
@@ -267625,7 +267625,7 @@ const getParentRelativePath = (relativePath) => {
267625
267625
  return `${cleaned.slice(0, index)}/`;
267626
267626
  };
267627
267627
  const createProjectFileEntry = (root, absolutePath, isDirectory, gitIgnored, collapsed) => {
267628
- const relativePath = toPosixRelativePath$1(path.relative(root, absolutePath));
267628
+ const relativePath = toPosixRelativePath(path.relative(root, absolutePath));
267629
267629
  return {
267630
267630
  ...collapsed ? { collapsed: true } : {},
267631
267631
  ...gitIgnored ? { gitIgnored: true } : {},
@@ -268508,7 +268508,6 @@ const prepareSkillDirectory = async (params, deps = {}) => {
268508
268508
 
268509
268509
  //#endregion
268510
268510
  //#region ../../packages/device-control/src/workspace.ts
268511
- const MAX_SKILL_FILE_COUNT = 1e3;
268512
268511
  const DEFAULT_DIRECTORY_PAGE_SIZE = 200;
268513
268512
  const MAX_DIRECTORY_PAGE_SIZE = 1e3;
268514
268513
  const SKILL_SOURCES = [
@@ -268580,30 +268579,6 @@ const createDeviceSkillRoots = () => {
268580
268579
  * before its parents, project before device.
268581
268580
  */
268582
268581
  const createSkillRoots = async (root) => [...createProjectSkillRoots(root, await resolveAgentFileDirs(root)), ...createDeviceSkillRoots()];
268583
- const toPosixRelativePath = (filePath) => filePath.split(path.sep).join("/");
268584
- const listSkillFilesRecursive = async (dir) => {
268585
- const results = [];
268586
- const stack = [dir];
268587
- while (stack.length > 0 && results.length < MAX_SKILL_FILE_COUNT) {
268588
- const current = stack.pop();
268589
- let entries;
268590
- try {
268591
- entries = await readdir(current, { withFileTypes: true });
268592
- } catch {
268593
- continue;
268594
- }
268595
- for (const entry of entries) {
268596
- if (entry.name.startsWith(".")) continue;
268597
- const full = path.join(current, entry.name);
268598
- if (entry.isDirectory()) stack.push(full);
268599
- else if (entry.isFile()) {
268600
- results.push(toPosixRelativePath(path.relative(dir, full)));
268601
- if (results.length >= MAX_SKILL_FILE_COUNT) break;
268602
- }
268603
- }
268604
- }
268605
- return results.sort();
268606
- };
268607
268582
  const readStringField = (data, field) => {
268608
268583
  const value = data[field];
268609
268584
  return typeof value === "string" ? value.trim() : void 0;
@@ -268626,30 +268601,32 @@ const parseSkillFrontmatter = (raw) => {
268626
268601
  };
268627
268602
  /**
268628
268603
  * Scan one skill source directory and return parsed frontmatter for each
268629
- * `SKILL.md`. Returns `[]` when the source directory is absent or unreadable.
268630
- * Unsorted — callers sort/merge.
268604
+ * `SKILL.md`. Once a directory contains `SKILL.md`, treat it as a skill root
268605
+ * and do not recurse into its subdirectories (`scripts/`, `references/`, etc.).
268606
+ * Returns `[]` when the source directory is absent or unreadable.
268607
+ * Candidates are ordered by directory name to make alias precedence stable.
268631
268608
  */
268632
- const scanSkillsInSource = async ({ previewRoot, scope, source, sourceRoot }) => {
268609
+ const scanSkillsInSource = async ({ previewRoot, scope, source, sourceRoot }, seenRealPaths) => {
268633
268610
  let entries;
268634
268611
  try {
268635
268612
  entries = await readdir(sourceRoot, { withFileTypes: true });
268636
268613
  } catch {
268637
268614
  return [];
268638
268615
  }
268639
- return (await Promise.all(entries.filter((entry) => entry.isDirectory() || entry.isSymbolicLink()).map(async (entry) => {
268616
+ return Promise.all(entries.filter((entry) => !entry.name.startsWith(".") && (entry.isDirectory() || entry.isSymbolicLink())).sort((a, b) => a.name.localeCompare(b.name)).map(async (entry) => {
268640
268617
  const skillDir = path.join(sourceRoot, entry.name);
268641
268618
  const skillFile = path.join(skillDir, "SKILL.md");
268642
268619
  try {
268620
+ const realPath = await realpath(skillFile);
268621
+ if (seenRealPaths.has(realPath)) return null;
268643
268622
  const fields = parseSkillFrontmatter(await readFile(skillFile, "utf8"));
268644
- const files = await listSkillFilesRecursive(skillDir);
268645
268623
  return {
268646
268624
  description: fields.description || void 0,
268647
268625
  disableModelInvocation: fields.disableModelInvocation,
268648
- fileCount: files.length,
268649
- files,
268650
268626
  name: fields.name || entry.name,
268651
268627
  path: skillFile,
268652
268628
  previewRoot,
268629
+ realPath,
268653
268630
  scope,
268654
268631
  skillDir,
268655
268632
  source
@@ -268657,15 +268634,18 @@ const scanSkillsInSource = async ({ previewRoot, scope, source, sourceRoot }) =>
268657
268634
  } catch {
268658
268635
  return null;
268659
268636
  }
268660
- }))).filter((skill) => skill !== null);
268637
+ }));
268661
268638
  };
268662
268639
  const collectSkills = async (roots) => {
268663
- const seen = /* @__PURE__ */ new Set();
268640
+ const seenNames = /* @__PURE__ */ new Set();
268641
+ const seenRealPaths = /* @__PURE__ */ new Set();
268664
268642
  const skills = [];
268665
- for (const root of roots) for (const skill of await scanSkillsInSource(root)) {
268666
- if (seen.has(skill.name)) continue;
268667
- seen.add(skill.name);
268668
- skills.push(skill);
268643
+ for (const root of roots) for (const skill of await scanSkillsInSource(root, seenRealPaths)) {
268644
+ if (!skill || seenNames.has(skill.name) || seenRealPaths.has(skill.realPath)) continue;
268645
+ const { realPath, ...item } = skill;
268646
+ seenNames.add(item.name);
268647
+ seenRealPaths.add(realPath);
268648
+ skills.push(item);
268669
268649
  }
268670
268650
  return skills.sort((a, b) => a.name.localeCompare(b.name));
268671
268651
  };
package/man/man1/lh.1 CHANGED
@@ -1,6 +1,6 @@
1
1
  .\" Code generated by `npm run man:generate`; DO NOT EDIT.
2
2
  .\" Manual command details come from the Commander command tree.
3
- .TH LH 1 "" "@lichao0223/lobehub\-cli 0.0.91" "User Commands"
3
+ .TH LH 1 "" "@lichao0223/lobehub\-cli 0.0.93" "User Commands"
4
4
  .SH NAME
5
5
  lh \- LobeHub CLI \- manage and connect to LobeHub services
6
6
  .SH SYNOPSIS
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lichao0223/lobehub-cli",
3
- "version": "0.0.91",
3
+ "version": "0.0.93",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/lichao0223/lobehub",
@@ -83,5 +83,5 @@
83
83
  "access": "public",
84
84
  "registry": "https://registry.npmjs.org"
85
85
  },
86
- "gitHead": "ec34575cf58bf6e37b3d76081bce550363c14b02"
86
+ "gitHead": "ac933bd1a8026c509db693c8a49b516c49439f49"
87
87
  }