The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 23, 03:00 UTC
fix(provider-cursor): a symlinked skills root is no longer scanned twice (#18664)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Scott Norteman committed
Oct 18, 2026 at 15:51 UTC
52eba84734ce69de6ca60c28955b28c902972932
2 files changed
+44
-1
packages/provider-cursor/src/server/skills.test.ts
+36
@@ -229,6 +229,42 @@ describe("Cursor skills", () => {
229
}),
230
));
231
232
+ it.skipIf(!symlinksSupported)(
233
+ "scans a skills root linked to another root only once",
234
+ async () =>
235
+ await runNode(
236
+ Effect.gen(function* () {
237
+ const fileSystem = yield* FileSystem.FileSystem;
238
+ const path = yield* Path.Path;
239
+ const userHome = yield* fileSystem.makeTempDirectoryScoped({
240
+ directory: NodeOS.tmpdir(),
241
+ prefix: "cursor-skills-home-",
242
+ });
243
+ // More than half the entry budget, so a second walk of the same tree runs out.
244
+ const claudeRoot = path.join(userHome, ".claude", "skills");
245
+ yield* fileSystem.makeDirectory(path.join(claudeRoot, "review"), { recursive: true });
246
+ yield* fileSystem.writeFileString(
247
+ path.join(claudeRoot, "review", "SKILL.md"),
248
+ "---\n---\n",
249
+ );
250
+ yield* Effect.forEach(
251
+ Array.from({ length: 6_000 }, (_, index) => path.join(claudeRoot, `entry-${index}`)),
252
+ (file) => fileSystem.writeFileString(file, ""),
253
+ { concurrency: 64, discard: true },
254
+ );
255
+ yield* fileSystem.makeDirectory(path.join(userHome, ".agents"), { recursive: true });
256
+ yield* fileSystem.symlink(claudeRoot, path.join(userHome, ".agents", "skills"));
257
+
258
+ const result = yield* probeCursorSkills(undefined, { HOME: userHome }).pipe(
259
+ Effect.result,
260
+ );
261
+ expect(result._tag).toBe("Success");
262
+ const skills = yield* discoverCursorSkills(undefined, { HOME: userHome });
263
+ expect(skills.map((skill) => `${skill.scope}:${skill.name}`)).toEqual(["user:review"]);
264
+ }),
265
+ ),
266
+ );
267
+
268
it.skipIf(!symlinksSupported)(
269
"treats a symlinked skill outside the root as a package boundary",
270
async () =>
packages/provider-cursor/src/server/skills.ts
+8
-1
@@ -127,6 +127,8 @@ const discoverSkillsInRoot = Effect.fn("discoverCursorSkillsInRoot")(function* (
127
readonly directory: string;
128
readonly scope: "user" | "project";
129
readonly budget: CursorSkillScanBudget;
130
+ /** Real paths of the roots already walked in this scan. */
131
+ readonly scannedRoots: Set<string>;
132
}): Effect.fn.Return<ReadonlyArray<ServerProviderSkill>, never, FileSystem.FileSystem | Path.Path> {
133
const fileSystem = yield* FileSystem.FileSystem;
134
const path = yield* Path.Path;
@@ -134,6 +136,10 @@ const discoverSkillsInRoot = Effect.fn("discoverCursorSkillsInRoot")(function* (
136
if (input.budget.exhausted) return skills;
137
const rootDirectory = yield* orUndefined(fileSystem.realPath(input.directory), input.budget);
138
if (!rootDirectory) return skills;
139
+ // A root linked to another one, such as `~/.agents/skills` pointing at `~/.claude/skills`,
140
+ // is the same tree: walking it again would charge the scan budget twice for nothing new.
141
+ if (input.scannedRoots.has(rootDirectory)) return skills;
142
+ input.scannedRoots.add(rootDirectory);
143
const visitedDirectories = new Set<string>();
144
145
const visit = Effect.fn("visitCursorSkillDirectory")(function* (
@@ -235,9 +241,10 @@ const inspectCursorSkills = Effect.fn("inspectCursorSkills")(function* (
241
exhausted: false,
242
incomplete: false,
243
};
244
+ const scannedRoots = new Set<string>();
245
for (const root of roots) {
246
if (budget.exhausted) break;
240
- const skills = yield* discoverSkillsInRoot({ ...root, budget });
247
+ const skills = yield* discoverSkillsInRoot({ ...root, budget, scannedRoots });
248
for (const skill of skills) {
249
if (!skillsByName.has(skill.name)) skillsByName.set(skill.name, skill);
250
}