Documentation
¶
Index ¶
- func ApplyFilter(filter string, value string) (string, error)
- func Evaluate(node Node, ctx Context) (bool, error)
- func Interpolate(template string, ctx Context) (string, error)
- func InterpolateFile(content []byte, ctx Context) ([]byte, error)
- type BinaryNode
- type BoolLiteralNode
- type CallNode
- type CompareNode
- type Computed
- type Context
- type FileRule
- type IdentNode
- type Input
- type Lexer
- type Manifest
- type Node
- type NotNode
- type Parser
- type Step
- type StringLiteralNode
- type Token
- type TokenType
- type ValidationError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BinaryNode ¶
BinaryNode represents a logical binary expression: left && right | left || right.
type BoolLiteralNode ¶
type BoolLiteralNode struct {
Value bool
}
BoolLiteralNode represents a boolean literal.
type CallNode ¶ added in v0.2.0
CallNode represents function calls like contains(features, "docker").
type CompareNode ¶
CompareNode represents a comparison expression: left == right | left != right.
type Context ¶
type Context map[string]interface{}
Context contains the runtime values for all variables referenced in expressions and used during interpolation.
type FileRule ¶
type FileRule struct {
Include string `yaml:"include,omitempty"`
Exclude string `yaml:"exclude,omitempty"`
When string `yaml:"when,omitempty"`
}
FileRule controls which files or directories are included or excluded.
type IdentNode ¶
type IdentNode struct {
Name string
}
IdentNode represents an identifier (variable reference).
type Input ¶
type Input struct {
ID string `yaml:"id"`
Prompt string `yaml:"prompt"`
Type string `yaml:"type"`
Required bool `yaml:"required"`
Default any `yaml:"default,omitempty"`
Validate string `yaml:"validate,omitempty"`
Options []string `yaml:"options,omitempty"`
When string `yaml:"when,omitempty"`
MustExist bool `yaml:"must_exist,omitempty"`
}
Input describes a single user-provided value in scaffold.yaml.
type Manifest ¶
type Manifest struct {
Name string `yaml:"name"`
Version string `yaml:"version"`
Author string `yaml:"author"`
Language string `yaml:"language"`
Architecture string `yaml:"architecture"`
Description string `yaml:"description"`
Tags []string `yaml:"tags"`
Inputs []Input `yaml:"inputs"`
Computed []Computed `yaml:"computed,omitempty"`
Files []FileRule `yaml:"files"`
Steps []Step `yaml:"steps"`
}
Manifest models the full scaffold.yaml manifest.
func LoadManifest ¶
func ParseManifest ¶ added in v0.5.0
ParseManifest parses scaffold YAML from bytes (no file I/O).
type Node ¶
type Node interface {
// contains filtered or unexported methods
}
Node is the base interface for all AST nodes.
type NotNode ¶
type NotNode struct {
Expr Node
}
NotNode represents a logical NOT expression: !expr.
type Step ¶
type Step struct {
Name string `yaml:"name"`
Run string `yaml:"run"`
When string `yaml:"when,omitempty"`
}
Step represents a post-generation command to execute.
type StringLiteralNode ¶
type StringLiteralNode struct {
Value string
}
StringLiteralNode represents a string literal.
type Token ¶
type Token struct {
Type TokenType
Literal string
Pos int // position in the original input string
}
Token represents a single lexical token with its literal value and position.
type TokenType ¶
type TokenType string
TokenType represents the type of a token produced by the lexer.
const ( // Literals TOKEN_STRING TokenType = "STRING" // "http" TOKEN_BOOL TokenType = "BOOL" // true | false TOKEN_IDENT TokenType = "IDENT" // transport, orm, project_name // Operators TOKEN_EQ TokenType = "==" // == TOKEN_NEQ TokenType = "!=" // != TOKEN_AND TokenType = "&&" // && TOKEN_OR TokenType = "||" // || TOKEN_NOT TokenType = "!" // ! TOKEN_LPAREN TokenType = "(" TOKEN_RPAREN TokenType = ")" TOKEN_COMMA TokenType = "," // Control TOKEN_EOF TokenType = "EOF" TOKEN_ILLEGAL TokenType = "ILLEGAL" )
Token types for the DSL lexer.
type ValidationError ¶
func ValidateManifest ¶
func ValidateManifest(m *Manifest) []ValidationError