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 ¶
- func Emit(document *Document) (string, error)
- func HasSuccessfulDetectionCondition(condition string) bool
- func IsStatusOnlyJob(config map[string]any) bool
- func ParseActionsExpression(expression string) (string, actionlint.ExprNode, error)
- type Document
- type ExecutionBlock
- type ExecutionStep
- type JobDependencyGraph
- type SourceLocation
- type StatusOnlyViolation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Emit ¶
Emit preserves unchanged regions verbatim. New or edited frontmatter uses canonical YAML; Markdown edits are emitted exactly as supplied.
func HasSuccessfulDetectionCondition ¶
HasSuccessfulDetectionCondition reports whether a job's condition requires detection success on every branch, allowing skipped detection for conditional gates.
func IsStatusOnlyJob ¶
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 ¶
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 JobDependencyGraph ¶
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 StatusOnlyViolation ¶
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.