Files
work-queue-api/skill/bin/wq_update
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

40 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
# wq_update — update status, outcome, notes, or assigned_agent on a work item
# Usage: wq update <work_item_id> [options]
# Options:
# --status <status> New status
# --outcome <outcome> success, failed, cancelled
# --notes <text> Agent notes / context
# --agent <agent> Re-assign to different agent
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; }
work_id="" status="" outcome="" notes="" agent=""
while [[ $# -gt 0 ]]; do
case "$1" in
--status) status="$2"; shift 2;;
--outcome) outcome="$2"; shift 2;;
--notes) notes="$2"; shift 2;;
--agent) agent="$2"; shift 2;;
--) shift; break;;
-*) echo "Unknown option: $1" >&2; exit 1;;
*) [[ -z "$work_id" ]] && work_id="$1"; shift;;
esac
done
[[ -z "$work_id" ]] && { echo "Usage: wq update <work_item_id> [--status <status>] [--outcome <success|failed|cancelled>] [--notes <text>] [--agent <agent>]" >&2; exit 1; }
[[ -z "$status" ]] && [[ -z "$outcome" ]] && [[ -z "$notes" ]] && [[ -z "$agent" ]] && { echo "Error: at least one of --status, --outcome, --notes, or --agent required" >&2; exit 1; }
body="{}"
[[ -n "$status" ]] && body=$(echo "$body" | jq ".status=\"$status\"")
[[ -n "$outcome" ]] && body=$(echo "$body" | jq ".outcome=\"$outcome\"")
[[ -n "$notes" ]] && body=$(echo "$body" | jq ".notes=\"$notes\"")
[[ -n "$agent" ]] && body=$(echo "$body" | jq ".assigned_agent=\"$agent\"")
curl -sf -X PATCH "$API_URL/work/$work_id" \
-H "Content-Type: application/json" \
-d "$body" | jq .