Documentation
¶
Overview ¶
Package app is the Bubble Tea model/update/view for the review client. It is deliberately independent of Git and any forge: it consumes a parsed diff and a draft review, renders them, and turns key events into navigation, selection, and comment actions. Rendered rows are projections; comments anchor to semantic diff locations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PickRequest ¶
PickRequest shows an interactive picker over the discovered requests and returns the chosen index, or -1 if the user dismissed it.
Types ¶
type Config ¶
type Config struct {
Files []diff.FileDiff
Title string
HeadOID string
Draft *review.DraftReview
Store *review.Store
Editor editor.Editor
Theme ui.Theme
// PR is set in pull-request mode; nil for local/patch review.
PR *PRContext
// Highlighter, when set, overrides the environment-derived default.
Highlighter *ui.Highlighter
// Keys overrides individual normal-mode key bindings (key -> action).
Keys map[string]string
// Wrap enables line/comment wrapping at start (default true when built via
// the CLI); WrapWidth caps the unified wrap point (0 means the default).
Wrap bool
WrapWidth int
}
Config wires the model's dependencies together.
type Keymap ¶
Keymap maps a key (as reported by Bubble Tea's KeyMsg.String) to a normal-mode action name. Single-key normal-mode dispatch flows through this table so bindings can be remapped via configuration. Two-key sequences (gg, ]c, …), numeric count prefixes, and overlay/input keys are handled by the grammar and are not remappable.
func DefaultKeymap ¶
func DefaultKeymap() Keymap
DefaultKeymap returns the built-in bindings as a fresh map on every call, so apply can mutate one model's keymap without affecting other instances or the knownActions set derived from the defaults.
type Mode ¶
type Mode uint8
Mode is the explicit interaction mode. Using an enum (rather than scattered booleans) keeps the update logic legible and testable.
const ( // ModeNormal is navigation. ModeNormal Mode = iota // ModeVisual is an active line selection. ModeVisual // ModeFiles is the file picker. ModeFiles // ModeComments is the comment/thread list. ModeComments // ModeConfirm is a yes/no confirmation prompt. ModeConfirm // ModeHelp shows the key reference. ModeHelp // ModeThread shows a focused reader for the review thread under the cursor. ModeThread // ModePR shows the pull-request details (title, description, URL). ModePR // ModeExternalEditor is a placeholder state while the editor is open. ModeExternalEditor )
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the root Bubble Tea model.
func New ¶
New builds the initial model, filling in whatever cfg leaves unset: an empty draft, the environment-derived highlighter, the default wrap width, and the default keymap overlaid with the user's overrides. The cursor starts on the first commentable row rather than row 0, which is a hunk header.
func (*Model) Init ¶
Init implements tea.Model. All data arrives fully loaded through Config, so there is no startup command to run.
type PRContext ¶
type PRContext struct {
Forge forge.Forge
Ref forge.PullRequestRef
PR *forge.PullRequest
Threads []forge.Thread
}
PRContext carries everything the TUI needs to operate in pull-request mode: the forge to reply/submit through, the PR reference and metadata, and the existing review threads. It is nil in local/patch mode.