Files
beads/cmd/bd/show_unit_helpers.go
Steve Yegge 1611f16751 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>
2025-12-27 16:02:15 -08:00

69 lines
1.6 KiB
Go

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
}