feat: add dynamic molecule bonding with --ref flag (bd-xo1o.1)
Implements the Christmas Ornament pattern for patrol molecules:
- Add CloneOptions struct with ParentID and ChildRef for dynamic bonding
- Add generateBondedID() to create custom IDs like "patrol-x7k.arm-ace"
- Add --ref flag to `bd mol bond` for custom child references
- Variable substitution in childRef (e.g., "arm-{{polecat_name}}")
This enables:
bd mol bond mol-polecat-arm bd-patrol --ref arm-{{name}} --var name=ace
# Creates: bd-patrol.arm-ace, bd-patrol.arm-ace.capture, etc.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -268,7 +268,8 @@ func TestCloneSubgraph(t *testing.T) {
|
||||
}
|
||||
|
||||
vars := map[string]string{"version": "2.0.0"}
|
||||
result, err := cloneSubgraph(ctx, s, subgraph, vars, "", "test-user", false)
|
||||
opts := CloneOptions{Vars: vars, Actor: "test-user"}
|
||||
result, err := cloneSubgraph(ctx, s, subgraph, opts)
|
||||
if err != nil {
|
||||
t.Fatalf("cloneSubgraph failed: %v", err)
|
||||
}
|
||||
@@ -308,7 +309,8 @@ func TestCloneSubgraph(t *testing.T) {
|
||||
}
|
||||
|
||||
vars := map[string]string{"service": "api-gateway"}
|
||||
result, err := cloneSubgraph(ctx, s, subgraph, vars, "", "test-user", false)
|
||||
opts := CloneOptions{Vars: vars, Actor: "test-user"}
|
||||
result, err := cloneSubgraph(ctx, s, subgraph, opts)
|
||||
if err != nil {
|
||||
t.Fatalf("cloneSubgraph failed: %v", err)
|
||||
}
|
||||
@@ -367,7 +369,8 @@ func TestCloneSubgraph(t *testing.T) {
|
||||
t.Fatalf("loadTemplateSubgraph failed: %v", err)
|
||||
}
|
||||
|
||||
result, err := cloneSubgraph(ctx, s, subgraph, nil, "", "test-user", false)
|
||||
opts := CloneOptions{Actor: "test-user"}
|
||||
result, err := cloneSubgraph(ctx, s, subgraph, opts)
|
||||
if err != nil {
|
||||
t.Fatalf("cloneSubgraph failed: %v", err)
|
||||
}
|
||||
@@ -402,7 +405,8 @@ func TestCloneSubgraph(t *testing.T) {
|
||||
}
|
||||
|
||||
// Clone with assignee override
|
||||
result, err := cloneSubgraph(ctx, s, subgraph, nil, "new-assignee", "test-user", false)
|
||||
opts := CloneOptions{Assignee: "new-assignee", Actor: "test-user"}
|
||||
result, err := cloneSubgraph(ctx, s, subgraph, opts)
|
||||
if err != nil {
|
||||
t.Fatalf("cloneSubgraph failed: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user