2026-02-08 17:52:34 +09:00
|
|
|
import type { GitMasterConfig, BrowserAutomationProvider } from "../../config/schema"
|
|
|
|
|
import { resolveMultipleSkillsAsync } from "../../features/opencode-skill-loader/skill-content"
|
|
|
|
|
import { discoverSkills } from "../../features/opencode-skill-loader"
|
|
|
|
|
|
|
|
|
|
export async function resolveSkillContent(
|
|
|
|
|
skills: string[],
|
2026-02-21 17:07:29 +09:00
|
|
|
options: { gitMasterConfig?: GitMasterConfig; browserProvider?: BrowserAutomationProvider, disabledSkills?: Set<string>, directory?: string }
|
2026-02-08 17:52:34 +09:00
|
|
|
): Promise<{ content: string | undefined; error: string | null }> {
|
|
|
|
|
if (skills.length === 0) {
|
|
|
|
|
return { content: undefined, error: null }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const { resolved, notFound } = await resolveMultipleSkillsAsync(skills, options)
|
|
|
|
|
if (notFound.length > 0) {
|
2026-02-21 17:07:29 +09:00
|
|
|
const allSkills = await discoverSkills({ includeClaudeCodePaths: true, directory: options?.directory })
|
2026-02-08 17:52:34 +09:00
|
|
|
const available = allSkills.map(s => s.name).join(", ")
|
|
|
|
|
return { content: undefined, error: `Skills not found: ${notFound.join(", ")}. Available: ${available}` }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return { content: Array.from(resolved.values()).join("\n\n"), error: null }
|
|
|
|
|
}
|