Documentation
¶
Overview ¶
Package configui owns Sidecar's Configuration surface: its route model, its sidebar/detail presentation, and the shared controls every Configuration page composes. It renders and answers input; it decides nothing about persistence. Reading and writing settings stays behind internal/config, so a page can be filled in later without moving the surface.
Index ¶
- Constants
- Variables
- func BackBar(title, parent string, width int, state State) string
- func BackControl(parent string, state State) string
- func Badge(text string, urgent bool) string
- func BetaBadge() string
- func Body(text string) string
- func Button(label string, primary bool, state State) string
- func ButtonRow(buttons ...string) string
- func CaptureLimitRange() string
- func Centered(content string, width int) string
- func ClampCaptureLimit(bytes int) int
- func CodeChip(text string) string
- func ControlWidth(inner, preferred int) int
- func DropdownRow(label, desc string, width int, state State) string
- func Field(input *textinput.Model, width int, state State) string
- func FormRow(label, control string, state State) string
- func FormatCaptureLimit(bytes int) string
- func FormatKeyLabel(key string) string
- func HelpLine(text string) string
- func HighlightBlock(content string, width int, state State) string
- func HighlightRow(content string, width int, state State) string
- func Indented(text string) string
- func IndentedMuted(text string) string
- func IndentedRaw(content string) string
- func ListRow(text string, width int, state State) string
- func Muted(text string) string
- func NearestCaptureLimit(bytes int) int
- func PageTitle(id PageID) string
- func PaneTitle(text string) string
- func PanelRow(title, badge, detail, control string, width int, state State) string
- func ParseCaptureLimit(value string) int
- func RepairRow(badge, title, detail string, width int, state State) string
- func RowWidth(inner int) int
- func SaveCmd(notice string, save func() error) tea.Cmd
- func SectionHeader(text string) string
- func Selector(value string, state State) string
- func SelectorArrow(value, arrow string, state State) string
- func SelectorWidth(value string, width int, state State) string
- func SelectorWidthArrow(value, arrow string, width int, state State) string
- func StaticField(value string, width int, state State) string
- func StatusRow(ok bool, label, detail, badge string, width int, state State) string
- func Swatch(colors []string) string
- func Toggle(on bool, state State) string
- func ToggleWidth(on bool, width int, state State) string
- func ValidateInteractiveKey(value string) error
- func Warning(text string) string
- func WrapAt(text string, inner, indent int, style func(string) string) string
- type CheckUpdatesMsg
- type ChecksMsg
- type ChildID
- type CloseConfigMsg
- type ConfigSavedMsg
- type CopyMsg
- type Group
- type HostState
- type IndexEntry
- type Integration
- type Model
- func (m *Model) AddProjectLocation() string
- func (m *Model) ApplyChecks(msg ChecksMsg)
- func (m *Model) Back() bool
- func (m *Model) Checks() configchecks.Results
- func (m *Model) ChecksReady() bool
- func (m *Model) ClearSearch()
- func (m *Model) Close()
- func (m *Model) Commands() []plugin.Command
- func (m *Model) Config() *config.Config
- func (m *Model) DismissConfirm() bool
- func (m *Model) Escape() bool
- func (m *Model) FocusContext() string
- func (m *Model) FocusNotesPreference()
- func (m *Model) Handle(msg Msg) tea.Cmd
- func (m *Model) Key(msg tea.KeyPressMsg) (bool, tea.Cmd)
- func (m *Model) Mouse(msg tea.MouseMsg) tea.Cmd
- func (m *Model) Navigate(page PageID)
- func (m *Model) Open(page PageID)
- func (m *Model) OpenAddProject()
- func (m *Model) OpenAddRemote()
- func (m *Model) OpenAgentInstructions()
- func (m *Model) OpenAgentIntegrations()
- func (m *Model) OpenEditProject(path string)
- func (m *Model) OpenEditRemote(id string)
- func (m *Model) OpenRepair(repair configchecks.RepairID) bool
- func (m *Model) Page() PageID
- func (m *Model) PrefillAddProjectFromDir(dir string)
- func (m *Model) PreviewingTheme() bool
- func (m *Model) ProbeCmd() tea.Cmd
- func (m *Model) PushChild(child ChildID, title string)
- func (m *Model) Query() string
- func (m *Model) Recheck() tea.Cmd
- func (m *Model) RefreshNotificationProbe()
- func (m *Model) Reopen()
- func (m *Model) Route() Route
- func (m *Model) SearchActive() bool
- func (m *Model) SearchFocused() bool
- func (m *Model) SetCheckInput(in configchecks.Input)
- func (m *Model) SetHostState(state HostState)
- func (m *Model) SetInstallEnvironment(env *version.Environment)
- func (m *Model) SetIntegrationService(svc *agentintegration.Service)
- func (m *Model) SetRemoteHosts(remotes []RemoteHost)
- func (m *Model) TakePending() tea.Cmd
- func (m *Model) View(width, height int) string
- func (m *Model) WheelAtBoundary(msg tea.MouseWheelMsg) bool
- type Msg
- type NoticeMsg
- type NotificationConfigValidationMsg
- type NotificationDeliveryStatusMsg
- type NotificationTestResultMsg
- type OpenFileMsg
- type OpenInApp
- type OpenPaletteMsg
- type OpenShellMsg
- type OpenURLMsg
- type OpenUpdaterMsg
- type Page
- type PageID
- type ProbeNotificationDeliveryMsg
- type RemoteHost
- type Route
- type State
- type TestNotificationDeliveryMsg
- type UpdateStatus
Constants ¶
const ( // CaptureLimitDefault is the safe default, matching config.Default(). CaptureLimitDefault = 2 * 1024 * 1024 // CaptureLimitMin is the smallest capture Sidecar accepts. CaptureLimitMin = 256 * 1024 // CaptureLimitMax is the largest capture Sidecar accepts. CaptureLimitMax = 64 * 1024 * 1024 )
The embedded terminal's capture limit is surfaced twice — plainly on Terminal and among the technical controls on Advanced — so its bounds, its clamp, and the way it is written for a human live here rather than in either page.
The bounds are deliberate: below the minimum a preview loses the scrollback that makes it worth showing, and above the maximum a single capture costs more memory than any preview is worth. config.Validate already refuses a non-positive value; this narrows an accepted value to a range Sidecar is willing to stand behind, for typed and selected input alike.
const ( // LabelColumn is the width of the fixed left label column. It is wide // enough for the longest label any page actually uses ("Split workspace // terminal", "Terminal preview capture"): a shared column that truncates a // real setting's name is a broken column, not a page's problem to work // around. LabelColumn = 26 // RowIndent is the left inset shared by rows inside a section. RowIndent = 2 // ControlColumn is the column every control starts at, measured from the // pane's content origin. ControlColumn = RowIndent + LabelColumn // MaxControlWidth is the widest any fixed-width control asks to be drawn. MaxControlWidth = 48 // MaxRowWidth caps the width a row lays its content out in. A row that // right-aligns a control — the ON/OFF pill on every panel switch — would // otherwise pin it to the pane's right edge, so widening the window drags // the pill away from the label it belongs to until the two are reading as // separate columns. Capping at the control column plus the widest control // puts that right edge exactly where the widest form field already ends, so // pills and fields share one edge instead of the pills drifting past it. MaxRowWidth = ControlColumn + MaxControlWidth )
The Configuration surface aligns every page against one grid: labels occupy a fixed left column and their controls start at one shared column, so help text, completions, and nested pickers can align to the control rather than to the pane edge.
const ( // ContextConfig is sidebar navigation and page-level actions. ContextConfig = "config" // ContextConfigEdit is an active editor — Search, or any future field. // Registered in the host's isTextInputContext so typing never leaks. ContextConfigEdit = "config-edit" // ContextConfigConfirm is a consequential change awaiting confirmation. ContextConfigConfirm = "config-confirm" )
Keymap contexts owned by Configuration. They are registered in internal/keymap/bindings.go, which is what drives the footer, the help modal, and the command palette.
const DefaultPage = PageSetup
DefaultPage is where the gear, the palette command, and `sidecar setup` all land. Configuration deliberately does not remember the last section.
const ( // DocsURL is Sidecar's documentation site, the address the website itself // is published at (website/static/CNAME). DocsURL = "https://sidecar.haplab.com" )
Variables ¶
var CaptureLimitChoices = []int{
256 * 1024,
512 * 1024,
1024 * 1024,
2 * 1024 * 1024,
4 * 1024 * 1024,
8 * 1024 * 1024,
16 * 1024 * 1024,
32 * 1024 * 1024,
64 * 1024 * 1024,
}
CaptureLimitChoices are the values the selector offers, smallest first. Every one of them is inside the accepted range. A configuration may still hold a value between two of them — Advanced accepts a typed size — which the list offers no rung for and the closed control reports as it is stored.
Functions ¶
func BackBar ¶
BackBar is the top row of a focused child route: the route's own title on the left and the visible parent-return control on the right. Escape does the same thing the control does.
func BackControl ¶
BackControl renders the parent-return control on its own, for callers that place it outside a bar.
func Badge ¶
Badge renders a row's action label. A badge on a problem row is the accent call to action; a badge on a healthy row is a quiet way in, so it must not shout at a user who has nothing to fix.
func BetaBadge ¶
func BetaBadge() string
BetaBadge marks an integration Sidecar is still shipping as a preview. It stays on the row after the integration is enabled: turning something on does not make it finished.
func CaptureLimitRange ¶
func CaptureLimitRange() string
CaptureLimitRange writes the accepted range the way the help line states it, so the documented bounds and the enforced ones are the same two numbers.
func Centered ¶
Centered places already-styled content in the middle of the pane, for the small amount of Configuration that is a signature rather than a control.
func ClampCaptureLimit ¶
ClampCaptureLimit narrows a value to the accepted range. A missing or nonsensical value becomes the safe default rather than the nearest bound: zero means "unset", not "as small as possible".
func ControlWidth ¶
ControlWidth is how wide a fixed-width control may actually be drawn: the width the page asked for, or everything the pane has left after the label column, whichever is smaller. A page that insists on its full width in a narrow terminal does not get a wide field — it gets a field with its right half cut off, which is the one thing the brief's narrow-terminal rule rules out.
func DropdownRow ¶
DropdownRow paints one choice in an open list. The list is opaque — every row carries its own background — because it is drawn over content that is still there underneath.
func Field ¶
Field renders a text field at the shared control column. An editable field looks editable at rest and unmistakably active while it owns the keyboard.
func FormRow ¶
FormRow renders a labelled control: the label in the fixed left column, the control starting at the shared column.
func FormatCaptureLimit ¶
FormatCaptureLimit writes a capture limit the way a person reads it.
func FormatKeyLabel ¶
FormatKeyLabel writes a key string the way the mockups show it — Ctrl+\ — without changing the stored value, which stays in the form a key press produces.
func HelpLine ¶
HelpLine renders muted help aligned to the control it belongs to, not to the pane edge.
func HighlightBlock ¶
HighlightBlock applies HighlightRow to every line of a multi-line control.
func HighlightRow ¶
HighlightRow fills a list row so selection is the whole line, not just the label. Focused and hovered rows keep their existing text colour and sit on a darker surface, which is what makes the cursor readable on a dark theme.
func IndentedMuted ¶
IndentedMuted renders quieter text at the shared row indent.
func IndentedRaw ¶
IndentedRaw places already-styled content at the shared row indent.
func ListRow ¶
ListRow renders a focusable row that fills the pane width, so the whole row is legibly the control.
func NearestCaptureLimit ¶
NearestCaptureLimit is the rung a stored value sits on or just above: the largest choice no greater than it, or the smallest choice when it is below them all. It is what a list opens on when the configuration holds a size Advanced accepted as free text, so pressing Enter on an off-ladder value can only ever round it down to the next real rung rather than collapse it to the smallest one.
func PaneTitle ¶
PaneTitle is the page or pane title at the top of a pane, with the breathing room the design brief asks for supplied by the caller's blank line.
func PanelRow ¶
PanelRow is one surface on Panels & Integrations: the whole two-line block is the control, with its ON/OFF state as a distinct pill at the right edge. The name and the pill share a line so the state is legible at a glance; the description sits underneath in the muted column so it never competes with the pill for space.
func ParseCaptureLimit ¶
ParseCaptureLimit reads a typed capture limit — "4 MB", "512kb", or a plain byte count — and returns a value inside the accepted range. Blank or unreadable input keeps the safe default rather than being refused: this setting has no meaningful "unset", and a technical control should not trap a user in an error state over a typo.
func RepairRow ¶
RepairRow is Sidecar Setup's actionable row: a leading badge, the work stated as something to do, and a quieter line saying why. The whole two-line block is one control.
func RowWidth ¶ added in v1.4.0
RowWidth is the width a row lays its content out in: everything the pane has to give, but never more than MaxRowWidth. Rows stay left-aligned in the pane and simply stop growing, which is what keeps a right-aligned control near its label on a wide terminal.
func SectionHeader ¶
SectionHeader titles a group of controls. It carries its own leading blank line so sections separate by whitespace rather than by divider lines.
func SelectorArrow ¶
SelectorArrow renders a selector whose arrow says which way it opens: ▾ for a closed disclosure, ▴ for one already expanded below the field.
func SelectorWidth ¶
SelectorWidth renders a selector that fills a fixed width, so several selectors in a group share one right edge the way the mockups draw them.
func SelectorWidthArrow ¶
SelectorWidthArrow is SelectorWidth with the arrow the control's own state asks for: ▾ while its list is closed, ▴ while it is open over the page.
func StaticField ¶
StaticField renders a value that is edited elsewhere — a placeholder for an unfocused field, drawn like the field it becomes.
func StatusRow ¶
StatusRow renders a diagnostic row.
A healthy row with nothing to do is one quiet line: marker, label, and its detail in the shared control column. A row that offers an action carries a badge at the right edge and moves its detail to a second line, so the badge and the detail never compete for the same run of space. Both forms are one control: the caller registers the whole block.
func Toggle ¶
Toggle renders an ON/OFF pill. The pill is the control; FormRow supplies the label column around it.
func ToggleWidth ¶
ToggleWidth renders an ON/OFF pill that fills a fixed width, so a group of toggles and selectors shares one right edge the way the mockups draw them.
func ValidateInteractiveKey ¶
ValidateInteractiveKey reports whether a value is a key string Sidecar can match against a real key press. It requires a modifier: a bare character would be swallowed the moment the user typed it into the terminal.
func WrapAt ¶
WrapAt lays a paragraph out inside a pane: every line is indented to the same column and no line runs past the pane's writable width. It returns one string with embedded newlines, which the pane builder splits into painted rows, so wrapped help still counts for hit regions and the height clamp.
Types ¶
type CheckUpdatesMsg ¶
type CheckUpdatesMsg struct{}
CheckUpdatesMsg asks the host to run its release check again, bypassing the per-product cache.
type ChecksMsg ¶
type ChecksMsg struct {
Results configchecks.Results
}
ChecksMsg carries a completed run back to the surface. The host forwards it; the surface owns the cache.
type ChildID ¶
type ChildID string
ChildID identifies a focused route hosted by a page — a repair, an add form, an inline picker. Later phases add their own; the empty ChildID means "the page itself".
const ( ChildRepairTmux ChildID = "repair-tmux" ChildRepairTerminalColors ChildID = "repair-terminal-colors" ChildRepairAgentInstructions ChildID = "repair-agent-instructions" ChildRepairConfiguration ChildID = "repair-configuration" )
Child route IDs. They are exported because later phases route to the same repairs from their own pages — the Agents page opens the agent-instructions route rather than building a second one.
const ( ChildNotificationAgentRules ChildID = "notification-agent-rules" ChildNotificationOtherRules ChildID = "notification-other-rules" ChildNotificationQuietHours ChildID = "notification-quiet-hours" ChildNotificationSoundPaths ChildID = "notification-sound-paths" ChildNotificationStatus ChildID = "notification-status" ChildNotificationSourceRule ChildID = "notification-source-rule" ChildNotificationSSH ChildID = "notification-ssh" )
const ChildAgentIntegrations ChildID = "agent-integrations"
ChildAgentIntegrations is the focused route listing agent integrations.
const ChildEnableIntegration ChildID = "enable-integration"
ChildEnableIntegration is the enable route.
const ( // ChildNone is the page's own route. ChildNone ChildID = "" )
type CloseConfigMsg ¶ added in v1.7.0
type CloseConfigMsg struct{}
CloseConfigMsg asks the host to put Configuration away; the chips' Close affordance has no page-local close to call.
type ConfigSavedMsg ¶
type ConfigSavedMsg struct {
// Notice is the toast text on success.
Notice string
// Err is a failure message, empty on success.
Err string
}
ConfigSavedMsg reports a completed write. The host reloads the configuration, reapplies anything it snapshots at startup, and hands the surface fresh state — so this is the one message Configuration cannot handle by itself.
type CopyMsg ¶
type CopyMsg struct {
Text string
// Notice is what the toast should say on success.
Notice string
}
CopyMsg asks the host to put text on the clipboard and say so. Configuration does not own the clipboard or the toast, so it asks.
type HostState ¶
type HostState struct {
// Config is the configuration the app is running with.
Config *config.Config
// ProjectDir is the active working directory.
ProjectDir string
// OpenInApps are the applications the host can open a project in, in the
// order it offers them. Configuration only names them; opening is the
// host's job.
OpenInApps []OpenInApp
// ProjectPath is the configured project the working directory belongs to,
// resolved through worktrees. Empty when the current directory is not one of
// the user's configured projects — which is exactly when a project-scoped
// setting must not be offered.
ProjectPath string
// Version is the version string the running Sidecar resolved for itself.
Version string
// Update is the release check the app already runs at startup. Configuration
// reports it and hands an available update to the existing updater; it never
// checks, downloads, or installs anything itself.
Update UpdateStatus
// RemoteHosts is each registered machine's condition as the running host
// registry knows it. Configuration reports it and never probes: a settings
// screen with its own ssh connection would be a second answer to a question
// the registry is already answering, and the two would disagree the moment
// one was slower than the other.
//
// Note the name. HostState above is about the Sidecar hosting this surface;
// these are the other machines it watches. The two senses of "host" meet
// only here, so everything about the remote sense says "remote".
RemoteHosts []RemoteHost
}
HostState is what the running Sidecar tells Configuration about itself.
type IndexEntry ¶
IndexEntry is one searchable setting: the page it lives on, the label the user would recognize, and extra words they might type instead.
This is a hand-written static index, deliberately not a schema. A phase that adds real controls to a page appends its entries here — one entry per control the user could reasonably search for — and search keeps working with no other change.
func Index ¶
func Index() []IndexEntry
Index returns the full settings index: the static entries above plus one per registered feature flag.
func Search ¶
func Search(query string) []IndexEntry
Search returns the index entries matching a query, in index order. An empty or whitespace-only query matches nothing: search is a filter the user opts into, not a default view.
type Integration ¶
type Integration struct {
// ID is the panel's own identifier, used for region IDs and probe lookups.
ID string
// Name is what the user calls it.
Name string
// Flag is the feature flag enabling the panel.
Flag string
// Why is one line saying what enabling it gets the user.
Why string
// Descriptor names the command and the formula. A zero Descriptor means the
// integration ships inside Sidecar and has nothing to install — Notes is
// exactly that, and it must never reach the enable route.
Descriptor version.Descriptor
}
Integration describes a panel backed by an external command. It exists so the enable route is written once: a future integration supplies a descriptor and gets the PATH check, the Homebrew check, the confirmed install, and the honest failure states without a second implementation.
func NotesIntegration ¶
func NotesIntegration() Integration
NotesIntegration is in-repo. It has no executable, no formula, and no install route: enabling it is only the feature flag. The mockup shows the enable route with Notes as its example, which does not match how Notes is actually built; the route is parameterized for integrations that do have a command.
func TasksIntegration ¶
func TasksIntegration() Integration
TasksIntegration is the Tasks command suite: a real external product with a Homebrew formula, so enabling it can genuinely fail for a reason Sidecar can explain and offer to fix.
func (Integration) NeedsCommand ¶
func (i Integration) NeedsCommand() bool
NeedsCommand reports whether enabling this integration depends on something outside Sidecar.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the Configuration surface. It owns navigation, search, and the per-surface mouse hit map; it owns no configuration data.
func New ¶
func New() *Model
New builds the surface. It performs no I/O, so it is safe on the startup path; nothing here runs until the user opens Configuration.
func (*Model) AddProjectLocation ¶ added in v1.3.0
PrefillAddProjectFromDir puts the current working directory in Location (and Name, if empty) so a first-run user can add this folder without hunting for it. Completions stay user-initiated: a prefilled path still asks for candidates. AddProjectLocation is the Location field on the open Add/Edit Project form.
func (*Model) ApplyChecks ¶
ApplyChecks caches a completed run.
func (*Model) Back ¶
Back returns from a focused child route to its parent. It reports false when there is nothing to return to.
Returning restores the parent page's own state: the sidebar destination never moved, and the row cursor starts at the top of the page the user came from rather than at whatever index the child happened to leave behind.
func (*Model) ChecksReady ¶
ChecksReady reports whether a run has completed.
func (*Model) ClearSearch ¶
func (m *Model) ClearSearch()
ClearSearch drops the query and restores the full sidebar.
func (*Model) Close ¶
func (m *Model) Close()
Close records the position Reopen restores. The host calls it as the surface goes away, which is the only moment that position is still known.
It also puts back a theme the surface was only previewing. A preview belongs to the screen that started it, and closing Configuration is one more way of leaving that screen: Escape restores it, moving to another page restores it, and closing must too, or a theme nobody saved outlives the surface that could have undone it.
func (*Model) Commands ¶
Commands describes what the footer and palette may advertise here. Keys come from the registered bindings, never from this list.
func (*Model) DismissConfirm ¶
DismissConfirm cancels a pending confirmation. Escape reaches it before it means "go back": the change on screen is what the user is answering.
func (*Model) Escape ¶
Escape answers esc for everything the surface owns, innermost first: the field being typed into, a pending confirmation, an inline picker, the sidebar search, then a focused child route. It reports false when nothing on screen needed dismissing, which is the host's signal to close Configuration.
func (*Model) FocusContext ¶
FocusContext is the keymap context the surface owns right now.
func (*Model) FocusNotesPreference ¶ added in v1.2.0
func (m *Model) FocusNotesPreference()
FocusNotesPreference opens the page that owns Notes enablement and puts the detail cursor on its existing toggle. Setup surfaces use this rather than inventing a second Notes setting.
func (*Model) Key ¶
Key handles a key press. It reports whether the surface consumed it; the host keeps unconsumed keys away from the plugin hidden underneath.
func (*Model) Open ¶
Open resets the surface onto a destination. Configuration always opens with the sidebar focused and no query, so Up/Down works immediately.
func (*Model) OpenAddProject ¶
func (m *Model) OpenAddProject()
OpenAddProject opens the Add Project route with Location focused. The diagnostics "no projects" repair and Setup's "Add a project" row both land here, which is why focusing the field is part of opening it.
func (*Model) OpenAddRemote ¶ added in v1.11.0
func (m *Model) OpenAddRemote()
OpenAddRemote opens the Add host route with Target focused: the target is the one field with no useful default, and every other field can be left alone.
func (*Model) OpenAgentInstructions ¶
func (m *Model) OpenAgentInstructions()
OpenAgentInstructions opens the agent-instructions repair as a child of the current page. The Agents page uses this in a later phase; Diagnostics uses it now. Both get the same route, with the same parent-return.
func (*Model) OpenAgentIntegrations ¶ added in v1.11.0
func (m *Model) OpenAgentIntegrations()
OpenAgentIntegrations pushes the route and starts discovery.
func (*Model) OpenEditProject ¶
OpenEditProject opens the same form over an existing project.
func (*Model) OpenEditRemote ¶ added in v1.11.0
OpenEditRemote opens the same form over a registered machine.
func (*Model) OpenRepair ¶
func (m *Model) OpenRepair(repair configchecks.RepairID) bool
OpenRepair opens the focused route for a repair hint from the current page. It reports false for a hint with no route of its own — today, adding a project, which is a page rather than a repair.
func (*Model) PrefillAddProjectFromDir ¶ added in v1.3.0
func (*Model) PreviewingTheme ¶
PreviewingTheme reports that a picker has a live preview on screen. The host must not apply the disk theme over it when some other setting is saved.
func (*Model) ProbeCmd ¶
ProbeCmd looks for the commands Configuration reports on. It runs through the same Env seam the readiness checks use, so a test describes a machine instead of having one.
func (*Model) PushChild ¶
PushChild opens a focused child route with parent-return behavior. The parent's own selection is remembered here, which is what "returning restores the parent page" means in practice.
func (*Model) Recheck ¶
Recheck runs every check in a command. It is explicit everywhere: no repair infers success from a shell closing or a file being saved.
func (*Model) RefreshNotificationProbe ¶ added in v1.11.0
func (m *Model) RefreshNotificationProbe()
RefreshNotificationProbe invalidates any in-flight result and queues a fresh capability and config check against the current host state. The app calls it after a successful save, including while an earlier probe is still running.
func (*Model) Reopen ¶
func (m *Model) Reopen()
Reopen puts the surface back where it was when it last closed: the same section, the same place in the sidebar, and the same row in the detail pane. It is what the gear and the settings key ask for, so toggling Configuration off and on is not a way to lose your place. Nothing to resume — the first open of the session — starts on the default page.
func (*Model) SearchActive ¶
SearchActive reports that a query is still narrowing the sidebar, whether or not the input has focus. Escape clears that before it closes Configuration.
func (*Model) SearchFocused ¶
SearchFocused reports that Search has the keyboard, so every printable key belongs to it.
func (*Model) SetCheckInput ¶
func (m *Model) SetCheckInput(in configchecks.Input)
SetCheckInput tells the surface what to check. The host supplies the running configuration and the active project each time Configuration opens, so a project switch cannot leave stale answers behind.
func (*Model) SetHostState ¶
SetHostState refreshes the surface's view of the running Sidecar. The host calls it when Configuration opens and after every save.
func (*Model) SetInstallEnvironment ¶
func (m *Model) SetInstallEnvironment(env *version.Environment)
SetInstallEnvironment substitutes the process environment the enable route installs through.
func (*Model) SetIntegrationService ¶ added in v1.11.0
func (m *Model) SetIntegrationService(svc *agentintegration.Service)
SetIntegrationService overrides the application service this route uses.
It exists for tests, which must describe a machine rather than have one: without it every test of this route would inspect, and its mutation tests would rewrite, the developer's real provider configuration.
func (*Model) SetRemoteHosts ¶ added in v1.11.0
func (m *Model) SetRemoteHosts(remotes []RemoteHost)
SetRemoteHosts refreshes only the registered machines' health. The app calls it whenever a host's condition changes while Configuration is open.
It is deliberately narrower than SetHostState: health changes on the registry's own cadence, several times a minute, and pushing a whole host state that often would re-run syncHostState — which would snap a live theme preview back to the saved theme while a user was still looking at it.
func (*Model) TakePending ¶ added in v1.3.0
TakePending returns commands queued outside a key handler — a directory listing, a git probe — so the host can run them after a programmatic open.
func (*Model) View ¶
View renders the whole Configuration content area. It never returns more rows than height: the host's header and footer must stay on screen.
func (*Model) WheelAtBoundary ¶
func (m *Model) WheelAtBoundary(msg tea.MouseWheelMsg) bool
WheelAtBoundary reports that a wheel event over Configuration cannot change anything currently under the pointer. The theme list and an open dropdown are the surfaces that scroll; everything else is unknown.
type Msg ¶
type Msg interface {
// contains filtered or unexported methods
}
Msg is a message the Configuration surface sends itself. The host forwards anything implementing it back into Handle without needing to know what it is, which keeps asynchronous work (a directory listing, a save) in commands without adding a host case per message.
type NotificationConfigValidationMsg ¶ added in v1.11.0
NotificationConfigValidationMsg reports the asynchronous custom-path and notification-config validation requested by Delivery status. Validation may touch the filesystem, so it never runs from View.
type NotificationDeliveryStatusMsg ¶ added in v1.11.0
type NotificationDeliveryStatusMsg struct {
Generation uint64
Status notifydelivery.Status
}
NotificationDeliveryStatusMsg carries a completed read-only probe back to the Configuration surface.
type NotificationTestResultMsg ¶ added in v1.11.0
type NotificationTestResultMsg struct{ Result notifydelivery.Result }
NotificationTestResultMsg carries one explicit test result back to the page.
type OpenFileMsg ¶
type OpenFileMsg struct {
Path string
}
OpenFileMsg asks the host to put a file in front of the user.
type OpenPaletteMsg ¶
type OpenPaletteMsg struct{}
OpenPaletteMsg asks the host to open the command palette.
type OpenShellMsg ¶
type OpenShellMsg struct {
Command string
}
OpenShellMsg asks the host to open an ordinary Sidecar shell with a command typed into it. The command is never executed by Sidecar — the user reads it and presses Enter, or does not.
type OpenURLMsg ¶
type OpenURLMsg struct {
URL string
}
OpenURLMsg asks the host to open a URL with the desktop's opener.
type OpenUpdaterMsg ¶
type OpenUpdaterMsg struct{}
OpenUpdaterMsg asks the host to open Sidecar's existing updater. Configuration does not own release notes, confirmation, progress, or install behavior, so it asks for the surface that does.
type PageID ¶
type PageID string
PageID identifies a Configuration destination. It is the stable name later phases route to, so it is deliberately independent of the sidebar's order and of the page's display title.
const ( PageSetup PageID = "setup" PageAppearance PageID = "appearance" PageProjects PageID = "projects" PageWorkspaces PageID = "workspaces" PageRemotes PageID = "remotes" PageAgents PageID = "agents" PageNotifications PageID = "notifications" PageTerminal PageID = "terminal" PagePanels PageID = "panels" PageDiagnostics PageID = "diagnostics" PageFlags PageID = "flags" PageAdvanced PageID = "advanced" PageAbout PageID = "about" )
func SearchPages ¶
SearchPages returns the pages that have at least one matching setting, in sidebar order.
type ProbeNotificationDeliveryMsg ¶ added in v1.11.0
type ProbeNotificationDeliveryMsg struct{ Generation uint64 }
ProbeNotificationDeliveryMsg asks the app host to run the lazy provider probes. It is emitted only after the Notifications page is entered.
type RemoteHost ¶ added in v1.11.0
type RemoteHost struct {
// ID is the name the host is registered under.
ID string
// State is the health state's name, as hosts.State spells it.
State string
// Detail is what went wrong, when anything did.
Detail string
// Fix names what to do about the state, in the imperative. Empty for the
// states that need nothing done.
Fix string
// Connected reports a machine whose rows are current, so a page can say
// "watching" without having to know every state name.
Connected bool
}
RemoteHost is one registered machine's live condition.
It carries the state's own fix line rather than leaving the page to write one, so the row a user reads in Configuration and the row they read in the Sessions browser say the same thing about the same machine.
type Route ¶
type Route struct {
Page PageID
Child ChildID
// Title is what the child route calls itself. Empty for a page route.
Title string
}
Route is one explicit Configuration state: a page, optionally with a focused child route open on top of it. Routes are a stack with parent-return, not stacked modals — a child knows the page it returns to, and Escape or the visible Back control returns there without applying anything.
type State ¶
type State struct {
Focused bool
Hovered bool
// Disabled marks a control the current environment cannot offer.
Disabled bool
}
State is the interaction state of a control. Every control renders rest, focus, and hover distinctly so keyboard and mouse describe the same surface.
type TestNotificationDeliveryMsg ¶ added in v1.11.0
type TestNotificationDeliveryMsg struct {
Event notifydelivery.TestEvent
Source notify.SourceID
}
TestNotificationDeliveryMsg asks the host to exercise enabled channels through its shared delivery service. It never creates a centre record.
type UpdateStatus ¶
type UpdateStatus struct {
// Checked is true once a check has settled, successfully or not.
Checked bool
// Failed marks a check that could not complete.
Failed bool
// Available marks a real available update.
Available bool
// AnyPending marks any updater work worth opening the surface for:
// another product's pending update included, not just Sidecar's own.
AnyPending bool
// LatestVersion is the release a user would move to.
LatestVersion string
}
UpdateStatus is the app's release check as About needs to state it. It deliberately distinguishes "not checked yet" and "the check failed" from "up to date": an unknown answer must never be reported as reassurance.
Source Files
¶
- capture.go
- checks.go
- components.go
- detail.go
- dropdown.go
- editor.go
- host.go
- index.go
- integrations.go
- keys.go
- model.go
- page_about.go
- page_advanced.go
- page_agent_integrations.go
- page_agents.go
- page_appearance.go
- page_diagnostics.go
- page_flags.go
- page_notifications.go
- page_panels.go
- page_projects.go
- page_remotes.go
- page_setup.go
- page_terminal.go
- page_workspaces.go
- pages.go
- repairs.go
- route.go
- route_enable.go
- route_project_form.go
- route_remote_form.go
- stubs.go
- themepicker.go