config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StateFileName     = "state.json"
	InstancesFileName = "instances.json"
)
View Source
const (
	ConfigFileName = "config.json"
)

Variables

This section is empty.

Functions

func GetClaudeCommand

func GetClaudeCommand() (string, error)

GetClaudeCommand attempts to find the "claude" command in the user's shell It checks in the following order: 1. Shell alias resolution: using "which" command 2. PATH lookup

If both fail, it returns an error.

func GetConfigDir

func GetConfigDir() (string, error)

GetConfigDir returns the path to the application's configuration directory

func SaveConfig

func SaveConfig(config *Config) error

SaveConfig exports the saveConfig function for use by other packages

func SaveState

func SaveState(state *State) error

SaveState saves the state to disk

Types

type AppState

type AppState interface {
	// GetHelpScreensSeen returns the bitmask of seen help screens
	GetHelpScreensSeen() uint32
	// SetHelpScreensSeen updates the bitmask of seen help screens
	SetHelpScreensSeen(seen uint32) error
}

AppState handles application-level state

type Config

type Config struct {
	// DefaultProgram is the default program to run in new instances
	DefaultProgram string `json:"default_program"`
	// AutoYes is a flag to automatically accept all prompts.
	AutoYes bool `json:"auto_yes"`
	// DaemonPollInterval is the interval (ms) at which the daemon polls sessions for autoyes mode.
	DaemonPollInterval int `json:"daemon_poll_interval"`
	// BranchPrefix is the prefix used for git branches created by the application.
	BranchPrefix string `json:"branch_prefix"`
	// NotificationsEnabled controls whether macOS/Linux desktop notifications
	// are sent when an agent finishes (Running -> Ready).
	NotificationsEnabled *bool `json:"notifications_enabled,omitempty"`
}

Config represents the application configuration

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default configuration

func LoadConfig

func LoadConfig() *Config

func (*Config) AreNotificationsEnabled

func (c *Config) AreNotificationsEnabled() bool

AreNotificationsEnabled returns whether desktop notifications are enabled. Defaults to true when the field is not set.

type InstanceStorage

type InstanceStorage interface {
	// SaveInstances saves the raw instance data
	SaveInstances(instancesJSON json.RawMessage) error
	// GetInstances returns the raw instance data
	GetInstances() json.RawMessage
	// DeleteAllInstances removes all stored instances
	DeleteAllInstances() error
}

InstanceStorage handles instance-related operations

type State

type State struct {
	// HelpScreensSeen is a bitmask tracking which help screens have been shown
	HelpScreensSeen uint32 `json:"help_screens_seen"`
	// Instances stores the serialized instance data as raw JSON
	InstancesData json.RawMessage `json:"instances"`
	// TopicsData stores the serialized topic data as raw JSON
	TopicsData json.RawMessage `json:"topics,omitempty"`
	// RecentRepos stores recently opened repo paths so they persist in the picker
	RecentRepos []string `json:"recent_repos,omitempty"`
}

State represents the application state that persists between sessions

func DefaultState

func DefaultState() *State

DefaultState returns the default state

func LoadState

func LoadState() *State

LoadState loads the state from disk. If it cannot be done, we return the default state.

func (*State) AddRecentRepo

func (s *State) AddRecentRepo(path string) error

AddRecentRepo adds a repo path to the recent list if not already present.

func (*State) DeleteAllInstances

func (s *State) DeleteAllInstances() error

DeleteAllInstances removes all stored instances

func (*State) GetHelpScreensSeen

func (s *State) GetHelpScreensSeen() uint32

GetHelpScreensSeen returns the bitmask of seen help screens

func (*State) GetInstances

func (s *State) GetInstances() json.RawMessage

GetInstances returns the raw instance data

func (*State) GetRecentRepos

func (s *State) GetRecentRepos() []string

GetRecentRepos returns the list of recently opened repo paths.

func (*State) GetTopics

func (s *State) GetTopics() json.RawMessage

GetTopics returns the raw topic data

func (*State) SaveInstances

func (s *State) SaveInstances(instancesJSON json.RawMessage) error

SaveInstances saves the raw instance data

func (*State) SaveTopics

func (s *State) SaveTopics(topicsJSON json.RawMessage) error

SaveTopics saves the raw topic data

func (*State) SetHelpScreensSeen

func (s *State) SetHelpScreensSeen(seen uint32) error

SetHelpScreensSeen updates the bitmask of seen help screens

type StateManager

type StateManager interface {
	InstanceStorage
	TopicStorage
	AppState
}

StateManager combines instance storage, topic storage, and app state management

type TopicStorage

type TopicStorage interface {
	SaveTopics(topicsJSON json.RawMessage) error
	GetTopics() json.RawMessage
}

TopicStorage handles topic-related operations

Jump to

Keyboard shortcuts

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