Documentation
¶
Overview ¶
Package recipe implements a named, shareable workflow library for cloop. A recipe bundles a flow YAML, a goal template, lifecycle hooks, and default environment variables into a single installable YAML file stored in .cloop/recipes/<name>.yaml.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MarshalExample ¶
MarshalExample serialises a Recipe to YAML bytes (exported wrapper for cmd use).
Types ¶
type Recipe ¶
type Recipe struct {
// Name is the unique identifier for the recipe (used as the file stem).
Name string `yaml:"name"`
// Description is a short human-readable summary.
Description string `yaml:"description,omitempty"`
// Version is an optional semantic version string (e.g. "1.0.0").
Version string `yaml:"version,omitempty"`
// Author is the optional creator name or email.
Author string `yaml:"author,omitempty"`
// FlowYAML is the embedded flow pipeline definition (YAML text).
// It is rendered as a Go text/template before execution; use {{.Goal}},
// {{.Name}}, or any key from ExtraVars.
FlowYAML string `yaml:"flow_yaml"`
// GoalTemplate is an optional Go text/template that generates the cloop
// goal string. The template receives a TemplateData value.
// When empty, the --goal flag value is used verbatim.
GoalTemplate string `yaml:"goal_template,omitempty"`
// Hooks defines shell commands to run at plan/task lifecycle events.
Hooks hooks.Config `yaml:"hooks,omitempty"`
// EnvVars lists environment variables to set before running the recipe.
// These are merged with the project's existing env vars (recipe values win).
EnvVars []env.Var `yaml:"env_vars,omitempty"`
}
Recipe is a named, shareable automation workflow that combines a flow pipeline, a goal template, lifecycle hooks, and default environment variables into a single installable unit.
func ExampleRecipe ¶
func ExampleRecipe() *Recipe
ExampleRecipe returns a minimal but complete example recipe for documentation/init purposes.
func Install ¶
Install copies a recipe from a local file path or HTTP(S) URL into .cloop/recipes/<name>.yaml. The source must contain valid recipe YAML.
func List ¶
List returns all Recipe objects found in .cloop/recipes/. Returns an empty slice (not an error) when the directory does not exist.
type RunConfig ¶
type RunConfig struct {
// Goal overrides the default goal. Required when GoalTemplate is non-empty
// and no default is embedded in the recipe.
Goal string
// ExtraVars are additional key→value pairs available inside templates.
ExtraVars map[string]string
// WorkDir is the project working directory.
WorkDir string
// CloopBin is the path to the cloop binary (defaults to os.Executable).
CloopBin string
// DryRun prints steps without executing them.
DryRun bool
}
RunConfig controls recipe execution behaviour.
type RunResult ¶
type RunResult struct {
// Recipe is the recipe that was executed.
Recipe *Recipe
// FlowResults contains per-step outcomes.
FlowResults []flow.StepResult
// Err is the first fatal error, if any.
Err error
}
RunResult captures the outcome of executing a recipe.
type TemplateData ¶
type TemplateData struct {
// Goal is the goal string provided via --goal or the recipe default.
Goal string
// Name is the recipe name.
Name string
// Timestamp is the current UTC time.
Timestamp time.Time
// Extra holds any additional key→value pairs passed by the caller.
Extra map[string]string
}
TemplateData is passed to GoalTemplate and FlowYAML rendering.