Skip to main content

st/formatters/
mod.rs

1pub mod ai;
2pub mod ai_json;
3pub mod classic;
4pub mod context;
5pub mod csv;
6pub mod digest;
7pub mod emotional_new; // The FUN emotional formatter with personality!
8pub mod function_markdown;
9pub mod hex;
10pub mod hextree; // HexTree - quantum meets readable tree structure
11pub mod json;
12pub mod ls;
13pub mod markdown;
14pub mod marqant;
15pub mod mermaid;
16pub mod projects; // Projects discovery mode - find all your forgotten 3am coding gems!
17pub mod quantum;
18pub mod quantum_semantic;
19pub mod relations;
20pub mod relations_formatter;
21pub mod semantic;
22pub mod smart; // Smart formatter - surface what matters, not everything!
23pub mod sse;
24pub mod stats;
25pub mod summary;
26pub mod summary_ai;
27pub mod tsv;
28pub mod waste;
29
30use crate::scanner::{FileNode, TreeStats};
31use anyhow::Result;
32use std::io::Write;
33
34#[derive(Debug, Clone, Copy)]
35pub enum PathDisplayMode {
36    Off,
37    Relative,
38    Full,
39}
40
41pub trait Formatter {
42    fn format(
43        &self,
44        writer: &mut dyn Write,
45        nodes: &[FileNode],
46        stats: &TreeStats,
47        root_path: &std::path::Path,
48    ) -> Result<()>;
49}
50
51pub trait StreamingFormatter {
52    /// Initialize the stream (e.g., write headers)
53    fn start_stream(&self, writer: &mut dyn Write, root_path: &std::path::Path) -> Result<()>;
54
55    /// Format a single node as it arrives
56    fn format_node(
57        &self,
58        writer: &mut dyn Write,
59        node: &FileNode,
60        root_path: &std::path::Path,
61    ) -> Result<()>;
62
63    /// Finalize the stream (e.g., write stats, footers)
64    fn end_stream(
65        &self,
66        writer: &mut dyn Write,
67        stats: &TreeStats,
68        root_path: &std::path::Path,
69    ) -> Result<()>;
70}