Documentation
¶
Overview ¶
Package config loads and validates gitlab-reviewer settings with the precedence flags > environment variables > settings file > defaults.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Categories = []string{"bug", "security", "performance", "docs", "style", "design"}
Categories of findings the reviewer can be asked to produce.
var Severities = []string{"info", "minor", "major", "critical"}
Severity levels a finding can carry, ordered weakest to strongest.
Functions ¶
func DefaultCacheDir ¶
func DefaultCacheDir() string
DefaultCacheDir is where repository clones and worktrees are cached.
func DefaultLogFile ¶
func DefaultLogFile() string
DefaultLogFile is the default log destination; the TUI owns stdout so logs always go to a file.
func DefaultStateDir ¶
func DefaultStateDir() string
DefaultStateDir is where logs and raw review dumps are written.
Types ¶
type Checkout ¶
type Checkout struct {
Mode string `koanf:"mode"` // clone | path | root
Path string `koanf:"path"`
Root string `koanf:"root"`
Transport string `koanf:"transport"` // https | ssh
CacheDir string `koanf:"cache_dir"`
CacheMaxMB int `koanf:"cache_max_mb"`
Keep bool `koanf:"keep"`
CloneMissing bool `koanf:"clone_missing"`
// LocalOverlay globs select untracked files in the local clone (path
// and root modes) that are copied into the review worktree — team
// standards kept out of the repo, e.g. via .git/info/exclude.
LocalOverlay []string `koanf:"local_overlay"`
}
type Config ¶
type Config struct {
GitLab GitLab `koanf:"gitlab"`
Review Review `koanf:"review"`
Bedrock Bedrock `koanf:"bedrock"`
Checkout Checkout `koanf:"checkout"`
Publish Publish `koanf:"publish"`
Log Log `koanf:"log"`
}
func Default ¶
func Default() Config
Default returns the built-in defaults, the lowest-precedence layer.
func (Config) Validate ¶
Validate checks internal consistency. It does not require a GitLab token; commands that talk to GitLab must additionally call ValidateGitLab.
func (Config) ValidateGitLab ¶
ValidateGitLab checks settings required to talk to GitLab at all. An empty project/group scope is fine: the TUI offers in-app selection.
type Options ¶
type Options struct {
// File is an explicit settings file path (--config). Empty = default
// XDG location, which is allowed to be absent.
File string
// Flags is the parsed flag set; nil skips the flag layer.
Flags *pflag.FlagSet
// LookupEnv overrides os.LookupEnv in tests.
LookupEnv func(string) (string, bool)
}
Options control loading; zero value means real environment and default paths.
type Result ¶
type Result struct {
Config Config
// FilePath is the settings file that was read, "" if none existed.
FilePath string
// contains filtered or unexported fields
}
Result is a loaded configuration plus the merged koanf tree, kept so per-project overrides can be applied later.
func (*Result) ForProject ¶
ForProject returns the configuration with per-project overrides from the settings file's projects.<full/project/path> section merged over the review, checkout, and publish sections.
type Review ¶
type Review struct {
Provider string `koanf:"provider"` // anthropic | bedrock
Model string `koanf:"model"`
ClaudePath string `koanf:"claude_path"`
Timeout time.Duration `koanf:"timeout"`
MaxBudgetUSD float64 `koanf:"max_budget_usd"`
Categories []string `koanf:"categories"`
Instructions string `koanf:"instructions"`
InstructionsFile string `koanf:"instructions_file"`
MaxDiffKB int `koanf:"max_diff_kb"`
Exclude []string `koanf:"exclude"`
Bare bool `koanf:"bare"`
// UseAgents lets the reviewer delegate to Claude Code subagents
// (project .claude/agents plus user-level ones). Write/exec tools
// stay denied for the whole session, subagents included.
UseAgents bool `koanf:"use_agents"`
Env map[string]string `koanf:"env"`
}