panels

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package panels defines shared message types used for inter-panel communication.

Package panels defines the Panel interface that all TUI panels implement. Panels are the building blocks of the grut UI — each panel renders a rectangular region and handles its own key events when focused.

Index

Constants

View Source
const ScrollDelta = 3

ScrollDelta is the number of lines to scroll on each mouse-wheel tick. All panels use this shared constant for consistent scroll behavior.

Variables

View Source
var StartDetachedFn = func(cmd *exec.Cmd) error {
	if err := cmd.Start(); err != nil {
		return err
	}
	go func() { _ = cmd.Wait() }()
	return nil
}

StartDetachedFn starts a command and reaps it in the background to prevent zombie processes. The caller does not wait for the process to exit. It is a variable so tests can replace it with a no-op stub.

Functions

func CopyToClipboard

func CopyToClipboard(ctx context.Context, text string) error

CopyToClipboard copies text to the OS clipboard using platform-native commands. All platforms pipe via stdin to avoid shell interpretation of the text content (prevents command injection via crafted text).

func OpenInBrowser

func OpenInBrowser(rawURL string) error

OpenInBrowser opens a URL in the default browser.

func OpenInEditor

func OpenInEditor(path string) error

OpenInEditor opens a file in the user's preferred editor. It checks $VISUAL, $EDITOR, then tries common developer editors, and finally falls back to platform defaults.

func OpenInTerminal

func OpenInTerminal(dir string) error

OpenInTerminal spawns a new terminal window at the given directory path.

func StripANSI

func StripANSI(s string) string

StripANSI removes ANSI/VT escape sequences from text.

func ValidateBrowserURL

func ValidateBrowserURL(rawURL string) error

ValidateBrowserURL validates a URL before opening it in the default browser. Only http and https schemes are allowed.

func ValidateEditorPath

func ValidateEditorPath(path string) error

ValidateEditorPath validates a file path before passing it to an external editor. It rejects null bytes, shell metacharacters, and empty paths.

Types

type AICommitSuggestionMsg

type AICommitSuggestionMsg struct {
	Subject string
	Body    string
	Type    string // "feat", "fix", "docs", etc.
	Scope   string
}

AICommitSuggestionMsg carries an AI-generated commit message suggestion for the commit input.

type AIConflictResolvedMsg

type AIConflictResolvedMsg struct {
	Path string
}

AIConflictResolvedMsg indicates that AI has resolved a conflict in the given file.

type AIReviewFinding

type AIReviewFinding struct {
	File       string
	Severity   string // "error", "warning", "info", "hint"
	Category   string // "security", "bug", "performance", "style", "test"
	Message    string
	Suggestion string
	Line       int
}

AIReviewFinding is a single code review annotation from the AI.

type AIReviewReadyMsg

type AIReviewReadyMsg struct {
	Findings []AIReviewFinding
}

AIReviewReadyMsg carries AI-generated code review findings for display in the diff panel.

type ActionJob

type ActionJob struct {
	Name        string
	Status      string
	Conclusion  string
	StartedAt   string
	CompletedAt string
	Steps       []ActionStep
	ID          int64
}

ActionJob represents a job in a workflow run.

type ActionJobsLoadedMsg

type ActionJobsLoadedMsg struct {
	Jobs  []ActionJob
	RunID int64
}

ActionJobsLoadedMsg carries the list of jobs for a workflow run.

type ActionLogMsg

type ActionLogMsg struct {
	Log   string
	RunID int64
	JobID int64
}

ActionLogMsg carries log output for a specific job.

type ActionRunDeselectedMsg

type ActionRunDeselectedMsg struct{}

ActionRunDeselectedMsg is sent when the user deselects a workflow run (via Escape).

type ActionRunSelectedMsg

type ActionRunSelectedMsg struct {
	WorkflowName string
	Status       string
	RunID        int64
}

ActionRunSelectedMsg is sent when the user selects a workflow run in the Actions tab. Preview pane should show job steps and logs.

type ActionStep

type ActionStep struct {
	Name       string
	Status     string
	Conclusion string
	Number     int64
}

ActionStep represents a single step within a workflow job.

type AddToContextMsg

type AddToContextMsg struct {
	Path string
}

--------------------------------------------------------------------------- Context builder messages --------------------------------------------------------------------------- AddToContextMsg requests adding a file to the AI context builder.

type AgentExitedMsg

type AgentExitedMsg struct {
	PID      int
	ExitCode int
}

AgentExitedMsg is emitted when an agent process exits.

type AgentOutputMsg

type AgentOutputMsg struct {
	Line string
	PID  int
}

AgentOutputMsg is emitted when an agent produces a line of output.

type AgentSpawnedMsg

type AgentSpawnedMsg struct {
	Command string
	PID     int
}

--------------------------------------------------------------------------- Agent monitor messages --------------------------------------------------------------------------- AgentSpawnedMsg is emitted when a new agent process is spawned.

type AmendRequestMsg

type AmendRequestMsg struct{}

AmendRequestMsg is sent to trigger an amend of the last commit. The panel opens a commit message modal; the app handles the actual amend.

type AsyncOpDoneMsg

type AsyncOpDoneMsg struct {
	Err         error
	Description string
}

AsyncOpDoneMsg is emitted when an async git operation completes. The root model clears the loading indicator and shows a toast with the result.

type AsyncOpStartMsg

type AsyncOpStartMsg struct {
	Description string
}

AsyncOpStartMsg is emitted when an async git operation begins. The root model uses it to display a loading indicator in the status bar.

type AutoFetchTickMsg

type AutoFetchTickMsg struct {
	Time time.Time
}

AutoFetchTickMsg drives the recurring auto-fetch timer. The root model handles this by performing a background fetch if configured.

type BasePanel

type BasePanel struct {
	PanelTitle string // exported so embedding types can set it at construction
	Focused    bool
	Width      int
	Height     int
}

BasePanel provides default implementations for Focus, Blur, SetSize, Title, and KeyBindings. Panels that embed BasePanel only need to implement Init, Update, and View (F07).

func (*BasePanel) Blur

func (b *BasePanel) Blur()

Blur implements Panel.

func (*BasePanel) Focus

func (b *BasePanel) Focus()

Focus implements Panel.

func (*BasePanel) KeyBindings

func (b *BasePanel) KeyBindings() []KeyBinding

KeyBindings implements Panel. Returns nil (no bindings) by default.

func (*BasePanel) SetSize

func (b *BasePanel) SetSize(width, height int)

SetSize implements Panel.

func (*BasePanel) Title

func (b *BasePanel) Title() string

Title implements Panel.

type BisectStatusMsg

type BisectStatusMsg struct {
	Current        string
	StepsRemaining int
	Active         bool
}

BisectStatusMsg reports the current bisect session status. Emitted after bisect operations so the status bar can display progress.

type BlameLoadedMsg

type BlameLoadedMsg struct {
	Err   error
	Lines []git.BlameLine
}

BlameLoadedMsg delivers blame annotation data to the preview panel. Produced by the root model after running git blame asynchronously.

type BookmarkAddMsg

type BookmarkAddMsg struct {
	Path string
}

BookmarkAddMsg requests adding the given directory path as a bookmark.

type BookmarkRemoveMsg

type BookmarkRemoveMsg struct {
	Path string
}

BookmarkRemoveMsg requests removing a bookmark by path.

type BranchChangedMsg

type BranchChangedMsg struct {
	Name string
}

BranchChangedMsg is sent after a successful branch checkout so that other panels can react to the new HEAD (e.g. refresh git status, file tree).

type BranchDeselectedMsg added in v0.0.2

type BranchDeselectedMsg struct{}

BranchDeselectedMsg is sent when the user deselects a branch (e.g. Escape or clicking the same branch again in the gitinfo panel).

type BranchSelectedMsg

type BranchSelectedMsg struct {
	Name string
}

BranchSelectedMsg is sent when the user selects (clicks or navigates to) a branch in the gitinfo panel. Other panels (e.g. gitlog) can react by showing data for that branch without switching HEAD.

type ChangeDirectoryMsg

type ChangeDirectoryMsg struct {
	Path string
}

ChangeDirectoryMsg requests changing the application's working directory. Unlike NavigateToPathMsg (which only changes the filetree root), this changes the process CWD, reinitializes git, and refreshes all panels.

type ChatFocusMsg

type ChatFocusMsg struct{}

--------------------------------------------------------------------------- AI and Chat messages --------------------------------------------------------------------------- ChatFocusMsg requests the chat footer to take or release focus.

type ChatNavigateMsg

type ChatNavigateMsg struct {
	Path string
}

ChatNavigateMsg asks the UI to navigate to a file path, triggered by the AI chat's navigate_to tool.

type ChatRefreshMsg

type ChatRefreshMsg struct{}

ChatRefreshMsg signals that the chat performed an operation that may have changed repository state, so panels should refresh.

type CherryPickMsg

type CherryPickMsg struct {
	Hash string
}

CherryPickMsg requests cherry-picking a commit by hash. Typically sent from the git log panel to the stash panel for execution.

type ClearContextMsg

type ClearContextMsg struct{}

ClearContextMsg requests clearing all files from the context builder.

type ClosePanelMsg

type ClosePanelMsg struct{}

ClosePanelMsg requests closing the currently focused panel.

type CloseTabMsg

type CloseTabMsg struct{}

CloseTabMsg requests closing the currently active tab.

type Closer

type Closer interface {
	Close()
}

Closer is an optional interface that panels can implement to release resources (watchers, goroutines, file handles) on application shutdown. The root model calls Close() on every panel that implements it when the user quits (F29).

type CommandSelectedMsg

type CommandSelectedMsg struct {
	Action string
}

CommandSelectedMsg is sent when the user selects a command from the command palette. The Action field holds the action identifier to execute (e.g. "quit", "focus_next").

type CommitDeselectedMsg

type CommitDeselectedMsg struct{}

CommitDeselectedMsg is sent when the user deselects a commit (via Escape). File tree exits commit-files mode when receiving this.

type CommitRequestMsg

type CommitRequestMsg struct{}

--------------------------------------------------------------------------- Git operation messages (app-level commit/push/pull/fetch) --------------------------------------------------------------------------- CommitRequestMsg is sent to trigger the commit dialog from any panel.

type CommitSelectedMsg

type CommitSelectedMsg struct {
	Hash    string
	Subject string
}

--------------------------------------------------------------------------- Commit selection messages --------------------------------------------------------------------------- CommitSelectedMsg is sent when the user selects a commit in the commits panel. Other panels can react to display commit details, diffs, etc.

type ConflictDetectedMsg

type ConflictDetectedMsg struct {
	Files []string
}

ConflictDetectedMsg is emitted when a merge or rebase encounters conflicts. Files lists the paths of conflicted files.

type ConflictResolvedMsg

type ConflictResolvedMsg struct{}

ConflictResolvedMsg is emitted when all conflicts have been resolved and the merge/rebase can continue.

type ContextUpdatedMsg

type ContextUpdatedMsg struct {
	FileCount  int
	TokenCount int
}

ContextUpdatedMsg notifies other panels that the context has changed.

type ExportContextMsg

type ExportContextMsg struct{}

ExportContextMsg requests exporting the context as structured text.

type ExtensionChangedMsg

type ExtensionChangedMsg struct{}

ExtensionChangedMsg is emitted after an extension install, remove, or enable/disable so that other panels can refresh extension-dependent state.

type FetchRequestMsg

type FetchRequestMsg struct{}

FetchRequestMsg is sent to trigger a git fetch from any panel.

type FileSelectedMsg

type FileSelectedMsg struct {
	Path string
}

FileSelectedMsg is sent when the user selects (opens) a file. Both filetree and preview panels use this shared type so that cross-panel message routing works correctly.

type FirstRunMsg

type FirstRunMsg struct{}

FirstRunMsg is sent when the application detects it is the user's first run. The root model shows the help overlay in response.

type FolderSelectedMsg

type FolderSelectedMsg struct {
	Path string
}

FolderSelectedMsg is sent when a directory is selected in the file tree.

type GitChangedFilesMsg

type GitChangedFilesMsg struct {
	Paths map[string]bool // absolute paths of changed files
}

GitChangedFilesMsg delivers the set of git-changed file paths to panels that need to filter by git status (e.g. filetree).

type GitFilterActiveMsg

type GitFilterActiveMsg struct {
	Active bool
}

GitFilterActiveMsg notifies panels whether git-filter mode is active. When active, the preview panel shows diff-only instead of file content.

type GitHubContextMsg

type GitHubContextMsg struct {
	Owner string
	Repo  string
}

--------------------------------------------------------------------------- GitHub Integration Messages --------------------------------------------------------------------------- GitHubContextMsg provides the owner/repo context detected from git remote. Emitted on startup after parsing the git remote URL.

type GitHubFilterChangedMsg

type GitHubFilterChangedMsg struct {
	Tab    string // "issues", "prs", "actions"
	Filter string // filter value (e.g., "all", "assigned", "needs_review")
}

GitHubFilterChangedMsg is sent when the user cycles through quick filters.

type GitHubUserMsg

type GitHubUserMsg struct {
	Login string
}

GitHubUserMsg provides the authenticated GitHub user's login. Emitted after successful GitHub authentication.

type GitStatusChangedMsg

type GitStatusChangedMsg struct {
	Files []git.FileStatus
}

GitStatusChangedMsg is emitted by the gitstatus panel after a stage/unstage operation so that other panels (e.g. filetree) can update file markers.

type HunkApprovedMsg

type HunkApprovedMsg struct {
	Path      string
	HunkIndex int
}

HunkApprovedMsg is emitted when a single diff hunk is approved during review. Other panels can react (e.g. refresh git status).

type HunkRejectedMsg

type HunkRejectedMsg struct {
	Path      string
	HunkIndex int
}

HunkRejectedMsg is emitted when a single diff hunk is rejected during review. Other panels can react (e.g. refresh git status).

type IssueCommentAddedMsg

type IssueCommentAddedMsg struct {
	Body   string
	Number int
}

IssueCommentAddedMsg is sent after a comment is added to an issue.

type IssueDeselectedMsg

type IssueDeselectedMsg struct{}

IssueDeselectedMsg is sent when the user deselects an issue (via Escape). Preview pane should restore to file preview.

type IssueSelectedMsg

type IssueSelectedMsg struct {
	Title  string
	Body   string
	State  string
	Number int
}

IssueSelectedMsg is sent when the user selects an issue in the GitHub Issues tab. Preview pane should render the issue body as markdown.

type IssueStateChangedMsg

type IssueStateChangedMsg struct {
	State  string
	Number int
}

IssueStateChangedMsg is sent when an issue is opened/closed.

type ItemCopyMsg

type ItemCopyMsg struct{}

ItemCopyMsg requests the focused panel to copy the selected item's identifier (hash, URL, path, name) to the clipboard.

type ItemCreateMsg

type ItemCreateMsg struct{}

--------------------------------------------------------------------------- CRUD action messages

These are dispatched by the root model when the keymap resolves a CRUD action (item_create, item_delete, etc.). Each focused panel interprets the message according to its own context (e.g. "create" means "new branch" in the branches panel, "new file" in the filetree). --------------------------------------------------------------------------- ItemCreateMsg requests the focused panel to create a new item.

type ItemDeleteMsg

type ItemDeleteMsg struct{}

ItemDeleteMsg requests the focused panel to delete the selected item.

type ItemEditMsg

type ItemEditMsg struct{}

ItemEditMsg requests the focused panel to edit/rename the selected item.

type ItemOpenMsg

type ItemOpenMsg struct{}

ItemOpenMsg requests the focused panel to open the selected item externally (e.g. in a browser for GitHub resources, in an editor for files).

type KeyBinding

type KeyBinding struct {
	Key         string // Key combination, e.g. "ctrl+s", "enter"
	Description string // Human-readable description, e.g. "Stage file"
	Action      string // Internal action identifier, e.g. "stage"
}

KeyBinding describes a single key binding for documentation and help text.

type MergeAbortMsg

type MergeAbortMsg struct{}

MergeAbortMsg requests aborting the current merge operation.

type MergeRequestMsg

type MergeRequestMsg struct {
	Branch string
}

MergeRequestMsg requests merging a branch into the current HEAD. Typically sent from the branches panel when the user presses m.

type NavigateToPathMsg struct {
	Path string
}

NavigateToPathMsg requests the filetree to change its root directory.

type NewTabMsg

type NewTabMsg struct {
	Preset string
}

--------------------------------------------------------------------------- Tab management messages --------------------------------------------------------------------------- NewTabMsg requests creating a new tab with the given layout preset. An empty Preset string defaults to "explorer".

type NextTabMsg

type NextTabMsg struct{}

NextTabMsg requests switching to the next tab (wrapping).

type PRCommentAddedMsg

type PRCommentAddedMsg struct {
	Body     string
	Number   int
	ThreadID int64
}

PRCommentAddedMsg is sent after a comment is added to a PR.

type PRCommit

type PRCommit struct {
	SHA     string
	Message string
	Author  string
	Date    string
}

PRCommit represents a commit in a pull request.

type PRCommitsLoadedMsg

type PRCommitsLoadedMsg struct {
	Commits []PRCommit
	Number  int
}

PRCommitsLoadedMsg carries the list of commits in a PR. Sent to the commits pane to show PR-specific commits.

type PRDeselectedMsg

type PRDeselectedMsg struct{}

PRDeselectedMsg is sent when the user deselects a PR (via Escape). Files and commits panes restore to normal mode.

type PRFile

type PRFile struct {
	Filename  string
	Status    string // "added", "removed", "modified", "renamed"
	Patch     string
	Additions int
	Deletions int
}

PRFile represents a file changed in a pull request.

type PRFilesLoadedMsg

type PRFilesLoadedMsg struct {
	Files  []PRFile
	Number int
}

PRFilesLoadedMsg carries the list of files changed in a PR. Sent to the files pane to enter PR-files mode.

type PRMergeFailedMsg added in v0.0.2

type PRMergeFailedMsg struct {
	Number int
	Err    error
}

PRMergeFailedMsg is sent when a PR merge fails.

type PRMergeRequestedMsg added in v0.0.2

type PRMergeRequestedMsg struct {
	Number     int
	Title      string
	HeadBranch string
}

PRMergeRequestedMsg triggers the merge strategy picker for a pull request.

type PRMergedMsg

type PRMergedMsg struct {
	Strategy string
	Number   int
}

PRMergedMsg is sent after a PR is merged.

type PRReviewSubmittedMsg

type PRReviewSubmittedMsg struct {
	ReviewState string
	Number      int
}

PRReviewSubmittedMsg is sent after a review is submitted on a PR.

type PRSelectedMsg

type PRSelectedMsg struct {
	Title      string
	State      string
	HeadBranch string
	Number     int
}

PRSelectedMsg is sent when the user selects a PR in the GitHub PRs tab. Files pane enters PR-files mode, commits pane shows PR commits, preview shows diff.

type PRThreadResolvedMsg

type PRThreadResolvedMsg struct {
	Number   int
	ThreadID int64
}

PRThreadResolvedMsg is sent when a review thread is resolved/unresolved.

type Panel

type Panel interface {
	// Init is called once when the panel is first created. The context is
	// cancelled on application shutdown and should be used for cancellation
	// of any background work.
	Init(ctx context.Context) tea.Cmd

	// Update processes a message and returns the (potentially updated) panel
	// and an optional command.
	Update(msg tea.Msg) (Panel, tea.Cmd)

	// View renders the panel content into the given width×height area.
	// Returns a plain string (not tea.View) — the root model handles
	// the final tea.View composition.
	View(width, height int) string

	// Focus is called when the panel gains keyboard focus.
	Focus()

	// Blur is called when the panel loses keyboard focus.
	Blur()

	// SetSize informs the panel of its allocated dimensions. Called on
	// window resize and layout changes.
	SetSize(width, height int)

	// Title returns the display name of the panel (shown in borders/tabs).
	Title() string

	// KeyBindings returns the panel-specific key bindings for help display.
	KeyBindings() []KeyBinding
}

Panel is the interface that all grut panels implement. Each panel occupies a rectangular region in the layout and can receive focus for keyboard input. Panels return plain strings from View; the root model wraps the final composition into a tea.View.

type PanelHeaderDoubleClickMsg added in v0.0.2

type PanelHeaderDoubleClickMsg struct {
	ContentCol int // approximate column within the panel area
}

PanelHeaderDoubleClickMsg is sent by the layout engine when a double-click lands on the panel header / border title area (the row above the panel content). Panels can use this to trigger a header-specific action, e.g. opening a repo URL in a browser.

type PanelMouseClickMsg

type PanelMouseClickMsg struct {
	ContentRow int // row within the panel content area (0-based)
	ContentCol int // column within the panel content area (0-based)
}

PanelMouseClickMsg is sent by the layout engine when a mouse click lands inside a panel. Coordinates are relative to the panel's content area (inside borders), so ContentRow 0 is the first visible line.

type PanelMouseDoubleClickMsg

type PanelMouseDoubleClickMsg struct {
	ContentRow int // row within the panel content area (0-based)
	ContentCol int // column within the panel content area (0-based)
}

PanelMouseDoubleClickMsg is sent by the layout engine when two clicks arrive within 300ms at the same panel position. Used for action triggers such as checkout, worktree switch, file open, etc.

type PanelMouseRightClickMsg

type PanelMouseRightClickMsg struct {
	ContentRow int // row within the panel content area (0-based)
	ContentCol int // column within the panel content area (0-based)
}

PanelMouseRightClickMsg is sent by the layout engine when a right-click lands inside a panel. Coordinates are relative to the panel's content area (inside borders), so ContentRow 0 is the first visible line.

type Placeholder

type Placeholder struct {
	BasePanel
}

Placeholder is a stub panel that displays its name centered. It implements the Panel interface and is used as a stand-in until real panel implementations (filetree, preview, etc.) are built. It embeds BasePanel for default Focus/Blur/SetSize/Title/KeyBindings (F07).

func NewPlaceholder

func NewPlaceholder(name string) *Placeholder

NewPlaceholder creates a new placeholder panel with the given name.

func (*Placeholder) Init

func (p *Placeholder) Init(_ context.Context) tea.Cmd

Init implements Panel.

func (*Placeholder) String

func (p *Placeholder) String() string

String implements fmt.Stringer for debugging.

func (*Placeholder) Update

func (p *Placeholder) Update(_ tea.Msg) (Panel, tea.Cmd)

Update implements Panel.

func (*Placeholder) View

func (p *Placeholder) View(width, height int) string

View implements Panel. It renders the panel name centered within the allocated width and height.

type PrevTabMsg

type PrevTabMsg struct{}

PrevTabMsg requests switching to the previous tab (wrapping).

type PreviewScrollMsg

type PreviewScrollMsg struct {
	Delta int
}

PreviewScrollMsg requests the preview panel to scroll by Delta lines. Positive = down, negative = up. Emitted by filetree so the user can scroll the preview without Tab-focusing it (e.g. J/K keys).

type PullRequestMsg

type PullRequestMsg struct{}

PullRequestMsg is sent to trigger a git pull from any panel.

type PushRequestMsg

type PushRequestMsg struct{}

PushRequestMsg is sent to trigger a git push from any panel.

type RebaseAbortMsg

type RebaseAbortMsg struct{}

RebaseAbortMsg requests aborting the current rebase operation.

type RebaseRequestMsg

type RebaseRequestMsg struct {
	Onto string
}

RebaseRequestMsg requests rebasing the current branch onto a target ref. Typically sent from the branches panel when the user presses r.

type RedoMsg

type RedoMsg struct{}

RedoMsg is sent when the user requests a redo operation (ctrl+y). The root model intercepts this and delegates to the UndoManager.

type RefreshBranchesMsg

type RefreshBranchesMsg struct{}

RefreshBranchesMsg is received by the branches panel to trigger a re-fetch of the branch list.

type RefreshGitStatusMsg

type RefreshGitStatusMsg struct{}

RefreshGitStatusMsg is received by the gitstatus panel to trigger a re-fetch of git status (e.g. after an external commit or file change).

type RefreshPreviewMsg

type RefreshPreviewMsg struct{}

RefreshPreviewMsg tells the preview panel to re-render whatever it is currently showing (file, GitHub issue, PR, CI run, etc.) without changing the displayed content type.

type RemoteChangedMsg

type RemoteChangedMsg struct{}

RemoteChangedMsg is emitted after remote add/remove so that other panels can react (e.g. refresh remote-dependent state).

type RemoteSelectedMsg

type RemoteSelectedMsg struct {
	Name string
}

RemoteSelectedMsg is sent when a remote is selected in the gitinfo panel.

type RemoveFromContextMsg

type RemoveFromContextMsg struct {
	Path string
}

RemoveFromContextMsg requests removing a file from the AI context builder.

type RepoChangedMsg

type RepoChangedMsg struct {
	Path string
}

RepoChangedMsg is broadcast after the working directory has changed to a new repository. All panels that hold a git client reference should replace it with a fresh client for the new path and reload their data. Path is the absolute path of the new working directory.

type ResizePanelMsg

type ResizePanelMsg struct {
	Direction string
	Delta     int
}

ResizePanelMsg requests resizing the focused panel boundary. Direction is "left", "right", "up", or "down".

type RevealFileMsg

type RevealFileMsg struct {
	Path string
}

RevealFileMsg requests the filetree to expand parent directories and move the cursor to the specified file path. Emitted by the fuzzy finder when the user selects a file, so the file tree highlights it.

type ReviewCompleteMsg

type ReviewCompleteMsg struct {
	Summary string
}

ReviewCompleteMsg is emitted when the user exits review mode. Summary contains a plain-text export of all review decisions.

type RewordRequestMsg

type RewordRequestMsg struct {
	OldMessage string
}

RewordRequestMsg is sent to reword the last commit's message. OldMessage carries the current commit message so the modal can pre-fill it.

type ShowDiffMsg

type ShowDiffMsg struct {
	Path   string
	Staged bool
}

ShowDiffMsg requests showing a diff for the specified file path. Staged indicates whether to show the staged (index vs HEAD) diff.

type SplitHorizontalMsg

type SplitHorizontalMsg struct {
	PanelType string
}

SplitHorizontalMsg requests splitting the focused panel horizontally, placing a new panel of PanelType below.

type SplitVerticalMsg

type SplitVerticalMsg struct {
	PanelType string
}

--------------------------------------------------------------------------- Split / panel messages --------------------------------------------------------------------------- SplitVerticalMsg requests splitting the focused panel vertically, placing a new panel of PanelType to the right.

type StartReviewMsg

type StartReviewMsg struct{}

--------------------------------------------------------------------------- Review messages (diff review mode) --------------------------------------------------------------------------- StartReviewMsg enters the diff review mode, loading all changed files for hunk-level approve/reject decisions.

type StashChangedMsg

type StashChangedMsg struct{}

StashChangedMsg is emitted after stash operations (push, pop, apply, drop) so that other panels can refresh their stash-dependent state.

type StashSelectedMsg

type StashSelectedMsg struct {
	Hash  string
	Index int
}

StashSelectedMsg is sent when a stash entry is selected.

type SwitchTabMsg

type SwitchTabMsg struct {
	Index int
}

SwitchTabMsg requests switching to the tab at the given index.

type SwitchWorktreeMsg

type SwitchWorktreeMsg struct {
	Path string
}

SwitchWorktreeMsg is emitted when the user selects a worktree to switch to. The Path field holds the filesystem path of the target worktree.

type TabActivatedMsg

type TabActivatedMsg struct {
	PresetName string
}

TabActivatedMsg is emitted after a tab switch completes so that panels can react to the active preset (e.g. auto-filter filetree in git mode).

type TagChangedMsg

type TagChangedMsg struct{}

TagChangedMsg is emitted after tag operations (create, delete) so that other panels can refresh their tag-dependent state.

type TargetedPanelMsg

type TargetedPanelMsg struct {
	Inner  tea.Msg // the actual message to deliver
	Target string  // panel name (e.g. "gitinfo")
}

TargetedPanelMsg wraps a message that should only be delivered to a specific panel by name, avoiding unnecessary broadcast to all panels. This prevents periodic tick messages (e.g. animation frames) from triggering full-UI re-renders when only one panel needs the update.

type TerminalExitedMsg

type TerminalExitedMsg struct {
	ExitCode int
}

TerminalExitedMsg is emitted when the embedded terminal's shell process exits.

type TerminalOutputMsg

type TerminalOutputMsg struct {
	Lines []string
}

--------------------------------------------------------------------------- Terminal messages --------------------------------------------------------------------------- TerminalOutputMsg notifies other panels that new terminal output is available. Lines contains the latest snapshot of all output lines.

type ToggleBlameMsg

type ToggleBlameMsg struct {
	Path string
}

ToggleBlameMsg requests toggling blame annotations for the given file. Emitted by the preview panel when the user presses B; the root model catches this to start an async git-blame load.

type ToggleBookmarksMsg

type ToggleBookmarksMsg struct{}

ToggleBookmarksMsg requests showing or hiding the bookmarks overlay panel.

type ToggleExtensionsMsg

type ToggleExtensionsMsg struct{}

--------------------------------------------------------------------------- Extension messages --------------------------------------------------------------------------- ToggleExtensionsMsg requests showing or hiding the extensions overlay panel.

type ToggleFuzzyFinderMsg

type ToggleFuzzyFinderMsg struct{}

ToggleFuzzyFinderMsg is sent to show or hide the fuzzy finder overlay. When the fuzzy finder is visible, this message closes it; when hidden, this message has no effect (opening is handled by specific actions).

type ToggleHelpMsg

type ToggleHelpMsg struct{}

ToggleHelpMsg requests showing or hiding the help overlay panel.

type UndoMsg

type UndoMsg struct{}

UndoMsg is sent when the user requests an undo operation (ctrl+z). The root model intercepts this and delegates to the UndoManager.

type UndoResultMsg

type UndoResultMsg struct {
	Err         error
	Description string
}

UndoResultMsg is sent after an undo or redo operation completes. It carries a human-readable description or an error for toast display.

type WorkflowSelectedMsg

type WorkflowSelectedMsg struct {
	Name string // e.g. "CI"
	Path string // e.g. ".github/workflows/ci.yml"
}

WorkflowSelectedMsg is sent when the user selects a workflow definition in the Workflows tab. Preview pane should show the workflow file contents.

type WorktreeChangedMsg

type WorktreeChangedMsg struct{}

WorktreeChangedMsg is emitted after worktree create/remove so that other panels can react (e.g. refresh worktree-dependent state).

type WorktreeSelectedMsg

type WorktreeSelectedMsg struct {
	Path   string
	Branch string
}

WorktreeSelectedMsg is sent when a worktree is selected (without switching).

Directories

Path Synopsis
Package agents implements the Agent Monitor panel for grut.
Package agents implements the Agent Monitor panel for grut.
Package aiconflict implements a three-way diff panel with AI-powered conflict resolution suggestions.
Package aiconflict implements a three-way diff panel with AI-powered conflict resolution suggestions.
Package bookmarks implements the bookmarks overlay panel for grut.
Package bookmarks implements the bookmarks overlay panel for grut.
Package branches implements the branch management panel for grut.
Package branches implements the branch management panel for grut.
Package commits implements the commits panel for grut.
Package commits implements the commits panel for grut.
Package conflicts implements the conflict resolution panel for grut.
Package conflicts implements the conflict resolution panel for grut.
Package context implements the context builder panel for grut.
Package context implements the context builder panel for grut.
Package extensions implements the extension management panel for grut.
Package extensions implements the extension management panel for grut.
Package filetree implements the file explorer panel for grut.
Package filetree implements the file explorer panel for grut.
Package fuzzyfinder implements a fuzzy search overlay for grut.
Package fuzzyfinder implements a fuzzy search overlay for grut.
Package gitdiff implements the diff viewer panel for the grut TUI.
Package gitdiff implements the diff viewer panel for the grut TUI.
Package gitinfo implements a combined panel that displays branches, worktrees, and remotes as switchable tabs within a single panel.
Package gitinfo implements a combined panel that displays branches, worktrees, and remotes as switchable tabs within a single panel.
Package gitlog implements the git log panel for grut.
Package gitlog implements the git log panel for grut.
Package gitstatus implements the Git Status panel for grut.
Package gitstatus implements the Git Status panel for grut.
Package help implements the help overlay panel for grut.
Package help implements the help overlay panel for grut.
Package preview implements the file preview panel for the grut TUI.
Package preview implements the file preview panel for the grut TUI.
Package review implements the diff review panel for grut.
Package review implements the diff review panel for grut.
Package settings implements the settings overlay panel for grut.
Package settings implements the settings overlay panel for grut.
Package stash implements the stash management and cherry-pick panel for grut.
Package stash implements the stash management and cherry-pick panel for grut.
Package terminal implements the embedded terminal panel for grut.
Package terminal implements the embedded terminal panel for grut.
Package welcome implements the first-run welcome overlay panel for grut.
Package welcome implements the first-run welcome overlay panel for grut.
Package worktrees implements the worktree management panel for grut.
Package worktrees implements the worktree management panel for grut.

Jump to

Keyboard shortcuts

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