Initial skill structure: Tududi task management
This commit is contained in:
68
scripts/tududi-suggest.sh
Executable file
68
scripts/tududi-suggest.sh
Executable file
@@ -0,0 +1,68 @@
|
||||
#!/bin/bash
|
||||
# Suggest priority/tags/projects for a task
|
||||
# Usage: tududi-suggest.sh "task name" "description"
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
task_name="${1:-}"
|
||||
task_desc="${2:-}"
|
||||
|
||||
if [ -z "$task_name" ]; then
|
||||
echo "Usage: tududi-suggest.sh <task_name> [task_description]" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get projects for reference
|
||||
API_URL="${TUDUDI_API_URL:-https://todo.dilain.com/api/v1}"
|
||||
API_KEY="${TUDUDI_API_KEY}"
|
||||
|
||||
projects=$(curl -s -H "Authorization: Bearer $API_KEY" "$API_URL/projects" | jq -r '.[] | "\(.id):\(.name)"' | head -10)
|
||||
|
||||
# Simple keyword-based suggestions
|
||||
priority="normal"
|
||||
tags="[]"
|
||||
project_id=""
|
||||
|
||||
# Detect priority keywords
|
||||
if echo "$task_name $task_desc" | grep -iE "(urgent|asap|critical|emergency|blocker)" > /dev/null; then
|
||||
priority="high"
|
||||
elif echo "$task_name $task_desc" | grep -iE "(low priority|someday|backlog|optional)" > /dev/null; then
|
||||
priority="low"
|
||||
fi
|
||||
|
||||
# Detect tag keywords
|
||||
tag_array="["
|
||||
if echo "$task_name $task_desc" | grep -iE "(email|meeting|call|communication)" > /dev/null; then
|
||||
tag_array="${tag_array}\"communication\","
|
||||
fi
|
||||
if echo "$task_name $task_desc" | grep -iE "(code|dev|debug|fix|feature|bug)" > /dev/null; then
|
||||
tag_array="${tag_array}\"devops\","
|
||||
fi
|
||||
if echo "$task_name $task_desc" | grep -iE "(urgent|high|critical|asap)" > /dev/null; then
|
||||
tag_array="${tag_array}\"urgent\","
|
||||
fi
|
||||
tag_array="${tag_array%,}]"
|
||||
[ "$tag_array" = "[]" ] && tags="[]" || tags="$tag_array"
|
||||
|
||||
# Output suggestion
|
||||
cat <<EOF
|
||||
{
|
||||
"task": "$task_name",
|
||||
"suggestion": {
|
||||
"priority": "$priority",
|
||||
"tags": $tags,
|
||||
"projects_available": [
|
||||
EOF
|
||||
|
||||
echo "$projects" | while read proj; do
|
||||
proj_id=$(echo "$proj" | cut -d: -f1)
|
||||
proj_name=$(echo "$proj" | cut -d: -f2)
|
||||
echo " {\"id\": $proj_id, \"name\": \"$proj_name\"}"
|
||||
done | sed '$ s/,$//'
|
||||
|
||||
cat <<EOF
|
||||
],
|
||||
"note": "Review suggestions and adjust as needed before adding"
|
||||
}
|
||||
}
|
||||
EOF
|
||||
Reference in New Issue
Block a user