feat: add markdown-validator agent and scoped-labels skill

- Add markdown-validator agent for validating Gitea issue descriptions
- Add scoped-labels skill for managing exclusive labels (status::, priority::, type::)
- Add init-scoped-labels.sh script to create standard label sets
- Add GiteaClient methods: createLabel, updateLabel, setScopedLabel, setScopedStatus, setScopedPriority
- Support exclusive labels (scoped labels) in Gitea API 1.21+

Created scoped labels:
- status::new, status::planned, status::in-progress, status::review, status::testing, status::done, status::blocked, status::cancelled
- priority::critical, priority::high, priority::medium, priority::low
- type::bug, type::feature, type::enhancement, type::documentation, type::refactor, type::test, type::chore
- size::xs, size::s, size::m, size::l, size::xl

Scoped labels are mutually exclusive within their scope - applying status::in-progress automatically removes status::new
This commit is contained in:
swp
2026-04-04 01:42:12 +01:00
parent 2519079e6e
commit e58a5b6380
4 changed files with 669 additions and 3 deletions

148
scripts/init-scoped-labels.sh Executable file
View File

@@ -0,0 +1,148 @@
#!/bin/bash
# Initialize standard scoped labels for Gitea
# Usage: ./scripts/init-scoped-labels.sh
echo "=== Gitea Scoped Labels Initialization ==="
echo ""
# Check for token
if [ -z "$GITEA_TOKEN" ]; then
echo "❌ GITEA_TOKEN not set!"
echo ""
echo "Run: ./scripts/create-gitea-token.sh <username> <password>"
echo "Or: export GITEA_TOKEN=your_token"
exit 1
fi
API_URL="https://git.softuniq.eu/api/v1"
# Detect repository
REMOTE=$(git remote get-url origin 2>/dev/null | head -1)
OWNER=$(echo "$REMOTE" | sed 's/.*[:/]\([^/]*\)\/.*/\1/')
REPO=$(echo "$REMOTE" | sed 's/.*[:/][^/]*\/\([^/.]*\).*/\1/')
if [ -z "$OWNER" ] || [ -z "$REPO" ]; then
echo "❌ Could not detect repository"
echo "Set OWNER and REPO manually:"
echo " export OWNER=UniqueSoft"
echo " export REPO=APAW"
exit 1
fi
echo "📦 Repository: $OWNER/$REPO"
echo ""
# Function to create label
create_label() {
local NAME="$1"
local COLOR="$2"
local DESC="$3"
local EXCLUSIVE="$4"
# Check if label exists
EXISTING=$(curl -s -H "Authorization: token $GITEA_TOKEN" \
"$API_URL/repos/$OWNER/$REPO/labels?name=$NAME" | grep -o "\"name\":\"$NAME\"")
if [ -n "$EXISTING" ]; then
echo " ⏭️ $NAME (already exists)"
return
fi
# Create label
RESPONSE=$(curl -s -X POST \
-H "Authorization: token $GITEA_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"name\":\"$NAME\",\"color\":\"$COLOR\",\"description\":\"$DESC\",\"exclusive\":$EXCLUSIVE}" \
"$API_URL/repos/$OWNER/$REPO/labels")
if echo "$RESPONSE" | grep -q '"id"'; then
echo "$NAME"
else
echo "$NAME - $(echo $RESPONSE | grep -o '"message":"[^"]*"')"
fi
}
# Status labels
echo "🏷️ Creating status labels..."
create_label "status::new" "0052cc" "New issue, not started" true
create_label "status::planned" "1d76db" "Planned for sprint" true
create_label "status::in-progress" "fbca04" "Work in progress" true
create_label "status::review" "d93f0b" "Under review" true
create_label "status::testing" "d4c5f9" "In testing" true
create_label "status::done" "0e8a16" "Completed" true
create_label "status::blocked" "b60205" "Blocked" true
create_label "status::cancelled" "5319e7" "Cancelled" true
echo ""
# Priority labels
echo "🏷️ Creating priority labels..."
create_label "priority::critical" "b60205" "Critical priority" true
create_label "priority::high" "d93f0b" "High priority" true
create_label "priority::medium" "fbca04" "Medium priority" true
create_label "priority::low" "0e8a16" "Low priority" true
echo ""
# Type labels
echo "🏷️ Creating type labels..."
create_label "type::bug" "d73a4a" "Something is broken" true
create_label "type::feature" "0e8a16" "New feature" true
create_label "type::enhancement" "a2eeef" "Improvement" true
create_label "type::documentation" "0075ca" "Documentation" true
create_label "type::refactor" "7057ff" "Code refactoring" true
create_label "type::test" "d4c5f9" "Testing" true
create_label "type::chore" "cfd3d7" "Maintenance task" true
echo ""
# Size labels
echo "🏷️ Creating size labels..."
create_label "size::xs" "cfd3d7" "Extra small (<1 hour)" true
create_label "size::s" "c2e0c6" "Small (1-2 hours)" true
create_label "size::m" "fbca04" "Medium (2-4 hours)" true
create_label "size::l" "d93f0b" "Large (4-8 hours)" true
create_label "size::xl" "b60205" "Extra large (>8 hours)" true
echo ""
# Component labels (non-exclusive)
echo "🏷️ Creating component labels..."
create_label "component::api" "1d76db" "API related" false
create_label "component::ui" "bfdadc" "UI related" false
create_label "component::database" "c5def5" "Database related" false
create_label "component::auth" "d4c5f9" "Authentication related" false
create_label "component::pipeline" "7057ff" "Pipeline related" false
create_label "component::agent" "5319e7" "Agent related" false
echo ""
# Pipeline status labels (alternative status format)
echo "🏷️ Creating pipeline status labels..."
create_label "pipeline::new" "0052cc" "New pipeline task" true
create_label "pipeline::researching" "1d76db" "Research phase" true
create_label "pipeline::designed" "bfd4f2" "Design complete" true
create_label "pipeline::testing" "fbca04" "Tests in progress" true
create_label "pipeline::implementing" "d93f0b" "Implementation" true
create_label "pipeline::reviewing" "d4c5f9" "Code review" true
create_label "pipeline::fixing" "e99695" "Fixing issues" true
create_label "pipeline::releasing" "c2e0c6" "Release preparation" true
create_label "pipeline::evaluated" "fef2c0" "Evaluation complete" true
create_label "pipeline::completed" "0e8a16" "Pipeline complete" true
echo ""
echo "=========================================="
echo "✅ Scoped labels initialized!"
echo ""
echo "📋 Usage examples:"
echo ""
echo "Set status (exclusive - removes other status:: labels):"
echo " client.addLabels(issueNumber, ['status::in-progress', 'priority::high'])"
echo ""
echo "Set priority:"
echo " client.addLabels(issueNumber, ['priority::critical'])"
echo ""
echo "Set type and size:"
echo " client.addLabels(issueNumber, ['type::feature', 'size::m'])"
echo ""
echo "Add component (multiple allowed):"
echo " client.addLabels(issueNumber, ['component::api', 'component::auth'])"
echo ""
echo "🔗 View all labels:"
echo " https://git.softuniq.eu/$OWNER/$REPO/labels"
echo ""