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:
@@ -313,6 +313,18 @@ var createCmd = &cobra.Command{
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If parent was specified, add parent-child dependency
|
||||||
|
if parentID != "" {
|
||||||
|
dep := &types.Dependency{
|
||||||
|
IssueID: issue.ID,
|
||||||
|
DependsOnID: parentID,
|
||||||
|
Type: types.DepParentChild,
|
||||||
|
}
|
||||||
|
if err := store.AddDependency(ctx, dep, actor); err != nil {
|
||||||
|
fmt.Fprintf(os.Stderr, "Warning: failed to add parent-child dependency %s -> %s: %v\n", issue.ID, parentID, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Add labels if specified
|
// Add labels if specified
|
||||||
for _, label := range labels {
|
for _, label := range labels {
|
||||||
if err := store.AddLabel(ctx, issue.ID, label, actor); err != nil {
|
if err := store.AddLabel(ctx, issue.ID, label, actor); err != nil {
|
||||||
|
|||||||
@@ -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
|
// Add labels if specified
|
||||||
for _, label := range createArgs.Labels {
|
for _, label := range createArgs.Labels {
|
||||||
if err := store.AddLabel(ctx, issue.ID, label, s.reqActor(req)); err != nil {
|
if err := store.AddLabel(ctx, issue.ID, label, s.reqActor(req)); err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user