(entry, targetSubdir, stripPrefix = null)
| 846 | |
| 847 | // Copy files by category |
| 848 | const copyFile = (entry, targetSubdir, stripPrefix = null) => { |
| 849 | const sourcePath = path.join(sourceDir, entry.path); |
| 850 | if (!fs.existsSync(sourcePath)) { |
| 851 | return; |
| 852 | } |
| 853 | |
| 854 | // Optionally strip a prefix from the path to avoid double-nesting |
| 855 | let targetRelPath = entry.path; |
| 856 | if (stripPrefix && targetRelPath.startsWith(stripPrefix)) { |
| 857 | targetRelPath = targetRelPath.slice(stripPrefix.length); |
| 858 | } |
| 859 | |
| 860 | const targetPath = path.join(refsDir, targetSubdir, targetRelPath); |
| 861 | fs.mkdirSync(path.dirname(targetPath), {recursive: true}); |
| 862 | |
| 863 | const destRelPath = path.posix.join(targetSubdir, targetRelPath); |
| 864 | const content = fs.readFileSync(sourcePath, 'utf8'); |
| 865 | const rewritten = rewriteRelativeLinks(content, entry.path, destRelPath, destinationMap); |
| 866 | fs.writeFileSync(targetPath, rewritten); |
| 867 | }; |
| 868 | |
| 869 | // Copy guides |
| 870 | const customContent = getCustomSkillContent(skillConfig.name); |
no test coverage detected