diff --git a/src/tools/delegate-task/skill-resolver.ts b/src/tools/delegate-task/skill-resolver.ts new file mode 100644 index 00000000..db31c898 --- /dev/null +++ b/src/tools/delegate-task/skill-resolver.ts @@ -0,0 +1,21 @@ +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[], + options: { gitMasterConfig?: GitMasterConfig; browserProvider?: BrowserAutomationProvider, disabledSkills?: Set } +): 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) { + const allSkills = await discoverSkills({ includeClaudeCodePaths: true }) + 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 } +}