MCPcopy Index your code
hub / github.com/coder/mux / appendToFile

Method appendToFile

src/node/services/devToolsService.ts:575–596  ·  view source on GitHub ↗
(workspaceId: string, entry: DevToolsLogEntry)

Source from the content-addressed store, hash-verified

573 }
574
575 private async appendToFile(workspaceId: string, entry: DevToolsLogEntry): Promise<void> {
576 return this.enqueueWrite(workspaceId, async () => {
577 // Defense-in-depth: skip stale writes after clear() by requiring current entities.
578 const data = this.workspaces.get(workspaceId);
579 if (!data) {
580 return;
581 }
582 if (entry.type === "run" && !data.runs.has(entry.run.id)) {
583 return;
584 }
585 if (entry.type === "step" && !data.steps.has(entry.step.id)) {
586 return;
587 }
588 if (entry.type === "step-update" && !data.steps.has(entry.stepId)) {
589 return;
590 }
591
592 const filePath = this.getSessionFilePath(workspaceId);
593 await fs.mkdir(path.dirname(filePath), { recursive: true });
594 await fs.appendFile(filePath, `${JSON.stringify(entry)}\n`, "utf-8");
595 });
596 }
597}

Callers 3

createRunMethod · 0.95
createStepMethod · 0.95
updateStepMethod · 0.95

Calls 4

enqueueWriteMethod · 0.95
getSessionFilePathMethod · 0.95
getMethod · 0.65
hasMethod · 0.45

Tested by

no test coverage detected