tweak: read global claude skills too

pull/6420/head
Aiden Cline 2025-12-29 21:31:25 -06:00
parent e1dd9c4ccb
commit dc64ce8ad4
1 changed files with 14 additions and 10 deletions

View File

@ -4,6 +4,7 @@ import { Instance } from "../project/instance"
import { NamedError } from "@opencode-ai/util/error"
import { ConfigMarkdown } from "../config/markdown"
import { Log } from "../util/log"
import { Global } from "@/global"
export namespace Skill {
const log = Log.create({ service: "skill" })
@ -37,6 +38,9 @@ export namespace Skill {
export const state = Instance.state(async () => {
const directories = await Config.directories()
// include the global claude skills
directories.push(Global.Path.home)
const skills: Record<string, Info> = {}
const addSkill = async (match: string) => {
@ -65,6 +69,16 @@ export namespace Skill {
}
for (const dir of directories) {
for await (const match of CLAUDE_SKILL_GLOB.scan({
cwd: dir,
absolute: true,
onlyFiles: true,
followSymlinks: true,
dot: true,
})) {
await addSkill(match)
}
for await (const match of OPENCODE_SKILL_GLOB.scan({
cwd: dir,
absolute: true,
@ -75,16 +89,6 @@ export namespace Skill {
}
}
for await (const match of CLAUDE_SKILL_GLOB.scan({
cwd: Instance.worktree,
absolute: true,
onlyFiles: true,
followSymlinks: true,
dot: true,
})) {
await addSkill(match)
}
return skills
})