MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / exportDiagnostics

Function exportDiagnostics

apps/desktop/src/main/diagnostics.ts:211–236  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

209 * manager. Returns the zip path.
210 */
211export const exportDiagnostics = async (): Promise<string> => {
212 const { TextReader, Uint8ArrayReader, Uint8ArrayWriter, ZipWriter } =
213 await import("@zip.js/zip.js");
214 const { readFile } = await import("node:fs/promises");
215
216 const logsDir = dirname(log.transports.file.getFile().path);
217 const executorLogsDir = join(app.getPath("home"), ".executor", "logs");
218 const entries: ZipEntry[] = [
219 ...collectFiles(logsDir, "logs"),
220 ...collectFiles(executorLogsDir, "executor-logs"),
221 ...collectFiles(app.getPath("crashDumps"), "crash-dumps"),
222 ];
223
224 const writer = new ZipWriter(new Uint8ArrayWriter());
225 await writer.add("manifest.json", new TextReader(JSON.stringify(buildManifest(), null, 2)));
226 for (const entry of entries) {
227 await writer.add(entry.name, new Uint8ArrayReader(new Uint8Array(await readFile(entry.path))));
228 }
229 const zipped = await writer.close();
230
231 const output = join(app.getPath("downloads"), `executor-diagnostics-${exportStamp()}.zip`);
232 writeFileSync(output, zipped);
233 log.info("[diagnostics] exported", { output, files: entries.length });
234 shell.showItemInFolder(output);
235 return output;
236};
237
238/**
239 * "Report a Problem…" menu flow: export the diagnostics zip, then open a

Callers 2

registerIpcHandlersFunction · 0.90

Calls 5

collectFilesFunction · 0.85
exportStampFunction · 0.85
buildManifestFunction · 0.70
closeMethod · 0.65
infoMethod · 0.65

Tested by

no test coverage detected