1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//! Runtime configuration for analysis.
use serde::{Deserialize, Serialize};
/// Output format for reports.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum OutputFormat {
/// Markdown report (default).
#[default]
Markdown,
/// JSON report.
Json,
/// Emit both Markdown and JSON.
Both,
}
impl OutputFormat {
/// Parse from CLI string.
pub fn parse(s: &str) -> Result<Self, String> {
match s.to_ascii_lowercase().as_str() {
"md" | "markdown" => Ok(Self::Markdown),
"json" => Ok(Self::Json),
"both" => Ok(Self::Both),
other => Err(format!(
"unknown format '{other}'; expected markdown, json, or both"
)),
}
}
}
/// Analysis configuration.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Config {
/// Local path or remote Git URI to analyze.
pub target: String,
/// Desired output format.
pub format: OutputFormat,
/// Optional explicit output path (file or directory).
pub output: Option<std::path::PathBuf>,
/// Maximum commits to inspect for maintenance signals (also clone depth for remotes).
pub commit_sample_limit: usize,
/// Write an LLM remediation prompt from gap findings.
pub llm_prompt: bool,
/// Skip hygiene report files; only emit the LLM prompt.
pub prompt_only: bool,
/// Print the LLM prompt to stdout.
pub prompt_stdout: bool,
}
impl Default for Config {
fn default() -> Self {
Self {
target: ".".into(),
format: OutputFormat::Markdown,
output: None,
commit_sample_limit: 100,
llm_prompt: false,
prompt_only: false,
prompt_stdout: false,
}
}
}