How compression works
Every command runs through the same eight pure-function stages:
- strip_ansi — remove escape sequences.
- pattern_replace — rewrite known noise (download progress, hashes).
- output_match — keep only lines matching configured patterns (errors, summaries).
- line_select — apply per-rule include/exclude.
- truncate_lines — cap individual line length.
- head_tail_window — keep the first N and last M lines of long blocks.
- hard_cap — enforce a global maximum byte budget.
- empty_message — substitute a friendly summary if everything was stripped.
Each stage is a pure fn(&str) -> String, so the pipeline is trivially
testable and can be replayed offline against captured fixtures.
If any stage errors, tok0 falls back to passing the raw output through unchanged. You never get blocked.