config

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package config handles loading and merging Simili configuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindConfigPath

func FindConfigPath(explicit string) string

FindConfigPath searches for a config file in standard locations.

func ParseExtendsRef

func ParseExtendsRef(ref string) (org, repo, branch, path string, err error)

ParseExtendsRef parses "org/repo@branch" into components.

Types

type AutoCloseConfig added in v0.1.7

type AutoCloseConfig struct {
	GracePeriodHours           int  `yaml:"grace_period_hours"` // Hours after labeling before auto-close (default: 72)
	GracePeriodMinutesOverride int  `yaml:"-"`                  // CLI-only override in minutes (for testing; 0 = use GracePeriodHours)
	DryRun                     bool `yaml:"dry_run,omitempty"`  // If true, log actions without executing
}

AutoCloseConfig configures the auto-close behavior for duplicate issues.

type Config

type Config struct {
	// Extends allows inheriting from a remote config (e.g., "org/repo@branch").
	Extends string `yaml:"extends,omitempty"`

	// Qdrant configures the vector database connection.
	Qdrant QdrantConfig `yaml:"qdrant"`

	// Embedding configures the embedding provider.
	Embedding EmbeddingConfig `yaml:"embedding"`

	// LLM configures the LLM provider.
	LLM LLMConfig `yaml:"llm"`

	// Workflow is a preset workflow name (e.g., "issue-triage").
	Workflow string `yaml:"workflow,omitempty"`

	// Steps is a custom list of pipeline steps (overrides workflow).
	Steps []string `yaml:"steps,omitempty"`

	// Defaults contains default behavior settings.
	Defaults DefaultsConfig `yaml:"defaults"`

	// Repositories lists the repositories this config applies to.
	Repositories []RepositoryConfig `yaml:"repositories,omitempty"`

	// Transfer configures cross-repository issue routing.
	Transfer TransferConfig `yaml:"transfer,omitempty"`

	// AutoClose configures the automatic closure of confirmed duplicate issues.
	AutoClose AutoCloseConfig `yaml:"auto_close,omitempty"`

	// BotUsers is a list of GitHub usernames whose events should be ignored
	// to prevent infinite comment loops. Built-in heuristics (e.g. "[bot]" suffix,
	// "gh-simili" prefix) always apply in addition to this list.
	BotUsers []string `yaml:"bot_users,omitempty"`
}

Config is the root configuration structure.

func Load

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

Load reads a config file from the given path and expands environment variables.

func LoadWithInheritance

func LoadWithInheritance(path string, fetcher func(ref string) ([]byte, error)) (*Config, error)

LoadWithInheritance loads a config and resolves the 'extends' chain. The fetcher function is used to retrieve remote configs.

func (*Config) Validate added in v0.1.7

func (c *Config) Validate() error

Validate ensures required configuration fields are present.

type DefaultsConfig

type DefaultsConfig struct {
	SimilarityThreshold float64 `yaml:"similarity_threshold"`
	MaxSimilarToShow    int     `yaml:"max_similar_to_show"`
	CrossRepoSearch     *bool   `yaml:"cross_repo_search,omitempty"`
}

DefaultsConfig holds default behavior settings.

type EmbeddingConfig

type EmbeddingConfig struct {
	Provider   string `yaml:"provider"`
	APIKey     string `yaml:"api_key"`
	Model      string `yaml:"model,omitempty"`
	Dimensions int    `yaml:"dimensions,omitempty"`
}

EmbeddingConfig holds embedding provider settings.

type LLMConfig added in v0.1.7

type LLMConfig struct {
	Provider    string   `yaml:"provider"`
	APIKey      string   `yaml:"api_key"`
	Model       string   `yaml:"model,omitempty"`
	Temperature *float64 `yaml:"temperature,omitempty"`
}

LLMConfig holds LLM provider settings.

type QdrantConfig

type QdrantConfig struct {
	URL        string `yaml:"url"`
	APIKey     string `yaml:"api_key"`
	Collection string `yaml:"collection"`
}

QdrantConfig holds Qdrant connection settings.

type RepositoryConfig

type RepositoryConfig struct {
	Org         string   `yaml:"org"`
	Repo        string   `yaml:"repo"`
	Description string   `yaml:"description,omitempty"` // For LLM routing
	Labels      []string `yaml:"labels,omitempty"`
	Enabled     bool     `yaml:"enabled"`
}

RepositoryConfig defines a repository and its settings.

type TransferConfig added in v0.1.0

type TransferConfig struct {
	Enabled                      *bool          `yaml:"enabled,omitempty"`
	Rules                        []TransferRule `yaml:"rules,omitempty"`
	LLMRoutingEnabled            *bool          `yaml:"llm_routing_enabled,omitempty"`
	HighConfidence               float64        `yaml:"high_confidence,omitempty"`                // Default: 0.9
	MediumConfidence             float64        `yaml:"medium_confidence,omitempty"`              // Default: 0.6
	DuplicateConfidenceThreshold float64        `yaml:"duplicate_confidence_threshold,omitempty"` // Default: 0.8
	RepoCollection               string         `yaml:"repo_collection,omitempty"`                // Collection for repository documentation
}

TransferConfig holds transfer routing settings.

type TransferRule added in v0.1.0

type TransferRule struct {
	Name          string   `yaml:"name"`
	Priority      int      `yaml:"priority,omitempty"`
	Target        string   `yaml:"target"`               // "owner/repo"
	Labels        []string `yaml:"labels,omitempty"`     // ALL must match
	LabelsAny     []string `yaml:"labels_any,omitempty"` // ANY must match
	TitleContains []string `yaml:"title_contains,omitempty"`
	BodyContains  []string `yaml:"body_contains,omitempty"`
	Author        []string `yaml:"author,omitempty"`
	Enabled       *bool    `yaml:"enabled,omitempty"`
}

TransferRule defines a rule for transferring issues to another repository.

Jump to

Keyboard shortcuts

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