dumpfs 0.1.0

A tool for dumping codebase information for LLMs efficiently and effectively
Documentation
/// Specifies the desired output format for the filesystem tree.
#[derive(Clone, Default, Debug, clap::ValueEnum)]
pub enum FsWriteFormat {
    /// Markdown format (`.md`)
    #[default]
    Md,
    /// XML format (`.xml`)
    Xml,
    /// JSON format (`.json`)
    Json,
}

impl FsWriteFormat {
    /// Returns the file extension for this format (without the dot).
    pub fn extension(&self) -> &'static str {
        match self {
            FsWriteFormat::Md => "md",
            FsWriteFormat::Xml => "xml",
            FsWriteFormat::Json => "json",
        }
    }
}

/// Configuration options controlling formatter behavior.
#[derive(Clone, Debug, clap::Args)]
pub struct FsFmtOpts {
    /// Output format to generate.
    #[arg(short = 'f', long, value_enum, default_value_t = FsWriteFormat::Md)]
    pub format: FsWriteFormat,
    /// Whether to show Unix permission bits (within metadata).
    #[arg(short = 'p', long, default_value_t = false)]
    pub show_permissions: bool,
    /// Whether to show file sizes (within metadata).
    #[arg(short = 's', long, default_value_t = false)]
    pub show_size: bool,
    /// Whether to show modification times (within metadata).
    #[arg(short = 'm', long, default_value_t = false)]
    pub show_modified: bool,
    /// Whether to exclude file contents from output (e.g., for structure-only views). Controller via scanner skip-content
    #[arg(skip)]
    pub omit_file_contents: bool,
    /// Whether to include a tree outline of directory structure at the beginning
    #[arg(short = 't', long, default_value_t = false)]
    pub include_tree_outline: bool,
    /// Whether to ensure that output format is parsable for given schema
    #[arg(long, default_value_t = false)]
    pub parsable_format: bool,
    /// Whether to omit custom summary for llms
    #[arg(long, default_value_t = false)]
    pub omit_summary: bool,
    /// Whether to include source details in output
    #[arg(short = 'l', long, default_value_t = false)]
    pub include_source_details: bool,
}

impl Default for FsFmtOpts {
    fn default() -> Self {
        FsFmtOpts {
            format: FsWriteFormat::default(),
            show_permissions: false,
            show_size: true,
            show_modified: true,
            omit_file_contents: false,
            include_tree_outline: true,
            parsable_format: false,
            omit_summary: false,
            include_source_details: true,
        }
    }
}