refactor(flags): migrate external skills flag (#27685)

This commit is contained in:
Shoubhit Dash
2026-05-15 13:24:56 +05:30
committed by GitHub
parent 2d6bedecd4
commit 22cb0395e2
5 changed files with 85 additions and 3 deletions

View File

@@ -29,6 +29,19 @@ const itWithoutClaudeCodeSkills = testEffect(
node,
),
)
const itWithoutExternalSkills = testEffect(
Layer.mergeAll(
Skill.layer.pipe(
Layer.provide(Discovery.defaultLayer),
Layer.provide(Config.defaultLayer),
Layer.provide(Bus.layer),
Layer.provide(AppFileSystem.defaultLayer),
Layer.provide(Global.layer),
Layer.provide(RuntimeFlags.layer({ disableExternalSkills: true })),
),
node,
),
)
async function createGlobalSkill(homeDir: string) {
const skillDir = path.join(homeDir, ".claude", "skills", "global-test-skill")
@@ -420,6 +433,53 @@ description: A skill in the .agents/skills directory.
),
)
itWithoutExternalSkills.live("skips external skill directories when disabled", () =>
provideTmpdirInstance(
(dir) =>
Effect.gen(function* () {
yield* Effect.promise(() =>
Promise.all([
Bun.write(
path.join(dir, ".claude", "skills", "claude-skill", "SKILL.md"),
`---
name: claude-skill
description: A skill in the .claude/skills directory.
---
# Claude Skill
`,
),
Bun.write(
path.join(dir, ".agents", "skills", "agent-skill", "SKILL.md"),
`---
name: agent-skill
description: A skill in the .agents/skills directory.
---
# Agent Skill
`,
),
Bun.write(
path.join(dir, ".opencode", "skill", "opencode-skill", "SKILL.md"),
`---
name: opencode-skill
description: A skill in the .opencode/skill directory.
---
# OpenCode Skill
`,
),
]),
)
const skill = yield* Skill.Service
const list = (yield* skill.all()).filter((s) => s.location !== "<built-in>")
expect(list.map((s) => s.name)).toEqual(["opencode-skill"])
}),
{ git: true },
),
)
it.live("properly resolves directories that skills live in", () =>
provideTmpdirInstance(
(dir) =>