(store: SqliteStore, skillId: string)
| 8 | import { resolveHubClient, hubRequestJson } from "./hub"; |
| 9 | |
| 10 | export function buildSkillBundleForHub(store: SqliteStore, skillId: string): SkillBundle { |
| 11 | const skill = store.getSkill(skillId); |
| 12 | if (!skill) { |
| 13 | throw new Error(`Skill not found: ${skillId}`); |
| 14 | } |
| 15 | |
| 16 | const latestVersion = store.getLatestSkillVersion(skillId); |
| 17 | const skillMd = readSkillMarkdown(skill.dirPath, latestVersion?.content ?? ""); |
| 18 | |
| 19 | return { |
| 20 | metadata: { |
| 21 | id: skill.id, |
| 22 | name: skill.name, |
| 23 | description: skill.description, |
| 24 | version: skill.version, |
| 25 | qualityScore: skill.qualityScore, |
| 26 | }, |
| 27 | bundle: { |
| 28 | skill_md: skillMd, |
| 29 | scripts: readCompanionFiles(path.join(skill.dirPath, "scripts")), |
| 30 | references: readCompanionFiles(path.join(skill.dirPath, "references")), |
| 31 | evals: readEvals(path.join(skill.dirPath, "evals", "evals.json")), |
| 32 | } satisfies SkillGenerateOutput, |
| 33 | }; |
| 34 | } |
| 35 | |
| 36 | function readSkillMarkdown(dirPath: string, fallback: string): string { |
| 37 | const skillMdPath = path.join(dirPath, "SKILL.md"); |
no test coverage detected