pigletbuild

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: MIT Imports: 52 Imported by: 0

Documentation

Overview

Package pigletbuild validates Piglet closure and builds source or binary Piglet artifacts.

Piglet Binary build implementation. The public entry point is only `pig piglet build`; no standalone build namespace is exposed.

Package pigletbuild hosts Piglet Binary planning while orchestration is moved to the final Piglet artifact package. The planner is factual: compatible Go factories fuse; every other extension is an exact subprocess component.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunPigletBuildCommand

func RunPigletBuildCommand(args []string, stdout, stderr io.Writer) int

RunPigletBuildCommand handles the sole public Piglet output build path.

func RunPigletPublishCommand

func RunPigletPublishCommand(args []string, stdout, stderr io.Writer) int

RunPigletPublishCommand handles `pig piglet publish`.

Types

type BuilderBackend

type BuilderBackend interface {
	Name() string
	Probe(context.Context, BuilderRequest) BuilderReadiness
	Build(context.Context, BuilderRequest) (BuilderResult, error)
}

BuilderBackend probes and executes one build provenance. Probe must have no authentication, prompt, download, or mutation side effects. pig additive (D18): Piglet Binary builds select generic named builders.

type BuilderReadiness

type BuilderReadiness struct {
	Builder string `json:"builder"`
	Ready   bool   `json:"ready"`
	Code    string `json:"code,omitempty"`
	Message string `json:"message,omitempty"`
	Remedy  string `json:"remedy,omitempty"`
}

BuilderReadiness is the side-effect-free probe result used by auto selection and non-interactive remediation.

type BuilderRequest

type BuilderRequest struct {
	Piglet  *piglet.Piglet
	Cells   []subprocess.CellSpec
	Options Options
	Output  string
	Stdout  io.Writer
	Stderr  io.Writer
}

BuilderRequest is one already-validated, locked Piglet build request.

type BuilderResult

type BuilderResult struct {
	Builder  string
	Artifact string
	Record   string
}

BuilderResult identifies the output produced by exactly one backend.

type BuilderUnavailableError

type BuilderUnavailableError struct {
	Readiness BuilderReadiness
}

BuilderUnavailableError carries one exact readiness result to JSON callers.

func (*BuilderUnavailableError) Error

func (e *BuilderUnavailableError) Error() string

type Compat

type Compat string

Compat describes whether a target/component pair is available without a target-side build toolchain.

const (
	CompatNative      Compat = "native"
	CompatHostReliant Compat = "host-reliant"
	CompatUnavailable Compat = "unavailable"
)

type ContainerBuilderConfig

type ContainerBuilderConfig struct {
	Name   string `json:"name"`
	Engine string `json:"engine"`
	Image  string `json:"image"`
}

type Decision

type Decision string

Decision is how one extension executes in the Piglet Binary.

const (
	DecisionFuse    Decision = "fuse"
	DecisionSidecar Decision = "sidecar"
)

type ExtPlan

type ExtPlan struct {
	Extension string            `json:"extension"`
	Decision  Decision          `json:"decision"`
	Reason    string            `json:"reason,omitempty"`
	Compat    map[string]Compat `json:"compat"`
}

ExtPlan is one extension's realization and target compatibility.

type ExtensionInput

type ExtensionInput struct {
	Name             string
	Language         Language
	Fusible          bool
	NotFusibleReason string
}

ExtensionInput contains the runtime-cell facts needed for one decision.

type Language

type Language string

Language is one extension implementation language.

const (
	Go     Language = "go"
	Rust   Language = "rust"
	Python Language = "python"
	Node   Language = "node"
)

type NoBuilderReadyError

type NoBuilderReadyError struct {
	Readiness []BuilderReadiness
}

NoBuilderReadyError carries every side-effect-free probe result for auto.

func (*NoBuilderReadyError) Error

func (e *NoBuilderReadyError) Error() string

type Options

type Options struct {
	Format        string
	Locked        bool
	Record        string
	Targets       []Target
	Sandbox       Sandbox
	BakedSettings []byte
	Version       string
	Builder       string
	Verification  string
	Workspace     string
	// SignKeyPath is the ed25519 private key a Piglet Binary is signed with.
	SignKeyPath string
	// SignKey is SignKeyPath's key, read before any build work starts.
	SignKey ed25519.PrivateKey
}

Options configures one Piglet output build. Component realization is not configurable; it is derived from component facts.

type Plan

type Plan struct {
	Targets  []string  `json:"targets"`
	Ext      []ExtPlan `json:"plan"`
	Warnings []Warning `json:"warnings"`
}

Plan is the deterministic Piglet Binary delivery plan.

func BuildPlan

func BuildPlan(extensions []ExtensionInput, options Options) Plan

BuildPlan derives realization and target compatibility from extension facts.

type Sandbox

type Sandbox struct {
	Native    Target
	RustCross bool
	PyCross   bool
}

Sandbox describes builder cross-target capabilities.

type Target

type Target struct {
	OS   string `json:"os"`
	Arch string `json:"arch"`
}

Target is an os/arch build target.

func (Target) String

func (t Target) String() string

type Verdict

type Verdict struct {
	OK       bool     `json:"ok"`
	Blockers []string `json:"blockers,omitempty"`
}

Verdict reports whether resolution produced a complete buildable Piglet.

func Validate

func Validate(plan Plan, resolutionWarnings []string, listedExtensions, extensionCount int, hasFrontend, requireFused bool) Verdict

Validate rejects unresolved Piglet extensions and a Piglet whose listed extensions resolve to none, and enforces an authored realization requirement. listedExtensions counts the effective Piglet's extension entries (after extends and extends.remove); extensionCount counts the extensions resolution produced. A Piglet that lists no extensions still builds: a base that only strips built-ins or sets defaults, or one with a frontend member, is a Binary of Stock PiG's own parts. Advisory target compatibility warnings are represented in the plan and do not masquerade as a successful self-contained target.

pig additive (D18): a Piglet Binary needs no extension.

type Warning

type Warning struct {
	Level     string `json:"level"`
	Code      string `json:"code"`
	Target    string `json:"target,omitempty"`
	Extension string `json:"extension,omitempty"`
	Message   string `json:"message"`
	Remedy    string `json:"remedy,omitempty"`
}

Warning is one actionable planning diagnostic.

Directories

Path Synopsis
Package binarypiglet holds the Piglet and resolution record embedded in a Piglet Binary.
Package binarypiglet holds the Piglet and resolution record embedded in a Piglet Binary.

Jump to

Keyboard shortcuts

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