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:
107
cmd/bd/show.go
107
cmd/bd/show.go
@@ -255,11 +255,47 @@ var showCmd = &cobra.Command{
|
|||||||
fmt.Printf("\n%s %s\n", ui.RenderBold("LABELS:"), strings.Join(details.Labels, ", "))
|
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 {
|
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 {
|
for _, dep := range details.Dependencies {
|
||||||
fmt.Println(formatDependencyLine("→", dep))
|
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))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -443,18 +479,67 @@ var showCmd = &cobra.Command{
|
|||||||
fmt.Printf("\n%s %s\n", ui.RenderBold("LABELS:"), strings.Join(labels, ", "))
|
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
|
||||||
deps, _ := issueStore.GetDependencies(ctx, issue.ID)
|
// Use GetDependenciesWithMetadata to get the dependency type
|
||||||
if len(deps) > 0 {
|
sqliteStore, ok := issueStore.(*sqlite.SQLiteStorage)
|
||||||
fmt.Printf("\n%s\n", ui.RenderBold("DEPENDS ON"))
|
if ok {
|
||||||
for _, dep := range deps {
|
depsWithMeta, _ := sqliteStore.GetDependenciesWithMetadata(ctx, issue.ID)
|
||||||
fmt.Println(formatSimpleDependencyLine("→", dep))
|
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"))
|
||||||
|
for _, dep := range deps {
|
||||||
|
fmt.Println(formatSimpleDependencyLine("→", dep))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show dependents - grouped by dependency type for clarity
|
// Show dependents - grouped by dependency type for clarity
|
||||||
// Use GetDependentsWithMetadata to get the dependency type
|
// Use GetDependentsWithMetadata to get the dependency type (sqliteStore already checked above)
|
||||||
sqliteStore, ok := issueStore.(*sqlite.SQLiteStorage)
|
|
||||||
if ok {
|
if ok {
|
||||||
dependentsWithMeta, _ := sqliteStore.GetDependentsWithMetadata(ctx, issue.ID)
|
dependentsWithMeta, _ := sqliteStore.GetDependentsWithMetadata(ctx, issue.ID)
|
||||||
if len(dependentsWithMeta) > 0 {
|
if len(dependentsWithMeta) > 0 {
|
||||||
|
|||||||
Reference in New Issue
Block a user