From ed9fcbe6ba3c9a5d37ed6e46268284642db881cc Mon Sep 17 00:00:00 2001 From: adlee-was-taken Date: Sat, 2 May 2026 17:18:31 -0400 Subject: [PATCH] feat(relay): start.sh launcher with --manual/--tmux/--kitty modes --- tools/relay/start.sh | 99 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100755 tools/relay/start.sh diff --git a/tools/relay/start.sh b/tools/relay/start.sh new file mode 100755 index 0000000..44dbadd --- /dev/null +++ b/tools/relay/start.sh @@ -0,0 +1,99 @@ +#!/usr/bin/env bash +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="$(git -C "$SCRIPT_DIR" rev-parse --show-toplevel)" +PORT=7331 +MODE="manual" + +for arg in "$@"; do + case "$arg" in + --tmux) MODE="tmux" ;; + --kitty) MODE="kitty" ;; + --manual) MODE="manual" ;; + *) echo "Unknown option: $arg" >&2; echo "Usage: $0 [--manual|--tmux|--kitty]" >&2; exit 1 ;; + esac +done + +# Port check +if lsof -ti:"$PORT" &>/dev/null; then + echo "Error: port $PORT is already in use." + echo "Relay already running? Kill it with: kill \$(lsof -ti:$PORT)" + exit 1 +fi + +# Install deps (no-op if node_modules current) +cd "$SCRIPT_DIR" +npm install --silent + +# Discover latest coordination prompts for instructions +COORD_DIR="$REPO_ROOT/docs/superpowers/coordination" +PM_PROMPT="$(ls -t "$COORD_DIR"/*-pm-prompt.md 2>/dev/null | head -1 || echo "(none found — run multi-agent-kickoff skill first)")" +DEV_A_PROMPT="$(ls -t "$COORD_DIR"/*-dev-a-prompt.md 2>/dev/null | head -1 || echo "(none found)")" +DEV_B_PROMPT="$(ls -t "$COORD_DIR"/*-dev-b-prompt.md 2>/dev/null | head -1 || echo "(none found)")" + +print_manual_instructions() { + echo "" + echo "╔══════════════════════════════════════════════════════════════╗" + echo "║ RELAY SERVER — MULTI-AGENT LIFT LAUNCHER ║" + echo "╚══════════════════════════════════════════════════════════════╝" + echo "" + echo "Open 3 new terminals. In each, start Claude Code and paste" + echo "the content BELOW the '---' line from the corresponding file." + echo "" + echo " Terminal 1 (PM): cat '$PM_PROMPT'" + echo " Terminal 2 (Dev A): cat '$DEV_A_PROMPT'" + echo " Terminal 3 (Dev B): cat '$DEV_B_PROMPT'" + echo "" + echo "This terminal becomes the relay log. Keep it open." + echo "" + echo "══════════════════════════════════════════════════════════════" +} + +launch_tmux() { + SESSION="relay-lift" + tmux new-session -d -s "$SESSION" -n "relay" \ + "cd '$SCRIPT_DIR' && npx tsx server.ts" + tmux new-window -t "$SESSION:" -n "pm" "cd '$REPO_ROOT' && claude" + tmux new-window -t "$SESSION:" -n "dev-a" "cd '$REPO_ROOT' && claude" + tmux new-window -t "$SESSION:" -n "dev-b" "cd '$REPO_ROOT' && claude" + echo "" + echo "[relay] Opened tmux session '$SESSION' with 4 windows: relay, pm, dev-a, dev-b." + echo "[relay] Paste the kickoff prompt into each Claude window." + echo " Prompts:" + echo " PM: $PM_PROMPT" + echo " Dev A: $DEV_A_PROMPT" + echo " Dev B: $DEV_B_PROMPT" + echo "" + tmux attach-session -t "$SESSION" +} + +launch_kitty() { + kitty @ launch --new-tab --tab-title "relay" -- \ + bash -c "cd '$SCRIPT_DIR' && npx tsx server.ts" + kitty @ launch --new-window --window-title "PM" -- \ + bash -c "cd '$REPO_ROOT' && claude" + kitty @ launch --new-window --window-title "Dev-A" -- \ + bash -c "cd '$REPO_ROOT' && claude" + kitty @ launch --new-window --window-title "Dev-B" -- \ + bash -c "cd '$REPO_ROOT' && claude" + echo "" + echo "[relay] Opened kitty tab 'relay' + 3 windows (PM, Dev-A, Dev-B)." + echo " Paste the kickoff prompts into each Claude window." + echo " PM: $PM_PROMPT" + echo " Dev A: $DEV_A_PROMPT" + echo " Dev B: $DEV_B_PROMPT" +} + +case "$MODE" in + manual) + print_manual_instructions + exec npx tsx "$SCRIPT_DIR/server.ts" + ;; + tmux) + launch_tmux + ;; + kitty) + launch_kitty + ;; +esac