Documentation
¶
Overview ¶
Package adapter provides the embedded adapter registry and lookup functions.
The registry is a static YAML file embedded in the ox binary via go:embed. It lists all known adapters (bundled and external) with their metadata, capabilities, and source repositories. Phase 1 is embedded-only; future phases will fetch updates from sageox/ox-adapters.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdapterEntry ¶
type AdapterEntry struct {
Name string `yaml:"name" json:"name"`
DisplayName string `yaml:"display_name" json:"display_name"`
Description string `yaml:"description" json:"description"`
Type string `yaml:"type" json:"type"` // session, vcs, indexer
Bundled bool `yaml:"bundled" json:"bundled"`
Binary string `yaml:"binary" json:"binary"`
Repo string `yaml:"repo" json:"repo"`
Capabilities []string `yaml:"capabilities" json:"capabilities"`
DetectCmds []string `yaml:"detect_commands,omitempty" json:"detect_commands,omitempty"`
// Curated-path integrity fields (ADR-022, ox-5ihl). For the short-name
// install path SageOx is the trust anchor, so a code-reviewed release tag
// pin plus per-platform sha256 in this registry IS the authenticity control.
// The download is verified against these BEFORE the binary is made
// executable or run (see runAdapterInstall). A missing pin fails closed
// unless the user opts into --allow-unverified.
//
// Tag pins the exact GitHub release (e.g. "v1.2.3"); installs fetch
// releases/tags/<Tag>, never releases/latest. Checksums maps a platform key
// ("darwin_arm64") to the lowercase sha256 hex of that platform's asset.
Tag string `yaml:"tag,omitempty" json:"tag,omitempty"`
Checksums map[string]string `yaml:"checksums,omitempty" json:"checksums,omitempty"`
}
AdapterEntry describes a known adapter in the registry.
func (*AdapterEntry) GitHubRepo ¶
func (e *AdapterEntry) GitHubRepo() string
GitHubRepo returns the full github.com URL for an adapter entry.
func (*AdapterEntry) RequireInstallable ¶ added in v0.10.0
func (e *AdapterEntry) RequireInstallable() error
RequireInstallable returns an error if a non-bundled entry lacks the curated integrity pins (Tag + Checksums) that ADR-022 requires before SageOx can vouch for a short-name install. Bundled adapters ship with ox and are exempt.
Callers use this to drive fail-closed behavior on the curated install path: an entry that is not installable can only be installed with an explicit --allow-unverified opt-in. It is NOT called automatically at registry load, so `ox adapter list`/`info` still surface entries that lack a pin.
type CommunityEntry ¶
type CommunityEntry struct {
Name string `yaml:"name" json:"name"`
DisplayName string `yaml:"display_name" json:"display_name"`
Description string `yaml:"description" json:"description"`
Repo string `yaml:"repo" json:"repo"`
Capabilities []string `yaml:"capabilities,omitempty" json:"capabilities,omitempty"`
}
CommunityEntry describes a community-contributed adapter.
type Registry ¶
type Registry struct {
SchemaVersion int `yaml:"schema_version" json:"schema_version"`
Adapters []AdapterEntry `yaml:"adapters" json:"adapters"`
Community []CommunityEntry `yaml:"community,omitempty" json:"community,omitempty"`
}
Registry is the top-level adapter registry structure.
func LoadEmbeddedRegistry ¶
LoadEmbeddedRegistry parses the embedded registry YAML and returns the registry. This is the Phase 1 registry source.
func (*Registry) BundledAdapters ¶
func (r *Registry) BundledAdapters() []AdapterEntry
BundledAdapters returns only adapters that ship with the ox binary.
func (*Registry) ExternalAdapters ¶
func (r *Registry) ExternalAdapters() []AdapterEntry
ExternalAdapters returns only adapters that must be installed separately.
func (*Registry) Lookup ¶
func (r *Registry) Lookup(name string) *AdapterEntry
Lookup finds an adapter entry by name. Returns nil if not found.