config

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: Apache-2.0 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 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"`
	OpenAIEmbedModel   string `yaml:"openai_embed_model,omitempty"`
	GenerationEndpoint string `yaml:"generation_endpoint,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) 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"`
	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