Skip to main content

ito_core/viewer/
mod.rs

1//! Proposal viewer support.
2
3use crate::errors::CoreResult;
4
5/// Artifact collection helpers for proposal viewing.
6pub mod collector;
7
8/// Bat-based terminal viewer backend.
9pub mod bat;
10
11/// Glow-based terminal viewer backend.
12pub mod glow;
13
14/// HTML browser viewer backend (pandoc + system browser).
15pub mod html;
16
17/// Viewer registry and lookup helpers.
18pub mod registry;
19
20/// Shared utilities for viewer backends.
21pub(crate) mod util;
22
23/// Tmux + Neovim popup viewer backend.
24pub mod tmux_nvim;
25
26pub use bat::BatViewer;
27pub use collector::collect_proposal_artifacts;
28pub use glow::GlowViewer;
29pub use html::HtmlViewer;
30pub use registry::ViewerRegistry;
31pub use tmux_nvim::TmuxNvimViewer;
32
33/// A pluggable backend that can render collected proposal artifacts.
34pub trait ViewerBackend {
35    /// Stable CLI/backend identifier.
36    fn name(&self) -> &str;
37
38    /// Human-readable summary shown in prompts and help.
39    fn description(&self) -> &str;
40
41    /// Whether the viewer can run in the current environment.
42    fn is_available(&self) -> bool;
43
44    /// Detailed hint shown when the viewer is unavailable.
45    ///
46    /// Returns `None` if `is_available()` is true or no specific guidance exists.
47    fn availability_hint(&self) -> Option<String> {
48        None
49    }
50
51    /// Open or render the provided proposal content.
52    fn open(&self, content: &str) -> CoreResult<()>;
53}
54
55#[cfg(test)]
56mod viewer_tests;