feat: add work-queue skill for Marcus and Steve
Some checks failed
ci / build-test-push (push) Failing after 29s
Some checks failed
ci / build-test-push (push) Failing after 29s
This commit is contained in:
39
skill/bin/wq_add
Executable file
39
skill/bin/wq_add
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/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 .
|
||||
}
|
||||
Reference in New Issue
Block a user