config

package
v0.74.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 19, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package config handles loading, saving, and validating user configuration from JSON files, including project settings, plugin options, keymaps, and UI preferences.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigPath

func ConfigPath() string

ConfigPath returns the path to the config file.

func ExpandPath

func ExpandPath(path string) string

ExpandPath expands ~ to home directory.

func ResetTestConfigPath

func ResetTestConfigPath()

ResetTestConfigPath clears the test config path override.

func Save

func Save(cfg *Config) error

Save writes the config to ~/.config/sidecar/config.json, preserving any keys it doesn't manage (e.g. "prompts").

func SaveCommunityTheme

func SaveCommunityTheme(communityName string, userOverrides map[string]interface{}) error

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 SaveProjectTheme

func SaveProjectTheme(projectPath string, theme *ThemeConfig) error

SaveProjectTheme updates a specific project's theme in config and saves.

func SaveTheme

func SaveTheme(themeName string) error

SaveTheme updates only the theme name in config and saves.

func SaveThemeWithOverrides

func SaveThemeWithOverrides(themeName string, overrides map[string]interface{}) error

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.

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.

func Default

func Default() *Config

Default returns the default configuration.

func Load

func Load() (*Config, error)

Load loads configuration from the default location.

func LoadFrom

func LoadFrom(path string) (*Config, error)

LoadFrom loads configuration from a specific path. If path is empty, uses ~/.config/sidecar/config.json

func (*Config) Validate

func (c *Config) Validate() error

Validate checks the configuration for errors.

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

type FeaturesConfig struct {
	Flags map[string]bool `json:"flags"`
}

FeaturesConfig holds feature flag settings.

type GitStatusPluginConfig

type GitStatusPluginConfig struct {
	Enabled         bool          `json:"enabled"`
	RefreshInterval time.Duration `json:"refreshInterval"`
}

GitStatusPluginConfig configures the git status plugin.

type KeymapConfig

type KeymapConfig struct {
	Overrides map[string]string `json:"overrides"`
}

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"`
	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)
}

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 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.)
}

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"`
	// 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"`
}

WorkspacePluginConfig configures the workspace plugin.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL