MCPcopy
hub / github.com/upstash/context7 / downloadSkill

Function downloadSkill

packages/cli/src/utils/api.ts:63–98  ·  view source on GitHub ↗
(project: string, skillName: string)

Source from the content-addressed store, hash-verified

61}
62
63export async function downloadSkill(project: string, skillName: string): Promise<DownloadResponse> {
64 const skillData = await getSkill(project, skillName);
65
66 if (skillData.error) {
67 // handle private repo skills with env var
68 const ghResult = await getSkillFromGitHub(project, skillName);
69 if (ghResult.status !== "ok" || !ghResult.skill) {
70 return {
71 skill: { name: skillName, description: "", url: "", project },
72 files: [],
73 error: skillData.message || skillData.error,
74 };
75 }
76
77 const { files, error } = await downloadSkillFromGitHub(ghResult.skill);
78 if (error) {
79 return { skill: ghResult.skill, files: [], error };
80 }
81 return { skill: ghResult.skill, files };
82 }
83
84 const skill = {
85 name: skillData.name,
86 description: skillData.description,
87 url: skillData.url,
88 project: skillData.project,
89 };
90
91 const { files, error } = await downloadSkillFromGitHub(skill);
92
93 if (error) {
94 return { skill, files: [], error };
95 }
96
97 return { skill, files };
98}
99
100export interface GenerateSkillResponse {
101 content: string;

Callers 5

installCommandFunction · 0.85
searchCommandFunction · 0.85
suggestCommandFunction · 0.85
setupAgentFunction · 0.85
setupCliFunction · 0.85

Calls 3

getSkillFunction · 0.85
getSkillFromGitHubFunction · 0.85
downloadSkillFromGitHubFunction · 0.85

Tested by

no test coverage detected