cast(phase 4): redesign plan + outcome cards against visual contract#97
Merged
BunsDev merged 2 commits intoMay 20, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Coven CLI’s Cast TUI rendering to match the Phase 1 visual contract by redesigning the plan and outcome cards (layout, labels, chips, and capped lists) while keeping execution/planning semantics unchanged, and adds semantic theme tokens for subtle/strong borders aligned to the brand CSS variables.
Changes:
- Redesign Cast plan/outcome card rendering to use a shared 14-char label column, fixed-width risk chips, continuation rows for risk reasons, and capped step/note lists.
- Add new helpers + expanded render tests to validate layout, chip coloring, and ANSI-free plain output.
- Introduce
BORDER_SUBTLE/BORDER_STRONGtheme tokens and extend drift tests to keep them aligned withbrand/ui/color-tokens.css.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| crates/coven-cli/src/tui/cast/render.rs | Reworks plan/outcome card rendering and updates/adds tests for the new visual contract. |
| crates/coven-cli/src/theme.rs | Adds semantic border tokens and extends theme drift/unit tests to enforce alignment with CSS variables. |
Comments suppressed due to low confidence (2)
crates/coven-cli/src/tui/cast/render.rs:304
push_step_rowrenders step notes without any width management. A longnotewill wrap at the terminal edge and misalign subsequent visual columns, conflicting with the Cast TUI contract’s wrapping rule and the new fixed-column layout. Consider wrapping/truncating the note to the same max inner width as label rows and indenting wrapped lines to the note column.
fn push_step_row(frame: &mut String, p: &Palette, index: usize, kind: CastStepKind, note: &str) {
let kind_block = format!("{:<9}", step_kind_label(kind));
frame.push_str(&format!(
" {}{}.{} {}{}{} {}{}{}\n",
p.field_label, index, p.reset, p.primary, kind_block, p.reset, p.text, note, p.reset,
crates/coven-cli/src/tui/cast/render.rs:311
push_note_rowprintsnoteverbatim; long notes will terminal-wrap back to column 0, losing the intended indentation under the Notes section. Consider applying the same max-width wrapping/truncation approach used for other rows (and indent wrapped lines under the note text after the·bullet).
fn push_note_row(frame: &mut String, p: &Palette, note: &str) {
frame.push_str(&format!(" {}·{} {}{}{}\n", p.primary, p.reset, p.text, note, p.reset));
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
56df8a0 to
185d7c9
Compare
5fc6c01 to
1727b35
Compare
185d7c9 to
5885b60
Compare
Plan/outcome cards now follow the Phase 1 TUI visual contract: a 14-char label column, fixed-width ALL-CAPS risk chips ([ SAFE ] / [CONFIRM ] / [ REJECT ]) colored by severity, noun-first risk reasons as continuation rows (no `!`/`X` glyphs), numbered step list capped at four, and a risk-aware footer hint. Sacrifice plans now ask for the typed `sacrifice` word in the footer; rejected plans steer the user to reframe. Execution semantics are unchanged: planner output, safety classification, and gate behavior are untouched — only the renderer (and the theme tokens the renderer leans on) moved. Also adds `BORDER_SUBTLE` / `BORDER_STRONG` semantic tokens so future single-rule separators have a brand-aligned color, mirroring the `--oc-border-subtle` / `--oc-border-strong` CSS variables. Tests assert key labels, every risk chip, harness-source copy (`Cast default` / `user-chosen`), the typed-confirm footer for sacrifice, the intent-row fallback for system actions, step/note caps, and that plain output never leaks an ANSI escape across any risk state. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1727b35 to
94463ff
Compare
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
31a3e46
into
cast/phase-3-design-implementation
1 of 3 checks passed
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.
Summary
docs/design/cast-tui-contract.mdso the agent-handoff moment looks trustworthy: what Cast understood, which harness it picked, why, risk level, next step, and how to rejoin — all at a glance.BORDER_SUBTLE/BORDER_STRONGsemantic tokens so future single-rule separators have a brand-aligned color, mirroring the existing--oc-border-subtle/--oc-border-strongCSS variables.What changed in the cards
spell,harness,session,intent,risk,launched,next)[ SAFE ]—PRIMARY_STRONG[CONFIRM ]—PRIMARY[ REJECT ]—DANGER!orXglyphs (the chip carries the semantic)intentrow falls back fromharnesswhen none applies, so system actions still answer "what did Cast understand?"press enter to cast · esc cancelsreview the risk note · y/N to confirm · esc cancelstype sacrifice to confirm · esc cancelsCast will not run this · type to reframe·middle-dot bullet, capped at three visibleSample (plain / non-color)
Test plan
cargo test -p coven-cli tui::cast→ 90/90 pass (includes 16 new render tests)magical_tui_frame_*tests untouched by this PR — they belong to the launcher rebrand work in progress on the parent branchCast default/user-chosen), session-id row, intent-row fallback for system actions, sacrifice typed-confirm footer, step-list cap (4), note cap (3), ANSI-clean plain output across six representative risk states, and severity-tinted chip escapes in TrueColor mode🤖 Generated with Claude Code