Merge pull request #756 from maphew/fix/comments-in-show-command

Fix: Display comments in bd show command (#177)
This commit is contained in:
Steve Yegge
2025-12-27 00:11:50 -08:00
committed by GitHub
4 changed files with 24 additions and 0 deletions

View File

@@ -111,6 +111,7 @@ var showCmd = &cobra.Command{
Labels []string `json:"labels,omitempty"`
Dependencies []*types.IssueWithDependencyMetadata `json:"dependencies,omitempty"`
Dependents []*types.IssueWithDependencyMetadata `json:"dependents,omitempty"`
Comments []*types.Comment `json:"comments,omitempty"`
}
details := &IssueDetails{Issue: issue}
details.Labels, _ = issueStore.GetLabels(ctx, issue.ID)
@@ -118,6 +119,7 @@ var showCmd = &cobra.Command{
details.Dependencies, _ = sqliteStore.GetDependenciesWithMetadata(ctx, issue.ID)
details.Dependents, _ = sqliteStore.GetDependentsWithMetadata(ctx, issue.ID)
}
details.Comments, _ = issueStore.GetIssueComments(ctx, issue.ID)
allDetails = append(allDetails, details)
} else {
if displayIdx > 0 {
@@ -151,6 +153,7 @@ var showCmd = &cobra.Command{
Labels []string `json:"labels,omitempty"`
Dependencies []*types.IssueWithDependencyMetadata `json:"dependencies,omitempty"`
Dependents []*types.IssueWithDependencyMetadata `json:"dependents,omitempty"`
Comments []*types.Comment `json:"comments,omitempty"`
}
var details IssueDetails
if err := json.Unmarshal(resp.Data, &details); err == nil {
@@ -173,6 +176,7 @@ var showCmd = &cobra.Command{
Labels []string `json:"labels,omitempty"`
Dependencies []*types.IssueWithDependencyMetadata `json:"dependencies,omitempty"`
Dependents []*types.IssueWithDependencyMetadata `json:"dependents,omitempty"`
Comments []*types.Comment `json:"comments,omitempty"`
}
var details IssueDetails
if err := json.Unmarshal(resp.Data, &details); err != nil {
@@ -303,6 +307,17 @@ var showCmd = &cobra.Command{
}
}
if len(details.Comments) > 0 {
fmt.Printf("\nComments (%d):\n", len(details.Comments))
for _, comment := range details.Comments {
fmt.Printf(" [%s] %s\n", comment.Author, comment.CreatedAt.Format("2006-01-02 15:04"))
commentLines := strings.Split(comment.Text, "\n")
for _, line := range commentLines {
fmt.Printf(" %s\n", line)
}
}
}
fmt.Println()
}
}

View File

@@ -5,6 +5,8 @@ argument-hint: [issue-id]
View or add comments to a beads issue.
Comments are separate from issue properties (title, description, etc.) because they serve a different purpose: they're a **discussion thread** rather than **singular editable fields**. Use `bd comments` for threaded conversations and `bd edit` for core issue metadata.
## View Comments
To view all comments on an issue:

View File

@@ -16,6 +16,8 @@ If arguments are missing, ask the user for:
Use the beads MCP `update` tool to apply the changes. Show the updated issue to confirm the change.
**Note:** Comments are managed separately with `bd comments add`. The `update` command is for singular, versioned properties (title, status, priority, etc.), while comments form a discussion thread that's appended to, not updated.
Common workflows:
- Start work: Update status to `in_progress`
- Mark blocked: Update status to `blocked`

View File

@@ -1222,12 +1222,16 @@ func (s *Server) handleShow(req *Request) Response {
}
}
// Fetch comments
comments, _ := store.GetIssueComments(ctx, issue.ID)
// Create detailed response with related data
type IssueDetails struct {
*types.Issue
Labels []string `json:"labels,omitempty"`
Dependencies []*types.IssueWithDependencyMetadata `json:"dependencies,omitempty"`
Dependents []*types.IssueWithDependencyMetadata `json:"dependents,omitempty"`
Comments []*types.Comment `json:"comments,omitempty"`
}
details := &IssueDetails{
@@ -1235,6 +1239,7 @@ func (s *Server) handleShow(req *Request) Response {
Labels: labels,
Dependencies: deps,
Dependents: dependents,
Comments: comments,
}
data, _ := json.Marshal(details)