Help us shape the future of Go! Take the 2026 Go Developer Survey

aw

package
v0.93.6 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package aw defines the source AST for agentic workflow Markdown files.

Document separates YAML frontmatter from the Markdown prompt and retains source locations for diagnostics. Parse uses the shared frontmatter parser; Emit preserves unchanged source verbatim, including comments, shorthands, line endings, and prompt whitespace. Edited frontmatter is serialized deterministically without losing fields that are not modeled by a typed view.

Frontmatter retains the complete AW configuration, including engine, tools, imports, safe outputs, triggers, and custom jobs. Schema validation, import resolution, and typed configuration parsing remain the compiler's job. Runner selections retain scalar, label-sequence, and group/labels mapping values, including expression strings, at the root and in custom jobs.

workflow.Compiler.ParseWorkflowDocument accepts this source AST, and callers then lower the resolved data through the existing compiler. The AW source AST and the native Actions execution AST are separate stages; AW-specific fields are never emitted as native Actions workflow properties.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Emit

func Emit(document *Document) (string, error)

Emit preserves unchanged regions verbatim. New or edited frontmatter uses canonical YAML; Markdown edits are emitted exactly as supplied.

func HasSuccessfulDetectionCondition

func HasSuccessfulDetectionCondition(condition string) bool

HasSuccessfulDetectionCondition reports whether a job's condition requires detection success on every branch, allowing skipped detection for conditional gates.

func IsStatusOnlyJob

func IsStatusOnlyJob(config map[string]any) bool

IsStatusOnlyJob reports whether an authored custom job opted to continue after detection errors.

func ParseActionsExpression

func ParseActionsExpression(expression string) (string, actionlint.ExprNode, error)

ParseActionsExpression accepts exactly one nonempty Actions expression, optionally enclosed in a complete ${{ }} wrapper. It returns the unwrapped expression and its syntax tree without performing semantic validation.

Types

type Document

type Document struct {
	Frontmatter map[string]any
	Markdown    string
	Location    SourceLocation
	// contains filtered or unexported fields
}

Document represents an AW .md source file before imports or compiler defaults have been applied. Frontmatter is the authoritative configuration.

func Parse

func Parse(content string) (*Document, error)

Parse accepts main workflows, shared imports, redirect placeholders, and plain Markdown. Semantic workflow validation happens during compilation.

func (*Document) FrontmatterResult

func (document *Document) FrontmatterResult() *parser.FrontmatterResult

FrontmatterResult returns an independent parser view. Compiler preprocessing may mutate it without modifying the authored document or its source metadata.

type ExecutionBlock

type ExecutionBlock struct {
	Path   string
	Fields map[string]any
	Steps  []ExecutionStep
}

ExecutionBlock is an authored AW execution scope, not a compiled Actions job. Fields and step nodes are read-only views of the parsed document.

func ExecutionBlocks

func ExecutionBlocks(ctx context.Context, document *Document) ([]ExecutionBlock, error)

ExecutionBlocks visits only explicit execution nodes. Imports, generated steps, engine configuration and compiler defaults are not reconstructed.

func (ExecutionBlock) FieldPath

func (block ExecutionBlock) FieldPath(field string) string

type ExecutionStep

type ExecutionStep struct {
	Path   string
	Fields map[string]any
	Post   bool
}

type JobDependencyGraph

type JobDependencyGraph map[string][]string

JobDependencyGraph follows needs edges, including transitive dependencies.

func AuthoredJobDependencies

func AuthoredJobDependencies(jobs map[string]any) JobDependencyGraph

AuthoredJobDependencies includes the compiler-owned post-agent dependencies. Malformed needs are left to schema validation; they never create graph edges.

func (JobDependencyGraph) DependsOn

func (graph JobDependencyGraph) DependsOn(job, dependency string) bool

DependsOn is cycle-safe so callers can inspect a graph before validation.

type SourceLocation

type SourceLocation struct {
	FrontmatterLines []string
	FrontmatterStart int
	FieldLines       map[string]int
}

type StatusOnlyViolation

type StatusOnlyViolation struct {
	Path    string
	Message string
}

StatusOnlyViolation describes one rejected status-only job reference.

func ValidateStatusOnlyJob

func ValidateStatusOnlyJob(jobID string, config map[string]any, allowedOutputJobs map[string]struct{}) []StatusOnlyViolation

ValidateStatusOnlyJob checks that a status-only job cannot access agent data.

Jump to

Keyboard shortcuts

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