feat: Implement control flow operators (gt-8tmz.4)
Add loop, branch, and gate operators for formula step transformation: - LoopSpec: Fixed-count loops expand body N times with chained iterations. Conditional loops expand once with runtime metadata labels. - BranchRule: Fork-join patterns wire dependencies for parallel paths. - GateRule: Adds condition labels for runtime evaluation before steps. Types added to types.go: - LoopSpec (count/until/max/body) - BranchRule (from/steps/join) - GateRule (before/condition) - Loop field on Step - Branch/Gate arrays on ComposeRules New controlflow.go with ApplyLoops, ApplyBranches, ApplyGates, and ApplyControlFlow convenience function. Wired into cook.go before advice and expansion operators. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -93,6 +93,15 @@ func runCook(cmd *cobra.Command, args []string) {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// Apply control flow operators (gt-8tmz.4) - loops, branches, gates
|
||||
// This must happen before advice and expansions so they can act on expanded loop steps
|
||||
controlFlowSteps, err := formula.ApplyControlFlow(resolved.Steps, resolved.Compose)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error applying control flow: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
resolved.Steps = controlFlowSteps
|
||||
|
||||
// Apply advice transformations (gt-8tmz.2)
|
||||
if len(resolved.Advice) > 0 {
|
||||
resolved.Steps = formula.ApplyAdvice(resolved.Steps, resolved.Advice)
|
||||
|
||||
Reference in New Issue
Block a user