|
|
@@ -20,7 +20,8 @@ import * as Log from "@opencode-ai/core/util/log"
|
|
|
import { Discovery } from "./discovery"
|
|
|
|
|
|
const log = Log.create({ service: "skill" })
|
|
|
-const EXTERNAL_DIRS = [".claude", ".agents"]
|
|
|
+const CLAUDE_EXTERNAL_DIR = ".claude"
|
|
|
+const AGENTS_EXTERNAL_DIR = ".agents"
|
|
|
const EXTERNAL_SKILL_PATTERN = "skills/**/SKILL.md"
|
|
|
const OPENCODE_SKILL_PATTERN = "{skill,skills}/**/SKILL.md"
|
|
|
const SKILL_PATTERN = "**/SKILL.md"
|
|
|
@@ -152,15 +153,19 @@ const discoverSkills = Effect.fnUntraced(function* (
|
|
|
) {
|
|
|
const state: ScanState = { matches: new Set(), dirs: new Set() }
|
|
|
|
|
|
+ const externalDirs: string[] = []
|
|
|
if (!Flag.OPENCODE_DISABLE_EXTERNAL_SKILLS) {
|
|
|
- for (const dir of EXTERNAL_DIRS) {
|
|
|
+ if (!Flag.OPENCODE_DISABLE_CLAUDE_CODE_SKILLS) externalDirs.push(CLAUDE_EXTERNAL_DIR)
|
|
|
+ externalDirs.push(AGENTS_EXTERNAL_DIR)
|
|
|
+
|
|
|
+ for (const dir of externalDirs) {
|
|
|
const root = path.join(Global.Path.home, dir)
|
|
|
if (!(yield* fsys.isDir(root))) continue
|
|
|
yield* scan(state, root, EXTERNAL_SKILL_PATTERN, { dot: true, scope: "global" })
|
|
|
}
|
|
|
|
|
|
const upDirs = yield* fsys
|
|
|
- .up({ targets: EXTERNAL_DIRS, start: directory, stop: worktree })
|
|
|
+ .up({ targets: externalDirs, start: directory, stop: worktree })
|
|
|
.pipe(Effect.catch(() => Effect.succeed([] as string[])))
|
|
|
|
|
|
for (const root of upDirs) {
|