fix(claude): discover skills from installed plugins #6453
ClosedMoinax(GitHub profile, opens in a new tab)wants to merge 1 commit into
main fromrefs/pull/6453/headopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- apps/server/src/provider/Drivers/ClaudeSkills.ts line 168OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -85,0 +148,21 @@148+ if (!plugin) {149+ continue;150+ }151+ const installLocation = marketplace152+ ? asString(asRecord(marketplaces?.[marketplace])?.installLocation)153+ : undefined;154+155+ for (const entry of Array.isArray(value) ? value : []) {156+ const candidates = [157+ asString(asRecord(entry)?.installPath),158+ installLocation ? path.join(installLocation, "plugins", plugin) : undefined,159+ installLocation,160+ ];161+ for (const candidate of candidates) {162+ if (candidate === undefined) {163+ continue;164+ }165+ const directory = path.join(candidate, "skills");166+ const exists = yield* fileSystem.exists(directory).pipe(Effect.orElseSucceed(() => false));167+ if (exists) {168+ roots.push({ directory, scope: "user", prefix: plugin });apps/server/src/provider/Drivers/ClaudeSkills.ts line 317Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -85,0 +152,21 @@152+ ? asString(asRecord(marketplaces?.[marketplace])?.installLocation)153+ : undefined;154+155+ for (const entry of Array.isArray(value) ? value : []) {156+ const candidates = [157+ asString(asRecord(entry)?.installPath),158+ installLocation ? path.join(installLocation, "plugins", plugin) : undefined,159+ installLocation,160+ ];161+ for (const candidate of candidates) {162+ if (candidate === undefined) {163+ continue;164+ }165+ const directory = path.join(candidate, "skills");166+ const exists = yield* fileSystem.exists(directory).pipe(Effect.orElseSucceed(() => false));167+ if (exists) {168+ roots.push({ directory, scope: "user", prefix: plugin });169+ break;170+ }171+ }172+ }
- apps/server/src/provider/Drivers/ClaudeSkills.ts lines 253 to 253OutdatedResolvedby Moinax(GitHub profile, opens in a new tab)@@ -93,0 +233,21 @@233+ }234+ const marketplaces = asRecord(235+ yield* readJsonFile(path.join(pluginsDir, "known_marketplaces.json")),236+ );237+ const enabledPlugins = yield* readEnabledPlugins(configDirPath, cwd);238+ const workspace = cwd ? path.resolve(cwd) : undefined;239+240+ const directories: Array<ClaudeSkillDirectory> = [];241+ for (const [key, value] of Object.entries(installed)) {242+ const [plugin, marketplace] = key.split("@");243+ // An explicit `false` is the only way a plugin is off; an install the244+ // settings never mention is on, which is how a fresh install behaves.245+ if (!plugin || enabledPlugins[key] === false) {246+ continue;247+ }248+ const installLocation = marketplace249+ ? asString(asRecord(marketplaces?.[marketplace])?.installLocation)250+ : undefined;251+252+ for (const entry of Array.isArray(value) ? value : []) {253+ const record = asRecord(entry);apps/server/src/provider/Drivers/ClaudeSkills.ts line 314Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -93,0 +260,21 @@260+261+ const candidates = [262+ asString(record?.installPath),263+ installLocation ? path.join(installLocation, "plugins", plugin) : undefined,264+ installLocation,265+ ];266+ let found = false;267+ for (const candidate of candidates) {268+ if (candidate === undefined) {269+ continue;270+ }271+ const skills = yield* pluginSkillDirectories(candidate, plugin);272+ if (skills.length > 0) {273+ directories.push(...skills);274+ found = true;275+ break;276+ }277+ }278+ // One install per plugin reaches the picker: several entries mean279+ // several scopes, and they all resolve to the same `<plugin>:` names.280+ if (found) {
- apps/server/src/provider/Drivers/ClaudeSkills.ts line 201OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -93,0 +181,21 @@181+182+ const manifest =183+ asRecord(yield* readJsonFile(path.join(pluginRoot, ".claude-plugin", "plugin.json"))) ??184+ asRecord(yield* readJsonFile(path.join(pluginRoot, "plugin.json")));185+ const declared = Array.isArray(manifest?.skills) ? manifest.skills : [];186+187+ const seen = new Set(conventional.map((entry) => entry.directory));188+ return [189+ ...conventional,190+ ...declared.flatMap((value) => {191+ const relative = asString(value);192+ if (relative === undefined) {193+ return [];194+ }195+ const directory = path.resolve(pluginRoot, relative);196+ if (seen.has(directory)) {197+ return [];198+ }199+ seen.add(directory);200+ return [{ directory, scope: "user" as const, prefix: plugin }];201+ }),apps/server/src/provider/Drivers/ClaudeSkills.ts line 230Resolvedby Moinax(GitHub profile, opens in a new tab)@@ -93,0 +183,21 @@183+ asRecord(yield* readJsonFile(path.join(pluginRoot, ".claude-plugin", "plugin.json"))) ??184+ asRecord(yield* readJsonFile(path.join(pluginRoot, "plugin.json")));185+ const declared = Array.isArray(manifest?.skills) ? manifest.skills : [];186+187+ const seen = new Set(conventional.map((entry) => entry.directory));188+ return [189+ ...conventional,190+ ...declared.flatMap((value) => {191+ const relative = asString(value);192+ if (relative === undefined) {193+ return [];194+ }195+ const directory = path.resolve(pluginRoot, relative);196+ if (seen.has(directory)) {197+ return [];198+ }199+ seen.add(directory);200+ return [{ directory, scope: "user" as const, prefix: plugin }];201+ }),202+ ];203+});
- apps/server/src/provider/Drivers/ClaudeSkills.ts line 306Resolvedby Moinax(GitHub profile, opens in a new tab)@@ -93,0 +273,21 @@273+ const projectPath = asString(record?.projectPath);274+ if (projectPath === undefined) {275+ return [{ record, projectScoped: false }];276+ }277+ return path.resolve(projectPath) === workspace ? [{ record, projectScoped: true }] : [];278+ })279+ .sort((left, right) => Number(right.projectScoped) - Number(left.projectScoped));280+281+ for (const { record } of applicable) {282+ const candidates = [283+ asString(record?.installPath),284+ installLocation ? path.join(installLocation, "plugins", plugin) : undefined,285+ installLocation,286+ ];287+ let found = false;288+ for (const candidate of candidates) {289+ if (candidate === undefined) {290+ continue;291+ }292+ const skills = yield* pluginSkillDirectories(candidate, plugin);293+ if (skills.length > 0) {
juliusmarminge closed this
Sign in to join this conversation.


Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
63a11ef4-5643-4a52-ac89-df7a927169b6You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share