feat(bd-1pj6): Add custom status states via config
Users can now define custom status states for multi-step pipelines using: bd config set status.custom "awaiting_review,awaiting_testing,awaiting_docs" Changes: - Add Status.IsValidWithCustom() method for custom status validation - Add Issue.ValidateWithCustomStatuses() method - Add GetCustomStatuses() method to storage interface - Update CreateIssue/UpdateIssue to support custom statuses - Add comprehensive tests for custom status functionality - Update config command help text with custom status documentation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -27,8 +27,14 @@ import (
|
||||
|
||||
// CreateIssue creates a new issue
|
||||
func (s *SQLiteStorage) CreateIssue(ctx context.Context, issue *types.Issue, actor string) error {
|
||||
// Validate issue before creating
|
||||
if err := issue.Validate(); err != nil {
|
||||
// Fetch custom statuses for validation (bd-1pj6)
|
||||
customStatuses, err := s.GetCustomStatuses(ctx)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to get custom statuses: %w", err)
|
||||
}
|
||||
|
||||
// Validate issue before creating (with custom status support)
|
||||
if err := issue.ValidateWithCustomStatuses(customStatuses); err != nil {
|
||||
return fmt.Errorf("validation failed: %w", err)
|
||||
}
|
||||
|
||||
@@ -471,6 +477,12 @@ func (s *SQLiteStorage) UpdateIssue(ctx context.Context, id string, updates map[
|
||||
return fmt.Errorf("issue %s not found", id)
|
||||
}
|
||||
|
||||
// Fetch custom statuses for validation (bd-1pj6)
|
||||
customStatuses, err := s.GetCustomStatuses(ctx)
|
||||
if err != nil {
|
||||
return wrapDBError("get custom statuses", err)
|
||||
}
|
||||
|
||||
// Build update query with validated field names
|
||||
setClauses := []string{"updated_at = ?"}
|
||||
args := []interface{}{time.Now()}
|
||||
@@ -481,8 +493,8 @@ func (s *SQLiteStorage) UpdateIssue(ctx context.Context, id string, updates map[
|
||||
return fmt.Errorf("invalid field for update: %s", key)
|
||||
}
|
||||
|
||||
// Validate field values
|
||||
if err := validateFieldUpdate(key, value); err != nil {
|
||||
// Validate field values (with custom status support)
|
||||
if err := validateFieldUpdateWithCustomStatuses(key, value, customStatuses); err != nil {
|
||||
return wrapDBError("validate field update", err)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user