Add public API for external extensions
Created root-level beads.go that re-exports types and functions from internal packages. This allows external projects (like VC) to import from github.com/steveyegge/beads without violating Go's internal package restrictions. Exports: - Storage interface and NewSQLiteStorage() - Core types (Issue, Dependency, Label, etc.) - Filter types (IssueFilter, WorkFilter) - All relevant constants (Status, IssueType, DependencyType, etc.) This matches the usage shown in docs/EXTENDING.md. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
108
beads.go
Normal file
108
beads.go
Normal file
@@ -0,0 +1,108 @@
|
||||
// Package beads provides a minimal public API for extending bd with custom orchestration.
|
||||
//
|
||||
// Most extensions should use direct SQL queries against bd's database.
|
||||
// This package exports only the essential types and functions needed for
|
||||
// Go-based extensions that want to use bd's storage layer programmatically.
|
||||
//
|
||||
// For detailed guidance on extending bd, see docs/EXTENDING.md.
|
||||
package beads
|
||||
|
||||
import (
|
||||
"github.com/steveyegge/beads/internal/beads"
|
||||
"github.com/steveyegge/beads/internal/types"
|
||||
)
|
||||
|
||||
// Storage is the interface for beads storage operations
|
||||
type Storage = beads.Storage
|
||||
|
||||
// NewSQLiteStorage creates a new SQLite storage instance at the given path
|
||||
func NewSQLiteStorage(dbPath string) (Storage, error) {
|
||||
return beads.NewSQLiteStorage(dbPath)
|
||||
}
|
||||
|
||||
// FindDatabasePath finds the beads database in the current directory tree
|
||||
func FindDatabasePath() string {
|
||||
return beads.FindDatabasePath()
|
||||
}
|
||||
|
||||
// FindJSONLPath finds the JSONL file corresponding to a database path
|
||||
func FindJSONLPath(dbPath string) string {
|
||||
return beads.FindJSONLPath(dbPath)
|
||||
}
|
||||
|
||||
// DatabaseInfo contains information about a beads database
|
||||
type DatabaseInfo = beads.DatabaseInfo
|
||||
|
||||
// FindAllDatabases finds all beads databases in the system
|
||||
func FindAllDatabases() []DatabaseInfo {
|
||||
return beads.FindAllDatabases()
|
||||
}
|
||||
|
||||
// Core types from internal/types
|
||||
type (
|
||||
Issue = types.Issue
|
||||
Status = types.Status
|
||||
IssueType = types.IssueType
|
||||
Dependency = types.Dependency
|
||||
DependencyType = types.DependencyType
|
||||
Label = types.Label
|
||||
Comment = types.Comment
|
||||
Event = types.Event
|
||||
EventType = types.EventType
|
||||
BlockedIssue = types.BlockedIssue
|
||||
TreeNode = types.TreeNode
|
||||
IssueFilter = types.IssueFilter
|
||||
WorkFilter = types.WorkFilter
|
||||
StaleFilter = types.StaleFilter
|
||||
DependencyCounts = types.DependencyCounts
|
||||
IssueWithCounts = types.IssueWithCounts
|
||||
SortPolicy = types.SortPolicy
|
||||
EpicStatus = types.EpicStatus
|
||||
)
|
||||
|
||||
// Status constants
|
||||
const (
|
||||
StatusOpen = types.StatusOpen
|
||||
StatusInProgress = types.StatusInProgress
|
||||
StatusBlocked = types.StatusBlocked
|
||||
StatusClosed = types.StatusClosed
|
||||
)
|
||||
|
||||
// IssueType constants
|
||||
const (
|
||||
TypeBug = types.TypeBug
|
||||
TypeFeature = types.TypeFeature
|
||||
TypeTask = types.TypeTask
|
||||
TypeEpic = types.TypeEpic
|
||||
TypeChore = types.TypeChore
|
||||
)
|
||||
|
||||
// DependencyType constants
|
||||
const (
|
||||
DepBlocks = types.DepBlocks
|
||||
DepRelated = types.DepRelated
|
||||
DepParentChild = types.DepParentChild
|
||||
DepDiscoveredFrom = types.DepDiscoveredFrom
|
||||
)
|
||||
|
||||
// SortPolicy constants
|
||||
const (
|
||||
SortPolicyHybrid = types.SortPolicyHybrid
|
||||
SortPolicyPriority = types.SortPolicyPriority
|
||||
SortPolicyOldest = types.SortPolicyOldest
|
||||
)
|
||||
|
||||
// EventType constants
|
||||
const (
|
||||
EventCreated = types.EventCreated
|
||||
EventUpdated = types.EventUpdated
|
||||
EventStatusChanged = types.EventStatusChanged
|
||||
EventCommented = types.EventCommented
|
||||
EventClosed = types.EventClosed
|
||||
EventReopened = types.EventReopened
|
||||
EventDependencyAdded = types.EventDependencyAdded
|
||||
EventDependencyRemoved = types.EventDependencyRemoved
|
||||
EventLabelAdded = types.EventLabelAdded
|
||||
EventLabelRemoved = types.EventLabelRemoved
|
||||
EventCompacted = types.EventCompacted
|
||||
)
|
||||
Reference in New Issue
Block a user