Documentation
¶
Overview ¶
Package tui is the interactive dashboard's rendering layer: the row cells, the gauge, the state map, and eventually the whole page.
Package tui is ccdad's terminal dashboard.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ASCIIGlyphs = Glyphs{ Name: "ascii", Art: false, Border: lipgloss.ASCIIBorder(), GaugeFull: '#', GaugeEmpty: '.', Cursor: ">", Active: "*", Candidate: "+", Exhausted: "!", Empty: "0", Quarantined: "x", Disabled: "-", Unknown: "?", Cue: "..", MoreAbove: "^", MoreBelow: "v", }
ASCIIGlyphs is the vocabulary this page had before there was a choice, and it is not a degraded mode: it is the correct answer on a console that cannot carry UTF-8, and the only correct answer in east-asian width mode, where the frame is not merely ugly but arithmetically wrong -- lipgloss sizes the vertical border with one width function and the horizontal rules with another, and only the second reads the environment variable, so a frame asked for twenty columns renders its rules at twenty and its content rows at twenty-two. The ASCII frame is exact at twenty in both modes.
The eight markers are the characters the state column already used, kept rather than re-invented, so a user who switches the key has a page they can still read and a maintainer has one fewer table to keep in step.
var DarkBackground = sync.OnceValue(func() bool { if !isTerminal(os.Stdin) || !isTerminal(os.Stdout) { return true } return lipgloss.HasDarkBackground(os.Stdin, os.Stdout) })
DarkBackground answers whether this process's terminal has a dark background, for the one-shot page below and for nothing else. Every clause of it is a bound rather than a preference.
It asks only when stdin AND stdout are terminals, and that guard has to be the CALLER'S. On Windows lipgloss opens CONIN$ and CONOUT$ explicitly when stdio is redirected, so the library will not decline a query into a pipe, and `ccdad status > file` from a scheduled task would sit in raw mode waiting for a reply from nobody.
It asks at most once per process, because one ask is already the most expensive line in this binary. lipgloss's BackgroundColor loops over stdin AND stdout and runs both legs even where they are the same file -- there is no in == out guard to fall through -- at a two-second timeout each, so a single call puts stdin into raw mode with a deferred restore and blocks FOUR seconds on a terminal that answers neither OSC 11 nor DA1. Twice is eight.
It answers dark when it did not ask, which is the same default the interactive half takes when a multiplexer eats the reply. A default that is DEFINED rather than awaited is what keeps the two surfaces from disagreeing on a terminal that never answers.
It is a package var because no test has a terminal, and it is EXPORTED with no reader outside this package left, which is a state worth explaining instead of tidying. Package cli's one-shot tables did read it, on the argument that one cache beats two; the argument was wrong on its own numbers, because a sync.OnceValue is once per PROCESS and every one of those listings is its own process, so `ccdad list` paid the full four seconds under the default theme on a terminal that never answers. They take the same defined dark default this function returns when it declines to ask, and the thing that keeps them off this name is a syntax walk in that package which spells the name out. Unexporting would make that walk unreadable -- a ban on something the compiler already refuses teaches nobody what the cost was -- and it would be a change to this page's own mechanism made for a reason that belongs to a different one. It is never reached from the daemon, which renders nothing.
var UnicodeGlyphs = Glyphs{ Name: "unicode", Art: true, Border: lipgloss.RoundedBorder(), GaugeFull: '█', GaugeEmpty: '▒', Cursor: "❯", Active: "▪", Candidate: "◉", Exhausted: "✗", Empty: "✕", Quarantined: "⚠", Disabled: "−", Unknown: "◌", Cue: "..", MoreAbove: "^", MoreBelow: "v", }
UnicodeGlyphs is the default vocabulary, and the three marker alphabets in it are deliberately three and not one.
The live-account MARKER stays "*", spelled by the row itself and not by this set. The CURSOR is U+276F. The active STATE glyph is U+25AA. Before this, all three were "*" or ">", which made two facts from two different documents -- which credential a session would actually get, and what the daemon last decided about that account -- look like one fact when they agreed and look like a rendering bug when they did not. They are different questions from different files and their disagreeing is information.
Functions ¶
func Handles ¶
Handles reports whether the dashboard does something with a binding, on any of its screens.
It exists because a keybar that offers a key the model ignores is a string painted on a terminal that nothing else in this repository reads, and the test that catches it lives in the package that registers the command. It runs the binding's own keys through the same switch Update runs rather than re-listing them: a predicate built from a second list would go on passing for a dashboard that handled nothing.
It asks about every screen because the help view advertises keys that live on one of them -- enter belongs to a picker, and three of them belong to the daemon screen and are offered nowhere else.
func Render ¶
Render is the one-shot, non-TTY page: load, draw at the design target with no height ladder, and write it.
A failed load here is fatal rather than a notice, and that is not a second rule: AfterLoad keeps the PREVIOUS snapshot, and a one-shot render has none. There is nothing to keep and nothing to label.
func Run ¶
Run drives the dashboard until the user quits.
THE OPTION LIST IS EMPTY, AND THAT IS THE POINT. The two that are missing are WithoutSignalHandler and WithoutSignals, and leaving them out is a shutdown property rather than a default nobody thought about. With the library's own handler in place, a SIGTERM arriving in raw mode is turned into an ordinary quit: the loop returns, the terminal is put back to echo, canonical input and signal generation, and this returns nil. With the handler removed, the same SIGTERM kills the process outright with status 15 and leaves the terminal in raw mode -- the shell the user goes back to has no echo, no line editing and no Ctrl-C.
Ctrl-C is an ordinary key while nothing is released: the terminal is in raw mode, so it arrives as a keystroke rather than a signal, there is no scoped trap to fight, and signals are not being ignored. During the add key's released span both signals are dropped, which is documented where that key is written.
A panic inside the model is caught by the program's own recover, the terminal is restored, and this returns the killed-program error. The dashboard still dies, which is correct: a renderer that panicked has nothing useful left to show.
AN INTERRUPT IS NOT A FAILURE, and this is where that is decided. The library routes SIGTERM to an ordinary quit and SIGINT to an interrupt, and the two take the same shutdown path and leave the terminal in the same state -- the only difference is that one comes back as an error. Passing it on would make `kill -INT` print a message and exit non-zero where `kill -TERM` is silent and exits 0, for two ways of asking the same program to stop. It is worded the way the login's own interrupted exit is worded: the user's decision, not a fault.
Options.Out is not passed through, and the reason is not that the library cannot take a writer -- it can. It is that Out is where the ONE-SHOT render writes, downstream of a colour decision package cli has already made, and a program makes that decision for itself by probing the terminal it was given. Handing it a writer that has already answered would be two answers to one question.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App is the dashboard as a running program: the page, the injected world, and which of the five screens is showing.
The page itself is Model, which is pure and stays pure. Everything with a clock, a terminal or a signal disposition is here.
func (App) Init ¶
Init loads once, starts both clocks, and asks the terminal what colour it is.
The startup read goes through a message rather than straight to the seam, because Init hands back a command and not a model -- and the flag that says a read is in flight lives on the model.
tea.RequestBackgroundColor is passed BARE, with no parentheses. It is a func() Msg and tea.Cmd is a func() Msg, so the identifier already IS a Cmd; bubbletea's own godoc shows `return RequestBackgroundColor()` inside an Init, which returns a Msg and does not compile here.
It is a fourth Cmd in this Batch and nothing else changes. NO ProgramOption is added and none is needed: the option list Run hands the library is empty, and that emptiness is the shutdown property that keeps a SIGTERM in raw mode from killing the process outright -- a test counts those options at zero and this must not be the change that makes it one.
func (App) Update ¶
Update is the whole event loop. Every arm that schedules ends by returning the next tick, which is what makes "at most one outstanding" a property of the code rather than of the timing.
func (App) View ¶
View is two lines, and that split is the whole reason the page is a pure string: everything above this point can be asserted with a string comparison, and nothing below it can be.
AltScreen is a declarative field on the returned view. There is no WithAltScreen option to pass to the program, and inline is the default.
type Column ¶
type Column int
Column identifies one field of the two shipping tables. ColIdx through ColAuto are SetStatus's eight columns; ColTier and ColLeft are the two SetList carries instead of ColUsed, ColWindow, ColState and ColAuto.
type ColumnSet ¶
type ColumnSet int
ColumnSet is which of the two shipping tables the page is showing. [L] swaps between them; the heading changes with the polarity, so USED and LEFT never share a heading. Plan is the first thing in this package that needs the distinction, so it is declared here rather than left undeclared until something else does.
type Glyphs ¶ added in v0.8.0
type Glyphs struct {
// Name is which set this is, "unicode" or "ascii". It exists so a failure
// message can say which vocabulary produced the page it is complaining
// about, and so a test can pin the set it asked for rather than inferring
// it from a character.
Name string
// Art is whether this set may draw the pixel chrome, and it is the width
// rule's THIRD answer rather than a convenience field.
//
// The rule above divides this vocabulary in two. A MARKER must measure one
// column in both width modes, because a table's columns were computed
// around it. The FRAME and the GAUGE may be ambiguous, because a frame is
// drawn at a width it was told and a gauge is a fixed cell whose total does
// not move with the value in it.
//
// ART is ambiguous AND its total moves with the mode, which is neither of
// those, so it gets neither answer. Measured: a 48-cell row of U+2580 is 48
// columns ordinarily and 96 in east-asian mode. Cutting art in cell space
// keeps ansi.Truncate off its path, but the frame still measures every
// content row it is handed, and a 96-column row inside a box asked for 78
// breaks the box rather than the drawing.
//
// So this is false in the east-asian mode even when the caller spelled
// "unicode", which is the one place the escape hatch is narrowed. The
// narrowing is exact: the frame, the cursor and the eight markers are still
// Unicode there, because their widths are still ones the page can predict.
Art bool
Border lipgloss.Border
GaugeFull rune
GaugeEmpty rune
Cursor string
Active string
Candidate string
Exhausted string
Empty string
Quarantined string
Disabled string
Unknown string
// Cue is what a line that was cut ends in. Two characters, so that a reader
// who sees it knows something was removed rather than taking the remainder
// for the whole value.
Cue string
// MoreAbove and MoreBelow say which way the rows a scrolled table is not
// showing lie. The count alone cannot: the window is a slice, so rows can
// be off the top, off the bottom, or both, and a bare number reads as "off
// the bottom" to everyone.
MoreAbove string
MoreBelow string
}
Glyphs is every character this page draws that is not a letter, a digit, or part of a value somebody else read. Two sets exist and one of them is chosen per process; nothing in this package spells a marker, a frame piece or a gauge cell inline any more.
The reason for the type is not tidiness. Before it, the same three questions were answered at nine separate sites across five files -- the frame in the page renderer, the gauge in the cell builder, the state markers in a switch, the cursor in a const, the picker's own cursor in a string literal, the cut cue in four more -- and each of those answers was independently reversible. A machine that could not draw one of them could not be given a set that avoided all of them, because there was no set; there were nine decisions that happened to agree.
THE WIDTH RULE, which is what the two sets are really for. The width engine this binary measures with reads RUNEWIDTH_EASTASIAN once at startup and, when it is on, every box-drawing and block character becomes two columns wide while the rest stay one. So the glyphs divide into two classes and they are treated differently:
- A MARKER sits inside a measured column, beside text, in a table whose column widths were computed from the content. It must measure one column in both modes or every column to its right moves. Each marker below was measured in both modes before it was chosen.
- The FRAME and the GAUGE may be ambiguous, because a frame is drawn at a width it was told and a gauge is a fixed cell whose total does not change with the percentage in it. That exemption is closed at exactly eight characters -- four corners, two rules, two gauge cells -- and it is safe only because PickGlyphs hands back the ASCII set to any process running with the east-asian mode on.
The cut cue and the two scroll marks are ASCII in BOTH sets. They are emitted at a measured column boundary by definition, and the three characters that would read better there -- the ellipsis and the two arrows -- are all ambiguous, which would have made the exemption above eleven characters wide and mode-dependent in the one place a page has already run out of room.
func PickGlyphs ¶ added in v0.8.0
PickGlyphs is the whole of the choice: the configured value, and two facts about the process it will draw in.
An explicit "unicode" or "ascii" is honoured unconditionally, including against a console this binary has just been told cannot carry it. That is what an escape hatch is for, and it works in both directions -- somebody whose console reports a code page it is lying about needs a way to say so, and a value that a probe could veto is not a setting.
"auto" is the default, and anything this function does not recognise takes the same arm rather than an error path: the config layer is what validates the key, and an Options nobody filled in is a caller who did not choose, not a caller who chose wrongly.
The east-asian test is spelled to match the width engine's own predicate exactly -- ParseBool, and false unless it parses cleanly to true. That matters more than it looks: with a looser test ("is it set at all"), a machine with RUNEWIDTH_EASTASIAN=yes would get the ASCII page while the engine measuring it stayed in the ordinary mode, so the two would disagree in the same direction this whole rule exists to prevent, only quietly and in the safe-looking direction.
type KeyMap ¶
type KeyMap struct {
Add, Switch, Daemon, Strategy, Quit, List key.Binding
Up, Down, Refresh, Help, Esc, Enter key.Binding
Start, Stop, Restart key.Binding
}
KeyMap is every binding the dashboard answers to. Add through List are the six the keybar advertises; Up through Enter are movement and dismissal, shown only in the long help; Start through Restart belong to the daemon screen and are not offered anywhere else.
func (KeyMap) FullHelp ¶
FullHelp groups every binding for the long help view: the keybar's six, then movement and dismissal, then the daemon screen's three.
func (KeyMap) ShortHelp ¶
ShortHelp returns the keybar's six, in the order a, s, d, c, q, l. help truncates from the right, so this order is a safety property and not a preference: losing l costs nothing, because the table already is the list, and losing q strands a user in a full-screen program with no advertised way out. Being fifth of six rather than sixth is what buys q the room it has -- it is not a guarantee q survives every width. Measured against the rendered bar (see keybar's own tests): q is entirely absent below width 45, and present at 45 and every width above it.
type Layout ¶
type Layout struct {
Columns []Column
AccountWide int
Collapsed bool // USED is the bare percentage, not the gauge
Wordmark, Tagline, Figures bool
Notice bool // the "note: ..." line; see Plan's notice parameter
Runway bool // the "Runway: ..." line; see Plan's runway parameter
Border, Blanks bool
Title, Header bool // Header is the Active/Strategy/Mode line
// VisibleRows is an UPPER BOUND on how many account rows to render, not a
// count of rows that are actually shown: at the scrolling rung the last
// of them is spent on "+K more (j/k)" rather than an account row, and
// below that rung it is clamped to the real row count so a renderer
// slicing Rows[Top:Top+VisibleRows] never reads past the end.
VisibleRows int
TooNarrow, TooShort bool
}
Layout is the answer to "what fits", computed once per frame from the terminal size and the row count, and read by nothing but the renderer: it carries no styling and touches no string.
func Plan ¶
Plan reads nothing and calls nothing: it is a pure function of the six arguments, so the same (set, width, height, rows, notice, runway) always answers the same way and a test can walk every boundary without a terminal.
notice is whether Snapshot.Notices is non-empty. Plan has no other way to find out: it takes no Snapshot, so a caller with a notice to show has to say so directly. A page with a notice needs one more row than the same page without one — the notice line itself — and that row is spent or reclaimed by the height ladder exactly like any other block.
runway is whether there is a runway line to draw — the measured-burn summary, which exists only once enough readings have been recorded to give a rate, and is therefore absent on every machine for the first hours after it starts recording. It arrives as a bool for the reason notice does, and it costs the same one row. It is deliberately NOT folded into fixedRows below: that constant is the sum of every UNCONDITIONAL row, and raising it would shift every threshold on the height ladder for pages that draw no runway line at all.
The defect this guards against was reproduced before this existed: with ACCOUNT computed as "whatever's left" independently at every width, going from 100 columns to 105 columns took ACCOUNT from 24 down to 12, because 105 crossed the threshold that puts WINDOW back on the page and WINDOW's cost came out of the one flex column. Widening a terminal must never narrow an address. The fix implemented below is to hold ACCOUNT at its comfort width while columns are added back one at a time, and to only let it grow once every optional column for the current table is already on the page — so crossing a column threshold can never claim width ACCOUNT already had.
type Model ¶
type Model struct {
Snap view.Snapshot
Set ColumnSet
Width int
Height int
Cursor int // index into Snap.Rows
Top int // first visible row, for the scrolling rung of the height ladder
Gauge progress.Model
Help help.Model
Keys KeyMap
// Pal is the colour of every role on this page: the chrome, the header
// line's labels, the table's cells through cellStyle, the gauge's fill and
// track per row, and the frame's border.
//
// It is a FIELD and not a package-level lookup because lipgloss v2 removed
// the global renderer -- a Style consults nothing about the terminal on its
// own -- so the background-darkness answer has to be threaded in from
// whoever asked the terminal for it. Two things ask, on two paths that
// cannot share one call: the event loop asks through a Cmd and refines this
// field when the reply arrives, and the one-shot render asks synchronously
// through DarkBackground. Both end here.
//
// Its zero value is the None palette and that is load-bearing rather than
// incidental: every role answers NoColor, Palette.Style hands back a style
// with no foreground SET, and the page emits no SGR byte at all -- which is
// what lets the seven golden pages under testdata be compared as bytes.
Pal theme.Palette
// Glyphs is the vocabulary this page draws with, chosen once per process.
Glyphs Glyphs
}
Model is the whole page as data. Body is pure: no Program, no clock, no filesystem and no terminal -- everything it draws was read by somebody else and handed in.
It was written with the claim that every field it would ever carry was already declared, and that claim is now spent: Pal and Glyphs arrived after it. They arrived for the reason the claim was made, though, which is the part worth keeping. A page cannot ask a terminal what it is able to draw -- asking means a console handle, an environment read, or a query written out and waited on -- so both answers travel in as data, resolved once by whoever built the Options, and the page stays a value that a test can compare as a string.
The rule the old sentence was protecting is therefore restated rather than dropped: a field here is a FACT THE PAGE WAS TOLD, never one it goes and finds. The event loop adds methods to this type; anything that has to be read off a machine is read by whoever builds an Options and arrives already answered.
func (Model) AfterLoad ¶
AfterLoad folds one Load result into the page.
A failed load KEEPS the previous snapshot and adds one notice. The two alternatives are both worse and both silent: emptying the table hides accounts that are still there and reads as "you have none", and leaving the previous numbers unlabelled presents a reading from before the failure as the current one. The notice is the label, and it is what makes keeping the numbers honest rather than stale.
A load that succeeds replaces the snapshot whole, which is what takes the notice away again — there is no separate clearing step to forget.
type Options ¶
type Options struct {
// Load is one complete read of the documents the dashboard renders. It
// takes the clock rather than reading it, so a caller can pin time.
//
// A failed Load is not fatal and must not empty the table — see
// Model.AfterLoad, which is the rule that says what happens instead.
Load func(now time.Time) (view.Snapshot, error)
// Exec runs one ccdad command through a FRESH cobra root. Every key that
// changes anything goes through here rather than calling an internal, so
// the scoped-session refusal, the wording and the exit contract all stay
// in one authority.
Exec view.Exec
// Now is the clock. It is a function value because nothing in this package
// may call time.Now itself.
Now func() time.Time
// Out is where the one-shot render writes.
Out io.Writer
// StderrTTY is whether stderr is a terminal, probed by package cli beside
// the two probes that already exist there. It gates the add key: the login
// writes every line of its prose to stderr, and bubbletea hands a released
// child os.Stderr rather than the Program's own output, so under a
// redirect the prompt would vanish while the dashboard sat blank.
StderrTTY bool
// CredentialHome is THIS process's own resolution of the Claude Code
// credential home, for the [D] screen to compare against the one the
// daemon published. A daemon started from a shell that resolved a
// different one manages that directory for the rest of its life and every
// other file on the machine looks normal; comparing the two is the only
// way anyone finds out.
//
// Empty is a legitimate value -- a caller that could not resolve one --
// and it omits the warning rather than guessing.
CredentialHome string
// SamePath reports whether two spellings name one directory.
//
// It is injected rather than called, and that is not ceremony. ccdad
// manufactures the two spellings of that path itself: daemon.ChildEnv pins
// an absolute, symlink-resolved one into every daemon it spawns, while a
// shell's own spelling comes back untouched, so a trailing slash or a
// symlink is enough to make two names for one directory. Answering it
// honestly therefore means asking the FILESYSTEM, which is exactly what
// nothing in this package may do. `doctor` asks the same question and
// reaches internal/credhome for the answer; package cli hands that same
// function down here.
//
// nil means the caller cannot compare paths, which omits the warning for
// the same reason an empty CredentialHome does.
SamePath func(a, b string) bool
// Theme is which palette the page paints with, AS CONFIGURED. theme.Auto is
// a legitimate value across this seam, and is in fact the one this field
// usually carries, since auto is the documented default.
//
// Auto is not resolved by the caller because it has two different answers
// in here rather than one. A live program asks by putting a background
// request into the batch its event loop already sends and handling the
// reply as a message, blocking for nothing. A one-shot render asks
// synchronously and pays the full price: raw mode on stdin, a request
// written to stdout, and up to FOUR seconds of waiting on a terminal that
// answers neither that request nor the identity one it falls back to -- the
// library runs the whole query twice, once per stdio end, two seconds a
// leg, whether or not the two ends are the same file. Those
// prices are only payable by whoever knows which path is running, and the
// caller building this struct does not: it builds one Options and hands it
// to whichever half the terminals turn out to justify.
//
// The ZERO Name is a different value from theme.Auto, and no caller that
// read a config file produces it. It means nobody said, and nobody-said
// paints nothing at all -- which is the answer this package's own
// internally constructed Models need, and the reason this field is a name
// rather than a Palette: a Palette has no spelling for "unset" that a test
// can compare, and a name does.
Theme theme.Name
// GlyphSet is which vocabulary the frame, the gauge and the state markers
// draw from, AS CONFIGURED: "unicode", "ascii" or "auto", and auto is the
// default, so auto is the ordinary case rather than the edge one.
//
// Two questions have to be answered to resolve it and only one of them
// belongs to the caller: whether this process's console can carry the
// bytes, which is ConsoleUTF8 below, and whether the width tables linked
// into THIS binary agree with the terminal about how wide those bytes are.
// The second is a property of the width engine this package draws through,
// read from an environment variable that engine interprets for itself, and
// a caller that pre-resolved auto would be deciding with half the evidence
// -- shipping a Unicode frame whose own measurements are wrong by two
// columns to precisely the users who configured for it.
//
// A spelling the picker does not recognise is treated as auto rather than
// refused. The config validator rejects it where it is written; a file
// edited by hand afterwards reaches a running dashboard, and a page that
// renders is worth more than a page that is right about a typo.
GlyphSet string
// ConsoleUTF8 is whether this process's console can carry UTF-8, probed by
// package cli beside the two terminal probes that already live there.
//
// It is the one appearance FACT this package genuinely cannot find out for
// itself, and the reason is Windows. There the answer is the output code
// page of the console this PROCESS is attached to -- a property of the
// process, read through a call that takes no handle at all -- so there is
// no writer in here to interrogate and no descriptor to hand to anything.
// On the interactive path there is not even a writer to try, because
// bubbletea owns the terminal. Everywhere else the answer is yes, and a
// package that answered "yes, unless Windows" would be making a syscall's
// decision from a build tag.
//
// It reports a capability and never an outcome. A console that answers
// UTF-8 may still draw boxes -- a legacy console with a raster font does
// exactly that, whatever its code page says -- which is why an explicit
// GlyphSet overrules this in both directions, and why nothing downstream
// may read a true value as a promise that a glyph appeared.
//
// false is the safe answer and false is the zero value, so a caller that
// fills in nothing gets ASCII rather than mojibake. That safety is also why
// this field cannot be checked for presence: package cli's test asks it
// twice, once with each answer, because one row alone cannot tell a wired
// field from an unwired one.
ConsoleUTF8 bool
}
Options is everything package cli injects. Nothing in package tui reads the environment, the clock or the filesystem except through one of these — which is what makes the whole page a pure function of data somebody else read, and therefore what makes every visual assertion in this package a string comparison rather than a pty.
The fields are declared here in full, once, even though the two-shot render below uses only three of them: the event loop that arrives later adds METHODS to Model and reads the rest of these, and a field added to a struct three files already read is a merge conflict in the one place this package cannot afford one.
The appearance trio -- Theme, GlyphSet and ConsoleUTF8 -- is the first group here that carries an UNRESOLVED value, and the distinction it draws is worth stating plainly, because the paragraph above is easy to over-read. What a caller may not do is READ for this package; what this package may not do is read for itself. Neither of those forbids this package from DECIDING. "auto" is a decision, not a read. The two facts it is decided from -- what the file said, and what this process's console is -- are reads, which is why those arrive through here and the decision does not.
Resolving the pair in package cli instead would cost two things that no later commit could get back. The width-engine fallback -- the arm that answers ascii for a terminal whose width tables have been switched to the east-asian ambiguous widths -- lives in this package's glyph picker and nowhere else, so a caller that collapsed "auto" to a set name first would leave that arm unreachable in every shipping binary while its own tests went on passing. And the background-colour question is answered on two different paths in here: by the event loop for a live program, as a message the terminal sends back in its own time, and by the one-shot render for a redirected one, synchronously and at a price. A caller that answered it once, before it knows which of the two paths it is about to take, necessarily answers it on the wrong one.