spec

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package spec loads and validates jevkit SDLC workflow definitions: authored YAML at .jevkit/sdlc/*.yaml, declarative only (no shell, no templates, no code), following the compaction.yaml precedent (internal/compact/policy.go).

Index

Constants

View Source
const (
	KindWork     = "work"
	KindGate     = "gate"
	KindSelect   = "select"
	KindCheck    = "check"
	KindDecide   = "decide"
	KindHuman    = "human"
	KindJoin     = "join"
	KindTerminal = "terminal"
)

Node kinds.

View Source
const (
	DefaultMaxNodeAttempts     = 3
	DefaultMaxReroutes         = 2
	DefaultMaxRunActiveSeconds = 21600
	DefaultMissingUsage        = "warn"
)

Default budgets, applied when a workflow omits them.

View Source
const DefaultMaxStageSteps = 20

Variables

This section is empty.

Functions

func BuiltinNames

func BuiltinNames() []string

BuiltinNames returns every embedded built-in workflow's name, sorted.

func BuiltinSource

func BuiltinSource(name string) ([]byte, bool)

BuiltinSource returns the raw YAML for the built-in workflow named name, for `sdlc init` to write out as an editable starting point.

Types

type Artifact

type Artifact struct {
	Path     string `yaml:"path"`
	Required bool   `yaml:"required"`
	Seedable bool   `yaml:"seedable"`
	Schema   string `yaml:"schema"`
}

Artifact is one node input/output declaration.

type Budgets

type Budgets struct {
	MaxNodeAttempts     int     `yaml:"maxNodeAttempts"`
	MaxReroutes         int     `yaml:"maxReroutes"`
	MaxRunActiveSeconds int     `yaml:"maxRunActiveSeconds"`
	MaxEstimatedCostUsd float64 `yaml:"maxEstimatedCostUsd"`
	MissingUsage        string  `yaml:"missingUsage"`
}

Budgets bound a run. Zero values are filled with the defaults above.

func (*Budgets) UnmarshalYAML

func (b *Budgets) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML decodes Budgets, distinguishing an omitted maxReroutes from an explicit 0.

type Node

type Node struct {
	ID          string            `yaml:"id"`
	Kind        string            `yaml:"kind"`
	Agent       string            `yaml:"agent"`
	Produces    []Artifact        `yaml:"produces"`
	Consumes    []Artifact        `yaml:"consumes"`
	Objective   string            `yaml:"objective"`
	Next        string            `yaml:"next"`
	QuestionSet string            `yaml:"questionSet"`
	State       *StateSpec        `yaml:"state"`
	Routes      map[string]string `yaml:"routes"`
	Default     string            `yaml:"default"`
	// TrueRoute names which of a gate node's two Routes keys is taken when
	// its noul question answers true (e.g. "yes" or "ready"); the other key
	// is taken when it answers false. A noul answer carries no chosen label
	// of its own — only a truth value — so a generic engine has no other way
	// to know which authored label means which outcome. Gate-only.
	TrueRoute  string   `yaml:"trueRoute"`
	Candidates []string `yaml:"candidates"`
	AssignTo   string   `yaml:"assignTo"`
	Command    string   `yaml:"command"`
	Prompt     string   `yaml:"prompt"`
	Outcome    string   `yaml:"outcome"`
}

Node is one workflow node. Not every field applies to every kind; Validate enforces which fields a given kind requires.

type Stage

type Stage struct {
	ID       string         `yaml:"id" json:"id"`
	Question *StageQuestion `yaml:"question,omitempty" json:"question,omitempty"`
	Work     *StageWork     `yaml:"work,omitempty" json:"work,omitempty"`
	Spawn    *StageSpawn    `yaml:"spawn,omitempty" json:"spawn,omitempty"`
	Finish   string         `yaml:"finish,omitempty" json:"finish,omitempty"`
}

Stage workflows are authored as questions, standard SDLC work, and endings. They share the project workflow file location with older node graphs.

type StageQuestion

type StageQuestion struct {
	Prompt        string            `yaml:"prompt" json:"prompt"`
	Options       map[string]string `yaml:"options" json:"options"`
	Routes        map[string]string `yaml:"routes" json:"routes"`
	Fallback      string            `yaml:"fallback" json:"fallback"`
	MinConfidence float64           `yaml:"minConfidence,omitempty" json:"minConfidence,omitempty"`
}

type StageSpawn

type StageSpawn struct {
	Workflow  string            `yaml:"workflow" json:"workflow"`
	Objective string            `yaml:"objective,omitempty" json:"objective,omitempty"`
	Routes    map[string]string `yaml:"routes" json:"routes"`
}

StageSpawn starts another SDLC run with the parent's task and policy.

type StageWork

type StageWork struct {
	Role      string            `yaml:"role" json:"role"`
	Objective string            `yaml:"objective" json:"objective"`
	Focus     string            `yaml:"focus,omitempty" json:"focus,omitempty"`
	Routes    map[string]string `yaml:"routes" json:"routes"`
}

type StateSpec

type StateSpec struct {
	From     []string `yaml:"from"`
	MaxBytes int      `yaml:"maxBytes"`
}

StateSpec bounds the state a node hands to Jev.

type Workflow

type Workflow struct {
	Version     int     `yaml:"version" json:"version"`
	Name        string  `yaml:"name" json:"name"`
	Description string  `yaml:"description" json:"description"`
	Budgets     Budgets `yaml:"budgets" json:"budgets,omitempty"`
	Nodes       []Node  `yaml:"nodes" json:"nodes,omitempty"`
	Entry       string  `yaml:"entry,omitempty" json:"entry,omitempty"`
	MaxSteps    int     `yaml:"maxSteps,omitempty" json:"maxSteps,omitempty"`
	Stages      []Stage `yaml:"stages,omitempty" json:"stages,omitempty"`
}

Workflow is one authored spec file.

func Builtin

func Builtin(name string) (w *Workflow, ok bool, err error)

Builtin loads and validates the built-in workflow named name. ok is false when name is not a built-in; err is non-nil only if an embedded workflow somehow fails to validate, which would be a bug in jevkit itself, not a user-fixable error.

func Load

func Load(raw []byte) (*Workflow, error)

Load parses and validates raw YAML into a Workflow, applying budget defaults. Unknown fields are rejected so a typo never silently no-ops.

func (*Workflow) IsStageFlow

func (w *Workflow) IsStageFlow() bool

func (*Workflow) Node

func (w *Workflow) Node(id string) (Node, bool)

Node looks up a node by id.

func (*Workflow) SeedableArtifacts

func (w *Workflow) SeedableArtifacts() []string

SeedableArtifacts lists every seedable artifact path declared anywhere in the workflow, in node order, for `--file` entry-point resolution.

func (*Workflow) StageByID

func (w *Workflow) StageByID(id string) (Stage, bool)

func (*Workflow) Validate

func (w *Workflow) Validate() error

Validate checks structural and cross-referential correctness: the schema JSON Schema cannot express (target existence, kind-specific requirements, id uniqueness) is enforced here.

func (*Workflow) ValidateStages

func (w *Workflow) ValidateStages() error

ValidateStages checks the stage-oriented SDLC format. Questions route by named answers; work stages route by structured SDLC worker outcomes.

Jump to

Keyboard shortcuts

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