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

Function saveCodeCache

src/utils/code-cache.ts:55–70  ·  view source on GitHub ↗
(workspace: WorkspaceStructure, cache: CodeCache)

Source from the content-addressed store, hash-verified

53 * Save code generation cache to file
54 */
55export 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

Callers 3

code-cache.test.tsFile · 0.90
saveComponentGeneratedFunction · 0.85
saveAppInjectedFunction · 0.85

Calls 1

getCachePathFunction · 0.85

Tested by

no test coverage detected