usage

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package usage parses Claude Code JSONL session logs and aggregates token counts. Malformed lines and files degrade gracefully: usage is best-effort, never fatal.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Totals

type Totals struct {
	Input       int
	Output      int
	CacheCreate int
	CacheRead   int
}

Totals holds aggregated token counts across all session logs.

func Aggregate

func Aggregate(configDir string) (Totals, error)

Aggregate walks <configDir>/projects recursively, sums token counts from every *.jsonl file, and returns the combined Totals. A missing projects directory yields zero Totals and a nil error. Individual unreadable files and malformed or usage-less lines are skipped rather than failing the walk.

func (Totals) Total

func (t Totals) Total() int

Total returns the sum of every token bucket.

Jump to

Keyboard shortcuts

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