#!/bin/bash # wq_list — list work items with optional filters # Usage: wq list [options] # Options: # --status Filter by status: queued, dispatched, in_progress, blocked, completed, failed, cancelled # --agent Filter by assigned agent # --project-id Filter by project # --since Only items created after this timestamp # --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 .