Documentation
¶
Index ¶
- func ExtractLayer(layerName string, data []byte, destDir string) error
- func ExtractProvenance(data []byte, destDir string) error
- func ExtractSpecs(data []byte, destDir string) error
- func LayerTargetDir(layerName, destDir string) string
- func ProvenanceRecordIDs(data []byte) ([]string, error)
- type FetchedManifest
- type Manifest
- type ManifestLayer
- type ManifestVersion
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractLayer ¶
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 ¶
ExtractProvenance unpacks the provenance layer tar into destDir. Each tar entry (named <recordID>.yml) is written directly under destDir.
func ExtractSpecs ¶
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 ¶
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 ¶
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.