Feature Request: Automatic Label Creator #6
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Feature Request: Automatic Label Creator (@codebot setup-labels)
Summary
Add a
@codebot setup-labelscommand that automatically creates all required repository labels for the AI review system, eliminating a major setup pain point and ensuring auto-labeling works immediately.What problem does this solve?
Current Problem:
Setting up OpenRabbit has two scenarios:
Scenario 1: Fresh Repository (No Labels)
Scenario 2: Existing Label Schema (Like Your Case)
type: bug,priority: high, etc.)Your Current Labels (18 total):
User Pain:
Support Burden:
User story / Use case
As a repository administrator setting up OpenRabbit,
I want to automatically create all required labels with one command,
so that I don't have to manually create 10+ labels and the bot works immediately.
Example scenario:
@codebot setup-labelsin any issueProposed solution
Implementation
Add a
@codebot setup-labelscommand that:Detects existing label schema - Scans repository labels to identify naming patterns (Kind/*, Priority -, type:, etc.)
Offers two modes:
Map Mode Flow:
.ai-review.ymlrepository configCreate Mode Flow:
Example Output: Map Mode (Your Case)
🔧 Missing Labels to Create (3):
Kind/Question- for question-type issuesStatus - AI Approved- for AI-approved PRsStatus - AI Changes Required- for PRs needing changesRun
@codebot setup-labels --create-missingto create these labels.Example: Dry-Run Mode
Response:
Files to Modify
1.
tools/ai-review/config.ymlAdd label schema detection patterns and default mappings:
Generated
.ai-review.yml(per-repository override):2.
tools/ai-review/clients/gitea_client.pyAdd label creation method:
3.
tools/ai-review/agents/issue_agent.pyAdd setup-labels command handler with schema detection:
Alternatives considered
Alternative 1: CLI Script for Setup
Alternative 2: Automatic Label Creation on First Use
Alternative 3: Setup Wizard in Workflow
Alternative 4: Manual Instructions in README
Alternative 5: Per-Repository Config File
.ai-review.ymlwith label definitions:Acceptance criteria
@codebot setup-labelscommand creates all required labelsconfig.yml--dry-runflag shows preview without creating labelsBackwards compatibility:
config.ymlformat still works (string format)Migration notes:
config.ymlcan upgrade to new format for color controlImpact
Complexity: MEDIUM-HIGH
config.yml,gitea_client.py,issue_agent.pyPOST /repos/{owner}/{repo}/labelsUser Impact: VERY HIGH
Technical Impact:
repo:writeoradmin:orgpermissions.ai-review.ymlper-repository configRisks:
Mockups / examples
Example 1: Map Mode - Your Repository (18 Existing Labels)
Example 2: Create Missing Labels (After Mapping)
Example 3: Fresh Repository (No Existing Labels)
Example 4: Force Create Mode (Ignore Existing)
Example 5: Dry-Run Preview
Implementation Plan
Phase 1: Core Implementation (3 hours)
Update
config.yml(30 min)Add API Methods to
gitea_client.py(30 min)create_label(owner, repo, name, color, description)get_repo_labels(owner, repo)Implement Label Schema Detection (1 hour)
_detect_label_schema()- Pattern detection_build_label_mapping()- Fuzzy matching with aliases_suggest_label_name()- Follow detected patternImplement Command Handlers (1 hour)
_command_setup_labels()- Main entry point_setup_labels_map_mode()- Map existing labels_setup_labels_create_mode()- Create new labels_generate_repo_config()- Generate .ai-review.ymlPhase 2: Testing (1 hour)
Unit Tests (30 min)
_detect_label_schema()with different patterns_build_label_mapping()fuzzy matching_suggest_label_name()pattern followingIntegration Test (30 min)
Phase 3: Documentation & Deployment (30 minutes)
Update Documentation
.ai-review.ymlformatDeployment
Dependencies
Required:
repo:writeoradmin:orgpermissionsOptional:
Related Issues/PRs
Success Metrics
Week 1 after deployment:
setup-labelscommandMonth 1 after deployment:
Long-term:
Security Considerations
Permissions Required:
repo:writescope minimumadmin:orgscopeSafety Measures:
Audit Trail:
Future Enhancements
v2.0 Features:
@codebot remove-labels- Clean up old/unused labels@codebot sync-labels- Update colors/descriptionsIntegration:
Checklist
Priority: ⭐ HIGH - Critical for setup experience
Milestone: Milestone 3 - Setup Simplification
Estimated Effort: 3-4 hours
Value: VERY HIGH
Complexity: MEDIUM-HIGH
Risk: MEDIUM
Key Features:
.ai-review.ymlconfig automatically