Documentation
¶
Index ¶
- func Aggregate(sessions []*SessionData, projectRoot string) *types.UsageInsights
- func AnalyzeUsage(ctx context.Context, projectPath string, opts Options) (*types.UsageInsights, error)
- func ClaudeProjectsDir() string
- func DiscoverProjectDir(absPath string) string
- func DiscoverSessions(projectDir string, since time.Time) ([]string, error)
- func DiscoverSubagents(projectDir, sessionID string) ([]string, error)
- func EncodeProjectPath(absPath string) string
- type Options
- type ParseOptions
- type SessionData
- type TokenRecord
- type ToolEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Aggregate ¶
func Aggregate(sessions []*SessionData, projectRoot string) *types.UsageInsights
Aggregate combines parsed session data into UsageInsights
func AnalyzeUsage ¶
func AnalyzeUsage(ctx context.Context, projectPath string, opts Options) (*types.UsageInsights, error)
AnalyzeUsage discovers and parses Claude Code session logs for a project, returning aggregated usage insights.
func ClaudeProjectsDir ¶
func ClaudeProjectsDir() string
ClaudeProjectsDir returns the base directory for Claude Code project logs
func DiscoverProjectDir ¶
DiscoverProjectDir finds the Claude Code project directory for a given project path. Returns the full path to the directory under ~/.claude/projects/, or empty string if not found.
func DiscoverSessions ¶
DiscoverSessions lists JSONL session files in a Claude project directory. If since is non-zero, only files modified after that time are returned.
func DiscoverSubagents ¶
DiscoverSubagents lists subagent JSONL files for a given session. Session directories are named by UUID and contain a subagents/ subdirectory.
func EncodeProjectPath ¶
EncodeProjectPath converts an absolute project path to Claude's encoded directory name. Claude Code encodes paths by replacing "/" and "." with "-": /Users/foo.bar/project → -Users-foo-bar-project
Types ¶
type ParseOptions ¶
ParseOptions controls parsing behavior
type SessionData ¶
type SessionData struct {
ID string
ToolEvents []ToolEvent
TokenStats []TokenRecord
TurnCount int
StartTime time.Time
EndTime time.Time
}
SessionData holds parsed data from a single JSONL session file
func ParseSession ¶
func ParseSession(ctx context.Context, path string, opts ParseOptions) (*SessionData, error)
ParseSession parses a single JSONL session file and extracts usage data. It streams the file line-by-line to handle large files efficiently.