ui

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package ui implements the Bubble Tea TUI for scry.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WorktreeSnapshotKey added in v0.3.0

func WorktreeSnapshotKey(wt model.WorktreeInfo) string

WorktreeSnapshotKey returns a cache key for a worktree's mutable state.

Types

type CommitEditedMsg added in v0.2.0

type CommitEditedMsg struct {
	Message string
	Err     error
}

CommitEditedMsg is sent when the user finishes editing a commit message in $EDITOR.

type CommitExecutedMsg added in v0.2.0

type CommitExecutedMsg struct {
	SHA        string
	Err        error
	Generation int
}

CommitExecutedMsg is sent when an async git commit completes.

type CommitExecutor added in v0.2.0

type CommitExecutor interface {
	Execute(ctx context.Context, message string) (string, error)
}

CommitExecutor runs git commit with a message and returns the short SHA.

type CommitGeneratedMsg added in v0.2.0

type CommitGeneratedMsg struct {
	Message    string
	Err        error
	Generation int // matches CommitState.Generation to detect stale results
}

CommitGeneratedMsg is sent when an async commit message generation completes.

type CommitProvider added in v0.2.0

type CommitProvider interface {
	Generate(ctx context.Context) (string, error)
}

CommitProvider generates commit messages. The implementation is responsible for collecting any diff/file data it needs (e.g. from the git index).

type CompareReResolver added in v0.2.0

type CompareReResolver interface {
	Resolve(ctx context.Context, req model.CompareRequest) (model.ResolvedCompare, error)
}

CompareReResolver re-resolves the compare specification against current refs.

type DrillDownLoadedMsg added in v0.2.0

type DrillDownLoadedMsg struct {
	Result     DrillDownResult
	Err        error
	Generation int // matches DashboardState.DrillGeneration to detect stale results
}

DrillDownLoadedMsg is sent when a worktree drill-down finishes loading.

type DrillDownProvider added in v0.2.0

type DrillDownProvider interface {
	LoadDrillDown(ctx context.Context, worktreePath string) (DrillDownResult, error)
}

DrillDownProvider creates the diff context for a specific worktree.

type DrillDownResult added in v0.2.0

type DrillDownResult struct {
	Compare     model.ResolvedCompare
	Files       []model.FileSummary
	PatchLoader PatchLoader
}

DrillDownResult holds the resolved data for a worktree drill-down.

type MetadataLoadedMsg

type MetadataLoadedMsg struct {
	Compare *model.ResolvedCompare // non-nil when compare was re-resolved
	Files   []model.FileSummary
	Gen     int
	Err     error
}

MetadataLoadedMsg is sent when an async metadata reload completes.

type MetadataLoader

type MetadataLoader interface {
	ListFiles(ctx context.Context, cmp model.ResolvedCompare) ([]model.FileSummary, error)
}

MetadataLoader lists changed files for a compare range.

type Model

type Model struct {
	State model.AppState
	// contains filtered or unexported fields
}

Model is the top-level Bubble Tea model for scry.

func NewModel

func NewModel(state model.AppState, opts ...ModelOption) Model

NewModel creates a Model from bootstrap data. Sets SelectedFile to -1 when the file list is empty, 0 otherwise.

func (Model) Init

func (m Model) Init() tea.Cmd

Init implements tea.Model.

func (Model) Update

func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update implements tea.Model.

func (Model) View

func (m Model) View() string

View implements tea.Model.

type ModelOption

type ModelOption func(*Model)

ModelOption configures optional Model dependencies.

func WithCommitExecutor added in v0.2.0

func WithCommitExecutor(ce CommitExecutor) ModelOption

WithCommitExecutor sets the CommitExecutor used to run git commit.

func WithCommitProvider added in v0.2.0

func WithCommitProvider(cp CommitProvider) ModelOption

WithCommitProvider sets the CommitProvider used for AI commit message generation.

func WithCompareResolver added in v0.2.0

func WithCompareResolver(cr CompareReResolver, req model.CompareRequest) ModelOption

WithCompareResolver sets the resolver used to re-resolve compare refs on refresh.

func WithDrillDownProvider added in v0.2.0

func WithDrillDownProvider(dp DrillDownProvider) ModelOption

WithDrillDownProvider sets the provider for loading worktree diffs on drill-down.

func WithMetadataLoader

func WithMetadataLoader(ml MetadataLoader) ModelOption

WithMetadataLoader sets the MetadataLoader used to reload file lists on refresh.

func WithPatchLoader

func WithPatchLoader(pl PatchLoader) ModelOption

WithPatchLoader sets the PatchLoader used to load file diffs on Enter.

func WithPreviewLoader added in v0.3.0

func WithPreviewLoader(pl PreviewLoader) ModelOption

WithPreviewLoader sets the PreviewLoader for dashboard preview pane.

func WithWatch added in v0.2.0

func WithWatch(fp WatchFingerprinter, baseRef string) ModelOption

WithWatch sets the WatchFingerprinter and symbolic base ref for watch mode.

func WithWorktreeLoader added in v0.2.0

func WithWorktreeLoader(wl WorktreeLoader) ModelOption

WithWorktreeLoader sets the WorktreeLoader used for dashboard auto-refresh.

func WithWorktreeRemover added in v0.3.0

func WithWorktreeRemover(wr WorktreeRemover) ModelOption

WithWorktreeRemover sets the WorktreeRemover for dashboard deletion.

type PatchLoadedMsg

type PatchLoadedMsg struct {
	Path  string
	Patch model.FilePatch
	Gen   int
	Err   error
}

PatchLoadedMsg is sent when an async patch load completes.

type PatchLoader

type PatchLoader interface {
	LoadPatch(ctx context.Context, cmp model.ResolvedCompare, filePath string, status model.FileStatus, ignoreWhitespace bool) (model.FilePatch, error)
}

PatchLoader loads a file's unified diff.

type PreviewLoadedMsg added in v0.3.0

type PreviewLoadedMsg struct {
	Path  string
	Snap  string
	Files []model.FileSummary
	Err   error
}

PreviewLoadedMsg is sent when an async preview load completes.

type PreviewLoader added in v0.3.0

type PreviewLoader interface {
	LoadPreview(ctx context.Context, worktreePath string) ([]model.FileSummary, error)
}

PreviewLoader loads the top changed files for a worktree preview.

type WatchFingerprinter added in v0.2.0

type WatchFingerprinter interface {
	Fingerprint(ctx context.Context, baseRef string, workingTree bool) (string, error)
}

WatchFingerprinter computes a repo state fingerprint for watch mode.

type WorktreeLoader added in v0.2.0

type WorktreeLoader interface {
	LoadWorktrees(ctx context.Context) ([]model.WorktreeInfo, error)
}

WorktreeLoader loads the worktree list with dirty state and commit info.

type WorktreeRefreshedMsg added in v0.2.0

type WorktreeRefreshedMsg struct {
	Worktrees  []model.WorktreeInfo
	Err        error
	Generation int // matches DashboardState.RefreshGeneration to detect stale results
}

WorktreeRefreshedMsg is sent when an async worktree list reload completes.

type WorktreeRemovedMsg added in v0.3.0

type WorktreeRemovedMsg struct {
	Path string
	Err  error
}

WorktreeRemovedMsg is sent when an async worktree removal completes.

type WorktreeRemover added in v0.3.0

type WorktreeRemover interface {
	Remove(ctx context.Context, path string, force bool) error
}

WorktreeRemover removes a worktree.

Directories

Path Synopsis
Package panes implements individual UI pane components for scry.
Package panes implements individual UI pane components for scry.
Package theme provides semantic color tokens for the scry TUI.
Package theme provides semantic color tokens for the scry TUI.

Jump to

Keyboard shortcuts

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