config

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GlobalConfigPath

func GlobalConfigPath() (string, error)

func ProjectConfigPath added in v0.4.7

func ProjectConfigPath(root string) string

func ResolveAPIBase

func ResolveAPIBase(cliProfile, cliAPIBase string) (string, string, string, error)

func ResolveActiveGroup

func ResolveActiveGroup(flagVal string) (string, error)

Active group resolution uses: env COMPAIR_ACTIVE_GROUP -> flag --group -> ~/.compair/active_group The flag is expected to be provided by the caller. This function reads env and active_group file.

func SaveCoreRuntime

func SaveCoreRuntime(cfg *CoreRuntime) error

func SaveProfiles

func SaveProfiles(prof *Profiles) error

func WriteActiveGroup

func WriteActiveGroup(id string) error

func WriteGlobal

func WriteGlobal(g Global) error

func WriteProjectConfig

func WriteProjectConfig(root string, cfg Project) error

Types

type CoreRuntime

type CoreRuntime struct {
	Image                             string            `yaml:"image"`
	ContainerName                     string            `yaml:"container_name"`
	DataVolume                        string            `yaml:"data_volume"`
	Port                              int               `yaml:"port"`
	AuthMode                          string            `yaml:"auth_mode"`
	GenerationProvider                string            `yaml:"generation_provider"`
	EmbeddingProvider                 string            `yaml:"embedding_provider"`
	OpenAIAPIKey                      string            `yaml:"openai_api_key,omitempty"`
	OpenAIModel                       string            `yaml:"openai_model,omitempty"`
	OpenAICodeModel                   string            `yaml:"openai_code_model,omitempty"`
	OpenAINotifModel                  string            `yaml:"openai_notif_model,omitempty"`
	OpenAIEmbedModel                  string            `yaml:"openai_embed_model,omitempty"`
	OpenAIBaseURL                     string            `yaml:"openai_base_url,omitempty"`
	NotificationScoringTimeoutS       int               `yaml:"notification_scoring_timeout_s,omitempty"`
	NotificationScoringMaxRetries     int               `yaml:"notification_scoring_max_retries,omitempty"`
	ReferenceTrace                    bool              `yaml:"reference_trace,omitempty"`
	ReferenceTraceMaxCandidates       int               `yaml:"reference_trace_max_candidates,omitempty"`
	ReferenceSourceTrace              bool              `yaml:"reference_source_trace,omitempty"`
	ReferenceSourceTraceMaxCandidates int               `yaml:"reference_source_trace_max_candidates,omitempty"`
	ReferenceHybrid                   bool              `yaml:"reference_hybrid,omitempty"`
	ReferenceAdjudicator              bool              `yaml:"reference_adjudicator,omitempty"`
	ReferenceAdjudicatorTopK          int               `yaml:"reference_adjudicator_top_k,omitempty"`
	ReferenceReranker                 bool              `yaml:"reference_reranker,omitempty"`
	ReferenceRerankerModelPath        string            `yaml:"reference_reranker_model_path,omitempty"`
	GenerationEndpoint                string            `yaml:"generation_endpoint,omitempty"`
	ExtraEnv                          map[string]string `yaml:"extra_env,omitempty"`
}

func LoadCoreRuntime

func LoadCoreRuntime() (*CoreRuntime, error)

func (*CoreRuntime) APIBase

func (c *CoreRuntime) APIBase() string

func (*CoreRuntime) ResolvedOpenAIAPIKey

func (c *CoreRuntime) ResolvedOpenAIAPIKey() string

func (*CoreRuntime) ResolvedOpenAIBaseURL added in v0.3.13

func (c *CoreRuntime) ResolvedOpenAIBaseURL() string

func (*CoreRuntime) ResolvedOpenAICodeModel added in v0.3.13

func (c *CoreRuntime) ResolvedOpenAICodeModel() string

func (*CoreRuntime) ResolvedOpenAINotifModel added in v0.3.13

func (c *CoreRuntime) ResolvedOpenAINotifModel() string

func (*CoreRuntime) UsesOpenAI

func (c *CoreRuntime) UsesOpenAI() bool

type Global

type Global struct {
	APIBase   string          `yaml:"api_base,omitempty"`
	Defaults  map[string]any  `yaml:"defaults,omitempty"`
	Telemetry TelemetryConfig `yaml:"telemetry,omitempty"`
}

Global config lives in ~/.compair/config.yaml

func ReadGlobal

func ReadGlobal() (Global, error)

type Group

type Group struct {
	ID   string `yaml:"id"`
	Name string `yaml:"name"`
}

type Profile

type Profile struct {
	APIBase  string         `yaml:"api_base"`
	Snapshot SnapshotConfig `yaml:"snapshot,omitempty"`
}

type Profiles

type Profiles struct {
	Default  string             `yaml:"default"`
	Profiles map[string]Profile `yaml:"profiles"`
}

func LoadProfiles

func LoadProfiles() (*Profiles, error)

type Project

type Project struct {
	Version     int    `yaml:"version"`
	ProjectName string `yaml:"project_name"`
	Group       Group  `yaml:"group"`
	Repos       []Repo `yaml:"repos"`
}

func ReadProjectConfig

func ReadProjectConfig(root string) (Project, error)

func (Project) JSON

func (p Project) JSON() string

Debug helper

type Repo

type Repo struct {
	Provider                         string `yaml:"provider"`
	RemoteURL                        string `yaml:"remote_url"`
	RepoID                           string `yaml:"repo_id"`
	DefaultBranch                    string `yaml:"default_branch"`
	LastSyncedCommit                 string `yaml:"last_synced_commit"`
	DocumentID                       string `yaml:"document_id"`
	Unpublished                      bool   `yaml:"unpublished,omitempty"`
	PendingTaskID                    string `yaml:"pending_task_id,omitempty"`
	PendingTaskCommit                string `yaml:"pending_task_commit,omitempty"`
	PendingTaskInitialFeedback       int    `yaml:"pending_task_initial_feedback,omitempty"`
	PendingTaskInitialFeedbackLatest string `yaml:"pending_task_initial_feedback_latest,omitempty"`
	PendingTaskStartedAt             string `yaml:"pending_task_started_at,omitempty"`
}

type SnapshotConfig

type SnapshotConfig struct {
	MaxTreeEntries int      `yaml:"max_tree_entries,omitempty"`
	MaxFiles       int      `yaml:"max_files,omitempty"`
	MaxTotalBytes  int      `yaml:"max_total_bytes,omitempty"`
	MaxFileBytes   int      `yaml:"max_file_bytes,omitempty"`
	MaxFileRead    int      `yaml:"max_file_read,omitempty"`
	IncludeGlobs   []string `yaml:"include_globs,omitempty"`
	ExcludeGlobs   []string `yaml:"exclude_globs,omitempty"`
}

type TelemetryConfig added in v0.2.1

type TelemetryConfig struct {
	Enabled         bool   `yaml:"enabled,omitempty"`
	InstallID       string `yaml:"install_id,omitempty"`
	LastHeartbeatAt string `yaml:"last_heartbeat_at,omitempty"`
}

Jump to

Keyboard shortcuts

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