config

package
v0.51.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReviewTypeDefault  = "default"
	ReviewTypeSecurity = "security"
	ReviewTypeDesign   = "design"
)

Canonical review type names.

View Source
const DefaultMaxPromptSize = 200 * 1024

DefaultMaxPromptSize is the default maximum prompt size in bytes (200KB)

View Source
const HiddenColumnsNoneSentinel = "_"

HiddenColumnsNoneSentinel is saved to hidden_columns when the user explicitly wants all columns visible. This distinguishes "hide nothing" from "never configured" (nil/empty slice).

View Source
const SeverityThresholdMarker = "SEVERITY_THRESHOLD_MET"

SeverityThresholdMarker is output by agents when all findings in a review are below the configured minimum severity. The refine loop checks for this marker to distinguish "nothing above threshold" from "agent couldn't fix it."

Variables

This section is empty.

Functions

func AllCommitMessagesExcluded added in v0.44.0

func AllCommitMessagesExcluded(
	repoPath string, messages []string,
) bool

AllCommitMessagesExcluded reports whether every message in the slice matches at least one excluded-commit pattern. Returns false when the slice is empty or the repo has no config.

func DataDir

func DataDir() string

DataDir returns the roborev data directory. Uses ROBOREV_DATA_DIR env var if set, otherwise ~/.roborev

func FindFieldByTOMLKey added in v0.31.0

func FindFieldByTOMLKey(v reflect.Value, key string) (reflect.Value, error)

FindFieldByTOMLKey locates a struct field by its TOML tag, supporting dot notation. It never mutates the struct; nil pointer fields are resolved via a throwaway zero struct.

func FindOrCreateFieldByTOMLKey added in v0.31.0

func FindOrCreateFieldByTOMLKey(v reflect.Value, key string) (reflect.Value, error)

FindOrCreateFieldByTOMLKey is like FindFieldByTOMLKey but initializes nil pointer fields so the returned field is settable. Use this in SetConfigValue.

func GetConfigValue added in v0.31.0

func GetConfigValue(cfg any, key string) (string, error)

GetConfigValue retrieves a value from a config struct by its TOML key. Supports dot-separated keys for nested structs (e.g., "sync.enabled").

func GetDisplayName

func GetDisplayName(repoPath string) string

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

func IsBranchExcluded(repoPath, branch string) bool

IsBranchExcluded checks if a branch should be excluded from reviews

func IsCommitMessageExcluded added in v0.44.0

func IsCommitMessageExcluded(repoPath, message string) bool

IsCommitMessageExcluded checks if a commit should be excluded from reviews based on substring patterns configured in the repo's .roborev.toml.

func IsConfigParseError added in v0.33.0

func IsConfigParseError(err error) bool

IsConfigParseError reports whether err (or any error in its chain) is a ConfigParseError.

func IsConfigValueSet added in v0.31.0

func IsConfigValueSet(cfg any, key string) bool

IsConfigValueSet returns true if the field for key exists and is non-zero.

func IsDefaultReviewType added in v0.27.0

func IsDefaultReviewType(rt string) bool

IsDefaultReviewType returns true if the review type represents the standard (non-specialized) code review. The canonical name is "default"; "general" and "review" are accepted as backward-compatible aliases.

func IsGlobalKey added in v0.31.0

func IsGlobalKey(key string) bool

IsGlobalKey returns true if the key belongs to the global Config struct.

func IsKeyInTOMLFile added in v0.31.0

func IsKeyInTOMLFile(raw map[string]any, key string) bool

IsKeyInTOMLFile checks whether a dot-separated key was explicitly present in a raw TOML map (as returned by toml.Decode into map[string]interface{}). This correctly detects explicit false/0 values that IsZero would miss.

func IsMarkerOnlyOutput added in v0.51.0

func IsMarkerOnlyOutput(output string) bool

IsMarkerOnlyOutput reports whether output is essentially the SeverityThresholdMarker by itself, allowing only whitespace and minimal markdown decoration: bold (**...** or __...__), italic (*...* or _..._), a fenced code block, a leading list bullet, and an optional trailing period. Any prose or other substantive content disqualifies the output, since we cannot reliably tell chatty narration from prose findings without severity labels.

Callers that want to treat the marker as a "below threshold" signal should use this helper rather than substring matching, which is too easy to fool with marker-bearing prose findings.

func IsSensitiveKey added in v0.31.0

func IsSensitiveKey(key string) bool

IsSensitiveKey returns true if the key holds a secret that should be masked.

func IsValidKey added in v0.31.0

func IsValidKey(key string) bool

IsValidKey returns true if the key is recognized by either Config or RepoConfig.

func LoadRawGlobal added in v0.31.0

func LoadRawGlobal() (map[string]any, error)

LoadRawGlobal loads the global config file as a raw TOML map.

func LoadRawRepo added in v0.31.0

func LoadRawRepo(repoPath string) (map[string]any, error)

LoadRawRepo loads the repo config file as a raw TOML map.

func LoadRawTOML added in v0.31.0

func LoadRawTOML(path string) (map[string]any, error)

LoadRawTOML loads a TOML file as a raw map.

func MaskValue added in v0.31.0

func MaskValue(val string) string

MaskValue returns a masked version of a sensitive value, showing only the last 4 chars.

func NormalizeMinSeverity added in v0.26.0

func NormalizeMinSeverity(value string) (string, error)

NormalizeMinSeverity validates and normalizes a minimum severity level string. Returns the canonical form (critical, high, medium, low) or an error if invalid. Returns empty string (no error) for empty input.

func NormalizeReasoning added in v0.26.0

func NormalizeReasoning(value string) (string, error)

NormalizeReasoning validates and normalizes a reasoning level string. Returns the canonical form (maximum, thorough, medium, standard, fast) or an error if invalid. Returns empty string (no error) for empty input.

func ReadRoborevID

func ReadRoborevID(repoPath string) (string, error)

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

func ResolveAgent(explicit string, repoPath string, globalCfg *Config) string

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 ResolveAutoClosePassingReviews added in v0.50.0

func ResolveAutoClosePassingReviews(repoPath string, globalCfg *Config) bool

ResolveAutoClosePassingReviews returns whether passing reviews should be automatically closed. Per-repo config overrides global.

func ResolveBackupAgentForWorkflow added in v0.33.0

func ResolveBackupAgentForWorkflow(repoPath string, globalCfg *Config, workflow string) string

ResolveBackupAgentForWorkflow returns the backup agent for a workflow, or empty string if none is configured. Priority:

  1. Repo {workflow}_backup_agent
  2. Repo backup_agent (generic)
  3. Global {workflow}_backup_agent
  4. Global default_backup_agent
  5. "" (no backup)

func ResolveBackupModelForWorkflow added in v0.43.0

func ResolveBackupModelForWorkflow(repoPath string, globalCfg *Config, workflow string) string

ResolveBackupModelForWorkflow returns the backup model for a workflow, or empty string if none is configured. Priority:

  1. Repo {workflow}_backup_model
  2. Repo backup_model (generic)
  3. Global {workflow}_backup_model
  4. Global default_backup_model
  5. "" (no override — agent uses its default)

func ResolveCIAgents added in v0.50.0

func ResolveCIAgents(
	explicit string,
	repoCfg *RepoConfig,
	globalCfg *Config,
) []string

ResolveCIAgents determines which agents to use for CI review execution. Priority: explicit CSV flag > repo [ci].agents > global [ci].agents > [""].

func ResolveCIMinSeverity added in v0.50.0

func ResolveCIMinSeverity(
	explicit string,
	repoCfg *RepoConfig,
	globalCfg *Config,
) (string, error)

ResolveCIMinSeverity determines the synthesis severity filter for CI review execution. Priority: explicit > repo [ci].min_severity > global [ci].min_severity > "".

func ResolveCIReasoning added in v0.50.0

func ResolveCIReasoning(
	explicit string,
	repoCfg *RepoConfig,
	globalCfg *Config,
) (string, error)

ResolveCIReasoning determines the reasoning level for CI review execution. Priority: explicit > repo [ci].reasoning > "thorough".

func ResolveCIReviewTypes added in v0.50.0

func ResolveCIReviewTypes(
	explicit string,
	repoCfg *RepoConfig,
	globalCfg *Config,
) []string

ResolveCIReviewTypes determines which review types to use for CI review execution. Priority: explicit CSV flag > repo [ci].review_types > global [ci].review_types > ["security"].

func ResolveCISynthesisAgent added in v0.50.0

func ResolveCISynthesisAgent(
	explicit string,
	repoCfg *RepoConfig,
	globalCfg *Config,
) string

ResolveCISynthesisAgent determines the synthesis agent for CI review execution. Priority: explicit > global [ci].synthesis_agent > "".

func ResolveCIUpsertComments added in v0.50.0

func ResolveCIUpsertComments(
	repoCfg *RepoConfig,
	globalCfg *Config,
) bool

ResolveCIUpsertComments determines whether CI should update an existing PR comment. Priority: repo [ci].upsert_comments > global [ci].upsert_comments > false.

func ResolveCIWorkflowAgents added in v0.50.0

func ResolveCIWorkflowAgents(
	explicit string,
	repoCfg *RepoConfig,
	globalCfg *Config,
) []string

ResolveCIWorkflowAgents determines which agents to encode into a generated CI workflow. Priority: explicit CSV flag > repo [ci].agents > repo agent > global [ci].agents > global default_agent > ["codex"].

func ResolveExcludePatterns added in v0.47.0

func ResolveExcludePatterns(
	repoPath string, globalCfg *Config, reviewType string,
) []string

ResolveExcludePatterns returns the merged exclude patterns from repo config and global config. Repo patterns are read from the default branch (like review guidelines) to prevent untrusted branches from suppressing files in reviews. Falls back to the filesystem config only when no default branch config exists. Global patterns are appended after repo patterns (deduplicated).

Security reviews skip repo-level patterns entirely so a compromised default branch cannot suppress files from review.

func ResolveExcludePatternsLocal added in v0.47.0

func ResolveExcludePatternsLocal(
	repoPath string, globalCfg *Config, reviewType string,
) []string

ResolveExcludePatternsLocal is like ResolveExcludePatterns but reads repo config from the working tree instead of the default branch. Use this for dirty reviews where the user is reviewing local changes and expects local config to apply.

func ResolveFixMinSeverity added in v0.45.0

func ResolveFixMinSeverity(explicit string, repoPath string, globalCfg *Config) (string, error)

ResolveFixMinSeverity determines minimum severity for fix. Priority: explicit > per-repo config > global config > "" (no filter)

func ResolveFixReasoning added in v0.21.0

func ResolveFixReasoning(explicit string, repoPath string, globalCfg *Config) (string, error)

ResolveFixReasoning determines reasoning level for fix. Priority: explicit > per-repo config > global config > default (standard)

func ResolveJobTimeout

func ResolveJobTimeout(repoPath string, globalCfg *Config) int

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

func ResolveMaxPromptSize(repoPath string, globalCfg *Config) int

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

func ResolveModel(explicit string, repoPath string, globalCfg *Config) string

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 ResolvePostCommitReview added in v0.44.0

func ResolvePostCommitReview(repoPath string) string

ResolvePostCommitReview returns the post-commit review mode for a repo. Returns "branch" when configured, otherwise "commit" (the default).

func ResolveRefineMinSeverity added in v0.45.0

func ResolveRefineMinSeverity(explicit string, repoPath string, globalCfg *Config) (string, error)

ResolveRefineMinSeverity determines minimum severity for refine. Priority: explicit > per-repo config > global config > "" (no filter)

func ResolveRefineReasoning

func ResolveRefineReasoning(explicit string, repoPath string, globalCfg *Config) (string, error)

ResolveRefineReasoning determines reasoning level for refine. Priority: explicit > per-repo config > global 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 ResolveReuseReviewSession added in v0.45.0

func ResolveReuseReviewSession(repoPath string, globalCfg *Config) bool

ResolveReuseReviewSession returns whether reviews should try to resume a prior session from the same branch. Priority: repo > global > default false.

func ResolveReuseReviewSessionLookback added in v0.45.0

func ResolveReuseReviewSessionLookback(repoPath string, globalCfg *Config) int

ResolveReuseReviewSessionLookback returns how many recent reusable-session candidates should be considered. Priority: repo > global > default unlimited. Non-positive values disable the cap.

func ResolveReviewMinSeverity added in v0.51.0

func ResolveReviewMinSeverity(explicit string, repoPath string, globalCfg *Config) (string, error)

ResolveReviewMinSeverity determines minimum severity for review. Priority: explicit > per-repo config > global config > "" (no filter)

func ResolveReviewReasoning

func ResolveReviewReasoning(explicit string, repoPath string, globalCfg *Config) (string, error)

ResolveReviewReasoning determines reasoning level for reviews. Priority: explicit > per-repo config > global config > default (thorough)

func ResolveWorkflowModel added in v0.43.0

func ResolveWorkflowModel(repoPath string, globalCfg *Config, workflow, level string) string

ResolveWorkflowModel resolves a model from workflow-specific config only, skipping generic defaults (repo model, global default_model). Use this when the agent was overridden from a different source (e.g., CLI --agent) and the generic model is likely paired with a different default agent.

func SaveGlobal

func SaveGlobal(cfg *Config) error

SaveGlobal saves the global configuration

func SaveGlobalTo added in v0.45.0

func SaveGlobalTo(path string, cfg *Config) error

SaveGlobalTo saves the global configuration to a specific path.

func SaveRepoConfigTo added in v0.45.0

func SaveRepoConfigTo(path string, cfg *RepoConfig) error

SaveRepoConfigTo saves a per-repo configuration to a specific path.

func SetConfigValue added in v0.31.0

func SetConfigValue(cfg any, key string, value string) error

SetConfigValue sets a value on a config struct by its TOML key. Converts the string value to the appropriate Go type.

func SeverityInstruction added in v0.45.0

func SeverityInstruction(minSeverity string) string

SeverityInstruction returns a prompt instruction telling the agent to focus only on findings at or above minSeverity. Returns "" for empty, "low", or unrecognized input (no filtering needed).

func StricterSeverity added in v0.51.0

func StricterSeverity(a, b string) string

StricterSeverity returns whichever severity threshold is stricter (filters more). Empty string means "no filter" (least strict).

func ValidateRepoConfig added in v0.51.0

func ValidateRepoConfig(repoPath string) error

ValidateRepoConfig returns any repo-config load or parse error for repoPath. Missing repo config is treated as valid.

func ValidateReviewTypes added in v0.34.0

func ValidateReviewTypes(types []string) ([]string, error)

ValidateReviewTypes canonicalizes, validates, and deduplicates a list of review type strings. Aliases ("general", "review") are normalized to "default". Returns an error if any type is empty or unrecognized.

func ValidateRoborevID

func ValidateRoborevID(id string) string

ValidateReporevID validates the content of a .roborev-id file. Returns empty string if valid, or an error message if invalid.

Types

type ACPAgentConfig added in v0.40.0

type ACPAgentConfig struct {
	Name            string   `toml:"name"`              // Agent name (required)
	Command         string   `toml:"command"`           // ACP agent command (required)
	Args            []string `toml:"args"`              // Additional arguments for the agent
	ReadOnlyMode    string   `toml:"read_only_mode"`    // Read-only mode. Valid values depend on the underlying agent, e.g. "plan"
	AutoApproveMode string   `toml:"auto_approve_mode"` // Auto-approve mode. Valid values depend on the underlying agent, e.g. "auto-approve"
	Mode            string   `toml:"mode"`              // Default agent mode. Use read_only_mode for review flows unless explicitly opting in.
	// DisableModeNegotiation skips ACP SetSessionMode while keeping
	// authorization behavior based on agentic/read-only mode selection.
	DisableModeNegotiation bool   `toml:"disable_mode_negotiation"`
	Model                  string `toml:"model"`   // Default model to use
	Timeout                int    `toml:"timeout"` // Command timeout in seconds (default: 600)
}

ACPAgentConfig holds configuration for a single ACP agent

type AdvancedConfig added in v0.43.0

type AdvancedConfig struct {
	TasksEnabled bool `toml:"tasks_enabled" comment:"Enable the advanced Tasks workflow in the TUI."` // Enables advanced TUI tasks workflow
}

type AgentReviewType added in v0.40.0

type AgentReviewType struct {
	Agent      string
	ReviewType string
}

AgentReviewType pairs an agent name with a review type for the review matrix.

type CIConfig added in v0.26.0

type CIConfig struct {
	// Enabled enables the CI poller
	Enabled bool `toml:"enabled"`

	// PollInterval is how often to poll for PRs (e.g., "5m", "10m"). Default: 5m
	PollInterval string `toml:"poll_interval"`

	// Repos is the list of GitHub repos to poll in "owner/repo" format.
	// Supports glob patterns (e.g., "myorg/*", "myorg/api-*") using path.Match syntax.
	// The owner part must be literal — no wildcards before the "/".
	Repos []string `toml:"repos"`

	// ExcludeRepos is a list of glob patterns to exclude from the resolved repo list.
	// Applies to both exact entries and wildcard-expanded entries.
	ExcludeRepos []string `toml:"exclude_repos"`

	// MaxRepos is a safety cap on the total number of expanded repos. Default: 100.
	MaxRepos int `toml:"max_repos"`

	// ReviewTypes is the list of review types to run for each PR (e.g., ["security", "default"]).
	// Defaults to ["security"] if empty.
	ReviewTypes []string `toml:"review_types"`

	// Agents is the list of agents to run for each PR (e.g., ["codex", "gemini"]).
	// Defaults to auto-detection if empty.
	Agents []string `toml:"agents"`

	// Reviews maps agent names to review type lists. When set, replaces
	// the ReviewTypes x Agents cross-product with a granular matrix.
	// Example: {"codex": ["security", "review"], "gemini": ["review"]}
	Reviews map[string][]string `toml:"reviews"`

	// ThrottleInterval is the minimum time between reviews of the same PR.
	// If a PR was reviewed within this interval, new pushes are deferred.
	// Default: "1h". Set to "0" to disable throttling.
	ThrottleInterval string `toml:"throttle_interval"`

	// ThrottleBypassUsers is a list of GitHub usernames whose PRs
	// bypass the throttle interval and are always reviewed immediately.
	ThrottleBypassUsers []string `toml:"throttle_bypass_users"`

	// Model overrides the model for CI reviews (empty = use workflow resolution)
	Model string `toml:"model"`

	// SynthesisAgent is the agent used to synthesize multiple review outputs into one comment.
	// Defaults to the first available agent.
	SynthesisAgent string `toml:"synthesis_agent"`

	// SynthesisBackupAgent is tried when the primary synthesis
	// agent fails. Empty means no backup — failures fall through
	// to raw formatting.
	SynthesisBackupAgent string `toml:"synthesis_backup_agent"`

	// SynthesisModel overrides the model used for synthesis.
	SynthesisModel string `toml:"synthesis_model"`

	// MinSeverity filters out findings below this severity level during synthesis.
	// Valid values: critical, high, medium, low. Empty means no filter (include all).
	MinSeverity string `toml:"min_severity"`

	// UpsertComments enables updating existing PR comments instead of
	// creating new ones. When true, roborev searches for its marker
	// comment and patches it. Default: false (create a new comment each run).
	UpsertComments bool `toml:"upsert_comments"`

	// BatchTimeout is how long to wait for all batch jobs to complete before
	// posting results with available reviews. Jobs still running after this
	// timeout are canceled. Default: "3m". Set to "0" to disable.
	BatchTimeout string `toml:"batch_timeout"`

	// GitHub App authentication (optional — comments appear as bot instead of personal account)
	GitHubAppConfig
}

CIConfig holds configuration for the CI poller that watches GitHub PRs

func (*CIConfig) IsThrottleBypassed added in v0.40.0

func (c *CIConfig) IsThrottleBypassed(login string) bool

IsThrottleBypassed reports whether the given GitHub login is in the ThrottleBypassUsers list. Comparison is case-insensitive.

func (*CIConfig) ResolvedAgents added in v0.26.0

func (c *CIConfig) ResolvedAgents() []string

ResolvedAgents returns the list of agents to use. Defaults to [""] (empty = auto-detect) if empty.

func (*CIConfig) ResolvedBatchTimeout added in v0.50.0

func (c *CIConfig) ResolvedBatchTimeout() time.Duration

ResolvedBatchTimeout returns how long to wait for all batch jobs before posting early with available results. Default: 3 minutes. Returns 0 (disabled) if explicitly set to "0".

func (*CIConfig) ResolvedMaxRepos added in v0.36.0

func (c *CIConfig) ResolvedMaxRepos() int

ResolvedMaxRepos returns the maximum number of repos to poll. Defaults to 100 if not set or non-positive.

func (*CIConfig) ResolvedReviewMatrix added in v0.40.0

func (c *CIConfig) ResolvedReviewMatrix() []AgentReviewType

ResolvedReviewMatrix returns (agent, reviewType) pairs. If Reviews is set, uses it directly. Otherwise falls back to the cross-product of ResolvedAgents() x ResolvedReviewTypes().

func (*CIConfig) ResolvedReviewTypes added in v0.26.0

func (c *CIConfig) ResolvedReviewTypes() []string

ResolvedReviewTypes returns the list of review types to use. Defaults to ["security"] if empty.

func (*CIConfig) ResolvedThrottleInterval added in v0.40.0

func (c *CIConfig) ResolvedThrottleInterval() time.Duration

ResolvedThrottleInterval returns the minimum time between reviews of the same PR. Defaults to 1h if empty or unparseable. Returns 0 (disabled) if explicitly set to "0".

type Config

type Config struct {
	ServerAddr                 string `toml:"server_addr"`
	MaxWorkers                 int    `toml:"max_workers"`
	ReviewContextCount         int    `toml:"review_context_count"`
	ReuseReviewSessionLookback int    `toml:"reuse_review_session_lookback"` // 0 means no candidate cap
	DefaultAgent               string `toml:"default_agent" comment:"Default agent when no workflow-specific agent is set."`
	DefaultModel               string `toml:"default_model"` // Default model for agents (format varies by agent)
	DefaultBackupAgent         string `toml:"default_backup_agent"`
	DefaultBackupModel         string `toml:"default_backup_model"`
	JobTimeoutMinutes          int    `toml:"job_timeout_minutes"`
	ReviewReasoning            string `toml:"review_reasoning" comment:"Default reasoning level for reviews: fast, standard, medium, thorough, or maximum."`
	RefineReasoning            string `toml:"refine_reasoning" comment:"Default reasoning level for refine: fast, standard, medium, thorough, or maximum."`
	FixReasoning               string `toml:"fix_reasoning" comment:"Default reasoning level for fix: fast, standard, medium, thorough, or maximum."`

	// Workflow-specific agent/model configuration
	ReviewAgent           string `toml:"review_agent"`
	ReviewAgentFast       string `toml:"review_agent_fast"`
	ReviewAgentStandard   string `toml:"review_agent_standard"`
	ReviewAgentMedium     string `toml:"review_agent_medium"`
	ReviewAgentThorough   string `toml:"review_agent_thorough"`
	ReviewAgentMaximum    string `toml:"review_agent_maximum"`
	RefineAgent           string `toml:"refine_agent"`
	RefineAgentFast       string `toml:"refine_agent_fast"`
	RefineAgentStandard   string `toml:"refine_agent_standard"`
	RefineAgentMedium     string `toml:"refine_agent_medium"`
	RefineAgentThorough   string `toml:"refine_agent_thorough"`
	RefineAgentMaximum    string `toml:"refine_agent_maximum"`
	ReviewModel           string `toml:"review_model"`
	ReviewModelFast       string `toml:"review_model_fast"`
	ReviewModelStandard   string `toml:"review_model_standard"`
	ReviewModelMedium     string `toml:"review_model_medium"`
	ReviewModelThorough   string `toml:"review_model_thorough"`
	ReviewModelMaximum    string `toml:"review_model_maximum"`
	RefineModel           string `toml:"refine_model"`
	RefineModelFast       string `toml:"refine_model_fast"`
	RefineModelStandard   string `toml:"refine_model_standard"`
	RefineModelMedium     string `toml:"refine_model_medium"`
	RefineModelThorough   string `toml:"refine_model_thorough"`
	RefineModelMaximum    string `toml:"refine_model_maximum"`
	FixAgent              string `toml:"fix_agent"`
	FixAgentFast          string `toml:"fix_agent_fast"`
	FixAgentStandard      string `toml:"fix_agent_standard"`
	FixAgentMedium        string `toml:"fix_agent_medium"`
	FixAgentThorough      string `toml:"fix_agent_thorough"`
	FixAgentMaximum       string `toml:"fix_agent_maximum"`
	FixModel              string `toml:"fix_model"`
	FixModelFast          string `toml:"fix_model_fast"`
	FixModelStandard      string `toml:"fix_model_standard"`
	FixModelMedium        string `toml:"fix_model_medium"`
	FixModelThorough      string `toml:"fix_model_thorough"`
	FixModelMaximum       string `toml:"fix_model_maximum"`
	SecurityAgent         string `toml:"security_agent"`
	SecurityAgentFast     string `toml:"security_agent_fast"`
	SecurityAgentStandard string `toml:"security_agent_standard"`
	SecurityAgentMedium   string `toml:"security_agent_medium"`
	SecurityAgentThorough string `toml:"security_agent_thorough"`
	SecurityAgentMaximum  string `toml:"security_agent_maximum"`
	SecurityModel         string `toml:"security_model"`
	SecurityModelFast     string `toml:"security_model_fast"`
	SecurityModelStandard string `toml:"security_model_standard"`
	SecurityModelMedium   string `toml:"security_model_medium"`
	SecurityModelThorough string `toml:"security_model_thorough"`
	SecurityModelMaximum  string `toml:"security_model_maximum"`
	DesignAgent           string `toml:"design_agent"`
	DesignAgentFast       string `toml:"design_agent_fast"`
	DesignAgentStandard   string `toml:"design_agent_standard"`
	DesignAgentMedium     string `toml:"design_agent_medium"`
	DesignAgentThorough   string `toml:"design_agent_thorough"`
	DesignAgentMaximum    string `toml:"design_agent_maximum"`
	DesignModel           string `toml:"design_model"`
	DesignModelFast       string `toml:"design_model_fast"`
	DesignModelStandard   string `toml:"design_model_standard"`
	DesignModelMedium     string `toml:"design_model_medium"`
	DesignModelThorough   string `toml:"design_model_thorough"`
	DesignModelMaximum    string `toml:"design_model_maximum"`

	// Backup agents for failover
	ReviewBackupAgent   string `toml:"review_backup_agent"`
	RefineBackupAgent   string `toml:"refine_backup_agent"`
	FixBackupAgent      string `toml:"fix_backup_agent"`
	SecurityBackupAgent string `toml:"security_backup_agent"`
	DesignBackupAgent   string `toml:"design_backup_agent"`

	// Backup models for failover (used when failing over to backup agent)
	ReviewBackupModel   string `toml:"review_backup_model"`
	RefineBackupModel   string `toml:"refine_backup_model"`
	FixBackupModel      string `toml:"fix_backup_model"`
	SecurityBackupModel string `toml:"security_backup_model"`
	DesignBackupModel   string `toml:"design_backup_model"`

	// Minimum severity thresholds (global defaults)
	ReviewMinSeverity string `toml:"review_min_severity" comment:"Minimum severity for reviews: critical, high, medium, or low. Empty disables filtering."`
	RefineMinSeverity string `toml:"refine_min_severity" comment:"Minimum severity for refine: critical, high, medium, or low. Empty disables filtering."`
	FixMinSeverity    string `toml:"fix_min_severity" comment:"Minimum severity for fix: critical, high, medium, or low. Empty disables filtering."`

	AllowUnsafeAgents   *bool `toml:"allow_unsafe_agents"`   // nil = not set, allows commands to choose their own default
	DisableCodexSandbox bool  `toml:"disable_codex_sandbox"` // use --full-auto instead of --sandbox read-only (for systems where bwrap is broken)
	ReuseReviewSession  *bool `toml:"reuse_review_session"`  // nil = not set; when true, reuse prior branch review sessions when possible

	// Agent commands
	CodexCmd      string `toml:"codex_cmd"`
	ClaudeCodeCmd string `toml:"claude_code_cmd"`
	CursorCmd     string `toml:"cursor_cmd"`
	PiCmd         string `toml:"pi_cmd"`
	OpenCodeCmd   string `toml:"opencode_cmd"`

	// API keys (optional - agents use subscription auth by default)
	AnthropicAPIKey string `toml:"anthropic_api_key" sensitive:"true"`

	// Hooks configuration
	Hooks []HookConfig `toml:"hooks"`

	// Sync configuration for PostgreSQL
	Sync SyncConfig `toml:"sync"`

	// CI poller configuration
	CI CIConfig `toml:"ci"`

	// Diff exclusion patterns (filenames or glob patterns to exclude from review diffs)
	ExcludePatterns []string `toml:"exclude_patterns" comment:"Filenames or glob patterns to exclude from review diffs globally."`

	// Analysis settings
	DefaultMaxPromptSize int `toml:"default_max_prompt_size"` // Max prompt size in bytes before falling back to paths (default: 200KB)

	// Behavior
	AutoClosePassingReviews bool `toml:"auto_close_passing_reviews" comment:"Automatically close reviews that pass with no findings."`

	// UI preferences
	HideClosedByDefault    bool     `toml:"hide_closed_by_default" comment:"Hide closed reviews by default in the TUI queue."`
	HideAddressedByDefault bool     `toml:"hide_addressed_by_default"` // deprecated: use hide_closed_by_default
	AutoFilterRepo         bool     `toml:"auto_filter_repo" comment:"Automatically filter the TUI queue to the current repo."`
	AutoFilterBranch       bool     `toml:"auto_filter_branch" comment:"Automatically filter the TUI queue to the current branch."`
	MouseEnabled           bool     `toml:"mouse_enabled" comment:"Enable mouse support in the TUI."`          // Enable mouse capture and mouse-driven TUI interactions
	TabWidth               int      `toml:"tab_width"`                                                         // Tab expansion width for TUI rendering (default: 2)
	HiddenColumns          []string `toml:"hidden_columns" comment:"Queue columns to hide in the TUI."`        // Column names to hide in queue table (e.g. ["branch", "agent"])
	ColumnBorders          bool     `toml:"column_borders" comment:"Show column borders in the TUI queue."`    // Show ▕ separators between columns
	ColumnOrder            []string `toml:"column_order" comment:"Custom queue column order in the TUI."`      // Custom queue column display order
	TaskColumnOrder        []string `toml:"task_column_order" comment:"Custom Tasks column order in the TUI."` // Custom task column display order
	ColumnConfigVersion    int      `toml:"column_config_version"`                                             // Tracks column migration version to avoid re-running one-shot migrations

	// Advanced feature flags
	Advanced AdvancedConfig `toml:"advanced"`

	// ACP (Agent Client Protocol) configuration
	ACP *ACPAgentConfig `toml:"acp"`
}

Config holds the daemon configuration

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default configuration

func LoadGlobal

func LoadGlobal() (*Config, error)

LoadGlobal loads the global configuration from the default path

func LoadGlobalFrom

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

LoadGlobalFrom loads the global configuration from a specific path

type ConfigParseError added in v0.33.0

type ConfigParseError struct {
	Ref string
	Err error
}

ConfigParseError is returned when .roborev.toml exists but contains invalid TOML. Callers can check with errors.As.

func (*ConfigParseError) Error added in v0.33.0

func (e *ConfigParseError) Error() string

func (*ConfigParseError) Unwrap added in v0.33.0

func (e *ConfigParseError) Unwrap() error

type GitHubAppConfig added in v0.31.0

type GitHubAppConfig struct {
	GitHubAppID             int64  `toml:"github_app_id"`
	GitHubAppPrivateKey     string `toml:"github_app_private_key" sensitive:"true"` // PEM file path or inline; supports ${ENV_VAR}
	GitHubAppInstallationID int64  `toml:"github_app_installation_id"`

	// Multi-installation: map of owner → installation_id
	GitHubAppInstallations map[string]int64 `toml:"github_app_installations"`
}

GitHubAppConfig holds GitHub App authentication settings. Extracted from CIConfig for cohesion; embedded so TOML keys remain flat under [ci].

func (*GitHubAppConfig) GitHubAppConfigured added in v0.31.0

func (c *GitHubAppConfig) GitHubAppConfigured() bool

GitHubAppConfigured returns true if GitHub App authentication can be used. Requires app ID, private key, and at least one installation ID (singular or map).

func (*GitHubAppConfig) GitHubAppPrivateKeyResolved added in v0.31.0

func (c *GitHubAppConfig) GitHubAppPrivateKeyResolved() (string, error)

GitHubAppPrivateKeyResolved expands env vars in the private key value, reads the file if it's a path, and returns the PEM content.

func (*GitHubAppConfig) InstallationIDForOwner added in v0.31.0

func (c *GitHubAppConfig) InstallationIDForOwner(owner string) int64

InstallationIDForOwner returns the installation ID for a GitHub owner. Checks the normalized installations map first (skipping non-positive values), then falls back to the singular field. Owner comparison is case-insensitive.

func (*GitHubAppConfig) NormalizeInstallations added in v0.31.0

func (c *GitHubAppConfig) NormalizeInstallations() error

NormalizeInstallations lowercases all keys in GitHubAppInstallations so lookups are case-insensitive via direct map access. Returns an error if two keys collide after lowercasing (e.g., "wesm" and "Wesm").

type HookConfig added in v0.22.0

type HookConfig struct {
	Event   string `toml:"event"`                // "review.failed", "review.completed", "review.*"
	Command string `toml:"command"`              // shell command with {var} templates
	Type    string `toml:"type"`                 // "beads" or "webhook"; empty or "command" runs Command
	URL     string `toml:"url" sensitive:"true"` // webhook destination URL when Type is "webhook"
}

HookConfig defines a hook that runs on review events

type KeyValue added in v0.31.0

type KeyValue struct {
	Key   string
	Value string
}

KeyValue represents a config key and its value

func ListConfigKeys added in v0.31.0

func ListConfigKeys(cfg any) []KeyValue

ListConfigKeys returns all non-zero values from a config struct as key-value pairs.

func ListExplicitKeys added in v0.31.0

func ListExplicitKeys(cfg any, raw map[string]any) []KeyValue

ListExplicitKeys returns key-value pairs only for keys explicitly present in the raw TOML map. This avoids showing default values or dropping explicit zero/false/empty values.

type KeyValueOrigin added in v0.31.0

type KeyValueOrigin struct {
	Key    string
	Value  string
	Origin string // "global", "local", "default"
}

KeyValueOrigin represents a config key, its value, and where it came from

func MergedConfigWithOrigin added in v0.31.0

func MergedConfigWithOrigin(global *Config, repo *RepoConfig, rawGlobal, rawRepo map[string]any) []KeyValueOrigin

MergedConfigWithOrigin returns all effective config values with their origin. global is the loaded global config (already has defaults applied by LoadGlobal). repo is the loaded repo config (nil if no .roborev.toml). rawGlobal and rawRepo are raw TOML maps for detecting explicit presence of false/0 values. Pass nil if not available.

type RepoCIConfig added in v0.26.0

type RepoCIConfig struct {
	// Agents overrides the list of agents for CI reviews of this repo.
	Agents []string `toml:"agents" comment:"Override the agents used by CI for this repo."`

	// ReviewTypes overrides the list of review types for CI reviews of this repo.
	ReviewTypes []string `toml:"review_types" comment:"Override the review types used by CI for this repo."`

	// Reviews maps agent names to review type lists. When set, replaces
	// the ReviewTypes x Agents cross-product for this repo.
	Reviews map[string][]string `toml:"reviews" comment:"Explicit CI review matrix for this repo: agent name to review types."`

	// Reasoning overrides the reasoning level for CI reviews.
	Reasoning string `toml:"reasoning" comment:"Override the CI reasoning level for this repo: fast, standard, medium, thorough, or maximum."`

	// MinSeverity overrides the minimum severity filter for CI synthesis.
	MinSeverity string `toml:"min_severity" comment:"Override the minimum CI severity included in synthesized output."`

	// UpsertComments overrides the global ci.upsert_comments setting.
	// Use a pointer so we can distinguish "not set" from "explicitly false".
	UpsertComments *bool `toml:"upsert_comments" comment:"Override whether CI updates an existing PR comment instead of creating a new one."`
}

RepoCIConfig holds per-repo CI overrides (used by the CI poller for this repo). These override the global [ci] settings when reviewing this specific repo.

func (*RepoCIConfig) ResolvedReviewMatrix added in v0.40.0

func (c *RepoCIConfig) ResolvedReviewMatrix() []AgentReviewType

ResolvedReviewMatrixForRepo returns the review matrix for a RepoCIConfig. If Reviews is set, uses it directly. Otherwise falls back to the cross-product of Agents x ReviewTypes (which may be empty, meaning "use global").

type RepoConfig

type RepoConfig struct {
	Agent                      string   `toml:"agent" comment:"Default agent for this repo when no workflow-specific agent is set."`
	Model                      string   `toml:"model" comment:"Default model for this repo when no workflow-specific model is set."` // Model for agents (format varies by agent)
	BackupAgent                string   `toml:"backup_agent" comment:"Backup agent for this repo if the primary agent fails."`
	BackupModel                string   `toml:"backup_model" comment:"Backup model for this repo if the primary model fails."`
	ReviewContextCount         int      `toml:"review_context_count" comment:"Number of related reviews to include as context for this repo."`
	ReviewGuidelines           string   `toml:"review_guidelines" comment:"Extra review instructions added to prompts for this repo."`
	JobTimeoutMinutes          int      `toml:"job_timeout_minutes" comment:"Override the review job timeout in minutes for this repo."`
	ExcludedBranches           []string `toml:"excluded_branches" comment:"Branches that should be skipped for automatic review in this repo."`
	ExcludedCommitPatterns     []string `toml:"excluded_commit_patterns" comment:"Commit message substrings that should skip review for this repo."`
	DisplayName                string   `toml:"display_name" comment:"Display name shown for this repo in the TUI and output."`
	ReviewReasoning            string   `toml:"review_reasoning" comment:"Reasoning level for reviews in this repo: fast, standard, medium, thorough, or maximum."`
	RefineReasoning            string   `toml:"refine_reasoning" comment:"Reasoning level for refine in this repo: fast, standard, medium, thorough, or maximum."`
	FixReasoning               string   `toml:"fix_reasoning" comment:"Reasoning level for fix in this repo: fast, standard, medium, thorough, or maximum."`
	FixMinSeverity             string   `toml:"fix_min_severity" comment:"Minimum severity for fix in this repo: critical, high, medium, or low."`     // Minimum severity for fix: critical, high, medium, low
	RefineMinSeverity          string   `toml:"refine_min_severity" comment:"Minimum severity for refine in this repo: critical, high, medium, low."`  // Minimum severity for refine: critical, high, medium, low
	ReviewMinSeverity          string   `toml:"review_min_severity" comment:"Minimum severity for reviews in this repo: critical, high, medium, low."` // Minimum severity for review: critical, high, medium, low
	ExcludePatterns            []string `toml:"exclude_patterns" comment:"Filenames or glob patterns to exclude from review diffs for this repo."`
	PostCommitReview           string   `toml:"post_commit_review" comment:"Automatic post-commit review mode for this repo: commit or branch."` // "commit" (default) or "branch"
	ReuseReviewSession         *bool    `toml:"reuse_review_session"`
	ReuseReviewSessionLookback int      `toml:"reuse_review_session_lookback"` // 0 means no candidate cap

	// CI-specific overrides (used by CI poller for this repo)
	CI RepoCIConfig `toml:"ci"`

	// Workflow-specific agent/model configuration
	ReviewAgent           string `toml:"review_agent" comment:"Agent override for standard review in this repo."`
	ReviewAgentFast       string `toml:"review_agent_fast" comment:"Agent override for fast review in this repo."`
	ReviewAgentStandard   string `toml:"review_agent_standard" comment:"Agent override for standard review in this repo."`
	ReviewAgentMedium     string `toml:"review_agent_medium" comment:"Agent override for medium review in this repo."`
	ReviewAgentThorough   string `toml:"review_agent_thorough" comment:"Agent override for thorough review in this repo."`
	ReviewAgentMaximum    string `toml:"review_agent_maximum" comment:"Agent override for maximum review in this repo."`
	RefineAgent           string `toml:"refine_agent" comment:"Agent override for refine in this repo."`
	RefineAgentFast       string `toml:"refine_agent_fast" comment:"Agent override for fast refine in this repo."`
	RefineAgentStandard   string `toml:"refine_agent_standard" comment:"Agent override for standard refine in this repo."`
	RefineAgentMedium     string `toml:"refine_agent_medium" comment:"Agent override for medium refine in this repo."`
	RefineAgentThorough   string `toml:"refine_agent_thorough" comment:"Agent override for thorough refine in this repo."`
	RefineAgentMaximum    string `toml:"refine_agent_maximum" comment:"Agent override for maximum refine in this repo."`
	ReviewModel           string `toml:"review_model" comment:"Model override for standard review in this repo."`
	ReviewModelFast       string `toml:"review_model_fast" comment:"Model override for fast review in this repo."`
	ReviewModelStandard   string `toml:"review_model_standard" comment:"Model override for standard review in this repo."`
	ReviewModelMedium     string `toml:"review_model_medium" comment:"Model override for medium review in this repo."`
	ReviewModelThorough   string `toml:"review_model_thorough" comment:"Model override for thorough review in this repo."`
	ReviewModelMaximum    string `toml:"review_model_maximum" comment:"Model override for maximum review in this repo."`
	RefineModel           string `toml:"refine_model" comment:"Model override for standard refine in this repo."`
	RefineModelFast       string `toml:"refine_model_fast" comment:"Model override for fast refine in this repo."`
	RefineModelStandard   string `toml:"refine_model_standard" comment:"Model override for standard refine in this repo."`
	RefineModelMedium     string `toml:"refine_model_medium" comment:"Model override for medium refine in this repo."`
	RefineModelThorough   string `toml:"refine_model_thorough" comment:"Model override for thorough refine in this repo."`
	RefineModelMaximum    string `toml:"refine_model_maximum" comment:"Model override for maximum refine in this repo."`
	FixAgent              string `toml:"fix_agent" comment:"Agent override for fix in this repo."`
	FixAgentFast          string `toml:"fix_agent_fast" comment:"Agent override for fast fix in this repo."`
	FixAgentStandard      string `toml:"fix_agent_standard" comment:"Agent override for standard fix in this repo."`
	FixAgentMedium        string `toml:"fix_agent_medium" comment:"Agent override for medium fix in this repo."`
	FixAgentThorough      string `toml:"fix_agent_thorough" comment:"Agent override for thorough fix in this repo."`
	FixAgentMaximum       string `toml:"fix_agent_maximum" comment:"Agent override for maximum fix in this repo."`
	FixModel              string `toml:"fix_model" comment:"Model override for standard fix in this repo."`
	FixModelFast          string `toml:"fix_model_fast" comment:"Model override for fast fix in this repo."`
	FixModelStandard      string `toml:"fix_model_standard" comment:"Model override for standard fix in this repo."`
	FixModelMedium        string `toml:"fix_model_medium" comment:"Model override for medium fix in this repo."`
	FixModelThorough      string `toml:"fix_model_thorough" comment:"Model override for thorough fix in this repo."`
	FixModelMaximum       string `toml:"fix_model_maximum" comment:"Model override for maximum fix in this repo."`
	SecurityAgent         string `toml:"security_agent" comment:"Agent override for security review in this repo."`
	SecurityAgentFast     string `toml:"security_agent_fast" comment:"Agent override for fast security review in this repo."`
	SecurityAgentStandard string `toml:"security_agent_standard" comment:"Agent override for standard security review in this repo."`
	SecurityAgentMedium   string `toml:"security_agent_medium" comment:"Agent override for medium security review in this repo."`
	SecurityAgentThorough string `toml:"security_agent_thorough" comment:"Agent override for thorough security review in this repo."`
	SecurityAgentMaximum  string `toml:"security_agent_maximum" comment:"Agent override for maximum security review in this repo."`
	SecurityModel         string `toml:"security_model" comment:"Model override for standard security review in this repo."`
	SecurityModelFast     string `toml:"security_model_fast" comment:"Model override for fast security review in this repo."`
	SecurityModelStandard string `toml:"security_model_standard" comment:"Model override for standard security review in this repo."`
	SecurityModelMedium   string `toml:"security_model_medium" comment:"Model override for medium security review in this repo."`
	SecurityModelThorough string `toml:"security_model_thorough" comment:"Model override for thorough security review in this repo."`
	SecurityModelMaximum  string `toml:"security_model_maximum" comment:"Model override for maximum security review in this repo."`
	DesignAgent           string `toml:"design_agent" comment:"Agent override for design review in this repo."`
	DesignAgentFast       string `toml:"design_agent_fast" comment:"Agent override for fast design review in this repo."`
	DesignAgentStandard   string `toml:"design_agent_standard" comment:"Agent override for standard design review in this repo."`
	DesignAgentMedium     string `toml:"design_agent_medium" comment:"Agent override for medium design review in this repo."`
	DesignAgentThorough   string `toml:"design_agent_thorough" comment:"Agent override for thorough design review in this repo."`
	DesignAgentMaximum    string `toml:"design_agent_maximum" comment:"Agent override for maximum design review in this repo."`
	DesignModel           string `toml:"design_model" comment:"Model override for standard design review in this repo."`
	DesignModelFast       string `toml:"design_model_fast" comment:"Model override for fast design review in this repo."`
	DesignModelStandard   string `toml:"design_model_standard" comment:"Model override for standard design review in this repo."`
	DesignModelMedium     string `toml:"design_model_medium" comment:"Model override for medium design review in this repo."`
	DesignModelThorough   string `toml:"design_model_thorough" comment:"Model override for thorough design review in this repo."`
	DesignModelMaximum    string `toml:"design_model_maximum" comment:"Model override for maximum design review in this repo."`

	// Backup agents for failover
	ReviewBackupAgent   string `toml:"review_backup_agent" comment:"Backup agent for review in this repo."`
	RefineBackupAgent   string `toml:"refine_backup_agent" comment:"Backup agent for refine in this repo."`
	FixBackupAgent      string `toml:"fix_backup_agent" comment:"Backup agent for fix in this repo."`
	SecurityBackupAgent string `toml:"security_backup_agent" comment:"Backup agent for security review in this repo."`
	DesignBackupAgent   string `toml:"design_backup_agent" comment:"Backup agent for design review in this repo."`

	// Backup models for failover (used when failing over to backup agent)
	ReviewBackupModel   string `toml:"review_backup_model" comment:"Backup model for review in this repo."`
	RefineBackupModel   string `toml:"refine_backup_model" comment:"Backup model for refine in this repo."`
	FixBackupModel      string `toml:"fix_backup_model" comment:"Backup model for fix in this repo."`
	SecurityBackupModel string `toml:"security_backup_model" comment:"Backup model for security review in this repo."`
	DesignBackupModel   string `toml:"design_backup_model" comment:"Backup model for design review in this repo."`

	// Behavior
	AutoClosePassingReviews *bool `toml:"auto_close_passing_reviews" comment:"Automatically close reviews that pass with no findings in this repo."`

	// Hooks configuration (per-repo)
	Hooks []HookConfig `toml:"hooks"`

	// Analysis settings
	MaxPromptSize int `toml:"max_prompt_size" comment:"Maximum prompt size for this repo before falling back to file paths."` // 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

func LoadRepoConfigFromRef added in v0.33.0

func LoadRepoConfigFromRef(repoPath, ref string) (*RepoConfig, error)

LoadRepoConfigFromRef loads per-repo config from .roborev.toml at a specific git ref (e.g., a commit SHA or "origin/main"). Returns (nil, nil) if the file doesn't exist at that ref. Returns an error for unexpected git failures (bad repo, corrupted objects, etc.).

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" sensitive:"true"`

	// 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).

Jump to

Keyboard shortcuts

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