Documentation
¶
Index ¶
- Constants
- func Render(g *Graph, selectedStepID string) (string, error)
- func RenderCompact(g *Graph, selectedStepID string) (string, error)
- type Canvas
- func (c *Canvas) Clear()
- func (c *Canvas) DrawArrow(x, y int, direction Direction)
- func (c *Canvas) DrawBox(x, y, width, height int, text string, status rest.V1TaskStatus, selected bool)
- func (c *Canvas) DrawHorizontalLine(x1, x2, y int)
- func (c *Canvas) DrawPath(path []Coord)
- func (c *Canvas) DrawVerticalLine(x, y1, y2 int)
- func (c *Canvas) GetDimensions() (width, height int)
- func (c *Canvas) SetCell(x, y int, char string, style lipgloss.Style)
- func (c *Canvas) ToString() string
- type Cell
- type CellPriority
- type Component
- type ComponentStats
- type Coord
- type Direction
- type Edge
- type Graph
- func (g *Graph) AddEdge(from, to *Node) error
- func (g *Graph) AddNode(node *Node) error
- func (g *Graph) ComponentCount() int
- func (g *Graph) DetectComponents() int
- func (g *Graph) EdgeCount() int
- func (g *Graph) GetComponent(id int) *Component
- func (g *Graph) GetComponentStats() ComponentStats
- func (g *Graph) GetNode(stepID string) *Node
- func (g *Graph) GetNodeComponent(stepID string) *Component
- func (g *Graph) HasCycle() bool
- func (g *Graph) IsEmpty() bool
- func (g *Graph) LayoutGraph(config *RenderConfig) error
- func (g *Graph) NodeCount() int
- type Node
- type Rect
- type RenderConfig
Constants ¶
const ( CharHorizontal = "─" CharVertical = "│" CharTopLeft = "┌" CharTopRight = "┐" CharBottomLeft = "└" CharBottomRight = "┘" CharArrowRight = "►" CharArrowDown = "▼" CharArrowLeft = "◄" CharArrowUp = "▲" CharSpace = " " CharCross = "┼" // Cross junction CharTeeRight = "├" // T-junction pointing right CharTeeLeft = "┤" // T-junction pointing left CharTeeDown = "┬" // T-junction pointing down CharTeeUp = "┴" // T-junction pointing up )
Box-drawing characters (Unicode)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Canvas ¶
type Canvas struct {
// contains filtered or unexported fields
}
Canvas represents an ASCII drawing surface for rendering the graph
func (*Canvas) DrawBox ¶
func (c *Canvas) DrawBox(x, y, width, height int, text string, status rest.V1TaskStatus, selected bool)
DrawBox renders a node box with status coloring and optional selection
func (*Canvas) DrawHorizontalLine ¶
DrawHorizontalLine draws a horizontal line from (x1, y) to (x2, y)
func (*Canvas) DrawVerticalLine ¶
DrawVerticalLine draws a vertical line from (x, y1) to (x, y2)
func (*Canvas) GetDimensions ¶
GetDimensions returns the actual used dimensions
type Cell ¶
type Cell struct {
Char string // The character to display
Style lipgloss.Style // Optional styling (color, bold, etc.)
}
Cell represents a single character on the canvas with optional styling
type CellPriority ¶
type CellPriority int
CellPriority defines priority for character collision resolution Higher priority characters overwrite lower priority ones
const ( PriorityEmpty CellPriority = iota // Empty cell (space) PriorityLine // Line characters (─ │) PriorityArrow // Arrow characters (► ▼ ◄ ▲) PriorityJunction // Junction characters (┌ ┐ └ ┘ ├ ┤ ┬ ┴ ┼) PriorityBox // Box borders and content )
type Component ¶
type Component struct {
ID int // Component identifier
Nodes []*Node // All nodes in this component
RootNodes []*Node // Nodes with no incoming edges (within this component)
// Bounding box after layout (absolute canvas coordinates)
BoundingBox Rect
}
Component represents a connected subgraph (part of the forest)
type ComponentStats ¶
type ComponentStats struct {
TotalComponents int
LargestComponent int // Number of nodes
SmallestComponent int // Number of nodes
IsolatedNodes int // Single-node components
}
ComponentStats returns statistics about the components
type Direction ¶
type Direction int
Direction represents a cardinal direction for navigation or drawing
type Edge ¶
type Edge struct {
From *Node // Source node
To *Node // Target node
Points []Coord // Computed path points for drawing (set by edge router)
}
Edge represents a directed connection between two nodes
type Graph ¶
type Graph struct {
// Graph structure
Nodes map[string]*Node // Keyed by step ID
Edges []*Edge
Components []*Component // Connected components
// Layout configuration
Direction string // "LR" (left-to-right) or "TD" (top-down)
// Space constraints
MaxWidth int // Available terminal width
MaxHeight int // Available terminal height
// Actual dimensions after layout
ActualWidth int
ActualHeight int
}
Graph represents the complete workflow execution graph May be a forest (multiple disconnected components)
func BuildGraph ¶
func BuildGraph( shape rest.WorkflowRunShapeForWorkflowRunDetails, tasks []rest.V1TaskSummary, maxWidth, maxHeight int, ) (*Graph, error)
BuildGraph converts API shape and task data into the internal graph representation
func (*Graph) AddNode ¶
AddNode adds a node to the graph Returns error if a node with the same StepID already exists
func (*Graph) ComponentCount ¶
ComponentCount returns the number of connected components
func (*Graph) DetectComponents ¶
DetectComponents finds all connected components using DFS
func (*Graph) GetComponent ¶
GetComponent returns the component with the given ID
func (*Graph) GetComponentStats ¶
func (g *Graph) GetComponentStats() ComponentStats
GetComponentStats returns component statistics
func (*Graph) GetNodeComponent ¶
GetNodeComponent returns the component containing the node
func (*Graph) LayoutGraph ¶
func (g *Graph) LayoutGraph(config *RenderConfig) error
LayoutGraph computes positions for all nodes within the available space
type Node ¶
type Node struct {
// Identity
StepID string // Unique step identifier from API
TaskName string // Display name for the task
TaskExternalID string // Link to full task details
// Status for coloring
Status rest.V1TaskStatus
// Graph topology
Parents []*Node // Incoming edges
Children []*Node // Outgoing edges
// Component membership
ComponentID int // Which connected component this belongs to
// Layout coordinates (relative to component, in grid units)
GridX int
GridY int
Layer int // Computed layer in hierarchical layout
// Drawing coordinates (absolute on canvas, in character units)
DrawX int
DrawY int
// Dimensions in character units
Width int
Height int
}
Node represents a single task node in the workflow graph
func GetNavigableNodes ¶
GetNavigableNodes returns nodes in visual order for keyboard navigation
func GetNodeAtPosition ¶
GetNodeAtPosition returns the node at the given canvas position, or nil if none
type RenderConfig ¶
type RenderConfig struct {
// Node dimensions in character units
NodeWidth int
NodeHeight int
// Spacing between nodes
PaddingX int
PaddingY int
// Available space
MaxWidth int
MaxHeight int
// Compact mode uses minimal spacing
CompactMode bool
}
RenderConfig contains layout and rendering parameters