tuistate

package
v1.23.4 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package tuistate provides persistent TUI state storage (tabs, recent/favorite directories).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store manages persistent TUI state in a SQLite database.

func New

func New() (*Store, error)

New creates a new TUI state store, initializing the database if needed.

func (*Store) AddFavoriteDir

func (s *Store) AddFavoriteDir(ctx context.Context, path string) error

AddFavoriteDir adds a directory to the favorites list.

func (*Store) AddTab

func (s *Store) AddTab(ctx context.Context, sessionID, workingDir string) error

AddTab adds a new tab to the store, placing it after all existing tabs.

func (*Store) ClearTabs

func (s *Store) ClearTabs(ctx context.Context) error

ClearTabs removes all tabs from the store. Used when starting fresh (no tabs to restore).

func (*Store) Close

func (s *Store) Close() error

Close closes the database connection.

func (*Store) GetFavoriteDirs

func (s *Store) GetFavoriteDirs(ctx context.Context) ([]string, error)

GetFavoriteDirs returns all favorite directories, ordered by most recently added.

func (*Store) GetRecentDirs

func (s *Store) GetRecentDirs(ctx context.Context, limit int) ([]string, error)

GetRecentDirs returns the most recently used directories.

func (*Store) GetTabs

func (s *Store) GetTabs(ctx context.Context) ([]TabEntry, string, error)

GetTabs returns all persisted tabs in position order, along with the active tab's session ID.

func (*Store) IsFavoriteDir

func (s *Store) IsFavoriteDir(ctx context.Context, path string) (bool, error)

IsFavoriteDir checks if a directory is in the favorites list.

func (*Store) RemoveFavoriteDir

func (s *Store) RemoveFavoriteDir(ctx context.Context, path string) error

RemoveFavoriteDir removes a directory from the favorites list.

func (*Store) RemoveTab

func (s *Store) RemoveTab(ctx context.Context, sessionID string) error

RemoveTab removes a tab from the store and compacts the remaining positions.

func (*Store) ReorderTab

func (s *Store) ReorderTab(ctx context.Context, sessionIDs []string) error

ReorderTab persists a new tab order. sessionIDs must contain every tab's persisted session ID in the desired order; positions are assigned 0..N-1.

func (*Store) SetActiveTab

func (s *Store) SetActiveTab(ctx context.Context, sessionID string) error

SetActiveTab sets the currently active tab.

func (*Store) ToggleFavoriteDir

func (s *Store) ToggleFavoriteDir(ctx context.Context, path string) (bool, error)

ToggleFavoriteDir adds or removes a directory from favorites. Returns the new state (true = now favorite).

func (*Store) ToggleSidebarCollapsed

func (s *Store) ToggleSidebarCollapsed(ctx context.Context, sessionID string) error

ToggleSidebarCollapsed inverts the sidebar collapsed state for a tab.

func (*Store) UpdateTabSessionID

func (s *Store) UpdateTabSessionID(ctx context.Context, oldID, newID string) error

UpdateTabSessionID replaces the session ID for a tab entry. Used after restoring a session: the tab store initially holds an ephemeral runner ID, which must be updated to the actual session store ID so that the session can be found on the next restart.

func (*Store) UpdateTabWorkingDir

func (s *Store) UpdateTabWorkingDir(ctx context.Context, sessionID, workingDir string) error

UpdateTabWorkingDir updates the stored working directory for the given session.

type TabEntry

type TabEntry struct {
	SessionID        string
	WorkingDir       string
	SidebarCollapsed bool
}

TabEntry represents a persisted tab.

Jump to

Keyboard shortcuts

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