manifest

package
v3.15.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractLayer

func ExtractLayer(layerName string, data []byte, destDir string) error

ExtractLayer unpacks the named manifest layer into its target directory under destDir (see LayerTargetDir), creating the directory if absent. The provenance layer is extracted with flat record files preserved; all other layers strip a common top-level directory prefix so files land directly under their target.

func ExtractProvenance

func ExtractProvenance(data []byte, destDir string) error

ExtractProvenance unpacks the provenance layer tar into destDir. Each tar entry (named <recordID>.yml) is written directly under destDir.

func ExtractSpecs

func ExtractSpecs(data []byte, destDir string) error

ExtractSpecs unpacks the specs layer tar into destDir. If all entries share a single common top-level directory component (e.g. "linespec.manifest/"), that prefix is stripped so files land directly in destDir.

func LayerTargetDir

func LayerTargetDir(layerName, destDir string) string

LayerTargetDir returns the directory, relative to a cloned project's root destDir, into which the named manifest layer is extracted:

  • "provenance" → destDir/provenance (flat record files)
  • "specs" → destDir/linespecs (.linespec test files and payloads)
  • any other → destDir (service source, prompt artifacts at the root)

The specs layer is given its own directory so cloned .linespec files are contained rather than dumped loose into the project root, mirroring the provenance/ convention.

func ProvenanceRecordIDs

func ProvenanceRecordIDs(data []byte) ([]string, error)

ProvenanceRecordIDs returns the list of record IDs (filenames without .yml) present in a provenance layer tar, without extracting anything to disk.

Types

type FetchedManifest

type FetchedManifest struct {
	Version string
	Name    string            // project name from the manifest, empty if not set
	Layers  map[string][]byte // layer name → raw artifact bytes
}

FetchedManifest is the result of a successful Fetch: all layers downloaded and hash-verified, ready to be extracted to disk.

func Fetch

func Fetch(manifestURL, version string) (*FetchedManifest, error)

Fetch downloads or reads the manifest from manifestURL (HTTP/HTTPS URL or local file path), resolves the target version, verifies the root_hash against the layer hashes (aborting before any layer download on mismatch), then fetches and SHA256-verifies each layer. Nothing is written to disk on any verification failure.

When manifestURL is a local file path and a layer's URL field is empty, the layer artifact is auto-resolved from the manifest's directory using the naming convention linespec-{layerName}-{version}.tar (matching the output of linespec provenance publish).

Version resolution order: @version URL suffix → version argument → manifest.latest.

type Manifest

type Manifest struct {
	Name     string                     `json:"name,omitempty"`
	Latest   string                     `json:"latest"`
	Versions map[string]ManifestVersion `json:"versions"`
}

Manifest is the top-level structure of linespec.manifest.json.

type ManifestLayer

type ManifestLayer struct {
	SHA256   string            `json:"sha256"`
	URL      string            `json:"url"`
	Metadata map[string]string `json:"metadata,omitempty"`
}

ManifestLayer holds the declared hash and download URL for a single layer artifact.

type ManifestVersion

type ManifestVersion struct {
	CreatedAt string                   `json:"created_at"`
	RootHash  string                   `json:"root_hash"`
	Layers    map[string]ManifestLayer `json:"layers"`
}

ManifestVersion represents one immutable published version.

Jump to

Keyboard shortcuts

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