tracking

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cleanup

func Cleanup(days int) error

Cleanup removes records older than the given number of days.

func CountTokens

func CountTokens(s string) int

CountTokens returns the word count of a string (whitespace-split).

func FormatGain

func FormatGain(s Stats) string

FormatGain prints the gain summary report.

func FormatHistory

func FormatHistory(records []Record) string

FormatHistory formats history records for display.

func FormatSummary added in v0.5.1

func FormatSummary(summaries []CommandSummary) string

FormatSummary formats per-command aggregates.

func Init

func Init() error

Init opens (or creates) the tracking database and ensures the schema exists.

func Track

func Track(command string, rawTokens, filteredTokens int) error

Track records a command's token savings. Silent on error.

Types

type CommandSummary added in v0.5.1

type CommandSummary struct {
	BaseCommand string
	Count       int
	RawTokens   int
	SavedTokens int
	SavingsPct  float64
	ZeroCount   int // times with 0% savings
}

CommandSummary holds per-command aggregate stats.

func GetCommandSummary added in v0.5.1

func GetCommandSummary() ([]CommandSummary, error)

GetCommandSummary returns per-base-command aggregates, sorted by tokens saved descending.

type Record

type Record struct {
	Timestamp      string
	Command        string
	RawTokens      int
	FilteredTokens int
	SavingsPct     float64
}

Record holds a single tracking entry.

func GetHistory

func GetHistory(limit int) ([]Record, error)

GetHistory returns the last N tracking records in reverse chronological order.

type Stats

type Stats struct {
	TotalCommands     int
	TotalRawTokens    int
	TotalSavedTokens  int
	OverallSavingsPct float64
	TodayCommands     int
	TodaySavedTokens  int
}

Stats holds aggregate token savings statistics.

func GetStats

func GetStats() (Stats, error)

GetStats returns aggregate statistics.

Jump to

Keyboard shortcuts

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