Fix epic hierarchy display in bd show command
Amp-Thread-ID: https://ampcode.com/threads/T-43f6c7bf-9d4f-4475-8266-69e0a35a5909 Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/steveyegge/beads/internal/storage/sqlite"
|
||||
"github.com/steveyegge/beads/internal/types"
|
||||
"github.com/steveyegge/beads/internal/utils"
|
||||
)
|
||||
@@ -392,17 +393,39 @@ func (s *Server) handleShow(req *Request) Response {
|
||||
}
|
||||
}
|
||||
|
||||
// Populate labels, dependencies, and dependents
|
||||
// Populate labels, dependencies (with metadata), and dependents (with metadata)
|
||||
labels, _ := store.GetLabels(ctx, issue.ID)
|
||||
deps, _ := store.GetDependencies(ctx, issue.ID)
|
||||
dependents, _ := store.GetDependents(ctx, issue.ID)
|
||||
|
||||
// Get dependencies and dependents with metadata (including dependency type)
|
||||
var deps []*types.IssueWithDependencyMetadata
|
||||
var dependents []*types.IssueWithDependencyMetadata
|
||||
if sqliteStore, ok := store.(*sqlite.SQLiteStorage); ok {
|
||||
deps, _ = sqliteStore.GetDependenciesWithMetadata(ctx, issue.ID)
|
||||
dependents, _ = sqliteStore.GetDependentsWithMetadata(ctx, issue.ID)
|
||||
} else {
|
||||
// Fallback for non-SQLite storage (won't have dependency type metadata)
|
||||
regularDeps, _ := store.GetDependencies(ctx, issue.ID)
|
||||
for _, d := range regularDeps {
|
||||
deps = append(deps, &types.IssueWithDependencyMetadata{
|
||||
Issue: *d,
|
||||
DependencyType: types.DepBlocks, // default
|
||||
})
|
||||
}
|
||||
regularDependents, _ := store.GetDependents(ctx, issue.ID)
|
||||
for _, d := range regularDependents {
|
||||
dependents = append(dependents, &types.IssueWithDependencyMetadata{
|
||||
Issue: *d,
|
||||
DependencyType: types.DepBlocks, // default
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Create detailed response with related data
|
||||
type IssueDetails struct {
|
||||
*types.Issue
|
||||
Labels []string `json:"labels,omitempty"`
|
||||
Dependencies []*types.Issue `json:"dependencies,omitempty"`
|
||||
Dependents []*types.Issue `json:"dependents,omitempty"`
|
||||
Labels []string `json:"labels,omitempty"`
|
||||
Dependencies []*types.IssueWithDependencyMetadata `json:"dependencies,omitempty"`
|
||||
Dependents []*types.IssueWithDependencyMetadata `json:"dependents,omitempty"`
|
||||
}
|
||||
|
||||
details := &IssueDetails{
|
||||
|
||||
Reference in New Issue
Block a user