Skip to main content
MIRA’s document parsing is done entirely in TypeScript inside a Node.js worker_threads worker (src/workers/document-parser.worker.ts). This keeps the main process unblocked during heavy I/O or CPU parsing. Adding a new format means extending this worker.

How parsers work

When a document is uploaded, src/main/document-parser.ts spawns a Worker from src/workers/document-parser.worker.ts. The worker receives a raw Buffer, detects the format by MIME type and file extension, and posts a ParseResult back:

1. Add the npm dependency (if needed)

If your format requires a parsing library, add it to package.json:
For type definitions:

2. Add the parser branch to the worker

In src/workers/document-parser.worker.ts, add a new if branch. The worker uses MIME type first, file extension as fallback:

3. Register the supported extension

In src/shared/constants.ts, add the extension to SUPPORTED_EXTENSIONS:

4. Add the MIME type mapping

In src/shared/types.ts, add the MIME type to the DocumentMimeType union so TypeScript accepts it:

5. Add the file extension to the upload dialog filter

In src/main/ipc-handlers.ts, find where skills:open-file-dialog and workflows:open-file-dialog define Electron dialog.showOpenDialog filters, and add your extension to the documents upload filter:

6. Update docs

Add your new format to the table in Supported File Formats.
Edit this page — Open a pull request