Documentation
¶
Index ¶
- func DataDir() string
- func GetDisplayName(repoPath string) string
- func GlobalConfigPath() string
- func IsBranchExcluded(repoPath, branch string) bool
- func ReadRoborevID(repoPath string) (string, error)
- func ResolveAgent(explicit string, repoPath string, globalCfg *Config) string
- func ResolveJobTimeout(repoPath string, globalCfg *Config) int
- func ResolveModel(explicit string, repoPath string, globalCfg *Config) string
- func ResolveRefineReasoning(explicit string, repoPath string) (string, error)
- func ResolveRepoIdentity(repoPath string, getRemoteURL func(repoPath, remoteName string) string) string
- func ResolveReviewReasoning(explicit string, repoPath string) (string, error)
- func SaveGlobal(cfg *Config) error
- func ValidateRoborevID(id string) string
- type Config
- type RepoConfig
- type SyncConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DataDir ¶
func DataDir() string
DataDir returns the roborev data directory. Uses ROBOREV_DATA_DIR env var if set, otherwise ~/.roborev
func GetDisplayName ¶
GetDisplayName returns the display name for a repo, or empty if not set
func GlobalConfigPath ¶
func GlobalConfigPath() string
GlobalConfigPath returns the path to the global config file
func IsBranchExcluded ¶
IsBranchExcluded checks if a branch should be excluded from reviews
func ReadRoborevID ¶
ReadRoborevID reads and validates the .roborev-id file from a repo. Returns the ID if valid, empty string if file doesn't exist or is invalid. If invalid, the error describes why.
func ResolveAgent ¶
ResolveAgent determines which agent to use based on config priority: 1. Explicit agent parameter (if non-empty) 2. Per-repo config 3. Global config 4. Default ("codex")
func ResolveJobTimeout ¶
ResolveJobTimeout determines job timeout based on config priority: 1. Per-repo config (if set and > 0) 2. Global config (if set and > 0) 3. Default (30 minutes)
func ResolveModel ¶ added in v0.17.0
ResolveModel determines which model to use based on config priority: 1. Explicit model parameter (if non-empty) 2. Per-repo config (model in .roborev.toml) 3. Global config (default_model in config.toml) 4. Default (empty string, agent uses its default)
func ResolveRefineReasoning ¶
ResolveRefineReasoning determines reasoning level for refine. Priority: explicit > per-repo config > default (standard)
func ResolveRepoIdentity ¶
func ResolveRepoIdentity(repoPath string, getRemoteURL func(repoPath, remoteName string) string) string
ResolveRepoIdentity determines the unique identity for a repository. Resolution order: 1. .roborev-id file in repo root (if exists and valid) 2. Git remote "origin" URL 3. Any git remote URL 4. Fallback: local://{absolute_path}
Note: Credentials are stripped from git remote URLs to prevent secrets from being persisted in the database or synced to PostgreSQL.
The getRemoteURL parameter allows injection of git remote lookup for testing. Pass nil to use the default git.GetRemoteURL function.
func ResolveReviewReasoning ¶
ResolveReviewReasoning determines reasoning level for reviews. Priority: explicit > per-repo config > default (thorough)
func ValidateRoborevID ¶
ValidateReporevID validates the content of a .roborev-id file. Returns empty string if valid, or an error message if invalid.
Types ¶
type Config ¶
type Config struct {
ServerAddr string `toml:"server_addr"`
MaxWorkers int `toml:"max_workers"`
ReviewContextCount int `toml:"review_context_count"`
DefaultAgent string `toml:"default_agent"`
DefaultModel string `toml:"default_model"` // Default model for agents (format varies by agent)
JobTimeoutMinutes int `toml:"job_timeout_minutes"`
AllowUnsafeAgents *bool `toml:"allow_unsafe_agents"` // nil = not set, allows commands to choose their own default
// Agent commands
CodexCmd string `toml:"codex_cmd"`
ClaudeCodeCmd string `toml:"claude_code_cmd"`
// API keys (optional - agents use subscription auth by default)
AnthropicAPIKey string `toml:"anthropic_api_key"`
// Sync configuration for PostgreSQL
Sync SyncConfig `toml:"sync"`
}
Config holds the daemon configuration
func LoadGlobal ¶
LoadGlobal loads the global configuration from the default path
func LoadGlobalFrom ¶
LoadGlobalFrom loads the global configuration from a specific path
type RepoConfig ¶
type RepoConfig struct {
Agent string `toml:"agent"`
Model string `toml:"model"` // Model for agents (format varies by agent)
ReviewContextCount int `toml:"review_context_count"`
ReviewGuidelines string `toml:"review_guidelines"`
JobTimeoutMinutes int `toml:"job_timeout_minutes"`
ExcludedBranches []string `toml:"excluded_branches"`
DisplayName string `toml:"display_name"`
ReviewReasoning string `toml:"review_reasoning"` // Reasoning level for reviews: thorough, standard, fast
RefineReasoning string `toml:"refine_reasoning"` // Reasoning level for refine: thorough, standard, fast
}
RepoConfig holds per-repo overrides
func LoadRepoConfig ¶
func LoadRepoConfig(repoPath string) (*RepoConfig, error)
LoadRepoConfig loads per-repo config from .roborev.toml
type SyncConfig ¶
type SyncConfig struct {
// Enabled enables sync to PostgreSQL
Enabled bool `toml:"enabled"`
// PostgresURL is the connection string for PostgreSQL.
// Supports environment variable expansion via ${VAR} syntax.
PostgresURL string `toml:"postgres_url"`
// Interval is how often to sync (e.g., "5m", "1h"). Default: 1h
Interval string `toml:"interval"`
// MachineName is a friendly name for this machine (optional)
MachineName string `toml:"machine_name"`
// ConnectTimeout is the connection timeout (e.g., "5s"). Default: 5s
ConnectTimeout string `toml:"connect_timeout"`
// RepoNames provides custom display names for synced repos by identity.
// Example: {"git@github.com:org/repo.git": "my-project"}
RepoNames map[string]string `toml:"repo_names"`
}
SyncConfig holds configuration for PostgreSQL sync
func (*SyncConfig) GetRepoDisplayName ¶ added in v0.18.0
func (c *SyncConfig) GetRepoDisplayName(identity string) string
GetRepoDisplayName returns the configured display name for a repo identity, or empty string if no override is configured.
func (*SyncConfig) PostgresURLExpanded ¶
func (c *SyncConfig) PostgresURLExpanded() string
PostgresURLExpanded returns the PostgreSQL URL with environment variables expanded. Returns empty string if URL is not set.
func (*SyncConfig) Validate ¶
func (c *SyncConfig) Validate() []string
Validate checks the sync configuration for common issues. Returns a list of warnings (non-fatal issues).