Files
work-queue-api/skill/bin/wq_update
Marcus A. c5be58c3c5
Some checks failed
ci / build-test-push (push) Failing after 29s
feat: add work-queue skill for Marcus and Steve
2026-04-11 14:48:08 -05:00

41 lines
1.1 KiB
Bash
Executable File

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