summary

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EstimateTokens

func EstimateTokens(bytes int64) int64

EstimateTokens provides a rough estimate of token count from byte size Using the cl100k_base tokenizer approximation (GPT-4) This is a very rough estimate: ~1 token per 4 bytes for code

func Print

func Print(w io.Writer, stats Stats, opts Options) error

Print outputs the summary using the specified formatter

Types

type BarFormatter

type BarFormatter struct {
	NoColor bool
	NoEmoji bool
}

BarFormatter formats summaries with visual progress bars for TTY environments

func NewBarFormatter

func NewBarFormatter() *BarFormatter

NewBarFormatter creates a new bar formatter

func (*BarFormatter) Format

func (f *BarFormatter) Format(w io.Writer, stats Stats) error

Format outputs a visually appealing summary with progress bar

type CIFormatter

type CIFormatter struct{}

CIFormatter formats summaries for CI/pipeline environments

func NewCIFormatter

func NewCIFormatter() *CIFormatter

NewCIFormatter creates a new CI formatter

func (*CIFormatter) Format

func (f *CIFormatter) Format(w io.Writer, stats Stats) error

Format outputs a clean, parseable summary line for CI environments

type DashboardFormatter

type DashboardFormatter struct {
	NoEmoji bool
}

DashboardFormatter formats summaries as a speedometer dashboard

func NewDashboardFormatter

func NewDashboardFormatter() *DashboardFormatter

NewDashboardFormatter creates a new dashboard formatter

func (*DashboardFormatter) Format

func (f *DashboardFormatter) Format(w io.Writer, stats Stats) error

Format outputs a speedometer dashboard style summary

type Formatter

type Formatter interface {
	Format(w io.Writer, stats Stats) error
}

Formatter defines the interface for summary formatters

func GetFormatter

func GetFormatter(opts Options) Formatter

GetFormatter returns the appropriate formatter based on options and environment

type JSONFormatter

type JSONFormatter struct{}

JSONFormatter formats summaries as JSON for machine processing

func NewJSONFormatter

func NewJSONFormatter() *JSONFormatter

NewJSONFormatter creates a new JSON formatter

func (*JSONFormatter) Format

func (f *JSONFormatter) Format(w io.Writer, stats Stats) error

Format outputs the summary as JSON

type JSONOutput

type JSONOutput struct {
	OriginalBytes   int64   `json:"original_bytes"`
	DistilledBytes  int64   `json:"distilled_bytes"`
	SavingsPercent  float64 `json:"savings_pct"`
	DurationMS      int64   `json:"duration_ms"`
	TokensBefore    int64   `json:"tokens_before,omitempty"`
	TokensAfter     int64   `json:"tokens_after,omitempty"`
	TokensSaved     int64   `json:"tokens_saved,omitempty"`
	TokenSavingsPct float64 `json:"token_savings_pct,omitempty"`
	FileCount       int     `json:"file_count"`
	OutputPath      string  `json:"output_path,omitempty"`
	Tokenizer       string  `json:"tokenizer,omitempty"`
}

JSONOutput represents the JSON structure for summary output

type Options

type Options struct {
	Format  string // "auto", "ci", "bar", "json", "off"
	NoColor bool
	NoEmoji bool
}

Options configures summary output behavior

type SparklineFormatter

type SparklineFormatter struct {
	NoEmoji bool
}

SparklineFormatter formats summaries in minimalist sparkline style

func NewSparklineFormatter

func NewSparklineFormatter() *SparklineFormatter

NewSparklineFormatter creates a new sparkline formatter

func (*SparklineFormatter) Format

func (f *SparklineFormatter) Format(w io.Writer, stats Stats) error

Format outputs a minimalist sparkline style summary

type Stats

type Stats struct {
	OriginalBytes   int64
	DistilledBytes  int64
	OriginalTokens  int64
	DistilledTokens int64
	Duration        time.Duration
	FileCount       int
	OutputPath      string
	IsStdout        bool
}

Stats holds the statistics for a distillation operation

type TickerFormatter

type TickerFormatter struct {
	NoEmoji bool
}

TickerFormatter formats summaries in stock ticker style

func NewTickerFormatter

func NewTickerFormatter() *TickerFormatter

NewTickerFormatter creates a new ticker formatter

func (*TickerFormatter) Format

func (f *TickerFormatter) Format(w io.Writer, stats Stats) error

Format outputs a stock ticker style summary

Jump to

Keyboard shortcuts

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