(code: string, filePath: string)
| 176 | * Helper function to save generated code (handles both single and multi-file output) |
| 177 | */ |
| 178 | export function saveGeneratedCode(code: string, filePath: string): void { |
| 179 | const files = extractFiles(code); |
| 180 | |
| 181 | if (files.length > 0) { |
| 182 | // Multi-file output (e.g., index.tsx + index.module.less) |
| 183 | createFiles({ files, filePath }); |
| 184 | } else { |
| 185 | const extractedCode = extractCode(code); |
| 186 | const folderPath = path.dirname(filePath); |
| 187 | const fileName = path.basename(filePath); |
| 188 | writeFile(folderPath, fileName, extractedCode); |
| 189 | } |
| 190 | } |
| 191 | |
| 192 | /** |
| 193 | * Get list of available asset files for AI to match against |
no test coverage detected