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:
68
cmd/bd/show_unit_helpers.go
Normal file
68
cmd/bd/show_unit_helpers.go
Normal file
@@ -0,0 +1,68 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/steveyegge/beads/internal/storage"
|
||||
"github.com/steveyegge/beads/internal/types"
|
||||
)
|
||||
|
||||
func validateIssueUpdatable(id string, issue *types.Issue) error {
|
||||
if issue == nil {
|
||||
return nil
|
||||
}
|
||||
if issue.IsTemplate {
|
||||
return fmt.Errorf("Error: cannot update template %s: templates are read-only; use 'bd molecule instantiate' to create a work item", id)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func validateIssueClosable(id string, issue *types.Issue, force bool) error {
|
||||
if issue == nil {
|
||||
return nil
|
||||
}
|
||||
if issue.IsTemplate {
|
||||
return fmt.Errorf("Error: cannot close template %s: templates are read-only", id)
|
||||
}
|
||||
if !force && issue.Status == types.StatusPinned {
|
||||
return fmt.Errorf("Error: cannot close pinned issue %s (use --force to override)", id)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func applyLabelUpdates(ctx context.Context, st storage.Storage, issueID, actor string, setLabels, addLabels, removeLabels []string) error {
|
||||
// Set labels (replaces all existing labels)
|
||||
if len(setLabels) > 0 {
|
||||
currentLabels, err := st.GetLabels(ctx, issueID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, label := range currentLabels {
|
||||
if err := st.RemoveLabel(ctx, issueID, label, actor); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
for _, label := range setLabels {
|
||||
if err := st.AddLabel(ctx, issueID, label, actor); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add labels
|
||||
for _, label := range addLabels {
|
||||
if err := st.AddLabel(ctx, issueID, label, actor); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// Remove labels
|
||||
for _, label := range removeLabels {
|
||||
if err := st.RemoveLabel(ctx, issueID, label, actor); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user