summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-03-25 05:15:52 +0000
committerPeter Stone <thepeterstone@gmail.com>2026-03-25 05:15:52 +0000
commit436862484e53e9cf06b2594bcefd99621e603a72 (patch)
tree55f728057979bbfa3ab24cd8eaf4e300874f5935
parent7419a7610b099c4ca93ba345d303c97f777733bd (diff)
feat: add ct-submit script for permission-free task creation
Wraps POST /api/tasks + run in a single script callable from /workspace/** (auto-permitted). Used by the ct-create skill to avoid per-call auth prompts. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
-rw-r--r--scripts/ct-submit62
1 files changed, 62 insertions, 0 deletions
diff --git a/scripts/ct-submit b/scripts/ct-submit
new file mode 100644
index 0000000..26213c5
--- /dev/null
+++ b/scripts/ct-submit
@@ -0,0 +1,62 @@
+#!/usr/bin/env bash
+# ct-submit — Create and immediately run a Claudomator task
+#
+# Usage:
+# ct-submit --name "task name" --repo "/site/git.terst.org/repos/doot.git" --instructions "..."
+# ct-submit --name "task name" --instructions-file /tmp/instructions.txt
+#
+# Reads instructions from --instructions or --instructions-file.
+# Prints the task ID on success.
+
+set -euo pipefail
+
+API="http://localhost:8484"
+NAME=""
+REPO="/site/git.terst.org/repos/claudomator.git"
+INSTRUCTIONS=""
+INSTRUCTIONS_FILE=""
+
+while [[ $# -gt 0 ]]; do
+ case "$1" in
+ --name) NAME="$2"; shift 2 ;;
+ --repo) REPO="$2"; shift 2 ;;
+ --instructions) INSTRUCTIONS="$2"; shift 2 ;;
+ --instructions-file) INSTRUCTIONS_FILE="$2"; shift 2 ;;
+ *) echo "Unknown arg: $1" >&2; exit 1 ;;
+ esac
+done
+
+if [[ -z "$NAME" ]]; then
+ echo "Error: --name is required" >&2
+ exit 1
+fi
+
+if [[ -n "$INSTRUCTIONS_FILE" ]]; then
+ INSTRUCTIONS="$(cat "$INSTRUCTIONS_FILE")"
+fi
+
+if [[ -z "$INSTRUCTIONS" ]]; then
+ echo "Error: --instructions or --instructions-file is required" >&2
+ exit 1
+fi
+
+PAYLOAD="$(jq -n \
+ --arg name "$NAME" \
+ --arg repo "$REPO" \
+ --arg inst "$INSTRUCTIONS" \
+ '{name: $name, repository_url: $repo, agent: {type: "claude", instructions: $inst}}')"
+
+RESPONSE="$(curl -s -X POST "$API/api/tasks" \
+ -H "Content-Type: application/json" \
+ -d "$PAYLOAD")"
+
+TASK_ID="$(echo "$RESPONSE" | jq -r '.id // empty')"
+if [[ -z "$TASK_ID" ]]; then
+ echo "Error creating task:" >&2
+ echo "$RESPONSE" >&2
+ exit 1
+fi
+
+curl -s -X POST "$API/api/tasks/$TASK_ID/run" > /dev/null
+
+echo "$TASK_ID"