Extends Storage interface with Dolt-specific version control capabilities:
- New VersionedStorage interface in storage/versioned.go with:
- History queries: History(), AsOf(), Diff()
- Branch operations: Branch(), Merge(), CurrentBranch(), ListBranches()
- Commit operations: Commit(), GetCurrentCommit()
- Conflict resolution: GetConflicts(), ResolveConflicts()
- Helper types: HistoryEntry, DiffEntry, Conflict
- DoltStore implements VersionedStorage interface
- New CLI commands:
- bd history <id> - Show issue version history
- bd diff <from> <to> - Show changes between commits/branches
- bd branch [name] - List or create branches
- bd vc merge <branch> - Merge branch to current
- bd vc commit -m <msg> - Create a commit
- bd vc status - Show current branch/commit
- Added --as-of flag to bd show for time-travel queries
- IsVersioned() helper for graceful SQLite backend detection
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add DeleteBranch method to DoltStore for removing branches
- Update hookPostMergeDolt to clean up import branches after merge
- Completes hq-ew1mbr.9 git hook infrastructure
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The SQL formatting warnings (G201) are safe because:
- Placeholders only contain "?" markers for parameterized queries
- WHERE/SET clauses use validated column names with ? placeholders
- Refs are validated by validateRef() before use in AS OF queries
- LIMIT values are safe integers from filter.Limit
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Phase 2 of Dolt integration - enables runtime backend selection:
- Add --backend flag to bd init (sqlite|dolt)
- Create storage factory for backend instantiation
- Update daemon and main.go to use factory with config detection
- Update database discovery to find Dolt backends via metadata.json
- Fix Dolt schema init to split statements for MySQL compatibility
- Add ReadOnly mode to skip schema init for read-only commands
Usage: bd init --backend dolt --prefix myproject
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements a complete Dolt storage backend that mirrors the SQLite implementation
with MySQL-compatible syntax and adds version control capabilities.
Key features:
- Full Storage interface implementation (~50 methods)
- Version control operations: commit, push, pull, branch, merge, checkout
- History queries via AS OF and dolt_history_* tables
- Cell-level merge instead of line-level JSONL merge
- SQL injection protection with input validation
Bug fixes applied during implementation:
- Added missing quality_score, work_type, source_system to scanIssue
- Fixed Status() to properly parse boolean staged column
- Added validation to CreateIssues (was missing in batch create)
- Made RenameDependencyPrefix transactional
- Expanded GetIssueHistory to return more complete data
Test coverage: 17 tests covering CRUD, dependencies, labels, search,
comments, events, statistics, and SQL injection protection.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>