Skip to content

Match Cursor Read tool behavior and add PDF-to-Markdown support - #13

Merged
vinniefalco merged 2 commits into
cppalliance:masterfrom
vinniefalco:master
Dec 4, 2026
Merged

vinniefalco merged 2 commits into
cppalliance:masterfrom
vinniefalco:master

Conversation

@vinniefalco

@vinniefalco vinniefalco commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Align Read with Cursor's text Read tool: sparse multiple-of-10 line prefixes, ... N line(s) not shown ... top/bottom markers, trailing-newline line counting, raw 100,000-character refusal naming file bytes, two-tier binary detection (blocked binary extensions + content sniff), and exact Cursor error messages.
  • Add pure-Rust, zero-dependency PDF-to-Markdown conversion via pdfmd (read/pdf.rs), routed through Read's normal window/limit/100k-char pipeline, with clear handling for empty, scanned, and corrupt PDFs.
  • Update schemas/read.json, schemas/EDITS.md, spec.rs, and unit + integration tests.

Verification

  • cargo test --locked --workspace --all-features
  • CARGO_BUILD_WARNINGS=deny cargo clippy --locked --workspace --all-targets --all-features
  • cargo fmt --all --check
  • RUSTDOCFLAGS="-D warnings" cargo doc --locked --workspace --no-deps --all-features --document-private-items
  • cargo build --locked -p plugin-std --release

Summary by CodeRabbit

  • New Features
    • Read now supports extracting text from PDF files as Markdown, including paged reads with offsets and limits.
    • Text reads show line numbers at intervals and mark lines omitted outside the selected window.
  • Bug Fixes
    • Reads now refuse requests that exceed the character limit instead of truncating output. Binary files are rejected, and missing-file errors no longer include the requested path.
  • Documentation
    • Updated Read tool guidance to describe PDF support, reading limits, and supported file types.

Align 
ead with Cursor's text Read tool: sparse multiple-of-10 line prefixes, top and bottom omitted-line markers, trailing-newline line counting, raw 100,000-character refusal, two-tier binary detection, and exact error messages.

- Keep 
ead::load and crate::text::split_lines unchanged so 
eplace and grep keep their existing behavior, while 
ead_file runs stat, check_read_type, �locked_binary_extension, 
ead_prefix, sniff_binary, split_read_lines, CHAR_CAP, and 
ender.
- Replace BYTE_CAP auto-truncation and cut_first_line with a raw-character check in 
aw_window_chars that returns the two-line refusal naming �ytes.len().
- Update schemas/read.json, schemas/EDITS.md, spec.rs, and the 
ead, pack, and integration test suites.
Convert .pdf files to Markdown in memory through 
ead/pdf.rs using zero-dependency pdfmd, then run the result through Read's normal line window, CHAR_CAP, and sparse-line render pipeline.

- Add pdfmd to Cargo.toml and crates/plugin-std/Cargo.toml so PDF conversion runs single-threaded without spawning a global thread pool inside the dynamic library.
- Handle zero-byte PDFs as File is empty., scanned PDFs with no extractable text as an explicit error, and corrupt PDFs with the parser error.
- Update schemas/read.json, schemas/EDITS.md, spec-tests.rs, and add 
ead/tests/pdf.rs.
@vinniefalco
vinniefalco merged commit a0a1e3f into cppalliance:master Dec 4, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant