MCPcopy Create free account
hub / github.com/codag-megalith/codag-visualizer / writeGraphFile

Method writeGraphFile

frontend/src/cache.ts:213–225  ·  view source on GitHub ↗

* Write the merged graph to a standalone JSON file for external consumers (e.g., MCP server).

(graph: WorkflowGraph | null)

Source from the content-addressed store, hash-verified

211 * Write the merged graph to a standalone JSON file for external consumers (e.g., MCP server).
212 */
213 private async writeGraphFile(graph: WorkflowGraph | null): Promise<void> {
214 if (!this.graphPath) return;
215 try {
216 if (graph) {
217 const content = JSON.stringify(graph, null, 2);
218 await vscode.workspace.fs.writeFile(this.graphPath, Buffer.from(content, 'utf8'));
219 } else {
220 try { await vscode.workspace.fs.delete(this.graphPath); } catch { /* may not exist */ }
221 }
222 } catch (error) {
223 console.error('Failed to write graph file:', error);
224 }
225 }
226
227 /**
228 * Force immediate save of any pending changes.

Callers 3

flushMethod · 0.95
getMergedGraphMethod · 0.95
clearMethod · 0.95

Calls 2

fromMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected