MCPcopy
hub / github.com/github/awesome-copilot / discoverSkills

Function discoverSkills

extensions/java-modernization-studio/scan.mjs:309–332  ·  view source on GitHub ↗
(repoPath)

Source from the content-addressed store, hash-verified

307}
308
309async function discoverSkills(repoPath) {
310 const skillsDir = join(repoPath, ".github", "skills");
311 const out = [];
312 let entries;
313 try {
314 entries = await readdir(skillsDir, { withFileTypes: true });
315 } catch {
316 return out;
317 }
318 for (const e of entries) {
319 if (!e.isDirectory()) continue;
320 const md = await readText(join(skillsDir, e.name, "SKILL.md"));
321 let name = e.name;
322 let description = "";
323 if (md) {
324 const nameM = md.match(/(?:^|\n)#+\s*(.+)|name:\s*(.+)/i);
325 if (nameM) name = stripMd(nameM[1] || nameM[2] || e.name);
326 const descM = md.match(/description:\s*(.+)/i);
327 if (descM) description = stripMd(descM[1]);
328 }
329 out.push({ folder: e.name, name, description, hasSkillMd: !!md });
330 }
331 return out;
332}
333
334function detectJavaVersion(pom, gradle) {
335 const text = `${pom || ""}\n${gradle || ""}`;

Callers 1

scanRepoFunction · 0.85

Calls 2

readTextFunction · 0.85
stripMdFunction · 0.85

Tested by

no test coverage detected