Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(cursor): populate $ picker from filesystem skills #8770

ClosedSvyk(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/8770/headopened View on GitHub

Showing 4 changed files with 191 additions and 0 deletions (loading 3).

x
0 of 4 viewed, 4 left
191 additions and 0 deletionsapps/server/src/provider/Drivers/CursorSkills.test.tsAdded
View file
@@ -0,0 +1,191 @@
+import * as NodeServices from "@effect/platform-node/NodeServices";
+import { assert, it } from "@effect/vitest";
+import * as Effect from "effect/Effect";
+import * as FileSystem from "effect/FileSystem";
+import * as Path from "effect/Path";
+​
+import { discoverCursorSkills } from "./CursorSkills.ts";
+​
+const writeSkill = Effect.fn(function* (
+ skillsDir: string,
+ directoryName: string,
+ contents: string,
+) {
+ const fs = yield* FileSystem.FileSystem;
+ const path = yield* Path.Path;
+ const skillDir = path.join(skillsDir, directoryName);
+ yield* fs.makeDirectory(skillDir, { recursive: true });
+ yield* fs.writeFileString(path.join(skillDir, "SKILL.md"), contents);
+});
+​
+it.layer(NodeServices.layer)("discoverCursorSkills", (it) => {
+ it.effect("discovers user skills with frontmatter metadata", () =>
+ Effect.gen(function* () {
+ const fs = yield* FileSystem.FileSystem;
+ const path = yield* Path.Path;
+ const tempDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-cursor-skills-" });
+ const homeDir = path.join(tempDir, "home");
+​
+ yield* writeSkill(
+ path.join(homeDir, ".cursor", "skills"),