(args, extras)
| 4 | import { getStringArg } from "../parseArgs"; |
| 5 | |
| 6 | export const readSkillImpl: ToolImpl = async (args, extras) => { |
| 7 | const skillName = getStringArg(args, "skillName"); |
| 8 | |
| 9 | const { skills } = await loadMarkdownSkills(extras.ide); |
| 10 | |
| 11 | const skill = skills.find((s) => s.name === skillName); |
| 12 | |
| 13 | if (!skill) { |
| 14 | const availableSkills = skills.map((s) => s.name).join(", "); |
| 15 | throw new ContinueError( |
| 16 | ContinueErrorReason.SkillNotFound, |
| 17 | `Skill "${skillName}" not found. Available skills: ${availableSkills || "none"}`, |
| 18 | ); |
| 19 | } |
| 20 | |
| 21 | let content = skill.content; |
| 22 | |
| 23 | if (skill.files.length > 0) { |
| 24 | content += `\n |
| 25 | ## Supporting files |
| 26 | Skill directory: |
| 27 | ${skill.files.join("\n")} |
| 28 | |
| 29 | Use the read file tool to access these files as needed.`; |
| 30 | } |
| 31 | |
| 32 | return [ |
| 33 | { |
| 34 | name: `Skill: ${skill.name}`, |
| 35 | description: skill.description, |
| 36 | content, |
| 37 | uri: { |
| 38 | type: "file", |
| 39 | value: skill.path, |
| 40 | }, |
| 41 | }, |
| 42 | ]; |
| 43 | }; |
no test coverage detected