fix: add label ID resolution to Gitea create_issue

Problem:
- Gitea API expects label IDs (integers), not label names (strings)
- Previous implementation passed label names directly, causing 422 errors

Solution:
- Added _resolve_label_ids() method to convert names to IDs
- Fetches all labels (org + repo) and builds name->ID mapping
- Automatically resolves IDs before creating issues

Testing:
- Created test issue #4 with 4 labels (manual verification)
- Created test issue #5 with 11 labels (automated testing)
- All labels applied correctly in Gitea

Also updated:
- projman/skills/label-taxonomy/labels-reference.md with current taxonomy
- Status updated to "Synced with Gitea" (43 labels total)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-21 10:28:27 -05:00
parent 1245862587
commit 66da25f899
2 changed files with 84 additions and 54 deletions

View File

@@ -116,7 +116,7 @@ class GiteaClient:
Args: Args:
title: Issue title title: Issue title
body: Issue description body: Issue description
labels: List of label names labels: List of label names (will be converted to IDs)
repo: Override configured repo (for PMO multi-repo) repo: Override configured repo (for PMO multi-repo)
Returns: Returns:
@@ -137,13 +137,44 @@ class GiteaClient:
} }
if labels: if labels:
data['labels'] = labels # Convert label names to IDs (Gitea expects integer IDs, not strings)
label_ids = self._resolve_label_ids(labels, target_repo)
data['labels'] = label_ids
logger.info(f"Creating issue in {self.owner}/{target_repo}: {title}") logger.info(f"Creating issue in {self.owner}/{target_repo}: {title}")
response = self.session.post(url, json=data) response = self.session.post(url, json=data)
response.raise_for_status() response.raise_for_status()
return response.json() return response.json()
def _resolve_label_ids(self, label_names: List[str], repo: str) -> List[int]:
"""
Convert label names to label IDs.
Args:
label_names: List of label names (e.g., ['Type/Feature', 'Priority/High'])
repo: Repository name
Returns:
List of label IDs
"""
# Fetch all available labels (org + repo)
org_labels = self.get_org_labels()
repo_labels = self.get_labels(repo)
all_labels = org_labels + repo_labels
# Build name -> ID mapping
label_map = {label['name']: label['id'] for label in all_labels}
# Resolve IDs
label_ids = []
for name in label_names:
if name in label_map:
label_ids.append(label_map[name])
else:
logger.warning(f"Label '{name}' not found in Gitea, skipping")
return label_ids
def update_issue( def update_issue(
self, self,
issue_number: int, issue_number: int,

View File

@@ -5,85 +5,84 @@ description: Dynamic reference for Gitea label taxonomy (organization + reposito
# Label Taxonomy Reference # Label Taxonomy Reference
**Status:** Initial template - Run `/labels-sync` to populate with actual labels from Gitea **Status:** ✅ Synced with Gitea
**Last synced:** 2025-11-21 (via automated testing)
**Last synced:** Never (please run `/labels-sync`) **Source:** Gitea (hhl-infra/claude-code-hhl-toolkit)
**Source:** Gitea (hhl-infra repository)
## Overview ## Overview
This skill provides the current label taxonomy used for issue classification in Gitea. Labels are **fetched dynamically** from Gitea and should never be hardcoded. This skill provides the current label taxonomy used for issue classification in Gitea. Labels are **fetched dynamically** from Gitea and should never be hardcoded.
**Current Taxonomy:** ~44 labels (28 organization + 16 repository) **Current Taxonomy:** 43 labels (27 organization + 16 repository)
## Organization Labels (~28) ## Organization Labels (27)
Organization-level labels are shared across all repositories in the `hhl-infra` organization. Organization-level labels are shared across all repositories in the `hhl-infra` organization.
### Agent (2) ### Agent (2)
- `Agent/Human` - Work performed by human developers - `Agent/Human` (#0052cc) - Work performed by human developers
- `Agent/Claude` - Work performed by Claude Code or AI assistants - `Agent/Claude` (#6554c0) - Work performed by Claude Code or AI assistants
### Complexity (3) ### Complexity (3)
- `Complexity/Simple` - Straightforward tasks requiring minimal analysis - `Complexity/Simple` (#c2e0c6) - Straightforward tasks requiring minimal analysis
- `Complexity/Medium` - Moderate complexity with some architectural decisions - `Complexity/Medium` (#fff4ce) - Moderate complexity with some architectural decisions
- `Complexity/Complex` - High complexity requiring significant planning and analysis - `Complexity/Complex` (#ffbdad) - High complexity requiring significant planning and analysis
### Efforts (5) ### Efforts (5)
- `Efforts/XS` - Extra small effort (< 2 hours) - `Efforts/XS` (#c2e0c6) - Extra small effort (< 2 hours)
- `Efforts/S` - Small effort (2-4 hours) - `Efforts/S` (#d4f1d4) - Small effort (2-4 hours)
- `Efforts/M` - Medium effort (4-8 hours / 1 day) - `Efforts/M` (#fff4ce) - Medium effort (4-8 hours / 1 day)
- `Efforts/L` - Large effort (1-3 days) - `Efforts/L` (#ffe0b2) - Large effort (1-3 days)
- `Efforts/XL` - Extra large effort (> 3 days) - `Efforts/XL` (#ffbdad) - Extra large effort (> 3 days)
### Priority (4) ### Priority (4)
- `Priority/Low` - Nice to have, can wait - `Priority/Low` (#d4e157) - Nice to have, can wait
- `Priority/Medium` - Should be done this sprint - `Priority/Medium` (#ffeb3b) - Should be done this sprint
- `Priority/High` - Important, do soon - `Priority/High` (#ff9800) - Important, do soon
- `Priority/Critical` - Urgent, blocking other work - `Priority/Critical` (#f44336) - Urgent, blocking other work
### Risk (3) ### Risk (3)
- `Risk/Low` - Low risk of issues or impact - `Risk/Low` (#c2e0c6) - Low risk of issues or impact
- `Risk/Medium` - Moderate risk, proceed with caution - `Risk/Medium` (#fff4ce) - Moderate risk, proceed with caution
- `Risk/High` - High risk, needs careful planning and testing - `Risk/High` (#ffbdad) - High risk, needs careful planning and testing
### Source (4) ### Source (4)
- `Source/Development` - Issue discovered during development - `Source/Development` (#7cb342) - Issue discovered during development
- `Source/Staging` - Issue found in staging environment - `Source/Staging` (#ffb300) - Issue found in staging environment
- `Source/Production` - Issue found in production - `Source/Production` (#e53935) - Issue found in production
- `Source/Customer` - Issue reported by customer - `Source/Customer` (#ab47bc) - Issue reported by customer
### Type (6) ### Type (6)
- `Type/Bug` - Bug fixes and error corrections - `Type/Bug` (#d73a4a) - Bug fixes and error corrections
- `Type/Feature` - New features and enhancements - `Type/Feature` (#0075ca) - New features and enhancements
- `Type/Refactor` - Code restructuring and architectural changes - `Type/Refactor` (#fbca04) - Code restructuring and architectural changes
- `Type/Documentation` - Documentation updates and improvements - `Type/Documentation` (#0e8a16) - Documentation updates and improvements
- `Type/Test` - Testing-related work (unit, integration, e2e) - `Type/Test` (#1d76db) - Testing-related work (unit, integration, e2e)
- `Type/Chore` - Maintenance, tooling, dependencies, build tasks - `Type/Chore` (#fef2c0) - Maintenance, tooling, dependencies, build tasks
## Repository Labels (~16) ## Repository Labels (16)
Repository-level labels are specific to each project. Repository-level labels are specific to the claude-code-hhl-toolkit project.
### Component (9) ### Component (9)
- `Component/Backend` - Backend service code and business logic - `Component/Backend` (#5319e7) - Backend service code and business logic
- `Component/Frontend` - User interface and client-side code - `Component/Frontend` (#1d76db) - User interface and client-side code
- `Component/API` - API endpoints, contracts, and integration - `Component/API` (#0366d6) - API endpoints, contracts, and integration
- `Component/Database` - Database schemas, migrations, queries - `Component/Database` (#006b75) - Database schemas, migrations, queries
- `Component/Auth` - Authentication and authorization - `Component/Auth` (#e99695) - Authentication and authorization
- `Component/Deploy` - Deployment, infrastructure, DevOps - `Component/Deploy` (#bfd4f2) - Deployment, infrastructure, DevOps
- `Component/Testing` - Test infrastructure and frameworks - `Component/Testing` (#f9d0c4) - Test infrastructure and frameworks
- `Component/Docs` - Documentation and guides - `Component/Docs` (#c5def5) - Documentation and guides
- `Component/Infra` - Infrastructure and system configuration - `Component/Infra` (#d4c5f9) - Infrastructure and system configuration
### Tech (7) ### Tech (7)
- `Tech/Python` - Python language and libraries - `Tech/Python` (#3572a5) - Python language and libraries
- `Tech/JavaScript` - JavaScript/Node.js code - `Tech/JavaScript` (#f1e05a) - JavaScript/Node.js code
- `Tech/Docker` - Docker containers and compose - `Tech/Docker` (#384d54) - Docker containers and compose
- `Tech/PostgreSQL` - PostgreSQL database - `Tech/PostgreSQL` (#336791) - PostgreSQL database
- `Tech/Redis` - Redis cache and pub/sub - `Tech/Redis` (#dc382d) - Redis cache and pub/sub
- `Tech/Vue` - Vue.js frontend framework - `Tech/Vue` (#42b883) - Vue.js frontend framework
- `Tech/FastAPI` - FastAPI backend framework - `Tech/FastAPI` (#009688) - FastAPI backend framework
## Label Suggestion Logic ## Label Suggestion Logic
@@ -242,7 +241,7 @@ The command updates this file with the latest taxonomy from Gitea.
## Keeping This Updated ## Keeping This Updated
**IMPORTANT:** This file is a template. Run `/labels-sync` to: **IMPORTANT:** Run `/labels-sync` to:
1. Fetch actual labels from Gitea 1. Fetch actual labels from Gitea
2. Update this reference file 2. Update this reference file
3. Ensure suggestion logic matches current taxonomy 3. Ensure suggestion logic matches current taxonomy