fix(server): report OpenCode skills in the provider snapshot #5683
Closedvraj-ai(GitHub profile, opens in a new tab)wants to merge 3 commits into
main fromrefs/pull/5683/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
- @@ -430,3 +437,4 @@430437 DEFAULT_OPENCODE_MODEL_CAPABILITIES,431438 );432439 const connectedCount = inventoryExit.value.providerList.connected.length;440+ const skills = yield* discoverOpenCodeSkills(cwd, resolvedEnvironment);@@ -0,0 +64,21 @@64+}65+66+/**67+ * Resolve the OpenCode config directory the runtime would use, matching the68+ * precedence OpenCode itself applies: `OPENCODE_CONFIG_DIR`, then the XDG69+ * config home, then `~/.config`.70+ */71+const resolveOpenCodeConfigDirPath = Effect.fn("resolveOpenCodeConfigDirPath")(function* (72+ environment: NodeJS.ProcessEnv,73+): Effect.fn.Return<string, never, Path.Path> {74+ const path = yield* Path.Path;75+ // Env vars reach the spawned runtime verbatim, so a literal `~` must stay76+ // literal for discovery to scan the directory the runtime would.77+ const configDir = environment.OPENCODE_CONFIG_DIR?.trim() ?? "";78+ if (configDir.length > 0) {79+ return path.resolve(configDir);80+ }81+ const xdgConfigHome = environment.XDG_CONFIG_HOME?.trim() ?? "";82+ const configHome =83+ xdgConfigHome.length > 0 ? path.resolve(xdgConfigHome) : path.join(NodeOS.homedir(), ".config");84+ return path.join(configHome, "opencode");@@ -0,0 +9,21 @@9+ * same locations directly — mirroring `ClaudeSkills` and how the Codex10+ * app-server reports its skills.11+ *12+ * @module provider/Drivers/OpenCodeSkills13+ */14+import * as NodeOS from "node:os";15+16+import type { ServerProviderSkill } from "@t3tools/contracts";17+import * as Effect from "effect/Effect";18+import * as FileSystem from "effect/FileSystem";19+import * as Path from "effect/Path";20+import { parse as parseYamlDocument } from "yaml";21+22+type OpenCodeSkillScope = "user" | "project";23+24+const FRONTMATTER_PATTERN = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/;25+26+/** OpenCode accepts both spellings of the skills directory. */27+const SKILL_DIRECTORY_NAMES = ["skill", "skills"] as const;28+29+/**
- @@ -0,0 +65,21 @@65+66+/**67+ * Resolve the OpenCode config directory the runtime would use, matching the68+ * precedence OpenCode itself applies: `OPENCODE_CONFIG_DIR`, then the XDG69+ * config home, then `~/.config`.70+ */71+const resolveOpenCodeConfigDirPath = Effect.fn("resolveOpenCodeConfigDirPath")(function* (72+ environment: NodeJS.ProcessEnv,73+): Effect.fn.Return<string, never, Path.Path> {74+ const path = yield* Path.Path;75+ // Env vars reach the spawned runtime verbatim, so a literal `~` must stay76+ // literal for discovery to scan the directory the runtime would.77+ const configDir = environment.OPENCODE_CONFIG_DIR?.trim() ?? "";78+ if (configDir.length > 0) {79+ return path.resolve(configDir);80+ }81+ const xdgConfigHome = environment.XDG_CONFIG_HOME?.trim() ?? "";82+ const configHome =83+ xdgConfigHome.length > 0 ? path.resolve(xdgConfigHome) : path.join(NodeOS.homedir(), ".config");84+ return path.join(configHome, "opencode");85+});
t3dotgg(GitHub profile, opens in a new tab) 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:
59cbd732-c40f-410e-884c-fe21eb7ac97aYou 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