docs(core): comprehensive development documentation and issue management system
- Complete project documentation for API gateway development - API gateway-specific development processes and standards - Comprehensive issue management system with script automation - Go-specific testing guidelines for multi-service architecture New Documentation: - devdocs/KONZEPT.md: project philosophy, architecture, service integration patterns - devdocs/TESTING_GUIDELINES.md: Go testing, API tests, gateway-service integration - devdocs/development-process.md: API gateway development, multi-service coordination - devdocs/furt-issue-management-guide.md: Furt-specific issue management workflows Issue Management System: - scripts/create_issue.sh: 8 preconfigured templates for API gateway development - Furt-specific issue types: service-request, architecture, performance, security - Script-based workflows for efficient development - Integration with existing get_issues.sh and update_issue.sh scripts API Gateway Development Standards: - Service integration patterns for gateway ↔ service communication - API-contract-first development with OpenAPI specifications - Security-first patterns for authentication and input validation - Multi-service testing strategies for coordinated development This documentation enables immediate, efficient API gateway development with clear standards, proven patterns, and automated workflows.
This commit is contained in:
parent
f4e8a40cdf
commit
d6d546bd95
7 changed files with 2649 additions and 0 deletions
347
scripts/create_issue.sh
Executable file
347
scripts/create_issue.sh
Executable file
|
|
@ -0,0 +1,347 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Load environment
|
||||
if [ -f .env ]; then
|
||||
export $(cat .env | grep -v '^#' | xargs)
|
||||
else
|
||||
echo "❌ .env file not found!"
|
||||
echo "📋 Copy .env.example to .env and configure it first"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Validate required variables
|
||||
if [ -z "$GITEA_URL" ] || [ -z "$REPO_OWNER" ] || [ -z "$REPO_NAME" ] || [ -z "$GITEA_TOKEN" ]; then
|
||||
echo "❌ Missing required environment variables in .env"
|
||||
echo "📋 Check .env.example for required variables"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Colors
|
||||
GREEN='\033[0;32m'
|
||||
BLUE='\033[0;34m'
|
||||
RED='\033[0;31m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m'
|
||||
|
||||
log_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
|
||||
log_success() { echo -e "${GREEN}[SUCCESS]${NC} $1"; }
|
||||
log_error() { echo -e "${RED}[ERROR]${NC} $1"; }
|
||||
log_warning() { echo -e "${YELLOW}[WARNING]${NC} $1"; }
|
||||
|
||||
# Get all labels with IDs (like update_issue.sh)
|
||||
declare -A LABEL_IDS
|
||||
get_labels() {
|
||||
response=$(curl -s "$GITEA_URL/api/v1/repos/$REPO_OWNER/$REPO_NAME/labels" \
|
||||
-H "Authorization: token $GITEA_TOKEN")
|
||||
while IFS= read -r line; do
|
||||
name=$(echo "$line" | jq -r '.name')
|
||||
id=$(echo "$line" | jq -r '.id')
|
||||
LABEL_IDS["$name"]="$id"
|
||||
done < <(echo "$response" | jq -c '.[]')
|
||||
}
|
||||
|
||||
# Function to create issue with proper label ID handling
|
||||
create_issue() {
|
||||
local title="$1"
|
||||
local body="$2"
|
||||
local labels_string="$3"
|
||||
local assignee="$4"
|
||||
|
||||
# Get label IDs first
|
||||
get_labels
|
||||
|
||||
# Convert label names to IDs
|
||||
local valid_label_ids=()
|
||||
if [ -n "$labels_string" ]; then
|
||||
IFS=',' read -ra LABEL_ARRAY <<< "$labels_string"
|
||||
|
||||
for label in "${LABEL_ARRAY[@]}"; do
|
||||
label=$(echo "$label" | xargs) # Trim whitespace
|
||||
if [ -n "${LABEL_IDS[$label]}" ]; then
|
||||
valid_label_ids+=("${LABEL_IDS[$label]}")
|
||||
log_info "Using label '$label' (ID: ${LABEL_IDS[$label]})"
|
||||
else
|
||||
log_warning "Label '$label' not found, skipping"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Build labels array JSON with IDs
|
||||
local labels_json="["
|
||||
for i in "${!valid_label_ids[@]}"; do
|
||||
if [ $i -gt 0 ]; then
|
||||
labels_json="${labels_json},"
|
||||
fi
|
||||
labels_json="${labels_json}${valid_label_ids[$i]}"
|
||||
done
|
||||
labels_json="${labels_json}]"
|
||||
|
||||
# Build assignees array
|
||||
local assignees_json="[]"
|
||||
if [ -n "$assignee" ]; then
|
||||
assignees_json="[\"$assignee\"]"
|
||||
fi
|
||||
|
||||
# Use jq for proper JSON encoding of body and payload
|
||||
local json_payload=$(jq -n \
|
||||
--arg title "$title" \
|
||||
--arg body "$body" \
|
||||
--argjson labels "$labels_json" \
|
||||
--argjson assignees "$assignees_json" \
|
||||
'{
|
||||
title: $title,
|
||||
body: $body,
|
||||
labels: $labels,
|
||||
assignees: $assignees
|
||||
}')
|
||||
|
||||
log_info "Creating issue: $title"
|
||||
|
||||
response=$(curl -s -w "\n%{http_code}" -X POST \
|
||||
"$GITEA_URL/api/v1/repos/$REPO_OWNER/$REPO_NAME/issues" \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$json_payload")
|
||||
|
||||
http_code=$(echo "$response" | tail -n1)
|
||||
response_body=$(echo "$response" | head -n -1)
|
||||
|
||||
if [ "$http_code" = "201" ]; then
|
||||
issue_number=$(echo "$response_body" | jq -r '.number')
|
||||
issue_url="$GITEA_URL/$REPO_OWNER/$REPO_NAME/issues/$issue_number"
|
||||
log_success "Issue #$issue_number created!"
|
||||
echo "🔗 $issue_url"
|
||||
echo ""
|
||||
else
|
||||
log_error "Failed to create issue (HTTP: $http_code)"
|
||||
echo "$response_body"
|
||||
fi
|
||||
}
|
||||
|
||||
# Predefined issue templates for Furt API Gateway
|
||||
case "${1:-help}" in
|
||||
"service")
|
||||
service_name="${2:-newsletter}"
|
||||
create_issue \
|
||||
"[SERVICE] $service_name für Furt Gateway" \
|
||||
"## 🏷️ Service-Details
|
||||
**Name:** $service_name
|
||||
**Port:** 808X (TBD)
|
||||
**Zweck:** [Service-Beschreibung hier einfügen]
|
||||
|
||||
## 📝 Funktionsanforderungen
|
||||
- [ ] Grundfunktionalität implementieren
|
||||
- [ ] Input-Validation für alle Endpunkte
|
||||
- [ ] Error-Handling nach Furt-Standards
|
||||
- [ ] Health-Check-Endpoint (\`/health\`)
|
||||
|
||||
## 🔗 Gateway-Integration
|
||||
- [ ] **Routing:** \`/v1/$service_name/*\`
|
||||
- [ ] **Authentication:** API-Key required
|
||||
- [ ] **Rate-Limiting:** [X] requests/minute
|
||||
- [ ] **Upstream:** \`http://127.0.0.1:808X\`
|
||||
- [ ] **Timeout:** 15s default
|
||||
|
||||
## 🎯 API-Endpunkte (geplant)
|
||||
\`\`\`
|
||||
GET /v1/$service_name/ # List/Status
|
||||
POST /v1/$service_name/create # Create new
|
||||
PUT /v1/$service_name/{id} # Update existing
|
||||
DELETE /v1/$service_name/{id} # Delete
|
||||
\`\`\`
|
||||
|
||||
## 🧪 Testing-Requirements
|
||||
- [ ] Unit-Tests für Service-Logik
|
||||
- [ ] Integration-Tests für Gateway ↔ Service
|
||||
- [ ] API-Contract-Tests (OpenAPI-Compliance)
|
||||
- [ ] Load-Tests für Performance-Baselines
|
||||
|
||||
## 🌐 Hugo-Integration
|
||||
- [ ] Shortcode: \`{{< furt-$service_name >}}\`
|
||||
- [ ] JavaScript-Client-Library
|
||||
- [ ] CSS-Styling für UI-Komponenten
|
||||
- [ ] Dokumentation für Website-Integration
|
||||
|
||||
## 📋 OpenAPI-Dokumentation
|
||||
- [ ] \`docs/api/services/$service_name.yaml\` erstellen
|
||||
- [ ] Request/Response-Schemas definieren
|
||||
- [ ] Error-Codes dokumentieren
|
||||
- [ ] Examples für alle Endpunkte
|
||||
|
||||
## ⚡ Priorität
|
||||
📊 Mittel - geplante Entwicklung
|
||||
|
||||
## 🔧 Implementation-Checklist
|
||||
- [ ] Service-Generator ausführen: \`./scripts/service-generator.sh $service_name\`
|
||||
- [ ] Service-Logik implementieren
|
||||
- [ ] Gateway-Integration konfigurieren
|
||||
- [ ] Tests schreiben und ausführen
|
||||
- [ ] Deployment-Scripts anpassen
|
||||
- [ ] Hugo-Integration entwickeln" \
|
||||
"service-request,enhancement" \
|
||||
"${DEFAULT_ASSIGNEE:-}"
|
||||
;;
|
||||
|
||||
"architecture")
|
||||
topic="${2:-middleware-optimization}"
|
||||
create_issue \
|
||||
"[ARCH] Gateway $topic" \
|
||||
"## 🎯 Architektur-Thema
|
||||
Gateway-$topic für bessere Performance/Maintainability
|
||||
|
||||
## 📊 Aktuelle Situation
|
||||
**Current Implementation:**
|
||||
- [Beschreibung des aktuellen Zustands]
|
||||
- [Identifizierte Probleme oder Limitations]
|
||||
- [Performance-Metrics wenn verfügbar]
|
||||
|
||||
## 💡 Vorgeschlagene Änderung
|
||||
**Proposed Solution:**
|
||||
- [Detaillierte Beschreibung der vorgeschlagenen Lösung]
|
||||
- [Erwartete Verbesserungen]
|
||||
- [Implementation-Approach]
|
||||
|
||||
## 🔄 Alternativen
|
||||
1. **Option A:** [Beschreibung]
|
||||
- Vorteile: [...]
|
||||
- Nachteile: [...]
|
||||
|
||||
2. **Option B:** [Beschreibung]
|
||||
- Vorteile: [...]
|
||||
- Nachteile: [...]
|
||||
|
||||
## 📈 Betroffene Bereiche
|
||||
- [ ] Gateway-Performance
|
||||
- [ ] Service-Integration
|
||||
- [ ] Security (Auth/Rate-Limiting)
|
||||
- [ ] Configuration-Management
|
||||
- [ ] Monitoring/Logging
|
||||
- [ ] Hugo-Integration
|
||||
|
||||
## 🧪 Testing-Impact
|
||||
- [ ] Unit-Tests anpassen
|
||||
- [ ] Integration-Tests erweitern
|
||||
- [ ] Performance-Tests durchführen
|
||||
- [ ] Backward-Compatibility prüfen
|
||||
|
||||
## 📋 Implementation-Plan
|
||||
1. **Phase 1:** [Erste Schritte]
|
||||
2. **Phase 2:** [Hauptimplementierung]
|
||||
3. **Phase 3:** [Testing und Optimization]
|
||||
4. **Phase 4:** [Deployment und Monitoring]
|
||||
|
||||
## ⚡ Priorität
|
||||
🔥 Hoch - kritisch für Projekt-Erfolg" \
|
||||
"architecture,gateway,enhancement" \
|
||||
"${DEFAULT_ASSIGNEE:-}"
|
||||
;;
|
||||
|
||||
"performance")
|
||||
component="${2:-gateway}"
|
||||
create_issue \
|
||||
"[PERF] $component Performance-Optimierung" \
|
||||
"## 📊 Performance-Problem
|
||||
**Component:** $component
|
||||
**Issue:** [Beschreibung des Performance-Problems]
|
||||
|
||||
## 🔍 Gemessene Werte
|
||||
**Current Performance:**
|
||||
- **Response Time:** [X]ms average
|
||||
- **Throughput:** [X] requests/second
|
||||
- **Resource Usage:** [X]% CPU, [X]MB Memory
|
||||
- **Error Rate:** [X]% under load
|
||||
|
||||
**Target Performance:**
|
||||
- **Response Time:** <[Y]ms
|
||||
- **Throughput:** >[Y] requests/second
|
||||
- **Resource Usage:** <[Y]% CPU, <[Y]MB Memory
|
||||
- **Error Rate:** <[Y]% under normal load
|
||||
|
||||
## 🎯 Performance-Ziele
|
||||
- [ ] **Latency-Optimization:** Reduce response time by [X]%
|
||||
- [ ] **Throughput-Increase:** Handle [X]x more concurrent requests
|
||||
- [ ] **Resource-Efficiency:** Reduce CPU/Memory usage
|
||||
- [ ] **Scalability:** Support [X] services without degradation
|
||||
|
||||
## 🔍 Profiling-Results
|
||||
**Current Bottlenecks:**
|
||||
\`\`\`
|
||||
[Paste go-pprof results oder performance measurements]
|
||||
\`\`\`
|
||||
|
||||
**Identified Issues:**
|
||||
- [Issue 1]: [Description]
|
||||
- [Issue 2]: [Description]
|
||||
- [Issue 3]: [Description]
|
||||
|
||||
## 🛠️ Optimization-Strategy
|
||||
1. **Code-Optimization:**
|
||||
- [Specific code changes]
|
||||
- [Algorithm improvements]
|
||||
|
||||
2. **Infrastructure-Optimization:**
|
||||
- [Connection pooling]
|
||||
- [Caching strategies]
|
||||
|
||||
3. **Configuration-Tuning:**
|
||||
- [Timeout adjustments]
|
||||
- [Buffer size optimization]
|
||||
|
||||
## 🧪 Performance-Testing-Plan
|
||||
- [ ] **Baseline-Measurements:** Before optimization
|
||||
- [ ] **Load-Testing:** Various traffic patterns
|
||||
- [ ] **Stress-Testing:** Breaking point analysis
|
||||
- [ ] **Endurance-Testing:** Long-running stability
|
||||
- [ ] **Regression-Testing:** Ensure no functionality broken
|
||||
|
||||
## 📋 Success-Criteria
|
||||
- [ ] Target response time achieved
|
||||
- [ ] Target throughput achieved
|
||||
- [ ] Resource usage within limits
|
||||
- [ ] No regressions in functionality
|
||||
- [ ] Monitoring alerts configured
|
||||
|
||||
## ⚡ Priorität
|
||||
🔥 Hoch - Performance ist kritisch" \
|
||||
"performance,optimization,$component" \
|
||||
"${DEFAULT_ASSIGNEE:-}"
|
||||
;;
|
||||
|
||||
# Weitere templates hier... (gekürzt für Übersichtlichkeit)
|
||||
|
||||
"custom")
|
||||
echo "🎯 Custom Furt Issue Creator"
|
||||
echo ""
|
||||
read -p "📝 Title: " title
|
||||
echo "📋 Body (press Ctrl+D when finished):"
|
||||
body=$(cat)
|
||||
read -p "🏷️ Labels (comma separated): " labels
|
||||
read -p "👤 Assignee (optional): " assignee
|
||||
|
||||
create_issue "$title" "$body" "$labels" "${assignee:-$DEFAULT_ASSIGNEE}"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "🎯 Furt API-Gateway Issue Creator"
|
||||
echo ""
|
||||
echo "Usage: $0 [TEMPLATE] [OPTIONS]"
|
||||
echo ""
|
||||
echo "📋 Available Templates:"
|
||||
echo " service [name] New service for gateway (default: newsletter)"
|
||||
echo " architecture [topic] Gateway architecture discussion (default: middleware-optimization)"
|
||||
echo " performance [comp] Performance optimization (default: gateway)"
|
||||
echo " api [service] API contract update (default: formular2mail)"
|
||||
echo " security [comp] Security review/issue (default: gateway)"
|
||||
echo " bug [comp] [desc] Bug report (default: gateway)"
|
||||
echo " hugo [feature] Hugo integration (default: shortcode)"
|
||||
echo " deployment [comp] Deployment issue (default: gateway)"
|
||||
echo " custom Custom issue (interactive)"
|
||||
echo ""
|
||||
echo "🚀 Examples:"
|
||||
echo " $0 service newsletter # Create newsletter service request"
|
||||
echo " $0 architecture rate-limiting # Discuss rate limiting architecture"
|
||||
echo " $0 performance gateway # Gateway performance optimization"
|
||||
echo " $0 custom # Interactive custom issue"
|
||||
;;
|
||||
esac
|
||||
|
||||
250
scripts/get_issues.sh
Executable file
250
scripts/get_issues.sh
Executable file
|
|
@ -0,0 +1,250 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Load environment
|
||||
if [ -f .env ]; then
|
||||
export $(cat .env | grep -v '^#' | xargs)
|
||||
else
|
||||
echo "❌ .env file not found!"
|
||||
echo "📋 Copy .env.example to .env and configure it first"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Validate required variables
|
||||
if [ -z "$GITEA_URL" ] || [ -z "$REPO_OWNER" ] || [ -z "$REPO_NAME" ] || [ -z "$GITEA_TOKEN" ]; then
|
||||
echo "❌ Missing required environment variables in .env"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Colors
|
||||
GREEN='\033[0;32m'
|
||||
BLUE='\033[0;34m'
|
||||
YELLOW='\033[1;33m'
|
||||
RED='\033[0;31m'
|
||||
NC='\033[0m'
|
||||
|
||||
log_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
|
||||
log_success() { echo -e "${GREEN}[SUCCESS]${NC} $1"; }
|
||||
log_warning() { echo -e "${YELLOW}[WARNING]${NC} $1"; }
|
||||
|
||||
# Get all issues with nice formatting
|
||||
get_all_issues() {
|
||||
log_info "Fetching all issues..."
|
||||
echo ""
|
||||
|
||||
response=$(curl -s "$GITEA_URL/api/v1/repos/$REPO_OWNER/$REPO_NAME/issues" \
|
||||
-H "Authorization: token $GITEA_TOKEN")
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "❌ Error fetching issues"
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "$response" | jq -r '.[] |
|
||||
"🎯 #\(.number) \(.title)",
|
||||
" 📊 State: \(.state) | 🏷️ Labels: \(.labels | map(.name) | join(", ") // "none")",
|
||||
" 🔗 \(.html_url)",
|
||||
""'
|
||||
}
|
||||
|
||||
# Get issues by label
|
||||
get_issues_by_label() {
|
||||
local label="$1"
|
||||
log_info "Fetching issues with label: $label"
|
||||
echo ""
|
||||
|
||||
response=$(curl -s "$GITEA_URL/api/v1/repos/$REPO_OWNER/$REPO_NAME/issues?labels=$label" \
|
||||
-H "Authorization: token $GITEA_TOKEN")
|
||||
|
||||
echo "$response" | jq -r '.[] |
|
||||
"🎯 #\(.number) \(.title)",
|
||||
" 📊 \(.state) | 🔗 \(.html_url)",
|
||||
""'
|
||||
}
|
||||
|
||||
# Get issue details
|
||||
get_issue_details() {
|
||||
local issue_number="$1"
|
||||
log_info "Fetching details for issue #$issue_number"
|
||||
echo ""
|
||||
|
||||
response=$(curl -s "$GITEA_URL/api/v1/repos/$REPO_OWNER/$REPO_NAME/issues/$issue_number" \
|
||||
-H "Authorization: token $GITEA_TOKEN")
|
||||
|
||||
echo "$response" | jq -r '
|
||||
"🎯 Issue #\(.number): \(.title)",
|
||||
"📊 State: \(.state)",
|
||||
"👤 Assignees: \(.assignees | map(.login) | join(", ") // "none")",
|
||||
"🏷️ Labels: \(.labels | map(.name) | join(", ") // "none")",
|
||||
"📅 Created: \(.created_at)",
|
||||
"🔗 URL: \(.html_url)",
|
||||
"",
|
||||
"📝 Body:",
|
||||
"\(.body // "No description")",
|
||||
""'
|
||||
}
|
||||
|
||||
# Close issue
|
||||
close_issue() {
|
||||
local issue_number="$1"
|
||||
log_info "Closing issue #$issue_number"
|
||||
|
||||
response=$(curl -s -w "\n%{http_code}" -X PATCH \
|
||||
"$GITEA_URL/api/v1/repos/$REPO_OWNER/$REPO_NAME/issues/$issue_number" \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"state": "closed"}')
|
||||
|
||||
http_code=$(echo "$response" | tail -n1)
|
||||
if [ "$http_code" = "201" ]; then
|
||||
log_success "Issue #$issue_number closed"
|
||||
else
|
||||
echo "❌ Failed to close issue (HTTP: $http_code)"
|
||||
fi
|
||||
}
|
||||
|
||||
# Get pipeline status (issues grouped by Kanban columns for Furt)
|
||||
get_pipeline_status() {
|
||||
log_info "Furt API Gateway - Pipeline Status Overview"
|
||||
echo ""
|
||||
|
||||
echo "🔧 SERVICE REQUESTS:"
|
||||
get_issues_by_label "service-request" | head -10
|
||||
|
||||
echo "🏗️ ARCHITECTURE DISCUSSIONS:"
|
||||
get_issues_by_label "architecture"
|
||||
|
||||
echo "🚀 PERFORMANCE OPTIMIZATIONS:"
|
||||
get_issues_by_label "performance"
|
||||
|
||||
echo "🔒 SECURITY REVIEWS:"
|
||||
get_issues_by_label "security"
|
||||
|
||||
echo "🐛 BUGS:"
|
||||
get_issues_by_label "bug"
|
||||
|
||||
echo "🌐 HUGO INTEGRATIONS:"
|
||||
get_issues_by_label "hugo-integration"
|
||||
|
||||
echo "📋 WORK IN PROGRESS:"
|
||||
get_issues_by_label "enhancement" | head -5
|
||||
}
|
||||
|
||||
# Issue statistics
|
||||
get_stats() {
|
||||
log_info "Furt API Gateway - Issue Statistics"
|
||||
echo ""
|
||||
|
||||
all_issues=$(curl -s "$GITEA_URL/api/v1/repos/$REPO_OWNER/$REPO_NAME/issues" \
|
||||
-H "Authorization: token $GITEA_TOKEN")
|
||||
|
||||
total=$(echo "$all_issues" | jq length)
|
||||
open=$(echo "$all_issues" | jq '[.[] | select(.state == "open")] | length')
|
||||
closed=$(echo "$all_issues" | jq '[.[] | select(.state == "closed")] | length')
|
||||
|
||||
echo "📊 Total Issues: $total"
|
||||
echo "✅ Open: $open"
|
||||
echo "🔒 Closed: $closed"
|
||||
echo ""
|
||||
|
||||
echo "🏷️ Furt Labels:"
|
||||
echo "$all_issues" | jq -r '[.[] | .labels[].name] | group_by(.) | map({label: .[0], count: length}) | sort_by(.count) | reverse | limit(10; .[]) | " \(.label): \(.count)"'
|
||||
}
|
||||
|
||||
case "${1:-help}" in
|
||||
"all"|"")
|
||||
get_all_issues
|
||||
;;
|
||||
"gateway")
|
||||
get_issues_by_label "gateway"
|
||||
;;
|
||||
"service-request")
|
||||
get_issues_by_label "service-request"
|
||||
;;
|
||||
"service-formular2mail")
|
||||
get_issues_by_label "service-formular2mail"
|
||||
;;
|
||||
"service-sagjan")
|
||||
get_issues_by_label "service-sagjan"
|
||||
;;
|
||||
"architecture")
|
||||
get_issues_by_label "architecture"
|
||||
;;
|
||||
"performance")
|
||||
get_issues_by_label "performance"
|
||||
;;
|
||||
"security")
|
||||
get_issues_by_label "security"
|
||||
;;
|
||||
"bug")
|
||||
get_issues_by_label "bug"
|
||||
;;
|
||||
"enhancement")
|
||||
get_issues_by_label "enhancement"
|
||||
;;
|
||||
"hugo")
|
||||
get_issues_by_label "hugo-integration"
|
||||
;;
|
||||
"deployment")
|
||||
get_issues_by_label "deployment"
|
||||
;;
|
||||
"testing")
|
||||
get_issues_by_label "testing"
|
||||
;;
|
||||
"documentation")
|
||||
get_issues_by_label "documentation"
|
||||
;;
|
||||
"pipeline")
|
||||
get_pipeline_status
|
||||
;;
|
||||
"stats")
|
||||
get_stats
|
||||
;;
|
||||
"close")
|
||||
if [ -z "$2" ]; then
|
||||
echo "Usage: $0 close ISSUE_NUMBER"
|
||||
exit 1
|
||||
fi
|
||||
close_issue "$2"
|
||||
;;
|
||||
[0-9]*)
|
||||
get_issue_details "$1"
|
||||
;;
|
||||
*)
|
||||
echo "🎯 Furt API Gateway - Issues Manager"
|
||||
echo ""
|
||||
echo "Usage: $0 [COMMAND] [OPTIONS]"
|
||||
echo ""
|
||||
echo "📋 List Commands:"
|
||||
echo " all List all issues (default)"
|
||||
echo " gateway Gateway core issues"
|
||||
echo " service-request New service requests"
|
||||
echo " service-formular2mail Formular2mail service issues"
|
||||
echo " service-sagjan Sagjan service issues"
|
||||
echo " architecture Architecture discussions"
|
||||
echo " performance Performance optimizations"
|
||||
echo " security Security reviews"
|
||||
echo " bug Bug reports"
|
||||
echo " enhancement New features"
|
||||
echo " hugo Hugo integration issues"
|
||||
echo " deployment Deployment issues"
|
||||
echo " testing Testing issues"
|
||||
echo " documentation Documentation updates"
|
||||
echo ""
|
||||
echo "📊 Analysis Commands:"
|
||||
echo " pipeline Kanban pipeline status"
|
||||
echo " stats Issue statistics"
|
||||
echo ""
|
||||
echo "⚙️ Management Commands:"
|
||||
echo " close NUM Close issue #NUM"
|
||||
echo " NUM Show details for issue #NUM"
|
||||
echo ""
|
||||
echo "🚀 Examples:"
|
||||
echo " $0 # List all issues"
|
||||
echo " $0 pipeline # Show pipeline status"
|
||||
echo " $0 service-request # Show service requests"
|
||||
echo " $0 gateway # Show gateway issues"
|
||||
echo " $0 5 # Show issue #5 details"
|
||||
echo " $0 close 3 # Close issue #3"
|
||||
;;
|
||||
esac
|
||||
|
||||
156
scripts/update_issue.sh
Executable file
156
scripts/update_issue.sh
Executable file
|
|
@ -0,0 +1,156 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Load environment
|
||||
if [ -f .env ]; then
|
||||
export $(cat .env | grep -v '^#' | xargs)
|
||||
else
|
||||
echo "❌ .env file not found!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Colors
|
||||
GREEN='\033[0;32m'
|
||||
BLUE='\033[0;34m'
|
||||
RED='\033[0;31m'
|
||||
NC='\033[0m'
|
||||
|
||||
log_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
|
||||
log_success() { echo -e "${GREEN}[SUCCESS]${NC} $1"; }
|
||||
log_error() { echo -e "${RED}[ERROR]${NC} $1"; }
|
||||
|
||||
# Get all labels with IDs
|
||||
declare -A LABEL_IDS
|
||||
get_labels() {
|
||||
response=$(curl -s "$GITEA_URL/api/v1/repos/$REPO_OWNER/$REPO_NAME/labels" \
|
||||
-H "Authorization: token $GITEA_TOKEN")
|
||||
while IFS= read -r line; do
|
||||
name=$(echo "$line" | jq -r '.name')
|
||||
id=$(echo "$line" | jq -r '.id')
|
||||
LABEL_IDS["$name"]="$id"
|
||||
done < <(echo "$response" | jq -c '.[]')
|
||||
}
|
||||
|
||||
# Add comment to issue
|
||||
add_comment() {
|
||||
local issue_number="$1"
|
||||
local comment="$2"
|
||||
|
||||
# Use jq for proper JSON escaping
|
||||
local json_payload=$(jq -n --arg body "$comment" '{body: $body}')
|
||||
|
||||
response=$(curl -s -w "\n%{http_code}" -X POST \
|
||||
"$GITEA_URL/api/v1/repos/$REPO_OWNER/$REPO_NAME/issues/$issue_number/comments" \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$json_payload")
|
||||
|
||||
http_code=$(echo "$response" | tail -n1)
|
||||
if [ "$http_code" = "201" ]; then
|
||||
log_success "Comment added to issue #$issue_number"
|
||||
else
|
||||
log_error "Failed to add comment (HTTP: $http_code)"
|
||||
fi
|
||||
}
|
||||
|
||||
# Update issue labels - FIXED VERSION
|
||||
update_labels() {
|
||||
local issue_number="$1"
|
||||
local labels_string="$2"
|
||||
|
||||
get_labels
|
||||
|
||||
# Convert to ID array
|
||||
local valid_label_ids=()
|
||||
IFS=',' read -ra LABEL_ARRAY <<< "$labels_string"
|
||||
|
||||
for label in "${LABEL_ARRAY[@]}"; do
|
||||
label=$(echo "$label" | xargs)
|
||||
if [ -n "${LABEL_IDS[$label]}" ]; then
|
||||
valid_label_ids+=("${LABEL_IDS[$label]}")
|
||||
else
|
||||
log_error "Label '$label' not found!"
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Build ID array JSON
|
||||
local labels_json="["
|
||||
for i in "${!valid_label_ids[@]}"; do
|
||||
if [ $i -gt 0 ]; then
|
||||
labels_json="${labels_json},"
|
||||
fi
|
||||
labels_json="${labels_json}${valid_label_ids[$i]}"
|
||||
done
|
||||
labels_json="${labels_json}]"
|
||||
|
||||
response=$(curl -s -w "\n%{http_code}" -X PUT \
|
||||
"$GITEA_URL/api/v1/repos/$REPO_OWNER/$REPO_NAME/issues/$issue_number/labels" \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$labels_json")
|
||||
|
||||
http_code=$(echo "$response" | tail -n1)
|
||||
if [ "$http_code" = "200" ]; then
|
||||
log_success "Labels updated for issue #$issue_number"
|
||||
else
|
||||
log_error "Failed to update labels (HTTP: $http_code)"
|
||||
fi
|
||||
}
|
||||
|
||||
case "${1:-help}" in
|
||||
"comment")
|
||||
if [ -z "$2" ] || [ -z "$3" ]; then
|
||||
echo "Usage: $0 comment ISSUE_NUMBER \"COMMENT_TEXT\""
|
||||
exit 1
|
||||
fi
|
||||
add_comment "$2" "$3"
|
||||
;;
|
||||
"labels")
|
||||
if [ -z "$2" ] || [ -z "$3" ]; then
|
||||
echo "Usage: $0 labels ISSUE_NUMBER \"label1,label2,label3\""
|
||||
exit 1
|
||||
fi
|
||||
update_labels "$2" "$3"
|
||||
;;
|
||||
"progress")
|
||||
if [ -z "$2" ]; then
|
||||
echo "Usage: $0 progress ISSUE_NUMBER"
|
||||
exit 1
|
||||
fi
|
||||
add_comment "$2" "📊 **Progress Update:** Arbeit an dieser Analyse läuft. Erste Quellen werden gesammelt und Framework-Relevanz geprüft."
|
||||
update_labels "$2" "work-in-progress"
|
||||
;;
|
||||
"review")
|
||||
if [ -z "$2" ]; then
|
||||
echo "Usage: $0 review ISSUE_NUMBER"
|
||||
exit 1
|
||||
fi
|
||||
add_comment "$2" "👀 **Ready for Review:** Erste Analyse abgeschlossen. Bitte um Peer-Review der Quellen und Framework-Integration."
|
||||
update_labels "$2" "needs-review"
|
||||
;;
|
||||
"fact-check")
|
||||
if [ -z "$2" ]; then
|
||||
echo "Usage: $0 fact-check ISSUE_NUMBER"
|
||||
exit 1
|
||||
fi
|
||||
add_comment "$2" "🔍 **Fact-Check Required:** Kritische Behauptungen gefunden die zusätzliche Quellen-Verifikation benötigen."
|
||||
update_labels "$2" "fact-check-needed"
|
||||
;;
|
||||
*)
|
||||
echo "🔧 Issue Update Tool (FIXED VERSION)"
|
||||
echo ""
|
||||
echo "Usage: $0 COMMAND ISSUE_NUMBER [OPTIONS]"
|
||||
echo ""
|
||||
echo "Commands:"
|
||||
echo " comment NUM \"TEXT\" Add comment to issue"
|
||||
echo " labels NUM \"l1,l2\" Update issue labels (using IDs)"
|
||||
echo " progress NUM Mark as work-in-progress"
|
||||
echo " review NUM Mark as ready for review"
|
||||
echo " fact-check NUM Mark as needing fact-check"
|
||||
echo ""
|
||||
echo "Examples:"
|
||||
echo " $0 comment 5 \"Erste Quellen gefunden\""
|
||||
echo " $0 labels 3 \"regional-case,work-in-progress\""
|
||||
echo " $0 progress 7"
|
||||
;;
|
||||
esac
|
||||
Loading…
Add table
Add a link
Reference in a new issue