MCPcopy Create free account
hub / github.com/Microck/opencode-studio / getSkillDirs

Function getSkillDirs

server/index.js:642–674  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

640};
641
642const getSkillDirs = () => {
643 const roots = getSearchRoots();
644 const dirs = [];
645
646 for (const root of roots) {
647 const skillDir = path.join(root, 'skill');
648 if (fs.existsSync(skillDir)) {
649 dirs.push({ path: skillDir, source: 'skill-dir', root });
650 }
651
652 const skillsDir = path.join(root, 'skills');
653 if (fs.existsSync(skillsDir)) {
654 try {
655 const packages = fs.readdirSync(skillsDir, { withFileTypes: true })
656 .filter(d => d.isDirectory());
657 for (const pkg of packages) {
658 const nestedSkillsDir = path.join(skillsDir, pkg.name, 'skills');
659 if (fs.existsSync(nestedSkillsDir)) {
660 dirs.push({ path: nestedSkillsDir, source: 'skills-dir', root, package: pkg.name });
661 }
662 const pkgSkillFile = path.join(skillsDir, pkg.name, 'SKILL.md');
663 if (fs.existsSync(pkgSkillFile)) {
664 dirs.push({ path: path.join(skillsDir, pkg.name), source: 'skills-dir', root, package: pkg.name, isFlat: true });
665 }
666 }
667 } catch (e) {
668 console.warn(`Failed to read skills from ${skillsDir}:`, e.message);
669 }
670 }
671 }
672
673 return dirs;
674};
675
676const getCommandDirs = () => {
677 const roots = getSearchRoots();

Callers 1

index.jsFile · 0.85

Calls 1

getSearchRootsFunction · 0.85

Tested by

no test coverage detected