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

40 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# wq_add — submit a new work item
wq_add() {
local type desc agent project_id priority payload_json
while [[ $# -gt 0 ]]; do
case "$1" in
--agent) agent="$2"; shift 2;;
--project-id) project_id="$2"; shift 2;;
--priority) priority="$2"; shift 2;;
--payload) payload_json="$2"; shift 2;;
--) shift; break;;
-*) echo "Unknown option: $1" >&2; exit 1;;
*)
if [[ -z "$type" ]]; then
type="$1"
elif [[ -z "$desc" ]]; then
desc="$1"
fi
shift;;
esac
done
if [[ -z "$type" ]] || [[ -z "$desc" ]]; then
echo "Usage: wq add <type> <description> [--agent <agent>] [--project-id <id>] [--priority 1-5>] [--payload <json>]" >&2
exit 1
fi
local body="{\"type\":\"$type\",\"description\":\"$desc\"}"
[[ -n "$agent" ]] && body=$(echo "$body" | jq ".assigned_agent=\"$agent\"")
[[ -n "$project_id" ]] && body=$(echo "$body" | jq ".project_id=\"$project_id\"")
[[ -n "$priority" ]] && body=$(echo "$body" | jq ".priority=$priority")
[[ -n "$payload_json" ]] && body=$(echo "$body" | jq ".payload=$payload_json")
curl -sf -X POST "$API_URL/work" \
-H "Content-Type: application/json" \
-d "$body" | jq .
}