fix(skills): use directory param instead of process.cwd() for project skill discovery

Project-level skills (.opencode/skills/ and .claude/skills/) were not
discovered in desktop app environments because the discover functions
hardcoded process.cwd() to resolve project paths. In desktop apps,
process.cwd() points to the app installation directory rather than the
user's project directory.

Add optional directory parameter to all project-level skill discovery
functions and thread ctx.directory from the plugin context through the
entire skill loading pipeline. Falls back to process.cwd() when
directory is not provided, preserving CLI compatibility.
This commit is contained in:
Willy
2026-02-13 10:49:15 +08:00
parent 4a991b5a83
commit 6914f2fd04
5 changed files with 23 additions and 20 deletions
+2 -2
View File
@@ -63,8 +63,8 @@ export async function createSkillContext(args: {
}),
includeClaudeSkills ? discoverUserClaudeSkills() : Promise.resolve([]),
discoverOpencodeGlobalSkills(),
includeClaudeSkills ? discoverProjectClaudeSkills() : Promise.resolve([]),
discoverOpencodeProjectSkills(),
includeClaudeSkills ? discoverProjectClaudeSkills(directory) : Promise.resolve([]),
discoverOpencodeProjectSkills(directory),
])
const mergedSkills = mergeSkills(