docs(spec): the engine renders — palette, tables, trees, drawings, width - #148
docs(spec): the engine renders — palette, tables, trees, drawings, width#148wmadden-electric wants to merge 2 commits into
Conversation
Ui gains semantic verbs and Presentations.stdout receives it, so a rich renderer can carry meaning in colour. The engine owns the tone-to-colour mapping and the enabled resolution; colour off makes the verbs identity functions. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
|
Warning Review limit reached
Next review available in: 52 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
commit: |
Fix the common renderer rather than hand commands a canvas: table aligns, tree draws connectors and glyphs, drawing is the escape hatch for layout the engine cannot derive. One consolidated palette carried by spans, so handlers never emit escapes and colour cannot break alignment. Width comes from the stream being printed to. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io>
|
Superseded by #153, which carries this spec plus the implementation. The spec landed there with four amendments, all from surveying what prisma/prisma and prisma/composer already ship rather than deciding by taste — six indexed colours instead of eight (the ORM's lane rotation is six and deliberately excludes red), Closing this one so the spec does not merge ahead of the code that implements it. |
What is broken
The engine ships a common renderer that does almost no rendering.
That is
renderBlockdoingcolumns.join(" ")— no sizing, no padding. Thetreeblock emits two-space indents with no connectors and has zero users.makeUiemits exactly two escape sequences, bold and dim, so the entire v8 CLI is unstyled. AndOutputStreamis{ write(text) }, so the engine cannot learn the terminal width even from the bin.Both consumers have already lost rendering to this. The platform port flattened
auth workspace list,project listandagent statusfrom aligned rail-and-card renderings, recorded as accepted divergences. The ORM's renderers ship colourless, and two of them callcreateColors({ useColor: true })to force colour pastNO_COLORbecause there is no other way to get any.The decision
The engine renders; a command describes. This fixes the renderer rather than giving commands an open canvas:
tablealigns — the engine sizes columns to content and pads. That alone restores every flattened platform table.treedraws connectors and status glyphs —├─ ✘ table user, as the style guide has specified all along.drawingis added as the escape hatch for layout the engine cannot derive — the migration DAG's lane gutter, where lane assignment comes from a BFS over the graph and one hue must reach the gutter cell, the node glyph and the label alike.color-3for a branch lane and never learns what colour that is.Text = string | Span[]everywhere a block takes display text. Spans carry tone, never escape sequences, so the engine measures on text and colour cannot break alignment — the pad-versus-colour trap in shipped code becomes unrepresentable.ui.widthis the width of the stream being printed to, unbounded when that is not a terminal. Only the command knows what to sacrifice, so it is told the room it has; if it overruns anyway the engine prints it unmodified.Two corrections ride along. Colour resolution currently keys off stdout while blocks render to stderr, so
cmd > filedisables colour for output a human is watching — it now follows the printing stream. And with the palette engine-owned there is no per-renderer colour switch left, so theNO_COLORbypass disappears by construction.What this PR is
The implementation spec only —
.drive/projects/prisma-cli-v8/specs/engine-colour.md— for handoff to an implementer. Its vocabulary and its list of what draws come from surveying both CLIs' renderers, not from taste.Alternatives considered
A separate
graphicpresenter alongsidehuman— rejected: a drawing is human output, so it belongs in the human channel's grammar, and a parallel presenter would need its own channel and colour handling.Routing rich renderings through
Presentations.stdout— rejected: that is the machine channel, and a drawing's consumer is a human.Letting commands draw tables and trees themselves — rejected: if every command reimplements every form of rendering on an open canvas, the common renderer has no purpose.
🤖 Generated with Claude Code