feat(flags): allow disabling .claude prompt and skills loading (#7205)

This commit is contained in:
freespace8
2026-01-08 14:10:25 +08:00
committed by GitHub
parent d5f0e3fccc
commit 542c9d5346
4 changed files with 30 additions and 19 deletions

View File

@@ -7,6 +7,7 @@ import { Log } from "../util/log"
import { Global } from "@/global"
import { Filesystem } from "@/util/filesystem"
import { exists } from "fs/promises"
import { Flag } from "@/flag/flag"
export namespace Skill {
const log = Log.create({ service: "skill" })
@@ -80,22 +81,24 @@ export namespace Skill {
claudeDirs.push(globalClaude)
}
for (const dir of claudeDirs) {
const matches = await Array.fromAsync(
CLAUDE_SKILL_GLOB.scan({
cwd: dir,
absolute: true,
onlyFiles: true,
followSymlinks: true,
dot: true,
}),
).catch((error) => {
log.error("failed .claude directory scan for skills", { dir, error })
return []
})
if (!Flag.OPENCODE_DISABLE_CLAUDE_CODE_SKILLS) {
for (const dir of claudeDirs) {
const matches = await Array.fromAsync(
CLAUDE_SKILL_GLOB.scan({
cwd: dir,
absolute: true,
onlyFiles: true,
followSymlinks: true,
dot: true,
}),
).catch((error) => {
log.error("failed .claude directory scan for skills", { dir, error })
return []
})
for (const match of matches) {
await addSkill(match)
for (const match of matches) {
await addSkill(match)
}
}
}