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
23pub use bat::BatViewer;
24pub use collector::collect_proposal_artifacts;
25pub use glow::GlowViewer;
26pub use html::HtmlViewer;
27pub use registry::ViewerRegistry;
28
29/// A pluggable backend that can render collected proposal artifacts.
30pub trait ViewerBackend {
31 /// Stable CLI/backend identifier.
32 fn name(&self) -> &str;
33
34 /// Human-readable summary shown in prompts and help.
35 fn description(&self) -> &str;
36
37 /// Whether the viewer can run in the current environment.
38 fn is_available(&self) -> bool;
39
40 /// Detailed hint shown when the viewer is unavailable.
41 ///
42 /// Returns `None` if `is_available()` is true or no specific guidance exists.
43 fn availability_hint(&self) -> Option<String> {
44 None
45 }
46
47 /// Open or render the provided proposal content.
48 fn open(&self, content: &str) -> CoreResult<()>;
49}
50
51#[cfg(test)]
52mod viewer_tests;