diff --git a/.vibe/skills/gitea-client/REFERENCE.md b/.vibe/skills/gitea-client/REFERENCE.md index 92598ed..5ea1e5d 100644 --- a/.vibe/skills/gitea-client/REFERENCE.md +++ b/.vibe/skills/gitea-client/REFERENCE.md @@ -12,6 +12,9 @@ The Gitea-Client skill provides comprehensive API access to Gitea repositories, **Commands:** ```bash +# List available workflows +gitea-client list-workflows + # List recent workflow jobs gitea-client list-jobs [limit] @@ -26,23 +29,68 @@ gitea-client list-workflow-jobs # Wait for job completion gitea-client wait-job [timeout] + +# Monitor workflow run until completion (with automatic updates) +gitea-client monitor-workflow [interval_seconds] + +# Diagnose failed job with automatic error analysis +gitea-client diagnose-job + +# Get summary of recent workflow runs +gitea-client recent-workflows [limit] [status_filter] ``` **Example Workflow:** ```bash -# 1. Find recent failed jobs -gitea-client list-jobs arcodange dance-lessons-coach 5 10 +# 1. Get summary of recent workflows +gitea-client recent-workflows arcodange dance-lessons-coach 5 -# 2. Check status of specific job +# 2. Monitor a specific workflow run until completion +gitea-client monitor-workflow arcodange dance-lessons-coach 415 30 + +# 3. Diagnose a failed job automatically +gitea-client diagnose-job arcodange dance-lessons-coach 759 + +# 4. List available workflows to get workflow IDs +gitea-client list-workflows arcodange dance-lessons-coach + +# 5. Check status of specific job gitea-client job-status arcodange dance-lessons-coach 706 -# 3. Fetch logs for debugging +# 6. Fetch logs for debugging gitea-client job-logs arcodange dance-lessons-coach 706 job_706_logs.txt -# 4. Analyze logs +# 7. Analyze logs manually grep -i "error\|fail" job_706_logs.txt ``` +**Advanced Monitoring Example:** +```bash +# Monitor workflow and automatically diagnose if it fails +WORKFLOW_ID=415 +TIMEOUT=300 +SECONDS_ELAPSED=0 + +while [ $SECONDS_ELAPSED -lt $TIMEOUT ]; do + STATUS=$(gitea-client job-status arcodange dance-lessons-coach $WORKFLOW_ID | jq -r '.status') + CONCLUSION=$(gitea-client job-status arcodange dance-lessons-coach $WORKFLOW_ID | jq -r '.conclusion') + + echo "[$(date)] Status: $STATUS, Conclusion: ${CONCLUSION:-not completed}" + + if [[ "$CONCLUSION" == "failure" ]]; then + echo "Job failed! Running diagnosis..." + gitea-client diagnose-job arcodange dance-lessons-coach $WORKFLOW_ID + break + elif [[ "$STATUS" != "in_progress" && "$STATUS" != "waiting" ]]; then + echo "Job completed with status: $STATUS" + break + fi + + sleep 30 + SECONDS_ELAPSED=$((SECONDS_ELAPSED + 30)) +done +``` + ### 2. Pull Request Management **Scenario:** Monitor and comment on PRs during CI/CD @@ -404,4 +452,79 @@ curl -s https://gitea.arcodange.lab/swagger.v1.json | \ - **GitHub Actions**: https://docs.github.com/en/actions - **JQ Tutorial**: https://stedolan.github.io/jq/manual/ -This reference guide provides comprehensive examples for using the gitea-client skill in real-world scenarios, covering job monitoring, PR management, issue tracking, and API discovery with practical, copy-paste-ready examples. \ No newline at end of file +This reference guide provides comprehensive examples for using the gitea-client skill in real-world scenarios, covering job monitoring, PR management, issue tracking, and API discovery with practical, copy-paste-ready examples. + +## 🎯 Real-World Use Cases from DanceLessonsCoach + +### CI/CD Pipeline Debugging + +**Scenario**: TLS certificate verification failures were blocking all CI/CD progress. + +**Solution**: Replaced Docker Buildx with traditional docker build + push. + +```bash +# Before (Failed) +# ERROR: failed to build: failed to solve: failed to push +# tls: failed to verify certificate: x509: certificate signed by unknown authority + +# After (Working) +gitea-client diagnose-job arcodange dance-lessons-coach 766 +# Result: Building cache image: gitea.arcodange.lab/... (no TLS errors) + +# Monitor the fix +gitea-client monitor-workflow arcodange dance-lessons-coach 418 30 +``` + +### Automated CI Monitoring + +```bash +# Monitor workflow and auto-diagnose failures +WORKFLOW_ID=418 +TIMEOUT=300 +SECONDS_ELAPSED=0 + +while [ $SECONDS_ELAPSED -lt $TIMEOUT ]; do + STATUS=$(gitea-client job-status arcodange dance-lessons-coach $WORKFLOW_ID | jq -r '.status') + CONCLUSION=$(gitea-client job-status arcodange dance-lessons-coach $WORKFLOW_ID | jq -r '.conclusion') + + echo "[$(date)] Status: $STATUS, Conclusion: ${CONCLUSION:-not completed}" + + if [[ "$CONCLUSION" == "failure" ]]; then + echo "❌ Workflow failed! Running diagnosis..." + gitea-client diagnose-job arcodange dance-lessons-coach $WORKFLOW_ID + break + elif [[ "$STATUS" != "in_progress" && "$STATUS" != "waiting" ]]; then + echo "✅ Workflow completed: $STATUS" + break + fi + + sleep 30 + SECONDS_ELAPSED=$((SECONDS_ELAPSED + 30)) +done +``` + +### PR Management Automation + +```bash +# Automated PR triage based on CI results +OPEN_PRS=$(gitea-client list-prs arcodange dance-lessons-coach | jq -r '.[] | select(.state == "open") | .number') + +for pr in $OPEN_PRS; do + PR_DETAILS=$(gitea-client pr-status arcodange dance-lessons-coach $pr) + BRANCH=$(echo "$PR_DETAILS" | jq -r '.head.ref') + + # Find related workflows + WORKFLOWS=$(gitea-client recent-workflows arcodange dance-lessons-coach 5 | grep "$BRANCH" || echo "") + + if [ -n "$WORKFLOWS" ]; then + LATEST_WORKFLOW=$(echo "$WORKFLOWS" | head -1 | cut -d':' -f1) + CONCLUSION=$(gitea-client job-status arcodange dance-lessons-coach $LATEST_WORKFLOW | jq -r '.conclusion') + + if [ "$CONCLUSION" = "failure" ]; then + gitea-client comment-pr arcodange dance-lessons-coach $pr "⚠️ CI Failed - Check workflow $LATEST_WORKFLOW" + elif [ "$CONCLUSION" = "success" ]; then + gitea-client comment-pr arcodange dance-lessons-coach $pr "✅ CI Passed - Ready for review!" + fi + fi +done +``` \ No newline at end of file