Skip to main content

Module compress_preview

Module compress_preview 

Source
Expand description

compress_preview — a read-only “what would compression do to this?” inspector (#984, Headroom #1267).

Returns the original alongside the exact bytes lean-ctx would emit, with token and byte accounting plus the line diff. It deliberately calls the production compressors — compressor::aggressive_compress for the file-read path and the shell engine’s compress_if_beneficial for command output — so the preview is always what the agent would actually receive, never a re-derivation that could drift from the real pipeline (#498).

Structs§

Preview
A computed preview: the original, the compressed form lean-ctx would emit, and the token/byte accounting for both.

Enums§

Pipeline
Which production compressor a preview runs through.

Functions§

ext_of
Lowercased extension (no leading dot) of path, for preview_read.
preview_read
Preview the read/aggressive pipeline for content, with an optional file extension that drives language-specific comment stripping and the JSON/CSV crushers.
preview_shell
Preview the shell pipeline for output produced by command (the command steers build/test-aware verbatim preservation).