claude

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatUsage added in v0.11.0

func FormatUsage(w io.Writer, summary *UsageSummary, now time.Time) error

FormatUsage writes the usage summary to w.

func Install

func Install(w io.Writer, fw FileWriter, personal bool) error

Install writes the Claude Code skill and agent files to disk. When personal is true, files are written under ~/.claude/ instead of .claude/.

func WindowEnd added in v0.11.0

func WindowEnd(start time.Time) time.Time

WindowEnd returns the end of the current 5-hour usage window in UTC.

func WindowStart added in v0.11.0

func WindowStart(now time.Time) time.Time

WindowStart returns the start of the current 5-hour usage window in UTC.

Types

type DirWalker added in v0.11.0

type DirWalker interface {
	WalkJSONL(root string, fn func(line []byte) error) error
}

DirWalker abstracts walking JSONL files for testability.

type FileWriter

type FileWriter interface {
	MkdirAll(path string, perm os.FileMode) error
	WriteFile(name string, data []byte, perm os.FileMode) error
	ReadFile(name string) ([]byte, error)
}

FileWriter abstracts filesystem operations for testability.

type ModelUsage added in v0.11.0

type ModelUsage struct {
	InputTokens  int
	OutputTokens int
	CacheCreate  int
	CacheRead    int
}

ModelUsage holds aggregated token counts for one model class.

type OSDirWalker added in v0.11.0

type OSDirWalker struct{}

OSDirWalker implements DirWalker using the real filesystem.

func (OSDirWalker) WalkJSONL added in v0.11.0

func (OSDirWalker) WalkJSONL(root string, fn func(line []byte) error) error

type OSFileWriter

type OSFileWriter struct{}

OSFileWriter implements FileWriter using the os package.

func (OSFileWriter) MkdirAll

func (OSFileWriter) MkdirAll(path string, perm os.FileMode) error

func (OSFileWriter) ReadFile

func (OSFileWriter) ReadFile(name string) ([]byte, error)

func (OSFileWriter) WriteFile

func (OSFileWriter) WriteFile(name string, data []byte, perm os.FileMode) error

type UsageSummary added in v0.11.0

type UsageSummary struct {
	Models map[string]*ModelUsage
}

UsageSummary holds the full usage breakdown for the current window.

func CalculateUsage added in v0.11.0

func CalculateUsage(walker DirWalker, root string, now time.Time) (*UsageSummary, error)

CalculateUsage scans JSONL files under root and returns usage broken down by model.

Jump to

Keyboard shortcuts

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