rinkaku_tui/lib.rs
1//! rinkaku's interactive terminal UI (ADR 0015/0016).
2//!
3//! Two layers, kept deliberately separate:
4//!
5//! - **View-models** (`tree`, `nav`, `order`, `detail`, `app`, `row_view`):
6//! plain data and pure functions/state machines derived from
7//! [`rinkaku_core::render::Report`]. `tree`/`nav`/`order`/`detail` carry
8//! no `ratatui`/`crossterm` types at all (ADR 0016 decision 3). `app`
9//! and `row_view` are the stage B additions that compose those
10//! view-models into one navigable state machine and format its rows —
11//! `row_view` uses `ratatui::text`/`style` types (`Line`/`Span`/`Style`),
12//! which are plain, comparable data rather than a live `Frame`/
13//! `Terminal`, so building one from a row stays a pure, unit-testable
14//! transformation. `app` stays entirely free of `ratatui`/`crossterm`
15//! types, translating real key events at the boundary instead (see
16//! `run`'s event loop).
17//! - **Terminal adapter** (`ui`, `source`, [`run`]): draws `App`'s state
18//! with `ratatui`, reads source files for the drill-down view, and owns
19//! the terminal lifecycle (raw mode, alternate screen, the event loop).
20//! This is the only layer that performs IO or holds a live `Terminal`.
21//! [`event_loop::run_app`]'s own event loop delegates responsibilities to
22//! sibling modules (ADR 0028, split out once this crate's event-loop code
23//! grew past the file-size threshold): `input_translate` (raw `crossterm`
24//! events → [`app::InputKey`]) and `review_flow` (ADR 0048's review-annotations
25//! composing/exporting/caching glue).
26//!
27//! [`run`] is the crate's single public entry point for the CLI binary:
28//! `rinkaku`'s `main.rs` hands it a [`rinkaku_core::render::Report`] once
29//! `--tui` is passed, in place of rendering Markdown/JSON. It also hands in
30//! the raw unified diff text `main.rs` already has in hand for every input
31//! mode (stdin / `--base` / `--pr`) — TUI iteration 2's diff pane
32//! (`d`/`D`, `crate::diff_view`) slices hunks straight out of that same
33//! string rather than reconstructing a diff from `Report` (which no longer
34//! carries hunk text once extraction has run).
35
36// ADR 0055: the `?` help overlay's translations, compiled in from
37// `locales/{en,ja}.yml` at build time. English is this macro's fallback,
38// matching this project's fixed English default.
39rust_i18n::i18n!("locales", fallback = "en");
40
41pub mod annotation_markers;
42pub mod app;
43pub mod blast_radius;
44pub mod detail;
45pub mod diff_shape;
46pub mod diff_view;
47mod event_loop;
48pub mod help;
49pub mod highlight;
50mod input_translate;
51pub mod locale;
52pub mod nav;
53pub mod order;
54pub mod review;
55mod review_flow;
56pub mod row_view;
57pub mod search;
58mod session;
59pub mod source;
60pub mod source_diff;
61pub mod source_split;
62pub mod splash;
63mod split_pairing;
64pub mod stack;
65mod stack_driver;
66pub mod tips;
67pub mod tree;
68pub mod ui;
69
70pub use event_loop::ReviewPorts;
71pub use session::{TuiSession, run};
72
73pub(crate) use event_loop::run_app;