Internal

internal/app/build

Package build advances phase-bounded execution and projects evidence back into specs.

import "github.com/nilstate/scafld/v2/internal/app/build"

Package build advances phase-bounded execution and projects evidence back into specs.

Variables

ErrSpecNotBuildable is returned when execution is attempted before approval or after terminal state.

Source: internal/app/build/build.go:20

var ErrSpecNotBuildable = errors.New("build requires approved, active, blocked, or failed-review state")

Functions

func Run(ctx context.Context, specs SpecStore, sessions SessionStore, workspace WorkspaceStatus, runner Runner, clock Clock, input Input) (Output, error)

Source: internal/app/build/build.go:77

Run advances the governed execution lifecycle. The first build call opens the first phase without running future acceptance. Later calls run evidence for the current phase, open the next phase, or move the task to review.

Types

type Clock

Source: internal/app/build/build.go:49

Clock supplies build timestamps.

type Clock interface{ Now() time.Time }
Methods
  • Now func() time.Time

type Input

Source: internal/app/build/build.go:52

Input describes the task and working directory to build.

type Input struct {
	TaskID      string
	CWD         string
	Env         []string
	Timeout     time.Duration
	IdleTimeout time.Duration
}
Fields
  • TaskID string
  • CWD string
  • Env []string
  • Timeout time.Duration
  • IdleTimeout time.Duration

type Output

Source: internal/app/build/build.go:61

Output summarizes one build lifecycle step.

type Output struct {
	TaskID string        `json:"task_id"`
	Status spec.Status   `json:"status"`
	Phase  string        `json:"phase,omitempty"`
	Passed int           `json:"passed"`
	Failed int           `json:"failed"`
	Next   string        `json:"next"`
	Repair *gate.Failure `json:"repair,omitempty"`
}
Fields
  • TaskID string `json:"task_id"`
  • Status spec.Status `json:"status"`
  • Phase string `json:"phase,omitempty"`
  • Passed int `json:"passed"`
  • Failed int `json:"failed"`
  • Next string `json:"next"`
  • Repair *gate.Failure `json:"repair,omitempty"`

func GateFailure() *gate.Failure

Source: internal/app/build/build.go:72

GateFailure exposes blocked build repair details to the CLI envelope.

type Runner

Source: internal/app/build/build.go:39

Runner executes acceptance commands.

type Runner interface {
	Run(context.Context, execution.Request) (execution.Result, error)
}
Methods
  • Run func(context.Context, execution.Request) (execution.Result, error)

type SessionStore

Source: internal/app/build/build.go:33

SessionStore is the session evidence port used by build.

type SessionStore interface {
	Append(context.Context, string, session.Entry, string) (session.Session, error)
	Load(context.Context, string) (session.Session, error)
}
Methods
  • Append func(context.Context, string, session.Entry, string) (session.Session, error)
  • Load func(context.Context, string) (session.Session, error)

type SpecStore

Source: internal/app/build/build.go:27

SpecStore is the spec persistence port used by build.

type SpecStore interface {
	Load(context.Context, string) (spec.Model, string, error)
	Save(context.Context, string, spec.Model) error
}
Methods
  • Load func(context.Context, string) (spec.Model, string, error)
  • Save func(context.Context, string, spec.Model) error

type WorkspaceStatus

Source: internal/app/build/build.go:44

WorkspaceStatus captures dirty workspace state when older sessions lack a task baseline.

type WorkspaceStatus interface {
	ChangedFiles(context.Context) ([]string, error)
}
Methods
  • ChangedFiles func(context.Context) ([]string, error)