feat(skill-loader): add skill-content resolver for agent skills
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)
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
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 }
|
||||
}
|
||||
Reference in New Issue
Block a user