Skip to main content

codetether_agent/swarm/validation/
format_report.rs

1use super::ValidationReport;
2
3impl ValidationReport {
4    /// Format the report as a human-readable string.
5    pub fn format(&self) -> String {
6        let mut output = String::new();
7        append_summary(&mut output, self.is_valid);
8        append_provider(&mut output, self);
9        super::format_workspace::append_workspace(&mut output, self);
10        super::format_tokens::append_tokens(&mut output, self);
11        super::format_issue::append_issues(&mut output, &self.issues);
12        output
13    }
14}
15
16fn append_summary(output: &mut String, is_valid: bool) {
17    if is_valid {
18        output.push_str("✓ Swarm pre-flight validation passed\n\n");
19    } else {
20        output.push_str("✗ Swarm pre-flight validation failed\n\n");
21    }
22}
23
24fn append_provider(output: &mut String, report: &ValidationReport) {
25    let status = if report.provider_status.is_available {
26        "✓ Available"
27    } else {
28        "✗ Unavailable"
29    };
30    output.push_str(&format!(
31        "Provider: {} ({}) - {}\n",
32        report.provider_status.provider, report.provider_status.model, status
33    ));
34}