🤖 feat: enhance agent skills for BDD testing and CI/CD management
Skill Improvements: - BDD Testing Skill: Enhanced step templates, debugging guides, and patterns - Gitea Client Skill: Added wiki management, issue tracking, and workflow monitoring - Product Owner Assistant: Improved user story workflow and documentation - Commit Message Skill: Better gitmoji integration and issue referencing - Changelog Manager: Enhanced change tracking and documentation - Skill Creator: Improved skill generation templates and validation - Swagger Documentation: Updated OpenAPI integration guides Key Features: - BDD best practices documentation - Gitea API client with wiki support - User story implementation workflow - Git commit message standardization - Skill development patterns - OpenAPI/Swagger documentation generation Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
@@ -52,6 +52,20 @@ api_request() {
|
||||
fi
|
||||
}
|
||||
|
||||
# List workflows
|
||||
cmd_list_workflows() {
|
||||
local owner="$1"
|
||||
local repo="$2"
|
||||
|
||||
if [[ -z "$owner" || -z "$repo" ]]; then
|
||||
echo "Usage: $0 list-workflows <owner> <repo>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local endpoint="/repos/${owner}/${repo}/actions/workflows"
|
||||
api_request "GET" "$endpoint"
|
||||
}
|
||||
|
||||
# List jobs
|
||||
cmd_list_jobs() {
|
||||
local owner="$1"
|
||||
@@ -226,12 +240,16 @@ main() {
|
||||
shift || true
|
||||
|
||||
case "$command" in
|
||||
list-workflows) cmd_list_workflows "$@" ;;
|
||||
list-jobs) cmd_list_jobs "$@" ;;
|
||||
job-status) cmd_job_status "$@" ;;
|
||||
job-logs) cmd_job_logs "$@" ;;
|
||||
action-logs) cmd_action_logs "$@" ;;
|
||||
list-workflow-jobs) cmd_list_workflow_jobs "$@" ;;
|
||||
wait-job) cmd_wait_job "$@" ;;
|
||||
monitor-workflow) cmd_monitor_workflow "$@" ;;
|
||||
diagnose-job) cmd_diagnose_job "$@" ;;
|
||||
recent-workflows) cmd_recent_workflows "$@" ;;
|
||||
comment-pr) cmd_comment_pr "$@" ;;
|
||||
pr-status) cmd_pr_status "$@" ;;
|
||||
list-issues) cmd_list_issues "$@" ;;
|
||||
@@ -241,16 +259,21 @@ main() {
|
||||
list-wiki) cmd_list_wiki "$@" ;;
|
||||
create-wiki) cmd_create_wiki "$@" ;;
|
||||
get-wiki) cmd_get_wiki "$@" ;;
|
||||
trigger-workflow) cmd_trigger_workflow "$@" ;;
|
||||
*)
|
||||
echo "Usage: $0 <command> [args...]" >&2
|
||||
echo "" >&2
|
||||
echo "Commands:" >&2
|
||||
echo " list-workflows <owner> <repo>" >&2
|
||||
echo " list-jobs <owner> <repo> <workflow_id> [limit]" >&2
|
||||
echo " job-status <owner> <repo> <job_id>" >&2
|
||||
echo " job-logs <owner> <repo> <job_id> [output_file]" >&2
|
||||
echo " action-logs <owner> <repo> <action_job_id> [output_file]" >&2
|
||||
echo " list-workflow-jobs <owner> <repo> <workflow_run_id>" >&2
|
||||
echo " wait-job <owner> <repo> <job_id> [timeout]" >&2
|
||||
echo " monitor-workflow <owner> <repo> <workflow_run_id> [interval_seconds]" >&2
|
||||
echo " diagnose-job <owner> <repo> <job_id>" >&2
|
||||
echo " recent-workflows <owner> <repo> [limit] [status_filter]" >&2
|
||||
echo " comment-pr <owner> <repo> <pr_number> <comment>" >&2
|
||||
echo " pr-status <owner> <repo> <pr_number>" >&2
|
||||
echo " list-issues <owner> <repo> [state]" >&2
|
||||
@@ -260,6 +283,7 @@ main() {
|
||||
echo " list-wiki <owner> <repo>" >&2
|
||||
echo " create-wiki <owner> <repo> <title> <content> [message]" >&2
|
||||
echo " get-wiki <owner> <repo> <page_name>" >&2
|
||||
echo " trigger-workflow <owner> <repo> <workflow_file> <branch>" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -386,7 +410,140 @@ cmd_get_wiki() {
|
||||
fi
|
||||
|
||||
local endpoint="/repos/$owner/$repo/wiki/page/$page_name"
|
||||
api_request "GET" "$endpoint"
|
||||
local response=$(api_request "GET" "$endpoint")
|
||||
|
||||
# Extract and decode the content_base64 field
|
||||
local content_b64=$(echo "$response" | jq -r '.content_base64')
|
||||
if [[ "$content_b64" != "null" && -n "$content_b64" ]]; then
|
||||
echo "$content_b64" | base64 --decode
|
||||
else
|
||||
echo "$response"
|
||||
fi
|
||||
}
|
||||
|
||||
# Trigger workflow
|
||||
cmd_trigger_workflow() {
|
||||
local owner="$1"
|
||||
local repo="$2"
|
||||
local workflow_file="$3"
|
||||
local branch="$4"
|
||||
|
||||
if [[ -z "$owner" || -z "$repo" || -z "$workflow_file" || -z "$branch" ]]; then
|
||||
echo "Usage: $0 trigger-workflow <owner> <repo> <workflow_file> <branch>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local endpoint="/repos/${owner}/${repo}/actions/workflows/${workflow_file}/dispatches"
|
||||
local data="{\"ref\": \"${branch}\"}"
|
||||
|
||||
echo "Triggering workflow: ${workflow_file} on branch: ${branch}"
|
||||
api_request "POST" "$endpoint" "$data"
|
||||
echo "Workflow triggered successfully!"
|
||||
}
|
||||
|
||||
# Monitor workflow run until completion
|
||||
cmd_monitor_workflow() {
|
||||
local owner="$1"
|
||||
local repo="$2"
|
||||
local workflow_run_id="$3"
|
||||
local interval="${4:-30}"
|
||||
|
||||
if [[ -z "$owner" || -z "$repo" || -z "$workflow_run_id" ]]; then
|
||||
echo "Usage: $0 monitor-workflow <owner> <repo> <workflow_run_id> [interval_seconds]" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Monitoring workflow run $workflow_run_id (interval: ${interval}s)..."
|
||||
echo "Press Ctrl+C to stop monitoring"
|
||||
|
||||
while true; do
|
||||
local endpoint="/repos/${owner}/${repo}/actions/runs/${workflow_run_id}"
|
||||
local status=$(api_request "GET" "$endpoint" | jq -r '.status')
|
||||
local conclusion=$(api_request "GET" "$endpoint" | jq -r '.conclusion')
|
||||
local updated_at=$(api_request "GET" "$endpoint" | jq -r '.updated_at')
|
||||
|
||||
echo "[$(date +'%Y-%m-%d %H:%M:%S')] Status: $status, Conclusion: ${conclusion:-not completed}, Updated: $updated_at"
|
||||
|
||||
# List jobs in this workflow
|
||||
local jobs_endpoint="/repos/${owner}/${repo}/actions/runs/${workflow_run_id}/jobs"
|
||||
local jobs=$(api_request "GET" "$jobs_endpoint")
|
||||
echo "Jobs:"
|
||||
echo "$jobs" | jq -r '.jobs[] | " \(.id): \(.name) - \(.status) \(if .conclusion then "(\(.conclusion))" else "" end)"'
|
||||
|
||||
# Check if workflow is completed
|
||||
if [[ "$status" != "queued" && "$status" != "in_progress" && "$status" != "waiting" ]]; then
|
||||
echo "Workflow run $workflow_run_id has completed with status: $status and conclusion: ${conclusion:-none}"
|
||||
break
|
||||
fi
|
||||
|
||||
sleep "$interval"
|
||||
done
|
||||
}
|
||||
|
||||
# Diagnose failed job
|
||||
cmd_diagnose_job() {
|
||||
local owner="$1"
|
||||
local repo="$2"
|
||||
local job_id="$3"
|
||||
|
||||
if [[ -z "$owner" || -z "$repo" || -z "$job_id" ]]; then
|
||||
echo "Usage: $0 diagnose-job <owner> <repo> <job_id>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Diagnosing job $job_id..."
|
||||
|
||||
# Get job details
|
||||
local job_endpoint="/repos/${owner}/${repo}/actions/jobs/${job_id}"
|
||||
local job_details=$(api_request "GET" "$job_endpoint")
|
||||
|
||||
echo "Job Details:"
|
||||
echo "$job_details" | jq '. | {id, name, status, conclusion, started_at, completed_at, runner_name}'
|
||||
|
||||
# Get job logs
|
||||
local logs_endpoint="/repos/${owner}/${repo}/actions/jobs/${job_id}/logs"
|
||||
echo -e "\nLast 50 lines of logs:"
|
||||
api_request "GET" "$logs_endpoint" | tail -50
|
||||
|
||||
# Look for errors
|
||||
echo -e "\nError analysis:"
|
||||
api_request "GET" "$logs_endpoint" | grep -i "error\|fail\|panic\|exception" | tail -10
|
||||
|
||||
# Get workflow run details
|
||||
local run_id=$(echo "$job_details" | jq -r '.run_id')
|
||||
local run_endpoint="/repos/${owner}/${repo}/actions/runs/${run_id}"
|
||||
local run_details=$(api_request "GET" "$run_endpoint")
|
||||
|
||||
echo -e "\nWorkflow Run Details:"
|
||||
echo "$run_details" | jq '. | {id, display_title, status, conclusion, head_branch, head_sha}'
|
||||
}
|
||||
|
||||
# Get recent workflow runs summary
|
||||
cmd_recent_workflows() {
|
||||
local owner="$1"
|
||||
local repo="$2"
|
||||
local limit="${3:-10}"
|
||||
local status_filter="${4:-}"
|
||||
|
||||
if [[ -z "$owner" || -z "$repo" ]]; then
|
||||
echo "Usage: $0 recent-workflows <owner> <repo> [limit] [status_filter]" >&2
|
||||
echo "Status filter options: all, completed, in_progress, queued, waiting" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local endpoint="/repos/${owner}/${repo}/actions/runs?limit=${limit}"
|
||||
if [[ -n "$status_filter" ]]; then
|
||||
endpoint="$endpoint&status=$status_filter"
|
||||
fi
|
||||
|
||||
local workflows=$(api_request "GET" "$endpoint")
|
||||
|
||||
echo "Recent Workflow Runs (showing $limit most recent):"
|
||||
echo "$workflows" | jq -r '.workflow_runs[] | "\(.id): \(.display_title) - \(.status) \(if .conclusion then "(\(.conclusion))" else "" end) - \(.updated_at)"'
|
||||
|
||||
# Show summary statistics
|
||||
echo -e "\nSummary:"
|
||||
echo "$workflows" | jq -r '.workflow_runs | group_by(.conclusion) | .[] | " \(.[0].conclusion // "in_progress"): \(length)"'
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
||||
Reference in New Issue
Block a user