Documentation
¶
Overview ¶
Package sessions provides interactive session picking via fzf or bubbletea.
Index ¶
- Constants
- Variables
- func FormatDetail(d search.Detail, snippet string, live bool) string
- func FormatLine(s history.Session) string
- func FormatPreview(s history.Session) string
- func FormatRow(r search.Result, live bool) string
- func FormatRowLayout(r search.Result, live bool, l RowColumns) string
- func FzfArgs(self, query, header string, listenPort int) []string
- func ListPaneWidth(cols int) int
- func ParseSelectedID(line string) string
- func PickSession(sessions []history.Session) (history.Session, error)
- func ReloadAction(self string) string
- func SearchPick(self, query string, st PickerState, background func()) (string, error)
- type PickerState
- func (s PickerState) Header() string
- func (s PickerState) IncludeAutomated() bool
- func (s PickerState) Live() map[string]bool
- func (s PickerState) LiveOnly() bool
- func (s PickerState) Mode() string
- func (s PickerState) Scope() string
- func (s PickerState) SetLive(ids []string) error
- func (s PickerState) SetMode(mode string) error
- func (s PickerState) SetScope(dir string) error
- func (s PickerState) Toggle(name string) error
- type RowColumns
Constants ¶
const PickerStateEnv = "AIMUX_PICKER_STATE"
PickerStateEnv names the env var that points subprocesses at the state dir.
Variables ¶
var DefaultRowLayout = RowColumns{Title: 44, Project: 14}
DefaultRowLayout is used when the terminal width is unknown.
var ErrCancelled = fmt.Errorf("selection cancelled")
ErrCancelled is returned when the user cancels the picker.
Functions ¶
func FormatDetail ¶ added in v0.13.0
FormatDetail renders the preview pane for one session.
func FormatLine ¶
FormatLine formats a session as a single display line for the picker.
func FormatPreview ¶
FormatPreview returns a second line with the first prompt in dim text, shown below the main FormatLine for extra context.
func FormatRow ¶ added in v0.13.0
FormatRow renders one session as "<id>\t<display>"; fzf hides the id.
func FormatRowLayout ¶ added in v0.13.0
func FormatRowLayout(r search.Result, live bool, l RowColumns) string
FormatRowLayout is FormatRow with explicit column widths.
func FzfArgs ¶ added in v0.13.0
FzfArgs builds the split-view fzf invocation; self is the aimux binary. A non-zero listenPort lets background work push a reload into fzf.
func ListPaneWidth ¶ added in v0.13.0
ListPaneWidth is the width fzf gives the list in a cols-wide terminal.
func ParseSelectedID ¶
ParseSelectedID extracts the session ID from a picker output line. Strips ANSI escape codes first, then takes the first whitespace-delimited field.
func PickSession ¶
PickSession presents an interactive picker for the given sessions. Uses fzf if available, falls back to a bubbletea list. Returns the selected session or ErrCancelled.
func ReloadAction ¶ added in v0.13.0
ReloadAction is the fzf action that re-runs the rows query.
func SearchPick ¶ added in v0.13.0
func SearchPick(self, query string, st PickerState, background func()) (string, error)
SearchPick runs the split-view picker and returns the chosen session id. The picker opens straight away on the cached index; background (index refresh, live-session discovery) runs meanwhile and its results are pushed into the open picker with a reload.
Types ¶
type PickerState ¶ added in v0.13.0
type PickerState struct{ Dir string }
PickerState holds the picker's toggles in files so the short-lived rows and preview processes see the same settings.
func PickerStateFromEnv ¶ added in v0.13.0
func PickerStateFromEnv() PickerState
PickerStateFromEnv returns the state named by PickerStateEnv (zero if unset).
func (PickerState) Header ¶ added in v0.13.0
func (s PickerState) Header() string
Header is the status and key-hint line shown above the list.
func (PickerState) IncludeAutomated ¶ added in v0.13.0
func (s PickerState) IncludeAutomated() bool
IncludeAutomated reports whether automated sessions are shown (default no).
func (PickerState) Live ¶ added in v0.13.0
func (s PickerState) Live() map[string]bool
Live returns the session ids recorded by SetLive.
func (PickerState) LiveOnly ¶ added in v0.13.0
func (s PickerState) LiveOnly() bool
LiveOnly reports whether the picker shows only live sessions (default no).
func (PickerState) Mode ¶ added in v0.13.0
func (s PickerState) Mode() string
Mode is "keyword" (default), "hybrid" (keyword + semantic) or "semantic" (embeddings only, from an explicit --mode semantic).
func (PickerState) Scope ¶ added in v0.13.0
func (s PickerState) Scope() string
Scope is the directory the picker is limited to, or "" for all projects.
func (PickerState) SetLive ¶ added in v0.13.0
func (s PickerState) SetLive(ids []string) error
SetLive records which sessions are running in a terminal right now.
func (PickerState) SetMode ¶ added in v0.13.0
func (s PickerState) SetMode(mode string) error
SetMode sets the ranking mode: "keyword" or "hybrid".
func (PickerState) SetScope ¶ added in v0.13.0
func (s PickerState) SetScope(dir string) error
SetScope limits the picker to sessions under dir ("" = all projects).
func (PickerState) Toggle ¶ added in v0.13.0
func (s PickerState) Toggle(name string) error
Toggle flips "automated" or "semantic".
type RowColumns ¶ added in v0.13.0
type RowColumns struct{ Title, Project int }
RowColumns are the title and project column widths of a picker row.
func RowLayout ¶ added in v0.13.0
func RowLayout(cols int) RowColumns
RowLayout sizes the row columns to fit the list pane; cols <= 0 means unknown (FZF_COLUMNS unset).