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 provider clients 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. It is derived from Default() so the map and struct representations of the built-in configuration stay in sync.
Types ¶
type Config ¶
type Config struct {
// DefaultProvider is used when a query omits a provider.
DefaultProvider model.Provider `mapstructure:"provider"`
// 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"`
// GitLabToken is the GitLab personal access token sting authenticates with.
// It is kept separate from both GITHUB_TOKEN and ambient GitLab env vars such
// as GITLAB_TOKEN.
GitLabToken string `mapstructure:"gitlab_token"`
// GitLabBaseURL points at a GitLab API v4 root
// ("https://gitlab.example.com/api/v4/"). Empty means GitLab.com.
GitLabBaseURL string `mapstructure:"gitlab_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"`
// IncludeFiles fetches per-file change summaries by default.
IncludeFiles bool `mapstructure:"include_files"`
// IncludeDiffs fetches bounded patch text by default.
IncludeDiffs bool `mapstructure:"include_diffs"`
// MaxDiffBytes caps patch text per commit when diffs are requested.
MaxDiffBytes int `mapstructure:"max_diff_bytes"`
// IncludePullRequests augments repos/org discovery with open-PR branch
// commits by default (GitHub only).
IncludePullRequests bool `mapstructure:"include_prs"`
}
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.
func Default ¶
func Default() Config
Default returns the built-in configuration as a Config value. This is the single source of truth for default values; Defaults() derives its map representation from it so the two cannot drift apart.
Default is intentional public API consumed by the sibling wake project (see ADR 0004) in addition to Defaults(), which is what the sting CLI itself seeds viper with.
type Request ¶
type Request struct {
Provider string // github|gitlab; empty uses default
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
// IncludeFiles overrides the default when non-nil.
IncludeFiles *bool
// IncludeDiffs overrides the default when non-nil.
IncludeDiffs *bool
// MaxDiffBytes overrides the default when non-nil.
MaxDiffBytes *int
// IncludePullRequests overrides the default when non-nil.
IncludePullRequests *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.