Skip to content

cast(phase 4): redesign plan + outcome cards against visual contract#97

Merged
BunsDev merged 2 commits into
cast/phase-3-design-implementationfrom
cast/phase-4-plan-outcome-cards
May 20, 2026
Merged

cast(phase 4): redesign plan + outcome cards against visual contract#97
BunsDev merged 2 commits into
cast/phase-3-design-implementationfrom
cast/phase-4-plan-outcome-cards

Conversation

@BunsDev
Copy link
Copy Markdown
Member

@BunsDev BunsDev commented May 19, 2026

Summary

  • Redesign the Cast plan and outcome cards against docs/design/cast-tui-contract.md so 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.
  • Execution semantics are unchanged. Planner output, safety classification, and gate behavior are untouched; only the renderer (and a couple of theme tokens it leans on) moved.
  • Add BORDER_SUBTLE / BORDER_STRONG semantic tokens so future single-rule separators have a brand-aligned color, mirroring the existing --oc-border-subtle / --oc-border-strong CSS variables.

What changed in the cards

  • 14-char label column shared across both cards (spell, harness, session, intent, risk, launched, next)
  • Fixed-width 10-char ALL-CAPS risk chips, colored by severity:
    • [ SAFE ]PRIMARY_STRONG
    • [CONFIRM ]PRIMARY
    • [ REJECT ]DANGER
  • Risk reason rendered as a quiet continuation row indented to the value column — no leading ! or X glyphs (the chip carries the semantic)
  • Numbered step list capped at four visible (was unbounded)
  • intent row falls back from harness when none applies, so system actions still answer "what did Cast understand?"
  • Footer hint adapts to risk + intent:
    • safe → press enter to cast · esc cancels
    • confirm → review the risk note · y/N to confirm · esc cancels
    • sacrifice → type sacrifice to confirm · esc cancels
    • reject → Cast will not run this · type to reframe
  • Outcome notes use a · middle-dot bullet, capped at three visible

Sample (plain / non-color)

Cast plan
spell           git push the changes to main
harness         Codex · Cast default
risk            [CONFIRM ]
                spell mentions publishing, pushing, merging, or releasing

Steps
  1.  launch     Launch Codex inside this project with the spell as the task
  2.  inform     Risk: ... Cast will route this ...

review the risk note · y/N to confirm · esc cancels
Cast outcome
spell           fix the failing tests
launched        Codex session (project-scoped) via daemon
session         abcdef-1234

Notes
  ·  Session finished: status `clean`, exit code 0

next            Run `coven attach abcdef-1234` to revisit

Test plan

  • cargo test -p coven-cli tui::cast → 90/90 pass (includes 16 new render tests)
  • Phase-1 main.rs tests called out in the goal (lines 1235 / 1251 / 1262) all pass
  • Pre-existing failing magical_tui_frame_* tests untouched by this PR — they belong to the launcher rebrand work in progress on the parent branch
  • New tests cover: section headers, 14-char label column for every key field, each risk chip, harness-source copy (Cast 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

Copilot AI review requested due to automatic review settings May 19, 2026 16:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_STRONG theme tokens and extend drift tests to keep them aligned with brand/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_row renders step notes without any width management. A long note will 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_row prints note verbatim; 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.

Comment thread crates/coven-cli/src/tui/cast/render.rs Outdated
@BunsDev BunsDev force-pushed the cast/phase-3-design-implementation branch from 56df8a0 to 185d7c9 Compare May 20, 2026 08:54
@BunsDev BunsDev force-pushed the cast/phase-4-plan-outcome-cards branch from 5fc6c01 to 1727b35 Compare May 20, 2026 08:55
@BunsDev BunsDev force-pushed the cast/phase-3-design-implementation branch from 185d7c9 to 5885b60 Compare May 20, 2026 08:58
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>
@BunsDev BunsDev force-pushed the cast/phase-4-plan-outcome-cards branch from 1727b35 to 94463ff Compare May 20, 2026 08:58
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@BunsDev BunsDev merged commit 31a3e46 into cast/phase-3-design-implementation May 20, 2026
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants