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:
@@ -16,10 +16,15 @@ func validatePriority(value interface{}) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// validateStatus validates a status value
|
||||
// validateStatus validates a status value (built-in statuses only)
|
||||
func validateStatus(value interface{}) error {
|
||||
return validateStatusWithCustom(value, nil)
|
||||
}
|
||||
|
||||
// validateStatusWithCustom validates a status value, allowing custom statuses.
|
||||
func validateStatusWithCustom(value interface{}, customStatuses []string) error {
|
||||
if status, ok := value.(string); ok {
|
||||
if !types.Status(status).IsValid() {
|
||||
if !types.Status(status).IsValidWithCustom(customStatuses) {
|
||||
return fmt.Errorf("invalid status: %s", status)
|
||||
}
|
||||
}
|
||||
@@ -65,8 +70,18 @@ var fieldValidators = map[string]func(interface{}) error{
|
||||
"estimated_minutes": validateEstimatedMinutes,
|
||||
}
|
||||
|
||||
// validateFieldUpdate validates a field update value
|
||||
// validateFieldUpdate validates a field update value (built-in statuses only)
|
||||
func validateFieldUpdate(key string, value interface{}) error {
|
||||
return validateFieldUpdateWithCustomStatuses(key, value, nil)
|
||||
}
|
||||
|
||||
// validateFieldUpdateWithCustomStatuses validates a field update value,
|
||||
// allowing custom statuses for status field validation.
|
||||
func validateFieldUpdateWithCustomStatuses(key string, value interface{}, customStatuses []string) error {
|
||||
// Special handling for status field to support custom statuses
|
||||
if key == "status" {
|
||||
return validateStatusWithCustom(value, customStatuses)
|
||||
}
|
||||
if validator, ok := fieldValidators[key]; ok {
|
||||
return validator(value)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user