-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtask.sh
More file actions
executable file
·36 lines (29 loc) · 890 Bytes
/
task.sh
File metadata and controls
executable file
·36 lines (29 loc) · 890 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
# task.sh - Execute an agent task with optional file attachments
# Usage: ./task.sh <taskName> <prompt> [file1 file2 ...]
# Check required arguments
if [ $# -lt 2 ]; then
echo "Usage: $0 <taskName> <prompt> [file1 file2 ...]"
echo "Example: $0 code-reviewer 'Review this code' main.ts utils.ts"
exit 1
fi
TASK_NAME="$1"
PROMPT="$2"
shift 2
FILES=("$@")
API_BASE_URL="${API_BASE_URL:-http://localhost:3000/api/v1}"
ENDPOINT="${API_BASE_URL}/task"
# Build curl command with form data
CURL_CMD="curl -X POST \"$ENDPOINT\""
CURL_CMD="$CURL_CMD -F \"taskName=$TASK_NAME\""
CURL_CMD="$CURL_CMD -F \"prompt=$PROMPT\""
# Add files if provided
for file in "${FILES[@]}"; do
if [ -f "$file" ]; then
CURL_CMD="$CURL_CMD -F \"files=@$file\""
else
echo "Warning: File not found: $file (skipping)"
fi
done
# Execute the request
eval "$CURL_CMD"