capyaml

package
v0.0.0-...-9239525 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 7 Imported by: ? 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

View Source
var ErrInstallRowShape = errors.New("install entry point row")

ErrInstallRowShape marks a row that breaks the row model at decode time, before ValidateInstallEntryPoints can see it: an unknown or duplicate key, a null or scalar os, or a field of the wrong YAML type.

Functions

func ValidateAgainstSchema

func ValidateAgainstSchema(path string, migrationWindow bool) error

ValidateAgainstSchema validates a capability YAML file against the schema version policy. If migrationWindow is true, the immediately previous schema version (index 1 in supportedSchemaVersions) is also accepted. Returns an error if schema_version is unknown, the file cannot be parsed, or ValidateCapabilities rejects it.

func ValidateCapabilities

func ValidateCapabilities(caps *ProviderCapabilities) error

ValidateCapabilities checks the rules a capability file must satisfy beyond parsing. Today that is the install_entry_points list of every content type.

func ValidateInstallEntryPoints

func ValidateInstallEntryPoints(rows []InstallEntryPoint) error

ValidateInstallEntryPoints checks one (provider, content type) row list against the ACIF install-targets row model: the closed scope, layout and status sets, the os set rules, the closed path-template grammar and its anchors, layout and <content-name> agreement, and uniqueness of (scope, path_template). An empty list is valid: it publishes no location.

func WriteCapabilityYAML

func WriteCapabilityYAML(w io.Writer, caps *ProviderCapabilities) error

WriteCapabilityYAML serializes a ProviderCapabilities to the writer. provider_exclusive nodes round-trip as CapabilityEntry values.

Types

type CapabilityEntry

type CapabilityEntry struct {
	Supported    bool                       `yaml:"supported"`
	Mechanism    string                     `yaml:"mechanism,omitempty"`
	Confidence   string                     `yaml:"confidence,omitempty"`
	Refs         []string                   `yaml:"refs,omitempty"`
	Capabilities map[string]CapabilityEntry `yaml:"capabilities,omitempty"`
}

CapabilityEntry is one capability (e.g., structured_output) in a capability YAML.

Object-typed canonical keys (activation_mode, cross_provider_recognition; see docs/spec/canonical-keys.yaml) hold a nested map of sub-capabilities under the recursive Capabilities field. Flat canonical keys (file_imports, hierarchical_loading, etc.) leave Capabilities nil. When at least one sub-capability is added, the parent's Supported is set to true automatically so a downstream reader sees the parent concept as supported.

type ContentTypeEntry

type ContentTypeEntry struct {
	Supported    bool                       `yaml:"supported"`
	Confidence   string                     `yaml:"confidence,omitempty"`
	Events       map[string]EventEntry      `yaml:"events,omitempty"`
	Capabilities map[string]CapabilityEntry `yaml:"capabilities,omitempty"`
	Tools        map[string]ToolEntry       `yaml:"tools,omitempty"`
	// InstallEntryPoints lists where the provider reads this content type on
	// disk, as ACIF install-targets rows (spec §6). Order is precedence: after
	// filtering by the target OS, the first current row for a scope is the
	// write target. See
	// ValidateInstallEntryPoints for the rules each list must satisfy.
	InstallEntryPoints []InstallEntryPoint `yaml:"install_entry_points,omitempty"`
}

ContentTypeEntry is the generic entry for a content type (hooks, rules, etc.)

type EventEntry

type EventEntry struct {
	NativeName string   `yaml:"native_name"`
	Blocking   string   `yaml:"blocking,omitempty"`
	Refs       []string `yaml:"refs,omitempty"`
}

EventEntry is one hook event in a capability YAML.

type InstallEntryPoint

type InstallEntryPoint struct {
	Scope        string   `yaml:"scope"`
	OS           []string `yaml:"os,omitempty"`
	PathTemplate string   `yaml:"path_template"`
	Layout       string   `yaml:"layout"`
	Status       string   `yaml:"status"`
	AsOf         string   `yaml:"as_of"`
}

InstallEntryPoint is one ACIF install-targets row. Field names and value spellings are ACIF's, verbatim, so a consumer resolves a path by the ACIF rules without translation. UnmarshalYAML decodes a row strictly (no extra keys, no null os).

func (*InstallEntryPoint) UnmarshalYAML

func (r *InstallEntryPoint) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML decodes one row strictly: a key outside the six row fields is an error, and so is an os key whose value is null or empty. Both would otherwise decode to a nil OS, and a nil OS means "every OS", so a blanked or misspelled os would publish an OS-specific location for all systems. The strictness is scoped to rows; the rest of a capability file keeps its lenient decoding.

type ProviderCapabilities

type ProviderCapabilities struct {
	SchemaVersion   string `yaml:"schema_version"`
	Slug            string `yaml:"slug"`
	DisplayName     string `yaml:"display_name"`
	LastVerified    string `yaml:"last_verified"`
	ProviderVersion string `yaml:"provider_version,omitempty"`
	SourceManifest  string `yaml:"source_manifest,omitempty"`
	FormatReference string `yaml:"format_reference,omitempty"`
	// References is auto-maintained by the pipeline. Maps reference ID → ReferenceEntry.
	References   map[string]ReferenceEntry   `yaml:"references,omitempty"`
	ContentTypes map[string]ContentTypeEntry `yaml:"content_types"`
	// ProviderExclusive holds capabilities unique to this provider that do not
	// map to a canonical key. Nodes are ordinary recursive CapabilityEntry trees,
	// so graduating one to a canonical key is a data move, not a shape change.
	ProviderExclusive map[string]CapabilityEntry `yaml:"provider_exclusive,omitempty"`
}

ProviderCapabilities is the Go representation of docs/provider-capabilities/<slug>.yaml.

func LoadCapabilityYAML

func LoadCapabilityYAML(path string) (*ProviderCapabilities, error)

LoadCapabilityYAML parses a provider capability YAML file.

type ReferenceEntry

type ReferenceEntry struct {
	URL             string `yaml:"url"`
	FetchMethod     string `yaml:"fetch_method"`
	VerifiedAt      string `yaml:"verified_at,omitempty"`
	LastContentHash string `yaml:"last_content_hash,omitempty"`
}

ReferenceEntry tracks provenance for a source URL used in capability extraction. The pipeline auto-updates VerifiedAt and LastContentHash after each successful fetch.

type ToolEntry

type ToolEntry struct {
	Native string   `yaml:"native"`
	Refs   []string `yaml:"refs,omitempty"`
}

ToolEntry maps a canonical tool name to its provider-native name.

Jump to

Keyboard shortcuts

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