(workspace: WorkspaceStructure, cache: CodeCache)
| 53 | * Save code generation cache to file |
| 54 | */ |
| 55 | export function saveCodeCache(workspace: WorkspaceStructure, cache: CodeCache): void { |
| 56 | const cachePath = getCachePath(workspace); |
| 57 | |
| 58 | try { |
| 59 | // Ensure process directory exists |
| 60 | if (!fs.existsSync(workspace.process)) { |
| 61 | fs.mkdirSync(workspace.process, { recursive: true }); |
| 62 | } |
| 63 | |
| 64 | const content = JSON.stringify(cache, null, 2); |
| 65 | fs.writeFileSync(cachePath, content, 'utf-8'); |
| 66 | } catch (error) { |
| 67 | const errorMessage = error instanceof Error ? error.message : String(error); |
| 68 | logger.printWarnLog(`Failed to save code cache: ${errorMessage}`); |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * Check if a component has already been generated |
no test coverage detected