From 30c5e0001af87c559bd531549893cce0bf7c1c5c Mon Sep 17 00:00:00 2001 From: Steve Yegge Date: Sun, 28 Dec 2025 02:24:39 -0800 Subject: [PATCH] feat: add computed .parent field to JSON output for convenience (bd-qket) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Simplifies querying parent ID from: bd show --json | jq '.[0].dependencies[] | select(.dependency_type == "parent-child") | .id' To: bd show --json | jq '.[0].parent' 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- cmd/bd/show.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/cmd/bd/show.go b/cmd/bd/show.go index 560e49dd..8fad091d 100644 --- a/cmd/bd/show.go +++ b/cmd/bd/show.go @@ -112,6 +112,7 @@ var showCmd = &cobra.Command{ Dependencies []*types.IssueWithDependencyMetadata `json:"dependencies,omitempty"` Dependents []*types.IssueWithDependencyMetadata `json:"dependents,omitempty"` Comments []*types.Comment `json:"comments,omitempty"` + Parent *string `json:"parent,omitempty"` } details := &IssueDetails{Issue: issue} details.Labels, _ = issueStore.GetLabels(ctx, issue.ID) @@ -120,6 +121,13 @@ var showCmd = &cobra.Command{ details.Dependents, _ = sqliteStore.GetDependentsWithMetadata(ctx, issue.ID) } details.Comments, _ = issueStore.GetIssueComments(ctx, issue.ID) + // Compute parent from dependencies (bd-qket) + for _, dep := range details.Dependencies { + if dep.DependencyType == types.DepParentChild { + details.Parent = &dep.ID + break + } + } allDetails = append(allDetails, details) } else { if displayIdx > 0 { @@ -154,9 +162,17 @@ var showCmd = &cobra.Command{ Dependencies []*types.IssueWithDependencyMetadata `json:"dependencies,omitempty"` Dependents []*types.IssueWithDependencyMetadata `json:"dependents,omitempty"` Comments []*types.Comment `json:"comments,omitempty"` + Parent *string `json:"parent,omitempty"` } var details IssueDetails if err := json.Unmarshal(resp.Data, &details); err == nil { + // Compute parent from dependencies (bd-qket) + for _, dep := range details.Dependencies { + if dep.DependencyType == types.DepParentChild { + details.Parent = &dep.ID + break + } + } allDetails = append(allDetails, details) } } else { @@ -359,6 +375,7 @@ var showCmd = &cobra.Command{ Dependencies []*types.IssueWithDependencyMetadata `json:"dependencies,omitempty"` Dependents []*types.IssueWithDependencyMetadata `json:"dependents,omitempty"` Comments []*types.Comment `json:"comments,omitempty"` + Parent *string `json:"parent,omitempty"` } details := &IssueDetails{Issue: issue} details.Labels, _ = issueStore.GetLabels(ctx, issue.ID) @@ -380,6 +397,13 @@ var showCmd = &cobra.Command{ } details.Comments, _ = issueStore.GetIssueComments(ctx, issue.ID) + // Compute parent from dependencies (bd-qket) + for _, dep := range details.Dependencies { + if dep.DependencyType == types.DepParentChild { + details.Parent = &dep.ID + break + } + } allDetails = append(allDetails, details) result.Close() // Close before continuing to next iteration continue