(dirPath: string, root: "scripts" | "references", files: Array<{ filename: string; content: string }>)
| 196 | } |
| 197 | |
| 198 | function writeCompanionFiles(dirPath: string, root: "scripts" | "references", files: Array<{ filename: string; content: string }>): void { |
| 199 | if (files.length === 0) return; |
| 200 | const rootDir = path.join(dirPath, root); |
| 201 | fs.mkdirSync(rootDir, { recursive: true }); |
| 202 | for (const file of files) { |
| 203 | const target = path.join(rootDir, file.filename); |
| 204 | fs.mkdirSync(path.dirname(target), { recursive: true }); |
| 205 | fs.writeFileSync(target, file.content, "utf8"); |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | function sanitizeName(input: string): string { |
| 210 | return input.trim().replace(/[^A-Za-z0-9._-]+/g, "-").replace(/^-+|-+$/g, ""); |
no test coverage detected