Documentation
¶
Overview ¶
Package config loads graphmaster settings. Layers are applied in order defaults < user (~/.config/graphmaster/config.toml) < project (<root>/.graphmaster/config.toml) < environment (GRAPHMASTER_*); a later layer overrides only the keys it sets.
Index ¶
Constants ¶
const ( EnvMode = "GRAPHMASTER_MODE" EnvMaxFileSize = "GRAPHMASTER_MAX_FILE_SIZE" EnvExcludes = "GRAPHMASTER_EXCLUDES" // replaces excludes EnvExtraExcludes = "GRAPHMASTER_EXTRA_EXCLUDES" // appended to extra_excludes EnvLanguages = "GRAPHMASTER_LANGUAGES" EnvSoftBudget = "GRAPHMASTER_SOFT_BUDGET" // EnvTimeoutPrefix + upper-cased timeout key, e.g. GRAPHMASTER_TIMEOUT_PRE_TOOL_USE. EnvTimeoutPrefix = "GRAPHMASTER_TIMEOUT_" )
Environment variables. Lists are comma-separated.
Variables ¶
This section is empty.
Functions ¶
func ProjectConfigPath ¶
ProjectConfigPath returns <root>/.graphmaster/config.toml.
Types ¶
type ByteSize ¶
type ByteSize int64
ByteSize is a size in bytes. In TOML it is either an integer or a string with a unit: B, KB/MB/GB/TB (powers of 1000) or KiB/MiB/GiB/TiB (powers of 1024), case-insensitive.
func (ByteSize) MarshalText ¶
MarshalText renders exact binary multiples with a unit, else plain bytes.
func (*ByteSize) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
type Config ¶
type Config struct {
Mode Mode `toml:"mode"`
MaxFileSize ByteSize `toml:"max_file_size"`
// Excludes replaces the default exclude list (gitignore syntax).
Excludes []string `toml:"excludes"`
// ExtraExcludes accumulates across layers on top of Excludes.
ExtraExcludes []string `toml:"extra_excludes"`
// Languages lists enabled language names; empty means all.
Languages []string `toml:"languages"`
SoftBudget int `toml:"soft_budget"` // balanced-mode denies per (session, agent)
Timeouts Timeouts `toml:"timeouts"`
// Sources lists the layers that contributed (file paths and/or "env").
Sources []string `toml:"-"`
// Warnings collects non-fatal problems such as unknown keys.
Warnings []string `toml:"-"`
}
Config is the effective configuration.
func Load ¶
Load loads the configuration for the repository at root using the real environment. On error callers should fall back to Default (fail-open).
func (*Config) AllExcludes ¶
AllExcludes returns Excludes followed by ExtraExcludes, deduplicated.
func (*Config) EnabledLangs ¶
EnabledLangs returns the enabled languages in model order. Unknown names are skipped (Validate reports them).
func (*Config) LangEnabled ¶
LangEnabled reports whether l is enabled.
type Duration ¶
Duration is a time.Duration that (un)marshals as a Go duration string such as "1.5s" or "750ms".
func (Duration) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (*Duration) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
type Mode ¶
type Mode string
Mode is the steering mode.
const ( ModeStrict Mode = "strict" // deny every code-scoped grep/glob ModeBalanced Mode = "balanced" // deny first symbol-like grep, then allow ModeOff Mode = "off" // never steer )
Steering modes.
func (*Mode) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler with validation.
type Options ¶
type Options struct {
// Root is the repository root; "" skips the project layer.
Root string
// UserPath overrides the user config file location.
UserPath string
// LookupEnv defaults to os.LookupEnv.
LookupEnv func(string) (string, bool)
}
Options controls Load. Zero values use the real environment.
type Timeouts ¶
type Timeouts struct {
MCP Duration `toml:"mcp"`
PreToolUse Duration `toml:"pre_tool_use"`
PostToolUse Duration `toml:"post_tool_use"`
SessionStart Duration `toml:"session_start"`
SubagentStart Duration `toml:"subagent_start"`
PreCompact Duration `toml:"pre_compact"`
}
Timeouts are freshness lock-wait budgets per caller: how long a caller waits for the index writer before answering from the current (stale) graph with a banner.