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§

DEFAULT_EXPLORE_BYTES
What a default explore reply may cost, in bytes.
EMPTY_BRIEF
The one line a store with nothing in it at all gets as a session opens: what is missing, and the command that fixes it. The same answer EMPTY_MAP gives, for the same reason — there is nothing to be central in, and no point naming a way to reach an empty graph.
EMPTY_MAP
The one line a store with nothing in it gets: what is missing, and the command that fixes it.
MAX_BRIEF_BYTES
Longest session brief, in bytes.
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_bytes
Keep whole lines while they fit in max bytes, dropping the rest.
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_brief
Render a BriefReport as the block a session opens with: at most MAX_BRIEF_BYTES bytes, byte-identical for the same report.
render_context
Render a ContextReport as the digest an assistant reads: at most MAX_CONTEXT_LINES lines, byte-identical for the same report.
render_explore
Render an ExploreReport in no more than budget_bytes.
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 character that could forge the shape of a digest with a space, so a value read out of the graph cannot fake a line break, a section header, or a terminal escape sequence — and cannot reorder or hide what it sits next to when rendered.
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.