mod tui#

module tui#

Interactive terminal UI for browsing and gating the canned-response corpus.

Launch with canonic tui. Pure state helpers are unit-tested with ratatui::backend::TestBackend; the live loop uses crossterm.

Functions

fn load_focusing(corpus: PathBuf, focus_path: Option<&Path>) -> Result<App>#

Open path as a single-file corpus view (load parent dir, select that id).

fn load_focusing_with_prefix(corpus: PathBuf, focus_path: Option<&Path>, prefix: &str) -> Result<App>#

Like load_focusing with an explicit shared prefix.

fn render_test_frame(app: &mut App, width: u16, height: u16) -> Result<String>#

Render one frame to a test backend (for structural UI tests).

fn run_tui(corpus: PathBuf) -> Result<()>#

Run the interactive TUI until the user quits.

fn run_tui_with_prefix(corpus: PathBuf, prefix: &str) -> Result<()>#

Enums

enum Focus#

Which pane / modal is focused.

List#
Filter#
Help#

Structs and Unions

struct App#

Application state for the corpus browser (testable without a real terminal).

corpus: PathBuf#
prefix: String#

Shared library prefix from canonic.toml / –prefix.

responses: Vec<CannedResponse>#
entries: Vec<ListEntry>#
list_state: ListState#
filter: String#
focus: Focus#
status: String#
preview: String#
side_panel: String#
should_quit: bool#
scroll: u16#

Implementations

impl App#

Functions

fn handle_key(&mut self, code: KeyCode, modifiers: KeyModifiers) -> Result<()>#

Handle a key press. Returns Ok after mutating state.

fn load(corpus: PathBuf) -> Result<Self>#

Load corpus from disk and build initial list + selection.

fn load_with_prefix(corpus: PathBuf, prefix: &str) -> Result<Self>#

Load corpus using an explicit shared prefix for quality checks.

fn rebuild_entries(&mut self)#

Apply filter string against id/title/content and refresh selection.

fn refresh_side_panel(&mut self)#
fn reload_corpus(&mut self) -> Result<()>#

Reload markdown files from disk (after external edits).

fn run_check_all(&mut self) -> Result<()>#

Run quality check over the full (unfiltered) corpus and show the report.

fn run_convert_selected(&mut self) -> Result<()>#

Convert the selected response with pandoc jira writer into the preview pane.

fn run_lint_selected(&mut self) -> Result<()>#

Lint the selected path (or whole corpus) with harper-core.

fn run_reindex(&mut self) -> Result<()>#

Rebuild the Tantivy index from the published corpus.

Search the local index with the current filter (or a fixed query).

fn select_next(&mut self)#
fn select_prev(&mut self)#
fn selected_entry(&self) -> Option<&ListEntry>#
fn selected_response(&self) -> Option<&CannedResponse>#
fn update_preview(&mut self)#
struct ListEntry#

One row in the browser list (filtered view over the full corpus).

id: String#
title: String#
path: PathBuf#
check_ok: bool#
finding_count: usize#