renderConsole outputs the audit data in a compact, high-density format optimized for agentic readability. Each line carries maximum information with minimal decoration.
(data AuditData, logsPath string)
| 22 | // renderConsole outputs the audit data in a compact, high-density format optimized |
| 23 | // for agentic readability. Each line carries maximum information with minimal decoration. |
| 24 | func renderConsole(data AuditData, logsPath string) { |
| 25 | auditReportLog.Print("Rendering compact audit report to console") |
| 26 | |
| 27 | // Line 1: Identity + outcome |
| 28 | statusIcon := "✅" |
| 29 | switch data.Overview.Conclusion { |
| 30 | case "failure": |
| 31 | statusIcon = "❌" |
| 32 | case "cancelled": |
| 33 | statusIcon = "⚠️" |
| 34 | } |
| 35 | fmt.Fprintf(os.Stderr, "%s %s | %s | %s | %s\n", |
| 36 | statusIcon, data.Overview.WorkflowName, data.Overview.Conclusion, |
| 37 | data.Overview.Duration, data.Overview.URL) |
| 38 | |
| 39 | // Line 2: Context |
| 40 | engineInfo := "" |
| 41 | if data.EngineConfig != nil { |
| 42 | parts := []string{data.EngineConfig.EngineID} |
| 43 | if data.EngineConfig.Model != "" { |
| 44 | parts = append(parts, data.EngineConfig.Model) |
| 45 | } |
| 46 | if data.EngineConfig.Version != "" { |
| 47 | parts = append(parts, "v"+data.EngineConfig.Version) |
| 48 | } |
| 49 | engineInfo = strings.Join(parts, "/") |
| 50 | } |
| 51 | fmt.Fprintf(os.Stderr, " run=%d branch=%s event=%s engine=%s\n", |
| 52 | data.Overview.RunID, data.Overview.Branch, data.Overview.Event, engineInfo) |
| 53 | |
| 54 | // Line 3: Comparison (if available) |
| 55 | if data.Comparison != nil && data.Comparison.BaselineFound { |
| 56 | compLine := " comparison:" |
| 57 | if data.Comparison.Classification != nil { |
| 58 | compLine += " " + data.Comparison.Classification.Label |
| 59 | } |
| 60 | if data.Comparison.Baseline != nil { |
| 61 | compLine += fmt.Sprintf(" vs baseline %d", data.Comparison.Baseline.RunID) |
| 62 | } |
| 63 | if data.Comparison.Recommendation != nil && data.Comparison.Recommendation.Action != "" { |
| 64 | compLine += " | " + data.Comparison.Recommendation.Action |
| 65 | } |
| 66 | fmt.Fprintln(os.Stderr, compLine) |
| 67 | } |
| 68 | |
| 69 | // Line 4: Fingerprint (if available) |
| 70 | if data.BehaviorFingerprint != nil { |
| 71 | fmt.Fprintf(os.Stderr, " fingerprint: %s/%s/%s/%s/%s\n", |
| 72 | data.BehaviorFingerprint.ExecutionStyle, |
| 73 | data.BehaviorFingerprint.ToolBreadth, |
| 74 | data.BehaviorFingerprint.ActuationStyle, |
| 75 | data.BehaviorFingerprint.ResourceProfile, |
| 76 | data.BehaviorFingerprint.DispatchMode) |
| 77 | } |
| 78 | |
| 79 | // Line 5: Metrics (always present) |
| 80 | metricsLine := fmt.Sprintf(" metrics: errors=%d warnings=%d", |
| 81 | data.Metrics.ErrorCount, data.Metrics.WarningCount) |