Documentation
¶
Overview ¶
Package render turns one patchy resource into a printer document.
It is organised by noun — one file per kind — because a kind is what changes together: add a field to InvestigationStatus and exactly one file here needs editing. The verb commands stay noun-agnostic, which is what lets `patchy get` serve every kind through the resource registry without a per-kind branch.
Each kind offers two depths, because the two verbs ask different questions:
- Detail — everything known, for `describe`.
- Review — the verdict and the report, for `review`.
They share this package's helpers rather than each verb growing its own copy, which is what previously let two spellings of "render an analysis rating" drift apart.
Index ¶
- func Age(t, now time.Time) string
- func Body(rep string, raw bool) string
- func Budget(d *printer.Doc, p v1alpha1.AgentParameters, st *v1alpha1.StageResult)
- func Cost(st *v1alpha1.StageResult) string
- func Dash(s string) string
- func FindingDetail(d *printer.Doc, f *v1alpha1.Finding, now time.Time, spend string)
- func FindingSummary(d *printer.Doc, f *v1alpha1.Finding)
- func FindingTracking(d *printer.Doc, f *v1alpha1.Finding, now time.Time)
- func FindingURL(f *v1alpha1.Finding) string
- func InvestigationDetail(d *printer.Doc, inv *v1alpha1.Investigation, now time.Time)
- func InvestigationReview(d *printer.Doc, inv *v1alpha1.Investigation, raw bool)
- func Outcome(st *v1alpha1.StageResult) string
- func Rating(a *v1alpha1.Analysis) string
- func RemediationDetail(d *printer.Doc, rem *v1alpha1.Remediation, now time.Time)
- func RemediationReview(d *printer.Doc, rem *v1alpha1.Remediation, raw bool)
- func SkewPercent(predicted, actual int64) string
- func Stage(d *printer.Doc, st *v1alpha1.StageResult, now time.Time)
- func Timestamp(t *metav1.Time, now time.Time) string
- func Usage(u v1alpha1.UsageSummary) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Body ¶
Body is the report as a human should read it: the machine frontmatter is a contract between stages, not prose, so it comes off unless asked for.
func Budget ¶ added in v0.8.0
func Budget(d *printer.Doc, p v1alpha1.AgentParameters, st *v1alpha1.StageResult)
Budget renders predicted against granted against actual. The estimate never limits a run — it only decides whether a human had to approve it — so the grant is shown beside it: without both, a run that finished well inside a generous grant looks identical to one that scraped a tight estimate.
func Dash ¶
Dash renders an empty value inside a composed line, where omitting it would leave a confusing gap.
func FindingDetail ¶
FindingDetail renders everything known about one finding. spend is the cross-attempt total, which lives on the child runs rather than the finding — the caller queries it and passes it in, so this package performs no I/O.
func FindingSummary ¶
FindingSummary renders the header `review` puts above the agent reports: enough to know which finding this is, and where its human artefacts live.
func FindingTracking ¶
FindingTracking renders the projected tracking item and the remediation pull request.
func FindingURL ¶
FindingURL is a finding's human destination: its tracking issue.
func InvestigationDetail ¶
InvestigationDetail renders everything known about one analysis attempt.
func InvestigationReview ¶
func InvestigationReview(d *printer.Doc, inv *v1alpha1.Investigation, raw bool)
InvestigationReview renders the verdict and the report — what a human reads when deciding whether to act on the agent's conclusion.
func Outcome ¶
func Outcome(st *v1alpha1.StageResult) string
Outcome reports how an agent run ended. Worth surfacing next to the report because it explains an empty one far better than the empty report does.
func Rating ¶
Rating renders one investigation analysis dimension: the grade, plus the agent's one-line justification when it gave one.
func RemediationDetail ¶
RemediationDetail renders everything known about one remediation attempt.
func RemediationReview ¶
func RemediationReview(d *printer.Doc, rem *v1alpha1.Remediation, raw bool)
RemediationReview renders the result and the report.
func SkewPercent ¶ added in v0.8.0
SkewPercent renders how far actual ran over (+) or under (-) predicted. The sign is the point — it says which way the estimate was wrong.
func Timestamp ¶
Timestamp renders an absolute time with its age. A detail view wants both: "when" and "how long ago" answer different questions.
func Usage ¶
func Usage(u v1alpha1.UsageSummary) string
Usage renders the token and cost accounting.
Types ¶
This section is empty.