dfb4f8abc3
Add resolveMultipleSkills() for resolving skill content to prepend to agent prompts. Includes test coverage for resolution logic. 🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
30 lines
762 B
TypeScript
30 lines
762 B
TypeScript
import { createBuiltinSkills } from "../builtin-skills/skills"
|
|
|
|
export function resolveSkillContent(skillName: string): string | null {
|
|
const skills = createBuiltinSkills()
|
|
const skill = skills.find((s) => s.name === skillName)
|
|
return skill?.template ?? null
|
|
}
|
|
|
|
export function resolveMultipleSkills(skillNames: string[]): {
|
|
resolved: Map<string, string>
|
|
notFound: string[]
|
|
} {
|
|
const skills = createBuiltinSkills()
|
|
const skillMap = new Map(skills.map((s) => [s.name, s.template]))
|
|
|
|
const resolved = new Map<string, string>()
|
|
const notFound: string[] = []
|
|
|
|
for (const name of skillNames) {
|
|
const template = skillMap.get(name)
|
|
if (template) {
|
|
resolved.set(name, template)
|
|
} else {
|
|
notFound.push(name)
|
|
}
|
|
}
|
|
|
|
return { resolved, notFound }
|
|
}
|