config

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultTOML added in v0.19.0

func DefaultTOML() []byte

func Expand

func Expand(s string, vars TemplateVars) (string, error)

func ExpandPath added in v0.11.0

func ExpandPath(p string) string

func ExpandSlice

func ExpandSlice(ss []string, vars TemplateVars) ([]string, error)

func IncludeEnvVarName added in v0.19.0

func IncludeEnvVarName(repoBasename string) string

func LegacyRuntimeDirs added in v0.11.0

func LegacyRuntimeDirs() []string

LegacyRuntimeDirs returns paths where older versions stored the socket and PID file (TMPDIR or /tmp fallbacks). Used during startup to detect and clean up an orphaned daemon after the socket location changed.

func ParseDurationWithDays added in v0.3.0

func ParseDurationWithDays(s string) (time.Duration, error)

func ResolvePath added in v0.16.5

func ResolvePath(p string) string

func ResolveProfile added in v0.18.0

func ResolveProfile() (profile string, appName string, err error)

Types

type Agent

type Agent struct {
	Command       string                     `json:"command"                  toml:"command"`
	Args          []string                   `json:"args,omitempty"           toml:"args"`
	ResumeArgs    []string                   `json:"resume_args,omitempty"    toml:"resume_args"`
	ForkArgs      []string                   `json:"fork_args,omitempty"      toml:"fork_args"`
	Env           map[string]string          `json:"env,omitempty"            toml:"env"`
	IdleTimeout   string                     `json:"idle_timeout,omitempty"   toml:"idle_timeout"`
	Sandbox       SandboxConfig              `json:"sandbox"                  toml:"sandbox"`
	MCPServers    map[string]MCPServerConfig `json:"mcp_servers,omitempty"    toml:"mcp_servers"`
	ValidateModel string                     `json:"validate_model,omitempty" toml:"validate_model"`
}

func (Agent) IdleTimeoutDuration

func (a Agent) IdleTimeoutDuration() time.Duration

type Approvals added in v0.13.0

type Approvals struct {
	Mode    string `toml:"mode"`
	AutoPop bool   `toml:"auto_pop"`
	Timeout string `toml:"timeout"`
	Command string `toml:"command"`
}

func (Approvals) TimeoutDuration added in v0.13.0

func (a Approvals) TimeoutDuration() time.Duration

type Config

type Config struct {
	DefaultAgent     string            `toml:"default_agent"`
	GitHubUsername   string            `toml:"github_username"`
	BranchPrefix     string            `toml:"branch_prefix"`
	DataDir          string            `toml:"data_dir"`
	FetchOnCreate    bool              `toml:"fetch_on_create"`
	AllowedRepoPaths []string          `toml:"allowed_repo_paths"`
	Repos            []RepoConfig      `toml:"repos"`
	StatusBar        StatusBar         `toml:"status_bar"`
	Keybindings      Keybindings       `toml:"keybindings"`
	Notifications    Notifications     `toml:"notifications"`
	Messages         Messages          `toml:"messages"`
	Sandbox          SandboxConfig     `toml:"sandbox"`
	Approvals        Approvals         `toml:"approvals"`
	MCPServers       []MCPServerConfig `toml:"mcp_servers"`
	Agents           map[string]Agent  `toml:"agents"`
}

func Default

func Default() *Config

func Load

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

func LoadOrDefault

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

func (*Config) FindRepo added in v0.18.0

func (c *Config) FindRepo(repoPath string) (RepoConfig, bool)

func (*Config) RepoPathAllowed added in v0.11.0

func (c *Config) RepoPathAllowed(repoPath string) bool

func (*Config) Validate added in v0.19.0

func (c *Config) Validate() error

type Keybindings

type Keybindings struct {
	Prefix        string `toml:"prefix"`
	NewSession    string `toml:"new_session"`
	ForkSession   string `toml:"fork_session"`
	DeleteSession string `toml:"delete_session"`
	Detach        string `toml:"detach"`
	SessionList   string `toml:"session_list"`
	NextSession   string `toml:"next_session"`
	PrevSession   string `toml:"prev_session"`
	LastSession   string `toml:"last_session"`
	ResumeSession string `toml:"resume_session"`
	RenameSession string `toml:"rename_session"`
	Search        string `toml:"search"`
	ScrollMode    string `toml:"scroll_mode"`
	Shell         string `toml:"shell"`
}

type MCPServerConfig added in v0.22.0

type MCPServerConfig struct {
	Name          string            `json:"-"              toml:"name"`
	Command       string            `json:"command"        toml:"command"`
	Args          []string          `json:"args,omitempty" toml:"args,omitempty"`
	Env           map[string]string `json:"env,omitempty"  toml:"env,omitempty"`
	Disabled      bool              `json:"-"              toml:"disabled,omitempty"`
	Sandbox       *bool             `json:"-"              toml:"sandbox,omitempty"`
	SandboxConfig *SandboxConfig    `json:"-"              toml:"sandbox_config,omitempty"`
}

func MergeMCPServers added in v0.22.0

func MergeMCPServers(global []MCPServerConfig, overrides map[string]MCPServerConfig) []MCPServerConfig

type Messages added in v0.3.0

type Messages struct {
	MaxAge       string `toml:"max_age"`
	MaxPerStream int    `toml:"max_per_stream"`
}

func (Messages) MaxAgeDuration added in v0.3.0

func (m Messages) MaxAgeDuration() time.Duration

type Notifications added in v0.2.0

type Notifications struct {
	Enabled    bool   `toml:"enabled"`
	OnApproval bool   `toml:"on_approval"`
	OnStopped  bool   `toml:"on_stopped"`
	Command    string `toml:"command"`
}

type Paths

type Paths struct {
	Profile    string
	AppName    string
	ConfigFile string
	DataDir    string
	RuntimeDir string
	SocketPath string
	PIDFile    string
	StateFile  string
	LogDir     string
	DaemonLog  string
	MessagesDB string
}

func ResolvePaths

func ResolvePaths() (Paths, error)

func (Paths) EnsureDirs

func (p Paths) EnsureDirs() error

func (Paths) WithDataDir added in v0.21.0

func (p Paths) WithDataDir(dataDir string) Paths

type RepoConfig added in v0.18.0

type RepoConfig struct {
	Path            string   `toml:"path"`
	AllowConcurrent bool     `toml:"allow_concurrent"`
	Singleton       bool     `toml:"singleton"`
	Includes        []string `toml:"includes"`
}

func (RepoConfig) Validate added in v0.19.0

func (rc RepoConfig) Validate() error

type SandboxConfig added in v0.11.0

type SandboxConfig struct {
	Enabled   bool     `json:"enabled"              toml:"enabled"`
	Disabled  *bool    `json:"disabled,omitempty"   toml:"disabled,omitempty"`
	Command   string   `json:"command,omitempty"    toml:"command"`
	Features  []string `json:"features,omitempty"   toml:"features"`
	ReadDirs  []string `json:"read_dirs,omitempty"  toml:"read_dirs"`
	WriteDirs []string `json:"write_dirs,omitempty" toml:"write_dirs"`
}

func (SandboxConfig) Merge added in v0.11.0

func (s SandboxConfig) Merge(agent SandboxConfig) SandboxConfig

type StatusBar added in v0.3.0

type StatusBar struct {
	Enabled  bool   `toml:"enabled"`
	Position string `toml:"position"`
}

type TemplateVars

type TemplateVars struct {
	Username                 string
	AgentSessionID           string
	SessionName              string
	SessionID                string
	WorktreePath             string
	ForkSourceAgentSessionID string
	Model                    string
}

type Watcher added in v0.3.0

type Watcher struct {
	// contains filtered or unexported fields
}

func NewWatcher added in v0.3.0

func NewWatcher(path string, onChange func(*Config), log *slog.Logger) *Watcher

func (*Watcher) Run added in v0.3.0

func (w *Watcher) Run(ctx context.Context) error

Jump to

Keyboard shortcuts

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