feat(skill): cover full API — projects, delete, health, all WorkCreate fields
All checks were successful
ci / build-test-push (push) Successful in 1m26s
All checks were successful
ci / build-test-push (push) Successful in 1m26s
This commit is contained in:
@@ -1,40 +1,39 @@
|
||||
#!/bin/bash
|
||||
# wq_update — update status, outcome, or notes
|
||||
# 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
|
||||
|
||||
wq_update() {
|
||||
local work_id status outcome notes
|
||||
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; }
|
||||
|
||||
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
|
||||
work_id="" status="" outcome="" notes="" agent=""
|
||||
|
||||
if [[ -z "$work_id" ]]; then
|
||||
echo "Usage: wq update <work_item_id> [--status <status>] [--outcome <success|failed|cancelled>] [--notes <text>]" >&2
|
||||
exit 1
|
||||
fi
|
||||
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
|
||||
|
||||
if [[ -z "$status" ]] && [[ -z "$outcome" ]] && [[ -z "$notes" ]]; then
|
||||
echo "Error: at least one of --status, --outcome, or --notes required" >&2
|
||||
exit 1
|
||||
fi
|
||||
[[ -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; }
|
||||
|
||||
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\"")
|
||||
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 .
|
||||
}
|
||||
curl -sf -X PATCH "$API_URL/work/$work_id" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$body" | jq .
|
||||
|
||||
Reference in New Issue
Block a user