design

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

cmd/internal/design/config.go

Package design provides JSON serialization for structured output mode.

Package design implements pattern-based CLI output visualization

cmd/internal/design/render.go

Package design implements a research-backed design system for CLI output

Index

Constants

View Source
const (
	IconStart   = "[START]"
	IconSuccess = "[SUCCESS]"
	IconWarning = "[WARNING]"
	IconFailed  = "[FAILED]"
	IconInfo    = "[INFO]"
	IconBullet  = "*"
)

Icon constants for monochrome/ASCII mode.

View Source
const (
	ColorKeyProcess = "Process"
	ColorKeySuccess = "Success"
	ColorKeyWarning = "Warning"
	ColorKeyError   = "Error"
	ColorKeyMuted   = "Muted"
)

Color key constants for theme color lookups.

View Source
const (
	TypeDetail   = "detail"   // Default for unclassified lines.
	TypeError    = "error"    // Error messages.
	TypeWarning  = "warning"  // Warning messages.
	TypeSuccess  = "success"  // Success indicators.
	TypeInfo     = "info"     // Informational messages (e.g., from stderr not being errors).
	TypeProgress = "progress" // Progress updates.
	TypeSummary  = "summary"  // Lines that are part of a generated summary.
)

LineType constants for consistent classification of output lines.

View Source
const (
	StatusRunning = "running" // Task is currently executing.
	StatusSuccess = "success" // Task completed successfully.
	StatusWarning = "warning" // Task completed with warnings.
	StatusError   = "error"   // Task failed or completed with errors.
)

TaskStatus constants for consistent representation of a task's overall status.

View Source
const (
	MessageTypeRaw     = "raw"     // Raw output without any formatting
	MessageTypeH1      = "h1"      // Level 1 header
	MessageTypeH2      = "h2"      // Level 2 header
	MessageTypeH3      = "h3"      // Level 3 header
	MessageTypeSuccess = "success" // Success message (alias for StatusSuccess)
	MessageTypeWarning = "warning" // Warning message (alias for StatusWarning)
	MessageTypeError   = "error"   // Error message (alias for StatusError)
	MessageTypeInfo    = "info"    // Info message (alias for TypeInfo)
)

MessageType constants for RenderDirectMessage to provide type safety and prevent typos.

View Source
const ANSIBrightWhite = "\033[0;97m"

ANSI color code constant.

View Source
const ANSIReset = "\033[0m"

ANSIReset is the escape code to reset all styling.

View Source
const DefaultSpinnerChars = "-\\|/"

Default spinner characters for ASCII mode.

View Source
const MessageTypeHeader = "header"

MessageType constant for legacy support.

Variables

This section is empty.

Functions

func ApplyMonochromeDefaults

func ApplyMonochromeDefaults(cfg *Config)

func DefaultThemes

func DefaultThemes() map[string]*Config

DefaultThemes returns a map of all built-in themes. This is the single source of truth for default theme definitions.

func IsInteractiveTerminal

func IsInteractiveTerminal() bool

IsInteractiveTerminal checks if stdout is connected to a terminal.

func IsValidPatternType

func IsValidPatternType(s string) bool

IsValidPatternType checks if a string represents a valid pattern type.

func NormalizeANSIEscape

func NormalizeANSIEscape(s string) string

NormalizeANSIEscape normalizes ANSI escape sequences to ensure they start with the ESC character (0x1b). YAML should handle escape sequences correctly, but this function normalizes them to handle edge cases and ensure consistency.

func RenderDirectMessage

func RenderDirectMessage(cfg *Config, messageType, customIcon, message string, indentLevel int) string

RenderDirectMessage creates the formatted status line.

func ToJSON

func ToJSON(p Pattern, metadata JSONMetadata) ([]byte, error)

ToJSON converts a Pattern to JSON output format.

Types

type BorderStyle

type BorderStyle string

BorderStyle defines the type of border to use for task output.

const (
	BorderLeftOnly   BorderStyle = "left_only"
	BorderLeftDouble BorderStyle = "left_double"
	BorderHeaderBox  BorderStyle = "header_box"
	BorderFull       BorderStyle = "full_box"
	BorderNone       BorderStyle = "none"
	BorderASCII      BorderStyle = "ascii"
)

type CognitiveLoadContext

type CognitiveLoadContext string

CognitiveLoadContext represents the user's likely cognitive state when processing information.

const (
	LoadLow    CognitiveLoadContext = "low"    // Simple, routine information.
	LoadMedium CognitiveLoadContext = "medium" // Standard operational information.
	LoadHigh   CognitiveLoadContext = "high"   // Complex errors, dense information requiring focus.
)

type Color

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

Color wraps an ANSI escape code for safer and more readable color handling. Use Sprint to wrap text in color codes, which automatically resets styling.

func NewColor

func NewColor(code string) Color

NewColor creates a Color from an ANSI escape code.

func (Color) Code

func (c Color) Code() string

Code returns the raw ANSI escape code for manual use.

func (Color) IsEmpty

func (c Color) IsEmpty() bool

IsEmpty returns true if this color has no escape code.

func (Color) Sprint

func (c Color) Sprint(s string) string

Sprint wraps text in this color and automatically resets styling.

type Comparison

type Comparison struct {
	Label   string           // Title for the comparison
	Changes []ComparisonItem // Items being compared
}

Comparison represents a before/after comparison of metrics. Useful for showing changes over time or between versions.

func (*Comparison) PatternType

func (c *Comparison) PatternType() PatternType

PatternType implements the Pattern interface.

func (*Comparison) Render

func (c *Comparison) Render(cfg *Config) string

Render creates the comparison visualization.

type ComparisonItem

type ComparisonItem struct {
	Label  string  // Metric label
	Before string  // Before value (formatted)
	After  string  // After value (formatted)
	Change float64 // Numeric change (positive or negative)
	Unit   string  // Unit for the change (e.g., "%", "MB", "ms")
}

ComparisonItem represents a single metric comparison.

type CompiledPattern

type CompiledPattern struct {
	Re     *regexp.Regexp
	Type   string
	Weight int
}

CompiledPattern holds a precompiled regex pattern with metadata.

type Config

type Config struct {
	ThemeName    string `yaml:"-"`
	IsMonochrome bool   `yaml:"-"`
	CI           bool   `yaml:"-"` // Explicit CI mode flag (takes precedence over heuristics)

	Style struct {
		UseBoxes          bool   `yaml:"use_boxes"`
		Indentation       string `yaml:"indentation"`
		ShowTimestamps    bool   `yaml:"show_timestamps"`
		NoTimer           bool   `yaml:"no_timer"`
		Density           string `yaml:"density"`
		UseInlineProgress bool   `yaml:"use_inline_progress"`
		NoSpinner         bool   `yaml:"no_spinner"`
		SpinnerInterval   int    `yaml:"spinner_interval"`
		HeaderWidth       int    `yaml:"header_width"` // Visual width of header content (default: 40)
	} `yaml:"style"`

	Border struct {
		TaskStyle              BorderStyle `yaml:"task_style"`
		HeaderChar             string      `yaml:"header_char"`
		VerticalChar           string      `yaml:"vertical_char"`
		TopCornerChar          string      `yaml:"top_corner_char"`
		BottomCornerChar       string      `yaml:"bottom_corner_char"`
		FooterContinuationChar string      `yaml:"footer_continuation_char"`
		TableHChar             string      `yaml:"table_h_char"`
		TableVChar             string      `yaml:"table_v_char"`
		TableXChar             string      `yaml:"table_x_char"`
		TableCornerTL          string      `yaml:"table_corner_tl"`
		TableCornerTR          string      `yaml:"table_corner_tr"`
		TableCornerBL          string      `yaml:"table_corner_bl"`
		TableCornerBR          string      `yaml:"table_corner_br"`
		TableTDown             string      `yaml:"table_t_down"`
		TableTUp               string      `yaml:"table_t_up"`
		TableTLeft             string      `yaml:"table_t_left"`
		TableTRight            string      `yaml:"table_t_right"`
	} `yaml:"border"`

	Colors struct {
		Process string `yaml:"process"`
		Success string `yaml:"success"`
		Warning string `yaml:"warning"`
		Error   string `yaml:"error"`
		Detail  string `yaml:"detail"`
		Muted   string `yaml:"muted"`
		Reset   string `yaml:"reset"`
		White   string `yaml:"white,omitempty"`
		BlueFg  string `yaml:"blue_fg,omitempty"`
		BlueBg  string `yaml:"blue_bg,omitempty"`
		Bold    string `yaml:"bold,omitempty"`
		Italic  string `yaml:"italic,omitempty"`
	} `yaml:"colors"`

	Icons struct {
		Start   string `yaml:"start"`
		Success string `yaml:"success"`
		Warning string `yaml:"warning"`
		Error   string `yaml:"error"`
		Info    string `yaml:"info"`
		Bullet  string `yaml:"bullet"`
	} `yaml:"icons"`

	Elements      map[string]ElementStyleDef `yaml:"elements"`
	Patterns      PatternsRepo               `yaml:"patterns"`
	Tools         map[string]*ToolConfig     `yaml:"tools"`
	CognitiveLoad struct {
		AutoDetect bool                 `yaml:"auto_detect"`
		Default    CognitiveLoadContext `yaml:"default"`
	} `yaml:"cognitive_load"`
	ComplexityThresholds struct {
		VeryHigh           int `yaml:"very_high"`            // Output lines threshold for complexity level 5
		High               int `yaml:"high"`                 // Output lines threshold for complexity level 4
		Medium             int `yaml:"medium"`               // Output lines threshold for complexity level 3
		ErrorCountHigh     int `yaml:"error_count_high"`     // Error count threshold for high cognitive load
		WarningCountMedium int `yaml:"warning_count_medium"` // Warning count threshold for medium cognitive load
	} `yaml:"complexity_thresholds"`
}

Config holds all resolved design system settings for rendering.

func ASCIIMinimalTheme

func ASCIIMinimalTheme() *Config

func DeepCopyConfig

func DeepCopyConfig(original *Config) *Config

DeepCopyConfig creates a deep copy of the Config using JSON marshal/unmarshal. This automatically handles all fields, preventing bugs when new fields are added. The small overhead of JSON encoding is acceptable since this is not in a hot path.

func DefaultConfig

func DefaultConfig() *Config

func NoColorConfig

func NoColorConfig() *Config

func UnicodeVibrantTheme

func UnicodeVibrantTheme() *Config

func (*Config) GetColor

func (c *Config) GetColor(colorKeyOrName string, elementName ...string) string

func (*Config) GetColorObj

func (c *Config) GetColorObj(colorKeyOrName string) Color

GetColorObj returns a Color wrapper for the given color key. This provides a safer interface for color handling with automatic reset. Example: cfg.GetColorObj("Error").Sprint("Error message").

func (*Config) GetElementStyle

func (c *Config) GetElementStyle(elementName string) ElementStyleDef

func (*Config) GetIcon

func (c *Config) GetIcon(iconKey string) string

func (*Config) GetIndentation

func (c *Config) GetIndentation(level int) string

func (*Config) ResetColor

func (c *Config) ResetColor() string

type DensityMode

type DensityMode string

DensityMode controls the space-efficiency of pattern rendering. Based on Tufte's data-ink ratio principle: maximize information per line.

const (
	// DensityDetailed shows one item per line with full context (current default).
	DensityDetailed DensityMode = "detailed"

	// DensityBalanced shows 2 columns where appropriate.
	DensityBalanced DensityMode = "balanced"

	// DensityCompact shows 3 columns with minimal spacing.
	DensityCompact DensityMode = "compact"
)

type ElementStyleDef

type ElementStyleDef struct {
	Text             string   `yaml:"text,omitempty"`
	Prefix           string   `yaml:"prefix,omitempty"`
	Suffix           string   `yaml:"suffix,omitempty"`
	TextContent      string   `yaml:"text_content,omitempty"`
	TextCase         string   `yaml:"text_case,omitempty"`
	TextStyle        []string `yaml:"text_style,omitempty"`
	ColorFG          string   `yaml:"color_fg,omitempty"`
	ColorBG          string   `yaml:"color_bg,omitempty"`
	IconKey          string   `yaml:"icon_key,omitempty"`
	BulletChar       string   `yaml:"bullet_char,omitempty"`
	LineChar         string   `yaml:"line_char,omitempty"`
	LineLengthType   string   `yaml:"line_length_type,omitempty"`
	FramingCharStart string   `yaml:"framing_char_start,omitempty"`
	FramingCharEnd   string   `yaml:"framing_char_end,omitempty"`
	AdditionalChars  string   `yaml:"additional_chars,omitempty"`
	DateTimeFormat   string   `yaml:"date_time_format,omitempty"`
}

ElementStyleDef defines visual styling properties for a specific UI element.

type InlineProgress

type InlineProgress struct {
	Task         *Task
	Writer       io.Writer // Output writer for progress messages (defaults to os.Stdout)
	IsActive     bool
	SpinnerIndex int
	StartTime    time.Time

	Debug bool
	// contains filtered or unexported fields
}

InlineProgress tracks and renders task progress with in-place updates.

func NewInlineProgress

func NewInlineProgress(task *Task, debugMode bool, writer io.Writer) *InlineProgress

NewInlineProgress creates a progress tracker for a task. The writer parameter specifies where progress output should be written; if nil, defaults to os.Stdout. This allows embedding applications to capture or redirect progress output.

func (*InlineProgress) Complete

func (p *InlineProgress) Complete(status string)

Complete marks the progress as complete and renders final state. Note: Cursor restoration is now handled at the console level via defer for better crash recovery (see mageconsole/console.go runContext).

func (*InlineProgress) RenderProgress

func (p *InlineProgress) RenderProgress(status string)

RenderProgress updates the terminal with the current progress state.

func (*InlineProgress) Start

func (p *InlineProgress) Start(ctx context.Context, enableSpinner bool)

Start begins progress tracking and renders initial state. Note: Cursor hiding is now handled at the console level for better restoration guarantees (see mageconsole/console.go runContext).

type Inventory

type Inventory struct {
	Label string          // Title for the inventory
	Items []InventoryItem // Items in the inventory
}

Inventory represents a list of generated artifacts or files. Useful for showing build outputs, generated files, or deployment artifacts.

func (*Inventory) PatternType

func (i *Inventory) PatternType() PatternType

PatternType implements the Pattern interface.

func (*Inventory) Render

func (i *Inventory) Render(cfg *Config) string

Render creates the inventory visualization.

type InventoryItem

type InventoryItem struct {
	Name string // File or artifact name
	Size string // Formatted size (e.g., "2.3MB", "450KB")
	Path string // Optional: full path or additional context
}

InventoryItem represents a single file or artifact.

type JSONMetadata

type JSONMetadata struct {
	ExitCode       int       `json:"exit_code"`
	Duration       string    `json:"duration"`
	DurationMs     int64     `json:"duration_ms"`
	StartTime      time.Time `json:"start_time"`
	EndTime        time.Time `json:"end_time"`
	Command        string    `json:"command,omitempty"`
	Args           []string  `json:"args,omitempty"`
	Label          string    `json:"label,omitempty"`
	Classification string    `json:"classification,omitempty"`
}

JSONMetadata contains metadata about the command execution and pattern.

type JSONOutput

type JSONOutput struct {
	Version     string                 `json:"version"`
	PatternType string                 `json:"pattern_type"`
	Metadata    JSONMetadata           `json:"metadata"`
	Data        map[string]interface{} `json:"data"`
}

JSONOutput represents the structured JSON output format for AI/automation consumption.

type Leaderboard

type Leaderboard struct {
	Label      string            // Title for the leaderboard (e.g., "Slowest Tests")
	MetricName string            // Name of the metric being ranked (e.g., "Duration", "Size", "Warnings")
	Items      []LeaderboardItem // Ranked items
	Direction  string            // "highest" or "lowest" - what's being shown
	TotalCount int               // Total items before filtering to top N
	ShowRank   bool              // Whether to show rank numbers
}

Leaderboard represents a ranked list of items sorted by a specific metric. Shows only the top/bottom N items to highlight optimization targets or achievements.

Use cases:

  • Slowest N tests (optimization targets)
  • Largest N binaries (size analysis)
  • Files with most linting warnings (quality hotspots)
  • Packages with lowest coverage (test gap identification)
  • Top contributors by commits

func (*Leaderboard) PatternType

func (l *Leaderboard) PatternType() PatternType

PatternType implements the Pattern interface.

func (*Leaderboard) Render

func (l *Leaderboard) Render(cfg *Config) string

Render creates the leaderboard visualization.

type LeaderboardItem

type LeaderboardItem struct {
	Name    string  // Item name (e.g., test name, file name, package name)
	Metric  string  // Formatted metric value (e.g., "2.3s", "45MB", "12 warnings")
	Value   float64 // Numeric value for ranking/comparison
	Rank    int     // Position in ranking (1-based)
	Context string  // Additional context or details
}

LeaderboardItem represents a single entry in a leaderboard.

type LineContext

type LineContext struct {
	// CognitiveLoad at the point this line is processed/displayed.
	CognitiveLoad CognitiveLoadContext
	// Importance rating (1-5) for prioritization in display or summary.
	Importance int
	// IsHighlighted indicates if the line should receive special emphasis.
	IsHighlighted bool
	// IsSummary indicates if this line is part of a generated summary.
	IsSummary bool
	// IsInternal indicates if this error originated from fo itself (not the wrapped command).
	IsInternal bool
}

LineContext holds information about the context of an individual output line used for fine-grained styling decisions.

type OutputLine

type OutputLine struct {
	// Content and metadata
	Content     string
	Type        string // "detail", "error", "warning", "success", "info", "progress"
	Timestamp   time.Time
	Indentation int

	// Context for cognitive load-based formatting
	Context LineContext
}

OutputLine represents a classified line of command output.

type Pattern

type Pattern interface {
	// Render returns the formatted string representation of the pattern
	// using the provided theme configuration.
	// The Config parameter controls visual presentation (colors, icons, density, etc.)
	// while the pattern itself controls semantic content (data, structure, meaning).
	Render(cfg *Config) string

	// PatternType returns the standard type identifier for this pattern.
	// This enables type-based routing, validation, and theme selection.
	PatternType() PatternType
}

Pattern is the interface that all output patterns implement. Patterns represent different ways of visualizing command output data.

Contract:

  • Patterns are semantic: they represent what to show, not how to show it
  • Patterns are theme-independent: the same pattern can be rendered with different themes
  • Patterns are composable: multiple patterns can be combined to create dashboards
  • Patterns implement Render() which takes a Config (theme) and returns formatted output

type PatternMatcher

type PatternMatcher struct {
	Config *Config
	// contains filtered or unexported fields
}

PatternMatcher provides intelligent pattern detection for commands and output.

func NewPatternMatcher

func NewPatternMatcher(config *Config) *PatternMatcher

NewPatternMatcher creates a pattern matcher with the given configuration. All regex patterns are precompiled at initialization time for performance.

func (*PatternMatcher) ClassifyOutputLine

func (pm *PatternMatcher) ClassifyOutputLine(line, cmd string, args []string) (string, LineContext)

ClassifyOutputLine determines the type of an output line. Uses fast-path string prefix checks before falling back to regex patterns for performance. When multiple patterns match, the category with the highest accumulated score wins.

func (*PatternMatcher) DetectCommandIntent

func (pm *PatternMatcher) DetectCommandIntent(cmd string, args []string) string

DetectCommandIntent identifies the purpose of a command.

func (*PatternMatcher) DetermineCognitiveLoad

func (pm *PatternMatcher) DetermineCognitiveLoad(lines []OutputLine) CognitiveLoadContext

DetermineCognitiveLoad analyzes output to determine overall cognitive load.

func (*PatternMatcher) FindSimilarLines

func (pm *PatternMatcher) FindSimilarLines(lines []OutputLine) map[string][]OutputLine

FindSimilarLines groups similar output lines for summarization.

type PatternType

type PatternType string

PatternType represents the six standard semantic pattern types in the design system. These types map semantic meaning (what to show) to visual presentation (how to show it).

const (
	// PatternTypeSparkline represents word-sized trend graphics using Unicode blocks.
	// Use for: test duration trends, coverage changes, build size progression, error count trends.
	PatternTypeSparkline PatternType = "sparkline"

	// PatternTypeLeaderboard represents ranked lists showing top/bottom N items by metric.
	// Use for: slowest tests, largest binaries, files with most warnings, packages with lowest coverage.
	PatternTypeLeaderboard PatternType = "leaderboard"

	// PatternTypeTestTable represents comprehensive test results with status and timing.
	// Use for: complete test suite results, package-level test summaries.
	PatternTypeTestTable PatternType = "test-table"

	// PatternTypeSummary represents high-level summaries with key metrics and counts.
	// Use for: at-a-glance understanding of overall results, rollup statistics.
	PatternTypeSummary PatternType = "summary"

	// PatternTypeComparison represents before/after comparisons of metrics.
	// Use for: showing changes over time, version comparisons, delta analysis.
	PatternTypeComparison PatternType = "comparison"

	// PatternTypeInventory represents lists of generated artifacts or files.
	// Use for: build outputs, generated files, deployment artifacts, file listings.
	PatternTypeInventory PatternType = "inventory"
)

func AllPatternTypes

func AllPatternTypes() []PatternType

AllPatternTypes returns all six standard pattern types.

type PatternsRepo

type PatternsRepo struct {
	Intent map[string][]string `yaml:"intent"`
	Output map[string][]string `yaml:"output"`
}

type Sparkline

type Sparkline struct {
	Label  string    // Label for the sparkline (e.g., "Build time trend")
	Values []float64 // Data points to visualize
	Min    float64   // Optional: explicit minimum for scale (0 = auto-detect)
	Max    float64   // Optional: explicit maximum for scale (0 = auto-detect)
	Unit   string    // Optional: unit suffix (e.g., "ms", "%", "MB")
}

Sparkline represents a word-sized graphic showing trends using Unicode blocks. Inspired by Tufte's sparklines - intense, simple, word-sized graphics.

Use cases:

  • Test duration trends over last N runs
  • Coverage percentage changes
  • Build size progression
  • Error count trends

func (*Sparkline) PatternType

func (s *Sparkline) PatternType() PatternType

PatternType implements the Pattern interface.

func (*Sparkline) Render

func (s *Sparkline) Render(cfg *Config) string

Render creates the sparkline visualization using Unicode block elements. Uses ▁▂▃▄▅▆▇█ for value representation.

type Summary

type Summary struct {
	Label   string        // Title for the summary
	Metrics []SummaryItem // Metrics to display
}

Summary represents a high-level summary with key metrics and counts. Provides at-a-glance understanding of overall results.

func (*Summary) PatternType

func (s *Summary) PatternType() PatternType

PatternType implements the Pattern interface.

func (*Summary) Render

func (s *Summary) Render(cfg *Config) string

Render creates the summary visualization.

type SummaryItem

type SummaryItem struct {
	Label string // Metric label (e.g., "Total Tests", "Passed", "Failed")
	Value string // Formatted value (e.g., "142", "98.5%")
	Type  string // "success", "error", "warning", "info" - affects coloring
}

SummaryItem represents a single summary metric.

type Task

type Task struct {
	// Core properties
	Label     string
	Intent    string
	Command   string
	Args      []string
	StartTime time.Time
	EndTime   time.Time
	Duration  time.Duration
	ExitCode  int
	Status    string // "running", "success", "warning", "error"

	// Output content
	OutputLines []OutputLine

	// Configuration and context
	Config  *Config
	Context TaskContext
	// contains filtered or unexported fields
}

Task represents a command execution as a visual task with formatted output.

func NewTask

func NewTask(label, intent, command string, args []string, config *Config) *Task

NewTask creates and initializes a new Task.

func (*Task) AddOutputLine

func (t *Task) AddOutputLine(content, lineType string, context LineContext)

AddOutputLine appends a new classified output line to the task's OutputLines. This method is thread-safe due to the use of outputLock.

func (*Task) Complete

func (t *Task) Complete(exitCode int)

Complete finalizes the task's status based on its exit code and output analysis. This should be called after all output has been processed.

func (*Task) OutputLinesLock

func (t *Task) OutputLinesLock()

OutputLinesLock provides external access to lock the task's outputLock. This is used by cmd/main.go to synchronize reading of OutputLines when rendering.

func (*Task) OutputLinesUnlock

func (t *Task) OutputLinesUnlock()

OutputLinesUnlock provides external access to unlock the task's outputLock.

func (*Task) RenderEndLine

func (t *Task) RenderEndLine() string

RenderEndLine returns the formatted end line for the task.

func (*Task) RenderOutputLine

func (t *Task) RenderOutputLine(line OutputLine) string

func (*Task) RenderStartLine

func (t *Task) RenderStartLine() string

RenderStartLine returns the formatted start line for the task.

func (*Task) RenderSummary

func (t *Task) RenderSummary() string

func (*Task) UpdateTaskContext

func (t *Task) UpdateTaskContext()

UpdateTaskContext heuristically adjusts the task's cognitive load and complexity based on the analysis of its output lines. This method is thread-safe.

type TaskContext

type TaskContext struct {
	// CognitiveLoad determines styling based on research (e.g., simplify for high load).
	CognitiveLoad CognitiveLoadContext

	// IsDetailView indicates if a detailed view is active, affecting verbosity.
	IsDetailView bool
	// Complexity is a heuristic (1-5) of the task's output or nature.
	Complexity int
}

TaskContext holds information about the cognitive context of the task (e.g., complexity, user's likely cognitive load).

type TestTable

type TestTable struct {
	Label   string          // Title for the test table
	Results []TestTableItem // Test results to display
	Density DensityMode     // Rendering density (detailed, balanced, compact)
}

TestTable represents a table of test results showing packages/tests with status and timing. Provides a comprehensive view of all test outcomes.

func (*TestTable) PatternType

func (t *TestTable) PatternType() PatternType

PatternType implements the Pattern interface.

func (*TestTable) Render

func (t *TestTable) Render(cfg *Config) string

Render creates the test table visualization. Supports different density modes for space-efficient rendering.

type TestTableItem

type TestTableItem struct {
	Name     string // Test or package name
	Status   string // "pass", "fail", "skip"
	Duration string // Formatted duration
	Count    int    // Number of tests (for package-level results)
	Details  string // Additional details or error message
}

TestTableItem represents a single test result entry.

type ToolConfig

type ToolConfig struct {
	Label          string              `yaml:"label,omitempty"`
	Intent         string              `yaml:"intent,omitempty"`
	OutputPatterns map[string][]string `yaml:"output_patterns,omitempty"`
}

ToolConfig defines specific settings for a command/tool preset for design purposes.

Jump to

Keyboard shortcuts

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