import { loadSkillsExport } from './skills-package'
export type GetSkillInput = {
id: string
path?: string
}
/**
* Load one skill from the owner's skills registry.
* Resolves the owner's skills package and loads it through a computed import.
*
* @param params.id - Skill id.
* @param params.path - Optional file path. Omit for the full skill with files.
* @returns The skill-get payload (metadata plus files, or one file).
*/
export default async function getSkill(input: GetSkillInput) {
if (!input.id?.trim()) {
throw new Error('Pass id.')
}
const skillGet = await loadSkillsExport('skill-get')
return await skillGet(
input.path ? { id: input.id, path: input.path } : { id: input.id },
)
}