output: braille summary visuals for scan Summary (TTY only) - #37
Open
buttonmonkey wants to merge 3 commits into
Open
output: braille summary visuals for scan Summary (TTY only)#37buttonmonkey wants to merge 3 commits into
buttonmonkey wants to merge 3 commits into
Conversation
asadeddin
reviewed
Jul 10, 2026
asadeddin
left a comment
Contributor
There was a problem hiding this comment.
Author
juangaitanv
reviewed
Jul 11, 2026
Add two dependency-free, TTY-only braille visuals to `print_summary`: 1. Findings heat map — the "Most affected files" list gains a per-file braille bar: length = finding count (normalised to the busiest file), colour = worst severity in that file (reusing ui::severity_code). 2. Severity mix bar — a single stacked braille bar under the `● N critical ● N high …` line, segments sized by count and coloured by severity. Both are gated behind ui::color_enabled(): piped / NO_COLOR output falls back to the original plain list, byte-for-byte unchanged, and JSON/CSV are untouched. Braille is packed by hand (U+2800 base); no new dependencies. Heat bars are padded to a fixed 10 glyphs so the count column stays aligned. Adds unit tests for the pure helpers: the braille_bar width/alignment invariant, fill math, clamping, partial-cell, and severity_rank ordering.
Per-segment rounding with .max(1.0) could push the stacked mix bar past WIDTH (e.g. counts 997/1/1/1 rendered 27 cells). Allocate cells with the largest-remainder method, reserving one cell per present severity: the bar now never exceeds WIDTH and never drops a severity the tally above it lists, so a lone critical among many highs stays visible. Adds unit tests: total never exceeds WIDTH, fills exactly WIDTH when it fits, every present severity keeps >=1 cell, absent severities get none.
…pers Iterator form for the sub-column loop in braille_bar; rustfmt on the mix-bar counts binding. No behavior change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
buttonmonkey
force-pushed
the
feat/braille-summary-visuals
branch
from
July 16, 2026 12:34
bd26659 to
926adbe
Compare
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.


What
Two small, dependency-free visual touches to the scan Summary, both TTY-only:
ui::severity_code).● N critical ● N high …line, segments sized by each severity's share and coloured by severity.What it looks like
A real multi-file scan — heat map (per file) + severity mix bar (overall blend):
A balanced severity mix — the stacked bar reads the blend at a glance:
The mix bar is normalized to the total, so it shows the blend of severities rather than the volume.
Pipe-safety (the important guarantee)
Both visuals are gated behind
ui::color_enabled()(TTY andNO_COLORunset). When stdout is piped orNO_COLORis set, the output falls back to the original plain list, byte-for-byte unchanged, and the JSON/CSV paths are untouched. Verified by diffing pre- vs post-change output:sighthound sample | cat— identicalNO_COLOR=1 sighthound sample— identicalsighthound sample -o json/-o csv— identicalNo new dependencies
Braille is packed by hand (
U+2800base), in the spirit of the dependency-freeui.rs.Cargo.toml/Cargo.lockare untouched. Bars are padded to a fixed 10 glyphs so the count column stays aligned; deterministic ordering (BTreeMap + existing sorts) is preserved.Tests
Adds unit tests for the pure helpers in
output.rs:braille_bar— the char-count == width alignment invariant (across widths/fracs), fill math, out-of-range clamping, and partial-cell behaviour.severity_rank— ordering including the unknown case.Full suite green; no existing tests changed.
Try it
Any tree with findings across several files / severities will show both visuals in a colour terminal; piping it (
| cat) shows the unchanged plain output.Scope: a single file,
src/scanner/output.rs.