tgdash

$ Architecture

Pipeline

tgdash processes Terragrunt output through a pipeline:

stdin -> reader -> parser -> processor -> state -> TUI

Packages

PackageRole
readerReads stdin, emits Bubble Tea msgs
parserRegex: prefix, plan, apply, errors
processorRoutes parsed lines into AppState
stateUnit model, run history
estimatorTime estimates from past runs
tuiBubble Tea views and keybindings
integrationFixture-based integration tests

How it works

Reader

The reader goroutine reads lines from stdin and sends them as Bubble Tea messages to the TUI. This allows the TUI to remain responsive while processing input.

Parser

Each line is parsed with regex to extract:

  • Unit prefix - The [unit/path] at the start
  • Plan summary - Lines matching Plan: N to add, N to change, N to destroy
  • Apply result - Lines matching Apply complete! Resources: ...
  • Errors - Terraform error blocks

Processor

The processor takes parsed lines and updates the application state. It tracks which units exist, their current status, and accumulates output per unit.

State

AppState holds the full model: list of units, their statuses, plan summaries, errors, and output lines. Units progress through states: waiting, running, done, or error.

Estimator

The estimator uses historical run data (stored in ~/.local/share/tgdash/history.json) to predict how long each unit will take based on past runs.

TUI

Built with Bubble Tea, the TUI renders the dashboard and list views, handles keybindings, and updates in real-time as new messages arrive.