Files
myworkspace/docs/task-handoff-script.sh

54 lines
1.3 KiB
Bash

#!/bin/bash
# Task Handoff Script - Automate OpenCode Launch
# Cline can invoke this to automatically hand off tasks to OpenCode
# Usage: task-handoff.sh "PROJECT_PATH" "TASK_DESCRIPTION"
set -e
PROJECT_PATH="${1:-.}"
TASK_DESC="${2:-}"
if [ -z "$TASK_DESC" ]; then
echo "Usage: task-handoff.sh \"PROJECT_PATH\" \"TASK DESCRIPTION\""
echo ""
echo "Example:"
echo " task-handoff.sh \"Linkding Browser Extension/LinkdingSync\" \"Implement Playwright tests for bookmark sync\""
exit 1
fi
echo "=========================================="
echo "OpenCode Task Handoff"
echo "=========================================="
echo "Project: $PROJECT_PATH"
echo "Task: $TASK_DESC"
echo "=========================================="
# Change to project directory
cd "$PROJECT_PATH"
# Check if task brief exists
if [ -f "task-brief.md" ]; then
echo ""
echo "Found task-brief.md"
echo "--- Task Brief Contents ---"
cat task-brief.md
echo "--- End Task Brief ---"
echo ""
fi
# Check if AGENTS.md exists
if [ -f "AGENTS.md" ]; then
echo "Found AGENTS.md - project context ready"
fi
echo ""
echo "Launching OpenCode with task..."
echo ""
# Launch OpenCode in server/headless mode for autonomous execution
# The agent will read the project files and execute the task
opencode run "$TASK_DESC"
# Exit with OpenCode's exit code
exit $?