Skip to main content

cargo_context_core/
options.rs

1use std::path::PathBuf;
2
3use crate::budget::Budget;
4use crate::expand::ExpandMode;
5use crate::impact::Finding;
6use crate::pack::{Format, Preset};
7use crate::tokenize::Tokenizer;
8
9/// Resolved pack inputs shared by CLI, MCP, and embedded callers.
10///
11/// Front-ends should translate their own argument/config shape into this
12/// struct, then hand it to [`crate::pack::PackBuilder`]. This keeps option
13/// precedence out of the pack assembly pipeline.
14#[derive(Debug, Clone)]
15pub struct PackOptions {
16    pub preset: Preset,
17    pub budget: Budget,
18    pub tokenizer: Tokenizer,
19    pub format: Format,
20    pub expand_mode: ExpandMode,
21    pub scrub: bool,
22    pub include_paths: Vec<String>,
23    pub exclude_paths: Vec<String>,
24    pub diff_range: Option<String>,
25    pub project_root: Option<PathBuf>,
26    pub stdin_prompt: Option<String>,
27    pub files_from: Vec<PathBuf>,
28    pub impact_findings: Vec<Finding>,
29    pub impact_per_finding: bool,
30}
31
32impl Default for PackOptions {
33    fn default() -> Self {
34        Self {
35            preset: Preset::Custom,
36            budget: Budget::default(),
37            tokenizer: Tokenizer::Llama3,
38            format: Format::Markdown,
39            expand_mode: ExpandMode::Off,
40            scrub: true,
41            include_paths: Vec::new(),
42            exclude_paths: Vec::new(),
43            diff_range: None,
44            project_root: None,
45            stdin_prompt: None,
46            files_from: Vec::new(),
47            impact_findings: Vec::new(),
48            impact_per_finding: false,
49        }
50    }
51}