feat(labels): standardize automatic label creation to match ecosystem convention
@goal: WHOOSH-LABELS-004, WSH-CONSISTENCY - Ecosystem standardization Replace custom label set with standardized CHORUS ecosystem labels: - Add all 8 GitHub-standard labels (bug, duplicate, enhancement, etc.) - Fix bzzz-task color from #ff6b6b to #5319e7 for consistency - Remove custom priority labels and whoosh-monitored label - Maintain backward compatibility and error handling Changes: - Updated EnsureRequiredLabels() in internal/gitea/client.go - Added requirement traceability comments throughout - Updated integration points in internal/server/server.go - Created comprehensive decision record Benefits: - Consistent labeling across WHOOSH, CHORUS, KACHING repositories - Familiar GitHub-standard labels for better developer experience - Improved tool integration and issue management - Preserved bzzz-task automation for CHORUS workflow Fixes: WHOOSH issue #4 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -433,49 +433,71 @@ func (c *Client) GetLabels(ctx context.Context, owner, repo string) ([]Label, er
|
||||
return labels, nil
|
||||
}
|
||||
|
||||
// @goal: WHOOSH-LABELS-004, WSH-CONSISTENCY - Ecosystem standardization
|
||||
// WHY: Ensures all CHORUS ecosystem repositories have consistent GitHub-standard labels
|
||||
// EnsureRequiredLabels ensures that required labels exist in the repository
|
||||
func (c *Client) EnsureRequiredLabels(ctx context.Context, owner, repo string) error {
|
||||
// @goal: WHOOSH-LABELS-004 - Standardized label set matching WHOOSH repository conventions
|
||||
// WHY: Provides consistent issue categorization across all CHORUS ecosystem repositories
|
||||
requiredLabels := []CreateLabelRequest{
|
||||
{
|
||||
Name: "bug",
|
||||
Color: "ee0701",
|
||||
Description: "Something is not working",
|
||||
},
|
||||
{
|
||||
Name: "bzzz-task",
|
||||
Color: "ff6b6b",
|
||||
Description: "Issues that should be converted to BZZZ tasks for CHORUS",
|
||||
Color: "5319e7", // @goal: WHOOSH-LABELS-004 - Corrected color to match ecosystem standard
|
||||
Description: "CHORUS task for auto ingestion.",
|
||||
},
|
||||
{
|
||||
Name: "whoosh-monitored",
|
||||
Color: "4ecdc4",
|
||||
Description: "Repository is monitored by WHOOSH",
|
||||
Name: "duplicate",
|
||||
Color: "cccccc",
|
||||
Description: "This issue or pull request already exists",
|
||||
},
|
||||
{
|
||||
Name: "priority-high",
|
||||
Color: "e74c3c",
|
||||
Description: "High priority task for immediate attention",
|
||||
Name: "enhancement",
|
||||
Color: "84b6eb",
|
||||
Description: "New feature",
|
||||
},
|
||||
{
|
||||
Name: "priority-medium",
|
||||
Color: "f39c12",
|
||||
Description: "Medium priority task",
|
||||
Name: "help wanted",
|
||||
Color: "128a0c",
|
||||
Description: "Need some help",
|
||||
},
|
||||
{
|
||||
Name: "priority-low",
|
||||
Color: "95a5a6",
|
||||
Description: "Low priority task",
|
||||
Name: "invalid",
|
||||
Color: "e6e6e6",
|
||||
Description: "Something is wrong",
|
||||
},
|
||||
{
|
||||
Name: "question",
|
||||
Color: "cc317c",
|
||||
Description: "More information is needed",
|
||||
},
|
||||
{
|
||||
Name: "wontfix",
|
||||
Color: "ffffff",
|
||||
Description: "This won't be fixed",
|
||||
},
|
||||
}
|
||||
|
||||
// Get existing labels
|
||||
// @goal: WHOOSH-LABELS-004 - Check existing labels to avoid duplicates
|
||||
// WHY: Prevents API errors from attempting to create labels that already exist
|
||||
existingLabels, err := c.GetLabels(ctx, owner, repo)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to get existing labels: %w", err)
|
||||
}
|
||||
|
||||
// Create a map of existing label names for quick lookup
|
||||
|
||||
// @goal: WHOOSH-LABELS-004 - Build lookup map for efficient duplicate checking
|
||||
// WHY: O(1) lookup performance for label existence checking
|
||||
existingLabelNames := make(map[string]bool)
|
||||
for _, label := range existingLabels {
|
||||
existingLabelNames[label.Name] = true
|
||||
}
|
||||
|
||||
// Create missing required labels
|
||||
|
||||
// @goal: WHOOSH-LABELS-004 - Create only missing standardized labels
|
||||
// WHY: Ensures all repositories have consistent labeling without overwriting existing labels
|
||||
for _, requiredLabel := range requiredLabels {
|
||||
if !existingLabelNames[requiredLabel.Name] {
|
||||
_, err := c.CreateLabel(ctx, owner, repo, requiredLabel)
|
||||
|
||||
@@ -2352,11 +2352,14 @@ func (s *Server) createRepositoryHandler(w http.ResponseWriter, r *http.Request)
|
||||
}
|
||||
|
||||
// Automatically create required labels in the Gitea repository
|
||||
// @goal: WHOOSH-LABELS-004 - Automatic label creation on repository addition
|
||||
// WHY: Ensures standardized ecosystem labels are available immediately for issue categorization
|
||||
if req.SourceType == "gitea" && s.repoMonitor != nil && s.repoMonitor.GetGiteaClient() != nil {
|
||||
log.Info().
|
||||
Str("repository", fullName).
|
||||
Msg("Creating required labels in Gitea repository")
|
||||
|
||||
|
||||
// @goal: WHOOSH-LABELS-004 - Apply standardized label set to new repository
|
||||
err := s.repoMonitor.GetGiteaClient().EnsureRequiredLabels(context.Background(), req.Owner, req.Name)
|
||||
if err != nil {
|
||||
log.Warn().
|
||||
@@ -2634,7 +2637,8 @@ func (s *Server) ensureRepositoryLabelsHandler(w http.ResponseWriter, r *http.Re
|
||||
return
|
||||
}
|
||||
|
||||
// Ensure required labels exist
|
||||
// @goal: WHOOSH-LABELS-004 - Manual label synchronization endpoint
|
||||
// WHY: Allows updating existing repositories to standardized label set
|
||||
err = s.repoMonitor.GetGiteaClient().EnsureRequiredLabels(context.Background(), owner, name)
|
||||
if err != nil {
|
||||
log.Error().
|
||||
|
||||
Reference in New Issue
Block a user