Documentation
¶
Index ¶
- Variables
- func FormatTimeRemaining(d time.Duration, useDays bool, showMinutes bool) string
- func GetCachedOAuthToken(c cacheInterface) (string, error)
- func GetOAuthToken() (string, error)
- func LevelToBarChar(level int) rune
- func TimeToBarLevel(d time.Duration, maxDuration time.Duration) int
- func TimeUntilReset(resetsAt string) (time.Duration, error)
- func UtilizationToBarLevel(utilization float64) int
- type AndroidPlugin
- type GitPlugin
- type HookContext
- type HookType
- type Hookable
- type KeychainCredentials
- type NativePlugin
- type OAuthCredentials
- type Registry
- func (r *Registry) Get(name string) NativePlugin
- func (r *Registry) GetHookablePlugins() []Hookable
- func (r *Registry) Has(name string) bool
- func (r *Registry) List() []string
- func (r *Registry) Register(p NativePlugin)
- func (r *Registry) RunHooks(ctx context.Context, hookType HookType, hookCtx HookContext) []string
- type TaskQueuePlugin
- type UpdatePlugin
- type UsageBarsPlugin
- type UsageLimit
- type UsagePlugin
- type UsageResponse
- type UsageTextPlugin
Constants ¶
This section is empty.
Variables ¶
var BarChars = []rune{'▁', '▂', '▃', '▄', '▅', '▆', '▇', '█'}
BarChars are the Unicode block elements for bar visualization
Functions ¶
func FormatTimeRemaining ¶ added in v0.4.1
FormatTimeRemaining formats a duration as days or hours (with optional minutes)
func GetCachedOAuthToken ¶ added in v0.4.1
GetCachedOAuthToken retrieves the OAuth token with caching to avoid repeated keychain/filesystem access. Cache TTL is 5 minutes.
func GetOAuthToken ¶ added in v0.4.1
GetOAuthToken retrieves the OAuth access token from the system credential store Supports macOS (Keychain) and Linux (~/.claude/.credentials.json) Note: This is uncached - prefer GetCachedOAuthToken() for repeated calls
func LevelToBarChar ¶ added in v0.4.1
LevelToBarChar converts a bar level (0-7) to the corresponding Unicode character
func TimeToBarLevel ¶ added in v0.4.1
TimeToBarLevel converts time remaining to a bar level (0-7) For 5-hour window: 5h = 7, 0h = 0 For 7-day window: 7d = 7, 0d = 0
func TimeUntilReset ¶ added in v0.4.1
TimeUntilReset calculates the duration until the reset time
func UtilizationToBarLevel ¶ added in v0.4.1
UtilizationToBarLevel converts a utilization percentage (0-100) to a bar level (0-7)
Types ¶
type AndroidPlugin ¶
type AndroidPlugin struct {
// contains filtered or unexported fields
}
AndroidPlugin shows connected Android devices (via adb) Config options:
- display: what to show for each device (default: "serial") Options: serial, model, version, sdk, manufacturer, device, build, arch Combine with colons: "model:version", "device:sdk:build"
- packages: array of package names for version lookup (supports wildcards)
func (*AndroidPlugin) Name ¶
func (p *AndroidPlugin) Name() string
func (*AndroidPlugin) OnHook ¶
func (p *AndroidPlugin) OnHook(ctx context.Context, hookType HookType, hookCtx HookContext) (string, error)
OnHook invalidates cache when Claude becomes idle (fresh data on next render)
func (*AndroidPlugin) SetCache ¶
func (p *AndroidPlugin) SetCache(c *cache.Cache)
type GitPlugin ¶
type GitPlugin struct {
// contains filtered or unexported fields
}
GitPlugin shows git branch and status
type HookContext ¶
type HookContext struct {
SessionID string
AgentType string // Agent type if --agent was specified (e.g., "coder", "researcher")
Config map[string]any // Plugin configuration
}
HookContext provides context for hook handlers
type HookType ¶
type HookType string
HookType represents the type of hook event
const ( // Session lifecycle hooks HookSessionStart HookType = "session_start" // SessionStart - Session started/resumed HookSessionEnd HookType = "session_end" // SessionEnd - Session ending // User interaction hooks HookBusy HookType = "busy" // UserPromptSubmit - User submitted prompt HookIdle HookType = "idle" // Stop - Claude finished responding HookNotification HookType = "notification" // Notification - Claude Code sends a notification HookPermissionRequest HookType = "permission_request" // PermissionRequest - Permission dialog shown // Tool hooks HookPreToolUse HookType = "pre_tool_use" // PreToolUse - Before tool calls (can block) HookPostToolUse HookType = "post_tool_use" // PostToolUse - After tool calls complete // Agent hooks HookSubagentStop HookType = "subagent_stop" // SubagentStop - Subagent task completed // Context management hooks HookPreCompact HookType = "pre_compact" // PreCompact - Before context compaction HookSetup HookType = "setup" // Setup - Repository init/maintenance (--init, --init-only, --maintenance) )
type Hookable ¶
type Hookable interface {
// OnHook is called when a hook event occurs
// Return value is optional output to display (e.g., notifications)
OnHook(ctx context.Context, hookType HookType, hookCtx HookContext) (string, error)
}
Hookable is an optional interface for plugins that want to respond to state changes
type KeychainCredentials ¶ added in v0.4.1
type KeychainCredentials struct {
ClaudeAIOAuth *OAuthCredentials `json:"claudeAiOauth"`
}
KeychainCredentials represents the structure stored in macOS Keychain
type NativePlugin ¶
type NativePlugin interface {
Name() string
Execute(ctx context.Context, input plugin.Input) (string, error)
SetCache(c *cache.Cache)
}
NativePlugin defines the interface for built-in Go plugins
type OAuthCredentials ¶ added in v0.4.1
type OAuthCredentials struct {
AccessToken string `json:"accessToken"`
RefreshToken string `json:"refreshToken"`
ExpiresAt int64 `json:"expiresAt"`
Scopes []string `json:"scopes"`
}
OAuthCredentials holds the OAuth token data
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry holds all available native plugins
func NewRegistry ¶
func NewRegistry() *Registry
NewRegistry creates a new plugin registry with all native plugins
func (*Registry) Get ¶
func (r *Registry) Get(name string) NativePlugin
Get returns a native plugin by name, or nil if not found
func (*Registry) GetHookablePlugins ¶
GetHookablePlugins returns all plugins implementing Hookable
func (*Registry) Register ¶
func (r *Registry) Register(p NativePlugin)
Register adds a plugin to the registry
type TaskQueuePlugin ¶ added in v0.6.0
type TaskQueuePlugin struct {
// contains filtered or unexported fields
}
TaskQueuePlugin displays task queue status from the tq CLI
func (*TaskQueuePlugin) Name ¶ added in v0.6.0
func (p *TaskQueuePlugin) Name() string
func (*TaskQueuePlugin) OnHook ¶ added in v0.6.0
func (p *TaskQueuePlugin) OnHook(ctx context.Context, hookType HookType, hookCtx HookContext) (string, error)
OnHook invalidates task queue cache when Claude becomes idle
func (*TaskQueuePlugin) SetCache ¶ added in v0.6.0
func (p *TaskQueuePlugin) SetCache(c *cache.Cache)
type UpdatePlugin ¶
type UpdatePlugin struct {
// contains filtered or unexported fields
}
UpdatePlugin shows indicator when Prism update is available
func (*UpdatePlugin) Name ¶
func (p *UpdatePlugin) Name() string
func (*UpdatePlugin) OnHook ¶
func (p *UpdatePlugin) OnHook(ctx context.Context, hookType HookType, hookCtx HookContext) (string, error)
OnHook implements Hookable interface for auto-update and notifications
func (*UpdatePlugin) SetCache ¶
func (p *UpdatePlugin) SetCache(c *cache.Cache)
type UsageBarsPlugin ¶ added in v0.4.1
type UsageBarsPlugin struct {
// contains filtered or unexported fields
}
UsageBarsPlugin displays usage limits as compact bar visualization
func (*UsageBarsPlugin) Name ¶ added in v0.4.1
func (p *UsageBarsPlugin) Name() string
func (*UsageBarsPlugin) SetCache ¶ added in v0.4.1
func (p *UsageBarsPlugin) SetCache(c *cache.Cache)
type UsageLimit ¶ added in v0.4.1
type UsageLimit struct {
Utilization float64 `json:"utilization"`
ResetsAt string `json:"resets_at"`
}
UsageLimit represents a single usage limit with utilization and reset time
type UsagePlugin ¶ added in v0.4.1
type UsagePlugin struct {
// contains filtered or unexported fields
}
UsagePlugin is a unified plugin that auto-detects billing type and renders the appropriate information: - For Max/Pro users (OAuth): shows usage limits (text or bars format) - For API billing users: shows cost
func (*UsagePlugin) Name ¶ added in v0.4.1
func (p *UsagePlugin) Name() string
func (*UsagePlugin) SetCache ¶ added in v0.4.1
func (p *UsagePlugin) SetCache(c *cache.Cache)
type UsageResponse ¶ added in v0.4.1
type UsageResponse struct {
FiveHour *UsageLimit `json:"five_hour"`
SevenDay *UsageLimit `json:"seven_day"`
SevenDayOpus *UsageLimit `json:"seven_day_opus"`
}
UsageResponse represents the API response from the usage endpoint
func FetchUsage ¶ added in v0.4.1
func FetchUsage(ctx context.Context, token string) (*UsageResponse, error)
FetchUsage calls the usage API and returns the current usage data
type UsageTextPlugin ¶ added in v0.4.1
type UsageTextPlugin struct {
// contains filtered or unexported fields
}
UsageTextPlugin displays usage limits as text with countdown labels
func (*UsageTextPlugin) Name ¶ added in v0.4.1
func (p *UsageTextPlugin) Name() string
func (*UsageTextPlugin) SetCache ¶ added in v0.4.1
func (p *UsageTextPlugin) SetCache(c *cache.Cache)