mirror of
https://mirror.skon.top/github.com/code-yeongyu/oh-my-opencode
synced 2026-04-30 18:50:29 +08:00
feat(opencode-skill-loader): adapt skill resolution and discovery for team-mode
This commit is contained in:
@@ -10,7 +10,9 @@ export function clearSkillCache(): void {
|
||||
}
|
||||
|
||||
export async function getAllSkills(options?: SkillResolutionOptions): Promise<LoadedSkill[]> {
|
||||
const cacheKey = options?.browserProvider ?? "playwright"
|
||||
const browserProvider = options?.browserProvider ?? "playwright"
|
||||
const teamModeEnabled = options?.teamModeEnabled ?? false
|
||||
const cacheKey = `${browserProvider}:${teamModeEnabled ? "team-on" : "team-off"}`
|
||||
const hasDisabledSkills = options?.disabledSkills && options.disabledSkills.size > 0
|
||||
|
||||
// Skip cache if disabledSkills is provided (varies between calls)
|
||||
@@ -21,12 +23,11 @@ export async function getAllSkills(options?: SkillResolutionOptions): Promise<Lo
|
||||
|
||||
const [discoveredSkills, builtinSkillDefinitions] = await Promise.all([
|
||||
discoverSkills({ includeClaudeCodePaths: true, directory: options?.directory }),
|
||||
Promise.resolve(
|
||||
createBuiltinSkills({
|
||||
browserProvider: options?.browserProvider,
|
||||
disabledSkills: options?.disabledSkills,
|
||||
})
|
||||
),
|
||||
createBuiltinSkills({
|
||||
browserProvider,
|
||||
disabledSkills: options?.disabledSkills,
|
||||
teamModeEnabled,
|
||||
}),
|
||||
])
|
||||
|
||||
const builtinSkillsAsLoaded: LoadedSkill[] = builtinSkillDefinitions.map((skill) => ({
|
||||
@@ -49,7 +50,6 @@ export async function getAllSkills(options?: SkillResolutionOptions): Promise<Lo
|
||||
|
||||
// Provider-gated skill names that should be filtered based on browserProvider
|
||||
const providerGatedSkillNames = new Set(["agent-browser", "playwright"])
|
||||
const browserProvider = options?.browserProvider ?? "playwright"
|
||||
|
||||
// Filter discovered skills to exclude provider-gated names that don't match the selected provider
|
||||
const filteredDiscoveredSkills = discoveredSkills.filter((skill) => {
|
||||
|
||||
@@ -4,6 +4,7 @@ export interface SkillResolutionOptions {
|
||||
gitMasterConfig?: GitMasterConfig
|
||||
browserProvider?: BrowserAutomationProvider
|
||||
disabledSkills?: Set<string>
|
||||
teamModeEnabled?: boolean
|
||||
/** Project directory to discover project-level skills from. Falls back to process.cwd() if not provided. */
|
||||
directory?: string
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ export function resolveSkillContent(skillName: string, options?: SkillResolution
|
||||
const skills = createBuiltinSkills({
|
||||
browserProvider: options?.browserProvider,
|
||||
disabledSkills: options?.disabledSkills,
|
||||
teamModeEnabled: options?.teamModeEnabled,
|
||||
})
|
||||
const skill = skills.find((builtinSkill) => builtinSkill.name === skillName)
|
||||
if (!skill) return null
|
||||
@@ -27,6 +28,7 @@ export function resolveMultipleSkills(
|
||||
const skills = createBuiltinSkills({
|
||||
browserProvider: options?.browserProvider,
|
||||
disabledSkills: options?.disabledSkills,
|
||||
teamModeEnabled: options?.teamModeEnabled,
|
||||
})
|
||||
const skillMap = new Map(skills.map((skill) => [skill.name, skill.template]))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user