Repository navigation
feat: add structured document recognition - #16
Merged
Merged
Conversation
privatenumber
marked this pull request as ready for review
August 10, 2026 02:22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
mac-ocr can return flat OCR lines, but callers processing receipts, forms, and tables must infer paragraphs, list items, rows, and merged cells themselves. macOS 26 provides Vision document recognition for this structure, but the CLI had no way to expose it without changing the established OCR schema.
For example, a table scan can contain
ALPHA,BETA,GAMMA, andDELTAas independent lines. A caller cannot reliably recover the original row and column relationships from that flat result alone.Changes
Add a macOS 26-only
mac-ocr documentcommand with a versioned mac-ocr-owned result schema. It returns root text plus recursive paragraphs, tables, lists, cells, line candidates, and top-left geometry, so consumers receive the recognized document structure directly.Older macOS versions return a typed unavailable error instead of attempting an unsupported Vision request. Existing OCR and searchable-PDF APIs remain unchanged. This PR establishes the native document core and CLI contract; a following PR will expose the same result through the shared Node service.