Documentation
¶
Overview ¶
Package config handles loading, saving, and validating user configuration from JSON files, including project settings, plugin options, keymaps, and UI preferences.
Index ¶
- func ConfigPath() string
- func ExpandPath(path string) string
- func ResetTestConfigPath()
- func ResetTestStateDir()
- func Save(cfg *Config) error
- func SaveCommunityTheme(communityName string, userOverrides map[string]interface{}) error
- func SaveGlobalTheme(tc ThemeConfig) error
- func SaveLastOpenInApp(projectPath, appID string) error
- func SaveProjectTheme(projectPath string, theme *ThemeConfig) error
- func SaveTheme(themeName string) error
- func SaveThemeWithOverrides(themeName string, overrides map[string]interface{}) error
- func SetTestConfigPath(path string)
- func SetTestStateDir(dir string)
- func StateDir() string
- type Config
- type ConversationsPluginConfig
- type FeaturesConfig
- type FileBrowserPluginConfig
- type GitStatusPluginConfig
- type KeymapConfig
- type NotesPluginConfig
- type PluginsConfig
- type ProjectConfig
- type ProjectsConfig
- type SidebarDisplayConfig
- type TDMonitorPluginConfig
- type ThemeConfig
- type UIConfig
- type WorkspacePluginConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResetTestConfigPath ¶
func ResetTestConfigPath()
ResetTestConfigPath clears the test config path override.
func ResetTestStateDir ¶ added in v0.75.0
func ResetTestStateDir()
ResetTestStateDir clears the test state directory override.
func Save ¶
Save writes the config to ~/.config/sidecar/config.json, preserving any keys it doesn't manage (e.g. "prompts").
func SaveCommunityTheme ¶
SaveCommunityTheme saves a community theme reference with optional user overrides. Only the scheme name is stored — the full palette is computed at runtime.
func SaveGlobalTheme ¶
func SaveGlobalTheme(tc ThemeConfig) error
SaveGlobalTheme saves a ThemeConfig as the global UI theme.
func SaveLastOpenInApp ¶ added in v0.75.0
SaveLastOpenInApp persists the last-used "open in" app ID. If projectPath matches a configured project, that project's LastOpenInApp is set. The global UI.LastOpenInApp is always set as a fallback.
func SaveProjectTheme ¶
func SaveProjectTheme(projectPath string, theme *ThemeConfig) error
SaveProjectTheme updates a specific project's theme in config and saves.
func SaveThemeWithOverrides ¶
SaveThemeWithOverrides saves a theme name and full overrides map to config.
func SetTestConfigPath ¶
func SetTestConfigPath(path string)
SetTestConfigPath sets a custom config path for testing. Call ResetTestConfigPath() in test cleanup to restore default behavior.
func SetTestStateDir ¶ added in v0.75.0
func SetTestStateDir(dir string)
SetTestStateDir sets a custom state directory for testing.
Types ¶
type Config ¶
type Config struct {
Projects ProjectsConfig `json:"projects"`
Plugins PluginsConfig `json:"plugins"`
Keymap KeymapConfig `json:"keymap"`
UI UIConfig `json:"ui"`
Features FeaturesConfig `json:"features"`
}
Config is the root configuration structure.
type ConversationsPluginConfig ¶
type ConversationsPluginConfig struct {
Enabled bool `json:"enabled"`
ClaudeDataDir string `json:"claudeDataDir"`
// DefaultCategoryFilter sets the default session category filter on startup.
// Example: ["interactive"] hides cron/system sessions by default.
// Empty or omitted means show all sessions (no filter).
DefaultCategoryFilter []string `json:"defaultCategoryFilter,omitempty"`
}
ConversationsPluginConfig configures the conversations plugin.
type FeaturesConfig ¶
FeaturesConfig holds feature flag settings.
type FileBrowserPluginConfig ¶ added in v0.81.0
type FileBrowserPluginConfig struct {
// Enabled controls whether the file browser plugin is loaded. Default: true.
Enabled bool `json:"enabled"`
}
FileBrowserPluginConfig configures the file browser plugin.
type GitStatusPluginConfig ¶
type GitStatusPluginConfig struct {
Enabled bool `json:"enabled"`
RefreshInterval time.Duration `json:"refreshInterval"`
}
GitStatusPluginConfig configures the git status plugin.
type KeymapConfig ¶
KeymapConfig holds key binding overrides.
type NotesPluginConfig ¶
type NotesPluginConfig struct {
// DefaultEditor sets the default editor mode when pressing Enter on a note.
// Values: "builtin" (default), "vim", "nvim", or any $EDITOR value.
// When set to "vim"/"nvim", Enter opens the note in inline vim instead of built-in editor.
DefaultEditor string `json:"defaultEditor,omitempty"`
}
NotesPluginConfig configures the notes plugin.
type PluginsConfig ¶
type PluginsConfig struct {
GitStatus GitStatusPluginConfig `json:"git-status"`
TDMonitor TDMonitorPluginConfig `json:"td-monitor"`
FileBrowser FileBrowserPluginConfig `json:"file-browser"`
Conversations ConversationsPluginConfig `json:"conversations"`
Workspace WorkspacePluginConfig `json:"workspace"`
Notes NotesPluginConfig `json:"notes"`
}
PluginsConfig holds per-plugin configuration.
type ProjectConfig ¶
type ProjectConfig struct {
Name string `json:"name"` // display name for the project
Path string `json:"path"` // absolute path to project root (supports ~ expansion)
Theme *ThemeConfig `json:"theme,omitempty"` // per-project theme (nil = use global)
LastOpenInApp string `json:"lastOpenInApp,omitempty"` // last app used to open this project (e.g. "vscode", "goland")
}
ProjectConfig represents a single project in the project switcher.
type ProjectsConfig ¶
type ProjectsConfig struct {
Mode string `json:"mode"` // "single" for now
Root string `json:"root"` // "." default
List []ProjectConfig `json:"list"` // list of configured projects for switcher
}
ProjectsConfig configures project detection and layout.
type SidebarDisplayConfig ¶ added in v0.81.0
type SidebarDisplayConfig struct {
// HideRepoPrefix strips the repo name prefix from worktree names (e.g., "myrepo-feature" → "feature").
// Default: false (show full name).
HideRepoPrefix bool `json:"hideRepoPrefix"`
// HideAgent hides the agent type label (e.g., "claude") on the second line. Default: false.
HideAgent bool `json:"hideAgent"`
// HideTask hides the linked task ID (e.g., "td-abc123") on the second line. Default: false.
HideTask bool `json:"hideTask"`
// HideStats hides the +/- line change stats on the second line. Default: false.
HideStats bool `json:"hideStats"`
}
SidebarDisplayConfig controls visibility of workspace sidebar entry elements.
type TDMonitorPluginConfig ¶
type TDMonitorPluginConfig struct {
Enabled bool `json:"enabled"`
RefreshInterval time.Duration `json:"refreshInterval"`
DBPath string `json:"dbPath"`
}
TDMonitorPluginConfig configures the TD monitor plugin.
type ThemeConfig ¶
type ThemeConfig struct {
Name string `json:"name"`
Community string `json:"community,omitempty"` // community scheme name (resolved at runtime)
Overrides map[string]interface{} `json:"overrides,omitempty"` // user customizations on top
}
ThemeConfig configures the color theme.
type UIConfig ¶
type UIConfig struct {
ShowClock bool `json:"showClock"`
Theme ThemeConfig `json:"theme"`
NerdFontsEnabled bool `json:"nerdFontsEnabled"` // enables Nerd Font glyphs (pill tabs, icons, etc.)
LastOpenInApp string `json:"lastOpenInApp,omitempty"` // global fallback for last app used to open projects
}
UIConfig configures UI appearance.
type WorkspacePluginConfig ¶
type WorkspacePluginConfig struct {
// DirPrefix prefixes workspace directory names with the repo name (e.g., 'myrepo-feature-auth')
// This helps associate conversations with the repo after workspace deletion. Default: true.
DirPrefix bool `json:"dirPrefix"`
// DefaultAgentType sets the default agent family selected when creating a workspace.
// Uses workspace.AgentType values (e.g. "claude", "codex", "opencode").
DefaultAgentType string `json:"defaultAgentType,omitempty"`
// AgentStart maps agent family (AgentType string) to default startup command.
// Example: {"claude":"claude", "opencode":"opencode --profile fast"}.
// Per-workspace .sidecar-agent-start still takes precedence when present.
AgentStart map[string]string `json:"agentStart,omitempty"`
// TmuxCaptureMaxBytes caps tmux pane capture size for the preview pane. Default: 2MB.
TmuxCaptureMaxBytes int `json:"tmuxCaptureMaxBytes"`
// InteractiveExitKey is the keybinding to exit interactive mode. Default: "ctrl+\".
// Examples: "ctrl+]", "ctrl+\\", "ctrl+x"
InteractiveExitKey string `json:"interactiveExitKey,omitempty"`
// InteractiveAttachKey is the keybinding to attach from interactive mode. Default: "ctrl+]".
// When pressed in interactive mode, exits interactive and attaches to the tmux session.
InteractiveAttachKey string `json:"interactiveAttachKey,omitempty"`
// InteractiveCopyKey is the keybinding to copy selection in interactive mode. Default: "alt+c".
InteractiveCopyKey string `json:"interactiveCopyKey,omitempty"`
// InteractivePasteKey is the keybinding to paste clipboard in interactive mode. Default: "alt+v".
InteractivePasteKey string `json:"interactivePasteKey,omitempty"`
// SidebarDisplay controls what information is shown in the workspace sidebar entries.
SidebarDisplay SidebarDisplayConfig `json:"sidebarDisplay"`
}
WorkspacePluginConfig configures the workspace plugin.