Skip to content

Commit f10f82f

Browse files
cursoragentechobt
andcommitted
fix(tui): split hero scenes out of lock_boards
Move HeroScene/paint_hero into readme_hero_boards so lock_boards stays under its main-line count and the source-policy gate stops regressing. Banner-green focus is unchanged. Co-authored-by: Mathis <echobt@users.noreply.github.com>
1 parent 870be41 commit f10f82f

4 files changed

Lines changed: 71 additions & 50 deletions

File tree

src/cortex-tui/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ pub mod lock_boards;
104104
pub mod lock_proof;
105105
pub mod lock_v2;
106106
pub mod readme_hero;
107+
pub mod readme_hero_boards;
107108

108109
// Backtracking system for conversation history navigation
109110
pub mod backtrack;

src/cortex-tui/src/lock_boards.rs

Lines changed: 24 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -822,58 +822,34 @@ fn paint_launch_header(area: Rect, buf: &mut Buffer, full: bool) -> u16 {
822822
// Boards 01–10
823823
// ---------------------------------------------------------------------------
824824

825+
fn paint_splash_chrome(area: Rect, buf: &mut Buffer, composer: Composer<'_>) {
826+
let y = paint_launch_header(area, buf, true);
827+
paint_composer(area, buf, y, composer);
828+
paint_footer(area, buf, &format!("{MODEL} · Agent · 100% context"));
829+
}
830+
825831
fn board_splash(area: Rect, buf: &mut Buffer) {
826-
paint_hero(area, buf, HeroScene::Splash);
832+
paint_splash_chrome(area, buf, Composer::Ghost(GHOST_IDLE));
827833
}
828834

829835
fn board_typing(area: Rect, buf: &mut Buffer) {
830-
paint_hero(area, buf, HeroScene::Typing(USER_PROMPT));
831-
}
832-
833-
/// README hero beat: signed splash, typing, working, then local command boards.
834-
#[derive(Debug, Clone, Copy)]
835-
pub enum HeroScene<'a> {
836-
/// Dual-hairline splash with the idle placeholder.
837-
Splash,
838-
/// Splash chrome with `text` in the composer (partial or full prompt).
839-
Typing(&'a str),
840-
/// Submitted prompt plus the working indicator.
841-
Working,
842-
/// Slash palette (`/` typed) — local commands, not a cloud handoff.
843-
Palette,
844-
/// `/model` picker with effort radios.
845-
Model,
846-
/// Live Shell tool row (`✓` mint on passing tests).
847-
Shell,
848-
/// Back to the idle composer after the first user turn (no welcome card).
849-
Composer,
850-
}
851-
852-
/// Paint one README-hero / lock frame from the signed chrome.
853-
pub fn paint_hero(area: Rect, buf: &mut Buffer, scene: HeroScene<'_>) {
854-
match scene {
855-
HeroScene::Splash => {
856-
let y = paint_launch_header(area, buf, true);
857-
paint_composer(area, buf, y, Composer::Ghost(GHOST_IDLE));
858-
paint_footer(area, buf, &format!("{MODEL} · Agent · 100% context"));
859-
}
860-
HeroScene::Typing(text) => {
861-
let y = paint_launch_header(area, buf, true);
862-
paint_composer(area, buf, y, Composer::Typed(text));
863-
paint_footer(area, buf, &format!("{MODEL} · Agent · 100% context"));
864-
}
865-
HeroScene::Working => board_working(area, buf),
866-
HeroScene::Palette => board_palette(area, buf),
867-
HeroScene::Model => board_model_full(area, buf),
868-
HeroScene::Shell => board_shell(area, buf),
869-
HeroScene::Composer => paint_session(
870-
area,
871-
buf,
872-
user_prompt_lines(area),
873-
&format!("{MODEL} · Agent · 92% context"),
874-
GHOST_IDLE,
875-
),
876-
}
836+
paint_splash_chrome(area, buf, Composer::Typed(USER_PROMPT));
837+
}
838+
839+
/// README hero typing frames use a partial prompt; lock board 02 uses the full one.
840+
pub(crate) fn paint_typed_splash(area: Rect, buf: &mut Buffer, text: &str) {
841+
paint_splash_chrome(area, buf, Composer::Typed(text));
842+
}
843+
844+
/// README hero return-to-composer beat: past user turn + idle ghost, no splash.
845+
pub(crate) fn paint_hero_composer(area: Rect, buf: &mut Buffer) {
846+
paint_session(
847+
area,
848+
buf,
849+
user_prompt_lines(area),
850+
&format!("{MODEL} · Agent · 92% context"),
851+
GHOST_IDLE,
852+
);
877853
}
878854

879855
const PALETTE_ROWS: &[(&str, &str)] = &[

src/cortex-tui/src/readme_hero.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ use cortex_tui_capture::{
1212
};
1313
use ratatui::widgets::Clear;
1414

15-
use crate::lock_boards::{self, HeroScene, USER_PROMPT};
15+
use crate::lock_boards::USER_PROMPT;
16+
use crate::readme_hero_boards::{self, HeroScene};
1617

1718
/// The prompt the hero types — same copy as the typing lock board.
1819
pub const HERO_PROMPT: &str = USER_PROMPT;
@@ -32,7 +33,7 @@ fn paint_beat(scene: HeroScene<'_>) -> impl FnOnce(&mut ratatui::Frame<'_>) + '_
3233
move |frame| {
3334
let area = frame.area();
3435
frame.render_widget(Clear, area);
35-
lock_boards::paint_hero(area, frame.buffer_mut(), scene);
36+
readme_hero_boards::paint_hero(area, frame.buffer_mut(), scene);
3637
}
3738
}
3839

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
//! README hero scene dispatch. Split out of [`crate::lock_boards`] so the
2+
//! storyboard can grow without pushing that file past the source-policy
3+
//! line-count gate.
4+
//!
5+
//! Painting stays on the signed lock chrome (banner-green focus). This
6+
//! module does not restyle anything.
7+
8+
use ratatui::buffer::Buffer;
9+
use ratatui::layout::Rect;
10+
11+
use crate::lock_boards;
12+
13+
/// README hero beat: signed splash, typing, working, then local command boards.
14+
#[derive(Debug, Clone, Copy)]
15+
pub enum HeroScene<'a> {
16+
/// Dual-hairline splash with the idle placeholder.
17+
Splash,
18+
/// Splash chrome with `text` in the composer (partial or full prompt).
19+
Typing(&'a str),
20+
/// Submitted prompt plus the working indicator.
21+
Working,
22+
/// Slash palette (`/` typed) — local commands, not a cloud handoff.
23+
Palette,
24+
/// `/model` picker with effort radios.
25+
Model,
26+
/// Live Shell tool row (`✓` mint on passing tests).
27+
Shell,
28+
/// Back to the idle composer after the first user turn (no welcome card).
29+
Composer,
30+
}
31+
32+
/// Paint one README-hero / lock frame from the signed chrome.
33+
pub fn paint_hero(area: Rect, buf: &mut Buffer, scene: HeroScene<'_>) {
34+
match scene {
35+
HeroScene::Splash => lock_boards::render_lock_board("splash", area, buf),
36+
HeroScene::Typing(text) => lock_boards::paint_typed_splash(area, buf, text),
37+
HeroScene::Working => lock_boards::render_lock_board("working", area, buf),
38+
HeroScene::Palette => lock_boards::render_lock_board("palette", area, buf),
39+
HeroScene::Model => lock_boards::render_lock_board("model_full", area, buf),
40+
HeroScene::Shell => lock_boards::render_lock_board("shell", area, buf),
41+
HeroScene::Composer => lock_boards::paint_hero_composer(area, buf),
42+
}
43+
}

0 commit comments

Comments
 (0)