-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspawn_staff_workspaces
More file actions
executable file
·72 lines (58 loc) · 2.26 KB
/
spawn_staff_workspaces
File metadata and controls
executable file
·72 lines (58 loc) · 2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
# Script to spawn all workspaces from .staff directory
STAFF_DIR="/Users/gregorywhiteside/Projects/.staff"
BRANCH_NAME="${1:-greg}"
echo "Spawning workspaces from $STAFF_DIR"
echo "Using branch: $BRANCH_NAME"
echo ""
# Check if .staff directory exists
if [ ! -d "$STAFF_DIR" ]; then
echo "Error: $STAFF_DIR not found"
exit 1
fi
# Function to spawn a workspace
spawn_workspace() {
local workspace_name="$1"
local workspace_path="$2"
local port="$3"
echo "Opening workspace: $workspace_name (port: $port)"
# Use project_workspace_single to run everything in one window, then open Claude
if [ -f "$workspace_path/package.json" ]; then
# Has package.json, so can run yarn with custom port
/Users/gregorywhiteside/Projects/.scripts/project_workspace_single "$workspace_path" "start:$port" "$workspace_name" "$BRANCH_NAME"
else
# Just open Claude window with git setup
/Users/gregorywhiteside/Projects/.scripts/open_terminal "$workspace_name" "cd '$workspace_path' && git stash && git checkout $BRANCH_NAME 2>/dev/null || git checkout -b $BRANCH_NAME && git pull origin $BRANCH_NAME 2>/dev/null || git pull || echo 'No remote' && claude"
fi
}
# Define port mapping for each workspace
declare -A PORTS
PORTS[BUGS]=8081
PORTS[MEDIUM]=8082
PORTS[QUICK]=8083
# Iterate through directories in .staff
for dir in "$STAFF_DIR"/*; do
if [ -d "$dir" ]; then
workspace_name=$(basename "$dir")
# Convert to lowercase for consistency
workspace_lower=$(echo "$workspace_name" | tr '[:upper:]' '[:lower:]')
# Get port for this workspace
port=${PORTS[$workspace_name]}
if [ -z "$port" ]; then
port=8080 # Default port if not defined
fi
spawn_workspace "$workspace_lower" "$dir" "$port"
# Small delay between spawning windows
sleep 1
fi
done
echo ""
echo "All workspaces spawned!"
echo ""
echo "Next steps:"
echo "1. Wait for all windows to open"
echo "2. Run: /Users/gregorywhiteside/Projects/.scripts/setup_workspaces $BRANCH_NAME"
echo " This will:"
echo " - Switch all workspaces to branch: $BRANCH_NAME"
echo " - Pull latest changes"
echo " - Update HTML titles to match window names"