refactor: remove unused bd pin/unpin/hook commands (bd-x0zl)
Analysis found these commands are dead code: - gt never calls `bd pin` - uses `bd update --status=pinned` instead - Beads.Pin() wrapper exists but is never called - bd hook functionality duplicated by gt mol status - Code comment says "pinned field is cosmetic for bd hook visibility" Removed: - cmd/bd/pin.go - cmd/bd/unpin.go - cmd/bd/hook.go 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1097,10 +1097,16 @@ func (m *MemoryStorage) getOpenBlockers(issueID string) []string {
|
||||
|
||||
// GetBlockedIssues returns issues that are blocked by other issues
|
||||
// Note: Pinned issues are excluded from the output (beads-ei4)
|
||||
func (m *MemoryStorage) GetBlockedIssues(ctx context.Context) ([]*types.BlockedIssue, error) {
|
||||
func (m *MemoryStorage) GetBlockedIssues(ctx context.Context, filter types.WorkFilter) ([]*types.BlockedIssue, error) {
|
||||
m.mu.RLock()
|
||||
defer m.mu.RUnlock()
|
||||
|
||||
// Build set of descendant IDs if parent filter is specified
|
||||
var descendantIDs map[string]bool
|
||||
if filter.ParentID != nil {
|
||||
descendantIDs = m.getAllDescendants(*filter.ParentID)
|
||||
}
|
||||
|
||||
var results []*types.BlockedIssue
|
||||
|
||||
for _, issue := range m.issues {
|
||||
@@ -1114,6 +1120,11 @@ func (m *MemoryStorage) GetBlockedIssues(ctx context.Context) ([]*types.BlockedI
|
||||
continue
|
||||
}
|
||||
|
||||
// Parent filtering: only include descendants of specified parent
|
||||
if descendantIDs != nil && !descendantIDs[issue.ID] {
|
||||
continue
|
||||
}
|
||||
|
||||
blockers := m.getOpenBlockers(issue.ID)
|
||||
// Issue is "blocked" if: status is blocked, status is deferred, or has open blockers
|
||||
if issue.Status != types.StatusBlocked && issue.Status != types.StatusDeferred && len(blockers) == 0 {
|
||||
@@ -1149,6 +1160,27 @@ func (m *MemoryStorage) GetBlockedIssues(ctx context.Context) ([]*types.BlockedI
|
||||
return results, nil
|
||||
}
|
||||
|
||||
// getAllDescendants returns all descendant IDs of a parent issue recursively
|
||||
func (m *MemoryStorage) getAllDescendants(parentID string) map[string]bool {
|
||||
descendants := make(map[string]bool)
|
||||
m.collectDescendants(parentID, descendants)
|
||||
return descendants
|
||||
}
|
||||
|
||||
// collectDescendants recursively collects all descendants of a parent
|
||||
func (m *MemoryStorage) collectDescendants(parentID string, descendants map[string]bool) {
|
||||
for issueID, deps := range m.dependencies {
|
||||
for _, dep := range deps {
|
||||
if dep.Type == types.DepParentChild && dep.DependsOnID == parentID {
|
||||
if !descendants[issueID] {
|
||||
descendants[issueID] = true
|
||||
m.collectDescendants(issueID, descendants)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (m *MemoryStorage) GetEpicsEligibleForClosure(ctx context.Context) ([]*types.EpicStatus, error) {
|
||||
return nil, nil
|
||||
}
|
||||
@@ -1184,6 +1216,58 @@ func (m *MemoryStorage) GetStaleIssues(ctx context.Context, filter types.StaleFi
|
||||
return stale, nil
|
||||
}
|
||||
|
||||
// GetNewlyUnblockedByClose returns issues that became unblocked when the given issue was closed.
|
||||
// This is used by the --suggest-next flag on bd close (GH#679).
|
||||
func (m *MemoryStorage) GetNewlyUnblockedByClose(ctx context.Context, closedIssueID string) ([]*types.Issue, error) {
|
||||
m.mu.RLock()
|
||||
defer m.mu.RUnlock()
|
||||
|
||||
var unblocked []*types.Issue
|
||||
|
||||
// Find issues that depend on the closed issue
|
||||
for issueID, deps := range m.dependencies {
|
||||
issue, exists := m.issues[issueID]
|
||||
if !exists {
|
||||
continue
|
||||
}
|
||||
|
||||
// Only consider open/in_progress, non-pinned issues
|
||||
if issue.Status != types.StatusOpen && issue.Status != types.StatusInProgress {
|
||||
continue
|
||||
}
|
||||
if issue.Pinned {
|
||||
continue
|
||||
}
|
||||
|
||||
// Check if this issue depended on the closed issue
|
||||
dependedOnClosed := false
|
||||
for _, dep := range deps {
|
||||
if dep.DependsOnID == closedIssueID && dep.Type == types.DepBlocks {
|
||||
dependedOnClosed = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if !dependedOnClosed {
|
||||
continue
|
||||
}
|
||||
|
||||
// Check if now unblocked (no remaining open blockers)
|
||||
blockers := m.getOpenBlockers(issueID)
|
||||
if len(blockers) == 0 {
|
||||
issueCopy := *issue
|
||||
unblocked = append(unblocked, &issueCopy)
|
||||
}
|
||||
}
|
||||
|
||||
// Sort by priority ascending
|
||||
sort.Slice(unblocked, func(i, j int) bool {
|
||||
return unblocked[i].Priority < unblocked[j].Priority
|
||||
})
|
||||
|
||||
return unblocked, nil
|
||||
}
|
||||
|
||||
func (m *MemoryStorage) AddComment(ctx context.Context, issueID, actor, comment string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user