Documentation
¶
Index ¶
- Constants
- Variables
- func AutoSchemes() []string
- func ConfigPath(env Env) string
- func DiffLayouts() []string
- func KeyContexts() []string
- func StateDir(env Env) string
- func WorktreeRoots() []string
- type Action
- type AgentState
- type Arrangement
- type BreakPane
- type CheckInfo
- type ClearPreselect
- type Clipboard
- type ClosePane
- type CloseReview
- type CloseTab
- type Column
- type Config
- type CycleLayoutMode
- type CycleTab
- type DiffConfig
- type Dir
- type Edit
- type Env
- type Equalize
- type FocusDir
- type FocusPane
- type ForgetEdit
- type KeyBind
- type KeysConfig
- type LayoutConfig
- type LayoutMode
- type MarkHunks
- type Mouse
- type MovePane
- type NewTab
- type Node
- type NoteEdit
- type NotePlan
- type OpenPane
- type OpenReview
- type PRChecks
- type PRInfo
- type Pane
- type PaneID
- type PaneKind
- type Pin
- type PinReview
- type Plan
- type PlanKind
- type PlansConfig
- type Preselect
- type Promote
- type PullRequestsConfig
- type ReadPlan
- type Rect
- type RenameTab
- type RepoMarks
- type RepoPRs
- type ResizeDir
- type Review
- type ReviewMode
- type ReviewPR
- type RotateSplit
- type SelectTab
- type SessionID
- type SetAgentAction
- type SetAgentCwd
- type SetAgentSession
- type SetAgentState
- type SetAgentStatus
- type SetBranchPR
- type SetLayoutMode
- type SetMarks
- type SetPaneCwd
- type SetPaneKind
- type SetRail
- type SetRepoPRs
- type SetReviewMode
- type SetReviewTree
- type SetTheme
- type ShowReviewPR
- type Split
- type State
- func (s State) AgentPanes() []PaneID
- func (s State) NewPaneID() PaneID
- func (s State) OpenPRFor(repo, branch string) (PRInfo, bool)
- func (s State) PRFor(repo, branch string) (PRInfo, bool)
- func (s State) Reviewed(repo, id string) bool
- func (s State) Tab() Tab
- func (s State) TabAgentState(i int) AgentState
- func (s State) TabHasAgents(i int) bool
- func (s State) TabOf(id PaneID) (int, bool)
- type Store
- type SwapDir
- type Tab
- type TabID
- type ToggleRail
- type ToggleZoom
- type TouchMarks
- type WorktreesConfig
Constants ¶
const ( MinMasterRatio = 10 MaxMasterRatio = 90 MinMasterCount = 1 MaxMasterCount = 9 MinColumnWidth = 10 MaxColumnWidth = 100 // MinDiffLimit is the lowest [diff] max_files, max_bytes and max_lines; // they have no upper bound. MinDiffLimit = 1 MinReviewRequestedDays = 0 // MaxReviewRequestedDays is ten years; the bound also keeps the cutoff's // duration far from overflowing. MaxReviewRequestedDays = 3650 )
Bounds of the numeric config keys.
const ( // KeyNone, as a command, unbinds the key. KeyNone = "none" // DefaultLeaderKey is the leader when the file sets none. DefaultLeaderKey = "ctrl+space" // DefaultWhichKeyDelay is the which-key delay in milliseconds. DefaultWhichKeyDelay = 300 )
Defaults and sentinels of the [keys] section.
const ( MinWhichKeyDelay = 0 MaxWhichKeyDelay = 5000 )
Bounds of keys.which_key_delay in milliseconds.
const DefaultTheme = "catppuccin-mocha"
DefaultTheme is the theme used when config.toml does not set one.
const MaxEdits = 32
MaxEdits is the most places a pane keeps; past it the lowest Seq goes.
const MaxPanes = 64
MaxPanes is the most panes a state may hold across all tabs; the saved layout file is rejected above it.
Variables ¶
var ( ErrNeedsBSP = errors.New("core: needs a BSP layout") ErrNeedsMaster = errors.New("core: needs a master-stack layout") ErrNothingToRotate = errors.New("core: nothing to rotate") )
Errors the layout actions return when the tab's mode or shape does not fit.
var ( ErrSameTab = errors.New("core: the pane is already in that tab") ErrNoTab = errors.New("core: there is no such tab") ErrAlone = errors.New("core: the pane is alone in its tab") )
Errors MovePane and BreakPane return for a move that cannot or need not happen; the state is unchanged.
var ErrTooManyPanes = errors.New("core: too many panes")
ErrTooManyPanes is returned by OpenPane and NewTab at MaxPanes panes.
var ErrUnknownMode = errors.New("core: unknown layout mode")
ErrUnknownMode is returned by SetLayoutMode for a mode that does not exist.
Functions ¶
func AutoSchemes ¶
func AutoSchemes() []string
AutoSchemes lists the allowed layout.auto_scheme values.
func ConfigPath ¶
ConfigPath returns the default config file path, the same on Linux and macOS.
func WorktreeRoots ¶
func WorktreeRoots() []string
WorktreeRoots lists the allowed worktrees.root values.
Types ¶
type Action ¶
type Action interface {
// contains filtered or unexported methods
}
Action is a state change applied through Store.Dispatch.
type AgentState ¶
type AgentState int
AgentState is what an agent pane is doing, as its harness reports it.
const ( AgentUnknown AgentState = iota AgentIdle AgentWorking AgentBlocked )
Agent states, in increasing urgency; AgentUnknown shows no badge.
func (AgentState) String ¶
func (s AgentState) String() string
type Arrangement ¶
type Arrangement struct {
Rects map[PaneID]Rect // drawn panes, each including its frame
Sizes map[PaneID]Rect // every placed pane of the tab, hidden columns included: rects whose content is the PTY size
HiddenLeft, HiddenRight int // scrolling columns hidden on each side
}
Arrangement is a tab laid out in a body rect.
func Arrange ¶
func Arrange(t Tab, body Rect, lc LayoutConfig) Arrangement
Arrange lays t out in body. Tiles fill the body edge to edge and each is a pane's rect, framed by its outline; the content is the rect inset by one cell. A pane is drawn only when its rect is at least minPane square, inside body and disjoint from the panes kept before it in pane order; others are in neither map. A body under minPane square stays blank. Zoom is the caller's.
type CheckInfo ¶
type CheckInfo struct {
Name, URL, State string
StartedAt, CompletedAt time.Time
// ID and App are the run's id and the app that made it ("github-actions" for
// an Actions job); a commit status has ID 0.
ID int64
App string
}
CheckInfo is one check of a pull request. State is pending, success, failure or skipped.
type ClearPreselect ¶
type ClearPreselect struct{}
ClearPreselect drops the active BSP tab's preselection, set or not.
type Clipboard ¶
Clipboard is the [clipboard] section. The pointers let an absent key (nil) mean true.
type ClosePane ¶
type ClosePane struct {
ID PaneID
}
ClosePane removes a pane from its own tab, giving its space to the rest. Closing the focused pane focuses the pane that took its place. The last pane of a tab removes the tab unless it is the only one.
type CloseReview ¶
type CloseReview struct{}
CloseReview closes the active tab's drawer, keeping its pin; with none open it does nothing.
type CloseTab ¶
type CloseTab struct {
ID TabID
}
CloseTab removes a tab and its panes' metadata. Closing the active tab activates the tab to its left, or the new first tab. The only tab stays, emptied.
type Config ¶
type Config struct {
Theme string `toml:"theme"`
// Icons is a pointer so an absent key (nil) can mean true.
Icons *bool `toml:"icons"`
Mouse Mouse `toml:"mouse"`
Clipboard Clipboard `toml:"clipboard"`
Layout LayoutConfig `toml:"layout"`
Diff DiffConfig `toml:"diff"`
Worktrees WorktreesConfig `toml:"worktrees"`
Plans PlansConfig `toml:"plans"`
PullRequests PullRequestsConfig `toml:"pull_requests"`
Keys KeysConfig `toml:"keys"`
}
Config is the user's config.toml.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns the config used for keys the file does not set.
func LoadConfig ¶
LoadConfig reads the config file at path over the defaults. A missing file gives the defaults; unknown keys are errors, so a typo never goes unnoticed. Values such as theme names are not validated here.
type CycleLayoutMode ¶
type CycleLayoutMode struct {
Area Rect
}
CycleLayoutMode switches the active tab to the next mode: bsp, master-stack, scrolling, bsp.
type CycleTab ¶
type CycleTab struct {
Delta int
}
CycleTab activates the next (+1) or previous (-1) tab, wrapping.
type DiffConfig ¶
type DiffConfig struct {
Layout string `toml:"layout"` // unified | split: the layout a drawer starts in
Mode string `toml:"mode"` // turn | branch: what a new drawer opens in
MaxFiles int `toml:"max_files"` // the engine's limits
MaxBytes int `toml:"max_bytes"`
MaxLines int `toml:"max_lines"`
}
DiffConfig is the [diff] section. Validate rejects an unknown name or a non-positive limit from a file; the accessors read a zero field as its default so a hand-built DiffConfig behaves as the defaults.
func (DiffConfig) BranchFirst ¶
func (c DiffConfig) BranchFirst() bool
BranchFirst reports whether a new drawer opens in branch mode even when the pane has turns.
func (DiffConfig) Split ¶
func (c DiffConfig) Split() bool
Split reports whether a new drawer starts side by side.
func (DiffConfig) Validate ¶
func (c DiffConfig) Validate() error
Validate names the first key that is unknown or not positive.
type Dir ¶
type Dir int
Dir is a direction for focus, resize and preselection. The zero value is NoDir, so a Tab literal has no preselection.
type Edit ¶
type Edit struct {
Root, Common, Repo string // as git.Place
Seq uint64 // the order the edit hooks arrived in; the highest is the latest
At time.Time // when the latest edit's hook arrived
}
Edit is a worktree an agent made a counted edit in.
type Env ¶
Env is the part of the process environment that decides AIM's paths.
func DefaultEnv ¶
DefaultEnv returns the environment of the running process.
type Equalize ¶
type Equalize struct{}
Equalize evens out the active tab's layout: BSP panes become equal along each axis, master-stack goes back to master_ratio and every scrolling column to column_width. It changes nothing for fewer than two panes.
type FocusDir ¶
FocusDir focuses the pane Neighbour picks on the tiles Arrange lays out in Area; a zero Area uses a fixed large rect. It does nothing at an edge.
type ForgetEdit ¶
ForgetEdit drops the entry for Root from an agent's edited places; it changes nothing when the pane has none.
type KeysConfig ¶
type KeysConfig struct {
LeaderKey string `toml:"leader_key"`
WhichKeyDelay *int `toml:"which_key_delay"` // milliseconds; nil means the default
Leader map[string]string `toml:"leader"`
Drawer map[string]string `toml:"drawer"`
Rail map[string]string `toml:"rail"`
PRList map[string]string `toml:"pr_list"`
Checks map[string]string `toml:"checks"`
Reader map[string]string `toml:"reader"`
Merge map[string]string `toml:"merge"`
Compose map[string]string `toml:"compose"`
Order map[string][]string `toml:"-"`
}
KeysConfig is the [keys] section. Validate checks the syntax of the key names; which commands a context takes is the UI's to check. Order keeps each context's keys in file order, since a map does not.
func (KeysConfig) Binds ¶
func (c KeysConfig) Binds(context string) []KeyBind
Binds lists a context's entries in file order. Keys Order lacks (a hand-built config) follow, sorted.
func (KeysConfig) Delay ¶
func (c KeysConfig) Delay() time.Duration
Delay is how long the leader waits before which-key opens.
func (KeysConfig) LeaderName ¶
func (c KeysConfig) LeaderName() string
LeaderName is the leader key, read as the default when unset.
func (KeysConfig) Validate ¶
func (c KeysConfig) Validate() error
Validate names the first key that is malformed.
type LayoutConfig ¶
type LayoutConfig struct {
DefaultMode string `toml:"default_mode"` // bsp | master-stack | scrolling
AutoScheme string `toml:"auto_scheme"` // spiral | longest_side | alternate | smart_split
MasterRatio int `toml:"master_ratio"` // percent, 10-90
MasterPosition string `toml:"master_position"` // left | right | top | bottom | center
MasterCount int `toml:"master_count"` // 1-9
MasterGrid *bool `toml:"master_grid"` // nil means true
ColumnWidth int `toml:"column_width"` // percent, 10-100
}
LayoutConfig is the [layout] section. Validate rejects an out-of-range value from a file; the accessors read a zero field as its default so a hand-built LayoutConfig behaves as the defaults.
func (LayoutConfig) Mode ¶
func (c LayoutConfig) Mode() LayoutMode
Mode is the mode new tabs start in.
func (LayoutConfig) Scheme ¶
func (c LayoutConfig) Scheme() tiling.AutoScheme
Scheme is the auto split scheme for BSP.
func (LayoutConfig) Validate ¶
func (c LayoutConfig) Validate() error
Validate names the first key that is out of range or unknown.
type LayoutMode ¶
type LayoutMode string
LayoutMode is how a tab arranges its panes.
const ( ModeBSP LayoutMode = "bsp" ModeMaster LayoutMode = "master-stack" ModeScrolling LayoutMode = "scrolling" )
Layout modes.
func LayoutModes ¶
func LayoutModes() []LayoutMode
LayoutModes lists the layout modes in cycle order. Each call returns a fresh slice.
type Mouse ¶
type Mouse struct {
FocusFollowsMouse bool `toml:"focus_follows_mouse"`
CopyOnSelect bool `toml:"copy_on_select"`
}
Mouse is the [mouse] section; both switches are off by default.
type MovePane ¶
MovePane moves a pane to the tab at a 0-based index, or to a new tab at the end when Tab is the tab count. It lands per the target's mode (BSP: at the preselection, else beside the focused pane; master-stack: appended; scrolling: a new column after the focused one) and becomes the target's focused pane. The source loses it as ClosePane would, and an emptied source tab is removed. Follow makes the target active; otherwise the previously active tab stays active, unless it was the removed source tab.
type NewTab ¶
NewTab appends a tab whose first pane is a new pane and activates it. An empty active tab (only possible as the only tab) is filled instead, keeping its ID and name.
type Node ¶
Node is a layout tree node: a leaf when Pane is set, otherwise a split with children A (left or top) and B (right or bottom), A taking Ratio of the space.
type NoteEdit ¶
NoteEdit records a worktree Session's agent edited. It changes nothing, and is no error, for a pane that is closed, a shell, or in another session. An entry for the same Root keeps the higher Seq and the later At; past MaxEdits the entry with the lowest Seq goes.
type NotePlan ¶
NotePlan replaces an agent's latest plan. It changes nothing, and is no error, for a pane that is closed or a shell; an invalid Plan is an error.
type OpenPane ¶
type OpenPane struct {
Kind PaneKind
Cwd string
Split Split
Harness string
Area Rect
// Beside, when it names a pane of the tab, places the pane beside that one in
// place of the focused one. The new pane takes the focus either way.
Beside PaneID
}
OpenPane puts a new pane beside the active tab's focused pane and focuses it; in BSP a split divides the focused pane with the new pane as child B. The first pane of a tab ignores Split. Area is the body rect the UI lays out in; a zero Area decides auto splits as on a wide screen. Harness is kept only for an agent.
type OpenReview ¶
type OpenReview struct {
Pane PaneID
Mode ReviewMode
}
OpenReview opens the active tab's drawer on a pane of that tab, replacing any open one. A pin on another pane ends.
type PRInfo ¶
type PRInfo struct {
Number int
Title, URL, Author string
State string // OPEN, MERGED or CLOSED
HeadBranch, HeadOID, BaseBranch string
ReviewDecision, MergeState string // GitHub's enums as given; "" when null
Draft, CrossRepo bool
ViewerAuthored bool // the signed-in user opened it
ChecksTotal, ChecksDone int
ChecksFailed int
UpdatedAt time.Time
}
PRInfo is a pull request as the poll sees it. It mirrors the GitHub client's type so that core needs no import of it.
type Pane ¶
type Pane struct {
Kind PaneKind
Cwd string
Harness string // "claude-code" for agents; "" for shells
Session SessionID // the latest session the agent reported; "" for none
Transcript string // that session's transcript file, as the harness reported it
State AgentState // not persisted
Action string // the agent's current action from its hooks; not persisted
AgentCwd string // the directory the agent last reported in a hook; not persisted
Model string // the model the agent's status line reported; not persisted
Context int // that status line's context percentage, floored and clamped to 0-100; meaningful with ContextKnown; not persisted
ContextKnown bool // the status line reported a percentage; not persisted
StatusSession SessionID // the session the status above belongs to; not persisted
Edits []Edit // the places of this session's counted edits; not persisted
Plan Plan // the agent's latest plan; a zero Path means none
}
Pane is the metadata of one pane.
type PaneID ¶
type PaneID string
PaneID names a pane for the session: "p1", "p2", ... and never reused.
func NeighbourSkipping ¶
func NeighbourSkipping(t Tab, d Dir, area Rect, lc LayoutConfig, skip func(PaneID, Rect) bool) (PaneID, bool)
NeighbourSkipping is the pane a focus move reaches from the tab's focused pane in direction d, as FocusDir finds it, but passing over every pane skip reports as out of reach; a nil skip passes over none. skip gets the pane and the rect it is drawn at, which in scrolling is the rect after the focus has moved to it, since that scrolls the columns. A pane that is not drawn is never skipped. It reads the tab and changes nothing.
type PinReview ¶
type PinReview struct{ Root string }
PinReview holds the open drawer on the worktree at Root, or releases it when Root is empty.
type Plan ¶
type Plan struct {
Path string // the plan's markdown file; empty for none
Root string // for a plan file, the folder its [plans] path sits under; empty for a plan-mode plan
Kind PlanKind
At time.Time // when the plan arrived or was last rewritten
Unread bool
}
Plan is an agent's latest plan: a markdown file, not its text.
type PlansConfig ¶
type PlansConfig struct {
Paths []string `toml:"paths"`
}
PlansConfig is the [plans] section: the folders, relative to a worktree root, whose markdown files count as plans.
func (PlansConfig) Validate ¶
func (c PlansConfig) Validate() error
Validate names the first entry that is not a relative path inside a worktree.
type Preselect ¶
type Preselect struct {
Dir Dir
}
Preselect makes the next pane opened in the active BSP tab go to the given side of the focused pane at ratio 0.5. Focus moves keep it; a mode switch and the pane it places clear it.
type Promote ¶
type Promote struct{}
Promote swaps the focused pane with the first pane of a master-stack tab, or with the second when it is first, and focuses the pane now first.
type PullRequestsConfig ¶
type PullRequestsConfig struct {
ReviewRequestedDays int `toml:"review_requested_days"`
}
PullRequestsConfig is the [pull_requests] section. ReviewRequestedDays limits the Review requested tab to pull requests updated in that many days; 0, the zero value, is no limit.
func (PullRequestsConfig) RequestedSince ¶
func (c PullRequestsConfig) RequestedSince(now time.Time) time.Time
RequestedSince is the oldest update a review request may have at now, or the zero time for no limit. Whole days of 24 hours keep a DST change from moving the cutoff.
func (PullRequestsConfig) Validate ¶
func (c PullRequestsConfig) Validate() error
Validate names the key when the days are out of range.
type ReadPlan ¶
type ReadPlan struct {
ID PaneID
}
ReadPlan clears the unread flag of a pane's plan; it changes nothing when the pane has none.
type RepoMarks ¶
RepoMarks holds a repository's reviewed-hunk marks: hunk id to the UTC day (2006-01-02) it was last set or shown. Rev changes with every change, so views rebuild on it. Copies of the state share Days, so actions build a new map and never edit one in place.
type RepoPRs ¶
type RepoPRs struct {
DefaultBranch string
Open []PRInfo // the last successful poll, newest update first
Err string // the last poll's failure; "" after a success
// Methods are the merge methods the repository allows, in the order merge,
// squash, rebase.
Methods []string
DeleteBranchOnMerge bool
Focused *PRChecks // the focused pull request with its checks, when there is one
Branch map[string]PRInfo // per branch, the pull request a lookup found
}
RepoPRs is what is known of one repository's pull requests. State copies share it, so an action replaces a RepoPRs and never edits one in place.
type ResizeDir ¶
type ResizeDir struct {
Dir Dir
}
ResizeDir moves the nearest BSP divider on the direction's axis by one step: Right and Down grow the first child, Left and Up shrink it. It does nothing when the focused pane has no split on that axis. Master-stack moves the master ratio and scrolling the focused column's width.
type Review ¶
type Review struct {
Pane PaneID
Mode ReviewMode
Tree bool
PR *ReviewPR // the pull request the drawer shows instead of a diff; never saved
}
Review is a tab's open review drawer: the pane it reviews, its mode and whether its file tree is open.
type ReviewMode ¶
type ReviewMode string
ReviewMode is what a tab's review drawer shows.
const ( ReviewTurn ReviewMode = "turn" ReviewBranch ReviewMode = "branch" )
Review modes.
type ReviewPR ¶
ReviewPR is the pull request a drawer in PR mode shows: its repository keyed "host/owner/name", its number and the worktree root it was opened from.
type RotateSplit ¶
type RotateSplit struct{}
RotateSplit flips the axis of the focused pane's parent split in BSP and keeps its ratio. A lone pane has nothing to rotate.
type SelectTab ¶
type SelectTab struct {
Index int
}
SelectTab activates the tab at a 0-based index; out of range does nothing.
type SessionID ¶
type SessionID string
SessionID names a harness session, e.g. a Claude Code session UUID.
type SetAgentAction ¶
SetAgentAction records what an agent is doing right now; empty clears it.
type SetAgentCwd ¶
SetAgentCwd records the directory an agent reported in a hook; empty clears it.
type SetAgentSession ¶
type SetAgentSession struct {
ID PaneID
Session SessionID
Transcript string
// NewConversation drops the plan: the session does not go on with the old
// conversation.
NewConversation bool
}
SetAgentSession records the session an agent reported and its transcript file. An empty Session clears both. An end or a change of session also clears the edited places, and the reported status unless that status already belongs to the new session: a status line can report before its SessionStart hook.
type SetAgentState ¶
type SetAgentState struct {
ID PaneID
State AgentState
}
SetAgentState records what an agent is doing; AgentUnknown clears the badge.
type SetAgentStatus ¶
type SetAgentStatus struct {
ID PaneID
Session SessionID
Model string
Context float64
ContextKnown bool
}
SetAgentStatus records the model and context an agent's status line reported for Session. A false ContextKnown clears the meter and keeps the model; Context is floored and clamped to 0-100.
func (SetAgentStatus) Matches ¶
func (a SetAgentStatus) Matches(p Pane) bool
Matches reports whether p already holds the status a would record.
type SetBranchPR ¶
SetBranchPR records the pull request a lookup found for a branch of the repository keyed "host/owner/name"; without Found it forgets the branch's.
type SetLayoutMode ¶
type SetLayoutMode struct {
Mode LayoutMode
Area Rect
}
SetLayoutMode rebuilds the active tab in a mode from its pane order: BSP inserts the panes one by one with the auto scheme, master-stack keeps the order with the configured ratio, scrolling makes one column per pane. Split ratios and column widths reset; focus stays, zoom and preselection clear. An empty tab only gets its mode, and the current mode changes nothing. Area is the body rect the UI lays out in.
type SetMarks ¶
SetMarks replaces a repository's marks, as loaded from its file. The first SetMarks for a repository always creates its entry: that records the marks as loaded.
type SetPaneCwd ¶
SetPaneCwd records a pane's working directory.
type SetPaneKind ¶
SetPaneKind changes what a pane is. An agent names its harness; becoming a shell clears Harness, Session, Transcript, State, Action, AgentCwd, the reported status and the edited places.
type SetRepoPRs ¶
type SetRepoPRs struct {
Repo string
DefaultBranch string
Open []PRInfo
Err string
Methods []string
DeleteBranchOnMerge bool
Focused *PRChecks
}
SetRepoPRs records a poll of the repository keyed "host/owner/name": its default branch, its open pull requests, merge methods, delete-branch setting, focused pull request's checks and the poll's error, replacing all of them. The branch lookups stay.
type SetReviewMode ¶
type SetReviewMode struct {
Mode ReviewMode
}
SetReviewMode changes the open drawer's mode.
type SetReviewTree ¶
type SetReviewTree struct {
Open bool
}
SetReviewTree opens or closes the open drawer's file tree.
type SetTheme ¶
type SetTheme struct {
Name string
}
SetTheme switches the theme by name. Whether the name is a known theme is the caller's check, since core cannot import the theme package.
type ShowReviewPR ¶
ShowReviewPR puts the open drawer in PR mode on a pull request.
type State ¶
type State struct {
Theme string
Tabs []Tab // at least one once an action has run
Active int // index into Tabs
Panes map[PaneID]Pane
NextID int // last pane number handed out
NextTabID int // last tab number handed out
Layout LayoutConfig // settings Arrange and the placement helpers read
Rail bool // the agents rail is open; it narrows every pane's body
// PRs holds each GitHub repository's pull requests, keyed "host/owner/name".
// It is not saved. Copies of the state share it, so actions replace the map
// and its values and never edit them in place.
PRs map[string]RepoPRs
// Marks holds each repository's reviewed-hunk marks, keyed by its common
// dir. It is not saved in state.json (the marks have their own files) and
// copies share it, so actions replace the map and its values.
Marks map[string]RepoMarks
}
State is the application state; only a Store changes it. A State with no tabs behaves as one empty tab.
func InitialState ¶
InitialState returns the state of a fresh session: one empty tab.
func (State) AgentPanes ¶
AgentPanes lists the agent panes by tab, then layout order.
func (State) OpenPRFor ¶
OpenPRFor returns the newest same-repository open pull request of a branch in the repository keyed "host/owner/name", from the last poll alone. Newest is the highest number, which is the order of creation.
func (State) PRFor ¶
PRFor returns the pull request of a branch of the repository keyed "host/owner/name": the open one the last poll lists (see OpenPRFor), else the one a lookup found. A merged lookup record of the same number outranks the poll's entry.
func (State) TabAgentState ¶
func (s State) TabAgentState(i int) AgentState
TabAgentState is the most urgent state among tab i's agent panes: blocked, working, idle, else AgentUnknown.
func (State) TabHasAgents ¶
TabHasAgents reports whether tab i holds an agent pane.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store holds the State. It is used only on the Bubble Tea goroutine, so it has no lock.
type SwapDir ¶
SwapDir exchanges the focused pane with its FocusDir neighbour. In BSP the tree keeps its shape and ratios, so each position keeps its size; focus stays on the moved pane. It does nothing at an edge.
type Tab ¶
type Tab struct {
ID TabID
Name string // "" for the automatic name
Focus PaneID // "" when the tab has no pane
Zoomed bool // the focused pane fills the body
Mode LayoutMode // never "" once a pane exists
Panes []PaneID // layout order; empty for an empty tab
Layout *Node // the BSP tree; nil outside BSP and for an empty tab
Master float64 // master-stack ratio, 0.1-0.9
Columns []Column // scrolling columns, left to right
First int // first visible scrolling column
Preselect Dir // NoDir when none; BSP only, not saved
Review *Review // the open review drawer; nil when closed
Pin *Pin // the worktree the drawer is held on; not saved
}
Tab is one workspace: its own layout, focus and zoom, kept as plain values so a state copy is a value copy.
func DefaultLayout ¶
func DefaultLayout(t Tab, lc LayoutConfig) Tab
DefaultLayout returns t with the configured default mode built from t.Panes, for a state file with no usable layout. It needs no screen size: BSP puts the panes side by side in equal columns, master-stack keeps the order at the configured ratio, scrolling makes one column per pane. Focus and zoom stay; preselection clears.
func (*Tab) KeepVisible ¶
func (t *Tab) KeepVisible()
KeepVisible scrolls a scrolling tab so its focused column is drawn; other modes are unchanged. A restored tab calls it once its focus is set.
type ToggleRail ¶
type ToggleRail struct{}
ToggleRail opens the agents rail when it is closed and closes it when open.
type ToggleZoom ¶
type ToggleZoom struct{}
ToggleZoom zooms or unzooms the active tab's focused pane.
type TouchMarks ¶
TouchMarks sets Day on the ids that are already marked with another day.
type WorktreesConfig ¶
type WorktreesConfig struct {
Root string `toml:"root"` // inside | sibling: where a new worktree goes
}
WorktreesConfig is the [worktrees] section. Validate rejects an unknown root from a file; Sibling reads a zero field as the default, so a hand-built WorktreesConfig behaves as the defaults.
func (WorktreesConfig) Sibling ¶
func (c WorktreesConfig) Sibling() bool
Sibling reports whether a new worktree goes beside the main checkout rather than inside it. internal/git owns the layouts, so the UI maps this to its root style.
func (WorktreesConfig) Validate ¶
func (c WorktreesConfig) Validate() error
Validate names the key when the root is unknown.