Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix(skills): reserve the parent listing for skill folders found unlisted
AdityaUmaled1b5fbf847a9
diff --git a/server/skill-fetch.test.ts b/server/skill-fetch.test.tsindex 36a4754fd6..66205d4f18 100644--- a/server/skill-fetch.test.ts+++ b/server/skill-fetch.test.ts@@ -397,6 +397,16 @@ describe("skill import budget", () => {expect(skills).toHaveLength(30);});+ it("keeps requests for the folder listing a skill under .claude or .agents still needs", async () => {+ const entries: Record<string, FakeRepoEntry> = {+ ".claude/skills/SKILL.md": SKILL("claude-one"),+ ".agents/skills/SKILL.md": SKILL("agents-one"),+ };+ for (const folder of ["docs", "guides", "pages", "notes"]) for (let i = 0; i < 100; i++) entries[`${folder}/page-${i}/README.md`] = "# Page";+ const skills = ok(await fetchSkillFromSource("a/b", fakeGitHub({ "a/b": entries }).fetch));+ expect(skills).toHaveLength(2);+ });+it("stops a larger collection at the per-import cap", async () => {const entries: Record<string, FakeRepoEntry> = {};for (let i = 0; i < MAX_SKILLS_PER_IMPORT + 5; i++) entries[`skills/skill-${i}/SKILL.md`] = SKILL(`skill-${i}`);diff --git a/server/skill-fetch.ts b/server/skill-fetch.tsindex ab151f0b7c..0223c549d5 100644--- a/server/skill-fetch.ts+++ b/server/skill-fetch.ts@@ -349,8 +349,10 @@ async function discoverSkillDirs(target: Target, snapshot: Snapshot, fetcher: Imconst preferred = ["skills", ".claude", ".agents"];const rank = (name: string) => (wanted && toSkillSlug(name) === wanted ? 0 : preferred.includes(name) ? 1 : 2);const ordered = [...dirs].sort((a, b) => rank(a.name) - rank(b.name));- // Each skill found takes one more request to fetch its folder, so the walk stops while those still fit.- const enough = () => found.length >= (wanted ? 1 : MAX_SKILLS_PER_IMPORT) || (found.length > 0 && fetcher.apiRequestsLeft() < found.length + 2);+ // Each skill found takes one more request to fetch its folder, plus its parent's listing when that folder was never listed,+ // so the walk stops while those still fit.+ const reserved = () => found.reduce((sum, dir) => sum + (snapshot.trees.has(dir) ? 1 : 2), 2);+ const enough = () => found.length >= (wanted ? 1 : MAX_SKILLS_PER_IMPORT) || (found.length > 0 && fetcher.apiRequestsLeft() < reserved());for (const dir of ordered.slice(0, MAX_FOLDERS_WALKED)) {if (enough()) break;const base = dir.name === ".claude" || dir.name === ".agents" ? `${dir.path}/skills` : dir.path;