Documentation
¶
Index ¶
- Constants
- 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 ResolveAgentForWorkflow(cli, repoPath string, globalCfg *Config, workflow, level string) string
- func ResolveJobTimeout(repoPath string, globalCfg *Config) int
- func ResolveMaxPromptSize(repoPath string, globalCfg *Config) int
- func ResolveModel(explicit string, repoPath string, globalCfg *Config) string
- func ResolveModelForWorkflow(cli, repoPath string, globalCfg *Config, workflow, level string) 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 ¶
const DefaultMaxPromptSize = 200 * 1024
DefaultMaxPromptSize is the default maximum prompt size in bytes (200KB)
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 ResolveAgentForWorkflow ¶ added in v0.19.0
func ResolveAgentForWorkflow(cli, repoPath string, globalCfg *Config, workflow, level string) string
ResolveAgentForWorkflow determines which agent to use based on workflow and level. Priority (Option A - layer wins first, then specificity): 1. CLI explicit 2. Repo {workflow}_agent_{level} 3. Repo {workflow}_agent 4. Repo agent 5. Global {workflow}_agent_{level} 6. Global {workflow}_agent 7. Global default_agent 8. "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 ResolveMaxPromptSize ¶ added in v0.20.0
ResolveMaxPromptSize determines the maximum prompt size based on config priority: 1. Per-repo config (max_prompt_size in .roborev.toml) 2. Global config (default_max_prompt_size in config.toml) 3. Default (200KB)
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 ResolveModelForWorkflow ¶ added in v0.19.0
func ResolveModelForWorkflow(cli, repoPath string, globalCfg *Config, workflow, level string) string
ResolveModelForWorkflow determines which model to use based on workflow and level. Same priority as ResolveAgentForWorkflow, but returns empty string as 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"`
// Workflow-specific agent/model configuration
ReviewAgent string `toml:"review_agent"`
ReviewAgentFast string `toml:"review_agent_fast"`
ReviewAgentStandard string `toml:"review_agent_standard"`
ReviewAgentThorough string `toml:"review_agent_thorough"`
RefineAgent string `toml:"refine_agent"`
RefineAgentFast string `toml:"refine_agent_fast"`
RefineAgentStandard string `toml:"refine_agent_standard"`
RefineAgentThorough string `toml:"refine_agent_thorough"`
ReviewModel string `toml:"review_model"`
ReviewModelFast string `toml:"review_model_fast"`
ReviewModelStandard string `toml:"review_model_standard"`
ReviewModelThorough string `toml:"review_model_thorough"`
RefineModel string `toml:"refine_model"`
RefineModelFast string `toml:"refine_model_fast"`
RefineModelStandard string `toml:"refine_model_standard"`
RefineModelThorough string `toml:"refine_model_thorough"`
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"`
// Analysis settings
DefaultMaxPromptSize int `toml:"default_max_prompt_size"` // Max prompt size in bytes before falling back to paths (default: 200KB)
}
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
// Workflow-specific agent/model configuration
ReviewAgent string `toml:"review_agent"`
ReviewAgentFast string `toml:"review_agent_fast"`
ReviewAgentStandard string `toml:"review_agent_standard"`
ReviewAgentThorough string `toml:"review_agent_thorough"`
RefineAgent string `toml:"refine_agent"`
RefineAgentFast string `toml:"refine_agent_fast"`
RefineAgentStandard string `toml:"refine_agent_standard"`
RefineAgentThorough string `toml:"refine_agent_thorough"`
ReviewModel string `toml:"review_model"`
ReviewModelFast string `toml:"review_model_fast"`
ReviewModelStandard string `toml:"review_model_standard"`
ReviewModelThorough string `toml:"review_model_thorough"`
RefineModel string `toml:"refine_model"`
RefineModelFast string `toml:"refine_model_fast"`
RefineModelStandard string `toml:"refine_model_standard"`
RefineModelThorough string `toml:"refine_model_thorough"`
// Analysis settings
MaxPromptSize int `toml:"max_prompt_size"` // Max prompt size in bytes before falling back to paths (overrides global default)
}
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).