Documentation
¶
Overview ¶
Package workspace manages git worktrees and tmux sessions for parallel development workflows, with AI agent orchestration, PR fetching, and interactive shell access.
Index ¶
- Constants
- Variables
- func ApplyEnvOverrides(baseEnv []string, overrides map[string]string) []string
- func BuildEnvOverrides(mainRepoPath string) map[string]string
- func GenerateExportCommands(overrides map[string]string) []string
- func GenerateSingleEnvCommand(overrides map[string]string) string
- func LayoutPanes(root *PaneNode, box Box, floors Floors) ([]Placement, []Divider, bool)
- func SanitizeBranchName(name string) string
- func SetRatio(root *PaneNode, id, ratio int) bool
- func SlugifyWorktreeName(name string) string
- func ValidateBranchName(name string) (bool, []string, string)
- func WorktreeActionRefusal(wt *Worktree, action WorktreeAction) string
- type Agent
- type AgentOutputMsg
- type AgentPollUnchangedMsg
- type AgentStartedMsg
- type AgentStoppedMsg
- type AgentType
- type ApproveResultMsg
- type AsyncCaptureResultMsg
- type AsyncShellCaptureResultMsg
- type BaseUpdateResult
- type Box
- type BranchListMsg
- type CheckPRMergedMsg
- type CleanupDoneMsg
- type CleanupPlan
- type CleanupResults
- type CommitDetailLoadedMsg
- type CommitFileDiffLoadedMsg
- type CommitStatusInfo
- type CommitStatusLoadedMsg
- type Conflict
- type ConflictsDetectedMsg
- type Content
- type CreateDoneMsg
- type CreateOpenAnywayMsg
- type CreateOperationPlan
- type CreateOutcomeKind
- type CreatePlanResolvedMsg
- type CreateRecoveryDeleteDoneMsg
- type CreateRecoveryDeleteResult
- type CreateSetupDoneMsg
- type CreateSetupOutcome
- type CreateSetupResult
- type CreateWorktreeAddedMsg
- type CreateWorktreeMsg
- type DeleteDoneMsg
- type DeleteWorktreeMsg
- type DiffErrorMsg
- type DiffLoadedMsg
- type DiffScope
- type DiffSnapshot
- type DiffTabFocus
- type DiffViewMode
- type DirectMergeDoneMsg
- type DirectMergeOperation
- type DirectMergePreflightMsg
- type DirectMergeRecovery
- type Divider
- type FetchPRDoneMsg
- type FetchPRListMsg
- type Floors
- type FocusPane
- type FullFileDiffLoadedMsg
- type GitStats
- type InteractivePasteResultMsg
- type InteractiveSessionDeadMsg
- type InteractiveState
- type LoadState
- type LocalBranchesMsg
- type MergeCommitDoneMsg
- type MergeCommitState
- type MergeResolutionMsg
- type MergeStepCompleteMsg
- type MergeWorkflowState
- type MergeWorkflowStep
- type OpenCreateModalWithTaskMsg
- type OperationScope
- type PRGenerationDoneMsg
- type PRIdentity
- type PRListItem
- type PRPollKind
- type PRPollResult
- type PaneFloor
- type PaneKind
- type PaneLayout
- type PaneNode
- type PaneSplit
- type Placement
- type Plugin
- func (p *Plugin) Approve(wt *Worktree) tea.Cmd
- func (p *Plugin) ApproveAll() tea.Cmd
- func (p *Plugin) AtFocusCycleEnd(reverse bool) bool
- func (p *Plugin) AttachToSession(wt *Worktree) tea.Cmd
- func (p *Plugin) AttachToWorktreeDir(wt *Worktree) tea.Cmd
- func (p *Plugin) BlocksGlobalKeys() bool
- func (p *Plugin) Cleanup(removeSessions bool) error
- func (p *Plugin) CleanupOrphanedSessions() error
- func (p *Plugin) Commands() []plugin.Command
- func (p *Plugin) ConsumesTextInput() bool
- func (p *Plugin) Cursor() *tea.Cursor
- func (p *Plugin) FocusContext() string
- func (p *Plugin) FocusCycleStart(reverse bool) tea.Cmd
- func (p *Plugin) ID() string
- func (p *Plugin) Icon() string
- func (p *Plugin) Init(ctx *plugin.Context) error
- func (p *Plugin) IsFocused() bool
- func (p *Plugin) Name() string
- func (p *Plugin) PreferredMouseMode() tea.MouseMode
- func (p *Plugin) PrepareTerminalLinks()
- func (p *Plugin) Reject(wt *Worktree) tea.Cmd
- func (p *Plugin) ResizeDragActive() bool
- func (p *Plugin) SendText(wt *Worktree, text string) tea.Cmd
- func (p *Plugin) SetFocused(f bool)
- func (p *Plugin) SetPendingWorkspaceSelection(selection plugin.PendingWorkspaceSelection)
- func (p *Plugin) SetResourceMatchers(matchers []terminallink.ResourceMatcher)
- func (p *Plugin) SetResourceResolver(resolve resourceview.Resolver) tea.Cmd
- func (p *Plugin) SetTerminalLinkCoordinator(coordinator termpreview.LinkCoordinator)
- func (p *Plugin) Start() tea.Cmd
- func (p *Plugin) StartAgent(wt *Worktree, agentType AgentType) tea.Cmd
- func (p *Plugin) StartAgentWithOptions(wt *Worktree, agentType AgentType, skipPerms bool) tea.Cmd
- func (p *Plugin) Stop()
- func (p *Plugin) StopAgent(wt *Worktree) tea.Cmd
- func (p *Plugin) TakePendingWorkspaceAction() tea.Cmd
- func (p *Plugin) Update(msg tea.Msg) (plugin.Plugin, tea.Cmd)
- func (p *Plugin) View(width, height int) string
- func (p *Plugin) WheelAtBoundary(msg tea.MouseWheelMsg) bool
- type PullAfterMergeMsg
- type PushDoneMsg
- type PushMsg
- type RebaseResolutionMsg
- type RefreshDoneMsg
- type RefreshMsg
- type RejectResultMsg
- type RemoteBranchDeleteMsg
- type RemoteCheckDoneMsg
- type RenameShellDoneMsg
- type RenameWorktreeDoneMsg
- type Render
- type RepoSnapshot
- type ResumeConversationMsg
- type SendTextResultMsg
- type SetupConfig
- type ShellAgentErrorMsg
- type ShellAgentStartedMsg
- type ShellCreatedMsg
- type ShellDefinition
- type ShellDetachedMsg
- type ShellKilledMsg
- type ShellLeafCloseProbeMsg
- type ShellManifest
- func (m *ShellManifest) AddShell(def ShellDefinition) error
- func (m *ShellManifest) BackfillWorkDirs(byTmux map[string]string) error
- func (m *ShellManifest) EnsureShells(defs []ShellDefinition) (bool, error)
- func (m *ShellManifest) FindShell(tmuxName string) *ShellDefinition
- func (m *ShellManifest) Path() string
- func (m *ShellManifest) RemoveShell(tmuxName string) error
- func (m *ShellManifest) RenameShell(tmuxName, namespace, name string) (shellstate.RenameResult, error)
- func (m *ShellManifest) Revision() uint64
- func (m *ShellManifest) UpdateShell(def ShellDefinition) error
- type ShellManifestChangedMsg
- type ShellOutputMsg
- type ShellSession
- type ShellSessionDeadMsg
- type ShellWatcher
- type Size
- type SplitAxis
- type StatsErrorMsg
- type StatsLoadedMsg
- type Task
- type TaskLinkedMsg
- type TaskSearchResultsMsg
- type TermPanelSeedFailedMsg
- type TermPanelSessionCreatedMsg
- type TmuxAttachFinishedMsg
- type UncommittedChangesCheckMsg
- type ViewMode
- type WatchEventMsg
- type WatcherErrorMsg
- type WatcherStartedMsg
- type WorkDirDeletedMsg
- type Worktree
- type WorktreeAction
- type WorktreeChanges
- type WorktreeDirtyCheckedMsg
- type WorktreeSnapshot
- type WorktreeStatus
Constants ¶
const ( PaneTerminal = panelayout.Terminal PaneDoc = panelayout.Document PaneIssue = panelayout.Issue PaneDiff = panelayout.Diff PaneResource = panelayout.Resource // PaneShell is a live terminal peer of the primary terminal. The terminal // panel is the first one: see shell_leaf.go. PaneShell = panelayout.Shell PaneNote = panelayout.Note )
const ( SplitCols = panelayout.Columns SplitRows = panelayout.Rows )
const ( DiffViewUnified = workspacediff.ViewUnified DiffViewSideBySide = workspacediff.ViewSideBySide DiffViewFullFile = workspacediff.ViewFullFile DiffScopeWorkingTree = workspacediff.ScopeWorkingTree DiffScopeCommits = workspacediff.ScopeCommits DiffScopeAggregate = workspacediff.ScopeAggregate LoadStateUnknown = workspacediff.LoadStateUnknown LoadStateLoading = workspacediff.LoadStateLoading LoadStateClean = workspacediff.LoadStateClean LoadStateReady = workspacediff.LoadStateReady LoadStateTruncated = workspacediff.LoadStateTruncated LoadStateError = workspacediff.LoadStateError DiffTabFocusFileList = workspacediff.FocusFileList DiffTabFocusDiff = workspacediff.FocusDiff DiffTabFocusCommitFiles = workspacediff.FocusCommitFiles DiffTabFocusCommitDiff = workspacediff.FocusCommitDiff )
const AckDwell = 2 * time.Second
AckDwell is how long a session's output must stay selected before its completion is treated as read. Short enough to feel immediate when you stop on a card, long enough that scrolling through the list clears nothing.
Variables ¶
var AgentCommands = buildAgentCommands()
AgentCommands maps agent types to their CLI commands.
var AgentDisplayNames = buildAgentDisplayNames()
AgentDisplayNames provides human-readable names for agent types.
var AgentTypeOrder = append(catalogAgentTypes(), AgentNone)
AgentTypeOrder defines the order of agents in selection UI.
var DefaultEnvOverrides = map[string]string{
"GOWORK": "off",
"GOFLAGS": "",
"NODE_OPTIONS": "",
"NODE_PATH": "",
"PYTHONPATH": "",
"VIRTUAL_ENV": "",
}
DefaultEnvOverrides contains environment variables to clear/override for worktree isolation. These prevent common issues when running commands in worktrees.
var PrintModeArgs = map[AgentType][]string{ AgentClaude: {"-p"}, AgentCodex: {"exec", "-"}, AgentAntigravity: {"-p"}, }
PrintModeArgs maps agent types to their non-interactive/print mode CLI arguments. Agents with print mode can generate output to stdout without an interactive session. Only agents that support true non-interactive one-shot output are included. Values are passed as arguments to exec.Command after the agent binary name.
var ShellAgentOrder = append([]AgentType{AgentNone}, catalogAgentTypes()...)
ShellAgentOrder defines agent order for shell creation (None first as default). td-a902fe: shells default to no agent, so "None" is first.
var SkipPermissionsFlags = buildSkipPermissionsFlags()
SkipPermissionsFlags maps agent types to their skip-permissions CLI flags. Derived from workspaceops.AgentSkipFlag so this map cannot drift from the one the creation forms use; agents without a known flag resolve to "".
var SystemPromptAppendFlags = map[AgentType]string{ AgentClaude: "--append-system-prompt", AgentGrok: "--rules", }
SystemPromptAppendFlags maps agent types to the flag that appends text to their system prompt for one session. Only harnesses with a documented flag appear here: guidance an agent never sees is worse than none, and a guessed flag would break the launch outright. Harnesses without one rely on the SIDECAR_SHELL_NAME environment cue (and project docs such as AGENTS.md).
Grok: --rules appends session rules (documented alias: --append-system-prompt). Claude: --append-system-prompt.
Functions ¶
func ApplyEnvOverrides ¶
ApplyEnvOverrides applies overrides to an existing environment slice. Returns a new slice with overrides applied.
func BuildEnvOverrides ¶
BuildEnvOverrides returns the combined environment overrides for a worktree. User overrides from .worktree-env take precedence over defaults.
func GenerateExportCommands ¶
GenerateExportCommands generates shell commands to apply environment overrides. Empty values generate unset commands, non-empty generate export commands.
func GenerateSingleEnvCommand ¶
GenerateSingleEnvCommand returns a single shell command that applies all env overrides. This is less noisy than sending multiple commands individually.
func LayoutPanes ¶ added in v0.98.0
func SanitizeBranchName ¶
SanitizeBranchName converts a string to a valid git branch name. The output should always pass ValidateBranchName.
func SlugifyWorktreeName ¶ added in v1.0.0
SlugifyWorktreeName turns a display name into a git-safe branch and directory component. An empty result means the name cannot be used.
func ValidateBranchName ¶
ValidateBranchName validates a git branch name and returns validation state. Returns: (valid, errors, sanitized suggestion) Based on git-check-ref-format rules.
func WorktreeActionRefusal ¶ added in v0.94.0
func WorktreeActionRefusal(wt *Worktree, action WorktreeAction) string
WorktreeActionRefusal returns a user-facing reason when an action is unsafe.
Types ¶
type Agent ¶
type Agent struct {
Type AgentType // claude, codex, aider, gemini
TmuxSession string // tmux session name
TmuxPane string // Pane identifier (e.g., "%12" - globally unique)
PID int // Process ID (if available)
StartedAt time.Time
LastOutput time.Time // Last time output was detected
OutputBuf *tty.OutputBuffer // Last N lines of output
WaitingFor string // Prompt text if waiting
Activity agentactivity.Tracker
ActivityCapturedAt time.Time
// Runaway detection fields (td-018f25)
// Track recent poll times to detect continuous output that would cause CPU spikes.
RecentPollTimes []time.Time // Last N poll times for runaway detection
PollsThrottled bool // True if this agent is throttled due to continuous output
UnchangedPollCount int // Consecutive unchanged polls (for throttle reset)
}
Agent represents an AI coding agent process.
func (*Agent) CheckRunaway ¶
CheckRunaway checks if this agent should be throttled (td-018f25). Returns true and sets PollsThrottled if runaway condition is detected.
func (*Agent) RecordPollTime ¶
func (a *Agent) RecordPollTime()
RecordPollTime records a poll time for runaway detection (td-018f25). Should be called when an AgentOutputMsg (content changed) is received.
func (*Agent) RecordUnchangedPoll ¶
func (a *Agent) RecordUnchangedPoll()
RecordUnchangedPoll records an unchanged poll for throttle reset (td-018f25). Should be called when an AgentPollUnchangedMsg is received.
type AgentOutputMsg ¶
type AgentOutputMsg struct {
WorkspaceName string
Generation int
AgentType AgentType // Live provider inferred from the captured pane
Output string
Status WorktreeStatus
WaitingFor string
// Cursor position captured atomically with output (only set in interactive mode)
CursorRow int
CursorCol int
CursorVisible bool
HasCursor bool // True if cursor position was captured
PaneHeight int // Tmux pane height for cursor offset calculation
PaneWidth int // Tmux pane width for display alignment
HistorySize int
CaptureBase int
HasHistory bool
// RowsJoined says the capture was taken with -J, so it carries no usable
// history/pane split.
RowsJoined bool
// MouseReporting is tmux's #{mouse_any_flag} for the pane. Only meaningful
// when HasCursor is set.
MouseReporting bool
Activity agentactivity.Result
CapturedAt time.Time
PaneTitle string
CurrentCommand string
}
AgentOutputMsg delivers new agent output.
type AgentPollUnchangedMsg ¶
type AgentPollUnchangedMsg struct {
WorkspaceName string
Generation int
AgentType AgentType // Live provider inferred from the captured pane
Output string
CurrentStatus WorktreeStatus // Status including session file re-check
WaitingFor string // Prompt text if waiting
// Cursor position captured atomically (even when content unchanged)
CursorRow int
CursorCol int
CursorVisible bool
HasCursor bool
PaneHeight int // Tmux pane height for cursor offset calculation
PaneWidth int // Tmux pane width for display alignment
HistorySize int
CaptureBase int
HasHistory bool
// RowsJoined says the capture was taken with -J, so it carries no usable
// history/pane split.
RowsJoined bool
// MouseReporting is tmux's #{mouse_any_flag} for the pane. Only meaningful
// when HasCursor is set.
MouseReporting bool
Activity agentactivity.Result
CapturedAt time.Time
PaneTitle string
CurrentCommand string
}
AgentPollUnchangedMsg signals content unchanged, schedule next poll.
type AgentStartedMsg ¶
type AgentStartedMsg struct {
Epoch uint64 // Epoch when request was issued (for stale detection)
WorktreeKey string
WorkspaceName string
SessionName string
PaneID string // tmux pane ID (e.g., "%12") for interactive mode
AgentType AgentType
Reconnected bool // True if we reconnected to an existing session
Err error
}
AgentStartedMsg signals an agent has been started in a worktree.
func (AgentStartedMsg) GetEpoch ¶
func (m AgentStartedMsg) GetEpoch() uint64
GetEpoch implements plugin.EpochMessage.
type AgentStoppedMsg ¶
AgentStoppedMsg signals an agent has stopped.
type AgentType ¶
type AgentType string
AgentType represents the type of AI coding agent.
const ( AgentNone AgentType = "" // No agent (attach only) AgentClaude AgentType = "claude" // Claude Code AgentCodex AgentType = "codex" // Codex CLI AgentCopilot AgentType = "copilot" // GitHub Copilot CLI AgentAider AgentType = "aider" // Aider AgentAntigravity AgentType = "antigravity" // Antigravity (agy) AgentCursor AgentType = "cursor" // Cursor Agent AgentOpenCode AgentType = "opencode" // OpenCode AgentPi AgentType = "pi" // Pi Agent AgentAmp AgentType = "amp" // Amp AgentGrok AgentType = "grok" // Grok Build AgentCustom AgentType = "custom" // Custom command AgentShell AgentType = "shell" // Project shell (not an AI agent) )
type ApproveResultMsg ¶
ApproveResultMsg signals the result of an approve action.
type AsyncCaptureResultMsg ¶
type AsyncCaptureResultMsg struct {
WorkspaceName string // Worktree this capture is for
SessionName string // tmux session name
Output string // Captured output (empty on error)
Err error // Non-nil if capture failed
}
AsyncCaptureResultMsg delivers async tmux capture results. Used to avoid blocking the UI thread on tmux subprocess calls (td-c2961e).
type AsyncShellCaptureResultMsg ¶
type AsyncShellCaptureResultMsg struct {
TmuxName string // Shell session tmux name
Output string // Captured output (empty on error)
Err error // Non-nil if capture failed
}
AsyncShellCaptureResultMsg delivers async shell capture results.
type BaseUpdateResult ¶ added in v0.94.0
type BaseUpdateResult struct {
Branch string
TargetPath string
Fetched bool
Updated bool
LeftUnchanged bool
Message string
Err error
}
BaseUpdateResult describes a safe post-merge base refresh.
type Box ¶ added in v0.98.0
type Box = panelayout.Box
type BranchListMsg ¶
type BranchListMsg struct {
OperationScope
Branches []string
Err error
}
BranchListMsg delivers available branches.
type CheckPRMergedMsg ¶
type CheckPRMergedMsg struct {
OperationScope
WorkspaceName string
Result PRPollResult
}
CheckPRMergedMsg signals the result of checking if a PR was merged.
type CleanupDoneMsg ¶
type CleanupDoneMsg struct {
OperationScope
WorkspaceName string
Results *CleanupResults
}
CleanupDoneMsg signals that cleanup operations completed.
type CleanupPlan ¶ added in v0.94.0
type CleanupPlan struct {
RepoPath string
// ProjectRoot is the owning project, whose manifest records the shells
// rooted in the worktree. It is not RepoPath, which is only a surviving
// checkout the git commands run from.
ProjectRoot string
WorktreePath string
Branch string
ExpectedOID string
BranchRemote string
ExpectedRemoteOID string
BaseRemote string
BaseBranch string
DeleteWorktree bool
DeleteBranch bool
DeleteRemote bool
UpdateBase bool
PRIdentity *PRIdentity
ReviewedOID string
ForceDeleteBranch bool
}
CleanupPlan is captured before cleanup starts and executed in order.
type CleanupResults ¶
type CleanupResults struct {
LocalWorktreeDeleted bool
LocalBranchDeleted bool
RemoteBranchDeleted bool
PullAttempted bool
PullSuccess bool
PullError error
Errors []string
// Error detail expansion state (for UX improvements)
ShowErrorDetails bool // Toggle for expanded error view
PullErrorSummary string // Concise 1-line summary
PullErrorFull string // Full git output for details view
PullMessage string // Explicit update/intentional-no-update result
BranchDiverged bool // Enables rebase/merge resolution actions
BaseBranch string // Branch name for resolution commands
}
CleanupResults holds the results of cleanup operations for display in summary.
type CommitDetailLoadedMsg ¶ added in v0.81.0
type CommitDetailLoadedMsg struct {
Epoch uint64
WorkspaceName string
CommitHash string
Commit *gitstatus.Commit
Err error
}
CommitDetailLoadedMsg is sent when commit detail (file list) is loaded.
func (CommitDetailLoadedMsg) GetEpoch ¶ added in v0.81.0
func (m CommitDetailLoadedMsg) GetEpoch() uint64
GetEpoch implements plugin.EpochMessage.
type CommitFileDiffLoadedMsg ¶ added in v0.81.0
type CommitFileDiffLoadedMsg struct {
Epoch uint64
WorkspaceName string
CommitHash string
FilePath string
Raw string
Err error
}
CommitFileDiffLoadedMsg is sent when a commit file's diff is loaded.
func (CommitFileDiffLoadedMsg) GetEpoch ¶ added in v0.81.0
func (m CommitFileDiffLoadedMsg) GetEpoch() uint64
GetEpoch implements plugin.EpochMessage.
type CommitStatusInfo ¶
type CommitStatusInfo = workspacediff.CommitInfo
CommitStatusInfo holds commit information with merge/push status.
type CommitStatusLoadedMsg ¶
type CommitStatusLoadedMsg struct {
Epoch uint64 // Epoch when request was issued (for stale detection)
WorkspaceName string
Commits []CommitStatusInfo
Err error
}
CommitStatusLoadedMsg delivers commit status info for the diff view header.
func (CommitStatusLoadedMsg) GetEpoch ¶
func (m CommitStatusLoadedMsg) GetEpoch() uint64
GetEpoch implements plugin.EpochMessage.
type Conflict ¶
type Conflict struct {
Worktrees []string // Stable keys of worktrees with overlapping dirty files
Files []string // List of conflicting files
}
Conflict represents a file conflict between worktrees.
type ConflictsDetectedMsg ¶
type ConflictsDetectedMsg struct {
OperationScope
Conflicts []Conflict
Err error
}
ConflictsDetectedMsg signals that conflicts have been detected.
type Content ¶ added in v0.99.0
Content, Size and Render are the shared frame's contract. They are aliased rather than redeclared so a leaf written for this plugin and a leaf written for the global Workspaces browser are the same type, and neither surface can grow a private notion of what a pane is.
type CreateDoneMsg ¶
type CreateDoneMsg struct {
OperationScope
Worktree *Worktree
AgentType AgentType // Agent selected at creation
SkipPerms bool // Whether to skip permissions
Err error
}
CreateDoneMsg signals worktree creation completed.
type CreateOpenAnywayMsg ¶ added in v0.94.0
type CreateOpenAnywayMsg struct{ OperationScope }
type CreateOperationPlan ¶ added in v0.94.0
type CreateOperationPlan struct {
RepoKey string
OperationID string
SourceWorktree string
MainWorktree string
SourceRef string
SourceOID string
Branch string
Path string
DisplayName string
TaskID string
TaskTitle string
AgentType AgentType
SkipPerms bool
RemotePolicy string
CopyEnv bool
EnvFiles []string
RunHook bool
HookPath string
HookRequired bool
}
CreateOperationPlan is the immutable contract shown to the user before any repository mutation. It is also retained for retry and identity-checked undo.
type CreateOutcomeKind ¶ added in v0.94.0
type CreateOutcomeKind string
const ( CreateOutcomeIdentity CreateOutcomeKind = "identity" CreateOutcomeTDRoot CreateOutcomeKind = "td-root" CreateOutcomeTaskLink CreateOutcomeKind = "task-link" CreateOutcomeTDStart CreateOutcomeKind = "td-start" CreateOutcomeAgent CreateOutcomeKind = "agent-metadata" CreateOutcomeEnv CreateOutcomeKind = "env-copy" CreateOutcomeHook CreateOutcomeKind = "setup-hook" )
type CreatePlanResolvedMsg ¶ added in v0.94.0
type CreatePlanResolvedMsg struct {
OperationScope
Plan *CreateOperationPlan
Err error
}
CreatePlanResolvedMsg completes the non-mutating Git-plumbing preflight.
type CreateRecoveryDeleteDoneMsg ¶ added in v0.94.0
type CreateRecoveryDeleteDoneMsg struct {
OperationScope
Result CreateRecoveryDeleteResult
}
type CreateRecoveryDeleteResult ¶ added in v0.94.0
type CreateSetupDoneMsg ¶ added in v0.94.0
type CreateSetupDoneMsg struct {
OperationScope
Plan *CreateOperationPlan
Result *CreateSetupResult
}
type CreateSetupOutcome ¶ added in v0.94.0
type CreateSetupOutcome struct {
Kind CreateOutcomeKind
Action string
Err error
Required bool
}
CreateSetupOutcome records one independently recoverable setup action.
type CreateSetupResult ¶ added in v0.94.0
type CreateSetupResult struct {
Worktree *Worktree
Outcomes []CreateSetupOutcome
}
func (*CreateSetupResult) HasRequiredFailure ¶ added in v0.94.0
func (r *CreateSetupResult) HasRequiredFailure() bool
func (*CreateSetupResult) Warnings ¶ added in v0.94.0
func (r *CreateSetupResult) Warnings() []CreateSetupOutcome
type CreateWorktreeAddedMsg ¶ added in v0.94.0
type CreateWorktreeAddedMsg struct {
OperationScope
Plan *CreateOperationPlan
Worktree *Worktree
Err error
}
CreateWorktreeAddedMsg means Git created the worktree. Setup is a separate, recoverable phase and may still produce warnings or a required failure.
type CreateWorktreeMsg ¶
CreateWorktreeMsg requests worktree creation.
type DeleteDoneMsg ¶
type DeleteDoneMsg struct {
OperationScope
Name string
Err error
Warnings []string // Non-fatal warnings (e.g., branch deletion failures)
}
DeleteDoneMsg signals worktree deletion completed.
type DeleteWorktreeMsg ¶
DeleteWorktreeMsg requests worktree deletion.
type DiffErrorMsg ¶
type DiffErrorMsg struct {
OperationScope
WorkspaceName string
Err error
Command string
BaseRef string
}
DiffErrorMsg signals diff loading failed.
func (DiffErrorMsg) GetEpoch ¶ added in v0.94.0
func (m DiffErrorMsg) GetEpoch() uint64
type DiffLoadedMsg ¶
type DiffLoadedMsg struct {
OperationScope
WorkspaceName string
Identity string
Content string
Raw string
Snapshot *DiffSnapshot
}
DiffLoadedMsg delivers diff content for a worktree.
func (DiffLoadedMsg) GetEpoch ¶
func (m DiffLoadedMsg) GetEpoch() uint64
GetEpoch implements plugin.EpochMessage.
type DiffScope ¶ added in v0.94.0
type DiffScope = workspacediff.Scope
Diff view types live in workspacediff so the global preview can use the same model without constructing a Plugin.
type DiffSnapshot ¶ added in v0.94.0
type DiffSnapshot = workspacediff.Snapshot
DiffSnapshot contains all three explicit diff views resolved from the same immutable worktree/base identity.
type DiffTabFocus ¶ added in v0.81.0
type DiffTabFocus = workspacediff.Focus
Diff view types live in workspacediff so the global preview can use the same model without constructing a Plugin.
type DiffViewMode ¶
type DiffViewMode = workspacediff.ViewMode
Diff view types live in workspacediff so the global preview can use the same model without constructing a Plugin.
type DirectMergeDoneMsg ¶
type DirectMergeDoneMsg struct {
OperationScope
WorkspaceName string
BaseBranch string
Operation *DirectMergeOperation
Err error
}
DirectMergeDoneMsg signals that direct merge completed.
type DirectMergeOperation ¶ added in v0.94.0
type DirectMergeOperation struct {
SourcePath string
TargetPath string
SourceBranch string
TargetBranch string
Remote string
SourceOID string
TargetOID string // target HEAD captured during visible preflight
PreMergeOID string // target HEAD immediately before merge, after ff-only update
MergeOID string
Completed []string
Recovery DirectMergeRecovery
GitState string
Err error
Aborted bool
// contains filtered or unexported fields
}
DirectMergeOperation is the immutable context and accumulated result of a merge.
type DirectMergePreflightMsg ¶ added in v0.94.0
type DirectMergePreflightMsg struct {
OperationScope
WorkspaceName string
BaseBranch string
Operation *DirectMergeOperation
Err error
}
type DirectMergeRecovery ¶ added in v0.94.0
type DirectMergeRecovery string
DirectMergeRecovery describes the safe actions available after a failed merge.
const ( DirectMergeRecoveryNone DirectMergeRecovery = "" DirectMergeRecoveryConflict DirectMergeRecovery = "conflict" DirectMergeRecoveryPushFailure DirectMergeRecovery = "push-failure" )
type Divider ¶ added in v0.98.0
type Divider = panelayout.Divider
type FetchPRDoneMsg ¶
type FetchPRDoneMsg struct {
OperationScope
Worktree *Worktree
AlreadyLocal bool // branch already existed locally
Branch string // for finding existing worktree when Worktree is nil
Err error
}
FetchPRDoneMsg signals that a PR branch was fetched and worktree created.
type FetchPRListMsg ¶
type FetchPRListMsg struct {
OperationScope
PRs []PRListItem
Err error
}
FetchPRListMsg delivers the list of open PRs from gh CLI.
type Floors ¶ added in v0.98.0
type Floors = panelayout.Floors
type FullFileDiffLoadedMsg ¶ added in v0.81.0
type FullFileDiffLoadedMsg struct {
Epoch uint64
WorkspaceName string
Identity string
OldContent string
NewContent string
Parsed *gitstatus.ParsedDiff
FilePath string
CommitHash string // Non-empty when loaded for a commit file diff
}
FullFileDiffLoadedMsg is sent when full-file content is loaded for workspace diff view.
func (FullFileDiffLoadedMsg) GetEpoch ¶ added in v0.81.0
func (m FullFileDiffLoadedMsg) GetEpoch() uint64
GetEpoch implements plugin.EpochMessage.
type GitStats ¶
type GitStats struct {
Additions int
Deletions int
FilesChanged int
Ahead int // Commits ahead of base branch
Behind int // Commits behind base branch
}
GitStats holds file change statistics.
type InteractivePasteResultMsg ¶
InteractivePasteResultMsg reports clipboard paste results for interactive mode.
type InteractiveSessionDeadMsg ¶
type InteractiveSessionDeadMsg struct{}
InteractiveSessionDeadMsg indicates the tmux session has ended. Sent when send-keys or capture fails with a session/pane not found error.
type InteractiveState ¶
type InteractiveState struct {
// Active indicates whether interactive mode is currently active.
Active bool
// TargetPane is the tmux pane ID (e.g., "%12") receiving input.
TargetPane string
// TargetSession is the tmux session name for the active pane.
TargetSession string
// TermPanel is true when interactive mode targets the terminal panel session
// (rather than the main agent/shell session).
TermPanel bool
// PaneOnEntry is the pane that was active before interactive mode took over.
// leaveInteractiveMode (Esc) restores it so Enter-from-the-list still
// returns to the list. Other exits leave the ring on the live pane.
// Interactive mode forces the preview pane active so the embedded terminal
// owns the cursor and mouse mode (td-62b8ab).
PaneOnEntry FocusPane
// LastKeyTime tracks when the last key was sent for polling decay.
LastKeyTime time.Time
// CursorRow and CursorCol track the cached cursor position for overlay rendering.
// Updated asynchronously via cursorPositionMsg from poll handler (td-648af4).
CursorRow int
CursorCol int
// CursorVisible indicates if the cursor should be rendered.
// Updated asynchronously via cursorPositionMsg from poll handler (td-648af4).
CursorVisible bool
// PaneHeight tracks the tmux pane height for cursor offset calculation.
// Used to adjust cursor_y when display height differs from pane height, and
// to find pane row 0 in the buffer: a capture ends at the bottom of the
// pane, so its last PaneHeight rows are the pane.
PaneHeight int
// PaneWidth tracks the tmux pane width for display width alignment.
PaneWidth int
// BracketedPasteEnabled tracks whether the target app has enabled
// bracketed paste mode (ESC[?2004h). Updated from captured output.
BracketedPasteEnabled bool
// MouseReportingEnabled tracks whether the application in the target pane has
// asked for mouse events. It is mirrored from the terminal component and read
// only to describe the surface: who owns a click or a notch is that
// component's PaneMouseReporting, so the two can never disagree.
MouseReportingEnabled bool
// LastResizeAt tracks the last time we attempted to resize the tmux pane.
LastResizeAt time.Time
// ResizeRetryPending records that a deferred assertion of the pane's
// geometry is already armed. A layout still moving delivers one size per
// frame; without this each of them would arm its own retry and the burst
// would become a chain of resizes spaced a debounce window apart.
ResizeRetryPending bool
}
InteractiveState tracks state for interactive mode (tmux input passthrough). Feature-gated behind tmux_interactive_input feature flag.
type LoadState ¶ added in v0.94.0
type LoadState = workspacediff.LoadState
Diff view types live in workspacediff so the global preview can use the same model without constructing a Plugin.
type LocalBranchesMsg ¶
type LocalBranchesMsg struct {
OperationScope
Branches []string
Err error
}
LocalBranchesMsg returns available local branches for target selection.
type MergeCommitDoneMsg ¶
type MergeCommitDoneMsg struct {
OperationScope
WorkspaceName string
CommitHash string
// NothingToCommit reports that the worktree was already clean by the time
// the commit ran (the modal's counts came from a cached status snapshot).
NothingToCommit bool
Err error
}
MergeCommitDoneMsg signals that the commit before merge completed.
type MergeCommitState ¶
type MergeCommitState struct {
Worktree *Worktree
StagedCount int
ModifiedCount int
UntrackedCount int
CommitMessage string
Error string
}
MergeCommitState holds state for the commit-before-merge modal.
type MergeResolutionMsg ¶
type MergeResolutionMsg struct {
OperationScope
WorkspaceName string
Branch string
Success bool
Err error
}
MergeResolutionMsg signals result of merge resolution attempt.
type MergeStepCompleteMsg ¶
type MergeStepCompleteMsg struct {
OperationScope
WorkspaceName string
Step MergeWorkflowStep
Data string // Step-specific data (e.g., PR URL)
Err error
ExistingPRFound bool // True if PR already existed (vs newly created)
PR PRIdentity
ReviewedOID string
BaseRemote string
}
MergeStepCompleteMsg signals a merge workflow step completed.
type MergeWorkflowState ¶
type MergeWorkflowState struct {
OperationScope
Worktree *Worktree
Step MergeWorkflowStep
DiffSummary string
PRTitle string
PRBody string
PRURL string
PR PRIdentity
ExistingPR bool // True if using an existing PR (vs newly created)
ReviewedOID string
PushRemote string
BaseRemote string
Error error
ErrorTitle string // Short title for error display (e.g. "Direct Merge Failed")
ErrorDetail string // Full error text for display and clipboard copy
ErrorFromStep MergeWorkflowStep // Which step produced the error
StepStatus map[MergeWorkflowStep]string // "pending", "running", "done", "error", "skipped"
DeleteAfterMerge bool // true = delete worktree after merge (default)
// Target branch selection
TargetBranch string // Resolved target branch for merge/PR
TargetBranchOption int // Selected index in branch list
TargetBranches []string // Available branches for selection
// Merge method selection
UseDirectMerge bool // true = direct merge to base, false = PR workflow
MergeMethodOption int // 0 = Create PR (default), 1 = Direct merge
// Post-merge confirmation options
DeleteLocalWorktree bool // Checkbox: delete local worktree (default: true)
DeleteLocalBranch bool // Checkbox: delete local branch (default: true)
DeleteRemoteBranch bool // Checkbox: delete remote branch (default: false)
PullAfterMerge bool // Checkbox: pull changes to current branch after merge
CurrentBranch string // Branch user was on before merge (for pull)
ConfirmationFocus int // 0-3=checkboxes, 4=confirm btn, 5=skip btn
ConfirmationHover int // Mouse hover state
// PR generation state
PRGenerationDots int // Animation counter for progress dots (0-3)
PRGenerationCancel context.CancelFunc // Cancel func for in-flight agent process
PRGenerationActive bool
PRTitleInput textinput.Model
PRBodyInput textarea.Model
PRPollAttempt int
PRWatchStopped bool
PRPollKind PRPollKind
ForceDeleteRequired bool // squash/rebase means ordinary branch -d cannot prove safety
ForceDeleteLocalBranch bool // explicit user choice after the explanation is shown
// Cleanup results for summary display
CleanupResults *CleanupResults
PendingCleanupOps int // Counter for cleanup result messages in flight
DirectOperation *DirectMergeOperation
}
MergeWorkflowState holds the state for the merge workflow modal.
type MergeWorkflowStep ¶
type MergeWorkflowStep int
MergeWorkflowStep represents the current step in the merge workflow.
const ( MergeStepReviewDiff MergeWorkflowStep = iota MergeStepTargetBranch // Choose target branch for merge/PR MergeStepMergeMethod // Choose: PR workflow or direct merge MergeStepPush MergeStepGeneratePR // User chooses deterministic or disclosed agent assistance MergeStepEditPR // User edits title/body before creation MergeStepCreatePR MergeStepWaitingMerge MergeStepDirectMerge // Performing direct merge (no PR) MergeStepPostMergeConfirmation // User confirms cleanup options after PR merge MergeStepCleanup MergeStepDone MergeStepError // Error display step (strategy-agnostic) )
func (MergeWorkflowStep) String ¶
func (s MergeWorkflowStep) String() string
String returns a display name for the merge step.
type OpenCreateModalWithTaskMsg ¶
OpenCreateModalWithTaskMsg opens the create modal with a name derived from the task. Sent from td-monitor when the user presses send-to-worktree.
type OperationScope ¶ added in v0.94.0
type OperationScope struct {
Epoch uint64
OperationID string
RepoKey string
WorktreeKey string
Lifecycle bool
}
OperationScope is copied into every lifecycle command result so Update can reject work completed for a prior repository, worktree, or plugin epoch.
func (OperationScope) GetOperationScope ¶ added in v0.94.0
func (s OperationScope) GetOperationScope() OperationScope
type PRGenerationDoneMsg ¶ added in v0.78.0
type PRGenerationDoneMsg struct {
OperationScope
WorkspaceName string
Title string
Body string
Err error
}
PRGenerationDoneMsg signals that agent-powered PR description generation completed.
type PRIdentity ¶ added in v0.94.0
type PRIdentity struct {
Number int `json:"number"`
URL string `json:"url"`
NodeID string `json:"id"`
Repository string `json:"repository,omitempty"`
HeadRef string `json:"headRefName"`
HeadOwner string `json:"headOwner,omitempty"`
HeadRepo string `json:"headRepository,omitempty"`
HeadOID string `json:"headRefOid,omitempty"`
BaseRef string `json:"baseRefName"`
State string `json:"state,omitempty"`
MergedAt string `json:"mergedAt,omitempty"`
MergeOID string `json:"mergeCommitOid,omitempty"`
}
PRIdentity is the stable identity Sidecar uses after a pull request is found or created. Branch names are display/routing data; Number and NodeID identify the pull request across checkout and branch changes.
type PRListItem ¶
type PRListItem struct {
Number int `json:"number"`
NodeID string `json:"id"`
Title string `json:"title"`
Branch string `json:"headRefName"`
HeadOID string `json:"headRefOid"`
BaseBranch string `json:"baseRefName"`
HeadRepo ghRepository `json:"headRepository"`
HeadOwner ghOwner `json:"headRepositoryOwner"`
Repository string `json:"-"`
Author prAuthor `json:"author"`
URL string `json:"url"`
CreatedAt string `json:"createdAt"`
IsDraft bool `json:"isDraft"`
}
PRListItem represents an open pull request for the fetch modal.
type PRPollKind ¶ added in v0.94.0
type PRPollKind string
const ( PRPollOpen PRPollKind = "open" PRPollMerged PRPollKind = "merged" PRPollClosed PRPollKind = "closed" PRPollAuth PRPollKind = "authentication" PRPollRepository PRPollKind = "repository-mismatch" PRPollNetwork PRPollKind = "network-unavailable" )
type PRPollResult ¶ added in v0.94.0
type PRPollResult struct {
Kind PRPollKind
Identity PRIdentity
Err error
ForceDeleteRequired bool
}
type PaneFloor ¶ added in v0.98.0
type PaneFloor = panelayout.Floor
type PaneKind ¶ added in v0.98.0
type PaneKind = panelayout.Kind
type PaneLayout ¶ added in v0.99.0
type PaneLayout = panelayout.Layout
func LayoutPaneTree ¶ added in v0.99.0
type PaneNode ¶ added in v0.98.0
type PaneNode = panelayout.Node
func ApplyPanePlan ¶ added in v1.7.0
ApplyPanePlan grafts a planned open's new leaf where the plan says, so an internal-node split (a column append, an occupied-cell insert) lands exactly as panelayout intended it.
type PaneSplit ¶ added in v0.98.0
type PaneSplit = panelayout.Split
type Placement ¶ added in v0.98.0
type Placement = panelayout.Placement
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin implements the worktree manager plugin.
func (*Plugin) ApproveAll ¶
ApproveAll approves all worktrees with pending prompts.
func (*Plugin) AtFocusCycleEnd ¶ added in v1.2.0
AtFocusCycleEnd and FocusCycleStart implement plugin.FocusCycler, which is how the shell's notification centre becomes a stop on this surface's Tab cycle instead of a cycle of its own. Both read the same ring cyclePaneFocus walks, so the stop lands exactly where the wrap would have been.
func (*Plugin) AttachToSession ¶
AttachToSession attaches to a tmux session using tea.ExecProcess.
func (*Plugin) AttachToWorktreeDir ¶
AttachToWorktreeDir creates a tmux session in the worktree directory and attaches to it.
func (*Plugin) BlocksGlobalKeys ¶ added in v0.96.0
BlocksGlobalKeys reports whether a plugin-owned modal has keyboard focus.
func (*Plugin) CleanupOrphanedSessions ¶
CleanupOrphanedSessions removes sessions that no longer have worktrees.
func (*Plugin) ConsumesTextInput ¶
ConsumesTextInput reports whether the workspace plugin is currently in a mode that expects typed text input.
func (*Plugin) Cursor ¶ added in v0.88.0
Cursor exposes the active embedded terminal's native cursor in plugin-local coordinates. App-level focus, modal, and bounds checks are applied later.
func (*Plugin) FocusContext ¶
FocusContext returns the current focus context for keybinding dispatch.
func (*Plugin) FocusCycleStart ¶ added in v1.2.0
func (*Plugin) PreferredMouseMode ¶ added in v0.88.0
PreferredMouseMode keeps hover-rich all-motion reporting for ordinary workspace views and requests cell motion only while a child terminal owns interactive input.
func (*Plugin) PrepareTerminalLinks ¶ added in v1.6.0
func (p *Plugin) PrepareTerminalLinks()
PrepareTerminalLinks prepares primary and split-panel visible rows from the same geometry the renderer and pointer mapper use.
func (*Plugin) ResizeDragActive ¶ added in v1.2.0
ResizeDragActive reports a live divider drag. It reuses the same predicate the no-SIGWINCH-until-drop gate does, so "a rail is being dragged" has one definition on this surface rather than two that can disagree.
func (*Plugin) SetPendingWorkspaceSelection ¶ added in v0.94.0
func (p *Plugin) SetPendingWorkspaceSelection(selection plugin.PendingWorkspaceSelection)
func (*Plugin) SetResourceMatchers ¶ added in v1.0.3
func (p *Plugin) SetResourceMatchers(matchers []terminallink.ResourceMatcher)
SetResourceMatchers publishes the live external matcher snapshot the scanner may run. The default is empty on purpose: no ready provider means no underline and no click target, which is what keeps ordinary terminal output ordinary text until a provider has actually described itself.
func (*Plugin) SetResourceResolver ¶ added in v1.0.3
func (p *Plugin) SetResourceResolver(resolve resourceview.Resolver) tea.Cmd
SetResourceResolver injects how a reference becomes a document. The host owns the manager, the process and the timeout; this plugin only says when to ask. A nil resolver is valid, and existing panes are rebound because provider setup may complete after restored tabs have been constructed.
It also asks the visible pane's active tab again. Restore arms tabs, and until a provider is ready there is nothing to ask, so this is the first moment a remembered ticket can actually load. Without it the pane sits on "Waiting for <provider> to be ready" after every relaunch — of a provider that already is — until the user refreshes each tab by hand.
func (*Plugin) SetTerminalLinkCoordinator ¶ added in v1.6.0
func (p *Plugin) SetTerminalLinkCoordinator(coordinator termpreview.LinkCoordinator)
func (*Plugin) StartAgent ¶
StartAgent creates a tmux session and starts an agent for a worktree. If a session already exists, it reconnects to it instead of failing.
func (*Plugin) StartAgentWithOptions ¶
StartAgentWithOptions creates a tmux session and starts an agent with options. If a session already exists, it reconnects to it instead of failing.
func (*Plugin) TakePendingWorkspaceAction ¶ added in v1.0.0
func (*Plugin) Update ¶
Update routes terminal-owned lifecycle messages through the shared component before applying workspace product state. Ordinary keys and mouse events are routed explicitly by interactive mode so a visible preview never captures input intended for workspace navigation.
func (*Plugin) WheelAtBoundary ¶ added in v1.0.0
func (p *Plugin) WheelAtBoundary(msg tea.MouseWheelMsg) bool
WheelAtBoundary implements plugin.WheelBoundaryConsumer for the project Workspaces surface. It follows the same hit regions as handleMouseScroll but performs no loads or visible mutations, allowing Bubble Tea to discard an inertial tail before Update and View.
type PullAfterMergeMsg ¶
type PullAfterMergeMsg struct {
OperationScope
WorkspaceName string
Branch string
Success bool
Err error
}
PullAfterMergeMsg signals that pull after merge completed.
type PushDoneMsg ¶
type PushDoneMsg struct {
OperationScope
WorkspaceName string
Err error
}
PushDoneMsg signals push operation completed.
type RebaseResolutionMsg ¶
type RebaseResolutionMsg struct {
OperationScope
WorkspaceName string
Branch string
Success bool
Err error
}
RebaseResolutionMsg signals result of rebase resolution attempt.
type RefreshDoneMsg ¶
type RefreshDoneMsg struct {
OperationScope
Worktrees []*Worktree
Snapshot *RepoSnapshot
Err error
Conflicts []Conflict
Duration time.Duration
Processes int
MaxConcurrency int
}
RefreshDoneMsg signals that refresh has completed.
func (RefreshDoneMsg) GetEpoch ¶
func (m RefreshDoneMsg) GetEpoch() uint64
GetEpoch implements plugin.EpochMessage.
type RejectResultMsg ¶
RejectResultMsg signals the result of a reject action.
type RemoteBranchDeleteMsg ¶
type RemoteBranchDeleteMsg struct {
OperationScope
WorkspaceName string
BranchName string
Err error
}
RemoteBranchDeleteMsg signals the result of deleting a remote branch.
type RemoteCheckDoneMsg ¶
type RemoteCheckDoneMsg struct {
OperationScope
WorkspaceName string
Branch string
Exists bool
}
RemoteCheckDoneMsg signals remote branch existence check completed.
type RenameShellDoneMsg ¶
type RenameShellDoneMsg struct {
TmuxName string // Session name (stable identifier)
NewName string // New display name
Err error // Non-nil if rename failed
}
RenameShellDoneMsg signals shell rename operation completed
type RenameWorktreeDoneMsg ¶ added in v1.0.0
RenameWorktreeDoneMsg signals worktree display-name persist completed.
type Render ¶ added in v0.99.0
Render is what the frame knows about a placed leaf and the content does not.
type RepoSnapshot ¶ added in v0.94.0
type RepoSnapshot struct {
Key string
CanonicalRoot string
CanonicalCommonDir string
Worktrees []WorktreeSnapshot
CheckedOut map[string]string // local branch -> stable worktree key
}
RepoSnapshot is one immutable inventory used to identify and validate all worktree lifecycle operations. Callers replace the whole value after refresh; commands never mutate it.
func BuildRepoSnapshot ¶ added in v0.94.0
func BuildRepoSnapshot(ctx context.Context, repoPath string) (*RepoSnapshot, error)
BuildRepoSnapshot reads one porcelain worktree inventory and enriches it with a single branch-ref inventory. This avoids independently rediscovering correctness-critical paths and branch ownership during an operation.
type ResumeConversationMsg ¶
type ResumeConversationMsg struct {
SessionID string // Adapter session ID for resume command
AdapterID string // Adapter type (claude-code, codex, etc.)
ResumeCmd string // Full resume command (e.g., "claude --resume xyz")
Type string // "shell" or "worktree"
// Worktree-specific fields (only used when Type == "worktree")
WorktreeName string // Branch name for new worktree
BaseBranch string // Base branch to create from
AgentType AgentType // Agent to start (matches adapter or user selection)
SkipPerms bool // Whether to auto-approve agent actions
}
ResumeConversationMsg requests resuming a conversation in a new shell or worktree. Sent from conversations plugin when user presses O key.
type SendTextResultMsg ¶
SendTextResultMsg signals the result of sending text to an agent.
type SetupConfig ¶
type SetupConfig struct {
CopyEnv bool // Whether to copy env files (default: true)
EnvFiles []string // List of env files to copy
SymlinkDirs []string // Directories to symlink (default: empty, opt-in)
RunSetupScript bool // Whether to run .worktree-setup.sh (default: true)
}
SetupConfig holds worktree setup configuration.
func DefaultSetupConfig ¶
func DefaultSetupConfig() *SetupConfig
DefaultSetupConfig returns the default setup configuration.
type ShellAgentErrorMsg ¶
type ShellAgentErrorMsg struct {
TmuxName string // Shell's tmux session name
Err error // Error that occurred
}
ShellAgentErrorMsg signals agent failed to start in a shell session. td-21a2d8: Sent when agent command fails to execute.
type ShellAgentStartedMsg ¶
type ShellAgentStartedMsg struct {
TmuxName string // Shell's tmux session name
AgentType AgentType // Agent type that was started
SkipPerms bool // Whether skip permissions was enabled
}
ShellAgentStartedMsg signals agent was started in a shell session. td-21a2d8: Sent after agent command is sent to tmux.
type ShellCreatedMsg ¶
type ShellCreatedMsg struct {
SessionName string // tmux session name
DisplayName string // Display name (e.g., "Shell 1")
PaneID string // tmux pane ID (e.g., "%12") for interactive mode
Err error // Non-nil if creation failed
AgentType AgentType // td-16b2b5: Agent to start (AgentNone if plain shell)
SkipPerms bool // td-16b2b5: Whether to skip permissions for agent
// KeepSelection leaves the sidebar selection where it is instead of
// selecting the new shell. Set for shells created without the user
// explicitly asking for one (auto-create on first focus).
KeepSelection bool
}
ShellCreatedMsg signals shell session was created
type ShellDefinition ¶
type ShellDefinition = shellstate.Definition
ShellDefinition is retained as the workspace-facing name for the shared persisted model. New non-interactive surfaces use shellstate.Definition directly rather than defining another manifest shape.
type ShellDetachedMsg ¶
type ShellDetachedMsg struct {
Err error
}
ShellDetachedMsg signals user detached from shell session
type ShellKilledMsg ¶
type ShellKilledMsg struct {
SessionName string // tmux session name that was killed
}
ShellKilledMsg signals shell session was terminated
type ShellLeafCloseProbeMsg ¶ added in v1.3.0
type ShellLeafCloseProbeMsg struct {
Session string
CurrentCommand string
ShellCommand string
Err error
// Mode is the view mode the ✕ was clicked in. The probe is a tmux subprocess
// spawn, which on an EDR machine is long enough for the user to have opened
// the create modal or entered interactive mode in the meantime; this is the
// only async modal-open path in the plugin, so it carries its own precondition
// rather than assuming the mode it left behind.
Mode ViewMode
}
ShellLeafCloseProbeMsg carries what tmux said about the split terminal's pane when its ✕ was clicked. Err (or a session that no longer answers) means the pane is gone, which is a close with nothing to confirm.
type ShellManifest ¶
type ShellManifest struct {
Version int `json:"version"`
Shells []ShellDefinition `json:"shells"`
// Tombstones holds forgotten definitions so restore can put them back.
// An older binary ignores this field and may drop the key on write —
// accepted until docs/plans/active/shell-record-durability.md part D.
Tombstones []shellstate.Tombstone `json:"tombstones,omitempty"`
// contains filtered or unexported fields
}
ShellManifest stores persistent shell definitions for cross-instance sync and reboot survival. Stored in $XDG_STATE_HOME/sidecar/projects/<slug>/shells.json.
func LoadShellManifest ¶
func LoadShellManifest(path string) (*ShellManifest, error)
LoadShellManifest loads the shell manifest from disk. Returns an empty manifest (not error) if file doesn't exist or is corrupted.
func (*ShellManifest) AddShell ¶
func (m *ShellManifest) AddShell(def ShellDefinition) error
AddShell adds a shell definition and saves.
func (*ShellManifest) BackfillWorkDirs ¶ added in v0.98.0
func (m *ShellManifest) BackfillWorkDirs(byTmux map[string]string) error
BackfillWorkDirs writes inferred parent worktree paths onto definitions that still lack WorkDir. Existing non-empty values are left untouched.
func (*ShellManifest) EnsureShells ¶ added in v0.93.0
func (m *ShellManifest) EnsureShells(defs []ShellDefinition) (bool, error)
EnsureShells adds any definitions the manifest is missing and saves once. Existing entries are left untouched. Returns true when the file changed.
This is the additive counterpart to AddShell: it heals a manifest another instance narrowed (td-8d18de) without ever overwriting what that instance wrote. A name currently in tombstones is an explicit forget, not a missing definition — it is not added back, and the tombstone is not dropped.
func (*ShellManifest) FindShell ¶
func (m *ShellManifest) FindShell(tmuxName string) *ShellDefinition
FindShell returns a shell definition by tmuxName, or nil if not found.
func (*ShellManifest) Path ¶
func (m *ShellManifest) Path() string
Path returns the manifest file path.
func (*ShellManifest) RemoveShell ¶
func (m *ShellManifest) RemoveShell(tmuxName string) error
RemoveShell moves a shell by tmuxName into tombstones and saves.
func (*ShellManifest) RenameShell ¶ added in v0.96.0
func (m *ShellManifest) RenameShell(tmuxName, namespace, name string) (shellstate.RenameResult, error)
RenameShell routes display-name validation and persistence through the same application boundary as the agent-facing CLI.
func (*ShellManifest) Revision ¶ added in v0.93.0
func (m *ShellManifest) Revision() uint64
Revision counts the successful writes this process has made through this manifest object. A reconciliation that started before a local delete and lands after it would resurrect the deleted shell, so callers stamp the revision they observed and discard (or re-run) a sync whose base moved underneath them (td-8d18de).
func (*ShellManifest) UpdateShell ¶
func (m *ShellManifest) UpdateShell(def ShellDefinition) error
UpdateShell updates an existing shell definition and saves.
type ShellManifestChangedMsg ¶
type ShellManifestChangedMsg struct{}
ShellManifestChangedMsg is emitted when the manifest file changes. This can be triggered by another sidecar instance modifying the manifest.
type ShellOutputMsg ¶
type ShellOutputMsg struct {
TmuxName string // Session name (stable identifier)
Generation int
AgentType AgentType // Live provider inferred from the captured pane
Output string
Err error
Activity agentactivity.Result
CapturedAt time.Time
PaneTitle string
CurrentCommand string
// Cursor position captured atomically with output (only set in interactive mode)
CursorRow int
CursorCol int
CursorVisible bool
HasCursor bool // True if cursor position was captured
PaneHeight int // Tmux pane height for cursor offset calculation
PaneWidth int // Tmux pane width for display alignment
HistorySize int
CaptureBase int
HasHistory bool
// RowsJoined says the capture was taken with -J, so it carries no usable
// history/pane split.
RowsJoined bool
// MouseReporting is tmux's #{mouse_any_flag} for the pane. Only
// meaningful when HasCursor is set.
MouseReporting bool
}
ShellOutputMsg signals shell output was captured (for polling)
type ShellSession ¶
type ShellSession struct {
Name string // Display name (e.g., "Shell 1")
TmuxName string // tmux session name (e.g., "sidecar-sh-project-1")
WorkDir string // Parent worktree path; persisted on the definition
Agent *Agent // Reuses Agent struct for tmux state
CreatedAt time.Time
ChosenAgent AgentType // td-317b64: Agent type selected at creation (AgentNone for plain shell)
SkipPerms bool // td-317b64: Whether skip permissions was enabled
IsOrphaned bool // td-f88fdd: True if manifest entry exists but tmux session is gone
}
ShellSession represents a tmux shell session (not tied to a git worktree).
type ShellSessionDeadMsg ¶
type ShellSessionDeadMsg struct {
TmuxName string // Session name for cleanup (stable identifier)
Generation int // Poll owner; zero for non-poll lifecycle checks
}
ShellSessionDeadMsg signals shell session was externally terminated (e.g., user typed 'exit' in the shell)
type ShellWatcher ¶
type ShellWatcher struct {
// contains filtered or unexported fields
}
ShellWatcher monitors the shell manifest file for changes. When changes are detected, it emits ShellManifestChangedMsg for cross-instance sync.
func NewShellWatcher ¶
func NewShellWatcher(manifestPath string) (*ShellWatcher, error)
NewShellWatcher creates a watcher for the shell manifest file.
func (*ShellWatcher) Start ¶
func (w *ShellWatcher) Start() <-chan tea.Msg
Start begins watching and returns a channel for receiving messages. The channel emits ShellManifestChangedMsg when the manifest changes.
func (*ShellWatcher) Stop ¶
func (w *ShellWatcher) Stop()
Stop stops the watcher and closes channels.
type Size ¶ added in v0.99.0
Size is the box a content draws into: the leaf's INNER box, header row included. The terminal leaf's header is still drawn by the legacy renderer from inside its box, so each content spends its own header row.
type SplitAxis ¶ added in v0.98.0
type SplitAxis = panelayout.Axis
type StatsErrorMsg ¶
type StatsErrorMsg struct {
OperationScope
WorkspaceName string
Err error
Command string
}
StatsErrorMsg signals stats loading failed.
func (StatsErrorMsg) GetEpoch ¶ added in v0.94.0
func (m StatsErrorMsg) GetEpoch() uint64
type StatsLoadedMsg ¶
type StatsLoadedMsg struct {
OperationScope
WorkspaceName string
Stats *GitStats
}
StatsLoadedMsg delivers git stats for a worktree.
func (StatsLoadedMsg) GetEpoch ¶
func (m StatsLoadedMsg) GetEpoch() uint64
GetEpoch implements plugin.EpochMessage.
type Task ¶
type Task struct {
ID string
Title string
Status string
Description string
EpicTitle string // Parent epic title for search
}
Task represents a TD task for linking.
type TaskLinkedMsg ¶
type TaskLinkedMsg struct {
OperationScope
WorkspaceName string
TaskID string
Err error
}
TaskLinkedMsg signals a task was linked to a worktree.
type TaskSearchResultsMsg ¶
type TaskSearchResultsMsg struct {
OperationScope
Tasks []Task
Err error
}
TaskSearchResultsMsg delivers task search results.
type TermPanelSeedFailedMsg ¶ added in v1.3.0
type TermPanelSeedFailedMsg struct {
Err error
}
TermPanelSeedFailedMsg is a --run/--type that could not be sent after the split session existed.
type TermPanelSessionCreatedMsg ¶ added in v0.83.0
TermPanelSessionCreatedMsg is sent when the terminal panel tmux session is created.
type TmuxAttachFinishedMsg ¶
TmuxAttachFinishedMsg signals return from tmux attach.
type UncommittedChangesCheckMsg ¶
type UncommittedChangesCheckMsg struct {
OperationScope
WorkspaceName string
HasChanges bool
StagedCount int
ModifiedCount int
UntrackedCount int
// Changes and Stats are the live porcelain result used to make this
// decision. The update handler writes them back onto the worktree so the
// shared snapshot matches what merge just saw.
Changes *WorktreeChanges
Stats *GitStats
Err error
}
UncommittedChangesCheckMsg signals the result of checking for uncommitted changes.
type ViewMode ¶
type ViewMode int
ViewMode represents the current view state.
const ( ViewModeList ViewMode = iota // List view (default) ViewModeKanban // Kanban board view ViewModeCreate // New worktree modal ViewModeTaskLink // Task link modal (for existing worktrees) ViewModeMerge // Merge workflow modal ViewModeAgentChoice // Agent action choice modal (attach/restart) ViewModeConfirmDelete // Delete confirmation modal ViewModeConfirmDeleteShell // Shell delete confirmation modal ViewModeConfirmCloseSplit // Split-terminal close confirmation modal ViewModeCommitForMerge // Commit modal before merge workflow ViewModeRenameShell // Rename shell modal ViewModeRenameWorktree // Rename worktree display-name modal ViewModeFilePicker // Diff file picker modal ViewModeInteractive // Interactive mode (tmux input passthrough) ViewModeFetchPR // Fetch remote PR modal ViewModeAgentConfig // Agent config modal (start/restart with options) )
type WatchEventMsg ¶
type WatchEventMsg struct {
Path string
}
WatchEventMsg signals a filesystem change was detected.
type WatcherErrorMsg ¶
type WatcherErrorMsg struct {
Err error
}
WatcherErrorMsg signals a file watcher error.
type WatcherStartedMsg ¶
type WatcherStartedMsg struct{}
WatcherStartedMsg signals the file watcher is running.
type WorkDirDeletedMsg ¶
type WorkDirDeletedMsg struct {
MainWorktreePath string
}
WorkDirDeletedMsg signals that the current working directory was deleted. This happens when sidecar is running inside a worktree that gets deleted.
type Worktree ¶
type Worktree struct {
Key string // Stable normalized-path identity; never presentation
RepoKey string // Stable canonical common-dir identity
Name string // e.g., "auth-oauth-flow"
Path string // Absolute path
Branch string // Git branch name
BaseBranch string // Branch worktree was created from
TaskID string // Linked td task (e.g., "td-a1b2")
TaskTitle string // Task title (used as fallback if td show fails)
PRURL string // URL of open PR (if any)
PRState string // open, merged, closed, or unavailable when known
SetupWarning string // Last visible setup warning for this worktree
ChosenAgentType AgentType // Agent selected at creation (persists even when agent not running)
Agent *Agent // nil if no agent running
Status WorktreeStatus // Derived from agent state
Stats *GitStats // +/- line counts
Changes *WorktreeChanges // One refresh result shared by badges/stats/overlap/gating
CreatedAt time.Time
UpdatedAt time.Time
IsOrphaned bool // True if agent file exists but tmux session is gone
IsMain bool // True if this is the primary/main worktree (project root)
IsMissing bool // True if worktree directory no longer exists (detected via os.Stat or git prunable)
IsBare bool // True if Git reports a bare worktree entry
IsDetached bool // True if HEAD is detached
IsLocked bool // True if Git reports the worktree as locked
IsPrunable bool // True if Git reports the worktree record as prunable
HEADOID string
BaseOID string
Remote string
Upstream string
}
Worktree represents a git worktree with optional agent.
func (*Worktree) IdentityKey ¶ added in v0.94.0
type WorktreeAction ¶ added in v0.94.0
type WorktreeAction string
WorktreeAction identifies a mutating action offered by the workspace UI.
const ( WorktreeActionDelete WorktreeAction = "delete" WorktreeActionPush WorktreeAction = "push" WorktreeActionMerge WorktreeAction = "merge" )
type WorktreeChanges ¶ added in v0.94.0
type WorktreeChanges struct {
State LoadState
Staged []string
Unstaged []string
Untracked []string
Dirty []string
Truncated bool
TruncatedFiles int
TruncatedBytes int64
Err error
}
WorktreeChanges is the bounded, immutable status result for one refresh. Paths are repository-relative and originate from a single porcelain status invocation. Stats and dirty overlap are derived from this same value.
type WorktreeDirtyCheckedMsg ¶ added in v1.0.0
type WorktreeDirtyCheckedMsg struct {
Path string
Dirty worktreedelete.Dirtiness
}
WorktreeDirtyCheckedMsg carries git's answer about uncommitted work in the worktree an open delete confirmation refers to. It is asked once, when the confirmation opens, so the warning can tell the truth without putting a `git status` on every refresh cycle (td-d37612).
type WorktreeSnapshot ¶ added in v0.94.0
type WorktreeSnapshot struct {
Key string
RepoKey string
Path string
Branch string
Detached bool
HEADOID string
BaseRef string
BaseOID string
Remote string
Upstream string
Locked bool
Prunable bool
Bare bool
IsMain bool
}
WorktreeSnapshot contains Git identity and routing facts, separate from the user-facing Worktree.Name.
type WorktreeStatus ¶
type WorktreeStatus int
WorktreeStatus represents the current state of a worktree.
const ( StatusPaused WorktreeStatus = iota // No agent, worktree exists StatusActive // Agent running, recent output StatusThinking // Agent is processing/thinking StatusWaiting // Agent waiting for input StatusDone // Agent completed task StatusError // Agent crashed or errored )
func (WorktreeStatus) Icon ¶
func (s WorktreeStatus) Icon() string
Icon returns the status indicator icon for display.
func (WorktreeStatus) String ¶
func (s WorktreeStatus) String() string
String returns the display string for a WorktreeStatus.
Source Files
¶
- activity_animation.go
- activity_status.go
- agent.go
- agent_config_modal.go
- agent_session.go
- agent_triggers.go
- agents_config.go
- browser.go
- commands.go
- conflicts.go
- constants.go
- content.go
- content_deck.go
- content_pane_shared.go
- create_modal.go
- create_operation.go
- create_picker.go
- diff.go
- diff_host.go
- diff_panes.go
- diff_tab_strip.go
- doc.go
- doc_edit.go
- doc_links.go
- doc_panes.go
- doc_search.go
- doc_select.go
- doc_tab_strip.go
- env.go
- feature_flags.go
- fetch_pr.go
- fetch_pr_view.go
- focus.go
- git_lifecycle.go
- interactive.go
- interactive_selection.go
- issue_panes.go
- issue_tab_strip.go
- kanban.go
- keys.go
- layout_report.go
- layout_requests.go
- layout_spec.go
- list_filter.go
- live_panes.go
- merge.go
- messages.go
- mouse.go
- native_terminal.go
- note_panes.go
- note_scrollbar.go
- pane_badge.go
- pane_geometry.go
- pane_host.go
- pane_mouse.go
- pane_placement.go
- panetree.go
- plugin.go
- poll_scheduler.go
- pr_lifecycle.go
- repo_snapshot.go
- resource_panes.go
- setup.go
- setup_prompt.go
- shell.go
- shell_leaf.go
- shell_leaf_close.go
- shell_leaf_rename.go
- shell_liveness.go
- shell_manifest.go
- shell_merge.go
- shell_startup.go
- shell_watcher.go
- sidebar_shared.go
- sidebar_sort.go
- stats.go
- target_panes.go
- task_picker.go
- term_panel_migrate.go
- terminal_control.go
- terminal_history.go
- terminal_link_state.go
- terminal_links.go
- terminal_panel.go
- terminal_scrollbar.go
- terminal_search.go
- terminal_surface.go
- terminal_viewport.go
- terminal_window.go
- types.go
- ui_requests.go
- update.go
- view_flyout.go
- view_helpers.go
- view_kanban.go
- view_list.go
- view_modals.go
- view_preview.go
- worktree.go