parser

package
v0.8.6 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(opts Options) ([]Record, []Session, []string, error)

Parse reads all JSONL files under ~/.claude/projects and returns deduplicated records and sessions.

Types

type Entry

type Entry struct {
	Type      string  `json:"type"`
	Timestamp string  `json:"timestamp"`
	CWD       string  `json:"cwd"`
	Message   Message `json:"message"`
}

type Message

type Message struct {
	ID    string `json:"id"`
	Model string `json:"model"`
	Usage Usage  `json:"usage"`
}

type Options

type Options struct {
	Since   time.Time
	Until   time.Time
	Project string // substring match
}

type Record

type Record struct {
	Time       time.Time
	Model      string
	Project    string
	Input      int
	Output     int
	CacheWrite int
	CacheRead  int
}

Record is a deduplicated assistant entry with parsed time.

type Session added in v0.4.0

type Session struct {
	Date     string // YYYY-MM-DD
	Project  string
	Duration time.Duration
}

Session represents time spent in a main session file on a single day. A session spanning multiple days produces one Session per day.

type Usage

type Usage struct {
	InputTokens              int `json:"input_tokens"`
	OutputTokens             int `json:"output_tokens"`
	CacheCreationInputTokens int `json:"cache_creation_input_tokens"`
	CacheReadInputTokens     int `json:"cache_read_input_tokens"`
}

func (Usage) IsZero

func (u Usage) IsZero() bool

Jump to

Keyboard shortcuts

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