artifact

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package artifact defines immutable, target-independent generated artifacts.

Index

Constants

View Source
const AggregateChecksumAsset = "pasture-aggregate-manifest.json.sha256"
View Source
const AggregateManifestAsset = "pasture-aggregate-manifest.json"
View Source
const AggregateManifestSchema = "pasture.aggregate-release/v1"

Variables

This section is empty.

Functions

func AggregateManifestChecksum

func AggregateManifestChecksum(manifest []byte) []byte

AggregateManifestChecksum returns the canonical checksum sidecar bytes.

Types

type AggregateAssetSource

type AggregateAssetSource interface {
	OpenAsset(context.Context, string) (io.ReadCloser, error)
}

AggregateAssetSource injects release asset I/O for verification and testing.

type AggregateComponent

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

AggregateComponent is one immutable member of the closed three-by-three set.

func (AggregateComponent) Asset

func (c AggregateComponent) Asset() string

func (AggregateComponent) AuraRevision

func (c AggregateComponent) AuraRevision() Revision

func (AggregateComponent) BundleID

func (c AggregateComponent) BundleID() BundleID

func (AggregateComponent) Digest

func (c AggregateComponent) Digest() Digest

func (AggregateComponent) Extension

func (c AggregateComponent) Extension() Extension

func (AggregateComponent) Harness

func (c AggregateComponent) Harness() Harness

func (AggregateComponent) ID

func (AggregateComponent) PastureRevision

func (c AggregateComponent) PastureRevision() Revision

func (AggregateComponent) RuntimeContractID

func (c AggregateComponent) RuntimeContractID() RuntimeContractID

type AggregateComponentSpec

type AggregateComponentSpec struct {
	Harness           Harness
	Extension         Extension
	Asset             string
	Digest            Digest
	BundleID          BundleID
	RuntimeContractID RuntimeContractID
	PastureRevision   Revision
	AuraRevision      Revision
}

AggregateComponentSpec is the typed producer input for one component.

type AggregateManifest

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

AggregateManifest is a completely validated immutable aggregate release.

func NewAggregateManifest

func NewAggregateManifest(spec AggregateManifestSpec) (AggregateManifest, error)

NewAggregateManifest validates typed producer input through the public codec.

func ParseAggregateManifest

func ParseAggregateManifest(data []byte) (AggregateManifest, error)

ParseAggregateManifest strictly decodes the public aggregate manifest codec.

func VerifyAggregateManifest

func VerifyAggregateManifest(manifestBytes, checksumBytes []byte) (AggregateManifest, error)

VerifyAggregateManifest validates the immutable checksum sidecar and strict manifest without opening components.

func (AggregateManifest) AuraRevision

func (m AggregateManifest) AuraRevision() Revision

func (AggregateManifest) Channel

func (m AggregateManifest) Channel() ReleaseChannel

func (AggregateManifest) Compatible

func (m AggregateManifest) Compatible(installer Version) bool

func (AggregateManifest) Components

func (m AggregateManifest) Components() []AggregateComponent

func (AggregateManifest) InstallerMax

func (m AggregateManifest) InstallerMax() Version

func (AggregateManifest) InstallerMin

func (m AggregateManifest) InstallerMin() Version

func (AggregateManifest) MarshalJSON

func (m AggregateManifest) MarshalJSON() ([]byte, error)

MarshalJSON emits the canonical aggregate manifest representation.

func (AggregateManifest) PastureRevision

func (m AggregateManifest) PastureRevision() Revision

func (*AggregateManifest) UnmarshalJSON

func (m *AggregateManifest) UnmarshalJSON(data []byte) error

UnmarshalJSON replaces m only after complete strict validation.

func (AggregateManifest) Version

func (m AggregateManifest) Version() Version

type AggregateManifestSpec

type AggregateManifestSpec struct {
	Version         Version
	Channel         ReleaseChannel
	InstallerMin    Version
	InstallerMax    Version
	PastureRevision Revision
	AuraRevision    Revision
	Components      []AggregateComponentSpec
}

AggregateManifestSpec is the typed producer input for a complete release.

type AggregateRequirements

type AggregateRequirements struct {
	Version                Version
	Installer              Version
	PastureRevision        Revision
	AuraRevision           Revision
	MaxAssetBytes          int64
	MaxTotalBytes          int64
	ExpectedManifestDigest Digest
}

AggregateRequirements are trusted installer-side constraints.

type AggregateValidationError

type AggregateValidationError struct {
	Stage, Field, Reason, Impact, Fix string
	Cause                             error
}

AggregateValidationError is an actionable aggregate release failure.

func (*AggregateValidationError) Error

func (e *AggregateValidationError) Error() string

func (*AggregateValidationError) Unwrap

func (e *AggregateValidationError) Unwrap() error

type Bundle

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

Bundle is an immutable content-addressed artifact and implements fs.FS for its declared regular-file leaves.

func NewBundle

func NewBundle(source fs.FS, manifest Manifest) (Bundle, error)

NewBundle validates source against manifest and snapshots every file byte. The returned value owns no handle or alias into source.

func (Bundle) Equal

func (b Bundle) Equal(other Bundle) bool

Equal reports whether two validated bundles have identical canonical manifests and content addresses.

func (Bundle) ID

func (b Bundle) ID() BundleID

ID returns the bundle's derived content address.

func (Bundle) Manifest

func (b Bundle) Manifest() Manifest

Manifest returns an owned immutable copy of the bundle inventory.

func (Bundle) Open

func (b Bundle) Open(name string) (fs.File, error)

Open returns a fresh read-only handle for a declared regular-file leaf.

type BundleID

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

BundleID is the validated content address of a complete artifact manifest.

func ParseBundleID

func ParseBundleID(value string) (BundleID, error)

ParseBundleID validates the canonical artifact bundle identifier.

func (BundleID) MarshalText

func (id BundleID) MarshalText() ([]byte, error)

func (BundleID) String

func (id BundleID) String() string

func (*BundleID) UnmarshalText

func (id *BundleID) UnmarshalText(text []byte) error

type ComponentID

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

ComponentID is the opaque canonical target descriptor identity harness/extension.

func ComponentIDs

func ComponentIDs() []ComponentID

ComponentIDs returns every canonical coordinate in harness-major order.

func NewComponentID

func NewComponentID(harness Harness, extension Extension) (ComponentID, error)

NewComponentID constructs one member of the closed three-by-three matrix.

func ParseComponentID

func ParseComponentID(value string) (ComponentID, error)

ParseComponentID validates one member of the closed three-by-three matrix.

func (ComponentID) Extension

func (id ComponentID) Extension() Extension

func (ComponentID) Harness

func (id ComponentID) Harness() Harness

func (ComponentID) IsValid

func (id ComponentID) IsValid() bool

func (ComponentID) String

func (id ComponentID) String() string

type Digest

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

Digest is a validated lowercase SHA-256 content digest.

func DigestBytes

func DigestBytes(content []byte) Digest

DigestBytes returns the SHA-256 digest of the exact supplied bytes.

func ParseDigest

func ParseDigest(value string) (Digest, error)

ParseDigest validates the canonical sha256:<64 lowercase hex> form.

func (Digest) MarshalText

func (d Digest) MarshalText() ([]byte, error)

func (Digest) String

func (d Digest) String() string

func (*Digest) UnmarshalText

func (d *Digest) UnmarshalText(text []byte) error

type Entry

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

Entry is one immutable manifest entry.

func NewDirectoryEntry

func NewDirectoryEntry(entryPath Path, mode Mode) (Entry, error)

NewDirectoryEntry constructs a validated directory manifest entry.

func NewFileEntry

func NewFileEntry(entryPath Path, mode Mode, digest Digest) (Entry, error)

NewFileEntry constructs a validated regular-file manifest entry.

func (Entry) Digest

func (e Entry) Digest() Digest

func (Entry) IsDirectory

func (e Entry) IsDirectory() bool

func (Entry) IsRegular

func (e Entry) IsRegular() bool

func (Entry) Mode

func (e Entry) Mode() Mode

func (Entry) Path

func (e Entry) Path() Path

func (Entry) Type

func (e Entry) Type() EntryType

type EntryType

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

EntryType is one of the closed artifact entry variants.

func DirectoryType

func DirectoryType() EntryType

DirectoryType returns the directory entry variant.

func ParseEntryType

func ParseEntryType(value string) (EntryType, error)

ParseEntryType decodes a closed artifact entry variant.

func RegularFileType

func RegularFileType() EntryType

RegularFileType returns the regular-file entry variant.

func (EntryType) MarshalText

func (t EntryType) MarshalText() ([]byte, error)

func (EntryType) String

func (t EntryType) String() string

func (*EntryType) UnmarshalText

func (t *EntryType) UnmarshalText(text []byte) error

type Extension

type Extension uint8

Extension identifies one immutable generated component class.

const (
	ExtensionSkills Extension = iota + 1
	ExtensionAgents
	ExtensionHooks
)

func ParseExtension

func ParseExtension(value string) (Extension, error)

func (Extension) IsValid

func (e Extension) IsValid() bool

func (Extension) MarshalText

func (e Extension) MarshalText() ([]byte, error)

func (Extension) String

func (e Extension) String() string

func (*Extension) UnmarshalText

func (e *Extension) UnmarshalText(text []byte) error

type Harness

type Harness string

Harness identifies one supported installation harness.

const (
	HarnessClaudeCode Harness = "claude-code"
	HarnessOpenCode   Harness = "opencode"
	HarnessCodex      Harness = "codex"
)

func (Harness) IsValid

func (h Harness) IsValid() bool

type Manifest

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

Manifest is an immutable, lexicographically ordered artifact inventory.

func NewManifest

func NewManifest(entries ...Entry) (Manifest, error)

NewManifest validates ownership collisions and snapshots entries in lexicographic path order.

func ParseManifest

func ParseManifest(data []byte) (Manifest, error)

ParseManifest decodes and validates a manifest. Entry order in the input is canonicalized by NewManifest before the value can be observed.

func (Manifest) Entries

func (m Manifest) Entries() []Entry

Entries returns a copy in canonical lexicographic order.

func (Manifest) Equal

func (m Manifest) Equal(other Manifest) bool

Equal reports semantic equality of two validated manifests.

func (Manifest) Len

func (m Manifest) Len() int

Len returns the number of explicit manifest entries.

func (Manifest) MarshalBinary

func (m Manifest) MarshalBinary() ([]byte, error)

MarshalBinary emits the same canonical bytes as MarshalJSON.

func (Manifest) MarshalJSON

func (m Manifest) MarshalJSON() ([]byte, error)

MarshalJSON emits the canonical manifest codec.

func (*Manifest) UnmarshalBinary

func (m *Manifest) UnmarshalBinary(data []byte) error

UnmarshalBinary replaces m only after the complete input validates.

func (*Manifest) UnmarshalJSON

func (m *Manifest) UnmarshalJSON(data []byte) error

UnmarshalJSON replaces m only after the complete input validates.

type Mode

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

Mode is an explicit set of Unix permission bits.

func NewMode

func NewMode(bits uint32) (Mode, error)

NewMode accepts permission bits in the inclusive range 0000 through 0777.

func ParseMode

func ParseMode(value string) (Mode, error)

ParseMode decodes the canonical four-digit octal form, such as 0644.

func (Mode) Bits

func (m Mode) Bits() uint32

Bits returns the validated permission bits.

func (Mode) MarshalText

func (m Mode) MarshalText() ([]byte, error)

func (Mode) String

func (m Mode) String() string

func (*Mode) UnmarshalText

func (m *Mode) UnmarshalText(text []byte) error

type Path

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

Path is a canonical, slash-separated relative artifact path.

func NewPath

func NewPath(value string) (Path, error)

NewPath validates and owns a canonical artifact path.

func (Path) MarshalText

func (p Path) MarshalText() ([]byte, error)

MarshalText returns the canonical path spelling.

func (Path) String

func (p Path) String() string

func (*Path) UnmarshalText

func (p *Path) UnmarshalText(text []byte) error

UnmarshalText replaces p only after the complete input validates.

type ReleaseChannel

type ReleaseChannel string

ReleaseChannel is the closed aggregate release channel.

const (
	ReleaseFinal      ReleaseChannel = "final"
	ReleasePrerelease ReleaseChannel = "prerelease"
)

type Revision

type Revision string

Revision is an immutable lowercase Git commit identity.

func ParseRevision

func ParseRevision(value string) (Revision, error)

ParseRevision validates an immutable Git commit identity.

func (Revision) String

func (r Revision) String() string

type RuntimeContractID

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

RuntimeContractID is one opaque constructor-owned, harness-bound target identity.

func NewRuntimeContractID

func NewRuntimeContractID(harness Harness, name string) (RuntimeContractID, error)

NewRuntimeContractID constructs a canonical <harness>/<profile> identity.

func ParseRuntimeContractID

func ParseRuntimeContractID(value string) (RuntimeContractID, error)

ParseRuntimeContractID parses the same canonical identity emitted by target descriptors.

func ProductionRuntimeContract

func ProductionRuntimeContract(harness Harness) (RuntimeContractID, error)

ProductionRuntimeContract returns the sole registered target profile accepted by runtime lowering, target descriptors, and aggregate releases.

func (RuntimeContractID) Harness

func (id RuntimeContractID) Harness() Harness

func (RuntimeContractID) IsValid

func (id RuntimeContractID) IsValid() bool

func (RuntimeContractID) MarshalJSON

func (id RuntimeContractID) MarshalJSON() ([]byte, error)

func (RuntimeContractID) String

func (id RuntimeContractID) String() string

func (*RuntimeContractID) UnmarshalJSON

func (id *RuntimeContractID) UnmarshalJSON(data []byte) error

type ValidationError

type ValidationError struct {
	Stage  string
	Bundle string
	Entry  string
	Rule   string
	Reason string
	Impact string
	Fix    string
	Cause  error
}

ValidationError describes a rejected artifact value or filesystem boundary. Its fields are stable so callers can present or inspect the actionable failure without parsing Error's text.

func (*ValidationError) Error

func (e *ValidationError) Error() string

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap returns the lower-level filesystem or codec error, when one exists.

type VerifiedAggregate

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

VerifiedAggregate is produced only after all manifest and component bytes verify.

func VerifyAggregate

func VerifyAggregate(ctx context.Context, source AggregateAssetSource, requirements AggregateRequirements) (VerifiedAggregate, error)

VerifyAggregate verifies the checksum, identity, compatibility, revisions, and every component before returning a value usable by a mutator.

func (VerifiedAggregate) Asset

func (v VerifiedAggregate) Asset(id ComponentID) ([]byte, bool)

func (VerifiedAggregate) Manifest

func (v VerifiedAggregate) Manifest() AggregateManifest

type Version

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

Version is a validated semantic version without a leading v.

func ParseVersion

func ParseVersion(value string) (Version, error)

ParseVersion parses the canonical SemVer form used by aggregate releases.

func (Version) Compare

func (v Version) Compare(other Version) int

Compare returns -1, 0, or 1 according to SemVer precedence.

func (Version) IsPrerelease

func (v Version) IsPrerelease() bool

func (Version) String

func (v Version) String() string

Jump to

Keyboard shortcuts

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