config

package
v0.0.1-alpha12 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package config handles loading and validating the config.yaml configuration.

Index

Constants

View Source
const DefaultSentryBaseURL = "https://sentry.io/api/0"

Variables

This section is empty.

Functions

func ConfigPath

func ConfigPath() (string, error)

ConfigPath returns the path to the configuration file.

func GitHubAuthConfigured

func GitHubAuthConfigured(cfg GithubConfig) bool

func GitHubAuthSource

func GitHubAuthSource(cfg GithubConfig) string

func GitLabAuthConfigured

func GitLabAuthConfigured(cfg GitlabConfig) bool

GitLabAuthConfigured reports whether GitLab authentication is available. It mirrors GitHubAuthConfigured: a token in config, a keychain reference, or the glab CLI on PATH is sufficient.

func GitLabAuthSource

func GitLabAuthSource(cfg GitlabConfig) string

GitLabAuthSource returns a human-readable label describing the active GitLab auth source ("config token", "glab cli", or "unset").

func GlobalDBPath

func GlobalDBPath() (string, error)

GlobalDBPath returns the path to the global SQLite database.

func GlobalDir

func GlobalDir() (string, error)

GlobalDir returns the path to the global Substrate directory. It respects the SUBSTRATE_HOME environment variable if set. Tilde (~) is expanded and relative paths are resolved to absolute.

func HarnessCredentialFields

func HarnessCredentialFields() map[string][]string

func HarnessFieldAllowed

func HarnessFieldAllowed(harness, key string) bool

func HasGitHubCLI

func HasGitHubCLI() bool

func HasGlabCLI

func HasGlabCLI() bool

HasGlabCLI reports whether the glab binary is on PATH.

func HasSentryCLI

func HasSentryCLI() bool

func ListSentryCLIOrganizations

func ListSentryCLIOrganizations(cfg SentryConfig) []string

ListSentryCLIOrganizations returns the slugs of all Sentry organizations accessible via the authenticated sentry CLI. Returns nil when the CLI is not available or the call fails.

func LoadSecrets

func LoadSecrets(cfg *Config, store SecretStore) error

func NormalizeProjects

func NormalizeProjects(projects []string) []string

func NormalizeSentryBaseURL

func NormalizeSentryBaseURL(raw string) string

func SaveSecrets

func SaveSecrets(cfg *Config, store SecretStore) error

func SecretKeys

func SecretKeys() map[string]string

func SentryAuthConfigured

func SentryAuthConfigured(cfg SentryConfig) bool

func SentryAuthSource

func SentryAuthSource(cfg SentryConfig) string

func SentryCLIEnvironment

func SentryCLIEnvironment(baseURL string) []string

func SentryRootURL

func SentryRootURL(raw string) string

func SessionsDir

func SessionsDir() (string, error)

SessionsDir returns the path to the sessions directory.

Types

type AdaptersConfig

type AdaptersConfig struct {
	OhMyPi     OhMyPiConfig     `yaml:"ohmypi"`
	ClaudeCode ClaudeCodeConfig `yaml:"claude_code"`
	Codex      CodexConfig      `yaml:"codex"`
	Linear     LinearConfig     `yaml:"linear"`
	Glab       GlabConfig       `yaml:"glab"`
	GitLab     GitlabConfig     `yaml:"gitlab"`
	GitHub     GithubConfig     `yaml:"github"`
	Sentry     SentryConfig     `yaml:"sentry"`
}

AdaptersConfig contains per-adapter configuration.

type ClaudeCodeConfig

type ClaudeCodeConfig struct {
	BinaryPath     string  `yaml:"binary_path"`
	Model          string  `yaml:"model"`
	PermissionMode string  `yaml:"permission_mode"`
	MaxTurns       int     `yaml:"max_turns"`
	MaxBudgetUSD   float64 `yaml:"max_budget_usd"`
}

type CodexConfig

type CodexConfig struct {
	BinaryPath   string `yaml:"binary_path"`
	Model        string `yaml:"model"`
	ApprovalMode string `yaml:"approval_mode"`
	FullAuto     bool   `yaml:"full_auto"`
	Quiet        bool   `yaml:"quiet"`
}

type CommitConfig

type CommitConfig struct {
	Strategy        CommitStrategy      `yaml:"strategy"`
	MessageFormat   CommitMessageFormat `yaml:"message_format"`
	MessageTemplate string              `yaml:"message_template"`
}

CommitConfig controls agent commit behavior.

type CommitMessageFormat

type CommitMessageFormat string

CommitMessageFormat controls the format of commit messages.

const (
	CommitMessageAIGenerated  CommitMessageFormat = "ai-generated"
	CommitMessageConventional CommitMessageFormat = "conventional"
	CommitMessageCustom       CommitMessageFormat = "custom"
)

type CommitStrategy

type CommitStrategy string

CommitStrategy controls how often agents commit during a session.

const (
	CommitStrategyGranular    CommitStrategy = "granular"
	CommitStrategySemiRegular CommitStrategy = "semi-regular"
	CommitStrategySingle      CommitStrategy = "single"
)

type Config

type Config struct {
	Commit   CommitConfig          `yaml:"commit"`
	Plan     PlanConfig            `yaml:"plan"`
	Review   ReviewConfig          `yaml:"review"`
	Harness  HarnessConfig         `yaml:"harness"`
	Adapters AdaptersConfig        `yaml:"adapters"`
	Foreman  ForemanConfig         `yaml:"foreman"`
	Repos    map[string]RepoConfig `yaml:"repos"`
}

Config is the top-level configuration loaded from config.yaml.

func Load

func Load(path string) (*Config, error)

Load reads and validates a config.yaml configuration file. Missing fields are filled with defaults before validation.

type ForemanConfig

type ForemanConfig struct {
	QuestionTimeout string `yaml:"question_timeout"`
}

ForemanConfig controls the foreman question-answering system.

type GithubConfig

type GithubConfig struct {
	TokenRef      string            `yaml:"token_ref"` // optional keychain reference; gh auth token remains fallback
	Token         string            `yaml:"-"`
	BaseURL       string            `yaml:"base_url"`      // default: https://api.github.com
	Assignee      string            `yaml:"assignee"`      // username filter for Watch; "me" resolves via /user
	PollInterval  string            `yaml:"poll_interval"` // default: 60s
	Reviewers     []string          `yaml:"reviewers"`
	Labels        []string          `yaml:"labels"`
	StateMappings map[string]string `yaml:"state_mappings"`
}

type GitlabConfig

type GitlabConfig struct {
	TokenRef      string            `yaml:"token_ref"` // keychain reference for GitLab REST API
	Token         string            `yaml:"-"`
	BaseURL       string            `yaml:"base_url"`      // default: https://gitlab.com
	Assignee      string            `yaml:"assignee"`      // username filter for Watch
	PollInterval  string            `yaml:"poll_interval"` // default: 60s
	StateMappings map[string]string `yaml:"state_mappings"`
}

type GlabConfig

type GlabConfig struct {
	// Reviewers is a list of GitLab usernames added as reviewers to created MRs.
	Reviewers []string `yaml:"reviewers"`
	// Labels is a list of GitLab label names added to created MRs.
	Labels []string `yaml:"labels"`
}

GlabConfig configures the glab CLI adapter. All fields are optional; the adapter is always registered regardless.

type HarnessConfig

type HarnessConfig struct {
	Default HarnessName        `yaml:"default"`
	Phase   HarnessPhaseConfig `yaml:"phase"`
}

type HarnessName

type HarnessName string
const (
	HarnessOhMyPi     HarnessName = "ohmypi"
	HarnessClaudeCode HarnessName = "claude-code"
	HarnessCodex      HarnessName = "codex"
)

type HarnessPhaseConfig

type HarnessPhaseConfig struct {
	Planning       HarnessName `yaml:"planning"`
	Implementation HarnessName `yaml:"implementation"`
	Review         HarnessName `yaml:"review"`
	Foreman        HarnessName `yaml:"foreman"`
}

type LinearConfig

type LinearConfig struct {
	APIKeyRef      string            `yaml:"api_key_ref"`
	APIKey         string            `yaml:"-"` //nolint:gosec // credential field name, not a hardcoded value
	TeamID         string            `yaml:"team_id"`
	AssigneeFilter string            `yaml:"assignee_filter"` // "me" or explicit user ID
	PollInterval   string            `yaml:"poll_interval"`   // e.g. "30s"; default "30s"
	StateMappings  map[string]string `yaml:"state_mappings"`  // TrackerState -> Linear workflow state UUID
}

LinearConfig configures the Linear GraphQL adapter.

type OSKeychainStore

type OSKeychainStore struct{}

func (OSKeychainStore) Delete

func (OSKeychainStore) Delete(key string) error

func (OSKeychainStore) Get

func (OSKeychainStore) Get(key string) (string, error)

func (OSKeychainStore) Set

func (OSKeychainStore) Set(key, value string) error

type OhMyPiConfig

type OhMyPiConfig struct {
	BunPath       string `yaml:"bun_path"`
	BridgePath    string `yaml:"bridge_path"`
	ThinkingLevel string `yaml:"thinking_level"`
}

OhMyPiConfig configures the oh-my-pi agent harness.

type PassThreshold

type PassThreshold string

PassThreshold controls how strict the review pipeline is.

const (
	PassThresholdNitOnly     PassThreshold = "nit_only"
	PassThresholdMinorOK     PassThreshold = "minor_ok"
	PassThresholdNoCritiques PassThreshold = "no_critiques"
)

type PlanConfig

type PlanConfig struct {
	MaxParseRetries *int `yaml:"max_parse_retries"`
}

PlanConfig controls the planning pipeline.

type RepoConfig

type RepoConfig struct {
	// DocPaths are documentation paths to include in planning context.
	DocPaths []string `yaml:"doc_paths"`
}

RepoConfig contains per-repo overrides.

type ResolvedSentryAuth

type ResolvedSentryAuth struct {
	Token        string
	BaseURL      string
	Organization string
	Projects     []string
	Source       string
	UseCLI       bool
}

func ResolveSentryAuth

func ResolveSentryAuth(ctx context.Context, cfg SentryConfig) (ResolvedSentryAuth, error)

type ResolvedSentryContext

type ResolvedSentryContext struct {
	BaseURL      string
	Organization string
	Projects     []string
}

func ResolveSentryContext

func ResolveSentryContext(cfg SentryConfig) ResolvedSentryContext

type ReviewConfig

type ReviewConfig struct {
	PassThreshold    PassThreshold `yaml:"pass_threshold"`
	MaxCycles        *int          `yaml:"max_cycles"`
	Timeout          *string       `yaml:"timeout"`
	AutoFeedbackLoop *bool         `yaml:"auto_feedback_loop"`
}

ReviewConfig controls the review pipeline.

func (ReviewConfig) ReviewTimeout

func (r ReviewConfig) ReviewTimeout() time.Duration

ReviewTimeout returns the parsed review session timeout duration. Falls back to 1 hour if parsing fails.

type SecretStore

type SecretStore interface {
	Get(key string) (string, error)
	Set(key, value string) error
	Delete(key string) error
}

type SentryConfig

type SentryConfig struct {
	TokenRef        string   `yaml:"token_ref"`
	Token           string   `yaml:"-"`
	BaseURL         string   `yaml:"base_url"`
	BaseURLExplicit bool     `yaml:"-"`
	Organization    string   `yaml:"organization"`
	Projects        []string `yaml:"projects"`
}

func (*SentryConfig) UnmarshalYAML

func (c *SentryConfig) UnmarshalYAML(value *yaml.Node) error

Jump to

Keyboard shortcuts

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