feat(close): Add --suggest-next flag to show newly unblocked issues (GH#679)
When closing an issue, the new --suggest-next flag returns a list of
issues that became unblocked (ready to work on) as a result of the close.
This helps agents and users quickly identify what work is now available
after completing a blocker.
Example:
$ bd close bd-5 --suggest-next
✓ Closed bd-5: Completed
Newly unblocked:
• bd-7 "Implement feature X" (P1)
• bd-8 "Write tests for X" (P2)
Implementation:
- Added GetNewlyUnblockedByClose to storage interface
- Implemented efficient single-query for SQLite using blocked_issues_cache
- Added SuggestNext field to CloseArgs in RPC protocol
- Added CloseResult type for structured response
- CLI handles both daemon and direct modes
Thanks to @kraitsura for the detailed feature request and design.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,8 @@ package rpc
|
||||
import (
|
||||
"encoding/json"
|
||||
"time"
|
||||
|
||||
"github.com/steveyegge/beads/internal/types"
|
||||
)
|
||||
|
||||
// Operation constants for all bd commands
|
||||
@@ -124,8 +126,16 @@ type UpdateArgs struct {
|
||||
|
||||
// CloseArgs represents arguments for the close operation
|
||||
type CloseArgs struct {
|
||||
ID string `json:"id"`
|
||||
Reason string `json:"reason,omitempty"`
|
||||
ID string `json:"id"`
|
||||
Reason string `json:"reason,omitempty"`
|
||||
SuggestNext bool `json:"suggest_next,omitempty"` // Return newly unblocked issues (GH#679)
|
||||
}
|
||||
|
||||
// CloseResult is returned when SuggestNext is true (GH#679)
|
||||
// When SuggestNext is false, just the closed issue is returned for backward compatibility
|
||||
type CloseResult struct {
|
||||
Closed *types.Issue `json:"closed"` // The issue that was closed
|
||||
Unblocked []*types.Issue `json:"unblocked,omitempty"` // Issues newly unblocked by closing
|
||||
}
|
||||
|
||||
// DeleteArgs represents arguments for the delete operation
|
||||
|
||||
@@ -555,6 +555,26 @@ func (s *Server) handleClose(req *Request) Response {
|
||||
})
|
||||
|
||||
closedIssue, _ := store.GetIssue(ctx, closeArgs.ID)
|
||||
|
||||
// If SuggestNext is requested, find newly unblocked issues (GH#679)
|
||||
if closeArgs.SuggestNext {
|
||||
unblocked, err := store.GetNewlyUnblockedByClose(ctx, closeArgs.ID)
|
||||
if err != nil {
|
||||
// Non-fatal: still return the closed issue
|
||||
unblocked = nil
|
||||
}
|
||||
result := CloseResult{
|
||||
Closed: closedIssue,
|
||||
Unblocked: unblocked,
|
||||
}
|
||||
data, _ := json.Marshal(result)
|
||||
return Response{
|
||||
Success: true,
|
||||
Data: data,
|
||||
}
|
||||
}
|
||||
|
||||
// Backward compatible: just return the closed issue
|
||||
data, _ := json.Marshal(closedIssue)
|
||||
return Response{
|
||||
Success: true,
|
||||
|
||||
Reference in New Issue
Block a user