config

package
v0.0.0-...-f56615f Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultURL   = "https://api.openai.com/v1"
	DefaultModel = "gpt-5.6"
)

Variables

This section is empty.

Functions

func DefaultPath

func DefaultPath() (string, error)

func Ensure

func Ensure(path string) (created bool, returnErr error)

Ensure creates a secure configuration directory and starter file. Existing configuration content is never overwritten. It returns true when a new file was created.

func IsWorkspaceTrusted

func IsWorkspaceTrusted(configuration File, workspace string) bool

IsWorkspaceTrusted compares canonical paths so symlink aliases cannot grant trust to a different directory.

func Path

func Path(lookupEnv func(string) (string, bool)) (string, error)

Path returns SUPERCODE_CONFIG when set, otherwise ~/.supercode/config.yaml.

func ProjectPath

func ProjectPath(workspace string) string

func Save

func Save(path string, configuration File) error

Save atomically replaces a user-owned configuration file.

func TrustWorkspace

func TrustWorkspace(path, workspace string) error

TrustWorkspace atomically records an explicit trust decision in the user configuration. This intentionally happens only through --trust-project.

Types

type File

type File struct {
	ConfigVersion                int                                  `yaml:"config_version,omitempty"`
	URL                          string                               `yaml:"url"`
	Model                        string                               `yaml:"model"`
	Models                       []string                             `yaml:"models,omitempty"`
	Providers                    []ProviderConfig                     `yaml:"providers,omitempty"`
	ModelCatalog                 map[string]modelcatalog.Capabilities `yaml:"model_catalog,omitempty"`
	ReasoningEffort              string                               `yaml:"reasoning_effort,omitempty"`
	ServiceTier                  string                               `yaml:"service_tier,omitempty"`
	FallbackModels               []string                             `yaml:"fallback_models,omitempty"`
	Token                        string                               `yaml:"token"`
	TokenCommand                 []string                             `yaml:"token_command,omitempty"`
	Instructions                 string                               `yaml:"instructions,omitempty"`
	ProjectDocFallbacks          []string                             `yaml:"project_doc_fallback_filenames,omitempty"`
	ProjectDocMaxBytes           int                                  `yaml:"project_doc_max_bytes,omitempty"`
	ReadRoots                    []string                             `yaml:"read_roots,omitempty"`
	WriteRoots                   []string                             `yaml:"write_roots,omitempty"`
	DenyRoots                    []string                             `yaml:"deny_roots,omitempty"`
	MemoryMaxTokens              int                                  `yaml:"memory_max_tokens,omitempty"`
	MemoryAutoCapture            *bool                                `yaml:"memory_auto_capture,omitempty"`
	MemoryGenerate               *bool                                `yaml:"memory_generate,omitempty"`
	MemoryUse                    *bool                                `yaml:"memory_use,omitempty"`
	MemoryDedicatedTools         *bool                                `yaml:"memory_dedicated_tools,omitempty"`
	MemoryMaxRolloutsPerStartup  int                                  `yaml:"memory_max_rollouts_per_startup,omitempty"`
	MemoryMaxRolloutAgeDays      int                                  `yaml:"memory_max_rollout_age_days,omitempty"`
	MemoryMinRolloutIdleHours    int                                  `yaml:"memory_min_rollout_idle_hours,omitempty"`
	MemoryMaxRawForConsolidation int                                  `yaml:"memory_max_raw_memories_for_consolidation,omitempty"`
	MemoryMaxUnusedDays          int                                  `yaml:"memory_max_unused_days,omitempty"`
	MemoryExtractModel           string                               `yaml:"memory_extract_model,omitempty"`
	MemoryConsolidationModel     string                               `yaml:"memory_consolidation_model,omitempty"`
	Theme                        string                               `yaml:"theme,omitempty"`
	Keymap                       string                               `yaml:"keymap,omitempty"`
	Notification                 string                               `yaml:"notification,omitempty"`
	TerminalTitle                string                               `yaml:"terminal_title,omitempty"`
	DebugLog                     string                               `yaml:"debug_log,omitempty"`
	Stream                       *bool                                `yaml:"stream,omitempty"`
	Timeout                      string                               `yaml:"timeout,omitempty"`
	MaxRetries                   int                                  `yaml:"max_retries,omitempty"`
	Approval                     string                               `yaml:"approval,omitempty"`
	ApprovalCategories           map[string]bool                      `yaml:"approval_categories,omitempty"`
	MaxTurns                     int                                  `yaml:"max_turns,omitempty"`
	ContextWindowTokens          int                                  `yaml:"context_window_tokens,omitempty"`
	AutoCompactTokens            int                                  `yaml:"auto_compact_tokens,omitempty"`
	UsableContextTokens          int                                  `yaml:"usable_context_tokens,omitempty"`
	ToolOutputTokens             int                                  `yaml:"tool_output_tokens,omitempty"`
	GoalAutoContinue             *bool                                `yaml:"goal_auto_continue,omitempty"`
	AlternateScreen              *bool                                `yaml:"alternate_screen,omitempty"`
	TrustedWorkspaces            []string                             `yaml:"trusted_workspaces,omitempty"`
	MCPServers                   map[string]MCPServer                 `yaml:"mcp_servers,omitempty"`
	Hooks                        map[string][]Hook                    `yaml:"hooks,omitempty"`
}

File is the user-editable YAML configuration stored in ~/.supercode. Stream is a pointer so an omitted value can be distinguished from false.

func Load

func Load(path string) (File, error)

func Merge

func Merge(base, overlay File) File

Merge overlays explicitly configured project values. TrustedWorkspaces stays user-owned and is never inherited from a repository.

type Hook

type Hook struct {
	Command []string `yaml:"command"`
	Timeout string   `yaml:"timeout,omitempty"`
	Matcher string   `yaml:"matcher,omitempty"`
	Enabled *bool    `yaml:"enabled,omitempty"`
	SHA256  string   `yaml:"sha256,omitempty"`
}

type MCPServer

type MCPServer struct {
	Transport         string            `yaml:"transport,omitempty"`
	Command           string            `yaml:"command,omitempty"`
	Args              []string          `yaml:"args,omitempty"`
	Env               map[string]string `yaml:"env,omitempty"`
	URL               string            `yaml:"url,omitempty"`
	Headers           map[string]string `yaml:"headers,omitempty"`
	OAuthTokenCommand []string          `yaml:"oauth_token_command,omitempty"`
	Enabled           *bool             `yaml:"enabled,omitempty"`
}

type ProviderConfig

type ProviderConfig struct {
	Name         string            `yaml:"name"`
	Provider     string            `yaml:"provider"`
	URL          string            `yaml:"url,omitempty"`
	Token        string            `yaml:"token,omitempty"`
	TokenCommand []string          `yaml:"token_command,omitempty"`
	Models       []string          `yaml:"models"`
	MaxTokens    int64             `yaml:"maxTokens,omitempty"`
	Headers      map[string]string `yaml:"headers,omitempty"`
}

ProviderConfig describes one named model endpoint. Provider selects the wire protocol: openai, openai_responses, anthropic, or openrouter.

Jump to

Keyboard shortcuts

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