(entry, targetSubdir, stripPrefix = null)
| 763 | |
| 764 | // Copy files by category |
| 765 | const copyFile = (entry, targetSubdir, stripPrefix = null) => { |
| 766 | const sourcePath = path.join(sourceDir, entry.path); |
| 767 | if (!fs.existsSync(sourcePath)) { |
| 768 | return; |
| 769 | } |
| 770 | |
| 771 | // Optionally strip a prefix from the path to avoid double-nesting |
| 772 | let targetRelPath = entry.path; |
| 773 | if (stripPrefix && targetRelPath.startsWith(stripPrefix)) { |
| 774 | targetRelPath = targetRelPath.slice(stripPrefix.length); |
| 775 | } |
| 776 | |
| 777 | const targetPath = path.join(refsDir, targetSubdir, targetRelPath); |
| 778 | fs.mkdirSync(path.dirname(targetPath), {recursive: true}); |
| 779 | fs.copyFileSync(sourcePath, targetPath); |
| 780 | }; |
| 781 | |
| 782 | // Copy guides |
| 783 | const customContent = getCustomSkillContent(skillConfig.name); |
no test coverage detected