feat: read global ~/.claude/skills

pull/5339/head
Aiden Cline 2025-12-29 17:11:28 -06:00
parent 76b012139a
commit a1c9a1b8c5
1 changed files with 13 additions and 9 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) => {
@ -73,10 +77,9 @@ export namespace Skill {
})) {
await addSkill(match)
}
}
for await (const match of CLAUDE_SKILL_GLOB.scan({
cwd: Instance.worktree,
cwd: dir,
absolute: true,
onlyFiles: true,
followSymlinks: true,
@ -84,6 +87,7 @@ export namespace Skill {
})) {
await addSkill(match)
}
}
return skills
})