plan

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 4, 2026 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package plan renders Terraform and Kustomize plan summaries for the CLI. It lives under pkg/tui because plan output is a terminal-display concern, alongside the existing tui primitives (section headers, spinners, color codes). The cmd layer calls Summary or SummaryJSON; the layout, color vocabulary, and resource enumeration live here so command files stay focused on flag handling. Counts displayed under each component are derived from the per-resource change list rather than terraform's raw `change_summary` whenever the resource list is available — this keeps the header line and the indented resource list internally consistent (a terraform "replace" appears once, not once as +1 and once as -1).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DestroySummary

func DestroySummary(w io.Writer, tfPlans []terraforminfra.TerraformComponentPlan, k8sPlans []fluxinfra.KustomizePlan, noColor bool)

DestroySummary writes a destroy-plan preview to w. The shape mirrors Summary but with destroy-aware semantics: the header reads "Windsor Destroy Plan", counts collapse to "-N" since every resource is a delete, and IsNew renders as "(no state)" / "(not deployed)" instead of "(new)" — honoring the IsNew dual-meaning contract documented on TerraformComponentPlan. The footer is removed (no streaming-plan equivalent for destroy) and there is no hints block (destroy is gated on a working cluster, so a tooling-missing fallback is not part of the destroy contract). Callers prepend the "this will permanently destroy..." confirmation language; this function only renders the plan body.

func DestroySummaryJSON

func DestroySummaryJSON(w io.Writer, tfPlans []terraforminfra.TerraformComponentPlan, k8sPlans []fluxinfra.KustomizePlan) error

DestroySummaryJSON encodes destroy-plan results as JSON to w. The schema mirrors SummaryJSON but is_new is documented as carrying its destroy-side meaning ("no state to destroy") so machine consumers can interpret correctly. Action strings on resources are still create/update/delete/replace, but the only value destroy plans actually emit is "delete".

func Summary

func Summary(w io.Writer, tfPlans []terraforminfra.TerraformComponentPlan, k8sPlans []fluxinfra.KustomizePlan, hints []string, noColor bool)

Summary writes the combined Terraform and Kustomize plan summary to w. Component names are left-aligned in a column wide enough to fit the longest name. Each row shows action-bucketed counts (+a ~c -d, with ±r appended when replaces are present), with "(no changes)" when all buckets are zero and "(error: ...)" when the plan failed. Components with non-empty Resources slices have each changed resource listed below the row, prefixed with the action symbol (+ ~ - ±). The list is capped at resourceListCap entries per component to keep large kustomizations from drowning the summary; the cap is followed by a "… and N more" line. When at least one component has actual changes, a footer hint points the user at the streaming `windsor plan terraform/kustomize <name>` form for full diffs. Any upgrade hints from missing CLI tools are printed in a footnote block at the bottom when present.

func SummaryJSON

func SummaryJSON(w io.Writer, tfPlans []terraforminfra.TerraformComponentPlan, k8sPlans []fluxinfra.KustomizePlan) error

SummaryJSON encodes the plan results as JSON to w.

is_new supersedes the count fields: when is_new is true the component has no state in the configured backend, terraform plan is not executed, and add/ change/destroy/no_changes are zero/false. Consumers detecting "pending work" from this output must check is_new alongside the counts — using add+change+ destroy>0 alone will silently miss never-applied components.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL