Documentation
¶
Index ¶
- Variables
- func DebugLog(format string, args ...interface{})
- func DecryptConfig(data []byte, password string) ([]byte, error)
- func EncryptConfig(path string, password string) error
- func EnsureComandaDir() (string, error)
- func EnsureLoopStateDir() (string, error)
- func GenerateBearerToken() (string, error)
- func GetComandaDir() (string, error)
- func GetEnvPath() string
- func GetLoopStateDir() (string, error)
- func GetMemoryPath(envConfig *EnvConfig) string
- func InitializeUserMemoryFile() (string, error)
- func IsEncrypted(data []byte) bool
- func PromptPassword(prompt string) (string, error)
- func SaveEnvConfig(path string, config *EnvConfig) error
- func ValidateModelMode(mode ModelMode) bool
- func VerboseLog(format string, args ...interface{})
- type CORS
- type DatabaseConfig
- type DatabaseType
- type EnvConfig
- func (c *EnvConfig) AddDatabase(name string, config DatabaseConfig)
- func (c *EnvConfig) AddModelToProvider(providerName string, model Model) error
- func (c *EnvConfig) AddProvider(name string, provider Provider)
- func (c *EnvConfig) GetAllConfiguredModels() []string
- func (c *EnvConfig) GetDatabaseConfig(name string) (*DatabaseConfig, error)
- func (c *EnvConfig) GetModelConfig(providerName, modelName string) (*Model, error)
- func (c *EnvConfig) GetProviderConfig(providerName string) (*Provider, error)
- func (c *EnvConfig) GetServerConfig() *ServerConfig
- func (c *EnvConfig) GetToolConfig() *ToolConfig
- func (c *EnvConfig) IsAgenticToolsAllowed() bool
- func (c *EnvConfig) ResolveConfiguredModel(modelName string) (string, *Model, error)
- func (c *EnvConfig) SetToolConfig(tool *ToolConfig)
- func (c *EnvConfig) UpdateAPIKey(providerName, apiKey string) error
- func (c *EnvConfig) UpdateModelModes(providerName, modelName string, modes []ModelMode) error
- func (c *EnvConfig) UpdateServerConfig(serverConfig ServerConfig)
- type IndexEntry
- type Model
- type ModelMode
- type OpenAICompatConfig
- type Provider
- type SecurityConfig
- type ServerConfig
- type ToolConfig
Constants ¶
This section is empty.
Variables ¶
var Debug bool
Debug indicates whether debug logging is enabled
var Verbose bool
Verbose indicates whether verbose logging is enabled
Functions ¶
func DebugLog ¶
func DebugLog(format string, args ...interface{})
DebugLog prints debug information if debug mode is enabled
func DecryptConfig ¶
DecryptConfig decrypts the configuration data
func EncryptConfig ¶
EncryptConfig encrypts the configuration file
func EnsureComandaDir ¶ added in v0.0.89
EnsureComandaDir creates the ~/.comanda directory if it doesn't exist
func EnsureLoopStateDir ¶ added in v0.0.102
EnsureLoopStateDir creates the ~/.comanda/loop-states directory if it doesn't exist
func GenerateBearerToken ¶
GenerateBearerToken generates a secure random bearer token
func GetComandaDir ¶ added in v0.0.89
GetComandaDir returns the path to the .comanda directory in the user's home
func GetEnvPath ¶
func GetEnvPath() string
GetEnvPath returns the environment file path, checking in order: 1. COMANDA_ENV environment variable (explicit override) 2. ~/.comanda/config.yaml (preferred default) 3. .env in current directory (legacy fallback)
func GetLoopStateDir ¶ added in v0.0.102
GetLoopStateDir returns the path to the loop-states directory
func GetMemoryPath ¶ added in v0.0.73
GetMemoryPath returns the memory file path by checking in order: 1. COMANDA_MEMORY environment variable 2. memory_file setting in .env config 3. COMANDA.md in current directory 4. COMANDA.md in parent directories (up to 5 levels) 5. ~/.comanda/COMANDA.md (user-level default) Returns empty string if no memory file is found
func InitializeUserMemoryFile ¶ added in v0.0.73
InitializeUserMemoryFile creates the default user-level memory file if it doesn't exist
func IsEncrypted ¶
IsEncrypted checks if the file content is encrypted
func PromptPassword ¶
PromptPassword prompts the user for a password securely
func SaveEnvConfig ¶
SaveEnvConfig saves the environment configuration to .env file
func ValidateModelMode ¶
ValidateModelMode checks if a mode is valid
func VerboseLog ¶
func VerboseLog(format string, args ...interface{})
VerboseLog prints verbose information if verbose mode is enabled
Types ¶
type CORS ¶ added in v0.0.16
type CORS struct {
Enabled bool `yaml:"enabled"`
AllowedOrigins []string `yaml:"allowedOrigins"`
AllowedMethods []string `yaml:"allowedMethods"`
AllowedHeaders []string `yaml:"allowedHeaders"`
MaxAge int `yaml:"maxAge"`
}
CORS holds Cross-Origin Resource Sharing settings
type DatabaseConfig ¶
type DatabaseConfig struct {
Type DatabaseType `yaml:"type"`
Host string `yaml:"host"`
Port int `yaml:"port"`
User string `yaml:"user"`
Password string `yaml:"password"`
Database string `yaml:"database"`
}
DatabaseConfig represents a database connection configuration
func (*DatabaseConfig) GetConnectionString ¶
func (c *DatabaseConfig) GetConnectionString() string
GetConnectionString returns a connection string for the specified database
type DatabaseType ¶
type DatabaseType string
DatabaseType represents supported database types
const (
PostgreSQL DatabaseType = "postgres"
)
type EnvConfig ¶
type EnvConfig struct {
Providers map[string]*Provider `yaml:"providers"` // Changed to store pointers to Provider
Server *ServerConfig `yaml:"server,omitempty"`
Databases map[string]DatabaseConfig `yaml:"databases,omitempty"` // Added database configurations
Tool *ToolConfig `yaml:"tool,omitempty"` // Global tool execution settings
Security *SecurityConfig `yaml:"security,omitempty"` // Global security settings
Indexes map[string]*IndexEntry `yaml:"indexes,omitempty"` // Registered codebase indexes
DefaultGenerationModel string `yaml:"default_generation_model,omitempty"`
MemoryFile string `yaml:"memory_file,omitempty"` // Path to COMANDA.md memory file
IndexEncryptionKey string `yaml:"index_encryption_key,omitempty"` // Key for encrypting codebase indexes
}
EnvConfig represents the complete environment configuration
func LoadEncryptedEnvConfig ¶
LoadEncryptedEnvConfig loads an encrypted environment configuration
func LoadEnvConfig ¶
LoadEnvConfig loads the environment configuration from .env file
func LoadEnvConfigWithPassword ¶
LoadEnvConfigWithPassword attempts to load the config, prompting for password if encrypted
func (*EnvConfig) AddDatabase ¶
func (c *EnvConfig) AddDatabase(name string, config DatabaseConfig)
AddDatabase adds or updates a database configuration
func (*EnvConfig) AddModelToProvider ¶
AddModelToProvider adds a model to a specific provider
func (*EnvConfig) AddProvider ¶
AddProvider adds or updates a provider configuration
func (*EnvConfig) GetAllConfiguredModels ¶ added in v0.0.35
GetAllConfiguredModels returns a list of all configured models across all providers
func (*EnvConfig) GetDatabaseConfig ¶
func (c *EnvConfig) GetDatabaseConfig(name string) (*DatabaseConfig, error)
GetDatabaseConfig retrieves configuration for a specific database
func (*EnvConfig) GetModelConfig ¶
GetModelConfig retrieves configuration for a specific model
func (*EnvConfig) GetProviderConfig ¶
GetProviderConfig retrieves configuration for a specific provider
func (*EnvConfig) GetServerConfig ¶
func (c *EnvConfig) GetServerConfig() *ServerConfig
GetServerConfig retrieves the server configuration
func (*EnvConfig) GetToolConfig ¶ added in v0.0.92
func (c *EnvConfig) GetToolConfig() *ToolConfig
GetToolConfig returns the global tool configuration, or nil if not set
func (*EnvConfig) IsAgenticToolsAllowed ¶ added in v0.0.99
IsAgenticToolsAllowed returns whether agentic tool use is allowed globally. When enabled (the default), agents can execute shell commands and write files within allowed_paths. Set security.allow_agentic_tools: false to disable.
func (*EnvConfig) ResolveConfiguredModel ¶ added in v0.0.178
ResolveConfiguredModel finds a configured model by its user-facing name across all providers.
func (*EnvConfig) SetToolConfig ¶ added in v0.0.92
func (c *EnvConfig) SetToolConfig(tool *ToolConfig)
SetToolConfig sets the global tool configuration
func (*EnvConfig) UpdateAPIKey ¶
UpdateAPIKey updates the API key for a specific provider
func (*EnvConfig) UpdateModelModes ¶
UpdateModelModes updates the modes for a specific model
func (*EnvConfig) UpdateServerConfig ¶
func (c *EnvConfig) UpdateServerConfig(serverConfig ServerConfig)
UpdateServerConfig updates the server configuration
type IndexEntry ¶ added in v0.0.143
type IndexEntry struct {
Path string `yaml:"path"` // Source repository path
IndexPath string `yaml:"index_path"` // Where index file is stored
LastIndexed string `yaml:"last_indexed"` // ISO8601 timestamp
ContentHash string `yaml:"content_hash"` // Hash of index content
Format string `yaml:"format"` // summary, structured, full
FileCount int `yaml:"file_count"` // Number of files indexed
SizeBytes int64 `yaml:"size_bytes"` // Size of index file
VarPrefix string `yaml:"var_prefix"` // Variable prefix for workflows
Encrypted bool `yaml:"encrypted,omitempty"` // Whether index is encrypted
Languages string `yaml:"languages,omitempty"` // Detected languages
}
IndexEntry represents a registered codebase index
type Model ¶
type Model struct {
Name string `yaml:"name"`
Target string `yaml:"target,omitempty"`
Type string `yaml:"type"`
Modes []ModelMode `yaml:"modes"`
}
Model represents a single model configuration
type ModelMode ¶
type ModelMode string
ModelMode represents the supported modes for a model
func GetSupportedModes ¶
func GetSupportedModes() []ModelMode
GetSupportedModes returns all supported model modes
type OpenAICompatConfig ¶ added in v0.0.84
type OpenAICompatConfig struct {
Enabled bool `yaml:"enabled"`
Prefix string `yaml:"prefix"` // API prefix, default: "/v1"
}
OpenAICompatConfig holds OpenAI API compatibility settings
type Provider ¶
type Provider struct {
APIKey string `yaml:"api_key"`
Models []Model `yaml:"models"`
SupportsWorktrees bool `yaml:"supports_worktrees,omitempty"`
}
Provider represents a provider's configuration
type SecurityConfig ¶ added in v0.0.99
type SecurityConfig struct {
AllowAgenticTools bool `yaml:"allow_agentic_tools"` // Allow agentic tool use in loops (default true)
}
SecurityConfig represents global security settings
type ServerConfig ¶
type ServerConfig struct {
Port int `yaml:"port"`
DataDir string `yaml:"dataDir"`
RuntimeDir string `yaml:"runtimeDir"` // Directory for runtime files like uploads and YAML processing
Enabled bool `yaml:"enabled"`
BearerToken string `yaml:"bearerToken"`
CORS CORS `yaml:"cors"`
OpenAICompat OpenAICompatConfig `yaml:"openai_compat,omitempty"`
}
ServerConfig holds configuration for the HTTP server
type ToolConfig ¶ added in v0.0.92
type ToolConfig struct {
Allowlist []string `yaml:"allowlist,omitempty"` // Additional commands to allow globally
Denylist []string `yaml:"denylist,omitempty"` // Additional commands to deny globally
Timeout int `yaml:"timeout,omitempty"` // Default timeout in seconds (0 = use system default of 30)
}
ToolConfig represents global tool execution settings