pluginreference

package
v2.0.0-...-00053fb Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package pluginreference defines plugin dependency declarations independently of registry transport, artifact resolution, and runtime loading.

Index

Constants

View Source
const DefaultRegistry = "https://plugins.actionlint.kjanat.dev/"

DefaultRegistry is the public actionlint plugin catalogue.

Variables

This section is empty.

Functions

func CheckDigest

func CheckDigest(digest string) error

CheckDigest accepts a SHA256 digest written as 64 lowercase hex digits, the canonical form of OCI digests and sha256:// cache addresses.

func IsOCI

func IsOCI(source string) bool

IsOCI reports whether source uses the oci:// scheme.

func LocalRegistryDirectory

func LocalRegistryDirectory(raw string) (string, error)

LocalRegistryDirectory accepts an explicit absolute file URI. Local candidate catalogues have no authenticated publisher and cannot substitute for HTTPS registries.

func NormalizeDigest

func NormalizeDigest(digest string) (string, bool)

NormalizeDigest accepts a SHA256 digest written as 64 hex digits in either case and returns it in lowercase. URL pins (#sha256=<hex>) and candidate digests use it; content addresses, which must already be canonical, use CheckDigest.

func NormalizeSource

func NormalizeSource(source, directory string) (reference, local string, err error)

NormalizeSource roots filesystem paths in directory while preserving URI identity, including queries and digest pins. local is empty for remote URLs; otherwise it identifies the local file consumed by the artifact resolver. It validates the location without reading files or making network requests.

func ValidAlias

func ValidAlias(name string) bool

ValidAlias checks the shared catalogue and declaration shorthand syntax.

func ValidName

func ValidName(name string) bool

ValidName accepts a repository selector or a package beneath its GitHub repository. GitLab's nested namespaces already share this path grammar; authenticated catalogue evidence establishes its repository boundary.

func ValidRepository

func ValidRepository(name string) bool

ValidRepository validates forge-qualified repository paths for declarations and catalogue identities.

func ValidVersion

func ValidVersion(version string) bool

ValidVersion accepts exact release tags, including slash-separated tag names.

Types

type ModuleLocation

type ModuleLocation struct {
	// Endpoint is the URI without its fragment. It is nil for a filesystem
	// path.
	Endpoint *url.URL
	// Local is the filesystem path the location names. It is empty for an
	// http, https or sha256 URI.
	Local string
	// Pin is the lowercase hex SHA256 digest the location pins with
	// #sha256=<hex>, or the digest a sha256 URI names. It is empty when the
	// location pins nothing.
	Pin string
}

ModuleLocation is a parsed WebAssembly module or tool provider package location that is not an oci:// reference: a filesystem path, or a file, http, https or sha256 URI. Parsing reads no files and makes no requests.

func ParseModuleLocation

func ParseModuleLocation(source string) (ModuleLocation, error)

ParseModuleLocation parses source as a filesystem path or a file, http, https or sha256 URI. Only explicit :// locations are URIs, so drive paths and colons in ordinary filenames stay paths on every host. It refuses credentials in URIs, malformed digest pins and other schemes, including oci.

func (ModuleLocation) File

func (l ModuleLocation) File(directory string) string

File returns the local file the location names. A relative filesystem path is rooted in directory and a filesystem path is cleaned; a file URI's path is returned as parsed. File returns "" for a remote location.

type OCIReference

type OCIReference struct {
	// contains filtered or unexported fields
}

OCIReference is a parsed oci:// source: oci://<host>/<repository> with either @sha256:<hex> naming the root image index or manifest, or :<tag>. Only plugin install accepts a tag, which it resolves to a digest.

func ParseOCI

func ParseOCI(source string) (OCIReference, error)

ParseOCI parses oci://<host>/<repository>@sha256:<hex> and refuses a tag.

func ParseOCITag

func ParseOCITag(source string) (OCIReference, error)

ParseOCITag parses oci://<host>/<repository>:<tag> or a digest reference. Only plugin install accepts a tag, which it resolves to a digest.

func (OCIReference) Digest

func (r OCIReference) Digest() string

Digest returns the SHA256 hex of the root index or manifest, or "" for a tag reference.

func (OCIReference) Endpoint

func (r OCIReference) Endpoint() *url.URL

Endpoint returns the HTTP authority used by the OCI client. Loopback sources use plain HTTP like Docker; public-only policy still rejects their addresses.

func (OCIReference) Host

func (r OCIReference) Host() string

Host returns the registry host, with its port if the source names one.

func (OCIReference) Repository

func (r OCIReference) Repository() string

Repository returns the repository name within the registry.

func (OCIReference) String

func (r OCIReference) String() string

String returns the normalized source.

func (OCIReference) Tag

func (r OCIReference) Tag() string

Tag returns the tag of a tag reference, or "" for a digest reference.

func (OCIReference) WithDigest

func (r OCIReference) WithDigest(digest string) (OCIReference, error)

WithDigest returns the digest reference to the same repository.

type Reference

type Reference struct {
	// contains filtered or unexported fields
}

Reference declares a registry alias or repository, requested release, and catalogue. Only Parse, New and NewCandidate build one, so values remain normalized. The zero Reference declares nothing.

func New

func New(name, version, registry string) (Reference, error)

New validates and normalizes a plugin declaration. Empty version and registry select latest stable and DefaultRegistry respectively.

func NewCandidate

func NewCandidate(name, version, registry, digest string) (Reference, error)

NewCandidate binds an exact canonical package from an explicit local registry to the SHA256 digest verified during installation.

func ParsePluginReference

func ParsePluginReference(value string) (Reference, error)

ParsePluginReference accepts an alias, owner/repo or forge-qualified repository/package, optionally followed by @latest or an exact release tag.

func (Reference) CandidateDigest

func (r Reference) CandidateDigest() string

CandidateDigest binds a local candidate declaration to one verified artifact. It is empty for unpinned local install requests and published registries.

func (Reference) DirectSource

func (r Reference) DirectSource() string

DirectSource returns a SHA-pinned artifact URL or oci:// digest reference, or empty for registry entries. Direct declarations already contain their immutable pin and need no lock row.

func (Reference) Equal

func (r Reference) Equal(other Reference) bool

Equal compares normalized declaration identities and selection intent.

func (Reference) IsAlias

func (r Reference) IsAlias() bool

IsAlias reports a registry-assigned shorthand, whose repository is resolved by that registry and recorded in the project lock.

func (Reference) Name

func (r Reference) Name() string

Name returns the registry alias or forge-qualified repository. For a direct declaration it returns the artifact URL without its #sha256= pin.

func (Reference) Normalize

func (r Reference) Normalize() (Reference, error)

Normalize validates either supported declaration form.

func (Reference) Registry

func (r Reference) Registry() string

Registry returns the normalized catalogue URL, ending in "/". It is empty for a direct declaration.

func (Reference) String

func (r Reference) String() string

String preserves the declared alias or full repository identity.

func (Reference) Version

func (r Reference) Version() string

Version returns "latest" or an exact release tag, never a resolved artifact. It is empty for a direct declaration.

Jump to

Keyboard shortcuts

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