This is a fundamental architectural shift from binary SQLite to JSONL as the source of truth for git workflows. ## New Features - `bd export --format=jsonl` - Export issues to JSON Lines format - `bd import` - Import issues from JSONL (create new, update existing) - `--skip-existing` flag for import to only create new issues ## Architecture Change **Before:** Binary SQLite database committed to git **After:** JSONL text files as source of truth, SQLite as ephemeral cache Benefits: - Git-friendly text format with clean diffs - AI-resolvable merge conflicts (append-only is 95% conflict-free) - Human-readable issue tracking in git - No binary merge conflicts ## Documentation - Updated README with JSONL-first workflow and git hooks - Added TEXT_FORMATS.md analyzing JSONL vs CSV vs binary - Updated GIT_WORKFLOW.md with historical context - .gitignore now excludes *.db, includes .beads/*.jsonl ## Implementation Details - Export sorts issues by ID for consistent diffs - Import handles both creates and updates atomically - Proper handling of pointer fields (EstimatedMinutes) - All tests passing ## Breaking Changes - Database files (*.db) should now be gitignored - Use export/import workflow for git collaboration - Git hooks recommended for automation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
62 lines
2.1 KiB
Go
62 lines
2.1 KiB
Go
package storage
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/steveyegge/beads/internal/types"
|
|
)
|
|
|
|
// Storage defines the interface for issue storage backends
|
|
type Storage interface {
|
|
// Issues
|
|
CreateIssue(ctx context.Context, issue *types.Issue, actor string) error
|
|
GetIssue(ctx context.Context, id string) (*types.Issue, error)
|
|
UpdateIssue(ctx context.Context, id string, updates map[string]interface{}, actor string) error
|
|
CloseIssue(ctx context.Context, id string, reason string, actor string) error
|
|
SearchIssues(ctx context.Context, query string, filter types.IssueFilter) ([]*types.Issue, error)
|
|
|
|
// Dependencies
|
|
AddDependency(ctx context.Context, dep *types.Dependency, actor string) error
|
|
RemoveDependency(ctx context.Context, issueID, dependsOnID string, actor string) error
|
|
GetDependencies(ctx context.Context, issueID string) ([]*types.Issue, error)
|
|
GetDependents(ctx context.Context, issueID string) ([]*types.Issue, error)
|
|
GetDependencyTree(ctx context.Context, issueID string, maxDepth int) ([]*types.TreeNode, error)
|
|
DetectCycles(ctx context.Context) ([][]*types.Issue, error)
|
|
|
|
// Labels
|
|
AddLabel(ctx context.Context, issueID, label, actor string) error
|
|
RemoveLabel(ctx context.Context, issueID, label, actor string) error
|
|
GetLabels(ctx context.Context, issueID string) ([]string, error)
|
|
GetIssuesByLabel(ctx context.Context, label string) ([]*types.Issue, error)
|
|
|
|
// Ready Work & Blocking
|
|
GetReadyWork(ctx context.Context, filter types.WorkFilter) ([]*types.Issue, error)
|
|
GetBlockedIssues(ctx context.Context) ([]*types.BlockedIssue, error)
|
|
|
|
// Events
|
|
AddComment(ctx context.Context, issueID, actor, comment string) error
|
|
GetEvents(ctx context.Context, issueID string, limit int) ([]*types.Event, error)
|
|
|
|
// Statistics
|
|
GetStatistics(ctx context.Context) (*types.Statistics, error)
|
|
|
|
// Lifecycle
|
|
Close() error
|
|
}
|
|
|
|
// Config holds database configuration
|
|
type Config struct {
|
|
Backend string // "sqlite" or "postgres"
|
|
|
|
// SQLite config
|
|
Path string // database file path
|
|
|
|
// PostgreSQL config
|
|
Host string
|
|
Port int
|
|
Database string
|
|
User string
|
|
Password string
|
|
SSLMode string
|
|
}
|