Internal

internal/app/build

Package build executes acceptance criteria and projects evidence back into specs.

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

Package build executes acceptance criteria 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:19

var ErrSpecNotBuildable = errors.New("build requires approved, active, blocked, or 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:67

Run executes acceptance criteria and projects evidence into the spec.

Types

type Clock

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

Clock supplies build timestamps.

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

type Input

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

Input describes the task and working directory to build.

type Input struct {
	TaskID string
	CWD    string
	Env    []string
}
Fields
  • TaskID string
  • CWD string
  • Env []string

type Output

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

Output summarizes acceptance execution.

type Output struct {
	TaskID string        `json:"task_id"`
	Status spec.Status   `json:"status"`
	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"`
  • 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:64

GateFailure exposes blocked build repair details to the CLI envelope.

type Runner

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

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:28

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:22

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:39

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)