pawan/config/healing.rs
1use serde::{Deserialize, Serialize};
2
3/// Configuration for self-healing behavior
4#[derive(Debug, Clone, Serialize, Deserialize)]
5#[serde(default)]
6pub struct HealingConfig {
7 /// Automatically commit fixes
8 pub auto_commit: bool,
9
10 /// Fix compilation errors
11 pub fix_errors: bool,
12
13 /// Fix clippy warnings
14 pub fix_warnings: bool,
15
16 /// Fix failing tests
17 pub fix_tests: bool,
18
19 /// Generate missing documentation
20 pub generate_docs: bool,
21
22 /// Run `cargo audit` and surface security advisories as diagnostics.
23 /// Off by default — `cargo audit` requires the binary to be installed
24 /// and has occasional network dependencies for the advisory database.
25 #[serde(default)]
26 pub fix_security: bool,
27
28 /// Maximum fix attempts per issue
29 pub max_attempts: usize,
30
31 /// Optional shell command to run after `cargo check` passes (stage 2 gate).
32 /// If this command exits non-zero the heal loop treats the output as a
33 /// remaining failure and retries. Useful values:
34 /// - `"cargo test --workspace"` — run full test suite
35 /// - `"cargo clippy -- -D warnings"` — enforce zero warnings
36 ///
37 /// Leave unset (default) to skip the second stage.
38 #[serde(default)]
39 pub verify_cmd: Option<String>,
40}
41
42impl Default for HealingConfig {
43 fn default() -> Self {
44 Self {
45 auto_commit: false,
46 fix_errors: true,
47 fix_warnings: true,
48 fix_tests: true,
49 generate_docs: false,
50 fix_security: false,
51 max_attempts: 3,
52 verify_cmd: None,
53 }
54 }
55}