Merge pull request #756 from maphew/fix/comments-in-show-command
Fix: Display comments in bd show command (#177)
This commit is contained in:
@@ -111,6 +111,7 @@ var showCmd = &cobra.Command{
|
|||||||
Labels []string `json:"labels,omitempty"`
|
Labels []string `json:"labels,omitempty"`
|
||||||
Dependencies []*types.IssueWithDependencyMetadata `json:"dependencies,omitempty"`
|
Dependencies []*types.IssueWithDependencyMetadata `json:"dependencies,omitempty"`
|
||||||
Dependents []*types.IssueWithDependencyMetadata `json:"dependents,omitempty"`
|
Dependents []*types.IssueWithDependencyMetadata `json:"dependents,omitempty"`
|
||||||
|
Comments []*types.Comment `json:"comments,omitempty"`
|
||||||
}
|
}
|
||||||
details := &IssueDetails{Issue: issue}
|
details := &IssueDetails{Issue: issue}
|
||||||
details.Labels, _ = issueStore.GetLabels(ctx, issue.ID)
|
details.Labels, _ = issueStore.GetLabels(ctx, issue.ID)
|
||||||
@@ -118,6 +119,7 @@ var showCmd = &cobra.Command{
|
|||||||
details.Dependencies, _ = sqliteStore.GetDependenciesWithMetadata(ctx, issue.ID)
|
details.Dependencies, _ = sqliteStore.GetDependenciesWithMetadata(ctx, issue.ID)
|
||||||
details.Dependents, _ = sqliteStore.GetDependentsWithMetadata(ctx, issue.ID)
|
details.Dependents, _ = sqliteStore.GetDependentsWithMetadata(ctx, issue.ID)
|
||||||
}
|
}
|
||||||
|
details.Comments, _ = issueStore.GetIssueComments(ctx, issue.ID)
|
||||||
allDetails = append(allDetails, details)
|
allDetails = append(allDetails, details)
|
||||||
} else {
|
} else {
|
||||||
if displayIdx > 0 {
|
if displayIdx > 0 {
|
||||||
@@ -151,6 +153,7 @@ var showCmd = &cobra.Command{
|
|||||||
Labels []string `json:"labels,omitempty"`
|
Labels []string `json:"labels,omitempty"`
|
||||||
Dependencies []*types.IssueWithDependencyMetadata `json:"dependencies,omitempty"`
|
Dependencies []*types.IssueWithDependencyMetadata `json:"dependencies,omitempty"`
|
||||||
Dependents []*types.IssueWithDependencyMetadata `json:"dependents,omitempty"`
|
Dependents []*types.IssueWithDependencyMetadata `json:"dependents,omitempty"`
|
||||||
|
Comments []*types.Comment `json:"comments,omitempty"`
|
||||||
}
|
}
|
||||||
var details IssueDetails
|
var details IssueDetails
|
||||||
if err := json.Unmarshal(resp.Data, &details); err == nil {
|
if err := json.Unmarshal(resp.Data, &details); err == nil {
|
||||||
@@ -173,6 +176,7 @@ var showCmd = &cobra.Command{
|
|||||||
Labels []string `json:"labels,omitempty"`
|
Labels []string `json:"labels,omitempty"`
|
||||||
Dependencies []*types.IssueWithDependencyMetadata `json:"dependencies,omitempty"`
|
Dependencies []*types.IssueWithDependencyMetadata `json:"dependencies,omitempty"`
|
||||||
Dependents []*types.IssueWithDependencyMetadata `json:"dependents,omitempty"`
|
Dependents []*types.IssueWithDependencyMetadata `json:"dependents,omitempty"`
|
||||||
|
Comments []*types.Comment `json:"comments,omitempty"`
|
||||||
}
|
}
|
||||||
var details IssueDetails
|
var details IssueDetails
|
||||||
if err := json.Unmarshal(resp.Data, &details); err != nil {
|
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()
|
fmt.Println()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ argument-hint: [issue-id]
|
|||||||
|
|
||||||
View or add comments to a beads issue.
|
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
|
## View Comments
|
||||||
|
|
||||||
To view all comments on an issue:
|
To view all comments on an issue:
|
||||||
|
|||||||
@@ -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.
|
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:
|
Common workflows:
|
||||||
- Start work: Update status to `in_progress`
|
- Start work: Update status to `in_progress`
|
||||||
- Mark blocked: Update status to `blocked`
|
- Mark blocked: Update status to `blocked`
|
||||||
|
|||||||
@@ -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
|
// Create detailed response with related data
|
||||||
type IssueDetails struct {
|
type IssueDetails struct {
|
||||||
*types.Issue
|
*types.Issue
|
||||||
Labels []string `json:"labels,omitempty"`
|
Labels []string `json:"labels,omitempty"`
|
||||||
Dependencies []*types.IssueWithDependencyMetadata `json:"dependencies,omitempty"`
|
Dependencies []*types.IssueWithDependencyMetadata `json:"dependencies,omitempty"`
|
||||||
Dependents []*types.IssueWithDependencyMetadata `json:"dependents,omitempty"`
|
Dependents []*types.IssueWithDependencyMetadata `json:"dependents,omitempty"`
|
||||||
|
Comments []*types.Comment `json:"comments,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
details := &IssueDetails{
|
details := &IssueDetails{
|
||||||
@@ -1235,6 +1239,7 @@ func (s *Server) handleShow(req *Request) Response {
|
|||||||
Labels: labels,
|
Labels: labels,
|
||||||
Dependencies: deps,
|
Dependencies: deps,
|
||||||
Dependents: dependents,
|
Dependents: dependents,
|
||||||
|
Comments: comments,
|
||||||
}
|
}
|
||||||
|
|
||||||
data, _ := json.Marshal(details)
|
data, _ := json.Marshal(details)
|
||||||
|
|||||||
Reference in New Issue
Block a user