Documentation
¶
Overview ¶
Package settings stores the user's preferences in the prefs table and serves them to the UI.
Each preference is a typed key with a default, so a fresh database already has a complete set of settings. Setters validate their value before storing it and reject anything unknown with a sentinel error. Settings writes every key it declares, and the keys the trust, snooze, sensitive, notifyprefs, branchrules, reporules, integrationprefs, threadrules, statusprefs, updateprefs, autopilotprefs, and heldruns packages declare and decode; see the prefs package for which package writes the others.
Index ¶
- Constants
- Variables
- func AdoptSections(ctx context.Context, pool *sql.DB, c clock.Clock) error
- func DefaultHiddenLabels() []string
- func IsDark(theme Theme, systemDark bool) bool
- func KeyDefaultProfile(id agent.ID) string
- type BackupPart
- func (bp *BackupPart) Announce(ctx context.Context, plan PortablePlan)
- func (bp *BackupPart) ApplyPortable(ctx context.Context, tx *sql.Tx, plan PortablePlan) (backup.Count, error)
- func (bp *BackupPart) PlanPortable(ctx context.Context, p Portable) (PortablePlan, error)
- func (bp *BackupPart) PlanRepos(ctx context.Context, r PortableRepos, mode backup.Mode) (PortablePlan, error)
- func (bp *BackupPart) Portable(ctx context.Context) (Portable, error)
- func (bp *BackupPart) PortableItems(p Portable) int
- func (bp *BackupPart) PortableRepos(ctx context.Context) (PortableRepos, error)
- type CardDensity
- type Celebrations
- type ConversationOrder
- type InboxOrder
- type ListKey
- type ListKind
- type MergeMethod
- type NotificationsTab
- type Option
- type Portable
- type PortableAutopilot
- type PortableIntegration
- type PortablePlan
- type PortableRepos
- type PortableStatus
- type PortableThreadRules
- type ProfileLookup
- type RefreshChoices
- type RefreshIntervals
- type RefreshKind
- type ReviewTab
- type Service
- func (s *Service) AddCloneLocations(ctx context.Context, dirs []string) (Settings, error)
- func (s *Service) BypassOwn(ctx context.Context) (bool, error)
- func (s *Service) CheckCloneLocations(ctx context.Context) ([]localrepos.LocationState, error)
- func (s *Service) CollapsedSections(ctx context.Context) ([]ListKey, error)
- func (s *Service) CreateCloneRoot(ctx context.Context, root string) (Settings, error)
- func (s *Service) FollowSessions(ctx context.Context) (bool, error)
- func (s *Service) Get(ctx context.Context) (Settings, error)
- func (s *Service) InboxOrder(ctx context.Context) (InboxOrder, error)
- func (s *Service) MatchSensitivePath(ctx context.Context, path string) (sensitive.PathMatch, error)
- func (s *Service) MenuBar(ctx context.Context) (bool, error)
- func (s *Service) MergeMethod(ctx context.Context) (MergeMethod, error)
- func (s *Service) PreviewCloneLocation(ctx context.Context, dir string) (localrepos.Preview, error)
- func (s *Service) RemoveCloneLocation(ctx context.Context, dir string) (Settings, error)
- func (s *Service) ResetTrustedBots(ctx context.Context) (Settings, error)
- func (s *Service) SetAutopilotActionsPerDay(ctx context.Context, n int) (Settings, error)
- func (s *Service) SetAutopilotActionsPerHour(ctx context.Context, n int) (Settings, error)
- func (s *Service) SetAutopilotAgentsAtOnce(ctx context.Context, n int) (Settings, error)
- func (s *Service) SetAutopilotCatchUpHours(ctx context.Context, hours int) (Settings, error)
- func (s *Service) SetAutopilotDailyCap(ctx context.Context, dailyCap autopilotprefs.DailyCap) (Settings, error)
- func (s *Service) SetAutopilotDefaultMode(ctx context.Context, mode autopilotprefs.Mode) (Settings, error)
- func (s *Service) SetAutopilotEnabled(ctx context.Context, on bool) (Settings, error)
- func (s *Service) SetAutopilotHistoryDays(ctx context.Context, days int) (Settings, error)
- func (s *Service) SetAutopilotHoldOnOutage(ctx context.Context, on bool) (Settings, error)
- func (s *Service) SetAutopilotKeepAwake(ctx context.Context, on bool) (Settings, error)
- func (s *Service) SetAutopilotLogDays(ctx context.Context, days int) (Settings, error)
- func (s *Service) SetAutopilotMergePastRules(ctx context.Context, on bool) (Settings, error)
- func (s *Service) SetAutopilotPaused(ctx context.Context, on bool) (Settings, error)
- func (s *Service) SetAutopilotRunsPerDay(ctx context.Context, n int) (Settings, error)
- func (s *Service) SetBranchRules(ctx context.Context, rules branchrules.Rules) (Settings, error)
- func (s *Service) SetBypassOwn(ctx context.Context, on bool) (Settings, error)
- func (s *Service) SetCardAvatars(ctx context.Context, on bool) (Settings, error)
- func (s *Service) SetCardDensity(ctx context.Context, density CardDensity) (Settings, error)
- func (s *Service) SetCardUnread(ctx context.Context, on bool) (Settings, error)
- func (s *Service) SetCelebrations(ctx context.Context, c Celebrations) (Settings, error)
- func (s *Service) SetClaudeAPIKey(ctx context.Context, on bool) (Settings, error)
- func (s *Service) SetCloneRoot(ctx context.Context, root string) (Settings, error)
- func (s *Service) SetCodexAPIKey(ctx context.Context, on bool) (Settings, error)
- func (s *Service) SetCodexEffort(ctx context.Context, on bool) (Settings, error)
- func (s *Service) SetCodexFast(ctx context.Context, on bool) (Settings, error)
- func (s *Service) SetConversationOrder(ctx context.Context, order ConversationOrder) (Settings, error)
- func (s *Service) SetDefaultAgent(ctx context.Context, id agent.ID) (Settings, error)
- func (s *Service) SetDefaultProfile(ctx context.Context, id agent.ID, name string) (Settings, error)
- func (s *Service) SetDepsSort(ctx context.Context, sort integrationprefs.DepsSort) (Settings, error)
- func (s *Service) SetFollowSessions(ctx context.Context, on bool) (Settings, error)
- func (s *Service) SetGitHubNotificationAction(ctx context.Context, action threadrules.Action) (Settings, error)
- func (s *Service) SetGitHubNotificationSwitch(ctx context.Context, name threadrules.Switch, on bool) (Settings, error)
- func (s *Service) SetGitHubNotificationTrigger(ctx context.Context, trigger threadrules.Trigger, on bool) (Settings, error)
- func (s *Service) SetHiddenLabels(ctx context.Context, patterns []string) (Settings, error)
- func (s *Service) SetIgnoredWorkflows(ctx context.Context, names []string) (Settings, error)
- func (s *Service) SetIntegrationEnabled(ctx context.Context, id integrationprefs.ID, state integrationprefs.Switch) (Settings, error)
- func (s *Service) SetIntegrationPath(ctx context.Context, id integrationprefs.ID, path string) (Settings, error)
- func (s *Service) SetIntegrationsAnnounced(ctx context.Context, announced bool) (Settings, error)
- func (s *Service) SetListKind(ctx context.Context, section ListKey, kind ListKind) (Settings, error)
- func (s *Service) SetMenuBar(ctx context.Context, on bool) (Settings, error)
- func (s *Service) SetMergeBots(ctx context.Context, bots []string) (Settings, error)
- func (s *Service) SetMergeBotsOn(ctx context.Context, on bool) (Settings, error)
- func (s *Service) SetMergeMethod(ctx context.Context, method MergeMethod) (Settings, error)
- func (s *Service) SetNotificationBanner(ctx context.Context, kind notifyprefs.Kind, on bool) (Settings, error)
- func (s *Service) SetNotificationsTab(ctx context.Context, tab NotificationsTab) (Settings, error)
- func (s *Service) SetNudgeAfterHours(ctx context.Context, hours int) (Settings, error)
- func (s *Service) SetNudgeSnooze(ctx context.Context, on bool) (Settings, error)
- func (s *Service) SetOfferAfterMerge(ctx context.Context, on bool) (Settings, error)
- func (s *Service) SetProjectsTipDismissed(ctx context.Context, dismissed bool) (Settings, error)
- func (s *Service) SetRefreshInterval(ctx context.Context, kind RefreshKind, seconds int) (Settings, error)
- func (s *Service) SetReleaseSort(ctx context.Context, sort integrationprefs.ReleaseSort) (Settings, error)
- func (s *Service) SetRepoRule(ctx context.Context, target string, rule reporules.Rule) (Settings, error)
- func (s *Service) SetReviewTab(ctx context.Context, tab ReviewTab) (Settings, error)
- func (s *Service) SetRunsIn(ctx context.Context, place integrationprefs.RunsIn) (Settings, error)
- func (s *Service) SetScriptSources(ctx context.Context, magexTargets, repoFiles bool) (Settings, error)
- func (s *Service) SetScriptsLastPage(ctx context.Context, page integrationprefs.ScriptsPage) (Settings, error)
- func (s *Service) SetScriptsLastRepo(ctx context.Context, dir string) (Settings, error)
- func (s *Service) SetScriptsSectionOpen(ctx context.Context, section integrationprefs.ScriptsSection, open bool) (Settings, error)
- func (s *Service) SetSectionCollapsed(ctx context.Context, section ListKey, collapsed bool) (Settings, error)
- func (s *Service) SetSensitiveCategory(ctx context.Context, id string, on bool) (Settings, error)
- func (s *Service) SetSensitivePatterns(ctx context.Context, patterns []string) (Settings, error)
- func (s *Service) SetSensitiveScope(ctx context.Context, scope sensitive.Scope) (Settings, error)
- func (s *Service) SetShowRuns(ctx context.Context, on bool) (Settings, error)
- func (s *Service) SetSnoozeDays(ctx context.Context, days int) (Settings, error)
- func (s *Service) SetSnoozeWake(ctx context.Context, rules snooze.Rules) (Settings, error)
- func (s *Service) SetStatusOrder(ctx context.Context, order []string) (Settings, error)
- func (s *Service) SetStatusPart(ctx context.Context, id statusprefs.PartID, on bool) (Settings, error)
- func (s *Service) SetStatusProvider(ctx context.Context, id statusprefs.ProviderID, on bool) (Settings, error)
- func (s *Service) SetStatusSort(ctx context.Context, section ListKey, on bool) (Settings, error)
- func (s *Service) SetTerminal(ctx context.Context, id terminal.ID) (Settings, error)
- func (s *Service) SetTextSize(ctx context.Context, size TextSize) (Settings, error)
- func (s *Service) SetTheme(ctx context.Context, theme Theme) (Settings, error)
- func (s *Service) SetToastSeconds(ctx context.Context, seconds int) (Settings, error)
- func (s *Service) SetTrustedBots(ctx context.Context, bots []string) (Settings, error)
- func (s *Service) SetUpdateMode(ctx context.Context, mode updateprefs.Mode) (Settings, error)
- func (s *Service) SetWatchPushes(ctx context.Context, on bool) (Settings, error)
- func (s *Service) SetWindowSize(ctx context.Context, size WindowSize) (Settings, error)
- func (s *Service) SetWorktreeAutoCleanup(ctx context.Context, on bool) (Settings, error)
- func (s *Service) SetWorktreeDefault(ctx context.Context, on bool) (Settings, error)
- func (s *Service) SuggestCloneRoots(ctx context.Context) ([]localrepos.Suggestion, error)
- func (s *Service) TextSize(ctx context.Context) (TextSize, error)
- func (s *Service) Theme(ctx context.Context) (Theme, error)
- func (s *Service) WatchPushes(ctx context.Context) (bool, error)
- type Settings
- type TextSize
- type Theme
- type WindowSize
Constants ¶
const ( KeyMergeBotsOn = trust.PrefMergeBotsOn KeyMergeBots = trust.PrefMergeBots )
KeyMergeBotsOn is whether a pull request's card says when one of the user's auto-merge bots approved it, so it merges by itself once its checks pass, and KeyMergeBots lists those bots (see trust.MergeBots). The inbox reads both; the switch starts off and the list empty.
const ( KeyNudgeAfterHours = "review.nudgeAfterHours" KeyNudgeSnooze = "review.nudgeSnooze" )
KeyNudgeAfterHours is how many hours a pull request the user requested changes on has to be quiet before its card offers to nudge its author, stored as a whole number; 0 offers none. KeyNudgeSnooze is whether the nudge dialog starts with "Then snooze" ticked. Only the window reads them: the inbox posts a nudge whatever they say.
const ( MaxNudgeAfterHours = 720 DefaultNudgeAfterHours = 24 DefaultNudgeSnooze = false )
The hours a pull request can be set to be quiet before a nudge is offered, beyond 0 for never, the hours of a fresh database, and whether a fresh database snoozes after a nudge.
const ( KeyRefreshInbox = "refresh.inbox" KeyRefreshChecks = "refresh.checks" KeyRefreshReleaseChecks = "refresh.releaseChecks" KeyRefreshWorktrees = "refresh.worktrees" KeyRefreshNotifications = "refresh.notifications" KeyRefreshServiceStatus = "refresh.serviceStatus" )
The keys the refresh intervals are stored under, in seconds.
const ( DefaultRefreshInbox = 300 DefaultRefreshChecks = 45 DefaultRefreshReleaseChecks = 45 DefaultRefreshWorktrees = 300 DefaultRefreshNotifications = 300 DefaultRefreshServiceStatus = 1800 )
The default refresh intervals, in seconds.
const ( // KeyDefaultAgent is the coding agent launches use when no launch default names one. KeyDefaultAgent = "agent.default" // KeyWorktreeDefault is whether launches start in a worktree unless unticked. KeyWorktreeDefault = "launch.worktree" // KeyWorktreeAutoCleanup is whether a worktree is cleaned up on its own once its pull // request merges or its issue closes (see the worktrees package for what is checked). KeyWorktreeAutoCleanup = "worktrees.autoCleanup" // KeyTerminal is the terminal app launches open in. KeyTerminal = "launch.terminal" // KeyFollowSessions is whether the app follows the agent sessions it launches. KeyFollowSessions = "launch.followSessions" // KeyCodexEffort is whether a Codex launch passes the effort level it resolves to, // which Codex takes only as a config override. KeyCodexEffort = "agent.codex.effort" // KeyCodexFast is whether Codex launches start in Fast mode unless unticked. KeyCodexFast = "agent.codex.fast" // KeyClaudeAPIKey and KeyCodexAPIKey are whether an API key in the environment a // session starts in may sign the agent in (agent.Agent.KeyEnv). Off, the default, a // launch removes those variables, so the agent runs on the profile's own sign-in. KeyClaudeAPIKey = "agent.claude.apiKey" KeyCodexAPIKey = "agent.codex.apiKey" //nolint:gosec // a setting's name, which holds no credential // KeyCloneRoot is the directory whose children are the user's local clones, and the // one new clones go in. The other locations are under KeyCloneLocations. KeyCloneRoot = "clones.root" // KeyTrustedBots lists the bots whose items are trusted (see the trust package). KeyTrustedBots = trust.PrefBots // KeySnoozeDays is how many days an inbox row's Snooze button hides an item. The // wake rules are stored under the other snooze.* keys (see the snooze package). KeySnoozeDays = snooze.PrefDays )
Preference keys.
const ( // TerminalITerm2 opens launches in a new iTerm2 tab or window. TerminalITerm2 = terminal.ITerm2 // TerminalApp opens launches in a new Terminal.app window. TerminalApp = terminal.TerminalApp )
Terminal choices: the IDs of the terminal drivers.
const ( DefaultAgent = agent.Claude DefaultProfile = profiles.DefaultName DefaultWorktreeDefault = true DefaultAutoCleanup = true DefaultTerminal = TerminalITerm2 DefaultCloneRoot = "~/projects" DefaultFollowSessions = true )
Defaults for a fresh database.
const ( MinToastSeconds = 5 MaxToastSeconds = 60 DefaultToastSeconds = 12 )
The lengths a toast can be set to stay, in seconds, and the length of a fresh database. The frontend keeps the same three (frontend/src/components/Toast.tsx), and a test holds the two in step.
const ( DefaultWindowWidth = 1440 DefaultWindowHeight = 900 MinWindowWidth = 800 MinWindowHeight = 520 MaxWindowWidth = 7680 MaxWindowHeight = 4320 )
Window sizes, in points. A fresh database opens the window at the default size; the minimum is the smallest the window can be resized to at the default text size, and grows with a larger one (MinWindowSizeFor).
const DefaultBypassOwn = false
DefaultBypassOwn is whether a fresh database makes merging past the rules the button on the user's own pull request: it doesn't.
const DefaultCardAvatars = true
DefaultCardAvatars is whether a fresh database shows the authors' pictures on the cards.
const DefaultCardDensity = CardComfortable
DefaultCardDensity is the density of a fresh database.
const DefaultCardUnread = true
DefaultCardUnread is whether a fresh database shows the unread dots on the cards.
const DefaultCelebrations = CelebrationsMilestones
DefaultCelebrations is how a fresh database celebrates.
const DefaultConversationOrder = ConversationOldest
DefaultConversationOrder is the order of a fresh database: oldest first, as GitHub lists a conversation.
const DefaultMenuBar = true
DefaultMenuBar is the menu bar setting of a fresh database.
const DefaultMergeMethod = MergeMethodRepo
DefaultMergeMethod is the merge method of a fresh database.
const DefaultNotificationsTab = NotificationsTabApp
DefaultNotificationsTab is the tab a fresh database opens the Notifications page on.
const DefaultReviewTab = ReviewTabFiles
DefaultReviewTab is the tab a fresh database opens the review sheet on.
const DefaultTextSize = TextSizeDefault
DefaultTextSize is the text size of a fresh database.
const DefaultTheme = ThemeSystem
DefaultTheme is the theme of a fresh database.
const DefaultWatchPushes = true
DefaultWatchPushes is on: watching costs a few file checks every few seconds and no GitHub request until a pull request's branch moves.
const KeyBypassOwn = "review.bypassOwn"
KeyBypassOwn is whether the review sheet's button merges the user's own pull request past the branch's rules when an approval from someone else is all it lacks and GitHub lets the user merge past them. The sheet still asks the user to accept each rule it skips.
const KeyCardAvatars = "cards.avatars"
KeyCardAvatars is whether the inbox's cards show each author's picture: a person's in a circle and a bot's in a rounded square, downloaded through the avatars service without the token. Off, the cards show initials and the bot mark, and the window asks for no picture. Only the window reads it; the sheets show their pictures either way.
const KeyCardDensity = "cards.density"
KeyCardDensity is how much room each of the inbox's cards takes, in both lists, stored as one of the CardDensity choices. Only the window reads it.
const KeyCardUnread = "cards.unread"
KeyCardUnread is whether the inbox's cards show a dot on an item with activity since the user last opened it, and offer Mark as read and Mark as unread. Only the window reads it, and only for what it shows: the window marks items seen as they open either way.
const KeyCelebrations = "ui.celebrations"
KeyCelebrations is how the window celebrates, stored as one of the Celebrations choices. Only the window reads it: the inbox's party at nil, and the bursts of confetti that end the first-run setup and greet a release on GitHub.
const KeyCloneLocations = "clones.locations"
KeyCloneLocations is the user's other repository locations, beside the clone root: a JSON list of {path, kind}, each path with ~ for home, in the order they were added.
const KeyConversationOrder = "ui.conversationOrder"
KeyConversationOrder is the order the sheets list a conversation in, the one the user last chose, stored as one of the ConversationOrder choices: the window's memory, which a backup never holds.
const KeyHiddenLabels = "labels.hidden"
KeyHiddenLabels is the patterns of the labels the inbox's cards leave out, as a JSON list, such as "size/*": a card already shows its own size, so the size label repeats it. Only the window reads it, for the cards' labels alone; the filter, the issue sheet's label picker, Autopilot, and the prompts' variables still see every label. A key never stored holds DefaultHiddenLabels; a list stored empty stays empty.
A pattern matches a label's whole name, ignoring case: * matches any run of characters, / included, ? matches one character, and anything else matches itself, as Autopilot's label patterns do (internal/autopilot/eval's globMatch, and frontend/src/lib/labels.ts, which the window matches with).
const KeyIgnoredWorkflows = heldruns.KeyIgnoredWorkflows
KeyIgnoredWorkflows is the names of the workflows whose held runs never count toward where a pull request stands, on the inbox's cards and in the review sheet, as a JSON list (see the heldruns package). The inbox and the review sheet read it; a key never stored holds none.
const KeyMenuBar = "ui.menuBar"
KeyMenuBar is whether the app shows its icon, with how many items need the user, in the menu bar; closing the window then keeps the app running there.
const KeyMergeMethod = "review.mergeMethod"
KeyMergeMethod is how the review sheet merges a pull request, stored as one of the MergeMethod choices.
const KeyNotificationsTab = "ui.notificationsTab"
KeyNotificationsTab is the Notifications page's tab the user last chose, stored as one of the NotificationsTab choices: the window's memory, which a backup never holds.
const KeyProjectsTipDismissed = "ui.projectsTipDismissed"
KeyProjectsTipDismissed is whether the user put away the inbox's tip about showing the GitHub projects an issue is in, which the inbox offers while the token lacks the read:project scope.
const KeyReviewTab = "ui.reviewTab"
KeyReviewTab is the review sheet's tab the user last chose, stored as one of the ReviewTab choices: the window's memory, which a backup never holds.
const KeyStatusOrder = "ui.statusOrder"
KeyStatusOrder is the order the user put project statuses in, such as "In progress" before "Blocked", as a JSON array of their names. A list sorted by status ranks each issue by the first of its projects' statuses here. Statuses not in it are placed by the window, which knows them from the inbox; an empty order leaves every one to it.
const KeyTextSize = "ui.textSize"
KeyTextSize is the size of the app's text, stored as TextSizeDefault, TextSizeLarge, or TextSizeLarger.
const KeyTheme = "ui.theme"
KeyTheme is the theme the app shows, stored as ThemeSystem, ThemeLight, or ThemeDark.
const KeyToastSeconds = "ui.toastSeconds"
KeyToastSeconds is how long, in seconds, a message at the bottom of the window (a toast, such as "Dismissed" with its Undo) stays before it closes itself.
const KeyWatchPushes = "refresh.watchPushes"
KeyWatchPushes is whether the app watches the branches of the inbox's pull requests in the user's clones, so one pushed from this Mac is read again at once.
const KeyWindowSize = "window.size"
KeyWindowSize is the size the window opens at, stored as "<width>x<height>".
Variables ¶
var ( // ErrTooManyHiddenLabels is returned for more than maxHiddenLabels patterns. ErrTooManyHiddenLabels = errors.New("too many hidden labels") // ErrHiddenLabelTooLong is returned for a pattern longer than maxHiddenLabelLength // characters. ErrHiddenLabelTooLong = errors.New("a hidden label pattern is too long") // ErrInvalidHiddenLabel is returned for a pattern holding a control character, such as // a line break, which no label's name holds; the window keys its matcher by the // patterns joined with line breaks. ErrInvalidHiddenLabel = errors.New("a hidden label pattern holds a control character") )
var ( // ErrInvalidTerminal is returned for a terminal that is not one of the choices. ErrInvalidTerminal = errors.New("unknown terminal") // ErrUnknownProfile is returned when a default profile names no stored profile. ErrUnknownProfile = errors.New("unknown profile") // ErrUnknownAgent is returned for a default agent this build does not know. ErrUnknownAgent = errors.New("unknown coding agent") // ErrInvalidCloneRoot is returned for a clone root that is not an existing directory. ErrInvalidCloneRoot = errors.New("invalid clone root") )
var ErrInvalidCardDensity = errors.New("unknown card density")
ErrInvalidCardDensity is returned for a card density that is not one of the choices.
var ErrInvalidCelebrations = errors.New("unknown celebrations")
ErrInvalidCelebrations is returned for a celebrations choice that is not one of them.
var ErrInvalidCloneLocation = errors.New("invalid repository location")
ErrInvalidCloneLocation is returned for a repository location that can't be added: a path that isn't one, a folder that doesn't exist or can't be a location, or one the locations already cover.
var ErrInvalidConversationOrder = errors.New("unknown conversation order")
ErrInvalidConversationOrder is returned for a conversation order that is not one of the choices.
var ErrInvalidListKind = errors.New("unknown kind of item")
ErrInvalidListKind is returned for a kind that is not one a list can show.
var ErrInvalidMergeMethod = errors.New("unknown merge method")
ErrInvalidMergeMethod is returned for a merge method that is not one of the choices.
var ErrInvalidNotificationsTab = errors.New("unknown notifications tab")
ErrInvalidNotificationsTab is returned for a Notifications page tab that is not one of the choices.
var ErrInvalidNudgeAfterHours = errors.New("unknown time before a nudge")
ErrInvalidNudgeAfterHours is returned for a quiet time outside 0 to MaxNudgeAfterHours.
var ErrInvalidRefresh = errors.New("unknown refresh interval")
ErrInvalidRefresh is returned for a refresh kind, or an interval, that isn't one of the choices.
var ErrInvalidReviewTab = errors.New("unknown review sheet tab")
ErrInvalidReviewTab is returned for a review sheet tab that is not one of the choices.
var ErrInvalidStatusOrder = errors.New("invalid status order")
ErrInvalidStatusOrder is returned for a status order that is too long, or holds a name that is.
var ErrInvalidTextSize = errors.New("unknown text size")
ErrInvalidTextSize is returned for a text size that is not one of the choices.
var ErrInvalidTheme = errors.New("unknown theme")
ErrInvalidTheme is returned for a theme that is not one of the choices.
var ErrInvalidToastSeconds = errors.New("unknown toast length")
ErrInvalidToastSeconds is returned for a toast length outside MinToastSeconds to MaxToastSeconds.
var ErrInvalidToolPath = errors.New("invalid tool path")
ErrInvalidToolPath is returned for a chosen copy of a tool that is not an executable file.
var ErrInvalidWindowSize = errors.New("invalid window size")
ErrInvalidWindowSize is returned for a window size outside the bounds.
var ErrUnknownSection = errors.New("unknown inbox section")
ErrUnknownSection is returned for a section that is not one of the inbox lists.
Functions ¶
func AdoptSections ¶ added in v0.4.0
AdoptSections carries the window's memory of the inbox's former lists, Authored and Assigned, over to Yours, which took both their places, in one transaction: for the collapsed sections, the status sorts, and the kinds each list shows, Yours takes the Assigned list's stored value when it has none of its own (Yours is Assigned with the user's own pull requests added, and the user narrowed Assigned to a kind, say, for what it holds), and the Authored and Assigned keys are then deleted. Run again, it finds no former key and changes nothing, so it runs at every start and settles once per database: a start that finds none, as every start after the first does, only reads, and takes no write lock.
func DefaultHiddenLabels ¶ added in v0.4.0
func DefaultHiddenLabels() []string
DefaultHiddenLabels are the patterns a fresh database hides, which Restore the defaults goes back to: the size labels, which the card's own size grade already shows.
func IsDark ¶
IsDark reports whether a theme shows the dark palette while the system appearance is dark (systemDark) or light. A theme that is not one of the choices counts as DefaultTheme.
func KeyDefaultProfile ¶
KeyDefaultProfile is the key of the agent's default profile, profile.default.<agent>.
Types ¶
type BackupPart ¶ added in v0.2.0
type BackupPart struct {
// contains filtered or unexported fields
}
BackupPart is the settings' part of a backup of the user's setup: their settings and, apart, their repositories, in portable form, and what importing each does. Core adapts it to a backup.Part; it is a type of its own, apart from the Service, so the window, which binds the Service, never reaches it.
func NewBackupPart ¶ added in v0.2.0
func NewBackupPart(s *Service) *BackupPart
NewBackupPart returns the backup's part over s.
func (*BackupPart) Announce ¶ added in v0.2.0
func (bp *BackupPart) Announce(ctx context.Context, plan PortablePlan)
Announce emits, once each, the events the setters of the settings plan changed emit, as they would had the user changed each one: the theme, the text size, the menu bar, the sessions followed, the integrations, the GitHub notification rules, the refresh intervals, the pinned and muted repositories, what the service status check watches, what the app does when a new version is out, and Autopilot's settings.
func (*BackupPart) ApplyPortable ¶ added in v0.2.0
func (bp *BackupPart) ApplyPortable(ctx context.Context, tx *sql.Tx, plan PortablePlan) (backup.Count, error)
ApplyPortable makes plan's writes inside tx, the import's transaction, and returns what it changed.
func (*BackupPart) PlanPortable ¶ added in v0.2.0
func (bp *BackupPart) PlanPortable(ctx context.Context, p Portable) (PortablePlan, error)
PlanPortable works out what importing p, a backup's settings, does, changing nothing: each setting p holds is checked as its setter checks it and set, and one p lacks is left as it is. A value the setter would refuse, a profile that isn't on this Mac, and a copy of a tool that isn't a program here are left out, each with a note. Both modes import settings the same way.
func (*BackupPart) PlanRepos ¶ added in v0.2.0
func (bp *BackupPart) PlanRepos(ctx context.Context, r PortableRepos, mode backup.Mode) (PortablePlan, error)
PlanRepos works out what importing r, a backup's repositories, does under mode, changing nothing. The clone folder is set when it exists here. Merge adds the file's locations that exist here, and pins or mutes each of the file's targets, its rule winning over this Mac's; Replace makes the locations exactly the file's that exist here, and each list the file holds exactly the file's. A location or a target that can't be added is left out with a note, as one the setters would refuse.
func (*BackupPart) Portable ¶ added in v0.2.0
func (bp *BackupPart) Portable(ctx context.Context) (Portable, error)
Portable returns the user's settings in portable form, every field set.
func (*BackupPart) PortableItems ¶ added in v0.2.0
func (bp *BackupPart) PortableItems(p Portable) int
PortableItems counts the settings p holds.
func (*BackupPart) PortableRepos ¶ added in v0.2.0
func (bp *BackupPart) PortableRepos(ctx context.Context) (PortableRepos, error)
PortableRepos returns the user's repositories in portable form, every field set.
type CardDensity ¶ added in v0.4.0
type CardDensity string
CardDensity is how much room each of the inbox's cards takes. Both densities show the same next step, from the same rules.
const ( // CardComfortable shows each card on two lines, with the state track, and the agent's // slot beside the next step. CardComfortable CardDensity = "comfortable" // CardCompact shows each card on one line, a column per question, with the triage and // the agent's slot on hover. CardCompact CardDensity = "compact" )
The cards' densities.
type Celebrations ¶ added in v0.7.0
type Celebrations string
Celebrations is how the window celebrates: the inbox reaching nil, the first-run setup's end, and a release on GitHub.
const ( // CelebrationsMilestones throws the confetti for what it means: the inbox's party // throws it on its own for an achievement (the milestones package), at most once a // day, and the setup's end and a release each throw a burst. Every other party plays a // small flourish instead. CelebrationsMilestones Celebrations = "milestones" // CelebrationsQuiet keeps the party's flourishes and the achievements it shows, and // throws confetti only when the user runs the party again. CelebrationsQuiet Celebrations = "quiet" // CelebrationsOff shows the inbox at nil as a still strip, and throws nothing. CelebrationsOff Celebrations = "off" )
The celebrations' choices.
type ConversationOrder ¶ added in v0.2.0
type ConversationOrder string
ConversationOrder is the order the issue sheet and the review sheet list a conversation's entries in, under its description.
const ( ConversationOldest ConversationOrder = "oldest" ConversationNewest ConversationOrder = "newest" )
The conversation's orders.
type InboxOrder ¶ added in v0.2.0
type InboxOrder struct {
// StatusSorted lists the inbox lists sorted by project status, in the order the inbox
// shows them. Every other list keeps its newest activity first.
StatusSorted []ListKey `json:"statusSorted"`
// StatusOrder is the user's order of project status names, first ranked highest. It
// is empty until the user changes it.
StatusOrder []string `json:"statusOrder"`
// Kinds holds each list that shows only one kind of item on its own tab, with that
// kind. A list it leaves out shows every one.
Kinds map[ListKey]ListKind `json:"kinds"`
}
InboxOrder is how the inbox orders and narrows its lists: which are sorted by project status, the order of the statuses, and which show only one kind of item. Every field is a plain value.
type ListKey ¶ added in v0.2.0
type ListKey string
ListKey names an inbox list, as the inbox snapshot names it: each list is a section of the inbox the user can collapse.
type ListKind ¶ added in v0.2.0
type ListKind string
ListKind is which kind of item an inbox list shows on its own tab: every one, or only its pull requests, or only its issues.
type MergeMethod ¶ added in v0.2.0
type MergeMethod string
MergeMethod is how the review sheet merges a pull request: as the repository offers first, or with one method wherever the repository allows it.
const ( // MergeMethodRepo merges with the method GitHub offers first in each repository. MergeMethodRepo MergeMethod = "repo" // MergeMethodSquash, MergeMethodMerge, and MergeMethodRebase merge with that method // (squash, a merge commit, or a rebase) where the repository allows it, and as the // repository offers first elsewhere. MergeMethodSquash MergeMethod = "squash" MergeMethodMerge MergeMethod = "merge_commit" MergeMethodRebase MergeMethod = "rebase_merge" )
Merge method choices.
type NotificationsTab ¶ added in v0.2.0
type NotificationsTab string
NotificationsTab is a tab of the Notifications page: the app's own notifications, or the user's GitHub notifications.
const ( NotificationsTabApp NotificationsTab = "app" NotificationsTabGitHub NotificationsTab = "github" )
The Notifications page's tabs.
type Option ¶
type Option func(*Service)
Option configures a Service.
func WithClock ¶ added in v0.2.0
WithClock stamps the stored preferences from c rather than from the system clock.
func WithEvents ¶ added in v0.2.0
WithEvents emits the theme, text size, and menu bar changes into sink once they are stored.
func WithGit ¶ added in v0.2.0
WithGit reads a clone location's origin with git, one read-only git config, for the preview and the check of the repository locations. Without it, they name no repository.
func WithLogger ¶ added in v0.2.0
WithLogger logs to logger what a setter cannot report as its error. Without it, or with nil, that is not logged.
func WithReader ¶ added in v0.2.0
func WithReader(reader *localrepos.Reader) Option
WithReader reads the other repository locations through reader, which bounds how long each read may take, so one that hangs reads as not answering rather than holding the check of the locations. Without it they are read directly.
type Portable ¶ added in v0.2.0
type Portable struct {
DefaultAgent *agent.ID `json:"defaultAgent,omitempty"`
DefaultProfiles map[agent.ID]string `json:"defaultProfiles,omitempty"`
Terminal *terminal.ID `json:"terminal,omitempty"`
WorktreeDefault *bool `json:"worktreeDefault,omitempty"`
FollowSessions *bool `json:"followSessions,omitempty"`
CodexEffort *bool `json:"codexEffort,omitempty"`
CodexFast *bool `json:"codexFast,omitempty"`
ClaudeAPIKey *bool `json:"claudeApiKey,omitempty"`
CodexAPIKey *bool `json:"codexApiKey,omitempty"`
WorktreeAutoCleanup *bool `json:"worktreeAutoCleanup,omitempty"`
Branches *branchrules.Rules `json:"branches,omitempty"`
TrustedBots *[]string `json:"trustedBots,omitempty"`
SnoozeDays *int `json:"snoozeDays,omitempty"`
SnoozeWake *snooze.Rules `json:"snoozeWake,omitempty"`
SensitiveScope *sensitive.Scope `json:"sensitiveScope,omitempty"`
SensitiveOff *[]string `json:"sensitiveOff,omitempty"`
SensitivePatterns *[]string `json:"sensitivePatterns,omitempty"`
MenuBar *bool `json:"menuBar,omitempty"`
BannersOff *[]notifyprefs.Kind `json:"bannersOff,omitempty"`
GitHubNotifications *PortableThreadRules `json:"githubNotifications,omitempty"`
Refresh map[RefreshKind]int `json:"refresh,omitempty"`
WatchPushes *bool `json:"watchPushes,omitempty"`
ServiceStatus *PortableStatus `json:"serviceStatus,omitempty"`
MergeMethod *MergeMethod `json:"mergeMethod,omitempty"`
BypassOwn *bool `json:"bypassOwn,omitempty"`
NudgeAfterHours *int `json:"nudgeAfterHours,omitempty"`
NudgeSnooze *bool `json:"nudgeSnooze,omitempty"`
Theme *Theme `json:"theme,omitempty"`
TextSize *TextSize `json:"textSize,omitempty"`
Celebrations *Celebrations `json:"celebrations,omitempty"`
ToastSeconds *int `json:"toastSeconds,omitempty"`
InboxOrder *InboxOrder `json:"inboxOrder,omitempty"`
HiddenLabels *[]string `json:"hiddenLabels,omitempty"`
CardAvatars *bool `json:"cardAvatars,omitempty"`
CardDensity *CardDensity `json:"cardDensity,omitempty"`
CardUnread *bool `json:"cardUnread,omitempty"`
IgnoredWorkflows *[]string `json:"ignoredWorkflows,omitempty"`
MergeBotsOn *bool `json:"mergeBotsOn,omitempty"`
MergeBots *[]string `json:"mergeBots,omitempty"`
Integrations *PortableIntegration `json:"integrations,omitempty"`
UpdateMode *updateprefs.Mode `json:"updateMode,omitempty"`
Autopilot *PortableAutopilot `json:"autopilot,omitempty"`
}
Portable is the user's settings in portable form, as a backup holds them: every setting but the repositories (see PortableRepos) and the window's memory (its size, the folded sections, the tips put away, the review sheet's tab, the Notifications page's tab, the conversations' order, the Scripts tab's last page and clone, and the Release and Deps pages' sorts). Each field is a pointer, or a map whose entries each stand alone, so a field a backup lacks is left as it is when the backup is imported.
func (*Portable) UnmarshalJSON ¶ added in v0.2.0
UnmarshalJSON reads a backup's settings, taking an older backup's interval of the GitHub status check as the service status check's, unless the backup holds that too.
type PortableAutopilot ¶ added in v0.4.0
type PortableAutopilot struct {
Enabled *bool `json:"enabled,omitempty"`
Paused *bool `json:"paused,omitempty"`
DefaultMode *autopilotprefs.Mode `json:"defaultMode,omitempty"`
AgentsAtOnce *int `json:"agentsAtOnce,omitempty"`
RunsPerDay *int `json:"runsPerDay,omitempty"`
ActionsPerDay *int `json:"actionsPerDay,omitempty"`
ActionsPerHour *int `json:"actionsPerHour,omitempty"`
DailyCap *autopilotprefs.DailyCap `json:"dailyCap,omitempty"`
KeepAwake *bool `json:"keepAwake,omitempty"`
HoldOnOutage *bool `json:"holdOnOutage,omitempty"`
CatchUpHours *int `json:"catchUpHours,omitempty"`
HistoryDays *int `json:"historyDays,omitempty"`
LogDays *int `json:"logDays,omitempty"`
}
PortableAutopilot is Autopilot's settings in portable form, each left as it is when a backup lacks it. The routines are a backup section of their own, and the engine's own state is no setting.
type PortableIntegration ¶ added in v0.2.0
type PortableIntegration struct {
Switches map[integrationprefs.ID]integrationprefs.Switch `json:"switches,omitempty"`
Paths map[integrationprefs.ID]string `json:"paths,omitempty"`
RunsIn *integrationprefs.RunsIn `json:"runsIn,omitempty"`
OfferAfterMerge *bool `json:"offerAfterMerge,omitempty"`
MagexTargets *bool `json:"magexTargets,omitempty"`
RepoFiles *bool `json:"repoFiles,omitempty"`
ShowRuns *bool `json:"showRuns,omitempty"`
}
PortableIntegration is the integrations' settings in portable form, each left as it is when a backup lacks it: each integration's switch, the copy of each tool chosen, where the runs go, whether a merge offers a release, Repo scripts' sources, and whether a run it starts shows beside it.
type PortablePlan ¶ added in v0.2.0
PortablePlan is what importing a backup's settings, or its repositories, does: the plan the window shows, and the writes it makes.
type PortableRepos ¶ added in v0.2.0
type PortableRepos struct {
CloneRoot *string `json:"cloneRoot,omitempty"`
Locations *[]localrepos.Location `json:"locations,omitempty"`
Pinned *[]string `json:"pinned,omitempty"`
Muted *[]string `json:"muted,omitempty"`
}
PortableRepos is the user's repositories in portable form, as a backup holds them: the clone folder, the other repository locations, and the pinned and muted repositories and orgs. Each field is a pointer, so one a backup lacks is left as it is.
type PortableStatus ¶ added in v0.2.0
type PortableStatus struct {
Off *[]statusprefs.ProviderID `json:"off,omitempty"`
Parts *[]statusprefs.PartID `json:"parts,omitempty"`
}
PortableStatus is what the service status check watches in portable form, each left as it is when a backup lacks it: the status pages turned off, and every part watched, across the providers, by the app's own names for them (statusprefs.PartID).
type PortableThreadRules ¶ added in v0.2.0
type PortableThreadRules struct {
Read *bool `json:"read,omitempty"`
Auto *bool `json:"auto,omitempty"`
Action *threadrules.Action `json:"action,omitempty"`
TriggersOff *[]threadrules.Trigger `json:"triggersOff,omitempty"`
Watching *bool `json:"watching,omitempty"`
BotActivity *bool `json:"botActivity,omitempty"`
}
PortableThreadRules are the rules for the user's GitHub notifications in portable form, each left as it is when a backup lacks it.
type ProfileLookup ¶ added in v0.2.0
type ProfileLookup interface {
Lookup(ctx context.Context, id agent.ID, name string) (profiles.Profile, error)
}
ProfileLookup finds an agent's stored profile by name, or returns profiles.ErrProfileNotFound. *profiles.Store implements it.
type RefreshChoices ¶ added in v0.2.0
type RefreshChoices struct {
Inbox []int `json:"inbox"`
Checks []int `json:"checks"`
ReleaseChecks []int `json:"releaseChecks"`
Worktrees []int `json:"worktrees"`
Notifications []int `json:"notifications"`
ServiceStatus []int `json:"serviceStatus"`
}
RefreshChoices are the intervals each can be set to, in seconds, shortest first.
type RefreshIntervals ¶ added in v0.2.0
type RefreshIntervals struct {
Inbox int `json:"inbox"`
Checks int `json:"checks"`
ReleaseChecks int `json:"releaseChecks"`
Worktrees int `json:"worktrees"`
Notifications int `json:"notifications"`
ServiceStatus int `json:"serviceStatus"`
}
RefreshIntervals are how often, in seconds, the app reads each thing again on its own. Both checks follows' 0 is off, and so is the service status check's.
func DefaultRefreshIntervals ¶ added in v0.2.0
func DefaultRefreshIntervals() RefreshIntervals
DefaultRefreshIntervals are the intervals of a fresh database.
func (RefreshIntervals) Every ¶ added in v0.2.0
func (r RefreshIntervals) Every(kind RefreshKind) time.Duration
Every returns how often the app reads kind again, as set in s; zero is off, and a kind this build doesn't know is off.
type RefreshKind ¶ added in v0.2.0
type RefreshKind string
RefreshKind names one of the things the app reads again on its own, on a timer.
const ( // RefreshInbox is the whole inbox, from GitHub. RefreshInbox RefreshKind = "inbox" // RefreshChecks is the pull requests whose checks are running, from GitHub, all in one // request. RefreshChecks RefreshKind = "checks" // RefreshReleaseChecks is the Release page's repositories whose newest commit's checks // are running, read again from GitHub together. RefreshReleaseChecks RefreshKind = "releaseChecks" // RefreshWorktrees is the worktrees' sweep: each clone's worktrees, the pull requests // and issues they belong to, and the automatic cleanup. RefreshWorktrees RefreshKind = "worktrees" // RefreshNotifications is the user's GitHub notifications, listed from GitHub: one // conditional request, free when nothing changed, and never sooner than GitHub's own // poll interval asks. RefreshNotifications RefreshKind = "notifications" // RefreshServiceStatus is the status pages of the services the app depends on // (GitHub's, Claude's, and OpenAI's), which say whether a part the user watches has an // incident: one small request to each page watched, outside any API, so it costs no // point of the budget. RefreshServiceStatus RefreshKind = "serviceStatus" )
What the app reads again on its own.
func RefreshKinds ¶ added in v0.2.0
func RefreshKinds() []RefreshKind
RefreshKinds returns every kind the app reads again on its own, in the order Settings lists them.
type ReviewTab ¶ added in v0.2.0
type ReviewTab string
ReviewTab is a tab of the review sheet's larger column: the files a pull request changes, beneath its description, its conversation, or its commits.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service reads and writes the preferences.
Each setter stores its change and reads the preferences back in one transaction, then returns the settings with the change, so a setter that fails has stored nothing. Only the check that the default profiles are still stored runs after the change is committed, and a failure there is logged rather than reported, since the change has happened.
func NewService ¶
NewService returns a Service over the preferences in pool. known looks up the stored profiles the default profile must name, and home expands a ~ clone root.
func (*Service) AddCloneLocations ¶ added in v0.2.0
AddCloneLocations adds each of dirs to the other repository locations, all or none, and returns the settings with them; one call serves a single add, the suggestions the preview offers, and a launch's clone found elsewhere. Each is trimmed, expanded, and stored with ~, as a folder (looked into one level deep) or a single clone, by what it is now (localrepos.Classify); a hidden folder, one inside the app's worktrees folder or a git folder, a linked worktree, the clone root, a clone the locations already hold, and a folder that doesn't answer within the Reader's limit (WithReader) are refused, in words the window shows. A location already listed is classified again, which is what Check again does. A folder added drops the clone locations directly inside it, which it now covers.
func (*Service) BypassOwn ¶ added in v0.7.0
BypassOwn returns whether the review sheet's button merges the user's own pull request past the rules when it waits only on an approval: the stored setting, or DefaultBypassOwn when none is stored or it cannot be read.
func (*Service) CheckCloneLocations ¶ added in v0.2.0
func (s *Service) CheckCloneLocations(ctx context.Context) ([]localrepos.LocationState, error)
CheckCloneLocations reads how the clone root and each of the other repository locations read now, the clone root first: whether each is there, a folder's clones, and a clone's origin (see localrepos.Check).
func (*Service) CollapsedSections ¶
CollapsedSections returns the inbox sections the user collapsed, in the order the inbox shows them. None is collapsed on a fresh database, and a stored value that is not a boolean counts as open.
func (*Service) CreateCloneRoot ¶ added in v0.3.0
CreateCloneRoot makes the folder root, with any parents it lacks, and stores it as the clone root, returning the settings with it, for a user starting fresh, whose clones will go there. Like SetCloneRoot, it takes an absolute or ~-relative path and stores it as entered, trimmed and cleaned; a folder already there is fine. A folder that can't be a repository location (the whole disk, a hidden one, one inside a git folder or the app's worktrees folder, a linked worktree), and one that can't be made, as where a file stands, are refused in words the window shows.
func (*Service) FollowSessions ¶ added in v0.2.0
FollowSessions returns whether the app follows the agent sessions it launches: the stored setting, or DefaultFollowSessions when none is stored or it cannot be read.
func (*Service) Get ¶
Get returns every preference, with the default for any that is unset or holds a value that is no longer valid.
func (*Service) InboxOrder ¶ added in v0.2.0
func (s *Service) InboxOrder(ctx context.Context) (InboxOrder, error)
InboxOrder returns how the inbox orders its lists. On a fresh database every list is newest activity first, and the status order is empty.
func (*Service) MatchSensitivePath ¶
MatchSensitivePath reports whether a path would count as sensitive under the stored settings, and which category and pattern it matches, for trying patterns out.
func (*Service) MenuBar ¶
MenuBar returns whether the app shows its menu bar icon: the stored setting, or DefaultMenuBar when none is stored or the stored value cannot be read.
func (*Service) MergeMethod ¶ added in v0.2.0
func (s *Service) MergeMethod(ctx context.Context) (MergeMethod, error)
MergeMethod returns the stored merge method, or DefaultMergeMethod when none is stored or the stored value is no longer a choice.
func (*Service) PreviewCloneLocation ¶ added in v0.2.0
PreviewCloneLocation says what adding dir as a repository location would add, and what the app suggests instead where it finds a better choice, before anything is stored (see localrepos.Survey). It reads the folder and its subfolders with stat alone, and a clone's origin with one read-only git command when the Service has git (WithGit).
func (*Service) RemoveCloneLocation ¶ added in v0.2.0
RemoveCloneLocation drops dir from the other repository locations, by its stored text or as the same folder, and returns the settings without it. A location that isn't listed is no error. Its clones and their worktrees are left as they are, but no listing or cleanup reaches them until the location is added again.
func (*Service) ResetTrustedBots ¶
ResetTrustedBots goes back to the default trusted bots, and returns the settings with them.
func (*Service) SetAutopilotActionsPerDay ¶ added in v0.4.0
SetAutopilotActionsPerDay stores how many GitHub actions Autopilot sends a day, across every routine, autopilotprefs.MinActionsPerDay to MaxActionsPerDay, and returns the settings with it.
func (*Service) SetAutopilotActionsPerHour ¶
SetAutopilotActionsPerHour stores how many GitHub actions Autopilot sends an hour, across every routine, autopilotprefs.MinActionsPerHour to MaxActionsPerHour, and returns the settings with it.
func (*Service) SetAutopilotAgentsAtOnce ¶ added in v0.4.0
SetAutopilotAgentsAtOnce stores how many agents Autopilot runs at once, autopilotprefs.MinAgentsAtOnce to MaxAgentsAtOnce, and returns the settings with it.
func (*Service) SetAutopilotCatchUpHours ¶ added in v0.4.0
SetAutopilotCatchUpHours stores how long a gap makes Autopilot ask before it catches up, autopilotprefs.MinCatchUpHours to MaxCatchUpHours, and returns the settings with it.
func (*Service) SetAutopilotDailyCap ¶ added in v0.4.0
func (s *Service) SetAutopilotDailyCap(ctx context.Context, dailyCap autopilotprefs.DailyCap) (Settings, error)
SetAutopilotDailyCap stores the most Autopilot's agents may spend a day, and returns the settings with it: an amount of 0 for no cap, or whole dollars (autopilotprefs.MinCapUSD to MaxCapUSD) or tokens (MinCapTokens to MaxCapTokens), as its unit says.
func (*Service) SetAutopilotDefaultMode ¶ added in v0.4.0
func (s *Service) SetAutopilotDefaultMode(ctx context.Context, mode autopilotprefs.Mode) (Settings, error)
SetAutopilotDefaultMode stores the mode new routines start in (Dry run, Ask first, or Autopilot), and returns the settings with it. A routine already made keeps its own.
func (*Service) SetAutopilotEnabled ¶ added in v0.4.0
SetAutopilotEnabled turns Autopilot (beta) on or off, and returns the settings with it. Off, the window shows none of Autopilot and its engine doesn't run; the routines and their history stay as they are, and come back as they were once it is on again.
func (*Service) SetAutopilotHistoryDays ¶ added in v0.4.0
SetAutopilotHistoryDays stores how many days of Autopilot's history are kept, autopilotprefs.MinHistoryDays to MaxHistoryDays, and returns the settings with it. Run logs kept longer than the new history are kept as long as it instead.
func (*Service) SetAutopilotHoldOnOutage ¶ added in v0.4.0
SetAutopilotHoldOnOutage stores whether agent starts wait while the agent's provider reports an outage, and returns the settings with it.
func (*Service) SetAutopilotKeepAwake ¶ added in v0.4.0
SetAutopilotKeepAwake stores whether the Mac is kept awake while agents work, and returns the settings with it.
func (*Service) SetAutopilotLogDays ¶ added in v0.4.0
SetAutopilotLogDays stores how many days the agent runs' logs are kept, autopilotprefs.MinLogDays to MaxLogDays and never more than the history, and returns the settings with it.
func (*Service) SetAutopilotMergePastRules ¶
SetAutopilotMergePastRules turns Let routines merge your own pull requests past the rules on or off, and returns the settings with it. On, a routine whose Merge it allows it, and that the user accepted so, may merge their own signed pull request that lacks only an approval from someone else; off, none does, whatever its step allows. A backup never carries it.
func (*Service) SetAutopilotPaused ¶ added in v0.4.0
SetAutopilotPaused turns Pause Autopilot on or off, and returns the settings with it. Paused, no routine starts anything new; agents already running carry on.
func (*Service) SetAutopilotRunsPerDay ¶ added in v0.4.0
SetAutopilotRunsPerDay stores how many agent runs Autopilot starts a day, across every routine, autopilotprefs.MinRunsPerDay to MaxRunsPerDay, and returns the settings with it.
func (*Service) SetBranchRules ¶ added in v0.2.0
SetBranchRules stores the rules for deleting local branches, and returns the settings with them. Every rule is stored together, so the rules never mix two saves; a protected pattern that cannot match a branch is refused, and nothing is stored.
func (*Service) SetBypassOwn ¶ added in v0.7.0
SetBypassOwn stores whether the review sheet's button merges the user's own pull request past the rules when an approval from someone else is all it lacks, and returns the settings with it.
func (*Service) SetCardAvatars ¶ added in v0.4.0
SetCardAvatars stores whether the inbox's cards show the authors' pictures, and returns the settings with it.
func (*Service) SetCardDensity ¶ added in v0.4.0
SetCardDensity stores how much room the inbox's cards take, CardComfortable or CardCompact, and returns the settings with it. A density that is not one of the choices is refused, and nothing is stored.
func (*Service) SetCardUnread ¶ added in v0.4.0
SetCardUnread stores whether the inbox's cards show the unread dots, and returns the settings with it.
func (*Service) SetCelebrations ¶ added in v0.7.0
SetCelebrations stores how the window celebrates, CelebrationsMilestones, CelebrationsQuiet, or CelebrationsOff, and returns the settings with it. A choice that is not one of them is refused, and nothing is stored.
func (*Service) SetClaudeAPIKey ¶ added in v0.4.0
SetClaudeAPIKey stores whether an API key in the environment may sign Claude Code in, and returns the settings with it. Off, launches remove the key, so Claude Code runs on the profile's own sign-in.
func (*Service) SetCloneRoot ¶
SetCloneRoot stores the clone root, and returns the settings with it. It must be an absolute or ~-relative path to an existing directory; it is stored as entered (trimmed and cleaned), so "~/projects" stays portable across machines.
func (*Service) SetCodexAPIKey ¶ added in v0.4.0
SetCodexAPIKey stores whether an API key in the environment may sign Codex in, and returns the settings with it. Off, launches remove the key, so Codex runs on the profile's own sign-in.
func (*Service) SetCodexEffort ¶ added in v0.2.0
SetCodexEffort stores whether a Codex launch passes the effort level it resolves to, and returns the settings with it. Off, Codex uses the effort in its own config.
func (*Service) SetCodexFast ¶ added in v0.2.0
SetCodexFast stores whether Codex launches start in Fast mode unless unticked, and returns the settings with it.
func (*Service) SetConversationOrder ¶ added in v0.2.0
func (s *Service) SetConversationOrder(ctx context.Context, order ConversationOrder) (Settings, error)
SetConversationOrder stores the order the sheets list a conversation in, ConversationOldest or ConversationNewest, and returns the settings with it.
func (*Service) SetDefaultAgent ¶ added in v0.2.0
SetDefaultAgent stores the coding agent launches use when no launch default names one, and returns the settings with it.
func (*Service) SetDefaultProfile ¶
func (s *Service) SetDefaultProfile(ctx context.Context, id agent.ID, name string) (Settings, error)
SetDefaultProfile stores the agent's profile launches use when no launch default names one, and returns the settings with it. It must name one of the agent's stored profiles.
func (*Service) SetDepsSort ¶
func (s *Service) SetDepsSort(ctx context.Context, sort integrationprefs.DepsSort) (Settings, error)
SetDepsSort stores the order the Deps page lists each group of clones in, and returns the settings with it. An order that isn't one of the page's is refused.
func (*Service) SetFollowSessions ¶ added in v0.2.0
SetFollowSessions stores whether the app follows the agent sessions it launches, and returns the settings with it. While it is off, no agent is asked about its sessions, and the window shows none; launches are still recorded. Once it is stored, an event.SessionsUpdated is emitted, so the window and the menu bar show the sessions, or stop showing them, at once.
func (*Service) SetGitHubNotificationAction ¶ added in v0.2.0
func (s *Service) SetGitHubNotificationAction(ctx context.Context, action threadrules.Action) (Settings, error)
SetGitHubNotificationAction stores what clearing a GitHub notification does, mark it done or mark it read, and returns the settings with it. An action this build does not know is refused.
func (*Service) SetGitHubNotificationSwitch ¶ added in v0.2.0
func (s *Service) SetGitHubNotificationSwitch(ctx context.Context, name threadrules.Switch, on bool) (Settings, error)
SetGitHubNotificationSwitch turns one of the GitHub notification rules' switches on or off (see threadrules.Switches), and returns the settings with it.
func (*Service) SetGitHubNotificationTrigger ¶ added in v0.2.0
func (s *Service) SetGitHubNotificationTrigger(ctx context.Context, trigger threadrules.Trigger, on bool, ) (Settings, error)
SetGitHubNotificationTrigger turns one of the moments that clear a GitHub notification on or off (see threadrules.Triggers), and returns the settings with it. Clearing by hand has no switch and is refused, as is a trigger this build does not know. The triggers that are off are read and written in one transaction, so two changes never lose either.
func (*Service) SetHiddenLabels ¶ added in v0.4.0
SetHiddenLabels stores the patterns of the labels the inbox's cards leave out, in order, and returns the settings with them. Each is trimmed, and blank ones and repeats (ignoring case) are left out; an empty list hides no label.
func (*Service) SetIgnoredWorkflows ¶ added in v0.4.0
SetIgnoredWorkflows stores the names of the workflows whose held runs never count, in order, and returns the settings with them. Each is trimmed, and blank ones and exact repeats are left out; an empty list ignores none. A list that holds too many names, one too long, or one with a control character is refused, and nothing is stored.
func (*Service) SetIntegrationEnabled ¶ added in v0.2.0
func (s *Service) SetIntegrationEnabled(ctx context.Context, id integrationprefs.ID, state integrationprefs.Switch, ) (Settings, error)
SetIntegrationEnabled stores how the user set an integration's switch, automatic, on, or off, and returns the settings with it. Once it is stored, an event.IntegrationsChanged is emitted, so the window hears that the tools' list changed.
func (*Service) SetIntegrationPath ¶ added in v0.2.0
func (s *Service) SetIntegrationPath(ctx context.Context, id integrationprefs.ID, path string) (Settings, error)
SetIntegrationPath stores the copy of a tool the user chose, and returns the settings with it: an absolute or ~-relative path to an executable file, stored cleaned and absolute, or "" to use the copy the user's shell finds. Once it is stored, an event.IntegrationsChanged is emitted, so the integrations detect the tools again.
func (*Service) SetIntegrationsAnnounced ¶ added in v0.2.0
SetIntegrationsAnnounced stores whether the window announced the Scripts tab, as it first appeared because a tool was found, and returns the settings with it, so the toast shows once rather than at every start. Nothing else hears of it.
func (*Service) SetListKind ¶ added in v0.2.0
func (s *Service) SetListKind(ctx context.Context, section ListKey, kind ListKind) (Settings, error)
SetListKind stores which kind of item an inbox list shows on its own tab, every one or only its pull requests or its issues, and returns the settings with it.
func (*Service) SetMenuBar ¶
SetMenuBar stores whether the app shows its menu bar icon, and returns the settings with it. Once it is stored, an event.MenuBarChanged is emitted, so the desktop shell adds or removes the icon.
func (*Service) SetMergeBots ¶
SetMergeBots stores the user's auto-merge bots, and returns the settings with them. Each login may be written as GitHub shows it ("acme-org-automerge", "acme-org-automerge[bot]", or "app/acme-org-automerge"); the list is stored normalized and sorted, and may be empty. A login that is not a bot's, or a list of more than 100, is refused, and nothing is stored.
func (*Service) SetMergeBotsOn ¶
SetMergeBotsOn stores whether a pull request's card says when a listed auto-merge bot approved it, and returns the settings with it.
func (*Service) SetMergeMethod ¶ added in v0.2.0
SetMergeMethod stores how the review sheet merges: MergeMethodRepo, MergeMethodSquash, MergeMethodMerge, or MergeMethodRebase, and returns the settings with it.
func (*Service) SetNotificationBanner ¶
func (s *Service) SetNotificationBanner(ctx context.Context, kind notifyprefs.Kind, on bool) (Settings, error)
SetNotificationBanner turns the banners of one kind of notification on or off (see the notify package for the kinds), and returns the settings with it. The notification history keeps every kind either way.
A kind that starts on is stored in notifyprefs.KeyBannersOff once turned off, and one that starts off, such as the agent sessions' kinds, in notifyprefs.KeyBannersOn once turned on; both keys are written together.
func (*Service) SetNotificationsTab ¶ added in v0.2.0
SetNotificationsTab stores the Notifications page's tab the user chose, NotificationsTabApp or NotificationsTabGitHub, which the page opens on from then on, and returns the settings with it.
func (*Service) SetNudgeAfterHours ¶ added in v0.7.0
SetNudgeAfterHours stores how many hours a pull request waiting on its author has to be quiet before its card offers a nudge, 0 for never to MaxNudgeAfterHours, and returns the settings with it.
func (*Service) SetNudgeSnooze ¶ added in v0.7.0
SetNudgeSnooze stores whether the nudge dialog starts with "Then snooze" ticked, so a nudge snoozes its pull request until the author answers, and returns the settings with it.
func (*Service) SetOfferAfterMerge ¶ added in v0.2.0
SetOfferAfterMerge stores whether merging a pull request in the review sheet offers to release its repository, and returns the settings with it. Nothing else hears of it: the review sheet asks Release whether to offer as each merge lands.
func (*Service) SetProjectsTipDismissed ¶ added in v0.2.0
SetProjectsTipDismissed stores whether the inbox's tip about showing issue projects is put away, and returns the settings with it.
func (*Service) SetRefreshInterval ¶ added in v0.2.0
func (s *Service) SetRefreshInterval(ctx context.Context, kind RefreshKind, seconds int) (Settings, error)
SetRefreshInterval stores how often, in seconds, the app reads kind again on its own, one of its choices (RefreshChoices), and returns the settings with it. Once it is stored, an event.IntervalsChanged is emitted, so whatever reads kind again works its next wait out from the new interval at once.
func (*Service) SetReleaseSort ¶ added in v0.7.0
func (s *Service) SetReleaseSort(ctx context.Context, sort integrationprefs.ReleaseSort) (Settings, error)
SetReleaseSort stores the order the Release page lists each group in, and returns the settings with it. An order that isn't one of the page's is refused.
func (*Service) SetRepoRule ¶ added in v0.2.0
func (s *Service) SetRepoRule(ctx context.Context, target string, rule reporules.Rule) (Settings, error)
SetRepoRule pins or mutes a repository ("owner/name") or an org ("owner"), or takes its rule off with reporules.RuleNone, and returns the settings with it. A target is in one list at most, so pinning a muted one unmutes it. The rules are read and written in one transaction, so two changes never lose either. Once they are stored, an event.RepoRulesChanged is emitted, so the inbox, the menu bar, and the Release page show the change at once.
func (*Service) SetReviewTab ¶ added in v0.2.0
SetReviewTab stores the review sheet's tab the user chose, ReviewTabFiles, ReviewTabComments, or ReviewTabCommits, which the sheet opens on from then on, and returns the settings with it.
func (*Service) SetRunsIn ¶ added in v0.2.0
SetRunsIn stores where the runs go, in the app or in the terminal chosen for launches, and returns the settings with it. Nothing else hears of it: what starts a run (a release, a hooks action, checks, or a script) reads the setting as it starts one.
func (*Service) SetScriptSources ¶ added in v0.2.0
func (s *Service) SetScriptSources(ctx context.Context, magexTargets, repoFiles bool) (Settings, error)
SetScriptSources stores which sources Repo scripts lists besides the user's own scripts, magex's targets and the commands in a repository's own files (t3.json and .vscode/tasks.json), and returns the settings with them. Nothing else hears of it: Repo scripts reads the setting as it lists a repository's scripts.
func (*Service) SetScriptsLastPage ¶ added in v0.2.0
func (s *Service) SetScriptsLastPage(ctx context.Context, page integrationprefs.ScriptsPage) (Settings, error)
SetScriptsLastPage stores the Scripts tab's page shown last, which the tab reopens on, and returns the settings with it. A page that isn't one of the tab's is refused.
func (*Service) SetScriptsLastRepo ¶ added in v0.2.0
SetScriptsLastRepo stores the clone Repo scripts showed last, as the window names it (its folder, with ~), which Repo scripts reopens on, and returns the settings with it; "" forgets it. A folder that isn't an absolute or ~ path on one line is refused. Repo scripts checks the folder again as it lists it, as it does any the window names.
func (*Service) SetScriptsSectionOpen ¶ added in v0.2.0
func (s *Service) SetScriptsSectionOpen(ctx context.Context, section integrationprefs.ScriptsSection, open bool, ) (Settings, error)
SetScriptsSectionOpen stores whether one of the Scripts tab's sections is open, as the user opened or folded it, which the page shows it as from then on, across starts, and returns the settings with it. The others stay as they were. A section that isn't one of the tab's is refused.
func (*Service) SetSectionCollapsed ¶
func (s *Service) SetSectionCollapsed(ctx context.Context, section ListKey, collapsed bool) (Settings, error)
SetSectionCollapsed stores whether an inbox section is collapsed, so the inbox opens the same way at the next launch, and returns the settings with it.
func (*Service) SetSensitiveCategory ¶
SetSensitiveCategory turns a built-in category of sensitive files on or off, and returns the settings with it. The agent configuration category cannot be turned off, since launches are held back by it.
func (*Service) SetSensitivePatterns ¶
SetSensitivePatterns stores the user's own patterns of sensitive files, in order, and returns the settings with them. Each is trimmed, empty ones and repeats are dropped, and a pattern that cannot be used is refused with the reason (see the sensitive package for the syntax).
func (*Service) SetSensitiveScope ¶
SetSensitiveScope stores whose pull requests have their changed files checked, sensitive.ScopeOutside or sensitive.ScopeCollaborators to check collaborators' too, and returns the settings with it.
func (*Service) SetShowRuns ¶ added in v0.2.0
SetShowRuns stores whether a run Repo scripts starts shows beside its scripts at once, and returns the settings with it. Nothing else hears of it: the page reads the setting as a run starts.
func (*Service) SetSnoozeDays ¶
SetSnoozeDays stores how many days the Snooze button hides an item, snooze.MinDays to snooze.MaxDays, and returns the settings with it.
func (*Service) SetSnoozeWake ¶
SetSnoozeWake stores which new activity ends a snooze early, and returns the settings with it. Every rule is stored together, so the rules never mix two saves.
func (*Service) SetStatusOrder ¶ added in v0.2.0
SetStatusOrder stores the user's order of project status names, first ranked highest, and returns the settings with it. Names are trimmed, and empty and repeated ones (ignoring case) are left out. An empty order puts every status back where the window would place it.
func (*Service) SetStatusPart ¶ added in v0.2.0
func (s *Service) SetStatusPart(ctx context.Context, id statusprefs.PartID, on bool) (Settings, error)
SetStatusPart ticks or unticks a part of a provider to watch (see statusprefs.Catalog), and returns the settings with it. A part this build doesn't know is refused. The list it is stored in is read and written in one update, so two quick changes never lose either.
func (*Service) SetStatusProvider ¶ added in v0.2.0
func (s *Service) SetStatusProvider(ctx context.Context, id statusprefs.ProviderID, on bool) (Settings, error)
SetStatusProvider turns a provider's status page on or off (see statusprefs.Catalog), and returns the settings with it. A provider this build doesn't know is refused. The providers off are read and written in one update, so two quick changes never lose either.
func (*Service) SetStatusSort ¶ added in v0.2.0
SetStatusSort stores whether an inbox list is sorted by project status, rather than by newest activity, and returns the settings with it.
func (*Service) SetTerminal ¶
SetTerminal stores the terminal launches open in, TerminalITerm2 or TerminalApp, and returns the settings with it.
func (*Service) SetTextSize ¶ added in v0.2.0
SetTextSize stores the size of the app's text: TextSizeDefault, TextSizeLarge, or TextSizeLarger, and returns the settings with it. The page shows the new size itself; once it is stored, an event.TextSizeChanged is emitted, so the desktop shell sets the window's smallest size to suit it.
func (*Service) SetTheme ¶
SetTheme stores the theme the app shows: ThemeSystem, ThemeLight, or ThemeDark, and returns the settings with it. Once it is stored, an event.ThemeChanged is emitted, so the desktop shell brings the window's native appearance along with it.
func (*Service) SetToastSeconds ¶ added in v0.2.0
SetToastSeconds stores how long, in seconds, a toast stays before it closes itself, MinToastSeconds to MaxToastSeconds, and returns the settings with it. The window reads it from the settings, so the next toast stays that long.
func (*Service) SetTrustedBots ¶
SetTrustedBots stores the bots whose items are trusted, and returns the settings with them. Each login may be written as GitHub shows it ("dependabot", "dependabot[bot]", or "app/dependabot"); the list is stored normalized and sorted, and may be empty to trust no bot.
func (*Service) SetUpdateMode ¶ added in v0.3.1
SetUpdateMode stores what the app does when a new version is out (see the updateprefs package): download it and tell the user, just tell them, or make no timed checks. It returns the settings with it. Once it is stored, an event.UpdatesChanged is emitted, so the update check follows the new choice at once.
func (*Service) SetWatchPushes ¶ added in v0.5.0
SetWatchPushes stores whether the app watches the branches of the inbox's pull requests in the user's clones, and returns the settings with it. While it is off, no clone is looked at, and a push reaches its card at the next refresh. Once it is stored, an event.IntervalsChanged is emitted, so the watch starts or stops at once.
func (*Service) SetWindowSize ¶
SetWindowSize stores the size the window opens at, which takes effect at the next launch: MinWindowWidth by MinWindowHeight up to MaxWindowWidth by MaxWindowHeight. It returns the settings with it.
func (*Service) SetWorktreeAutoCleanup ¶
SetWorktreeAutoCleanup stores whether finished worktrees are cleaned up on their own, and returns the settings with it.
func (*Service) SetWorktreeDefault ¶
SetWorktreeDefault stores whether launches start in a worktree unless unticked, and returns the settings with it.
func (*Service) SuggestCloneRoots ¶ added in v0.3.0
func (s *Service) SuggestCloneRoots(ctx context.Context) ([]localrepos.Suggestion, error)
SuggestCloneRoots suggests folders under home that could be the clone root or another repository location, for the setup. It returns the folders in home that have clones, whatever they are named, one level down too, the most clones first, leaving out those the locations already hold, with ~ for home. It never reads macOS's guarded folders or another disk (see localrepos.Candidates). It reads with stat and ReadDir alone, and runs no git.
func (*Service) TextSize ¶ added in v0.2.0
TextSize returns the stored text size, or DefaultTextSize when none is stored or the stored value is no longer a choice. The desktop shell reads it to open the window at it.
func (*Service) Theme ¶
Theme returns the stored theme, or DefaultTheme when none is stored or the stored value is no longer a choice.
func (*Service) WatchPushes ¶ added in v0.5.0
WatchPushes returns whether the app watches the branches of the inbox's pull requests in the user's clones: the stored setting, or DefaultWatchPushes when none is stored or it cannot be read.
type Settings ¶
type Settings struct {
// DefaultAgent is the coding agent launches use when no launch default names one.
DefaultAgent agent.ID `json:"defaultAgent"`
// DefaultProfiles is each agent's profile launches use when no launch default names
// one. It has an entry for every agent.
DefaultProfiles map[agent.ID]string `json:"defaultProfiles"`
// WorktreeDefault presets each row's "Start in a worktree" checkbox.
WorktreeDefault bool `json:"worktreeDefault"`
// WorktreeAutoCleanup cleans up a finished worktree on its own once its pull request
// merges or its issue closes.
WorktreeAutoCleanup bool `json:"worktreeAutoCleanup"`
// Terminal is TerminalITerm2 or TerminalApp.
Terminal terminal.ID `json:"terminal"`
// FollowSessions follows each agent session a launch starts from its item: what it
// is doing, and what it last said. Sessions are recorded either way.
FollowSessions bool `json:"followSessions"`
// CodexEffort passes Codex the effort level a launch resolves to, and CodexFast
// presets each Codex launch's Fast mode. Codex takes both only as config overrides,
// and runs a session started with either outside its shared app server, where the app
// can't see that it waits for the user, so both start off.
CodexEffort bool `json:"codexEffort"`
CodexFast bool `json:"codexFast"`
// ClaudeAPIKey and CodexAPIKey let an API key from the shell's environment sign the
// agent in (Claude Code's ANTHROPIC_API_KEY, Codex's OPENAI_API_KEY), billed to that
// key. Off, the default, every launch removes those variables, so the agent runs on the
// profile's own sign-in, as on a subscription.
ClaudeAPIKey bool `json:"claudeApiKey"`
CodexAPIKey bool `json:"codexApiKey"`
// CloneRoot is the clone root as entered, e.g. "~/projects": the folder new clones go
// in, and the first place clones are looked for.
CloneRoot string `json:"cloneRoot"`
// CloneLocations are the other repository locations, in the order they were added:
// each a folder looked into one level deep, as the clone root is, or a single clone,
// with ~ for home. Never nil.
CloneLocations []localrepos.Location `json:"cloneLocations"`
// TrustedBots lists the bots (GitHub Apps) whose pull requests and issues are trusted
// like a collaborator's, by login, sorted. It starts as trust.DefaultBots.
TrustedBots []string `json:"trustedBots"`
// DefaultTrustedBots is the list ResetTrustedBots restores.
DefaultTrustedBots []string `json:"defaultTrustedBots"`
// SnoozeDays is how many days an inbox row's Snooze button hides an item; its menu
// offers other lengths for one snooze.
SnoozeDays int `json:"snoozeDays"`
// SnoozeWake is which new activity ends a snooze early.
SnoozeWake snooze.Rules `json:"snoozeWake"`
// WindowSize is the size the window opens at.
WindowSize WindowSize `json:"windowSize"`
// DefaultWindowSize is the size a fresh database opens the window at.
DefaultWindowSize WindowSize `json:"defaultWindowSize"`
// SensitiveFiles is whose pull requests have their changed files checked, which
// built-in categories are off, and the user's own patterns (see the sensitive
// package).
SensitiveFiles sensitive.Config `json:"sensitiveFiles"`
// Branches are the rules for deleting local branches: which go with a worktree that
// is removed or cleaned up, whether a merged pull request's branch starts checked in
// the cleanup of merged branches, and which are never deleted. Each deletion is
// confirmed with checkboxes that start from them.
Branches branchrules.Rules `json:"branches"`
// DefaultProtectedBranches is the protected list before the user changes it.
DefaultProtectedBranches []string `json:"defaultProtectedBranches"`
// RepoRules are the pinned and the muted repositories and orgs: a pinned one's items
// count as pinned in the inbox, and a muted one's are set apart in each list's Muted
// tab and on the Release page (see the reporules package).
RepoRules reporules.Rules `json:"repoRules"`
// SensitiveCategories are the built-in categories in matching order, with their
// patterns, for the settings page to describe.
SensitiveCategories []sensitive.Category `json:"sensitiveCategories"`
// MenuBar shows the app's icon in the menu bar, with how many items need the user and
// a short list of them; closing the window then keeps the app running there.
MenuBar bool `json:"menuBar"`
// BannersOff lists the kinds of notification (see the notify package) whose banners
// are off, the agent sessions' kinds among them until turned on. The notification
// history keeps every inbox kind either way.
BannersOff []notifyprefs.Kind `json:"bannersOff"`
// Theme is the palette the app shows.
Theme Theme `json:"theme"`
// TextSize is the size of the app's text, apart from the size of its window.
TextSize TextSize `json:"textSize"`
// Celebrations is how the window celebrates the inbox at nil, the setup's end, and a
// release (see KeyCelebrations).
Celebrations Celebrations `json:"celebrations"`
// ToastSeconds is how long, in seconds, a message at the bottom of the window stays
// before it closes itself, MinToastSeconds to MaxToastSeconds.
ToastSeconds int `json:"toastSeconds"`
// CollapsedSections lists the inbox sections the user collapsed, in the order the
// inbox shows them.
CollapsedSections []ListKey `json:"collapsedSections"`
// ProjectsTipDismissed is set once the user puts away the inbox's tip about showing
// the GitHub projects an issue is in.
ProjectsTipDismissed bool `json:"projectsTipDismissed"`
// ReviewTab is the review sheet's tab the user last chose, which it opens on.
ReviewTab ReviewTab `json:"reviewTab"`
// NotificationsTab is the Notifications page's tab the user last chose, which it opens
// on unless a quick view's View all asks for the other.
NotificationsTab NotificationsTab `json:"notificationsTab"`
// ConversationOrder is the order the sheets list a conversation in, the one the user
// last chose.
ConversationOrder ConversationOrder `json:"conversationOrder"`
// InboxOrder is which inbox lists are sorted by project status, and the order of the
// statuses.
InboxOrder InboxOrder `json:"inboxOrder"`
// HiddenLabels are the patterns of the labels the inbox's cards leave out (see
// KeyHiddenLabels), never nil, and DefaultHiddenLabels what Restore the defaults goes
// back to.
HiddenLabels []string `json:"hiddenLabels"`
DefaultHiddenLabels []string `json:"defaultHiddenLabels"`
// CardAvatars shows each author's picture on the inbox's cards (see KeyCardAvatars).
CardAvatars bool `json:"cardAvatars"`
// CardDensity is how much room each of the inbox's cards takes (see KeyCardDensity).
CardDensity CardDensity `json:"cardDensity"`
// CardUnread shows a dot on the inbox's cards with activity the user hasn't seen, and
// Mark as read and Mark as unread (see KeyCardUnread).
CardUnread bool `json:"cardUnread"`
// IgnoredWorkflows are the names of the workflows whose held runs never count toward
// where a pull request stands (see KeyIgnoredWorkflows), in the order they were added,
// never nil.
IgnoredWorkflows []string `json:"ignoredWorkflows"`
// MergeBotsOn is whether a pull request's card says when an auto-merge bot on MergeBots
// approved it, so it merges by itself once its checks pass, and MergeBots lists those bots
// by login, normalized and sorted, never nil (see KeyMergeBotsOn). The switch starts off and
// the list empty.
MergeBotsOn bool `json:"mergeBotsOn"`
MergeBots []string `json:"mergeBots"`
// MergeMethod is how the review sheet merges a pull request, and BypassOwn whether its
// button merges the user's own pull request past the rules when an approval from
// someone else is all it lacks (see KeyBypassOwn).
MergeMethod MergeMethod `json:"mergeMethod"`
BypassOwn bool `json:"bypassOwn"`
// NudgeAfterHours is how many hours a pull request the user requested changes on has
// to be quiet before its card offers to nudge its author, 0 for never (see
// KeyNudgeAfterHours), and NudgeSnooze whether the nudge dialog starts with "Then
// snooze" ticked.
NudgeAfterHours int `json:"nudgeAfterHours"`
NudgeSnooze bool `json:"nudgeSnooze"`
// Integrations is each integration's switch, and the copy of each tool the user chose.
Integrations integrationprefs.Config `json:"integrations"`
// GitHubNotifications are the rules for the user's GitHub notifications: whether the app
// reads them, and whether, how, and when it clears one once the work behind it is
// finished (see the threadrules package).
GitHubNotifications threadrules.Rules `json:"githubNotifications"`
// Refresh is how often, in seconds, the app reads the inbox, the running checks, the
// Release page's running checks, the worktrees, the GitHub notifications, and the
// status pages again on its own, and RefreshChoices what each can be set to.
Refresh RefreshIntervals `json:"refresh"`
RefreshChoices RefreshChoices `json:"refreshChoices"`
// WatchPushes watches the branches of the inbox's pull requests in the user's clones,
// so one pushed from this Mac is read again from GitHub at once rather than at the next
// refresh (see the pushwatch package).
WatchPushes bool `json:"watchPushes"`
// ServiceStatus is what the service status check watches: which providers' status
// pages are on, and which of each one's parts count (see the statusprefs package).
ServiceStatus statusprefs.Config `json:"serviceStatus"`
// StatusProviders are the providers the check can watch, with their parts, for the
// settings page to list.
StatusProviders []statusprefs.Provider `json:"statusProviders"`
// UpdateMode is what the app does when a new version is out: download it and tell the
// user, just tell them, or make no timed checks (see the updateprefs package).
UpdateMode updateprefs.Mode `json:"updateMode"`
// Autopilot is Autopilot's settings: Pause Autopilot, the mode new routines start in,
// the limits and the daily cap, and how long its history is kept (see the
// autopilotprefs package).
Autopilot autopilotprefs.Config `json:"autopilot"`
}
Settings is the full set of preferences as the UI shows them. Every field is a plain value.
type TextSize ¶ added in v0.2.0
type TextSize string
TextSize is the size of the app's text, apart from the size of its window. A larger size scales the text and the spacing sized with it, as a browser's font size setting does; the frontend sets the scale for each choice.
const ( // TextSizeDefault shows the text at the size the app is designed at (100%). TextSizeDefault TextSize = "default" // TextSizeLarge shows the text a step larger (115%). TextSizeLarge TextSize = "large" // TextSizeLarger shows the text two steps larger (130%). TextSizeLarger TextSize = "larger" )
Text size choices.
type WindowSize ¶
WindowSize is the window's size, in points.
func DefaultWindowSize ¶
func DefaultWindowSize() WindowSize
DefaultWindowSize returns the size the window opens at on a fresh database.
func MinWindowSizeFor ¶ added in v0.2.0
func MinWindowSizeFor(textSize TextSize) WindowSize
MinWindowSizeFor returns the smallest the window can be at a text size: MinWindowWidth by MinWindowHeight scaled by the text size, rounded up. The page's layout is then never narrower or shorter, in its own scaled units, than at the default text size.
func ReadWindowSize ¶ added in v0.2.0
ReadWindowSize returns the size the window opens at, from the preferences in store: the stored size, or the default when none is stored or the stored one is no longer valid. Only the desktop shell reads the size on its own, so this is a function over the store rather than a method of the Service the window binds.
func WindowBounds ¶ added in v0.2.0
func WindowBounds(stored WindowSize, textSize TextSize, width, height int) (size, least WindowSize)
WindowBounds returns the size the window opens at, and the smallest it can be resized to, for the stored size at a text size on a screen area of the given width and height. The smallest is MinWindowSizeFor the text size, and the stored size grows to it; both then shrink, where needed, to fit the area (see Fit). A zero or negative area fits any size.
func (WindowSize) AtLeast ¶ added in v0.2.0
func (w WindowSize) AtLeast(least WindowSize) WindowSize
AtLeast returns the size grown, where needed, to least.
func (WindowSize) Fit ¶
func (w WindowSize) Fit(width, height int) WindowSize
Fit returns the size shrunk, where needed, to fit a screen area of the given width and height, but never below the minimum. A zero or negative area leaves the size as it is.
Source Files
¶
- autopilot.go
- bypassown.go
- cards.go
- celebrations.go
- checks.go
- choice.go
- conversationorder.go
- githubnotifications.go
- integrations.go
- labels.go
- locations.go
- mergebots.go
- notifications.go
- notificationstab.go
- nudge.go
- order.go
- portable.go
- portablerepos.go
- refresh.go
- repos.go
- review.go
- reviewtab.go
- sections.go
- servicestatus.go
- settings.go
- textsize.go
- theme.go
- tips.go
- toast.go
- update.go
- window.go