MCPcopy Create free account
hub / github.com/MigoXLab/coderio / saveGeneratedCode

Function saveGeneratedCode

src/nodes/code/utils.ts:178–190  ·  view source on GitHub ↗
(code: string, filePath: string)

Source from the content-addressed store, hash-verified

176 * Helper function to save generated code (handles both single and multi-file output)
177 */
178export 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

Callers 4

generateFrameFunction · 0.85
generateComponentFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85

Calls 4

extractFilesFunction · 0.90
createFilesFunction · 0.90
extractCodeFunction · 0.90
writeFileFunction · 0.90

Tested by

no test coverage detected