store

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GitContext

func GitContext(cwd string) (repo string, branch string)

GitContext returns (repoName, branch) for the given directory, or ("", "") if it's not inside a git repo. Shells out to `git` rather than parsing .git internals directly, since that stays correct across git versions.

Types

type Command

type Command struct {
	ID         int64
	Command    string
	Cwd        string
	GitRepo    string
	GitBranch  string
	ExitCode   int
	DurationMs int64
	Shell      string
	Hostname   string
	SessionID  string
	StartedAt  time.Time
}

Command represents a single captured shell command.

type SearchOptions

type SearchOptions struct {
	Query      string // FTS5 match query; empty means no text filter
	Repo       string
	Cwd        string
	FailedOnly bool
	Since      time.Time // zero value means no lower bound
	Limit      int
}

SearchOptions filters a history search.

type Store

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

Store wraps the SQLite connection used for all command history reads/writes.

func Open

func Open(path string) (*Store, error)

Open opens (or creates) the SQLite database at path and ensures the schema exists.

func (*Store) Close

func (s *Store) Close() error

func (*Store) Insert

func (s *Store) Insert(c Command) error

Insert records one captured command.

func (*Store) Search

func (s *Store) Search(opts SearchOptions) ([]Command, error)

Search returns commands matching the given options, most recent first.

Jump to

Keyboard shortcuts

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