Documentation
ΒΆ
Index ΒΆ
- Constants
- Variables
- func FormatDuration(d time.Duration) string
- func FormatSize(bytes int64) string
- func FormatSkillSummary(info *SkillResultInfo) string
- func GetProgressMessage(toolName string, args string) string
- func RenderCompactHeader(meta ResultMetadata) string
- func RenderCompactResult(result ToolResult) string
- func RenderErrorHeader(toolName, errorMsg string, width int) string
- func RenderFileList(files []string, maxShow int) string
- func RenderGrepResults(lines []ContentLine, maxShow int) string
- func RenderHeader(meta ResultMetadata, width int) string
- func RenderLines(lines []ContentLine, showLineNo bool) string
- func RenderProgress(spinnerFrame string, message string) string
- func RenderToolResult(result ToolResult, width int) string
- func TruncateText(text string, maxLen int) string
- type ContentLine
- type LineType
- type ResultMetadata
- type SkillResultInfo
- type ToolResult
Constants ΒΆ
const ( IconRead = "\U0001F4C4" // π IconGlob = "\U0001F50D" // π IconGrep = "\U0001F50E" // π IconWeb = "\U0001F310" // π IconSearch = "\U0001F50D" // π (web search) IconError = "\u274C" // β IconSuccess = "\u2713" // β IconFile = "\U0001F4C1" // π IconDuration = "\u23F1" // β± )
Icons
const MaxLineLength = 500
MaxLineLength is the maximum length of a content line
Variables ΒΆ
var ( ColorSuccess = lipgloss.Color("#10B981") // green ColorError = lipgloss.Color("#EF4444") // red ColorMuted = lipgloss.Color("#6B7280") // gray ColorAccent = lipgloss.Color("#60A5FA") // blue ColorWarn = lipgloss.Color("#F59E0B") // yellow ColorMatch = lipgloss.Color("#FBBF24") // yellow (highlight match) ColorBorder = lipgloss.Color("#374151") // dark gray for borders )
Colors
var ( // Header box styles HeaderStyle = lipgloss.NewStyle(). BorderStyle(lipgloss.RoundedBorder()). BorderForeground(ColorBorder). Padding(0, 1) HeaderTitleStyle = lipgloss.NewStyle(). Bold(true). Foreground(ColorAccent) HeaderSubtitleStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("#E5E7EB")) HeaderMetaStyle = lipgloss.NewStyle(). Foreground(ColorMuted) // Content styles LineNumberStyle = lipgloss.NewStyle(). Foreground(ColorMuted). Width(5). Align(lipgloss.Right) LineContentStyle = lipgloss.NewStyle() MatchStyle = lipgloss.NewStyle(). Foreground(ColorMatch). Bold(true) FilePathStyle = lipgloss.NewStyle(). Foreground(ColorAccent) TruncatedStyle = lipgloss.NewStyle(). Foreground(ColorMuted). Italic(true) // Error styles ErrorStyle = lipgloss.NewStyle(). Foreground(ColorError) ErrorMsgStyle = lipgloss.NewStyle(). Foreground(lipgloss.Color("#FCA5A5")) // Progress styles SpinnerStyle = lipgloss.NewStyle(). Foreground(ColorWarn) ProgressMsgStyle = lipgloss.NewStyle(). Foreground(ColorMuted) )
Styles
var SpinnerFrames = []string{"β ", "β ", "β Ή", "β Έ", "β Ό", "β ΄", "β ¦", "β §", "β ", "β "}
SpinnerFrames contains the spinner animation frames
Functions ΒΆ
func FormatDuration ΒΆ
FormatDuration formats duration to human readable string
func FormatSize ΒΆ
FormatSize formats bytes to human readable size
func FormatSkillSummary ΒΆ added in v1.2.0
func FormatSkillSummary(info *SkillResultInfo) string
FormatSkillSummary formats the skill result summary for display
Examples:
Loaded: git:commit [2 scripts, 1 ref] Loaded: pdf [3 scripts] Loaded: my-skill
func GetProgressMessage ΒΆ
GetProgressMessage returns the appropriate progress message for a tool
func RenderCompactHeader ΒΆ
func RenderCompactHeader(meta ResultMetadata) string
RenderCompactHeader renders a single-line header for compact display π Read: /path/to/file.go (2.4 KB Β· 85 lines Β· 12ms)
func RenderCompactResult ΒΆ
func RenderCompactResult(result ToolResult) string
RenderCompactResult renders a compact single-line result
func RenderErrorHeader ΒΆ
RenderErrorHeader renders an error header box ββ Read βββββββββββββββββββββββββββββββββββββββ β β Error β β file not found: /path/to/missing.go β βββββββββββββββββββββββββββββββββββββββββββββββ
func RenderGrepResults ΒΆ
func RenderGrepResults(lines []ContentLine, maxShow int) string
RenderGrepResults renders grep search results
main.go:42: // TODO: fix this utils.go:15: // TODO: refactor
func RenderHeader ΒΆ
func RenderHeader(meta ResultMetadata, width int) string
RenderHeader renders the tool header box ββ Read βββββββββββββββββββββββββββββββββββββββ β π /path/to/file.go β β 2.4 KB Β· 85 lines Β· 12ms β βββββββββββββββββββββββββββββββββββββββββββββββ
func RenderLines ΒΆ
func RenderLines(lines []ContentLine, showLineNo bool) string
RenderLines renders content lines with optional line numbers
1βpackage main 2β 3βimport "fmt"
func RenderProgress ΒΆ
RenderProgress renders an in-progress state β Reading file... β Searching 42 files... β Ή Fetching https://example.com...
func RenderToolResult ΒΆ
func RenderToolResult(result ToolResult, width int) string
RenderToolResult renders a complete tool result with header and content
func TruncateText ΒΆ
TruncateText truncates text to maxLen with ellipsis
Types ΒΆ
type ContentLine ΒΆ
type ContentLine struct {
LineNo int // Line number (0 means no line number)
Text string // Line content
Type LineType // Line type
File string // File path (for grep results)
}
ContentLine represents a formatted content line
type ResultMetadata ΒΆ
type ResultMetadata struct {
Title string // Tool name
Icon string // Tool icon
Subtitle string // Short description (e.g., file path)
Size int64 // File/content size in bytes
Duration time.Duration // Execution duration
LineCount int // Number of lines
ItemCount int // Number of items (files/matches)
StatusCode int // HTTP status code (WebFetch)
Truncated bool // Whether output was truncated
}
ResultMetadata contains metadata about tool execution result
type SkillResultInfo ΒΆ added in v1.2.0
type SkillResultInfo struct {
SkillName string // Full skill name (namespace:name)
ScriptCount int // Number of scripts in skill
RefCount int // Number of reference files
}
SkillResultInfo contains skill-specific result metadata for custom rendering
type ToolResult ΒΆ
type ToolResult struct {
Success bool // Whether the tool succeeded
Output string // Main output content
Error string // Error message if failed
Metadata ResultMetadata // Result metadata
Lines []ContentLine // Formatted content lines (optional)
Files []string // File list (for Glob)
SkillInfo *SkillResultInfo // Skill-specific info (for Skill tool)
}
ToolResult represents the result of a tool execution
func NewErrorResult ΒΆ
func NewErrorResult(title, errorMsg string) ToolResult
NewErrorResult creates an error result
func NewSuccessResult ΒΆ
func NewSuccessResult(title, icon, subtitle string, size int64, lineCount, itemCount int, duration time.Duration) ToolResult
NewSuccessResult creates a success result with metadata
func (ToolResult) FormatForLLM ΒΆ
func (r ToolResult) FormatForLLM() string
FormatForLLM returns a plain text representation of the result for LLM consumption