Skip to main content

Module render

Module render 

Source
Expand description

Turning graph facts into lines an assistant reads.

Everything here is generic over what is being rendered: the digests in this module’s siblings share the line budget, the number formatting, the path shortening, and — above all — sanitize, which every string that came out of the graph must pass through before it reaches a rendered line.

Constants§

EMPTY_MAP
The one line a store with nothing in it gets: what is missing, and the command that fixes it.
MAX_CONTEXT_LINES
Longest render_context digest, in lines. Wider than the others because it quotes source.
MAX_MAP_LINES
Longest digest any repograph tool may print, in lines.
MAX_TOOL_LINES
Longest digest every other tool here prints, in lines.
MIXED
What a set of files with no shared directory is called.
SEP
Separator between the items of a one-line list.

Functions§

age
A duration in seconds as one coarse unit: 45s, 12m, 3h, 20d. Negative input — a clock that ran backwards — reads as 0s.
basename
The last /-separated segment of a key: src/core/db.rsdb.rs.
cap_lines
Keep at most max lines, dropping the rest.
cluster_name
What to call a set of files.
common_dir_prefix
The longest directory prefix every key shares, /-joined. Empty when the keys share no leading directory at all.
dir_components
The directory segments of a key: src/core/db.rs["src", "core"]. A key with no / has none.
plural
n of word, pluralised by adding an s. 1 file, 2 files.
quarter_index
The quarter a timestamp falls in, counted from year 0 so that subtracting one index from another gives a number of quarters.
quarter_label
A quarter index as its label: 2026Q3.
render_context
Render a ContextReport as the digest an assistant reads: at most MAX_CONTEXT_LINES lines, byte-identical for the same report.
render_impact
Render an ImpactReport: at most MAX_TOOL_LINES lines.
render_map
Render a RepoMap as the digest an assistant reads: at most MAX_MAP_LINES lines, byte-identical for the same map.
render_owners
Render an OwnersReport: at most MAX_TOOL_LINES lines.
render_why
Render a WhyReport: at most MAX_TOOL_LINES lines.
sanitize
Replace every ASCII control character (0x00-0x1f and 0x7f, tabs and newlines included) with a space, so a value read out of the graph cannot forge a line break, a section header, or a terminal escape sequence.
short_names
Shorten keys to their filenames, keeping the full path for any filename that would otherwise appear twice.
thousands
12041,204. Groups of three, ASCII digits only.
top_tokens
The n path segments most keys carry, ignoring prefix.
ymd
A Unix timestamp as a calendar date in UTC: 2026-09-04.