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

Function exportDiagnostics

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

Source from the content-addressed store, hash-verified

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