Documentation
¶
Index ¶
- func Cleanup(days int) error
- func CountTokens(s string) int
- func DeleteCommand(cmd string) error
- func FormatGain(s Stats) string
- func FormatHistory(records []Record) string
- func FormatSummary(summaries []CommandSummary) string
- func FormatUnchopped(summaries []UnchoppedSummary, skipped []string, filtered []UnchoppedSummary, ...) string
- func GetSkippedCommands() ([]string, error)
- func Init() error
- func SkipUnchopped(cmd string) error
- func Track(command string, rawTokens, filteredTokens int) error
- func UnskipUnchopped(cmd string) error
- type CommandSummary
- type Record
- type Stats
- type UnchoppedSummary
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CountTokens ¶
CountTokens returns the word count of a string (whitespace-split).
func DeleteCommand ¶ added in v1.5.0
DeleteCommand removes all tracking records for a command key (first two words). This permanently erases the command from the history and unchopped report.
func FormatHistory ¶
FormatHistory formats history records for display.
func FormatSummary ¶ added in v0.5.1
func FormatSummary(summaries []CommandSummary) string
FormatSummary formats per-command aggregates.
func FormatUnchopped ¶ added in v1.4.0
func FormatUnchopped(summaries []UnchoppedSummary, skipped []string, filtered []UnchoppedSummary, verbose bool) string
FormatUnchopped formats the unchopped commands report. summaries are active candidates; skipped are manually skipped commands; filtered are commands auto-excluded because a registered filter exists for them. verbose disables command name truncation.
func GetSkippedCommands ¶ added in v1.5.0
GetSkippedCommands returns all commands in the skip list, ordered alphabetically.
func Init ¶
func Init() error
Init opens (or creates) the tracking database and ensures the schema exists.
func SkipUnchopped ¶ added in v1.5.0
SkipUnchopped marks a command as intentionally not needing a filter.
func UnskipUnchopped ¶ added in v1.5.0
UnskipUnchopped removes a command from the skip list.
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 ¶
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
WeekCommands int
WeekSavedTokens int
MonthCommands int
MonthSavedTokens int
YearCommands int
YearSavedTokens int
}
Stats holds aggregate token savings statistics.
type UnchoppedSummary ¶ added in v1.4.0
type UnchoppedSummary struct {
Command string
Count int
TotalTokens int // total raw tokens that could have been saved
}
UnchoppedSummary holds stats for commands that consistently get 0% savings.
func GetUnchopped ¶ added in v1.4.0
func GetUnchopped() ([]UnchoppedSummary, error)
GetUnchopped returns commands that always got 0% savings, sorted by call count desc. These are the best candidates for writing new filters.