Documentation
¶
Index ¶
- type AgentInteraction
- type Command
- type CommandCount
- type SearchOptions
- type SearchUI
- type Stats
- type Store
- func (s *Store) Add(cmd Command) (int64, error)
- func (s *Store) AddAgentInteraction(interaction AgentInteraction) (int64, error)
- func (s *Store) Close() error
- func (s *Store) Count() (int64, error)
- func (s *Store) GetAgentInteractions(prompt string, limit int) ([]AgentInteraction, error)
- func (s *Store) GetRecent(n int) ([]Command, error)
- func (s *Store) Search(opts SearchOptions) ([]Command, error)
- type SudoResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentInteraction ¶
type AgentInteraction struct {
ID int64
Prompt string // What the user asked
Response string // What the agent suggested
Accepted bool // Did the user accept the suggestion?
CommandID int64 // Link to executed command (if accepted)
Context string // Context that was sent (JSON)
LatencyMs int64 // Agent response time
Agent string // Which agent (claude, ollama, etc.)
Timestamp time.Time
}
AgentInteraction represents an agent prompt/response pair.
type Command ¶
type Command struct {
ID int64
Command string // The command that was executed
Cwd string // Working directory
ExitCode int // Exit code (0 = success)
DurationMs int64 // Execution duration in milliseconds
Timestamp time.Time // When the command was executed
GitBranch string // Git branch at time of execution
KubeContext string // Kubernetes context
IsSudo bool // Was this a sudo command?
SudoUser string // User switched to (usually "root")
RawCommand string // Original command with sudo prefix
}
Command represents a command in history.
type CommandCount ¶
CommandCount pairs a command with its usage count.
type SearchOptions ¶
type SearchOptions struct {
Query string // Full-text search query
Limit int // Max results (0 = unlimited)
Offset int // Pagination offset
OnlyFailed bool // Only show failed commands
OnlySudo bool // Only show sudo commands
Cwd string // Filter by working directory
Since time.Time
Before time.Time
}
SearchOptions for querying history.
type SearchUI ¶
type SearchUI struct {
// contains filtered or unexported fields
}
SearchUI provides Ctrl+R style interactive search.
func NewSearchUI ¶
NewSearchUI creates a new search UI with the given color palette.
func (*SearchUI) SetClipboard ¶
SetClipboard sets the clipboard buffer for output cross-referencing.
type Stats ¶
type Stats struct {
TotalCommands int64
UniqueCommands int64
SuccessRate float64
TotalAgentCalls int64
AgentAcceptRate float64
MostUsedCommands []CommandCount
MostFailedCommands []CommandCount
}
Stats holds history statistics.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store provides persistent command history.
func (*Store) AddAgentInteraction ¶
func (s *Store) AddAgentInteraction(interaction AgentInteraction) (int64, error)
AddAgentInteraction records an agent interaction.
func (*Store) GetAgentInteractions ¶
func (s *Store) GetAgentInteractions(prompt string, limit int) ([]AgentInteraction, error)
GetAgentInteractions returns agent interactions, optionally filtered.
type SudoResult ¶
SudoResult contains parsed sudo command info.
func ParseSudoCommand ¶
func ParseSudoCommand(raw string) SudoResult
ParseSudoCommand detects and parses sudo/doas commands.