How akin-genc0/tfpretty works
tfpretty is a terminal viewer for Terraform plans. The principal workflow starts with the user invoking plan; the command runs Terraform, parses its JSON output, and starts an interactive UI. The UI summarizes actions, shows attribute-level changes, and can display raw resource data or help. The graph preserves these documented screens and the sampled command, parser, and UI responsibilities. Some rendering details are represented by their exact source paths; unsampled implementation relationships are omitted.
Main entry points: plan.go Plan command · view.go View dispatcher · types.go Plan data types · runner.go Plan runner
Components 16
Command orchestration
- Program entry
main.go - Root command
cmd/root.go - Plan command
cmd/plan.go
Plan processing
- Plan runner
internal/terraform/runner.go - Temporary plan file
- JSON parser
internal/terraform/parser.go - Plan data types
internal/terraform/types.go
Interactive viewer
- UI state and input
internal/ui/model.go - View dispatcher
internal/ui/view.go - Plan summary
internal/ui/plan_view.go - Resource details
internal/ui/detail_view.go - Raw resource view
internal/ui/diff_view.go - Keyboard help
internal/ui/help_view.go - UI styles
internal/ui/styles.go
Other components
- User
- Terraform CLI
Connections 21
- User → Program entry: runs
README.md - Program entry → Root command: executes
main.go - Root command → Plan command: registers
cmd/plan.go - Plan command → Plan runner: runs plan
cmd/plan.go - Plan runner → Terraform CLI: runs commands
internal/terraform/runner.go - Plan runner → Temporary plan file: writes and removes
internal/terraform/runner.go - Plan command → JSON parser: parses output
cmd/plan.go - JSON parser → Plan data types: populates
internal/terraform/parser.go - Plan command → UI state and input: initializes
cmd/plan.go - UI state and input → Plan data types: holds plan
internal/ui/model.go - Plan command → View dispatcher: starts UI
cmd/plan.go - View dispatcher → Plan summary: renders plan
internal/ui/view.go - View dispatcher → Resource details: renders details
internal/ui/view.go - View dispatcher → Raw resource view: renders raw
internal/ui/view.go - View dispatcher → Keyboard help: renders help
internal/ui/view.go - Plan summary → UI styles: uses styles
internal/ui/plan_view.go - Resource details → UI styles: uses styles
internal/ui/detail_view.go - Raw resource view → UI styles: uses styles
internal/ui/diff_view.go - Plan summary → Plan data types: reads plan
internal/ui/plan_view.go - Resource details → Plan data types: reads changes
internal/ui/detail_view.go - Raw resource view → Plan data types: serializes resource
internal/ui/diff_view.go