Expand description
Token-savings presentation: reshape ripgrep’s path:line:text stream into a compact, paginated
view for agents. This is a pure transform over already-rendered output — matching stays 100%
ripgrep (see confirm). The contract is deliberately weaker than the byte-for-byte CLI: the
match set is identical to rg (nothing is ever dropped — pagination is the only volume
control), but the presentation differs: the path is printed once per file, results are paged,
and pathologically long lines are center-truncated on the match (one Read from full content).
Structs§
- Compact
Opts - Page
- A rendered page: surface-agnostic
header+body, plus the counts and keyset state each caller (CLI / MCP) needs to mint the “next page” cursor and detect a changed result set.
Constants§
- DEFAULT_
MAX_ COLS - Default max rendered columns per line; normal code lines pass untouched, only long/minified lines get center-truncated on the match.
- DEFAULT_
PAGE_ SIZE - Default matches per page. Generous: an agent pulls the next page cheaply (warm index).
Functions§
- format
- Reshape
raw(ripgrep’spath:line:textoutput) into a compact page.pattern/optsare used only to locate the match within long lines for centered truncation. Pagination is keyset (resume afterstart_after), not offset, so it stays correct when the result set shifts between calls;modeselects the matches / files (-l) / count (-c) shape.