Help us shape the future of Go! Take the 2026 Go Developer Survey

config

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultProfileName

func DefaultProfileName() (string, error)

DefaultProfileName returns the configured default profile name, if any. The local .sift.toml takes precedence over the global config.

func RegisterFlags

func RegisterFlags(c *Config, fs *pflag.FlagSet)

RegisterFlags binds every config option to fs, using the current field values as flag defaults.

Types

type Config

type Config struct {
	// Directory settings
	RootDir string

	// Logging settings
	Verbose     bool
	Quiet       bool
	LogLevel    string
	NoColor     bool
	UseColors   bool
	Highlight   bool
	NoHighlight bool
	Theme       string
	// UITheme is the persisted interactive picker palette. It is separate
	// from Theme, which controls syntax highlighting.
	UITheme           string
	HighlightMaxBytes int
	WindowTitle       string
	NoWindowTitle     bool
	OutputFile        string
	ShowSkipped       bool

	// Processing settings
	Concurrent    bool
	MaxWorkers    int
	MaxFileSizeMB int64
	ShowProgress  bool
	Timeout       time.Duration

	// Filtering settings
	IgnoreHidden  bool
	IgnoreGit     bool
	CustomIgnore  string
	Extensions    string
	IncludeBinary bool
	// SmartFilter skips generated/lock/minified artifacts and oversized files.
	SmartFilter    bool
	SmartMaxTokens int

	// Output format
	Style          string
	JSONOutput     bool
	MarkdownOutput bool
	// NoNerdFonts forces ASCII glyphs in the interactive picker.
	NoNerdFonts bool

	// Scoring tunes the relevance and selection optimizer. Zero fields mean
	// "use the default"; the shared engine fills them in. Values are loaded
	// from a [scoring] section and apply to both rank scoring and the utility
	// optimizer, so no tuning numbers are hardcoded outside internal/lang.
	Scoring Scoring

	// Profile selection
	Profile string

	// Token and context settings
	Budget        int
	TokenizeModel string
	Mode          string
	// Prompt is an optional task/directive section prepended to the output.
	Prompt string

	// Safety
	SecretScan   bool
	ForceSecrets bool
	Clipboard    bool

	// Version info
	ShowVersion bool
	Version     string
}

Config holds all application configuration settings.

func New

func New() *Config

New returns a Config populated with built-in defaults.

func (*Config) EffectiveStyle

func (c *Config) EffectiveStyle() string

EffectiveStyle returns the resolved output style, honoring the legacy --json and --markdown flags.

func (*Config) ResolveColors

func (c *Config) ResolveColors()

ResolveColors determines whether colored output should be used.

type Profile

type Profile struct {
	Style             string   `toml:"style"`
	TokenizeModel     string   `toml:"tokenize_model"`
	Budget            int      `toml:"budget"`
	Mode              string   `toml:"compress_mode"`
	Prompt            string   `toml:"prompt"`
	SecretScan        *bool    `toml:"secret_scan"`
	ForceSecrets      *bool    `toml:"force_secrets"`
	IgnoreHidden      *bool    `toml:"ignore_hidden"`
	IgnoreGit         *bool    `toml:"ignore_git"`
	Extensions        []string `toml:"extensions"`
	SmartFilter       *bool    `toml:"smart_filter"`
	SmartMaxTokens    int      `toml:"smart_max_tokens"`
	Highlight         *bool    `toml:"highlight"`
	NoHighlight       *bool    `toml:"no_highlight"`
	Theme             string   `toml:"theme"`
	HighlightMaxBytes int      `toml:"highlight_max_bytes"`
	WindowTitle       string   `toml:"window_title"`
	NoWindowTitle     *bool    `toml:"no_window_title"`
	Scoring           *Scoring `toml:"scoring"`
}

Profile is a named set of configuration overrides loaded from TOML. Pointer fields distinguish "not set" from an explicit value.

func LoadProfile

func LoadProfile(name string) (Profile, error)

LoadProfile returns the merged profile with the given name. Global config values are applied first, then local overrides them.

func (Profile) Apply

func (p Profile) Apply(c *Config, fs *pflag.FlagSet)

Apply overlays the profile onto c, without overriding any flag the user explicitly set on the command line.

type Scoring

type Scoring struct {
	// Composite weights for the git/role/centrality relevance score.
	RecencyWeight    float64 `toml:"recency_weight"`
	ChurnWeight      float64 `toml:"churn_weight"`
	CentralityWeight float64 `toml:"centrality_weight"`
	RoleWeight       float64 `toml:"role_weight"`
	// Mode bands for the relevance score.
	FullBand float64 `toml:"full_band"`
	SkipBand float64 `toml:"skip_band"`

	// Utility optimizer knobs.
	BaseMin         float64 `toml:"base_min"`
	BaseMax         float64 `toml:"base_max"`
	RelevanceWeight float64 `toml:"relevance_weight"`
	PreferenceBonus float64 `toml:"preference_bonus"`
	SignatureBonus  float64 `toml:"signature_bonus"`
	SkipMultiplier  float64 `toml:"skip_multiplier"`
	SigQualityMin   float64 `toml:"sig_quality_min"`
	SigQualityMax   float64 `toml:"sig_quality_max"`

	// Retention overrides per lang role name (e.g. "entrypoint", "docs").
	// An empty map leaves the lang-default retention in place; a present key
	// overrides it. Config takes priority over the default.
	Retention map[string]float64 `toml:"retention"`
}

Scoring holds the numeric tuning for the relevance ranker and the selection optimizer. Every field defaults to 0, which the consuming engine interprets as "use the built-in default". This keeps tuning values config-driven from a [scoring] TOML section while letting the defaults live once, in the engine.

func (*Scoring) Merge

func (s *Scoring) Merge(o Scoring)

Merge overlays the non-zero fields of o onto s. Pointer/zero semantics mean a profile's explicit values win while unset fields keep s's value.

Jump to

Keyboard shortcuts

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