config

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2025 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigDir

func ConfigDir() (string, error)

ConfigDir returns the configuration directory path

func ConfigPath

func ConfigPath() (string, error)

ConfigPath returns the default config file path

func LoadWithValidation

func LoadWithValidation(path string) (*Config, *ValidationResult, error)

LoadWithValidation loads config and returns structured validation result

Types

type AgentConfig

type AgentConfig struct {
	Command    string            `json:"command"`
	Args       []string          `json:"args"`
	Env        map[string]string `json:"env"`
	StatusFile string            `json:"status_file"`
	InitPrompt string            `json:"init_prompt"`
}

AgentConfig defines how to spawn and monitor an AI agent

type BehaviorSettings

type BehaviorSettings struct {
	ConfirmQuitWithAgents bool `json:"confirm_quit_with_agents"` // Prompt before quitting with running agents
}

BehaviorSettings controls application behavior preferences

type BoardSettings

type BoardSettings struct {
	DefaultAgent     string `json:"default_agent"`
	WorktreeBase     string `json:"worktree_base"`
	AutoSpawnAgent   bool   `json:"auto_spawn_agent"`
	AutoCreateBranch bool   `json:"auto_create_branch"`
	BranchPrefix     string `json:"branch_prefix"`
	BranchNaming     string `json:"branch_naming"`   // "template" | "ai" | "prompt"
	BranchTemplate   string `json:"branch_template"` // e.g., "{prefix}{slug}"
	SlugMaxLength    int    `json:"slug_max_length"` // default: 40
	InitPrompt       string `json:"init_prompt"`
}

BoardSettings contains default settings for boards

type CleanupSettings

type CleanupSettings struct {
	DeleteWorktree       bool `json:"delete_worktree"`        // Remove git worktree on ticket delete
	DeleteBranch         bool `json:"delete_branch"`          // Delete git branch after worktree removal
	ForceWorktreeRemoval bool `json:"force_worktree_removal"` // Force removal even with uncommitted changes
}

CleanupSettings controls cleanup behavior when deleting tickets

type Config

type Config struct {
	Defaults BoardSettings          `json:"defaults"`
	Agents   map[string]AgentConfig `json:"agents"`
	UI       UIConfig               `json:"ui"`
	Cleanup  CleanupSettings        `json:"cleanup"`
	Behavior BehaviorSettings       `json:"behavior"`
	Opencode OpencodeSettings       `json:"opencode"`
	Keys     map[string]string      `json:"keys,omitempty"`
}

Config holds the global application configuration

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default configuration

func Load

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

Load reads configuration from file or returns defaults

func (*Config) GetEffectiveInitPrompt

func (c *Config) GetEffectiveInitPrompt(agentType string) string

func (*Config) Save

func (c *Config) Save(path string) error

Save writes configuration to file

func (*Config) Validate

func (c *Config) Validate() *ValidationResult

Validate performs full config validation and returns all errors and warnings

type OpencodeSettings

type OpencodeSettings struct {
	ServerEnabled bool `json:"server_enabled"` // Start opencode server for enhanced status detection
	ServerPort    int  `json:"server_port"`    // Port for opencode server (default: 4096)
	PollInterval  int  `json:"poll_interval"`  // Status polling interval in seconds (default: 1)
}

OpencodeSettings controls OpenCode server integration

type UIConfig

type UIConfig struct {
	Theme           string `json:"theme"`
	ShowAgentStatus bool   `json:"show_agent_status"`
	RefreshInterval int    `json:"refresh_interval"`
	ColumnWidth     int    `json:"column_width"`
	TicketHeight    int    `json:"ticket_height"`
	SidebarVisible  bool   `json:"sidebar_visible"`
}

UIConfig holds UI-related preferences

type ValidationError

type ValidationError struct {
	Section string // "defaults", "agents.claude", "ui", etc.
	Field   string // "command", "branch_naming", etc.
	Message string // Human-readable error
	Value   any    // The invalid value (for display)
}

ValidationError represents a single config validation issue

type ValidationResult

type ValidationResult struct {
	Errors   []ValidationError
	Warnings []ValidationError
}

ValidationResult holds all validation errors and warnings

func (*ValidationResult) AddError

func (r *ValidationResult) AddError(section, field, message string, value any)

AddError adds a validation error

func (*ValidationResult) AddWarning

func (r *ValidationResult) AddWarning(section, field, message string, value any)

AddWarning adds a validation warning

func (*ValidationResult) FormatErrors

func (r *ValidationResult) FormatErrors() string

FormatErrors returns a formatted string of all errors for CLI output

func (*ValidationResult) FormatWarnings

func (r *ValidationResult) FormatWarnings() string

FormatWarnings returns a formatted string of all warnings for CLI output

func (*ValidationResult) HasErrors

func (r *ValidationResult) HasErrors() bool

HasErrors returns true if there are any validation errors

func (*ValidationResult) HasWarnings

func (r *ValidationResult) HasWarnings() bool

HasWarnings returns true if there are any validation warnings

Jump to

Keyboard shortcuts

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