Skip to content

Commit ffe0314

Browse files
authored
fix: ensure disabling OPENCODE_DISABLE_CLAUDE_CODE_SKILLS doesnt disable external skills too (anomalyco#25123)
1 parent 375444a commit ffe0314

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

packages/core/src/flag/flag.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export const Flag = {
4747
OPENCODE_DISABLE_CLAUDE_CODE,
4848
OPENCODE_DISABLE_CLAUDE_CODE_PROMPT: OPENCODE_DISABLE_CLAUDE_CODE || truthy("OPENCODE_DISABLE_CLAUDE_CODE_PROMPT"),
4949
OPENCODE_DISABLE_CLAUDE_CODE_SKILLS,
50-
OPENCODE_DISABLE_EXTERNAL_SKILLS: OPENCODE_DISABLE_CLAUDE_CODE_SKILLS || truthy("OPENCODE_DISABLE_EXTERNAL_SKILLS"),
50+
OPENCODE_DISABLE_EXTERNAL_SKILLS: truthy("OPENCODE_DISABLE_EXTERNAL_SKILLS"),
5151
OPENCODE_FAKE_VCS: process.env["OPENCODE_FAKE_VCS"],
5252
OPENCODE_SERVER_PASSWORD: process.env["OPENCODE_SERVER_PASSWORD"],
5353
OPENCODE_SERVER_USERNAME: process.env["OPENCODE_SERVER_USERNAME"],

packages/opencode/src/skill/index.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ import * as Log from "@opencode-ai/core/util/log"
2020
import { Discovery } from "./discovery"
2121

2222
const log = Log.create({ service: "skill" })
23-
const EXTERNAL_DIRS = [".claude", ".agents"]
23+
const CLAUDE_EXTERNAL_DIR = ".claude"
24+
const AGENTS_EXTERNAL_DIR = ".agents"
2425
const EXTERNAL_SKILL_PATTERN = "skills/**/SKILL.md"
2526
const OPENCODE_SKILL_PATTERN = "{skill,skills}/**/SKILL.md"
2627
const SKILL_PATTERN = "**/SKILL.md"
@@ -152,15 +153,19 @@ const discoverSkills = Effect.fnUntraced(function* (
152153
) {
153154
const state: ScanState = { matches: new Set(), dirs: new Set() }
154155

156+
const externalDirs: string[] = []
155157
if (!Flag.OPENCODE_DISABLE_EXTERNAL_SKILLS) {
156-
for (const dir of EXTERNAL_DIRS) {
158+
if (!Flag.OPENCODE_DISABLE_CLAUDE_CODE_SKILLS) externalDirs.push(CLAUDE_EXTERNAL_DIR)
159+
externalDirs.push(AGENTS_EXTERNAL_DIR)
160+
161+
for (const dir of externalDirs) {
157162
const root = path.join(Global.Path.home, dir)
158163
if (!(yield* fsys.isDir(root))) continue
159164
yield* scan(state, root, EXTERNAL_SKILL_PATTERN, { dot: true, scope: "global" })
160165
}
161166

162167
const upDirs = yield* fsys
163-
.up({ targets: EXTERNAL_DIRS, start: directory, stop: worktree })
168+
.up({ targets: externalDirs, start: directory, stop: worktree })
164169
.pipe(Effect.catch(() => Effect.succeed([] as string[])))
165170

166171
for (const root of upDirs) {

0 commit comments

Comments
 (0)