Files
managing-apps/scripts/vibe-dev-server.sh
2025-12-31 01:31:54 +07:00

59 lines
1.8 KiB
Bash
Executable File

#!/bin/bash
# scripts/vibe-dev-server.sh
# Minimal script for Vibe Kanban worktrees
# This script runs from the worktree and uses main repo scripts for Docker setup
TASK_ID=${1:-"DEV-$(date +%Y%m%d-%H%M%S)"}
PORT_OFFSET=${2:-0}
# Detect worktree root
WORKTREE_ROOT="$(pwd)"
# Check if we're in a nested structure (Vibe Kanban worktree)
if [ -d "$WORKTREE_ROOT/managing-apps" ] && [ -d "$WORKTREE_ROOT/managing-apps/src/Managing.Api" ]; then
WORKTREE_PROJECT_ROOT="$WORKTREE_ROOT/managing-apps"
elif [ -d "$WORKTREE_ROOT/src/Managing.Api" ]; then
WORKTREE_PROJECT_ROOT="$WORKTREE_ROOT"
else
echo "❌ Cannot find project structure in worktree"
echo " Current directory: $WORKTREE_ROOT"
exit 1
fi
echo "📁 Worktree project root: $WORKTREE_PROJECT_ROOT"
# Find main repository (try common locations)
MAIN_REPO_PATHS=(
"/Users/oda/Desktop/Projects/managing-apps"
"$(git -C "$WORKTREE_PROJECT_ROOT" rev-parse --show-toplevel 2>/dev/null || echo '')"
"$(dirname "$WORKTREE_ROOT" 2>/dev/null)/managing-apps"
)
MAIN_REPO=""
for path in "${MAIN_REPO_PATHS[@]}"; do
if [ -n "$path" ] && [ -d "$path" ] && [ -d "$path/scripts" ] && [ -f "$path/scripts/start-task-docker.sh" ]; then
MAIN_REPO="$path"
break
fi
done
if [ -z "$MAIN_REPO" ]; then
echo "❌ Cannot find main repository with scripts"
echo "💡 Tried:"
for path in "${MAIN_REPO_PATHS[@]}"; do
echo " - $path"
done
exit 1
fi
echo "📁 Main repository: $MAIN_REPO"
echo "🚀 Starting dev environment..."
echo " Task ID: $TASK_ID"
echo " Port offset: $PORT_OFFSET"
# Export worktree path so main repo scripts know where to run dotnet from
export VIBE_WORKTREE_ROOT="$WORKTREE_PROJECT_ROOT"
# Call main repo's start script
bash "$MAIN_REPO/scripts/start-task-docker.sh" "$TASK_ID" "$PORT_OFFSET"