Fix: --parent flag now creates parent-child dependency

When using 'bd create --parent <id>', the system now automatically
creates a parent-child dependency linking the child to the parent.
This fixes epic status reporting which was showing zero children.

Fixes #318 (bd-jijf)

Changes:
- cmd/bd/create.go: Add parent-child dependency after issue creation
- internal/rpc/server_issues_epics.go: Add same fix for daemon mode

Tested:
- Created epic with children, verified epic status shows correct count
- Verified closing all children makes epic eligible for closure
- All tests pass

Amp-Thread-ID: https://ampcode.com/threads/T-f1a1aee1-03bd-4e62-a63c-c1d339f8300b
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Steve Yegge
2025-11-15 13:20:02 -08:00
parent 1c2e88c621
commit b9919fe031
2 changed files with 27 additions and 0 deletions

View File

@@ -180,6 +180,21 @@ func (s *Server) handleCreate(req *Request) Response {
}
}
// If parent was specified, add parent-child dependency
if createArgs.Parent != "" {
dep := &types.Dependency{
IssueID: issue.ID,
DependsOnID: createArgs.Parent,
Type: types.DepParentChild,
}
if err := store.AddDependency(ctx, dep, s.reqActor(req)); err != nil {
return Response{
Success: false,
Error: fmt.Sprintf("failed to add parent-child dependency %s -> %s: %v", issue.ID, createArgs.Parent, err),
}
}
}
// Add labels if specified
for _, label := range createArgs.Labels {
if err := store.AddLabel(ctx, issue.ID, label, s.reqActor(req)); err != nil {