Skip to content

cast: phase 3 — design implementation (Cast rebrand + theming)#96

Closed
BunsDev wants to merge 11 commits into
mainfrom
cast/phase-3-design-implementation
Closed

cast: phase 3 — design implementation (Cast rebrand + theming)#96
BunsDev wants to merge 11 commits into
mainfrom
cast/phase-3-design-implementation

Conversation

@BunsDev
Copy link
Copy Markdown
Member

@BunsDev BunsDev commented May 19, 2026

Summary

  • Rebrand TUI launcher from "Coven" to Cast, refactoring the theming layer around the Phase 1 visual contract (PRIMARY_STRONG palette, chip system, 14-char field column).
  • Phase 2 carries over: Cast-native attach using a follower-backed transcript so the launcher view stays consistent with the live session.
  • Perf: skip the full event-log scan when checking for cast.summary existence.

Stack

Builds on:

Next: Phase 4 will pick up from here.

Test plan

  • cargo build -p coven-cli succeeds
  • cargo test -p coven-cli passes
  • Launch the TUI; confirm new "Cast" launcher chrome renders per the contract (chip colors, primary strong, no legacy +---+ ASCII chrome)
  • Attach to a live session; confirm the follower-backed transcript stays in sync
  • Verify cast.summary existence check no longer scans the full event log

🤖 Generated with Claude Code

PR #93 already shipped the Cast event follower, transcript renderer, exit
summary, `cast.summary` event writer, and stdin forwarding for *newly
launched* sessions. The remaining Phase 2 gap was `/attach` and `/summon`:
those still routed through the legacy `attach_session` loop in main.rs,
which uses a HashSet<String> for dedup and reads from the SQLite store
directly — bypassing the daemon's `/events` endpoint and `afterSeq` cursor.

This commit closes the gap.

New `cast/attach.rs`:
- `CastAttachSummary` + `find_cast_summary` decode the most recent
  `cast.summary` event from a session's history so the attach outcome can
  describe what the prior run did.
- `summary_already_recorded` lets the launch-side writer skip a duplicate
  summary when attach replays existing events through the same follower.
- `format_summary_note` renders the decoded summary as a one-line outcome
  card note (status, exit code, harness, request — truncated to 60 chars).

`shell.rs` wiring:
- New `attach_via_cast` dispatcher: live sessions stream through
  `follow_until_exit` with the same `afterSeq` cursor as launches and accept
  stdin forwarding; completed sessions replay the full event log through
  the same `TranscriptObserver` so the user sees the transcript shape they'd
  see at original launch, then surface the prior `cast.summary` in the
  outcome.
- Falls back to the legacy `attach_session` loop when the daemon isn't
  running, with an outcome note explaining the fallback.
- `write_cast_summary_event` is now idempotent — guards against double-logging
  when an attach replay reaches the exit event a second time.
- New `AttachOrigin` enum distinguishes `/attach` from `/summon` in the
  outcome card's `launched` label.

`main.rs`:
- Extract `summon_only_command` from `summon_session_command` so Cast can
  un-archive without dragging in the legacy attach loop. The top-level
  `coven summon` CLI behaviour is unchanged.

Tests: 14 new (11 in `cast::attach`, 3 in `shell::attach_tests` covering
AttachOrigin labels and `replay_completed_session` over a stub client).
Total: 275 unit + 4 smoke tests pass. cargo fmt clean, clippy clean,
diff --check clean. Non-interactive `coven` smoke renders the Cast frame
and exits 0.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 19, 2026 16:17
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

Rebrands the TUI launcher from "Coven" to "Cast", consolidates theming/width helpers into theme.rs, makes the Cast-native attach path stream live and replay completed sessions through the shared follower, and avoids re-writing the cast.summary event on replay.

Changes:

  • Cast-native attach: attach_via_cast routes live sessions through follow_until_exit (with stdin forwarding) and completed sessions through a full event-log replay, with a legacy attach_session fallback when the daemon is not running.
  • Theming consolidation: new semantic tokens (TEXT, TEXT_DIM, BORDER_DIM, BACKDROP, SCROLL_TRACK), Status enum + status_style, shared Palette, and a single theme::fit_chars reused by tui/sessions.rs and tui/cast/render.rs.
  • Idempotent summary + perf fix: store::event_kind_exists short-circuits the duplicate write of cast.summary; summon_session_command is split so Cast can summon then re-enter via its own follower.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
crates/coven-cli/src/tui/shell.rs Cast-native attach dispatcher (attach_via_cast, attach_via_daemon, replay_completed_session), idempotent summary write, plus attach unit tests.
crates/coven-cli/src/tui/sessions.rs Drops local fit_chars, imports the shared one from theme.
crates/coven-cli/src/tui/chat/render.rs Replaces raw Color::* usages with new semantic theme tokens / status_style.
crates/coven-cli/src/tui/cast/render.rs Drops local fit_chars, reuses theme::fit_chars.
crates/coven-cli/src/tui/cast/mod.rs Adds attach submodule and re-exports find_cast_summary / format_summary_note.
crates/coven-cli/src/tui/cast/attach.rs New module decoding cast.summary events and formatting outcome-card notes, with tests.
crates/coven-cli/src/theme.rs New semantic tokens, Status enum, palette/palette_for, shared fit_chars, additional brand surfaces, expanded tests.
crates/coven-cli/src/store.rs Adds event_kind_exists with test for cheap existence check.
crates/coven-cli/src/main.rs Splits summon_session_command into summon_only_command + attach; updates launcher tests for the new Cast frame contract.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/coven-cli/src/tui/shell.rs Outdated
@BunsDev
Copy link
Copy Markdown
Member Author

BunsDev commented May 19, 2026

@copilot apply changes based on the comments in this thread

Copy link
Copy Markdown
Contributor

Copilot AI commented May 19, 2026

@copilot apply changes based on the comments in this thread

Implemented in 56df8a0. I applied the review-thread change by removing the redundant full-history fetch for completed-session attach: replay now derives both exit and cast.summary note from the same list_events result, and I added a regression test to assert the summary note is surfaced with a single fetch.

BunsDev and others added 4 commits May 20, 2026 03:54
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Defines the sleek-minimalist Cast Codes target so Phase 2 has rules to
implement against: surfaces in scope, the 14-char field column,
hierarchy order, color roles re-anchored on PRIMARY_STRONG (#9A8ECD),
the chip system for risk states, copy tone, and twelve explicit
anti-patterns lifted from the current launcher (workspace map graph,
fake task inbox, +---+ ASCII chrome, repeated brand voice, Store
footer, etc.). Ends with the file seam Phase 2 will edit and a
done-when checklist.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@BunsDev BunsDev force-pushed the cast/phase-3-design-implementation branch from 56df8a0 to 185d7c9 Compare May 20, 2026 08:54
BunsDev and others added 5 commits May 20, 2026 03:58
Defines the sleek-minimalist Cast Codes target so Phase 2 has rules to
implement against: surfaces in scope, the 14-char field column,
hierarchy order, color roles re-anchored on PRIMARY_STRONG (#9A8ECD),
the chip system for risk states, copy tone, and twelve explicit
anti-patterns lifted from the current launcher (workspace map graph,
fake task inbox, +---+ ASCII chrome, repeated brand voice, Store
footer, etc.). Ends with the file seam Phase 2 will edit and a
done-when checklist.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Rework the launcher and theming across the TUI: replace the old "CovenCLI" identity with "Cast" and update tests to match the new wording and layout. Add several new theme tokens and helpers (SURFACE_0, SURFACE_3, BACKDROP, TEXT, TEXT_DIM, BORDER_DIM, SCROLL_TRACK), a Status semantic with status_token/status_style, a Palette helper, and a reusable fit_chars utility with tests. Remove duplicated fit_chars implementations and import theme::fit_chars where needed. Refactor cast renderer to use a LauncherSnapshot model and a two-column command+snapshot layout, introduce new rendering helpers (push_line, push_snapshot_row, render_paired_line, launcher_command_window, RowCell), use the U+203A selection marker, and simplify prompt/footer/preview rendering. Update chat renderers to use the new theme tokens (text, dim, border, scroll track, status_style) and replace ad-hoc color choices with semantic tokens. Adjust sessions and shell code to consume the shared utilities.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Agent-Logs-Url: https://github.com/OpenCoven/coven/sessions/ee483c99-c397-444d-9a21-212193e94880

Co-authored-by: BunsDev <68980965+BunsDev@users.noreply.github.com>
@BunsDev BunsDev force-pushed the cast/phase-3-design-implementation branch from 185d7c9 to 5885b60 Compare May 20, 2026 08:58
…97)

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

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.
Copy link
Copy Markdown
Member Author

@BunsDev BunsDev left a comment

Choose a reason for hiding this comment

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

Comprehensive review — PR #96 (cast: phase 3 — design implementation)

Verdict: comment / recommend close as superseded.

Status

This PR has been overtaken by main. Every commit on the branch has either landed on main via a different PR or is functionally identical to what main now contains:

Commit Status on main
`722ad39` cast phase 2 attach merged via #95 (`dc81bf0`)
`73f85a1` rebrand to Cast / theming merged as part of #99 (`48b60f3`)
`6da4907` / `07fd742` Phase 1 contract docs merged via #94 (`2a6e785`)
`de0b0dd` perf: skip full event-log scan merged via #99
Various "Potential fix for pull request finding" automation commits not needed

The mergeable status is DIRTY because the squash-merges on main rewrote the same content into single commits, so git can't reconcile the divergent histories.

Review threads

1 thread — already resolved. It flagged a duplicate `list_events` fetch for the `cast.summary` lookup. That concern was independently addressed by `de0b0dd perf: avoid full event log scan for cast.summary existence check`, which is now on main.

Code quality (for the historical record)

The Phase 3 launcher rebrand + theming work was solid (and is what eventually shipped through #99). Notable choices worth carrying forward: the `Palette` helper to avoid per-callsite `Fg::with_mode` repetition, the `fit_chars` consolidation in `theme.rs`, and the U+203A selection marker. All of those are now on main.

Recommendation

Close as superseded. The work has all shipped; keeping this PR open just adds noise to the queue. No data loss — the commits are preserved on main with attribution via the squash-merged PRs.

@BunsDev
Copy link
Copy Markdown
Member Author

BunsDev commented May 20, 2026

Closing as superseded.

Every commit on this branch has shipped on main via squash merges of #94, #95, and #99 (2a6e785, dc81bf0, 48b60f3). The single review thread on this PR was already resolved (the duplicate list_events fetch concern was addressed in de0b0dd perf: avoid full event log scan for cast.summary existence check on main).

The DIRTY merge status is purely a histories-diverge artifact of the squash merges, not unmerged content.

@BunsDev BunsDev closed this May 20, 2026
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.

3 participants