config

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigDir

func ConfigDir() string

func ConfigFilePath

func ConfigFilePath() string

func CopilotTokenPath added in v0.5.2

func CopilotTokenPath() string

CopilotTokenPath is where `gocode auth copilot` stores the GitHub OAuth token. It lives in the config dir (not the data dir) because it is a credential, and is written with owner-only permissions.

func DataDir

func DataDir() string

func EnsureDirs

func EnsureDirs() error

func LogDir added in v0.2.0

func LogDir() string

func LogFilePath added in v0.2.0

func LogFilePath() string

func Save added in v0.2.0

func Save(cfg Config) error

Save writes the configuration to the config.toml file.

func SaveToPath added in v0.2.0

func SaveToPath(cfg Config, path string) error

SaveToPath writes the configuration to a specific file path.

func SessionDir

func SessionDir() string

Types

type Config

type Config struct {
	Provider    ProviderConfig    `toml:"provider"`
	Permissions PermissionsConfig `toml:"permissions"`
	Session     SessionConfig     `toml:"session"`
	Tools       ToolsConfig       `toml:"tools"`
	MCP         MCPConfig         `toml:"mcp"`
}

Config represents top-level configuration options.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns default configuration values.

func Load

func Load() (Config, error)

Load reads configuration from file or returns defaults if non-existent.

func LoadFromPath added in v0.2.0

func LoadFromPath(path string) (Config, error)

LoadFromPath reads configuration from a specific file path.

type CopilotConfig added in v0.5.2

type CopilotConfig struct {
	// OAuthTokenEnv names the environment variable holding a GitHub OAuth
	// token (the `ghu_...` form produced by `gocode auth copilot`). The token
	// itself is never written into config.toml.
	OAuthTokenEnv string `toml:"oauth_token_env"`
	DefaultModel  string `toml:"default_model"`
	// EditorVersion and EditorPluginVersion are sent as the Copilot
	// integration headers. Copilot rejects requests whose headers do not look
	// like a real editor client.
	EditorVersion       string `toml:"editor_version"`
	EditorPluginVersion string `toml:"editor_plugin_version"`
}

CopilotConfig configures GitHub Copilot.

Copilot is not a plain bearer-token API. It needs a long-lived GitHub OAuth token, which is exchanged for a short-lived Copilot JWT that also carries a dynamic API base URL. Both layers are modelled here; see internal/provider/copilot.go for the exchange.

type GatewayConfig

type GatewayConfig struct {
	BaseURL      string `toml:"base_url"`
	APIKey       string `toml:"api_key"`
	APIKeyEnv    string `toml:"api_key_env"`
	DefaultModel string `toml:"default_model"`
}

GatewayConfig configures an OpenAI-compatible gateway or cloud provider endpoint.

type MCPConfig added in v0.2.0

type MCPConfig struct {
	Servers map[string]MCPServerConfig `toml:"servers"`
}

MCPConfig specifies Model Context Protocol server configurations.

type MCPServerConfig added in v0.2.0

type MCPServerConfig struct {
	Command string            `toml:"command"`
	Args    []string          `toml:"args"`
	Env     map[string]string `toml:"env,omitempty"`
}

MCPServerConfig defines an individual MCP server command and arguments.

type OllamaConfig

type OllamaConfig struct {
	Host         string `toml:"host"`
	DefaultModel string `toml:"default_model"`
}

OllamaConfig configures local Ollama instance.

type PermissionsConfig added in v0.2.0

type PermissionsConfig struct {
	AutoApprove       []string `toml:"auto_approve"`
	Deny              []string `toml:"deny"`
	SensitivePatterns []string `toml:"sensitive_patterns"`
}

PermissionsConfig specifies granular tool permissions.

type ProviderConfig

type ProviderConfig struct {
	Default    string                   `toml:"default"`
	Ollama     OllamaConfig             `toml:"ollama"`
	OmniRoute  GatewayConfig            `toml:"omniroute"`
	OpenAI     GatewayConfig            `toml:"openai"`
	Gemini     GatewayConfig            `toml:"gemini"`
	Groq       GatewayConfig            `toml:"groq"`
	OpenRouter GatewayConfig            `toml:"openrouter"`
	Anthropic  GatewayConfig            `toml:"anthropic"`
	Qwen       GatewayConfig            `toml:"qwen"`
	Kimi       GatewayConfig            `toml:"kimi"`
	Hermes     GatewayConfig            `toml:"hermes"`
	XAI        GatewayConfig            `toml:"xai"`
	Mistral    GatewayConfig            `toml:"mistral"`
	MiniMax    GatewayConfig            `toml:"minimax"`
	DeepSeek   GatewayConfig            `toml:"deepseek"`
	Together   GatewayConfig            `toml:"together"`
	Fireworks  GatewayConfig            `toml:"fireworks"`
	Cerebras   GatewayConfig            `toml:"cerebras"`
	Zhipu      GatewayConfig            `toml:"zhipu"`
	Nvidia     GatewayConfig            `toml:"nvidia"`
	Copilot    CopilotConfig            `toml:"copilot"`
	Custom     map[string]GatewayConfig `toml:"custom"`
}

ProviderConfig specifies provider settings.

type SessionConfig

type SessionConfig struct {
	// Persist controls whether conversations are written to the SQLite
	// store. It was previously parsed and then ignored, so `persist = false`
	// had no effect while the documentation implied it did.
	Persist bool `toml:"persist"`
}

SessionConfig specifies session settings.

type ShellConfig

type ShellConfig struct {
	TimeoutSeconds int  `toml:"timeout_seconds"`
	MaxOutputBytes int  `toml:"max_output_bytes"`
	RedactSecrets  bool `toml:"redact_secrets"`
}

type ToolsConfig

type ToolsConfig struct {
	Shell ShellConfig `toml:"shell"`
	// MaxToolIterations caps provider round-trips per user turn. Zero or
	// negative uses the built-in default.
	MaxToolIterations int `toml:"max_tool_iterations"`
	// MaxRepeatedToolCalls caps identical tool calls (same name and same
	// arguments) within one turn. Zero or negative uses the built-in default.
	MaxRepeatedToolCalls int `toml:"max_repeated_tool_calls"`
}

Jump to

Keyboard shortcuts

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