config

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: May 16, 2026 License: Apache-2.0 Imports: 6 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 ClaudeCodeConfig added in v0.2.1

type ClaudeCodeConfig struct {
	Enabled         *bool                     `yaml:"enabled,omitempty"`
	TriggerPhrase   string                    `yaml:"trigger_phrase,omitempty"` // Default: "@simili-bot"
	IssueImplement  ClaudeCodeIssueImplement  `yaml:"issue_implement,omitempty"`
	DocSync         ClaudeCodeDocSync         `yaml:"doc_sync,omitempty"`
	SecurityReview  ClaudeCodeSecurityReview  `yaml:"security_review,omitempty"`
	ReviewChecklist ClaudeCodeReviewChecklist `yaml:"review_checklist,omitempty"`
	Maintenance     ClaudeCodeMaintenance     `yaml:"maintenance,omitempty"`
}

ClaudeCodeConfig holds all Claude Code integration settings.

type ClaudeCodeDocSync added in v0.2.1

type ClaudeCodeDocSync struct {
	Enabled    *bool    `yaml:"enabled,omitempty"`
	WatchPaths []string `yaml:"watch_paths,omitempty"` // Glob patterns for source paths to watch
	DocPaths   []string `yaml:"doc_paths,omitempty"`   // Paths to documentation files
}

ClaudeCodeDocSync configures automatic documentation updates.

type ClaudeCodeIssueImplement added in v0.2.1

type ClaudeCodeIssueImplement struct {
	Enabled      *bool  `yaml:"enabled,omitempty"`
	TriggerLabel string `yaml:"trigger_label,omitempty"` // Default: "implement"
	BaseBranch   string `yaml:"base_branch,omitempty"`   // Default: "main"
}

ClaudeCodeIssueImplement configures label-triggered issue implementation.

type ClaudeCodeMaintenance added in v0.2.1

type ClaudeCodeMaintenance struct {
	Enabled *bool    `yaml:"enabled,omitempty"`
	Tasks   []string `yaml:"tasks,omitempty"` // Maintenance task descriptions
}

ClaudeCodeMaintenance configures scheduled maintenance tasks.

type ClaudeCodeReviewChecklist added in v0.2.1

type ClaudeCodeReviewChecklist struct {
	Enabled      *bool    `yaml:"enabled,omitempty"`
	TriggerLabel string   `yaml:"trigger_label,omitempty"` // Default: "review-checklist"
	Items        []string `yaml:"items,omitempty"`         // Checklist items
}

ClaudeCodeReviewChecklist configures custom PR review checklists.

type ClaudeCodeSecurityReview added in v0.2.1

type ClaudeCodeSecurityReview struct {
	Enabled      *bool  `yaml:"enabled,omitempty"`
	TriggerLabel string `yaml:"trigger_label,omitempty"` // Default: "security-review"
}

ClaudeCodeSecurityReview configures selective security analysis.

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"`

	// ClaudeCode configures Claude Code integration features.
	ClaudeCode ClaudeCodeConfig `yaml:"claude_code,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"`

	// Search configures the similarity search backend.
	Search SearchConfig `yaml:"search,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) ApplyDefaults added in v0.2.1

func (c *Config) ApplyDefaults()

applyDefaults sets default values for unset fields. ApplyDefaults sets sensible defaults for unset configuration fields. This is called automatically by Load and LoadWithInheritance, but callers constructing a Config{} directly (e.g. fallback when no config file exists) should call this explicitly.

func (*Config) Validate added in v0.1.7

func (c *Config) Validate() error

Validate ensures required configuration fields are present. Note: llm.api_key is intentionally not required here — the process command falls back to embedding.api_key when llm.api_key is unset, so rejecting the entire config (and losing qdrant.collection) would be worse than proceeding.

type DefaultsConfig

type DefaultsConfig struct {
	SimilarityThreshold float64 `yaml:"similarity_threshold"`
	MaxSimilarToShow    int     `yaml:"max_similar_to_show"`
	CrossRepoSearch     *bool   `yaml:"cross_repo_search,omitempty"`
	// DuplicateCandidates is the maximum number of similar issues sent to the LLM
	// for duplicate/relation analysis. Default: 5.
	DuplicateCandidates int `yaml:"duplicate_candidates,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"`
	PRCollection string `yaml:"pr_collection"` // Optional — no dedicated PR indexing if empty
}

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 SearchConfig added in v0.2.1

type SearchConfig struct {
	// Backend selects the search implementation: "qdrant" | "github_native" | "bm25".
	Backend string `yaml:"backend,omitempty"`
	// BM25Fallback enables automatic fallback to in-process BM25 when the
	// GitHub hybrid search API returns no results or is rate-limited.
	BM25Fallback *bool `yaml:"bm25_fallback,omitempty"`
}

SearchConfig selects the similarity search backend. "qdrant" (default) preserves existing behaviour; "github_native" and "bm25" require no external VDB or embedding API key.

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
	VDBRouting                   VDBRoutingConfig `yaml:"vdb_routing,omitempty"`
	Strategy                     string           `yaml:"strategy,omitempty"` // "rules-only", "vdb-only", "hybrid" (default: "hybrid" when vdb_routing.enabled)
}

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.

type VDBRoutingConfig added in v0.2.1

type VDBRoutingConfig struct {
	Enabled             *bool   `yaml:"enabled,omitempty"`
	ConfidenceThreshold float64 `yaml:"confidence_threshold,omitempty"` // Default: 0.75
	MinSamplesPerRepo   int     `yaml:"min_samples_per_repo,omitempty"` // Default: 20
	MaxCandidates       int     `yaml:"max_candidates,omitempty"`       // Default: 3
	ExplainDecision     bool    `yaml:"explain_decision,omitempty"`     // Default: true
}

VDBRoutingConfig configures VDB-based semantic transfer routing.

Jump to

Keyboard shortcuts

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