diff --git a/scripts/quick-add.sh b/scripts/quick-add.sh new file mode 100755 index 0000000..e0819fa --- /dev/null +++ b/scripts/quick-add.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# Quick add task from "todo [name]" pattern +# Usage: quick-add.sh "Configure Tailscale VPN" + +set -euo pipefail + +task_name="${1:-}" + +if [ -z "$task_name" ]; then + echo "Usage: quick-add.sh " >&2 + exit 1 +fi + +API_URL="${TUDUDI_API_URL:-https://todo.dilain.com/api/v1}" +API_KEY="${TUDUDI_API_KEY}" + +if [ -z "$API_KEY" ]; then + echo "Error: TUDUDI_API_KEY not set" >&2 + exit 1 +fi + +# Add to inbox (no project) +response=$(curl -s -X POST \ + -H "Authorization: Bearer $API_KEY" \ + -H "Content-Type: application/json" \ + -d "{\"name\":\"$task_name\"}" \ + "$API_URL/tasks") + +task_id=$(echo "$response" | jq -r '.id // empty') + +if [ -n "$task_id" ]; then + echo "✅ Added to Tududi inbox: $task_name" +else + echo "⚠️ Failed to add task" + echo "$response" | jq . + exit 1 +fi