Files
work-queue-api/skill/bin/wq_list
Marcus A. 33d65c35e9
All checks were successful
ci / build-test-push (push) Successful in 1m26s
feat(skill): cover full API — projects, delete, health, all WorkCreate fields
2026-04-11 16:11:13 -05:00

36 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# wq_list — list work items with optional filters
# Usage: wq list [options]
# Options:
# --status <status> Filter by status: queued, dispatched, in_progress, blocked, completed, failed, cancelled
# --agent <agent> Filter by assigned agent
# --project-id <id> Filter by project
# --since <ISO8601> Only items created after this timestamp
# --type <type> Filter by work type
API_URL="${WORK_QUEUE_API_URL:-}"
[[ -z "$API_URL" ]] && API_URL=$(cat ~/.config/work_queue_api_url 2>/dev/null || echo "")
[[ -z "$API_URL" ]] && { echo "Error: WORK_QUEUE_API_URL not set" >&2; exit 1; }
status="" agent="" project_id="" since="" type="" qs="?"
while [[ $# -gt 0 ]]; do
case "$1" in
--status) status="$2"; shift 2;;
--agent) agent="$2"; shift 2;;
--project-id) project_id="$2"; shift 2;;
--since) since="$2"; shift 2;;
--type) type="$2"; shift 2;;
--) shift; break;;
*) shift;;
esac
done
[[ -n "$status" ]] && qs="${qs}status=$status&"
[[ -n "$agent" ]] && qs="${qs}agent=$agent&"
[[ -n "$project_id" ]] && qs="${qs}project_id=$project_id&"
[[ -n "$since" ]] && qs="${qs}since=$since&"
[[ -n "$type" ]] && qs="${qs}type=$type&"
curl -sf "${API_URL}/work${qs}" | jq .