Documentation
¶
Overview ¶
SPDX-License-Identifier: MIT Package config defines the tool's settings and the flexible time-window parsing used to bound a query. Loading and source precedence (config file, environment, flags) is handled by viper in the CLI layer; this package stays dependency-light so the GitHub client and renderers can rely on it.
SPDX-License-Identifier: MIT
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Defaults ¶
Defaults are the built-in configuration values, keyed by their canonical config key. The CLI seeds viper with these so they participate uniformly in precedence resolution.
Types ¶
type Config ¶
type Config struct {
// Token is the GitHub personal access token sting authenticates with. It is
// deliberately sting's own key (config-file "token" or env STING_TOKEN), kept
// separate from the ambient GITHUB_TOKEN so a dedicated read-only PAT can be
// the default without colliding with other tools' credentials.
Token string `mapstructure:"token"`
// BaseURL points at a GitHub Enterprise API root
// ("https://ghe.example.com/api/v3/"). Empty means public github.com.
BaseURL string `mapstructure:"base_url"`
// DefaultScope is used when a query omits a scope.
DefaultScope model.Scope `mapstructure:"default_scope"`
// DefaultWindow is the look-back window when a query omits since/until.
DefaultWindow string `mapstructure:"default_window"`
// DefaultRepos seeds ScopeRepos queries that omit repos.
DefaultRepos []string `mapstructure:"default_repos"`
// DefaultOrg seeds ScopeOrg queries that omit org.
DefaultOrg string `mapstructure:"default_org"`
// DefaultFormat is the CLI render format ("markdown" or "json").
DefaultFormat string `mapstructure:"default_format"`
// PerPage is the API page size (1-100).
PerPage int `mapstructure:"per_page"`
// MaxCommits caps results per query (0 = unlimited).
MaxCommits int `mapstructure:"max_commits"`
// IncludeStats fetches per-commit line stats by default.
IncludeStats bool `mapstructure:"include_stats"`
}
Config holds all tunable settings. The mapstructure keys are the canonical configuration keys: they are the YAML/JSON config-file keys, the viper keys bound to flags, and (uppercased, STING_-prefixed) the environment variables.
type Request ¶
type Request struct {
Author string
Since string // RFC3339 or YYYY-MM-DD; empty uses Window
Until string // RFC3339 or YYYY-MM-DD; empty means now
Window string // look-back (e.g. "7d"); used only when Since is empty
Scope string // search|repos|org; empty uses default
Repos []string
Org string
// IncludeStats overrides the default when non-nil.
IncludeStats *bool
}
Request is the raw, mostly-string input from a CLI invocation or an MCP tool call. Empty fields fall back to configuration defaults during Resolve.