tui

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HighlightNode added in v0.2.0

func HighlightNode(c *Canvas, ln *LayoutNode)

HighlightNode temporarily re-renders a node with selection style on the canvas.

func NodeLabel added in v0.2.0

func NodeLabel(n *trace.Node) string

NodeLabel returns the display label for a node (exported for use in rendering).

func RenderViewport added in v0.2.0

func RenderViewport(c *Canvas, vpX, vpY, width, height int) string

RenderViewport extracts a visible rectangle from the canvas as a styled string.

func Run

func Run(paths []AnnotatedPath, graph *trace.TraceGraph) error

Run starts the TUI program.

func RunGraph added in v0.2.0

func RunGraph(graph *trace.TraceGraph) error

RunGraph starts the 2D graph TUI.

func SortedNodeIDs added in v0.2.0

func SortedNodeIDs(layout *LayoutResult) []uint64

SortedNodeIDs returns node IDs sorted by layer then order for consistent Tab cycling.

func UnhighlightNode added in v0.2.0

func UnhighlightNode(c *Canvas, ln *LayoutNode)

UnhighlightNode restores a node to its default style on the canvas.

Types

type AnnotatedPath

type AnnotatedPath struct {
	Path             trace.HotPath
	Pattern          *trace.Pattern // parameterized version (nil if not yet parameterized)
	Labels           []string       // human-readable step labels
	Confidence       float64
	Savings          int // estimated tokens saved per invocation
	CompilationValue int
	DataFlowEdges    []DataFlowAnnotation
}

AnnotatedPath is a HotPath enriched with display metadata.

type Canvas added in v0.2.0

type Canvas struct {
	Cells  [][]rune
	Styles [][]lipgloss.Style
	Width  int
	Height int
}

Canvas is a 2D character buffer with per-cell styling.

func NewCanvas added in v0.2.0

func NewCanvas(width, height int) *Canvas

NewCanvas creates an empty canvas filled with spaces.

func RenderCanvas added in v0.2.0

func RenderCanvas(layout *LayoutResult, g *trace.TraceGraph) *Canvas

RenderCanvas creates a fully rendered Canvas from the layout and graph.

func (*Canvas) Set added in v0.2.0

func (c *Canvas) Set(x, y int, ch rune, style lipgloss.Style)

Set writes a rune at (x,y) with a style, if within bounds.

func (*Canvas) SetEdge added in v0.2.1

func (c *Canvas) SetEdge(x, y int, ch rune, style lipgloss.Style)

SetEdge writes an edge character at (x,y), merging with existing edge characters to produce proper intersection glyphs when edges cross. Skips cells occupied by node content (letters, digits, punctuation) to avoid overwriting labels.

func (*Canvas) SetString added in v0.2.0

func (c *Canvas) SetString(x, y int, s string, style lipgloss.Style)

SetString writes a string starting at (x,y).

type DataFlowAnnotation added in v0.2.1

type DataFlowAnnotation struct {
	FromStep   int
	ToStep     int
	FlowTokens []string
}

DataFlowAnnotation describes a data-flow relationship between two steps.

type GraphModel added in v0.2.0

type GraphModel struct {
	// contains filtered or unexported fields
}

GraphModel is the bubbletea model for the 2D graph view.

func NewGraphModel added in v0.2.0

func NewGraphModel(graph *trace.TraceGraph, layout *LayoutResult, canvas *Canvas) GraphModel

NewGraphModel creates a new graph model.

func (GraphModel) Init added in v0.2.0

func (m GraphModel) Init() tea.Cmd

func (GraphModel) Update added in v0.2.0

func (m GraphModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (GraphModel) View added in v0.2.0

func (m GraphModel) View() string

type LayoutNode added in v0.2.0

type LayoutNode struct {
	ID     uint64
	Label  string
	Layer  int
	Order  int
	X, Y   int
	Width  int
	Height int
}

LayoutNode holds a positioned node for rendering.

type LayoutResult added in v0.2.0

type LayoutResult struct {
	Nodes       map[uint64]*LayoutNode
	TotalWidth  int
	TotalHeight int
}

LayoutResult holds the complete graph layout.

func ComputeLayout added in v0.2.0

func ComputeLayout(g *trace.TraceGraph) *LayoutResult

ComputeLayout runs a simplified Sugiyama-style layered layout on the trace graph.

type Model

type Model struct {
	// contains filtered or unexported fields
}

Model is the bubbletea model for the aj trace TUI.

func NewModel

func NewModel(paths []AnnotatedPath, graph *trace.TraceGraph) Model

NewModel creates a new TUI model.

func (Model) Init

func (m Model) Init() tea.Cmd

Init implements tea.Model.

func (Model) Update

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update implements tea.Model.

func (Model) View

func (m Model) View() string

View implements tea.Model.

Jump to

Keyboard shortcuts

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