feat: complete TUI Phase 0 — Toolchain Gate
This commit is contained in:
58
crates/lore-tui/src/lib.rs
Normal file
58
crates/lore-tui/src/lib.rs
Normal file
@@ -0,0 +1,58 @@
|
||||
#![forbid(unsafe_code)]
|
||||
|
||||
//! Gitlore TUI — terminal interface for exploring GitLab data locally.
|
||||
//!
|
||||
//! Built on FrankenTUI (Elm architecture): Model, update, view.
|
||||
//! The `lore` CLI spawns `lore-tui` via PATH lookup at runtime.
|
||||
|
||||
use anyhow::Result;
|
||||
|
||||
// Phase 0 modules.
|
||||
pub mod clock; // Clock trait: SystemClock + FakeClock (bd-2lg6)
|
||||
pub mod message; // Msg, Screen, EntityKey, AppError, InputMode (bd-c9gk)
|
||||
|
||||
pub mod safety; // Terminal safety: sanitize + URL policy + redact (bd-3ir1)
|
||||
|
||||
pub mod db; // DbManager: read pool + dedicated writer (bd-2kop)
|
||||
pub mod theme; // Flexoki theme: build_theme, state_color, label_style (bd-5ofk)
|
||||
|
||||
pub mod app; // LoreApp Model trait impl (Phase 0 proof: bd-2emv, full: bd-6pmy)
|
||||
|
||||
/// Options controlling how the TUI launches.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct LaunchOptions {
|
||||
/// Path to lore config file.
|
||||
pub config_path: Option<String>,
|
||||
/// Run a background sync before displaying data.
|
||||
pub sync_on_start: bool,
|
||||
/// Clear cached TUI state and start fresh.
|
||||
pub fresh: bool,
|
||||
/// Render backend: "crossterm" or "native".
|
||||
pub render_mode: String,
|
||||
/// Use ASCII-only box drawing characters.
|
||||
pub ascii: bool,
|
||||
/// Disable alternate screen (render inline).
|
||||
pub no_alt_screen: bool,
|
||||
}
|
||||
|
||||
/// Launch the TUI in browse mode (no sync).
|
||||
///
|
||||
/// Loads config from `options.config_path` (or default location),
|
||||
/// opens the database read-only, and enters the FrankenTUI event loop.
|
||||
pub fn launch_tui(options: LaunchOptions) -> Result<()> {
|
||||
let _options = options;
|
||||
// Phase 1 will wire this to LoreApp + App::fullscreen().run()
|
||||
eprintln!("lore-tui: browse mode not yet implemented (Phase 1)");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Launch the TUI with an initial sync pass.
|
||||
///
|
||||
/// Runs `lore sync` in the background while displaying a progress screen,
|
||||
/// then transitions to browse mode once sync completes.
|
||||
pub fn launch_sync_tui(options: LaunchOptions) -> Result<()> {
|
||||
let _options = options;
|
||||
// Phase 2 will implement the sync progress screen
|
||||
eprintln!("lore-tui: sync mode not yet implemented (Phase 2)");
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user