(sourceDir: string, targetDir: string)
| 150 | } |
| 151 | |
| 152 | export async function copyDir(sourceDir: string, targetDir: string): Promise<void> { |
| 153 | await ensureDir(targetDir) |
| 154 | const entries = await fs.readdir(sourceDir, { withFileTypes: true }) |
| 155 | for (const entry of entries) { |
| 156 | const sourcePath = path.join(sourceDir, entry.name) |
| 157 | const targetPath = path.join(targetDir, entry.name) |
| 158 | if (entry.isDirectory()) { |
| 159 | await copyDir(sourcePath, targetPath) |
| 160 | } else if (entry.isFile()) { |
| 161 | await ensureDir(path.dirname(targetPath)) |
| 162 | await fs.copyFile(sourcePath, targetPath) |
| 163 | } |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | /** |
| 168 | * Copy a skill directory, optionally transforming markdown content. |
no test coverage detected