Documentation
¶
Overview ¶
Package config loads the cascading YAML config that drives local-review.
Cascade (lowest precedence first):
- Built-in defaults (compiled in)
- Org config (optional URL, fetched + cached) -- v1: stub, see TODO
- ~/.local-review.yml (per-user)
- .local-review.yml (project root) (per-repo)
- CLI flags (per-invocation)
Each layer is a partial YAML; later layers shallow-merge over earlier ones.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindRepoConfig ¶
FindRepoConfig walks up from start looking for a .local-review.yml. Returns "" when none is found (not an error).
Types ¶
type Config ¶
type Config struct {
Provider Provider `yaml:"provider"` // v0: single-LLM API mode
Review Review `yaml:"review"`
Org Org `yaml:"org"`
// v0.1: multi-LLM support
LLMs map[string]LLMConfig `yaml:"llms"`
Merge MergeConfig `yaml:"merge"`
Storage StorageConfig `yaml:"storage"`
// v0.8: prompt-pack customization (issue #55). Lets teams ship
// their own house rules without forking the binary.
Prompts PromptsConfig `yaml:"prompts"`
}
Config is the resolved (post-cascade) configuration.
func Load ¶
Load resolves the cascade.
repoConfigPath is the path to the project-level .local-review.yml (typically found by walking up from cwd). Either path may be empty / missing.
type LLMConfig ¶
type LLMConfig struct {
Enabled *bool `yaml:"enabled"`
CLIPath string `yaml:"cli_path"` // path to CLI binary (auto-detect if empty)
Model string `yaml:"model"` // model name passed to the agent CLI
APIKeyEnv string `yaml:"api_key_env"` // env var name for API key
APIKey string `yaml:"api_key"` // DEPRECATED: use environment variable instead
TimeoutSec int `yaml:"timeout_seconds"` // per-call timeout
}
LLMConfig holds configuration for a single LLM (v0.1+).
Note: a `mode: cli|api` field shipped in v0.1's example config but was never wired through to the orchestrator (multi-LLM always invokes via CLI). It was removed in v0.5.x. Existing YAML configs with a `mode:` line still load — yaml.v3 silently ignores unknown fields. The "API fallback when CLI auth fails" idea is parked in do-not-merge/v06-fully-local-ollama-preset.md.
type MergeConfig ¶
type MergeConfig struct {
PreferredLLM string `yaml:"preferred_llm"` // "auto" or specific LLM name
Deduplicate *bool `yaml:"deduplicate"` // remove duplicate findings
ConsensusThreshold int `yaml:"consensus_threshold"` // N LLMs agreeing = "Confirmed by N"
}
MergeConfig controls how multi-LLM reviews are merged (v0.1+).
type Org ¶
type Org struct {
ConfigURL string `yaml:"config_url"`
}
Org is reserved for org-wide config delivery (v1: stub).
type PromptsConfig ¶ added in v0.8.0
type PromptsConfig struct {
PackDir string `yaml:"pack_dir"` // directory of override <language>.md files
Prepend string `yaml:"prepend"` // text spliced BEFORE the pack body
Append string `yaml:"append"` // text spliced AFTER the pack body
}
PromptsConfig customises the language prompt packs the binary ships with. Issue #55: teams want to tune review tone, severity bar, or add house rules without forking. Three knobs, all optional, all composable:
- PackDir: directory of override files keyed by language id. A `go.md` in this directory replaces the embedded `go.md`. Files not present fall through to the embedded pack of the same name.
- Prepend / Append: free-form text spliced before/after whatever pack content was loaded. Survives an upstream pack update — the prepend/append text is yours, the pack body keeps tracking upstream improvements.
All three apply to BOTH the single-LLM fallback path AND the per-LLM CLI invocations (claude/gemini/codex), so a team's house rules reach every reviewer.
type Provider ¶
type Provider struct {
BaseURL string `yaml:"base_url"` // e.g. https://api.openai.com/v1
Model string `yaml:"model"` // e.g. gpt-4o, claude-3-5-sonnet
APIKey string `yaml:"api_key"` // DEPRECATED: use environment variable instead
APIKeyEnv string `yaml:"api_key_env"` // env var name to read; defaults to LOCAL_REVIEW_API_KEY
TimeoutSec int `yaml:"timeout_seconds"` // per-call timeout, default 60
}
Provider holds LLM endpoint settings. Defaults to OpenAI; any OpenAI-compatible endpoint works (Anthropic via /v1/chat/completions, Together, Groq, OpenRouter, Ollama, vLLM, etc.).
type Review ¶
type Review struct {
MinSeverity string `yaml:"min_severity"` // "nit"|"info"|"warning"|"major"|"critical"
MaxFindings int `yaml:"max_findings"` // hard cap to avoid noise
IncludeGlobs []string `yaml:"include"` // file globs to consider
ExcludeGlobs []string `yaml:"exclude"` // file globs to drop
PromptPack string `yaml:"prompt_pack"` // override auto-detection
}
Review holds tuning knobs for what gets surfaced.
type StorageConfig ¶
type StorageConfig struct {
BasePath string `yaml:"base_path"` // base directory for reviews
}
StorageConfig controls where reviews are saved (v0.1+).