Documentation
¶
Overview ¶
Package config loads ogcode's optional file-based configuration: provider base URLs and API keys, and the skill sources and permissions, so they can live in a committed/shared file instead of only environment variables.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureProjectFile ¶
EnsureProjectFile creates a blank project-local ogcode.json in dir if no ogcode.json is found in dir or any of its ancestors (see findProjectFile). An existing file — found anywhere in that search — is left untouched, and so is dir itself if creation fails for any reason (e.g. a read-only filesystem): this is a best-effort convenience, never a requirement for startup. Returns the path that was created, or "" if nothing was created.
Types ¶
type Config ¶
type Config struct {
Providers map[string]ProviderConfig `json:"providers,omitempty"`
Skills SkillsConfig `json:"skills,omitempty"`
}
Config is ogcode's file-based configuration.
func Load ¶
Load reads the global config (~/.config/ogcode/config.json) and the project-local config (ogcode.json, found by searching dir and its parents, stopping once the repo root — the directory holding .git — has been checked), merging them provider-by-provider with project-local values taking precedence. Missing or unreadable files are silently skipped; Load always returns a usable, non-nil Config.
Skill sources merge differently from provider settings: paths and urls are unioned rather than overridden, so a project adds its own skill directories to the user's global ones instead of replacing them. Permissions merge key-by-key, project-local last, so a project can override one rule without restating the rest.
type ProviderConfig ¶
type ProviderConfig struct {
BaseURL string `json:"baseUrl,omitempty"`
APIKey string `json:"apiKey,omitempty"`
}
ProviderConfig holds per-provider connection overrides.
type SkillsConfig ¶ added in v0.27.0
type SkillsConfig struct {
// Paths are extra skill directories, relative to the project or absolute.
Paths []string `json:"paths,omitempty"`
// URLs are index.json manifests to fetch skills from.
URLs []string `json:"urls,omitempty"`
// Permissions maps a skill-name glob to "allow", "deny", or "ask".
Permissions map[string]string `json:"permissions,omitempty"`
}
SkillsConfig configures where skills come from and which of them an agent may use. Every field is optional: with none of them set, ogcode still scans the standard project and global skill directories.