Documentation
¶
Overview ¶
Package ui provides an embeddable Bubble Tea component for interactive code review.
Index ¶
- type App
- func NewApp(backend vcs.Backend, files []model.DiffFile, session *model.ReviewSession, ...) App
- func NewAppWithCommits(backend vcs.Backend, commits []vcs.CommitInfo, ...) App
- func NewPickerApp(backend vcs.Backend, th theme.Theme, opts ...Option) App
- func NewProviderApp(backend vcs.Backend, p provider.Provider, id string, th theme.Theme, ...) App
- type ClipboardMsg
- type DoneMsg
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App is the main Bubble Tea model for the code review TUI.
func NewApp ¶
func NewApp(backend vcs.Backend, files []model.DiffFile, session *model.ReviewSession, th theme.Theme, opts ...Option) App
NewApp creates a new App model.
func NewAppWithCommits ¶
func NewAppWithCommits(backend vcs.Backend, commits []vcs.CommitInfo, commitDiffs map[string][]model.DiffFile, enabledCommits map[string]bool, includesWorkTree bool, session *model.ReviewSession, th theme.Theme, opts ...Option) App
NewAppWithCommits creates a new App with pre-populated commit list data. commits should be in newest-first order. commitDiffs maps commit IDs (and "worktree") to their individual diffs. enabledCommits indicates which are initially enabled.
func NewPickerApp ¶
NewPickerApp creates an App that starts in the commit picker phase.
func NewProviderApp ¶
func NewProviderApp( backend vcs.Backend, p provider.Provider, id string, th theme.Theme, opts ...Option, ) App
NewProviderApp creates an App that starts in the loading phase and fetches provider data asynchronously.
func (*App) SetSize ¶
SetSize sets the component's dimensions. Call this from the parent model when the available size changes (e.g. in response to tea.WindowSizeMsg).
type ClipboardMsg ¶
type ClipboardMsg struct {
Content string
}
ClipboardMsg is emitted when the component wants to copy text to the clipboard.
type DoneMsg ¶
type DoneMsg struct {
Session *model.ReviewSession
Err error
}
DoneMsg is emitted when the component wants to close. Session contains the final review state (nil if no review was started). Err is set if the component encountered a fatal error (e.g. provider loading failed).
type Option ¶
type Option func(*App)
Option configures an App during construction.
func WithCommits ¶
WithCommits populates the commit list and per-commit diffs. commits should be newest-first. All commits are enabled by default. NOTE: This option must be applied after the App's diffFiles are set (i.e. it is intended for use with NewApp, not NewAppWithCommits).
func WithHighlighter ¶
func WithHighlighter(hl *syntax.Highlighter) Option
WithHighlighter sets the syntax highlighter.
func WithLogger ¶
WithLogger sets the logger. Defaults to slog.Default().
func WithProvider ¶
WithProvider sets the remote provider and review request ID.
func WithStore ¶
func WithStore(store persistence.Store) Option
WithStore sets the persistence store.