- Add tui/main.go, tui/go.mod, tui/go.sum (Go + Bubble Tea TUI) - Add CLAUDE.md with project instructions - Add bin/trailboss-preview script - Update bin/trailboss, bin/trailboss-start, bin/trailboss-watch - Update PROGRESS.md and docs/plan/plan.md to reflect completion - Add .gitignore entries for build artifacts (tui/tui, bin/trailboss-tui) - Remove stray root main.go placeholder and ~ directory Bead-Id: tb-25j Co-Authored-By: Claude <noreply@anthropic.com>
67 lines
2.3 KiB
Bash
Executable file
67 lines
2.3 KiB
Bash
Executable file
#!/bin/bash
|
|
# Start the Trail Boss daemon and open the supervisor split-view dashboard.
|
|
set -e
|
|
|
|
TB_DIR="$(cd "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/.." && pwd)"
|
|
|
|
# Check we're inside tmux
|
|
if [ -z "$TMUX" ]; then
|
|
echo "trailboss-start: must be run inside a tmux session" >&2
|
|
exit 1
|
|
fi
|
|
|
|
# Kill any existing trail-boss session and daemon process, then start fresh.
|
|
# Killing the daemon window when it's the session's last window auto-destroys
|
|
# the session, so it's simpler to tear down the whole session at once.
|
|
pkill -f "bun.*trail-boss/daemon/index.ts" 2>/dev/null || true
|
|
tmux kill-session -t trail-boss 2>/dev/null || true
|
|
sleep 0.5
|
|
|
|
# Create a fresh session with the daemon as its first (and only) window
|
|
tmux new-session -d -s trail-boss -n daemon -c "$TB_DIR/daemon" "bun index.ts"
|
|
|
|
# Wait for daemon to be ready
|
|
for i in $(seq 1 15); do
|
|
if curl -s --max-time 0.5 "http://127.0.0.1:4000/status" >/dev/null 2>&1; then
|
|
break
|
|
fi
|
|
sleep 0.3
|
|
done
|
|
|
|
if ! curl -s --max-time 1 "http://127.0.0.1:4000/status" >/dev/null 2>&1; then
|
|
echo "trailboss-start: daemon failed to start" >&2
|
|
tmux select-window -t trail-boss:daemon 2>/dev/null || true
|
|
exit 1
|
|
fi
|
|
|
|
# Load keybindings
|
|
tmux source-file "$TB_DIR/tmux.conf"
|
|
|
|
# Bootstrap: inject synthetic stops for all currently-idle Claude panes
|
|
"$TB_DIR/bin/trailboss-bootstrap"
|
|
|
|
# Create dashboard window as a bare shell.
|
|
# Use the stable window ID (@NNN) for all subsequent targeting so auto-rename
|
|
# can't break references before we lock the name.
|
|
DASH_ID=$(tmux new-window -t trail-boss -d -c "$TB_DIR" -P -F "#{window_id}")
|
|
|
|
# Pin the window name before any process renames it
|
|
tmux set-window-option -t "trail-boss:$DASH_ID" automatic-rename off
|
|
tmux rename-window -t "trail-boss:$DASH_ID" dashboard
|
|
|
|
# Resolve the top pane's stable %ID (immune to pane-base-index setting)
|
|
TOP_PANE=$(tmux display-message -t "trail-boss:$DASH_ID" -p "#{pane_id}")
|
|
|
|
# Create the bottom preview pane — pass the command directly so there's no
|
|
# send-keys timing race waiting for a shell to become ready.
|
|
tmux split-window -t "$TOP_PANE" -v -p 40 -d -c "$TB_DIR" \
|
|
"$TB_DIR/bin/trailboss-preview"
|
|
|
|
# Start the TUI in the top pane (exec replaces the shell)
|
|
tmux send-keys -t "$TOP_PANE" "exec $TB_DIR/bin/trailboss-tui" Enter
|
|
|
|
# Focus top (TUI) pane
|
|
tmux select-pane -t "$TOP_PANE"
|
|
|
|
# Switch the current client to the TUI
|
|
tmux switch-client -t "$TOP_PANE"
|