aft/config.rs
1use std::path::PathBuf;
2
3/// Runtime configuration for the aft process.
4///
5/// Holds project-scoped settings and tuning knobs. Values are set at startup
6/// and remain immutable for the lifetime of the process.
7#[derive(Debug, Clone)]
8pub struct Config {
9 /// Root directory of the project being analyzed. `None` if not scoped.
10 pub project_root: Option<PathBuf>,
11 /// How many levels of call-graph edges to follow during validation (default: 1).
12 pub validation_depth: u32,
13 /// Hours before a checkpoint expires and is eligible for cleanup (default: 24).
14 pub checkpoint_ttl_hours: u32,
15 /// Maximum depth for recursive symbol resolution (default: 10).
16 pub max_symbol_depth: u32,
17 /// Seconds before killing a formatter subprocess (default: 10).
18 pub formatter_timeout_secs: u32,
19 /// Seconds before killing a type-checker subprocess (default: 30).
20 pub type_checker_timeout_secs: u32,
21 /// Whether to auto-format files after edits (default: true).
22 pub format_on_edit: bool,
23 /// Whether to auto-validate files after edits (default: false).
24 /// When "syntax", only tree-sitter parse check. When "full", runs type checker.
25 pub validate_on_edit: Option<String>,
26 /// Per-language formatter overrides. Keys: "typescript", "python", "rust", "go".
27 /// Values: "biome", "prettier", "deno", "ruff", "black", "rustfmt", "goimports", "gofmt", "none".
28 pub formatter: std::collections::HashMap<String, String>,
29 /// Per-language type checker overrides. Keys: "typescript", "python", "rust", "go".
30 /// Values: "tsc", "biome", "pyright", "ruff", "cargo", "go", "staticcheck", "none".
31 pub checker: std::collections::HashMap<String, String>,
32}
33
34impl Default for Config {
35 fn default() -> Self {
36 Config {
37 project_root: None,
38 validation_depth: 1,
39 checkpoint_ttl_hours: 24,
40 max_symbol_depth: 10,
41 formatter_timeout_secs: 10,
42 type_checker_timeout_secs: 30,
43 format_on_edit: true,
44 validate_on_edit: None,
45 formatter: std::collections::HashMap::new(),
46 checker: std::collections::HashMap::new(),
47 }
48 }
49}