fix(skill): isolate injected skill discovery

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
YeonGyu-Kim
2026-04-27 13:24:50 +09:00
parent f1353cd9a8
commit ecce65bb67
2 changed files with 3 additions and 12 deletions
+2 -4
View File
@@ -4,13 +4,10 @@ import { afterEach, beforeEach, describe, expect, it, mock, spyOn } from "bun:te
import type { ToolContext } from "@opencode-ai/plugin/tool"
import type { LoadedSkill } from "../../features/opencode-skill-loader/types"
import * as skillContent from "../../features/opencode-skill-loader/skill-content"
import * as commandDiscovery from "../slashcommand/command-discovery"
const discoverCommandsSync = mock(() => [])
mock.module("../slashcommand/command-discovery", () => ({
discoverCommandsSync,
}))
function createMockSkill(name: string): LoadedSkill {
return {
name,
@@ -50,6 +47,7 @@ function createMockContext(sessionID: string): ToolContext {
}
beforeEach(() => {
spyOn(commandDiscovery, "discoverCommandsSync").mockImplementation(discoverCommandsSync)
spyOn(skillContent, "getAllSkills").mockImplementation(getAllSkills)
spyOn(skillContent, "clearSkillCache").mockImplementation(clearSkillCache)
})
+1 -8
View File
@@ -37,14 +37,7 @@ export function createSkillTool(options: SkillLoadOptions = {}): ToolDefinition
disabledSkills: options?.disabledSkills,
browserProvider: options?.browserProvider,
})) ?? []
const allSkills = !options.skills
? discovered
: [
...discovered,
...options.skills.filter(
(skill) => !new Set(discovered.map((discoveredSkill) => discoveredSkill.name)).has(skill.name)
),
]
const allSkills = options.skills ? [...options.skills] : discovered
if (options.nativeSkills) {
try {