Documentation
¶
Overview ¶
Package ledger provides an interactive TUI for browsing and managing beads across all registered Forge anvils.
Index ¶
- Constants
- func AddDepCmd(anvilPath, beadID, depID string) tea.Cmd
- func AppendNotesCmd(anvilPath, beadID, notes string) tea.Cmd
- func BulkCloseCmd(anvils map[string]string, beads []Bead, selectedIDs map[string]bool) tea.Cmd
- func BulkLabelCmd(anvils map[string]string, beads []Bead, selectedIDs map[string]bool, ...) tea.Cmd
- func BulkPriorityCmd(anvils map[string]string, beads []Bead, selectedIDs map[string]bool, ...) tea.Cmd
- func CloseBeadCmd(anvilPath, beadID, reason string) tea.Cmd
- func EditBeadCmd(anvilPath, beadID, title, description string) tea.Cmd
- func FetchAllBeads(anvils map[string]string, db *state.DB) tea.Cmd
- func FetchAnvilBeads(anvilName, anvilPath string, db *state.DB) tea.Cmd
- func NewBeadCmd(anvilPath, title, description, issueType string, priority int) tea.Cmd
- func RemoveDepCmd(anvilPath, beadID, depID string) tea.Cmd
- func ReopenBeadCmd(anvilPath, beadID string) tea.Cmd
- func UpdateAssigneeCmd(anvilPath, beadID, assignee string) tea.Cmd
- func UpdateLabelCmd(anvilPath, beadID, label string, remove bool) tea.Cmd
- func UpdateNotesCmd(anvilPath, beadID, notes string) tea.Cmd
- func UpdatePriorityCmd(anvilPath, beadID string, priority int) tea.Cmd
- type ActionErrorMsg
- type Bead
- type BeadClosedMsg
- type BeadCreatedMsg
- type BeadReopenedMsg
- type BeadUpdatedMsg
- type BulkCloseResultMsg
- type BulkState
- type BulkUpdatedMsg
- type DepAddedMsg
- type DepRemovedMsg
- type EventEntry
- type EventLevel
- type FormKind
- type Model
- type SortField
- type TreeNode
- type UpdateBeadsMsg
- type ViewMode
Constants ¶
const ( LaneOpen = 0 LaneInProgress = 1 LaneInReview = 2 LaneClosed = 3 )
Lane indices for the kanban board.
Variables ¶
This section is empty.
Functions ¶
func AddDepCmd ¶
AddDepCmd adds a dependency to a bead via bd dep add <beadID> <depID>. After this, beadID depends on depID (depID blocks beadID).
func AppendNotesCmd ¶
AppendNotesCmd appends text to a bead's notes field.
func BulkCloseCmd ¶
BulkCloseCmd closes all selected beads sequentially and returns a summary message.
func BulkLabelCmd ¶
func BulkLabelCmd(anvils map[string]string, beads []Bead, selectedIDs map[string]bool, label string, remove bool) tea.Cmd
BulkLabelCmd adds or removes a label from all selected beads sequentially.
func BulkPriorityCmd ¶
func BulkPriorityCmd(anvils map[string]string, beads []Bead, selectedIDs map[string]bool, priority int) tea.Cmd
BulkPriorityCmd sets the priority of all selected beads sequentially.
func CloseBeadCmd ¶
CloseBeadCmd closes a bead with an optional reason.
func EditBeadCmd ¶
EditBeadCmd updates a bead's title and description.
func FetchAllBeads ¶
FetchAllBeads returns a tea.Cmd that fetches beads from all anvils in parallel. It fetches open/in_progress beads plus up to 50 closed beads (best-effort), then filters the closed beads to those updated or closed within the last 7 days. Note: closed-bead ordering is not guaranteed, so the 7-day window is applied after fetching — beads closed within 7 days but outside the first 50 results may not appear.
func FetchAnvilBeads ¶
FetchAnvilBeads returns a tea.Cmd that fetches beads for a single named anvil. It fetches open/in_progress beads plus recently-closed beads (last 7 days, up to 50), then enriches the results with PR data from the state DB.
func NewBeadCmd ¶
NewBeadCmd creates a new bead via bd create.
func RemoveDepCmd ¶
RemoveDepCmd removes a dependency via bd dep remove <beadID> <depID>. This removes the relationship where beadID depends on depID.
func ReopenBeadCmd ¶
ReopenBeadCmd reopens a closed bead.
func UpdateAssigneeCmd ¶
UpdateAssigneeCmd assigns or unassigns a bead.
func UpdateLabelCmd ¶
UpdateLabelCmd adds or removes a label from a bead.
func UpdateNotesCmd ¶
UpdateNotesCmd replaces a bead's notes field.
Types ¶
type ActionErrorMsg ¶
type ActionErrorMsg struct{ Err error }
ActionErrorMsg indicates a bead action failed.
type Bead ¶
type Bead struct {
ID string `json:"id"`
Title string `json:"title"`
Description string `json:"description"`
Status string `json:"status"`
Priority int `json:"priority"`
IssueType string `json:"issue_type"`
Assignee string `json:"assignee"`
Labels []string `json:"labels"`
Blocks []string `json:"blocks"`
DependsOn []string `json:"depends_on"`
ClosedAt *time.Time `json:"closed_at"`
UpdatedAt *time.Time `json:"updated_at"`
// Enriched fields (not from bd JSON)
Anvil string `json:"-"`
HasPR bool `json:"-"`
}
Bead represents an issue from bd with enrichment from Forge's state DB.
func (*Bead) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler for Bead. It sanitises timestamp fields whose year is outside the JSON-safe range [0,9999], zeroing those fields instead of storing an unrepresentable value that would crash when the Bead is later re-marshalled to JSON.
type BeadClosedMsg ¶
type BeadClosedMsg struct{ ID string }
BeadClosedMsg indicates a bead was successfully closed.
type BeadCreatedMsg ¶
type BeadCreatedMsg struct{ ID string }
BeadCreatedMsg indicates a new bead was successfully created.
type BeadReopenedMsg ¶
type BeadReopenedMsg struct{ ID string }
BeadReopenedMsg indicates a bead was successfully reopened.
type BeadUpdatedMsg ¶
type BeadUpdatedMsg struct{ ID string }
BeadUpdatedMsg indicates a bead was successfully updated.
type BulkCloseResultMsg ¶
BulkCloseResultMsg is returned after a bulk close operation completes.
type BulkState ¶
type BulkState struct {
// contains filtered or unexported fields
}
BulkState tracks which beads are currently selected for bulk operations.
func (*BulkState) IsSelected ¶
IsSelected reports whether the given bead ID is selected.
type BulkUpdatedMsg ¶
BulkUpdatedMsg is returned after a bulk update operation (label/priority) completes.
type DepAddedMsg ¶
DepAddedMsg indicates a dependency was successfully added.
type DepRemovedMsg ¶
DepRemovedMsg indicates a dependency was successfully removed.
type EventEntry ¶
type EventEntry struct {
Timestamp string
Level EventLevel
Message string
}
EventEntry is one entry in the Ledger's in-memory event/error log.
type EventLevel ¶
type EventLevel int
EventLevel indicates the severity of a log entry.
const ( EventInfo EventLevel = iota EventWarn EventError )
type FormKind ¶
type FormKind int
FormKind tracks which overlay form is active.
const ( FormNone FormKind = iota FormNewBead FormEditBead FormCloseBead FormLabel FormPriority FormComment FormNotes FormAssign FormAddDep // d key: pick a bead to add as a dependency FormViewDeps // b key: view and optionally remove dependencies FormBulkLabel // ctrl+l: set a label on all selected beads FormBulkPriority // ctrl+p: set priority on all selected beads )
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the top-level Bubbletea model for the Ledger TUI.
func NewModel ¶
func NewModel(anvils map[string]string, anvilConfigs map[string]config.AnvilConfig, db *state.DB) *Model
NewModel creates a new Ledger model. anvilConfigs is the per-anvil configuration map from forge.yaml (may be nil); it is used when running dependency updates so they respect per-anvil Temper settings.
func (*Model) Init ¶
Init schedules the periodic refresh tick. Bead data is fetched lazily when the user selects an anvil from the top-level ViewAnvils screen.
type TreeNode ¶
type TreeNode struct {
Bead *Bead
Depth int
Children []*TreeNode
Progress string // e.g. "3/5" (closed/total children); empty for leaf nodes
}
TreeNode represents a node in the bead hierarchy tree.
type UpdateBeadsMsg ¶
UpdateBeadsMsg carries the result of a FetchAllBeads operation.