Documentation
¶
Overview ¶
Package scheme is the CLI dispatch layer over v1alpha1: it owns the alias-flexible Kind lookup table (so `arctl get mcp` and `arctl get mcpserver` both resolve), per-kind table-render metadata, and the per-kind cobra→registry-client callbacks (`Get`, `List`, `Delete`, `ToYAMLFunc`). YAML decode itself flows through pkg/api/v1alpha1.Scheme — this package holds only CLI-specific concerns.
Kinds are registered at package init by the declarative package. The table is global, populated once, and never mutated afterwards (no SetRegistry hook — there is no current caller that needs to swap it). Aliases collide → panic at boot.
Index ¶
- Constants
- Variables
- func DecodeBytes(b []byte) ([]v1alpha1.Object, error)
- func DecodeFile(path string) ([]v1alpha1.Object, error)
- func IsEnvelopeYAML(data []byte) bool
- func Register(k *Kind)
- type Column
- type DeleteAllTagsFunc
- type DeleteFunc
- type GetFunc
- type Kind
- type ListFunc
- type ListOpts
- type ListTagsFunc
- type Registry
- type RowFunc
- type ToYAMLFunc
Constants ¶
const APIVersion = v1alpha1.GroupVersion
APIVersion is the canonical apiVersion string for arctl declarative YAML files.
Variables ¶
var ErrUnknownKind = errors.New("unknown kind")
ErrUnknownKind is returned by Lookup when no Kind is registered under the given name or alias.
Functions ¶
func DecodeBytes ¶
DecodeBytes parses one or more declarative YAML documents into typed v1alpha1.Object envelopes. Returns an error if any document has an unknown Scheme kind or fails to decode. Kinds do not need a CLI dispatch entry here: downstream builds can register server-side-only kinds with v1alpha1.Default and still use `arctl apply -f`.
Status is reset to nil before returning so `arctl get -o yaml | apply -f -` stays apply-safe even when the source YAML contained server-managed status.
func DecodeFile ¶
DecodeFile reads a YAML file and decodes it into v1alpha1.Object envelopes.
func IsEnvelopeYAML ¶
IsEnvelopeYAML reports whether the given bytes look like a declarative ar.dev/v1alpha1 envelope. Malformed YAML returns false so callers can surface the real parse error from a downstream loader.
Pins on the canonical apiVersion (ar.dev/v1alpha1) — generic K8s-style manifests with an unrelated apiVersion (kagent CRDs, k8s core types, etc.) would otherwise misclassify as envelopes and route to the wrong loader.
Types ¶
type DeleteAllTagsFunc ¶
DeleteAllTagsFunc soft-deletes every live tag of a single (name) in one server round-trip. Set only on taggable artifact kinds. Nil for kinds whose identity is not tagged.
type DeleteFunc ¶
DeleteFunc deletes a single (name, tag) of the kind.
type Kind ¶
type Kind struct {
Kind string
Plural string
Aliases []string
ListFunc ListFunc
RowFunc RowFunc
ToYAMLFunc ToYAMLFunc
Get GetFunc
Delete DeleteFunc
ListTags ListTagsFunc
DeleteAllTags DeleteAllTagsFunc
TableColumns []Column
}
type ListOpts ¶
type ListOpts struct {
// Tag, when set, restricts the list to rows with this tag value
// (tagged content kinds only). Mutually exclusive with LatestOnly.
Tag string
// LatestOnly restricts the list to the literal "latest" tag (tagged
// content kinds) or the latest mutable-object row.
LatestOnly bool
// Origin filters Deployment rows by provenance. Recognized values:
// "managed", "discovered", "all" (both), and "" (unset — the Deployment
// list defaults to managed to preserve historical behavior). The
// Deployment ListFunc translates these to the server filter; only the
// Deployment kind honors this — other kinds ignore it.
Origin string
}
ListOpts are CLI-facing filters forwarded to the per-kind ListFunc. Empty fields mean "no filter" — the default `arctl get <plural>` lists every row of the kind.
type ListTagsFunc ¶
ListTagsFunc returns every live tag row for a single (name). Set only on taggable artifact kinds (Agent, MCPServer, Skill, etc.). Nil for kinds whose identity is not tagged (Deployment, Runtime) — callers must check for nil and reject `--all-tags` cleanly.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry is an isolated Kind lookup table.
func NewRegistry ¶
NewRegistry returns an isolated registry populated with the given kinds.