This repository was archived by the owner on May 15, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·348 lines (291 loc) · 11.1 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
·348 lines (291 loc) · 11.1 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
#!/bin/bash
build_extension() {
echo "🔨 Building the Roo Code extension..."
pnpm -w vsix -- --out ../bin/roo-code-$(git rev-parse --short HEAD).vsix || exit 1
code --install-extension ../../bin/roo-code-$(git rev-parse --short HEAD).vsix || exit 1
}
check_docker_services() {
echo "🐳 Checking Docker services..."
if ! command -v docker &> /dev/null; then
echo "❌ Docker is not installed. Please install Docker Desktop and try again."
exit 1
fi
if ! docker info &> /dev/null; then
echo "❌ Docker is not running. Please start Docker Desktop and try again."
exit 1
fi
if ! docker compose version &> /dev/null; then
echo "❌ Docker Compose is not available. Please ensure Docker Desktop is properly installed."
exit 1
fi
local services_to_start=()
if ! nc -z localhost 5432 2>/dev/null; then
echo "📦 PostgreSQL not running on port 5432"
services_to_start+=("db")
else
echo "✅ PostgreSQL is running"
fi
if ! nc -z localhost 6379 2>/dev/null; then
echo "📦 Redis not running on port 6379"
services_to_start+=("redis")
else
echo "✅ Redis is running"
fi
if [ ${#services_to_start[@]} -gt 0 ]; then
echo "🚀 Starting Docker services: ${services_to_start[*]}"
echo "🧹 Cleaning up stale Docker state..."
docker compose down --remove-orphans &>/dev/null || true
docker network prune -f &>/dev/null || true
if docker compose --profile server up -d "${services_to_start[@]}"; then
echo "✅ Docker services started successfully"
echo "⏳ Waiting for services to be ready..."
local timeout=30
local elapsed=0
local all_ready=false
while [ $elapsed -lt $timeout ]; do
all_ready=true
for service in "${services_to_start[@]}"; do
if [[ "$service" == "db" ]] && ! nc -z localhost 5432 2>/dev/null; then
all_ready=false
break
elif [[ "$service" == "redis" ]] && ! nc -z localhost 6379 2>/dev/null; then
all_ready=false
break
fi
done
if [ "$all_ready" = true ]; then
echo "✅ All services are ready"
break
fi
sleep 1
elapsed=$((elapsed + 1))
if [ $((elapsed % 5)) -eq 0 ]; then
echo " Still waiting... (${elapsed}s/${timeout}s)"
fi
done
if [ "$all_ready" = false ]; then
echo "❌ Timeout: Services failed to start within ${timeout} seconds"
echo " Please check Docker logs: docker compose logs"
exit 1
fi
else
echo "❌ Failed to start Docker services even after cleanup. Please check your docker-compose.yml file."
exit 1
fi
else
echo "✅ All required Docker services are already running"
fi
}
if [[ "$(uname -s)" != "Darwin" ]]; then
echo "⚠️ Only macOS is currently supported."
echo "The Roo Code evals system can also be run with Docker on any platform."
echo "See https://github.com/RooCodeInc/Roo-Code/blob/main/packages/evals/README.md for instructions."
exit 1
fi
if ! command -v brew &>/dev/null; then
if [[ -f "/opt/homebrew/bin/brew" ]]; then
echo "⚠️ Homebrew is installed but not in your PATH"
exit 1
fi
read -p "🍺 Homebrew (https://brew.sh) is required. Install it? (Y/n): " install_brew
if [[ "$install_brew" =~ ^[Yy]|^$ ]]; then
echo "🍺 Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" || exit 1
# Can be undone with:
# /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)" && sudo rm -rvf /opt/homebrew
if [[ "$SHELL" == "/bin/zsh" ]] && ! grep -q 'eval "$(/opt/homebrew/bin/brew shellenv)"' ~/.zprofile; then
echo '[[ -s "/opt/homebrew/bin/brew" ]] && eval "$(/opt/homebrew/bin/brew shellenv)"' >>~/.zprofile
elif [[ "$SHELL" == "/bin/bash" ]] && ! grep -q 'eval "$(/opt/homebrew/bin/brew shellenv)"' ~/.bash_profile; then
echo '[[ -s "/opt/homebrew/bin/brew" ]] && eval "$(/opt/homebrew/bin/brew shellenv)"' >>~/.bash_profile
fi
if [[ "$SHELL" == "/bin/zsh" ]]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
elif [[ "$SHELL" == "/bin/bash" ]]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
BREW_VERSION=$(brew --version)
echo "✅ Homebrew is installed ($BREW_VERSION)"
else
exit 1
fi
else
BREW_VERSION=$(brew --version)
echo "✅ Homebrew is installed ($BREW_VERSION)"
fi
if ! command -v mise &>/dev/null; then
read -p "🛠️ mise (https://mise.jdx.dev) is required. Install it? (Y/n): " install_mise
if [[ "$install_mise" =~ ^[Yy]|^$ ]]; then
echo "🛠️ Installing mise..."
brew install mise || exit 1
# Can be undone with:
# brew uninstall mise
# rm -rvf ~/.local/share/mise ~/.config/mise
eval "$(mise activate bash)"
if [[ "$SHELL" == "/bin/zsh" ]] && ! grep -q 'mise activate zsh' ~/.zprofile; then
echo 'eval "$(mise activate zsh)"' >>~/.zprofile
elif [[ "$SHELL" == "/bin/bash" ]] && ! grep -q 'mise activate bash' ~/.bash_profile; then
echo 'eval "$(mise activate bash)"' >>~/.bash_profile
fi
MISE_VERSION=$(mise --version)
echo "✅ mise is installed ($MISE_VERSION)"
else
exit 1
fi
else
MISE_VERSION=$(mise --version)
echo "✅ mise is installed ($MISE_VERSION)"
eval "$(mise activate bash)"
fi
if ! command -v gh &>/dev/null; then
read -p "👨💻 GitHub cli is needed to submit evals results. Install it? (Y/n): " install_gh
if [[ "$install_gh" =~ ^[Yy]|^$ ]]; then
brew install gh || exit 1
GH_VERSION=$(gh --version | head -n 1)
echo "✅ gh is installed ($GH_VERSION)"
gh auth status || gh auth login -w -p https
fi
else
GH_VERSION=$(gh --version | head -n 1)
echo "✅ gh is installed ($GH_VERSION)"
fi
# Install language runtimes via mise
if ! command -v node &>/dev/null; then
echo "📦 Installing Node.js via mise..."
mise install node@20.20.0 || exit 1
mise use --global node@20.20.0 || exit 1
eval "$(mise activate bash)"
NODE_VERSION=$(node --version)
echo "✅ Node.js is installed ($NODE_VERSION)"
else
NODE_VERSION=$(node --version)
echo "✅ Node.js is installed ($NODE_VERSION)"
fi
if [[ $(node --version) != "v20.20.0" ]]; then
NODE_VERSION=$(node --version)
echo "🚨 You have the wrong version of node installed ($NODE_VERSION)."
echo "💡 If you are using nvm then run 'nvm install' to install the version specified by the repo's .nvmrc."
exit 1
fi
if ! command -v python &>/dev/null; then
echo "📦 Installing Python via mise..."
mise install python@3.13.2 || exit 1
mise use --global python@3.13.2 || exit 1
eval "$(mise activate bash)"
PYTHON_VERSION=$(python --version)
echo "✅ Python is installed ($PYTHON_VERSION)"
else
PYTHON_VERSION=$(python --version)
echo "✅ Python is installed ($PYTHON_VERSION)"
fi
if ! command -v uv &>/dev/null; then
brew install uv || exit 1
UV_VERSION=$(uv --version)
echo "✅ uv is installed ($UV_VERSION)"
else
UV_VERSION=$(uv --version)
echo "✅ uv is installed ($UV_VERSION)"
fi
if ! command -v go &>/dev/null; then
echo "📦 Installing Go via mise..."
mise install go@1.24.2 || exit 1
mise use --global go@1.24.2 || exit 1
eval "$(mise activate bash)"
GO_VERSION=$(go version)
echo "✅ Go is installed ($GO_VERSION)"
else
GO_VERSION=$(go version)
echo "✅ Go is installed ($GO_VERSION)"
fi
if ! command -v rustc &>/dev/null; then
echo "📦 Installing Rust via mise..."
mise install rust@1.85.1 || exit 1
mise use --global rust@1.85.1 || exit 1
eval "$(mise activate bash)"
RUST_VERSION=$(rustc --version)
echo "✅ Rust is installed ($RUST_VERSION)"
else
RUST_VERSION=$(rustc --version)
echo "✅ Rust is installed ($RUST_VERSION)"
fi
if ! command -v javac &>/dev/null || ! javac --version &>/dev/null; then
echo "☕ Installing Java via mise..."
mise install java@openjdk-17 || exit 1
mise use --global java@openjdk-17 || exit 1
eval "$(mise activate bash)"
JAVA_VERSION=$(javac --version | head -n 1)
echo "✅ Java is installed ($JAVA_VERSION)"
else
JAVA_VERSION=$(javac --version | head -n 1)
echo "✅ Java is installed ($JAVA_VERSION)"
fi
if ! command -v pnpm &>/dev/null; then
brew install pnpm || exit 1
PNPM_VERSION=$(pnpm --version)
echo "✅ pnpm is installed ($PNPM_VERSION)"
else
PNPM_VERSION=$(pnpm --version)
echo "✅ pnpm is installed ($PNPM_VERSION)"
fi
pnpm install --silent || exit 1
if ! command -v code &>/dev/null; then
echo "⚠️ Visual Studio Code cli is not installed"
exit 1
else
VSCODE_VERSION=$(code --version | head -n 1)
echo "✅ Visual Studio Code is installed ($VSCODE_VERSION)"
fi
# To reset VSCode:
# rm -rvf ~/.vscode && rm -rvf ~/Library/Application\ Support/Code
echo -n "🔌 Installing Visual Studio Code extensions... "
code --install-extension golang.go &>/dev/null || exit 1
code --install-extension dbaeumer.vscode-eslint&>/dev/null || exit 1
code --install-extension redhat.java &>/dev/null || exit 1
code --install-extension ms-python.python&>/dev/null || exit 1
code --install-extension rust-lang.rust-analyzer &>/dev/null || exit 1
if ! code --list-extensions 2>/dev/null | grep -q "RooVeterinaryInc.roo-cline"; then
code --install-extension RooVeterinaryInc.roo-cline &>/dev/null || exit 1
fi
echo "✅ Done"
if [[ ! -d "../../../evals" ]]; then
echo -n "🔗 Cloning evals repository... "
git clone https://github.com/RooCodeInc/Roo-Code-Evals.git ../../../evals || exit 1
echo "✅ Done"
else
echo -n "🔄 Updating evals repository... "
(cd ../../../evals && \
git checkout -f &>/dev/null && \
git clean -f -d &>/dev/null && \
git checkout main &>/dev/null && \
git pull &>/dev/null) || { echo "❌ Failed to update evals repository."; exit 1; }
echo "✅ Done"
fi
if [[ ! -s .env.local ]]; then
touch .env.local || exit 1
fi
# Check and start Docker services before database operations
check_docker_services
echo -n "🗄️ Syncing Roo Code evals database... "
pnpm --filter @roo-code/evals db:push --force &>/dev/null || exit 1
echo "✅ Done"
if ! grep -q "OPENROUTER_API_KEY" .env.local; then
read -p "🔐 Enter your OpenRouter API key (sk-or-v1-...): " openrouter_api_key
echo "🔑 Validating..."
curl --silent --fail https://openrouter.ai/api/v1/key -H "Authorization: Bearer $openrouter_api_key" &>/dev/null || exit 1
echo "OPENROUTER_API_KEY=$openrouter_api_key" >> .env.local || exit 1
fi
current_version=$(code --list-extensions --show-versions 2>/dev/null | grep roo)
read -p "💻 Do you want to build a new version of the Roo Code extension? [currently $current_version] (y/N): " build_extension
if [[ "$build_extension" =~ ^[Yy]$ ]]; then
build_extension
fi
echo -e "\n🚀 You're ready to rock and roll! \n"
if ! nc -z localhost 3446; then
read -p "🌐 Would you like to start the evals web app? (Y/n): " start_evals
if [[ "$start_evals" =~ ^[Yy]|^$ ]]; then
pnpm --filter @roo-code/web-evals dev
else
echo "💡 You can start it anytime with 'pnpm --filter @roo-code/web-evals dev'."
fi
else
echo "👟 The evals web app is running at http://localhost:3446"
fi