Documentation
¶
Index ¶
Constants ¶
const ( AppName = "codeany" ConfigDir = ".codeany" ConfigFile = "settings.json" MemoryDir = "memory" SessionDir = "sessions" )
Variables ¶
This section is empty.
Functions ¶
func GlobalConfigPath ¶
func GlobalConfigPath() string
GlobalConfigPath returns ~/.codeany/settings.json
func ProjectConfigPath ¶
func ProjectConfigPath() string
ProjectConfigPath returns .codeany/settings.json in CWD
func ProjectMemoryPath ¶
func ProjectMemoryPath() string
ProjectMemoryPath returns project-specific memory directory
Types ¶
type Config ¶
type Config struct {
// Model settings
Model string `json:"model,omitempty"`
SmallModel string `json:"smallModel,omitempty"`
// API settings
APIKey string `json:"apiKey,omitempty"`
BaseURL string `json:"baseURL,omitempty"`
// Permission settings
PermissionMode string `json:"permissionMode,omitempty"`
// Tool settings
AllowedTools []string `json:"allowedTools,omitempty"`
// MCP servers
MCPServers map[string]types.MCPServerConfig `json:"mcpServers,omitempty"`
// Custom system prompt
SystemPrompt string `json:"systemPrompt,omitempty"`
AppendSystemPrompt string `json:"appendSystemPrompt,omitempty"`
// Hooks
Hooks *HookConfig `json:"hooks,omitempty"`
// UI
Theme string `json:"theme,omitempty"`
// Proxy
ProxyURL string `json:"proxyURL,omitempty"`
// Max turns
MaxTurns int `json:"maxTurns,omitempty"`
// Budget
MaxBudgetUSD float64 `json:"maxBudgetUSD,omitempty"`
// Custom headers
CustomHeaders map[string]string `json:"customHeaders,omitempty"`
}
Config represents the application configuration
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns a config with sensible defaults
func Load ¶
func Load() *Config
Load loads configuration from all sources (env -> global config -> project config -> CLI flags)
func (*Config) GetPermissionMode ¶
func (c *Config) GetPermissionMode() types.PermissionMode
GetPermissionMode converts string to types.PermissionMode
type HookConfig ¶
type PermissionRules ¶
type PermissionRules struct {
AlwaysAllow map[string]bool `json:"alwaysAllow"` // tool name -> always allow
// contains filtered or unexported fields
}
PermissionRules stores persistent permission rules
func LoadPermissionRules ¶
func LoadPermissionRules() *PermissionRules
LoadPermissionRules loads rules from disk
func (*PermissionRules) IsAllowed ¶
func (pr *PermissionRules) IsAllowed(toolName string) bool
IsAllowed checks if a tool is always allowed
func (*PermissionRules) SetAlwaysAllow ¶
func (pr *PermissionRules) SetAlwaysAllow(toolName string)
SetAlwaysAllow marks a tool as always allowed and saves to disk
type YAMLConfig ¶
type YAMLConfig struct {
DefaultModel string `yaml:"default_model"`
PermissionMode string `yaml:"permission_mode"`
MaxIterations int `yaml:"max_iterations"`
Models map[string]struct {
APIKey string `yaml:"api_key"`
BaseURL string `yaml:"base_url"`
} `yaml:"models"`
}
YAMLConfig represents the legacy YAML config format