Documentation
¶
Overview ¶
Package oci provides shared types and an ORAS client for Klaus OCI artifacts.
Klaus uses OCI artifacts with custom media types for distributing plugins and personalities. This package defines the media types, metadata structs, and a registry client that both klausctl and the klaus-operator can use.
Index ¶
- Constants
- func IsCached(dir string, digest string) bool
- func LatestSemverTag(tags []string) string
- func RepositoryFromRef(ref string) string
- func ShortName(repository string) string
- func SplitNameTag(ref string) (string, string)
- func SplitRegistryBase(base string) (host, prefix string)
- func ToolchainRegistryRef(name string) string
- func TruncateDigest(d string) string
- func WriteCacheEntry(dir string, entry CacheEntry) error
- type ArtifactInfo
- type Author
- type CacheEntry
- type CacheStore
- type Client
- func (c *Client) CloseCache() error
- func (c *Client) DescribePersonality(ctx context.Context, ref string) (*DescribedPersonality, error)
- func (c *Client) DescribePlugin(ctx context.Context, ref string) (*DescribedPlugin, error)
- func (c *Client) DescribeToolchain(ctx context.Context, ref string) (*DescribedToolchain, error)
- func (c *Client) List(ctx context.Context, repository string) ([]string, error)
- func (c *Client) ListPersonalities(ctx context.Context, opts ...ListOption) ([]ListEntry, error)
- func (c *Client) ListPersonalityVersions(ctx context.Context, nameOrRef string) ([]string, error)
- func (c *Client) ListPluginVersions(ctx context.Context, nameOrRef string) ([]string, error)
- func (c *Client) ListPlugins(ctx context.Context, opts ...ListOption) ([]ListEntry, error)
- func (c *Client) ListToolchainVersions(ctx context.Context, nameOrRef string) ([]string, error)
- func (c *Client) ListToolchains(ctx context.Context, opts ...ListOption) ([]ListEntry, error)
- func (c *Client) PullPersonality(ctx context.Context, ref string, cacheDir string) (*PulledPersonality, error)
- func (c *Client) PullPlugin(ctx context.Context, ref string, destDir string) (*PulledPlugin, error)
- func (c *Client) PushPersonality(ctx context.Context, sourceDir, ref string, p Personality) (*PushResult, error)
- func (c *Client) PushPlugin(ctx context.Context, sourceDir, ref string, p Plugin) (*PushResult, error)
- func (c *Client) Resolve(ctx context.Context, ref string) (string, error)
- func (c *Client) ResolveLatestVersion(ctx context.Context, repository string) (string, error)
- func (c *Client) ResolvePersonalityDeps(ctx context.Context, p Personality) (*ResolvedDependencies, error)
- func (c *Client) ResolvePersonalityRef(ctx context.Context, ref string) (string, error)
- func (c *Client) ResolvePluginRef(ctx context.Context, ref string) (string, error)
- func (c *Client) ResolveToolchainRef(ctx context.Context, ref string) (string, error)
- type ClientOption
- func WithBackgroundRefresh(enabled bool) ClientOption
- func WithCache(dir string) ClientOption
- func WithCacheMaxSize(bytes int64) ClientOption
- func WithCacheTTL(fresh, stale time.Duration) ClientOption
- func WithConcurrency(n int) ClientOption
- func WithPlainHTTP(plain bool) ClientOption
- func WithRegistryAuthEnv(envName string) ClientOption
- type DescribedPersonality
- type DescribedPlugin
- type DescribedToolchain
- type ListEntry
- type ListOption
- type Personality
- type Plugin
- type PluginReference
- type PulledPersonality
- type PulledPlugin
- type PushResult
- type ResolvedDependencies
- type Toolchain
- type ToolchainReference
Constants ¶
const ( AnnotationName = "io.giantswarm.klaus.name" AnnotationDescription = "io.giantswarm.klaus.description" AnnotationHomepage = "io.giantswarm.klaus.homepage" AnnotationRepository = "io.giantswarm.klaus.repository" AnnotationLicense = "io.giantswarm.klaus.license" AnnotationKeywords = "io.giantswarm.klaus.keywords" AnnotationAuthorName = "io.giantswarm.klaus.author.name" AnnotationAuthorEmail = "io.giantswarm.klaus.author.email" AnnotationAuthorURL = "io.giantswarm.klaus.author.url" )
Klaus-specific OCI manifest annotation keys. All artifact types (plugins, personalities, toolchains) use these annotations to carry common metadata on the manifest.
const ( // MediaTypePluginConfig is the OCI media type for the plugin config blob. MediaTypePluginConfig = "application/vnd.giantswarm.klaus-plugin.config.v1+json" // MediaTypePluginContent is the OCI media type for the plugin content layer. MediaTypePluginContent = "application/vnd.giantswarm.klaus-plugin.content.v1.tar+gzip" )
Media types for Klaus plugin artifacts.
const ( // MediaTypePersonalityConfig is the OCI media type for the personality config blob. MediaTypePersonalityConfig = "application/vnd.giantswarm.klaus-personality.config.v1+json" // MediaTypePersonalityContent is the OCI media type for the personality content layer. MediaTypePersonalityContent = "application/vnd.giantswarm.klaus-personality.content.v1.tar+gzip" )
Media types for Klaus personality artifacts.
const ( DefaultPluginRegistry = "gsoci.azurecr.io/giantswarm/klaus-plugins" DefaultPersonalityRegistry = "gsoci.azurecr.io/giantswarm/klaus-personalities" DefaultToolchainRegistry = "gsoci.azurecr.io/giantswarm/klaus-toolchains" )
Default OCI registry base paths for each Klaus artifact type.
const ( // DefaultCacheFreshTTL is the window within which a cache entry is // returned with zero network traffic. DefaultCacheFreshTTL = 30 * time.Second // DefaultCacheStaleTTL is the default outer bound for tag and reference // entries: beyond this age the entry is discarded and refetched // synchronously. DefaultCacheStaleTTL = 24 * time.Hour // DefaultCacheCatalogStaleTTL is the outer bound for catalog entries. // Registry catalogs change slowly so we keep them much longer. DefaultCacheCatalogStaleTTL = 7 * 24 * time.Hour // DefaultCacheMaxSize is the default LRU budget (bytes) for the content // store. DefaultCacheMaxSize int64 = 2 * 1024 * 1024 * 1024 )
Default TTLs and size limit for the on-disk cache. Exposed as constants so callers can reason about cache behavior.
Variables ¶
This section is empty.
Functions ¶
func IsCached ¶
IsCached returns true if the directory has a cache entry matching the given manifest digest.
func LatestSemverTag ¶ added in v0.0.5
LatestSemverTag returns the highest semver tag from the given list. Tags that are not valid semver are silently ignored.
func RepositoryFromRef ¶ added in v0.0.5
RepositoryFromRef extracts the repository part from an OCI reference, stripping the tag or digest suffix. Handles both repo:tag and repo@sha256:digest formats. Port-only colons (e.g. localhost:5000/repo) are preserved. References without a path component (e.g. "localhost:5000") are returned unchanged.
func ShortName ¶
ShortName extracts the last segment of a repository path. For example, "gsoci.azurecr.io/giantswarm/klaus-plugins/gs-platform" returns "gs-platform".
func SplitNameTag ¶ added in v0.0.5
SplitNameTag splits "name:tag" into name and tag. If no tag-position colon is present, tag is empty. Port-only colons (e.g. "localhost:5000/repo") are not treated as tag separators.
func SplitRegistryBase ¶ added in v0.0.3
SplitRegistryBase splits a registry base path into the registry host and the repository name prefix (with trailing slash). For example, "gsoci.azurecr.io/giantswarm/klaus-plugins" returns ("gsoci.azurecr.io", "giantswarm/klaus-plugins/"). If the base contains no slash, the prefix is empty (matches all repositories).
func ToolchainRegistryRef ¶ added in v0.0.5
ToolchainRegistryRef returns the full registry reference for a toolchain image name. Toolchains use the pattern gsoci.azurecr.io/giantswarm/klaus-toolchains/<name>. If the name already starts with the toolchain registry base, it is returned as-is.
func TruncateDigest ¶
TruncateDigest shortens a digest string for human-readable display. For example, "sha256:abc123def456..." becomes "sha256:abc123def456".
func WriteCacheEntry ¶
func WriteCacheEntry(dir string, entry CacheEntry) error
WriteCacheEntry writes cache metadata to a directory. The PulledAt timestamp is always set to the current time.
Types ¶
type ArtifactInfo ¶ added in v0.0.2
type ArtifactInfo struct {
Ref string // Fully-qualified OCI reference (includes tag)
Tag string // Resolved OCI tag (e.g. "v1.0.0") -- source of truth for Version
Digest string // Manifest digest
}
ArtifactInfo holds OCI-level metadata returned by all operations that contact the registry (describe, pull).
type Author ¶ added in v0.0.8
type Author struct {
Name string `json:"name,omitempty" yaml:"name,omitempty"`
Email string `json:"email,omitempty" yaml:"email,omitempty"`
URL string `json:"url,omitempty" yaml:"url,omitempty"`
}
Author represents the author of an artifact.
type CacheEntry ¶
type CacheEntry struct {
// Digest is the OCI manifest digest.
Digest string `json:"digest"`
// Ref is the original OCI reference that was pulled.
Ref string `json:"ref"`
// PulledAt is when the artifact was last pulled.
PulledAt time.Time `json:"pulledAt"`
// ConfigJSON is the raw OCI config blob, persisted so that metadata
// remains available on cache hits without re-fetching.
ConfigJSON json.RawMessage `json:"configJSON,omitempty"`
// Annotations are the OCI manifest annotations, persisted so that
// common metadata is available on cache hits.
Annotations map[string]string `json:"annotations,omitempty"`
}
CacheEntry holds metadata about a cached artifact.
func ReadCacheEntry ¶
func ReadCacheEntry(dir string) (*CacheEntry, error)
ReadCacheEntry reads the cache metadata from a directory.
type CacheStore ¶ added in v0.0.17
type CacheStore interface {
// ResolveTag returns the manifest digest for a tag reference of the form
// "host/repo:tag". Entries are revalidated with HEAD probes against the
// registry.
ResolveTag(ctx context.Context, ref string) (string, error)
// ResolveManifest returns the full manifest descriptor (digest, size,
// media type) for a tag reference. Callers that plan to fetch the
// manifest body should use this method rather than ResolveTag so the
// returned descriptor carries enough information for downstream
// verification.
ResolveManifest(ctx context.Context, ref string) (ocispec.Descriptor, error)
// Tags returns all tags for a repository of the form "host/repo". Tag
// lists are revalidated with conditional GETs (If-None-Match).
Tags(ctx context.Context, repo string) ([]string, error)
// Repositories returns all repositories under a registry base of the
// form "host/prefix". Empty prefixes enumerate the whole registry.
Repositories(ctx context.Context, base string) ([]string, error)
// Fetch returns a reader for the content of desc. The content is served
// from the local content store when present; otherwise it is fetched
// from the registry and inserted into the store before returning.
Fetch(ctx context.Context, repo string, desc ocispec.Descriptor) (io.ReadCloser, error)
// Close releases resources. It waits for any in-flight background
// revalidations to complete.
Close() error
}
CacheStore provides cached lookups against an OCI registry.
When a CacheStore is attached to a Client via WithCache, every read path (tag resolve, tag list, repository catalog, manifest/blob fetch) consults the store first and falls back to the network on miss. The store is a pure cache: it never serves stale data that contradicts the registry, only data that is either fresh or known-good-pending-revalidation.
Implementations must be safe for concurrent use, and must be safe to use across concurrent processes sharing the same backing directory.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an ORAS-based client for interacting with OCI registries that host Klaus artifacts (plugins and personalities).
func NewClient ¶
func NewClient(opts ...ClientOption) *Client
NewClient creates a new OCI client for Klaus artifacts.
func (*Client) CloseCache ¶ added in v0.0.17
CloseCache releases any cache resources held by the client. It is safe to call even when no cache was configured.
func (*Client) DescribePersonality ¶ added in v0.0.8
func (c *Client) DescribePersonality(ctx context.Context, ref string) (*DescribedPersonality, error)
DescribePersonality fetches the config blob for a personality artifact and returns metadata without downloading the content layer. The soul text is NOT available via describe -- use PullPersonality to get it.
func (*Client) DescribePlugin ¶ added in v0.0.8
DescribePlugin fetches the config blob for a plugin artifact and returns metadata without downloading the content layer. The ref parameter supports short names (e.g. "gs-base"), name:tag, or full OCI references.
func (*Client) DescribeToolchain ¶ added in v0.0.8
DescribeToolchain fetches the manifest for a toolchain image and returns metadata derived from OCI manifest annotations. No config blob or layers are downloaded.
func (*Client) ListPersonalities ¶ added in v0.0.8
ListPersonalities discovers all personality artifacts under the default personality registry (or a custom one via WithRegistry) and returns ListEntry results with name and version extracted from the repository path and tag.
func (*Client) ListPersonalityVersions ¶ added in v0.0.8
ListPersonalityVersions returns all semver tags for a personality, sorted descending. nameOrRef can be a short name (e.g. "sre") or a full OCI repository path.
func (*Client) ListPluginVersions ¶ added in v0.0.8
ListPluginVersions returns all semver tags for a plugin, sorted descending. nameOrRef can be a short name (e.g. "gs-base") or a full OCI repository path.
func (*Client) ListPlugins ¶ added in v0.0.8
ListPlugins discovers all plugin artifacts under the default plugin registry (or a custom one via WithRegistry) and returns ListEntry results.
func (*Client) ListToolchainVersions ¶ added in v0.0.8
ListToolchainVersions returns all semver tags for a toolchain, sorted descending. nameOrRef can be a short name (e.g. "go") or a full OCI repository path.
func (*Client) ListToolchains ¶ added in v0.0.8
ListToolchains discovers all toolchain images under the default toolchain registry (or a custom one via WithRegistry) and returns ListEntry results.
func (*Client) PullPersonality ¶ added in v0.0.8
func (c *Client) PullPersonality(ctx context.Context, ref string, cacheDir string) (*PulledPersonality, error)
PullPersonality downloads a personality artifact from an OCI registry and returns a PulledPersonality with metadata, composition, and soul content. Both annotations (common metadata) and the config blob (composition data) are persisted in the cache entry so that metadata is always populated, even on cache hits.
func (*Client) PullPlugin ¶ added in v0.0.8
PullPlugin downloads a plugin artifact from an OCI registry and returns a PulledPlugin with metadata and the extraction directory. Common metadata is populated from manifest annotations; type-specific fields come from the config blob.
func (*Client) PushPersonality ¶ added in v0.0.8
func (c *Client) PushPersonality(ctx context.Context, sourceDir, ref string, p Personality) (*PushResult, error)
PushPersonality pushes a personality artifact to an OCI registry. Common metadata (name, description, author, etc.) is stored as Klaus annotations on the manifest. The config blob contains only composition data (toolchain + plugins). Version is conveyed through the OCI tag.
func (*Client) PushPlugin ¶ added in v0.0.8
func (c *Client) PushPlugin(ctx context.Context, sourceDir, ref string, p Plugin) (*PushResult, error)
PushPlugin pushes a plugin artifact to an OCI registry. Common metadata (name, description, author, etc.) is stored as Klaus annotations on the manifest. The config blob contains only discovered components (skills, commands, etc.). Version is conveyed through the OCI tag.
func (*Client) ResolveLatestVersion ¶ added in v0.0.5
ResolveLatestVersion lists tags for a repository and returns the full reference with the highest semver tag (e.g. "repo:v1.2.3").
func (*Client) ResolvePersonalityDeps ¶ added in v0.0.8
func (c *Client) ResolvePersonalityDeps(ctx context.Context, p Personality) (*ResolvedDependencies, error)
ResolvePersonalityDeps resolves a personality's toolchain and plugin references by describing each dependency from the registry. The toolchain and all plugins are resolved concurrently, bounded by the client's concurrency limit.
Missing or unreachable artifacts produce warnings rather than hard failures, allowing callers to present partial results (e.g. "plugin gs-sre: not found in registry").
func (*Client) ResolvePersonalityRef ¶ added in v0.0.5
ResolvePersonalityRef resolves a personality short name or OCI reference to a fully-qualified reference with its latest semver tag. Short names (e.g. "sre") are expanded using the default personality registry (e.g. "gsoci.azurecr.io/giantswarm/klaus-personalities/sre:v0.2.0").
func (*Client) ResolvePluginRef ¶ added in v0.0.5
ResolvePluginRef resolves a plugin short name or OCI reference to a fully-qualified reference with its latest semver tag. Short names (e.g. "gs-ae") are expanded using the default plugin registry (e.g. "gsoci.azurecr.io/giantswarm/klaus-plugins/gs-ae:v0.0.3").
func (*Client) ResolveToolchainRef ¶ added in v0.0.5
ResolveToolchainRef resolves a toolchain short name or OCI reference to a fully-qualified reference with its latest semver tag. Short names (e.g. "go") are expanded using the default toolchain registry (e.g. "gsoci.azurecr.io/giantswarm/klaus-toolchains/go:v1.0.0").
type ClientOption ¶
type ClientOption func(*Client)
ClientOption configures the OCI client.
func WithBackgroundRefresh ¶ added in v0.0.17
func WithBackgroundRefresh(enabled bool) ClientOption
WithBackgroundRefresh toggles async revalidation of stale-but-usable cache entries. Default on. When off, stale entries still return immediately but no background probe is issued; the entry is refetched synchronously only when it ages past the stale TTL.
func WithCache ¶ added in v0.0.17
func WithCache(dir string) ClientOption
WithCache enables the on-disk registry response cache rooted at dir. The cache accelerates tag resolves, tag lists, catalog lookups, and manifest/blob fetches. See CacheStore for invalidation details. An empty dir leaves the cache disabled.
func WithCacheMaxSize ¶ added in v0.0.17
func WithCacheMaxSize(bytes int64) ClientOption
WithCacheMaxSize overrides the default LRU budget (bytes) for the content store. A non-positive value disables eviction.
func WithCacheTTL ¶ added in v0.0.17
func WithCacheTTL(fresh, stale time.Duration) ClientOption
WithCacheTTL overrides the default fresh and stale TTLs for reference and tag-list entries. The catalog TTL is not affected. A non-positive value keeps the default for that field.
func WithConcurrency ¶ added in v0.0.5
func WithConcurrency(n int) ClientOption
WithConcurrency sets the maximum number of concurrent registry operations for batch listing methods. Defaults to 10.
func WithPlainHTTP ¶
func WithPlainHTTP(plain bool) ClientOption
WithPlainHTTP disables TLS for registry communication. This is useful for local testing with insecure registries.
func WithRegistryAuthEnv ¶
func WithRegistryAuthEnv(envName string) ClientOption
WithRegistryAuthEnv sets the environment variable name to check for base64-encoded Docker config JSON credentials. If empty (the default), no environment variable is checked and only Docker/Podman config files are used for credential resolution.
type DescribedPersonality ¶ added in v0.0.8
type DescribedPersonality struct {
ArtifactInfo
Personality
}
DescribedPersonality is a Personality with its OCI metadata.
type DescribedPlugin ¶ added in v0.0.8
type DescribedPlugin struct {
ArtifactInfo
Plugin
}
DescribedPlugin is a Plugin with its OCI metadata. Returned by DescribePlugin (config blob fetch only, no layer download).
type DescribedToolchain ¶ added in v0.0.8
type DescribedToolchain struct {
ArtifactInfo
Toolchain
}
DescribedToolchain is a Toolchain with its OCI metadata.
type ListEntry ¶ added in v0.0.8
type ListEntry struct {
Name string // Short name (e.g. "sre", "gs-base")
Version string // Latest semver tag (e.g. "v1.0.0")
Repository string // Full OCI repository path
Reference string // Full OCI reference with tag
}
ListEntry holds metadata for an artifact discovered by list operations. Populated from the registry catalog + tag resolution (no config fetch).
type ListOption ¶ added in v0.0.6
type ListOption func(*listConfig)
ListOption configures the behaviour of listing methods.
func WithFilter ¶ added in v0.0.6
func WithFilter(fn func(repository string) bool) ListOption
WithFilter sets a predicate that is applied to each discovered repository before any network-intensive resolution. Only repositories for which fn returns true will be resolved.
func WithRegistry ¶ added in v0.0.8
func WithRegistry(base string) ListOption
WithRegistry overrides the default registry base path for a listing operation. This supports multi-source registry configurations where the base path comes from user configuration rather than the default constants.
type Personality ¶ added in v0.0.8
type Personality struct {
Name string `yaml:"name" json:"name"`
Description string `yaml:"description,omitempty" json:"description,omitempty"`
Author *Author `yaml:"author,omitempty" json:"author,omitempty"`
Homepage string `yaml:"homepage,omitempty" json:"homepage,omitempty"`
SourceRepo string `yaml:"repository,omitempty" json:"repository,omitempty"`
License string `yaml:"license,omitempty" json:"license,omitempty"`
Keywords []string `yaml:"keywords,omitempty" json:"keywords,omitempty"`
// Toolchain is the container image that provides the runtime environment.
Toolchain ToolchainReference `yaml:"toolchain,omitempty" json:"toolchain,omitempty"`
// Plugins lists the plugin artifacts that compose this personality's capabilities.
Plugins []PluginReference `yaml:"plugins,omitempty" json:"plugins,omitempty"`
// Version is NOT stored in the config blob or personality.yaml. It is
// conveyed via the OCI tag when pushing, and populated from the resolved
// OCI tag when fetching (describe/pull).
Version string `yaml:"-" json:"-"`
}
Personality represents a Klaus personality. Common metadata (name, description, author, etc.) is stored as io.giantswarm.klaus.* manifest annotations in the OCI registry. Only composition fields (toolchain + plugins) are stored in the OCI config blob. JSON tags on metadata fields are retained for display serialization; OCI storage uses personalityConfigBlob.
Personalities are Giant Swarm's composition layer: they combine a toolchain (container image), a set of plugins, and a behavioral identity (soul) into a coherent agent configuration.
Unlike plugins (where the manifest format is defined by upstream Claude Code), the personality definition format is our own. The on-disk source is personality.yaml (YAML) + SOUL.md (Markdown).
Fields are grouped by origin:
- Metadata: from personality.yaml (stored as OCI manifest annotations)
- Composition: from personality.yaml (stored in OCI config blob)
- Version: from OCI tags (not in personality.yaml, not in config blob)
func ReadPersonalityFromDir ¶ added in v0.0.8
func ReadPersonalityFromDir(dir string) (*Personality, error)
ReadPersonalityFromDir reads a personality's metadata from its source directory by parsing personality.yaml.
Version is NOT set -- it is conveyed via the OCI tag at push time. SOUL.md is NOT read -- it lives in the content layer and is included automatically when PushPersonality tar.gz's the source directory.
type Plugin ¶ added in v0.0.8
type Plugin struct {
Name string `json:"name"`
// Version is NOT stored in the config blob. It is conveyed via the
// OCI tag when pushing, and populated from the resolved OCI tag when
// fetching (describe/pull).
Version string `json:"-"`
Description string `json:"description,omitempty"`
Author *Author `json:"author,omitempty"`
Homepage string `json:"homepage,omitempty"`
SourceRepo string `json:"repository,omitempty"`
License string `json:"license,omitempty"`
Keywords []string `json:"keywords,omitempty"`
// Skills lists skill directory names found under skills/ (e.g. "kubernetes", "fluxcd").
Skills []string `json:"skills,omitempty"`
// Commands lists command file names found under commands/ (e.g. "hello", "init-kubernetes").
Commands []string `json:"commands,omitempty"`
// Agents lists agent file names found under agents/ (e.g. "code-reviewer", "security-reviewer").
Agents []string `json:"agents,omitempty"`
// HasHooks is true if the plugin contains hooks/ or a hooks configuration.
HasHooks bool `json:"hasHooks,omitempty"`
// MCPServers lists MCP server names (keys from .mcp.json).
MCPServers []string `json:"mcpServers,omitempty"`
// LSPServers lists LSP server names (keys from .lsp.json).
LSPServers []string `json:"lspServers,omitempty"`
}
Plugin represents a Klaus plugin. Common metadata (name, description, author, etc.) is stored as io.giantswarm.klaus.* manifest annotations in the OCI registry. Only type-specific fields are stored in the OCI config blob. JSON tags on metadata fields are retained for display serialization (CLI output, API responses); OCI storage uses pluginConfigBlob.
The first group of fields comes directly from .claude-plugin/plugin.json and aligns with the Claude Code plugin manifest schema: https://code.claude.com/docs/en/plugins-reference#plugin-manifest-schema
The second group (Skills, Commands, Agents, HasHooks, MCPServers, LSPServers) is computed at push time by scanning the plugin directory. These are NOT plugin.json fields -- in the upstream spec, "commands", "skills", "agents" etc. are path overrides (string|array) that tell Claude Code where to find components. Here we store the *discovered* component names so that Describe can report what the plugin provides without downloading the content layer.
func ReadPluginFromDir ¶ added in v0.0.8
ReadPluginFromDir reads a plugin's metadata from its source directory.
It reads .claude-plugin/plugin.json for manifest metadata (name, description, author, etc.) and then scans the directory tree to discover components:
- skills/ subdirectories containing SKILL.md -> Skills
- commands/*.md files -> Commands
- agents/*.md files -> Agents
- hooks/ directory or hooks config in plugin.json -> HasHooks
- .mcp.json top-level keys -> MCPServers
- .lsp.json top-level keys -> LSPServers
Version is NOT set -- it is conveyed via the OCI tag at push time.
type PluginReference ¶
type PluginReference struct {
Repository string `yaml:"repository" json:"repository"`
Tag string `yaml:"tag,omitempty" json:"tag,omitempty"`
Digest string `yaml:"digest,omitempty" json:"digest,omitempty"`
}
PluginReference points to a plugin OCI artifact.
func (PluginReference) Ref ¶
func (p PluginReference) Ref() string
Ref returns the full OCI reference string for this plugin. If Digest is set, it is used (repo@digest). Otherwise Tag is used (repo:tag). If neither is set, the bare repository is returned.
type PulledPersonality ¶ added in v0.0.8
type PulledPersonality struct {
ArtifactInfo
Personality
Soul string // Behavioral identity text from SOUL.md (content layer only)
Dir string
Cached bool
}
PulledPersonality is a Personality with OCI metadata, local file state, and the soul text (which is only available after pulling the content layer).
type PulledPlugin ¶ added in v0.0.8
type PulledPlugin struct {
ArtifactInfo
Plugin
Dir string // Local directory where files were extracted
Cached bool // True if pull was skipped (cache hit)
}
PulledPlugin is a Plugin with OCI metadata and local file state.
type PushResult ¶
type PushResult struct {
Digest string
}
PushResult holds the outcome of a push operation.
type ResolvedDependencies ¶ added in v0.0.8
type ResolvedDependencies struct {
Toolchain *DescribedToolchain
Plugins []DescribedPlugin
Warnings []string // e.g. "plugin gs-sre: not found in registry"
}
ResolvedDependencies holds the result of resolving a personality's toolchain and plugin references.
type Toolchain ¶ added in v0.0.8
type Toolchain struct {
Name string `json:"name"`
// Version is populated from the OCI tag (not from annotations or
// any config blob). Same convention as Plugin and Personality.
Version string `json:"-"`
Description string `json:"description,omitempty"`
Author *Author `json:"author,omitempty"`
Homepage string `json:"homepage,omitempty"`
SourceRepo string `json:"repository,omitempty"`
License string `json:"license,omitempty"`
Keywords []string `json:"keywords,omitempty"`
}
Toolchain represents a Klaus toolchain (container image). Derived from OCI manifest annotations since toolchains are standard Docker images, not custom OCI artifacts.
Fields mirror the metadata fields of Plugin and Personality for consistency. Each field maps to a Klaus annotation (io.giantswarm.klaus.*), parsed via metadataFromAnnotations.
Version is populated from the OCI tag, same as Plugin and Personality.
type ToolchainReference ¶ added in v0.0.8
type ToolchainReference struct {
Repository string `yaml:"repository" json:"repository"`
Tag string `yaml:"tag,omitempty" json:"tag,omitempty"`
Digest string `yaml:"digest,omitempty" json:"digest,omitempty"`
}
ToolchainReference points to a toolchain container image. Same shape as PluginReference but a distinct type for clarity.
func (ToolchainReference) Ref ¶ added in v0.0.8
func (t ToolchainReference) Ref() string
Ref returns the full OCI reference string for this toolchain. If Digest is set, it is used (repo@digest). Otherwise Tag is used (repo:tag). If neither is set, the bare repository is returned.