Documentation
¶
Index ¶
- Variables
- func DefaultProfileName() (string, error)
- func LoadConfigFile() (configFile, error)
- func RegisterFlags(c *Config, fs *pflag.FlagSet)
- func ResolveConfig(c *Config, fs *pflag.FlagSet, opts ...ResolveOption) error
- type Automation
- type Config
- type Profile
- type PromptRef
- type ResolveOption
- type Scoring
- type SiftDefaults
- type StringList
- type Target
Constants ¶
This section is empty.
Variables ¶
var Version = "dev"
Version is the release version embedded in the binary. It defaults to "dev" for plain `go build` runs and is stamped at build time via:
go build -ldflags "-X github.com/bethropolis/sift/internal/config.Version=v1.2.0"
GoReleaser, the justfile build recipe, and scripts/install.sh all pass the current git tag this way, so no source edit is needed per release.
Functions ¶
func DefaultProfileName ¶
DefaultProfileName returns the configured default profile name, if any. The local .sift.toml takes precedence over the global config.
func LoadConfigFile ¶ added in v1.2.0
func LoadConfigFile() (configFile, error)
LoadConfigFile returns the merged global+local config file for inspection (used by `sift config show`).
func RegisterFlags ¶
RegisterFlags binds every config option to fs, using the current field values as flag defaults.
func ResolveConfig ¶ added in v1.2.0
func ResolveConfig(c *Config, fs *pflag.FlagSet, opts ...ResolveOption) error
ResolveConfig builds a resolved Config from global + local config files, profile selection, optional target and prompt ref, and the caller's FlagSet (whose Changed flags always win). It mirrors the precedence chain:
Config.New() → global [sift] → local [sift] → profile (+extends) → target → flags
Types ¶
type Automation ¶ added in v1.2.0
type Automation struct {
Watch *bool `toml:"watch"`
WatchInterval string `toml:"watch_interval"`
GitHook string `toml:"git_hook"`
HookTargets []string `toml:"hook_targets"`
}
Automation holds optional declarative automation hints.
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
UIThemeFile 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
// Target selection (named [[targets]] entry)
Target string
// Token and context settings
Budget int
TokenizeModel string
Mode string
// MaxDepth bounds dependency expansion from the selected set
// (0 = disabled, -1 = unlimited).
MaxDepth int
// Prompt is an optional task/directive section prepended to the output.
Prompt string
// Safety
SecretScan bool
ForceSecrets bool
Clipboard bool
CopyOnGenerate bool
// Version info
ShowVersion bool
Version string
}
Config holds all application configuration settings.
func (*Config) EffectiveStyle ¶
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"`
Output string `toml:"output"`
Prompt string `toml:"prompt"`
PromptFile string `toml:"prompt_file"`
SecretScan *bool `toml:"secret_scan"`
ForceSecrets *bool `toml:"force_secrets"`
IgnoreHidden *bool `toml:"ignore_hidden"`
IgnoreGit *bool `toml:"ignore_git"`
Extensions StringList `toml:"extensions"`
Ignore StringList `toml:"ignore"`
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"`
Extends []string `toml:"extends"`
}
Profile is a named set of configuration overrides loaded from TOML. Pointer fields distinguish "not set" from an explicit value.
func LoadProfile ¶
LoadProfile returns the merged profile with the given name. Global config values are applied first, then local overrides them.
type PromptRef ¶ added in v1.2.0
PromptRef holds either inline text or a file path for a prompt.
func (PromptRef) ResolvedPrompt ¶ added in v1.2.0
ResolvedPrompt returns the prompt string, reading from file if needed.
type ResolveOption ¶ added in v1.2.0
type ResolveOption func(*resolveOpts)
ResolveOption configures ResolveConfig.
func WithPromptRef ¶ added in v1.2.0
func WithPromptRef(name string) ResolveOption
WithPromptRef selects a named [prompts.NAME] entry as the prompt.
func WithTarget ¶ added in v1.2.0
func WithTarget(name string) ResolveOption
WithTarget selects a named [[targets]] entry.
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"`
TestTaskBoost float64 `toml:"test_task_boost"`
// AreaDiminishing controls marginal utility for additional files in one area.
AreaDiminishing float64 `toml:"area_diminishing"`
AreaRoots map[string]string `toml:"area_roots"`
// 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"`
// SkipRoles excludes these classified file roles from automatic selection.
// An omitted value uses the built-in test/fixture/mock/generated/vendor list.
SkipRoles []string `toml:"skip_roles"`
}
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.
type SiftDefaults ¶ added in v1.2.0
type SiftDefaults struct {
Style string `toml:"style"`
TokenizeModel string `toml:"tokenize_model"`
Budget int `toml:"budget"`
Mode string `toml:"compress_mode"`
Output string `toml:"output"`
Prompt string `toml:"prompt"`
PromptFile string `toml:"prompt_file"`
SecretScan *bool `toml:"secret_scan"`
ForceSecrets *bool `toml:"force_secrets"`
IgnoreHidden *bool `toml:"ignore_hidden"`
IgnoreGit *bool `toml:"ignore_git"`
Extensions StringList `toml:"extensions"`
Ignore StringList `toml:"ignore"`
SmartFilter *bool `toml:"smart_filter"`
SmartMaxTokens int `toml:"smart_max_tokens"`
Highlight *bool `toml:"highlight"`
NoHighlight *bool `toml:"no_highlight"`
Theme string `toml:"theme"`
UIThemeFile string `toml:"ui_theme_file"`
HighlightMaxBytes int `toml:"highlight_max_bytes"`
WindowTitle string `toml:"window_title"`
NoWindowTitle *bool `toml:"no_window_title"`
CopyOnGenerate *bool `toml:"copy_on_generate"`
Scoring *Scoring `toml:"scoring"`
}
SiftDefaults holds top-level [sift] defaults. Every field is optional; zero/nil means "use Config.New() default". Mirrors a subset of Config.
type StringList ¶ added in v1.2.0
type StringList []string
StringList is an array-of-strings TOML field. The canonical TOML form is array (e.g. extensions = ["go", "md"]). String form is intentionally not handled here — TOML extensions/ignore should always be arrays so the file stays readable and shell-escaping is avoided. Comma-separated strings are a CLI concern (Config.Extensions is a plain string joined at Apply time).
type Target ¶ added in v1.2.0
type Target struct {
Name string `toml:"name"`
Profile string `toml:"profile"`
Output string `toml:"output"`
Style string `toml:"style"`
TokenizeModel string `toml:"tokenize_model"`
Budget int `toml:"budget"`
Mode string `toml:"compress_mode"`
Prompt string `toml:"prompt"`
PromptFile string `toml:"prompt_file"`
SecretScan *bool `toml:"secret_scan"`
ForceSecrets *bool `toml:"force_secrets"`
IgnoreHidden *bool `toml:"ignore_hidden"`
IgnoreGit *bool `toml:"ignore_git"`
Extensions StringList `toml:"extensions"`
Ignore StringList `toml:"ignore"`
SmartFilter *bool `toml:"smart_filter"`
SmartMaxTokens int `toml:"smart_max_tokens"`
Scoring *Scoring `toml:"scoring"`
}
Target is one named dump artifact declared via [[targets]].