fix(bd): separate parent-child deps from blocking deps in bd show (#1293)

Previously, `bd show` displayed all dependencies under "DEPENDS ON"
regardless of their type. This was confusing because parent-child
relationships (used for molecule/step hierarchy) appeared as if they
were blocking dependencies.

This fix:
- Groups dependencies by type in both daemon and non-daemon modes
- Shows parent-child deps under "PARENT" heading
- Shows blocking deps under "DEPENDS ON" heading
- Shows related deps under "RELATED" heading
- Shows discovered-from deps under "DISCOVERED FROM" heading

The fix applies the same filtering pattern already used for Dependents
(which correctly grouped CHILDREN, BLOCKS, RELATED, DISCOVERED) to the
Dependencies section.

Fixes: bd-69d7

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
aleiby
2026-01-24 17:09:48 -08:00
committed by GitHub
parent dedde444cc
commit e051a31f5c

View File

@@ -255,13 +255,49 @@ var showCmd = &cobra.Command{
fmt.Printf("\n%s %s\n", ui.RenderBold("LABELS:"), strings.Join(details.Labels, ", "))
}
// Dependencies with semantic colors
// Dependencies grouped by type with semantic colors
if len(details.Dependencies) > 0 {
fmt.Printf("\n%s\n", ui.RenderBold("DEPENDS ON"))
var blocks, parent, related, discovered []*types.IssueWithDependencyMetadata
for _, dep := range details.Dependencies {
switch dep.DependencyType {
case types.DepBlocks:
blocks = append(blocks, dep)
case types.DepParentChild:
parent = append(parent, dep)
case types.DepRelated:
related = append(related, dep)
case types.DepDiscoveredFrom:
discovered = append(discovered, dep)
default:
blocks = append(blocks, dep)
}
}
if len(parent) > 0 {
fmt.Printf("\n%s\n", ui.RenderBold("PARENT"))
for _, dep := range parent {
fmt.Println(formatDependencyLine("↑", dep))
}
}
if len(blocks) > 0 {
fmt.Printf("\n%s\n", ui.RenderBold("DEPENDS ON"))
for _, dep := range blocks {
fmt.Println(formatDependencyLine("→", dep))
}
}
if len(related) > 0 {
fmt.Printf("\n%s\n", ui.RenderBold("RELATED"))
for _, dep := range related {
fmt.Println(formatDependencyLine("↔", dep))
}
}
if len(discovered) > 0 {
fmt.Printf("\n%s\n", ui.RenderBold("DISCOVERED FROM"))
for _, dep := range discovered {
fmt.Println(formatDependencyLine("◊", dep))
}
}
}
// Dependents grouped by type with semantic colors
if len(details.Dependents) > 0 {
@@ -443,7 +479,56 @@ var showCmd = &cobra.Command{
fmt.Printf("\n%s %s\n", ui.RenderBold("LABELS:"), strings.Join(labels, ", "))
}
// Show dependencies with semantic colors
// Show dependencies - grouped by dependency type for clarity
// Use GetDependenciesWithMetadata to get the dependency type
sqliteStore, ok := issueStore.(*sqlite.SQLiteStorage)
if ok {
depsWithMeta, _ := sqliteStore.GetDependenciesWithMetadata(ctx, issue.ID)
if len(depsWithMeta) > 0 {
// Group by dependency type
var blocks, parent, related, discovered []*types.IssueWithDependencyMetadata
for _, dep := range depsWithMeta {
switch dep.DependencyType {
case types.DepBlocks:
blocks = append(blocks, dep)
case types.DepParentChild:
parent = append(parent, dep)
case types.DepRelated:
related = append(related, dep)
case types.DepDiscoveredFrom:
discovered = append(discovered, dep)
default:
blocks = append(blocks, dep) // Default to blocks
}
}
if len(parent) > 0 {
fmt.Printf("\n%s\n", ui.RenderBold("PARENT"))
for _, dep := range parent {
fmt.Println(formatDependencyLine("↑", dep))
}
}
if len(blocks) > 0 {
fmt.Printf("\n%s\n", ui.RenderBold("DEPENDS ON"))
for _, dep := range blocks {
fmt.Println(formatDependencyLine("→", dep))
}
}
if len(related) > 0 {
fmt.Printf("\n%s\n", ui.RenderBold("RELATED"))
for _, dep := range related {
fmt.Println(formatDependencyLine("↔", dep))
}
}
if len(discovered) > 0 {
fmt.Printf("\n%s\n", ui.RenderBold("DISCOVERED FROM"))
for _, dep := range discovered {
fmt.Println(formatDependencyLine("◊", dep))
}
}
}
} else {
// Fallback for non-SQLite storage (no dependency type metadata)
deps, _ := issueStore.GetDependencies(ctx, issue.ID)
if len(deps) > 0 {
fmt.Printf("\n%s\n", ui.RenderBold("DEPENDS ON"))
@@ -451,10 +536,10 @@ var showCmd = &cobra.Command{
fmt.Println(formatSimpleDependencyLine("→", dep))
}
}
}
// Show dependents - grouped by dependency type for clarity
// Use GetDependentsWithMetadata to get the dependency type
sqliteStore, ok := issueStore.(*sqlite.SQLiteStorage)
// Use GetDependentsWithMetadata to get the dependency type (sqliteStore already checked above)
if ok {
dependentsWithMeta, _ := sqliteStore.GetDependentsWithMetadata(ctx, issue.ID)
if len(dependentsWithMeta) > 0 {