claude

package
v0.47.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package claude provides Claude Code integration for Hive. It combines fork functionality and analytics in a single plugin.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectClaudeSessionID

func DetectClaudeSessionID(projectPath string) string

DetectClaudeSessionID attempts to find the most recent session ID for a project. Returns empty string if no session found.

func GetClaudeJSONLPath

func GetClaudeJSONLPath(projectPath, claudeSessionID string) string

GetClaudeJSONLPath resolves the JSONL file path for a Claude session.

Types

type Plugin

type Plugin struct {
	// contains filtered or unexported fields
}

Plugin implements Claude Code integration (fork + analytics).

func New

func New(cfg config.ClaudePluginConfig, kvStore kv.KV) *Plugin

New creates a new claude plugin.

func (*Plugin) Available

func (p *Plugin) Available() bool

func (*Plugin) Close

func (p *Plugin) Close() error

func (*Plugin) Commands

func (p *Plugin) Commands() map[string]config.UserCommand

func (*Plugin) Init

func (p *Plugin) Init(_ context.Context) error

func (*Plugin) Name

func (p *Plugin) Name() string

func (*Plugin) RefreshStatus

func (p *Plugin) RefreshStatus(ctx context.Context, sessions []*session.Session, pool *plugins.WorkerPool) (map[string]plugins.Status, error)

RefreshStatus implements plugins.StatusProvider

func (*Plugin) StatusCacheDuration

func (p *Plugin) StatusCacheDuration() time.Duration

func (*Plugin) StatusProvider

func (p *Plugin) StatusProvider() plugins.StatusProvider

type SessionAnalytics

type SessionAnalytics struct {
	CurrentContextTokens int           // Last turn's input + cache read
	InputTokens          int           // Cumulative input
	OutputTokens         int           // Cumulative output
	CacheReadTokens      int           // Cumulative cache reads
	CacheWriteTokens     int           // Cumulative cache writes
	TotalTurns           int           // Number of turns
	Duration             time.Duration // Session duration
	ToolCalls            []ToolCall    // Tool usage counts
}

SessionAnalytics represents parsed Claude session data.

func ParseSessionJSONL

func ParseSessionJSONL(path string) (*SessionAnalytics, error)

ParseSessionJSONL parses a Claude JSONL file and extracts analytics.

func (*SessionAnalytics) ContextPercent

func (a *SessionAnalytics) ContextPercent(modelLimit int) float64

ContextPercent calculates context usage as percentage of model limit.

type ToolCall

type ToolCall struct {
	Name  string
	Count int
}

ToolCall represents a tool and its usage count.

Jump to

Keyboard shortcuts

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