Documentation
¶
Index ¶
- func BuildPrefixQuery(dir, agent, text string) string
- func FilterSessions(sessions []provider.Session, pq ParsedQuery) []provider.Session
- func GitRoot() (string, error)
- func PromptInput(prompt string) (string, error)
- func ResolveDir(dir string) (string, error)
- type FallbackSearchFunc
- type ParsedQuery
- type PickOptions
- type Result
- type SessionTextFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildPrefixQuery ¶ added in v0.10.0
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
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
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
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 SessionTextFunc ¶
SessionTextFunc returns the raw session text for a given agent and session ID. Used for the detail preview pane.