fix(providers): discover workspace skills everywhere #9180
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
- apps/server/src/provider/Drivers/GrokSkills.ts lines 29 to 35OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -22,13 +21,15 @@21+import * as Schema from "effect/Schema";2222 import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process";2323 import { resolveSpawnCommand } from "@t3tools/shared/shell";24242525 import { spawnAndCollect } from "../providerSnapshot.ts";26262727 const GROK_SKILLS_PROBE_TIMEOUT_MS = 4_000;282829-/**30- * Map `grok inspect --json` output onto provider skills. Entries without a31- * name or a filesystem path are skipped; `userInvocable: false` skills are32- * kept but disabled so pickers that filter on `enabled` hide them.33- */34-export function parseGrokInspectSkills(stdout: string): ReadonlyArray<ServerProviderSkill> {29+export class GrokSkillsProbeError extends Schema.TaggedErrorClass<GrokSkillsProbeError>()(30+ "GrokSkillsProbeError",31+ {32+ detail: Schema.String,33+ cause: Schema.optional(Schema.Defect()),34+ },35+) {}
- apps/web/src/components/chat/ChatComposer.tsx line 1130OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1126,17 +1126,5 @@11261126 const refreshProviders = useAtomCommand(serverEnvironment.refreshProviders, {11271127 reportFailure: false,11281128 });1129- const workspaceRefreshKeyRef = useRef<string | null>(null);1130- const hadWorkspaceSnapshotRef = useRef(false);1131- useEffect(() => {1132- const hasWorkspaceSnapshot = Boolean(1133- gitCwd &&1134- selectedProviderStatus?.workspaceSnapshots?.some((snapshot) => snapshot.cwd === gitCwd),1135- );1136- if (hadWorkspaceSnapshotRef.current && !hasWorkspaceSnapshot) {1137- workspaceRefreshKeyRef.current = null;1138- }1139- hadWorkspaceSnapshotRef.current = hasWorkspaceSnapshot;1140- }, [gitCwd, selectedProviderStatus]);11411129 useEffect(() => {11421130 if (!gitCwd || !selectedProviderEntry) return;
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XL
- apps/web/src/components/chat/ChatComposer.tsx line 1135OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1153,19 +1131,5 @@11531131 void refreshProviders({11541132 environmentId,11551133 input: { instanceId: selectedProviderEntry.instanceId, cwd: gitCwd },1156- }).then(1157- (result) => {1158- const hasWorkspaceSnapshot =1159- result._tag === "Success" &&1160- result.value.providers1161- .find((provider) => provider.instanceId === selectedProviderEntry.instanceId)1162- ?.workspaceSnapshots?.some((snapshot) => snapshot.cwd === gitCwd);1163- if (!hasWorkspaceSnapshot && workspaceRefreshKeyRef.current === key) {1164- workspaceRefreshKeyRef.current = null;1165- }1166- },1167- () => {1168- if (workspaceRefreshKeyRef.current === key) workspaceRefreshKeyRef.current = null;1169- },1170- );1171- }, [environmentId, gitCwd, refreshProviders, selectedProviderEntry]);1134+ });1135+ }, [environmentId, gitCwd, refreshProviders, selectedProviderEntry?.instanceId]);
- apps/server/src/provider/Drivers/CursorSkills.ts line 24Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +1,21 @@1+/**2+ * CursorSkills — workspace-aware discovery and native invocation for Cursor.3+ *4+ * Cursor discovers Agent Skills recursively from user and project roots but5+ * its ACP command catalog only appears after opening a real session. Scanning6+ * the same roots avoids starting an agent and its MCP servers just to populate7+ * a composer menu.8+ *9+ * @module provider/Drivers/CursorSkills10+ */11+import * as NodeOS from "node:os";12+13+import type { ServerProviderSkill } from "@t3tools/contracts";14+import * as Effect from "effect/Effect";15+import * as FileSystem from "effect/FileSystem";16+import * as Path from "effect/Path";17+import { parse as parseYamlDocument } from "yaml";18+19+const FRONTMATTER_PATTERN = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/;20+const SKILL_MENTION_PATTERN = /(^|\s)\$([a-zA-Z][a-zA-Z0-9:_-]*)(?=\s|$)/g;21+const MAX_SKILL_DEPTH = 10;apps/server/src/provider/Layers/CursorAdapter.ts line 973OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -967,5 +968,6 @@967968 }968969969970 const promptParts: Array<EffectAcpSchema.ContentBlock> = [];970- if (input.input?.trim()) {971- promptParts.push({ type: "text", text: input.input.trim() });971+ const rawPrompt = input.input?.trim() ?? "";972+ if (rawPrompt) {973+ const prompt = rawPrompt.includes("$")
- apps/web/src/components/chat/ChatComposer.tsx line 1135OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -1153,19 +1131,5 @@11531131 void refreshProviders({11541132 environmentId,11551133 input: { instanceId: selectedProviderEntry.instanceId, cwd: gitCwd },1156- }).then(1157- (result) => {1158- const hasWorkspaceSnapshot =1159- result._tag === "Success" &&1160- result.value.providers1161- .find((provider) => provider.instanceId === selectedProviderEntry.instanceId)1162- ?.workspaceSnapshots?.some((snapshot) => snapshot.cwd === gitCwd);1163- if (!hasWorkspaceSnapshot && workspaceRefreshKeyRef.current === key) {1164- workspaceRefreshKeyRef.current = null;1165- }1166- },1167- () => {1168- if (workspaceRefreshKeyRef.current === key) workspaceRefreshKeyRef.current = null;1169- },1170- );1171- }, [environmentId, gitCwd, refreshProviders, selectedProviderEntry]);1134+ });1135+ }, [environmentId, gitCwd, refreshProviders, selectedProviderEntry?.instanceId]);apps/server/src/provider/Layers/ProviderRegistry.ts line 97OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -79,14 +82,16 @@7982 (model.capabilities?.optionDescriptors?.length ?? 0) > 0;80838184 const MAX_WORKSPACE_SNAPSHOTS_PER_PROVIDER = 16;85+const WORKSPACE_SNAPSHOT_TTL_MS = 60_000;82868387 export function upsertProviderWorkspaceSnapshot(8488 provider: ServerProvider,8589 cwd: string,86- scopedSnapshot: ServerProvider,90+ catalog: ProviderWorkspaceCatalog,91+ checkedAt: ServerProvider["checkedAt"],8792 ): ServerProvider {8893 const workspaceSnapshot = {8994 cwd,90- checkedAt: scopedSnapshot.checkedAt,91- slashCommands: scopedSnapshot.slashCommands,92- skills: scopedSnapshot.skills,95+ checkedAt,96+ slashCommands: provider.slashCommands,97+ skills: catalog.skills,
- apps/server/src/provider/Drivers/CursorDriver.ts line 173OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -166,3 +167,7 @@166167 accentColor,167168 enabled,168169 snapshot,170+ snapshotForCwd: (cwd) =>171+ !effectiveConfig.enabled172+ ? Effect.succeed({ skills: [] })173+ : discoverCursorSkills(cwd, processEnv).pipe(@@ -0,0 +58,21 @@58+ } catch {59+ return undefined;60+ }61+ if (typeof parsed !== "object" || parsed === null) return undefined;62+63+ const record = parsed as Record<string, unknown>;64+ const metadata =65+ typeof record.metadata === "object" && record.metadata !== null66+ ? (record.metadata as Record<string, unknown>)67+ : undefined;68+ const rawSurfaces = metadata?.surfaces;69+ const surfaces = Array.isArray(rawSurfaces)70+ ? rawSurfaces.filter((surface): surface is string => typeof surface === "string")71+ : typeof rawSurfaces === "string"72+ ? rawSurfaces.split(",")73+ : [];74+ const description = typeof record.description === "string" ? record.description.trim() : "";75+ const displayName = typeof record.name === "string" ? record.name.trim() : "";76+ return {77+ cliVisible:78+ surfaces.length === 0 || surfaces.some((surface) => surface.trim().toLowerCase() === "cli"),
- @@ -0,0 +1,21 @@1+/**2+ * CursorSkills — workspace-aware discovery and native invocation for Cursor.3+ *4+ * Cursor discovers Agent Skills recursively from user and project roots but5+ * its ACP command catalog only appears after opening a real session. Scanning6+ * the same roots avoids starting an agent and its MCP servers just to populate7+ * a composer menu.8+ *9+ * @module provider/Drivers/CursorSkills10+ */11+import * as NodeOS from "node:os";12+13+import type { ServerProviderSkill } from "@t3tools/contracts";14+import * as Effect from "effect/Effect";15+import * as FileSystem from "effect/FileSystem";16+import * as Path from "effect/Path";17+import { parse as parseYamlDocument } from "yaml";18+19+const FRONTMATTER_PATTERN = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/;20+const SKILL_MENTION_PATTERN = /(^|\s)\$([a-z][a-z0-9-]*)(?=\s|$)/g;21+const HAS_SKILL_MENTION_PATTERN = /(^|\s)\$[a-z][a-z0-9-]*(?=\s|$)/;
- @@ -69,3 +72,20 @@6972 setSelection(composerSelectionAtEnd(draftMessage));7073 }, [draftMessage, ownerKey]);717475+ const skills = useMemo(76+ () =>77+ selectedProviderStatus ? resolveProviderSkillsForCwd(selectedProviderStatus, projectCwd) : [],78+ [projectCwd, selectedProviderStatus],79+ );80+ const slashCommands = selectedProviderStatus?.slashCommands ?? [];81+ const refreshProviders = useAtomCommand(serverEnvironment.refreshProviders, {82+ reportFailure: false,83+ });84+ const selectedProviderInstanceId = selectedProviderStatus?.instanceId;85+ useEffect(() => {86+ if (!environmentId || !projectCwd || !selectedProviderInstanceId) return;87+ void refreshProviders({88+ environmentId,89+ input: { instanceId: selectedProviderInstanceId, cwd: projectCwd },90+ });91+ }, [environmentId, projectCwd, refreshProviders, selectedProviderInstanceId]);@@ -971 +977,20 @@971- promptParts.push({ type: "text", text: input.input.trim() });977+ const rawPrompt = input.input?.trim() ?? "";978+ if (rawPrompt) {979+ let cursorSkillNames = ctx.cursorSkillNames;980+ if (hasCursorSkillMention(rawPrompt) && cursorSkillNames === undefined) {981+ cursorSkillNames = yield* discoverCursorSkills(982+ ctx.session.cwd,983+ options?.environment,984+ ).pipe(985+ Effect.provideService(FileSystem.FileSystem, fileSystem),986+ Effect.provideService(Path.Path, path),987+ Effect.map(988+ (skills) =>989+ new Set(990+ skills991+ .filter((skill) => skill.enabled && skill.userInvocable !== false)992+ .map((skill) => skill.name),993+ ),994+ ),995+ );996+ ctx.cursorSkillNames = cursorSkillNames;
- @@ -382,3 +403,17 @@382403383404 return [...skillsByName.values()].sort((left, right) => left.name.localeCompare(right.name));384405 });406+407+export const discoverClaudeSkills = Effect.fn("discoverClaudeSkills")(function* (408+ config: Pick<ClaudeSettings, "homePath">,409+ cwd?: string,410+ environment?: NodeJS.ProcessEnv,411+): Effect.fn.Return<ReadonlyArray<ServerProviderSkill>, never, FileSystem.FileSystem | Path.Path> {412+ return yield* probeClaudeSkills(config, cwd, environment).pipe(413+ Effect.catch((cause) =>414+ Effect.logWarning("claude skill discovery failed; using an empty catalog", { cause }).pipe(415+ Effect.as([]),416+ ),417+ ),418+ );419+});
- apps/server/src/provider/Layers/ProviderRegistry.ts line 805OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -792,9 +794,12 @@792- }).pipe(793- Effect.tap(([previousProviders, nextProviders]) =>794- haveProvidersChanged(previousProviders, nextProviders)795- ? PubSub.publish(changesPubSub, nextProviders)796- : Effect.void,797- ),798- Effect.map(([, nextProviders]) => nextProviders),799- );800- }),794+ Effect.flatMap((catalog) =>795+ Effect.gen(function* () {796+ const currentInstance = yield* instanceRegistry.getInstance(input.instanceId);797+ if (currentInstance !== instance) return yield* Ref.get(providersRef);798+ const checkedAt = DateTime.formatIso(yield* DateTime.now);799+ return yield* Ref.modify(providersRef, (currentProviders) => {800+ const nextProviders = currentProviders.map((candidate) => {801+ if (candidate.instanceId !== input.instanceId) return candidate;802+ const previousSnapshot = candidate.workspaceSnapshots?.find(803+ (snapshot) => snapshot.cwd === input.cwd,804+ );805+ if (catalog.complete === false && previousSnapshot) return candidate;
- @@ -0,0 +126,21 @@126+ const fileSystem = yield* FileSystem.FileSystem;127+ const path = yield* Path.Path;128+ const skills: ServerProviderSkill[] = [];129+ const errors: PlatformError.PlatformError[] = [];130+ const rootDirectory = yield* collectFileSystemError(fileSystem.realPath(input.directory), errors);131+ if (!rootDirectory) return { skills, errors };132+ const visitedDirectories = new Set<string>();133+134+ const visit = Effect.fn("visitCursorSkillDirectory")(function* (135+ directory: string,136+ depth: number,137+ ): Effect.fn.Return<void, never> {138+ const resolvedDirectory = yield* collectFileSystemError(fileSystem.realPath(directory), errors);139+ if (140+ !resolvedDirectory ||141+ visitedDirectories.has(resolvedDirectory) ||142+ (resolvedDirectory !== rootDirectory &&143+ !resolvedDirectory.startsWith(`${rootDirectory}${path.sep}`))144+ ) {145+ return;146+ }
- apps/server/src/provider/Drivers/CursorSkills.ts line 173OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +153,21 @@153+ const frontmatter = contents === undefined ? undefined : parseSkillFrontmatter(contents);154+ const name = path.basename(resolvedDirectory).trim();155+ if (frontmatter?.cliVisible && name) {156+ skills.push({157+ name,158+ path: skillPath,159+ scope: input.scope,160+ enabled: true,161+ ...(frontmatter.displayName && frontmatter.displayName !== name162+ ? { displayName: frontmatter.displayName }163+ : {}),164+ ...(frontmatter.description ? { description: frontmatter.description } : {}),165+ ...(frontmatter.userInvocationOnly ? { userInvocationOnly: true } : {}),166+ ...(frontmatter.userInvocable === false ? { userInvocable: false } : {}),167+ });168+ }169+ }170+171+ if (depth >= MAX_SKILL_DEPTH) return;172+ const entries =173+ (yield* collectFileSystemError(fileSystem.readDirectory(resolvedDirectory), errors)) ?? [];
- apps/server/src/provider/Layers/ProviderRegistry.ts line 803OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -790,11 +794,10 @@790- );791- return [[currentProviders, nextProviders] as const, nextProviders];792- }).pipe(793- Effect.tap(([previousProviders, nextProviders]) =>794- haveProvidersChanged(previousProviders, nextProviders)795- ? PubSub.publish(changesPubSub, nextProviders)796- : Effect.void,797- ),798- Effect.map(([, nextProviders]) => nextProviders),799- );800- }),794+ Effect.flatMap((catalog) =>795+ Effect.gen(function* () {796+ const currentInstance = yield* instanceRegistry.getInstance(input.instanceId);797+ if (currentInstance !== instance) return yield* Ref.get(providersRef);798+ const checkedAt = DateTime.formatIso(yield* DateTime.now);799+ return yield* Ref.modify(providersRef, (currentProviders) => {800+ const nextProviders = currentProviders.map((candidate) => {801+ if (candidate.instanceId !== input.instanceId) return candidate;802+ if (catalog.complete === false) return candidate;803+ return upsertProviderWorkspaceSnapshot(candidate, input.cwd, catalog, checkedAt);
- apps/server/src/provider/Drivers/CursorSkills.ts lines 167 to 167OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +147,21 @@147+ const visitedDirectories = new Set<string>();148+149+ const visit = Effect.fn("visitCursorSkillDirectory")(function* (150+ directory: string,151+ depth: number,152+ ): Effect.fn.Return<void, never> {153+ if (input.budget.exhausted) return;154+ const resolvedDirectory = yield* collectFileSystemError(fileSystem.realPath(directory), errors);155+ if (156+ !resolvedDirectory ||157+ visitedDirectories.has(resolvedDirectory) ||158+ (resolvedDirectory !== rootDirectory &&159+ !resolvedDirectory.startsWith(`${rootDirectory}${path.sep}`))160+ ) {161+ return;162+ }163+ visitedDirectories.add(resolvedDirectory);164+165+ const skillPath = path.join(resolvedDirectory, "SKILL.md");166+ const skillInfo = yield* collectFileSystemError(fileSystem.stat(skillPath), errors);167+ if (skillInfo?.type === "File" && skillInfo.size <= MAX_SKILL_BYTES) {
- apps/web/src/components/chat/ChatComposer.tsx lines 1163 to 1168OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1155,11 +1154,15 @@11551154 input: { instanceId: selectedProviderEntry.instanceId, cwd: gitCwd },11561155 }).then(11571156 (result) => {1158- const hasWorkspaceSnapshot =1159- result._tag === "Success" &&1160- result.value.providers1161- .find((provider) => provider.instanceId === selectedProviderEntry.instanceId)1162- ?.workspaceSnapshots?.some((snapshot) => snapshot.cwd === gitCwd);1163- if (!hasWorkspaceSnapshot && workspaceRefreshKeyRef.current === key) {1157+ const refreshedProvider =1158+ result._tag === "Success"1159+ ? result.value.providers.find(1160+ (provider) => provider.instanceId === selectedProviderEntry.instanceId,1161+ )1162+ : undefined;1163+ if (1164+ !hasCompleteProviderWorkspaceSnapshotForCwd(refreshedProvider, gitCwd) &&1165+ workspaceRefreshKeyRef.current === key1166+ ) {11641167 workspaceRefreshKeyRef.current = null;11651168 }
- @@ -1162,10 +1157,18 @@1162- ?.workspaceSnapshots?.some((snapshot) => snapshot.cwd === gitCwd);1163- if (!hasWorkspaceSnapshot && workspaceRefreshKeyRef.current === key) {1157+ const refreshedProvider =1158+ result._tag === "Success"1159+ ? result.value.providers.find(1160+ (provider) => provider.instanceId === selectedProviderEntry.instanceId,1161+ )1162+ : undefined;1163+ if (1164+ !hasCompleteProviderWorkspaceSnapshotForCwd(refreshedProvider, gitCwd) &&1165+ workspaceRefreshKeyRef.current === key1166+ ) {11641167 workspaceRefreshKeyRef.current = null;11651168 }11661169 },11671170 () => {11681171 if (workspaceRefreshKeyRef.current === key) workspaceRefreshKeyRef.current = null;11691172 },11701173 );1171- }, [environmentId, gitCwd, refreshProviders, selectedProviderEntry]);1174+ }, [environmentId, gitCwd, prompt, refreshProviders, selectedProviderEntry]);
- @@ -0,0 +150,21 @@150+ directory: string,151+ depth: number,152+ ): Effect.fn.Return<void, never> {153+ if (input.budget.exhausted) return;154+ const resolvedDirectory = yield* collectFileSystemError(fileSystem.realPath(directory), errors);155+ if (156+ !resolvedDirectory ||157+ visitedDirectories.has(resolvedDirectory) ||158+ (resolvedDirectory !== rootDirectory &&159+ !resolvedDirectory.startsWith(`${rootDirectory}${path.sep}`))160+ ) {161+ return;162+ }163+ visitedDirectories.add(resolvedDirectory);164+165+ const skillPath = path.join(resolvedDirectory, "SKILL.md");166+ const skillInfo = yield* collectFileSystemError(fileSystem.stat(skillPath), errors);167+ if (skillInfo?.type === "File") {168+ if (skillInfo.size > MAX_SKILL_BYTES || skillInfo.size > input.budget.remainingBytes) {169+ input.budget.exhausted = true;170+ return;
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:XL
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- @@ -0,0 +196,21 @@196+ { directory: path.join(cwd, ".codex", "skills"), scope: "project" as const },197+ { directory: path.join(cwd, ".agents", "skills"), scope: "project" as const },198+ { directory: path.join(cwd, ".cursor", "skills"), scope: "project" as const },199+ ]200+ : []),201+ ];202+203+ const skillsByName = new Map<string, ServerProviderSkill>();204+ const budget: CursorSkillScanBudget = {205+ remainingEntries: MAX_SKILL_SCAN_ENTRIES,206+ remainingBytes: MAX_SKILL_SCAN_BYTES,207+ exhausted: false,208+ };209+ for (const root of roots) {210+ if (budget.exhausted) break;211+ const skills = yield* discoverSkillsInRoot({ ...root, budget });212+ for (const skill of skills) {213+ skillsByName.set(skill.name, skill);214+ }215+ }216+ return [...skillsByName.values()].sort((left, right) => left.name.localeCompare(right.name));
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:L
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XL
- apps/server/src/provider/Drivers/GrokSkills.ts lines 29 to 32OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -16,13 +16,17 @@1616 * @module provider/Drivers/GrokSkills1717 */1818 import type { GrokSettings, ServerProviderSkill } from "@t3tools/contracts";19+import * as Data from "effect/Data";1920 import * as Effect from "effect/Effect";2021 import * as Option from "effect/Option";21-import * as Result from "effect/Result";22-import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process";22+import { ChildProcess } from "effect/unstable/process";2323 import { resolveSpawnCommand } from "@t3tools/shared/shell";24242525 import { spawnAndCollect } from "../providerSnapshot.ts";26262727 const GROK_SKILLS_PROBE_TIMEOUT_MS = 4_000;282829+class GrokSkillsProbeError extends Data.TaggedError("GrokSkillsProbeError")<{30+ readonly detail: string;31+ readonly cause?: unknown;32+}> {}apps/server/src/provider/Drivers/CursorSkills.ts lines 43 to 43OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +23,21 @@23+const MAX_SKILL_DEPTH = 10;24+const MAX_SKILL_BYTES = FileSystem.Size(1_000_000);25+const MAX_SKILL_SCAN_ENTRIES = 10_000;26+const MAX_SKILL_SCAN_BYTES = FileSystem.Size(8_000_000);27+28+interface CursorSkillFrontmatter {29+ readonly description?: string;30+ readonly displayName?: string;31+ readonly userInvocationOnly?: boolean;32+ readonly userInvocable?: boolean;33+ readonly cliVisible: boolean;34+}35+36+interface CursorSkillScanBudget {37+ remainingEntries: number;38+ remainingBytes: bigint;39+ exhausted: boolean;40+ incomplete: boolean;41+}42+43+class CursorSkillsProbeError extends Data.TaggedError("CursorSkillsProbeError") {}
- apps/server/src/provider/Drivers/CursorSkills.ts line 234Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +208,21 @@208+ { directory: path.join(userHome, ".agents", "skills"), scope: "user" as const },209+ { directory: path.join(userHome, ".cursor", "skills"), scope: "user" as const },210+ ...(cwd211+ ? [212+ { directory: path.join(cwd, ".claude", "skills"), scope: "project" as const },213+ { directory: path.join(cwd, ".codex", "skills"), scope: "project" as const },214+ { directory: path.join(cwd, ".agents", "skills"), scope: "project" as const },215+ { directory: path.join(cwd, ".cursor", "skills"), scope: "project" as const },216+ ]217+ : []),218+ ];219+220+ const skillsByName = new Map<string, ServerProviderSkill>();221+ const budget: CursorSkillScanBudget = {222+ remainingEntries: MAX_SKILL_SCAN_ENTRIES,223+ remainingBytes: MAX_SKILL_SCAN_BYTES,224+ exhausted: false,225+ incomplete: false,226+ };227+ for (const root of roots) {228+ if (budget.exhausted) break;apps/server/src/provider/Drivers/CursorSkills.ts line 45OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +25,21 @@25+const MAX_SKILL_SCAN_ENTRIES = 10_000;26+const MAX_SKILL_SCAN_BYTES = FileSystem.Size(8_000_000);27+28+interface CursorSkillFrontmatter {29+ readonly description?: string;30+ readonly displayName?: string;31+ readonly userInvocationOnly?: boolean;32+ readonly userInvocable?: boolean;33+ readonly cliVisible: boolean;34+}35+36+interface CursorSkillScanBudget {37+ remainingEntries: number;38+ remainingBytes: bigint;39+ exhausted: boolean;40+ incomplete: boolean;41+}42+43+class CursorSkillsProbeError extends Data.TaggedError("CursorSkillsProbeError") {}44+45+const orUndefined = <A, E, R>(
- apps/server/src/provider/Drivers/CursorSkills.ts line 269Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -0,0 +236,21 @@236+ complete: !budget.exhausted && !budget.incomplete,237+ };238+});239+240+export const discoverCursorSkills = Effect.fn("discoverCursorSkills")(function* (241+ cwd?: string,242+ environment: NodeJS.ProcessEnv = process.env,243+) {244+ return (yield* inspectCursorSkills(cwd, environment)).skills;245+});246+247+export const probeCursorSkills = Effect.fn("probeCursorSkills")(function* (248+ cwd?: string,249+ environment: NodeJS.ProcessEnv = process.env,250+) {251+ const inspection = yield* inspectCursorSkills(cwd, environment);252+ if (!inspection.complete) {253+ return yield* new CursorSkillsProbeError();254+ }255+ return inspection.skills;256+});
- @@ -71,0 +110,21 @@110+ (result) => {111+ const refreshed =112+ result._tag === "Success" &&113+ result.value.providers114+ .find((provider) => provider.instanceId === selectedProviderInstanceId)115+ ?.workspaceSnapshots?.some((snapshot) => snapshot.cwd === projectCwd);116+ if (!refreshed && workspaceRefreshKeyRef.current === key) {117+ workspaceRefreshKeyRef.current = null;118+ }119+ },120+ () => {121+ if (workspaceRefreshKeyRef.current === key) workspaceRefreshKeyRef.current = null;122+ },123+ );124+ }, [125+ environmentId,126+ hasWorkspaceSnapshot,127+ projectCwd,128+ refreshProviders,129+ selectedProviderInstanceId,130+ ]);
maria-rcks merged this15fea6c
maria-rcks closed this
Sign in to join this conversation.




macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed