feat: add WaitsFor parsing and mol bond command (gt-odfr, gt-isje)
WaitsFor parsing: - Add WaitsFor []string field to MoleculeStep struct - Parse WaitsFor lines in molecule descriptions - Enables fanout gate semantics (e.g., WaitsFor: all-children) - Case-insensitive parsing like Needs/Tier mol bond command: - Add gt mol bond for dynamic child molecule creation - Supports --parent, --ref, and --var flags - Enables Christmas Ornament pattern for parallel child execution - Creates child issue with expanded template variables - Instantiates proto steps under the bonded child 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -13,6 +13,7 @@ type MoleculeStep struct {
|
||||
Title string // Step title (first non-empty line or ref)
|
||||
Instructions string // Prose instructions for this step
|
||||
Needs []string // Step refs this step depends on
|
||||
WaitsFor []string // Dynamic wait conditions (e.g., "all-children")
|
||||
Tier string // Optional tier hint: haiku, sonnet, opus
|
||||
}
|
||||
|
||||
@@ -25,6 +26,10 @@ var needsLineRegex = regexp.MustCompile(`(?i)^Needs:\s*(.+)$`)
|
||||
// tierLineRegex matches "Tier: haiku|sonnet|opus" lines.
|
||||
var tierLineRegex = regexp.MustCompile(`(?i)^Tier:\s*(haiku|sonnet|opus)\s*$`)
|
||||
|
||||
// waitsForLineRegex matches "WaitsFor: condition1, condition2, ..." lines.
|
||||
// Common conditions: "all-children" (fanout gate for dynamically bonded children)
|
||||
var waitsForLineRegex = regexp.MustCompile(`(?i)^WaitsFor:\s*(.+)$`)
|
||||
|
||||
// templateVarRegex matches {{variable}} placeholders.
|
||||
var templateVarRegex = regexp.MustCompile(`\{\{(\w+)\}\}`)
|
||||
|
||||
@@ -77,6 +82,18 @@ func ParseMoleculeSteps(description string) ([]MoleculeStep, error) {
|
||||
continue
|
||||
}
|
||||
|
||||
// Check for WaitsFor: line
|
||||
if matches := waitsForLineRegex.FindStringSubmatch(trimmed); matches != nil {
|
||||
conditions := strings.Split(matches[1], ",")
|
||||
for _, cond := range conditions {
|
||||
cond = strings.TrimSpace(cond)
|
||||
if cond != "" {
|
||||
currentStep.WaitsFor = append(currentStep.WaitsFor, cond)
|
||||
}
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
// Regular instruction line
|
||||
instructionLines = append(instructionLines, line)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user