gitmyhub

opencode-parser

TypeScript ★ 20 updated 14d ago

Parse any file in opencode. Supports PDF, DOCX, XLSX, PPTX, images, EPUB, HTML, Markdown, Jupyter, archives, and plain text.

A plugin for the opencode AI coding assistant that converts PDFs, Word docs, spreadsheets, presentations, Jupyter notebooks, and many other file formats into readable text the AI can process.

TypeScriptsetup: easycomplexity 2/5

opencode-parser is a plugin for the opencode AI coding assistant that lets the AI read and work with files in formats it would not otherwise understand. Without a plugin like this, an AI assistant can only see plain text files directly. With opencode-parser installed, you can hand it a PDF, a Word document, a spreadsheet, a PowerPoint file, or many other formats, and the plugin converts the content into structured text the AI can process.

The supported formats include PDF, DOCX, XLSX, XLS, CSV, TSV, PPTX, PPT, EPUB, HTML, XML, Markdown, Jupyter notebooks, ZIP files, and plain text formats like JSON, YAML, and TOML. Image files (PNG, JPG, WEBP, and others) can also be processed using OCR text extraction, though that option is off by default and requires enabling it. For spreadsheets, it extracts tables and sheet names. For presentations, it pulls slide text and speaker notes. For Jupyter notebooks, it pulls code cells, markdown cells, and outputs.

The plugin verifies file type using the actual binary content of the file rather than just trusting the file extension. All supported formats return results in the same structure, so the AI gets consistent output regardless of what kind of file you pass in. Large files are truncated with a note, or you can set the character limit to unlimited if you need the full content.

Options include controlling the maximum number of characters returned, limiting which pages or sheets are processed, enabling OCR for images, and saving the parsed result as a Markdown file alongside the original.

Installation is either through the opencode plugin command, a one-line JSON config entry, or by copying the source files into a local tools folder. The project is MIT licensed.

Where it fits