Documentation
¶
Overview ¶
Package stats keeps an opt-in, local-only usage log. Nothing here touches the network. It records bytes/4 token estimates, never file contents.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Enabled ¶
Enabled reports whether logging is on: STACKLIT_STATS=1 or "stats": true in .stacklitrc.json. Default off.
func Record ¶
func Record(root, cmd, output string)
Record appends one entry when logging is enabled. Errors are swallowed: statistics must never break a command.
func ReplacedEstimate ¶
ReplacedEstimate sums the sizes of existing files under root that text mentions by path, as tokens, and returns how many files matched.
Types ¶
type CmdTotals ¶
type CmdTotals struct {
Cmd string `json:"cmd"`
Calls int `json:"calls"`
Served int `json:"served"`
ReplacedEst int `json:"replaced_est"`
}
CmdTotals aggregates one command.
type Entry ¶
type Entry struct {
TS string `json:"ts"`
Cmd string `json:"cmd"`
Repo string `json:"repo,omitempty"` // base name only, never a full path
// Served is the estimated tokens of the answer (bytes/4).
Served int `json:"served"`
// ReplacedEst estimates the tokens of the whole files the answer pointed
// into. It is an estimate of what reading them would cost, not a
// measurement of what the agent would have done.
ReplacedEst int `json:"replaced_est"`
Files int `json:"files"`
}
Entry is one logged call.