config

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultTmuxStatusPosition = "bottom"

DefaultTmuxStatusPosition is the default tmux status bar position

View Source
const MainRepoDir = ".main"

MainRepoDir is the directory name used for the main repository clone

Variables

This section is empty.

Functions

func DefaultClaudeDir

func DefaultClaudeDir() string

DefaultClaudeDir returns the default Claude directory Checks CLAUDE_CONFIG_DIR environment variable first, then falls back to ~/.claude

func DetectClaudeDirForRepo

func DetectClaudeDirForRepo(sessionReader ports.SessionReader, repoInfo string) (string, error)

DetectClaudeDirForRepo finds ClaudeDir from existing sessions of the same repository (for consistency) Returns empty string if no existing sessions found or if they don't have ClaudeDir set

func ExpandPath

func ExpandPath(path string) string

ExpandPath expands ~ to home directory

func GetDBPath

func GetDBPath() string

GetDBPath returns $ROCHA_HOME/state.db

func GetRochaHome

func GetRochaHome() string

GetRochaHome returns ROCHA_HOME or ~/.rocha default

func GetSettingsExample

func GetSettingsExample() map[string]any

GetSettingsExample uses reflection to generate example settings This automatically stays in sync when new fields are added to Settings

func GetSettingsFilePath

func GetSettingsFilePath() string

GetSettingsFilePath returns the path to the settings file

func GetSettingsPath

func GetSettingsPath() string

GetSettingsPath returns $ROCHA_HOME/settings.json

func GetWorktreePath

func GetWorktreePath() string

GetWorktreePath returns $ROCHA_HOME/worktrees

func ResolveClaudeDir

func ResolveClaudeDir(sessionReader ports.SessionReader, repoInfo, userOverride string) string

ResolveClaudeDir determines ClaudeDir with precedence: 1. User override (if provided and non-empty) 2. Existing sessions' ClaudeDir (if repo has sessions with ClaudeDir set) 3. Default ~/.claude

Always returns an expanded absolute path

func SaveSettings

func SaveSettings(settings *Settings) error

SaveSettings saves settings to $ROCHA_HOME/settings.json

Types

type KeyBindingValue

type KeyBindingValue []string

KeyBindingValue supports "a" or ["up", "k"] in JSON

func (KeyBindingValue) MarshalJSON

func (kv KeyBindingValue) MarshalJSON() ([]byte, error)

MarshalJSON implements custom marshaling for KeyBindingValue

func (*KeyBindingValue) UnmarshalJSON

func (kv *KeyBindingValue) UnmarshalJSON(data []byte) error

UnmarshalJSON implements custom unmarshaling for KeyBindingValue

type KeyBindingsConfig

type KeyBindingsConfig map[string]KeyBindingValue

KeyBindingsConfig holds custom key binding overrides as a map. Keys are binding names (e.g., "archive", "help"), values are the key sequences.

func (KeyBindingsConfig) Validate

func (k KeyBindingsConfig) Validate(validNames []string) error

Validate checks for configuration errors in key bindings. The validNames parameter should come from ui.GetValidKeyNames().

type Settings

type Settings struct {
	AllowDangerouslySkipPermissions *bool             `json:"allow_dangerously_skip_permissions,omitempty"`
	Debug                           *bool             `json:"debug,omitempty"`
	Editor                          string            `json:"editor,omitempty"`
	ErrorClearDelay                 *int              `json:"error_clear_delay,omitempty"`
	Keys                            KeyBindingsConfig `json:"keys,omitempty"`
	MaxLogFiles                     *int              `json:"max_log_files,omitempty"`
	ShowPRNumber                    *bool             `json:"show_pr_number,omitempty"`
	ShowTimestamps                  *bool             `json:"show_timestamps,omitempty"`
	ShowTokenChart                  *bool             `json:"show_token_chart,omitempty"`
	StatusColors                    StringArray       `json:"status_colors,omitempty"`
	Statuses                        StringArray       `json:"statuses,omitempty"`
	TipsDisplayDurationSeconds      *int              `json:"tips_display_duration_seconds,omitempty"`
	TipsEnabled                     *bool             `json:"tips_enabled,omitempty"`
	TipsShowIntervalSeconds         *int              `json:"tips_show_interval_seconds,omitempty"`
	TmuxStatusPosition              string            `json:"tmux_status_position,omitempty"`
}

Settings represents the structure of ~/.rocha/settings.json

func LoadSettings

func LoadSettings() (*Settings, error)

LoadSettings loads settings from $ROCHA_HOME/settings.json (or ~/.rocha/settings.json if not set) Returns empty Settings if file doesn't exist (not an error)

type StatusConfig

type StatusConfig struct {
	Colors   []string
	Icons    []string
	Statuses []string
}

StatusConfig holds the configuration for session implementation statuses

func NewStatusConfig

func NewStatusConfig(statuses, icons, colors string) *StatusConfig

NewStatusConfig creates a new StatusConfig from comma-separated strings

func (*StatusConfig) GetColor

func (c *StatusConfig) GetColor(status string) string

GetColor returns a color for a given status based on its position Uses configured color palette for visual distinction

func (*StatusConfig) GetIcon

func (c *StatusConfig) GetIcon(status string) string

GetIcon returns the icon for a given status name, or empty string if not found

func (*StatusConfig) GetNextStatus

func (c *StatusConfig) GetNextStatus(currentStatus *string) *string

GetNextStatus returns the next status in the cycle nil -> first status -> second status -> ... -> last status -> nil

type StringArray

type StringArray []string

StringArray supports both JSON arrays and comma-separated strings

func (*StringArray) UnmarshalJSON

func (sa *StringArray) UnmarshalJSON(data []byte) error

UnmarshalJSON implements custom unmarshaling for StringArray

type TimestampColorConfig

type TimestampColorConfig struct {
	RecentColor    string // Color for recent updates (< RecentMinutes)
	RecentMinutes  int    // Threshold in minutes for recent color
	StaleColor     string // Color for very old updates (>= WarningMinutes)
	WarningColor   string // Color for moderately old updates (>= RecentMinutes, < WarningMinutes)
	WarningMinutes int    // Threshold in minutes for warning color
}

TimestampColorConfig holds configuration for timestamp display colors. Colors change based on how recently the session state was updated.

func NewTimestampColorConfig

func NewTimestampColorConfig(recentMin, warningMin int, recentColor, warningColor, staleColor string) *TimestampColorConfig

NewTimestampColorConfig creates a new TimestampColorConfig with the provided values.

Jump to

Keyboard shortcuts

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