Documentation
¶
Overview ¶
Package occompat provides compatibility for importing configurations from opencode.
Package occompat provides compatibility for importing configurations from opencode.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckExists ¶
func CheckExists() bool
CheckExists checks if opencode config directory and auth.json exist.
func ComputeSourceHash ¶
ComputeSourceHash computes a truncated SHA-256 hash of the source files.
func DefaultOpenCodeDir ¶
func DefaultOpenCodeDir() string
DefaultOpenCodeDir returns the default opencode config directory.
Types ¶
type AuthCredentials ¶
AuthCredentials maps provider names to their credentials.
func LoadAuth ¶
func LoadAuth(opencodeDir string) (AuthCredentials, error)
LoadAuth reads the opencode auth.json file.
type AuthEntry ¶
type AuthEntry struct {
Type string `json:"type,omitempty"` // "api", "bearer", etc.
Key string `json:"key,omitempty"`
}
AuthEntry represents a credential entry in opencode auth.json.
type OpenCodeConfig ¶
type OpenCodeConfig struct {
Options OpenCodeOptions `json:"options,omitempty"`
}
OpenCodeConfig represents the opencode.json configuration file.
func LoadConfig ¶
func LoadConfig(projectDir string) (*OpenCodeConfig, error)
LoadConfig reads the opencode.json file from the project or global location.
func LoadGlobalConfig ¶
func LoadGlobalConfig() (*OpenCodeConfig, error)
LoadGlobalConfig reads the global opencode.json config file.
type OpenCodeOptions ¶
type OpenCodeOptions struct {
BaseURL string `json:"baseURL,omitempty"`
APIKey string `json:"apiKey,omitempty"`
Model string `json:"model,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
NPM string `json:"npm,omitempty"` // e.g., "@ai-sdk/openai-compatible"
}
OpenCodeOptions contains the configuration options.
type TranslationResult ¶
type TranslationResult struct {
Provider agentConfig.ProviderConfig
Warnings []string
}
TranslationResult contains the result of translating opencode config to agent config.
func Translate ¶
func Translate(opencodeDir, authKey string) *TranslationResult
Translate converts opencode configuration to agent provider config per SD-007.