printGuardrailVerdict writes a coloured pass/fail summary to stderr, keeping stdout reserved for the estimate tables.
(g estimate.GuardrailResult)
| 435 | // printGuardrailVerdict writes a coloured pass/fail summary to stderr, keeping |
| 436 | // stdout reserved for the estimate tables. |
| 437 | func printGuardrailVerdict(g estimate.GuardrailResult) { |
| 438 | if g.Passed { |
| 439 | st := lipgloss.NewStyle().Foreground(lipgloss.Color("#22C55E")).Bold(true) |
| 440 | fmt.Fprintln(os.Stderr, st.Render(fmt.Sprintf("✓ GUARDRAIL PASSED — monthly $%.2f", g.MonthlyTotal))) |
| 441 | return |
| 442 | } |
| 443 | st := lipgloss.NewStyle().Foreground(lipgloss.Color("#EF4444")).Bold(true) |
| 444 | fmt.Fprintln(os.Stderr, st.Render("✗ GUARDRAIL FAILED:")) |
| 445 | for _, b := range g.Breaches { |
| 446 | fmt.Fprintln(os.Stderr, st.Render(" • "+b)) |
| 447 | } |
| 448 | } |
| 449 | |
| 450 | // guardrailBreachError signals that a cost guardrail threshold was exceeded. |
| 451 | // Execute() maps it to exit code 2 (distinct from 1 = runtime error). |
no test coverage detected