Skip to content

Commit 48b7803

Browse files
committed
fix(provider-cursor): installed node_modules no longer exhaust skill discovery
1 parent 339179f commit 48b7803

2 files changed

Lines changed: 47 additions & 0 deletions

File tree

‎packages/provider-cursor/src/server/skills.test.ts‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,51 @@ describe("Cursor skills", () => {
163163
}),
164164
));
165165

166+
it("discovers skills across roots without scanning installed node_modules", async () =>
167+
await runNode(
168+
Effect.gen(function* () {
169+
const fileSystem = yield* FileSystem.FileSystem;
170+
const path = yield* Path.Path;
171+
const userHome = yield* fileSystem
172+
.makeTempDirectoryScoped({
173+
directory: NodeOS.tmpdir(),
174+
prefix: "cursor-skills-home-",
175+
})
176+
.pipe(Effect.flatMap((directory) => fileSystem.realPath(directory)));
177+
const root = path.join(userHome, ".agents", "skills");
178+
const dependencies = path.join(root, "review", "tests", "node_modules");
179+
yield* fileSystem.makeDirectory(dependencies, { recursive: true });
180+
yield* Effect.forEach(
181+
Array.from({ length: 10_001 }, (_, index) => path.join(dependencies, `entry-${index}`)),
182+
(file) => fileSystem.writeFileString(file, ""),
183+
{ concurrency: 64, discard: true },
184+
);
185+
const skillDirectories = [
186+
path.join(root, "review"),
187+
path.join(root, "sibling"),
188+
path.join(userHome, ".claude", "skills", "later"),
189+
];
190+
for (const directory of skillDirectories) {
191+
yield* fileSystem.makeDirectory(directory, { recursive: true });
192+
yield* fileSystem.writeFileString(path.join(directory, "SKILL.md"), "---\n---\n");
193+
}
194+
195+
const result = yield* probeCursorSkills(undefined, { HOME: userHome }).pipe(Effect.result);
196+
expect(result._tag).toBe("Success");
197+
if (result._tag !== "Success") return;
198+
expect(result.success).toEqual(
199+
skillDirectories
200+
.map((directory) => ({
201+
name: path.basename(directory),
202+
path: path.join(directory, "SKILL.md"),
203+
scope: "user",
204+
enabled: true,
205+
}))
206+
.sort((left, right) => left.name.localeCompare(right.name)),
207+
);
208+
}),
209+
));
210+
166211
it("still fails discovery when a root holds more entries than the scan allows", async () =>
167212
await runNode(
168213
Effect.gen(function* () {

‎packages/provider-cursor/src/server/skills.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,8 @@ const discoverSkillsInRoot = Effect.fn("discoverCursorSkillsInRoot")(function* (
201201
return;
202202
}
203203
input.budget.remainingEntries -= 1;
204+
// Installed dependencies can exhaust the shared budget and hide unrelated skills.
205+
if (entry === "node_modules") continue;
204206
const child = path.join(directory, entry);
205207
const info = yield* orUndefined(fileSystem.stat(child), input.budget);
206208
if (info?.type !== "Directory") continue;

0 commit comments

Comments
 (0)