config

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultConfigPath

func DefaultConfigPath() (string, error)

DefaultConfigPath returns ~/.config/prr/config.json

func LoadCustomInstructions

func LoadCustomInstructions() string

LoadCustomInstructions searches for a custom instructions file in the repo root and returns its contents. Returns empty string if no file is found.

Search order:

  1. .prr/instructions.md
  2. .github/prr-instructions.md

func LoadModels

func LoadModels() (map[string]ModelConfig, error)

LoadModels returns model configs by merging embedded defaults with user overrides from ~/.config/prr/models.json. If the user file doesn't exist, it is created with the embedded defaults.

func LoadPipeTargets added in v1.3.0

func LoadPipeTargets() []pipe.Target

LoadPipeTargets reads pipe targets from the config file. Returns nil (not an error) if the config doesn't exist or has no pipes configured.

func Save

func Save(cfg *Config) error

Save writes the config back to the default path, preserving any fields the user may have set manually. It re-reads the file first so that only known fields are overwritten (provider, model, parallel_reviews).

func ShouldExcludeFromReview

func ShouldExcludeFromReview(path string) bool

ShouldExcludeFromReview returns true if the given file path should be excluded from AI review based on default exclusion patterns.

Types

type Config

type Config struct {
	Provider        string        `json:"provider"` // "gemini", "anthropic", "openai"
	APIKey          string        `json:"api_key"`
	Model           string        `json:"model"`
	Theme           string        `json:"theme,omitempty"`            // UI theme ID (e.g. "catppuccin-mocha", "dracula")
	ParallelReviews int           `json:"parallel_reviews,omitempty"` // number of concurrent batch reviews (default 3)
	Pipes           []pipe.Target `json:"pipes,omitempty"`            // external process pipe targets
	Debug           bool          `json:"-"`                          // set via --debug flag, not persisted
}

Config holds the application configuration.

func Load

func Load() (*Config, error)

Load reads the config from the default path. Returns a descriptive error if the file is missing or malformed.

type ModelConfig

type ModelConfig struct {
	MaxOutputTokens int     `json:"max_output_tokens"`
	Temperature     float64 `json:"temperature"`
	ThinkingBudget  int     `json:"thinking_budget"` // 0 = thinking disabled for this model
}

ModelConfig holds per-model tuning parameters.

func GetModelConfig

func GetModelConfig(models map[string]ModelConfig, modelID string) ModelConfig

GetModelConfig returns the config for a specific model. If no exact match, returns a sensible fallback.

Jump to

Keyboard shortcuts

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