tui

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildPrefixQuery added in v0.10.0

func BuildPrefixQuery(dir, agent, text string) string

BuildPrefixQuery constructs a query string from structured prefix values. Used by CLI flags (--dir, --cwd, --agent) to set the initial search query. Any existing positional query text is appended after the prefixes. A trailing space is added when prefixes are present but no text follows, so the cursor is ready for the user to start typing additional terms.

func FilterSessions added in v0.10.0

func FilterSessions(sessions []provider.Session, pq ParsedQuery) []provider.Session

FilterSessions applies the parsed query to a set of sessions. It applies prefix filters first (dir, agent), then fuzzy-matches the remaining text against SearchText.

func GitRoot added in v0.11.0

func GitRoot() (string, error)

GitRoot returns the root directory of the git repository containing the current working directory. Returns an error if not inside a git repo.

func PromptInput added in v1.1.0

func PromptInput(prompt string) (string, error)

PromptInput shows an interactive single-line text input and returns the user's response. It returns an empty string if the user presses Escape or Ctrl-C without submitting.

func ResolveDir added in v0.10.0

func ResolveDir(dir string) (string, error)

ResolveDir resolves a --dir flag value to an absolute path when it looks like a filesystem path. Values starting with /, ~, or . are treated as paths and resolved to absolute form. Bare words like "sesh" are left as-is for fuzzy matching against directory names.

Types

type FallbackSearchFunc

type FallbackSearchFunc func(ctx context.Context, query string, sessions []provider.Session) []provider.Session

FallbackSearchFunc is called when fuzzy search returns no results. It receives the query and all sessions, and returns a ranked subset. This runs in a goroutine — it can take time (e.g. LLM call).

type ParsedQuery added in v0.10.0

type ParsedQuery struct {
	Dir   string // value of dir: prefix (empty if absent)
	Agent string // value of agent: prefix (empty if absent)
	Text  string // remaining freeform search text
}

ParsedQuery holds the structured parts extracted from a search query. A query like "dir:sesh agent:opencode refactor" becomes:

Dir:   "sesh"
Agent: "opencode"
Text:  "refactor"

func ParseQuery added in v0.10.0

func ParseQuery(raw string) ParsedQuery

ParseQuery extracts structured prefixes from a raw query string. Recognized prefixes: dir:<value>, agent:<value>. Values can be bare words or quoted with double quotes for values containing spaces. Last occurrence of a prefix wins if duplicated.

type PickOptions

type PickOptions struct {
	InitialQuery   string
	FallbackSearch FallbackSearchFunc
	SessionText    SessionTextFunc
}

PickOptions configures the session picker.

type Result

type Result struct {
	Session provider.Session
}

Result is returned by Pick when the user selects a session.

func Pick

func Pick(sessions []provider.Session, opts PickOptions) (*Result, error)

Pick launches the fzf-style TUI picker and returns the selected session. The TUI renders to stderr so stdout stays clean for the shell wrapper to capture the resume command.

type SessionTextFunc

type SessionTextFunc func(agent, sessionID string) string

SessionTextFunc returns the raw session text for a given agent and session ID. Used for the detail preview pane.

Jump to

Keyboard shortcuts

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