-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.command
More file actions
executable file
·46 lines (37 loc) · 1.12 KB
/
Copy pathstart.command
File metadata and controls
executable file
·46 lines (37 loc) · 1.12 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
#!/bin/zsh
set -e
cd "$(dirname "$0")"
PORT="${DESIGN_BRIDGE_PORT:-8787}"
URL="http://127.0.0.1:${PORT}/core/canvas.html?project=default"
HEALTH="http://127.0.0.1:${PORT}/health"
if ! command -v python3 >/dev/null 2>&1; then
echo "Canvas Lab needs python3 to run the local server."
echo "Install Python 3, then double-click start.command again."
exit 1
fi
if curl -fsS "$HEALTH" >/dev/null 2>&1; then
echo "Canvas Lab is already running."
echo "Opening $URL"
open "$URL"
exit 0
fi
echo "Starting Canvas Lab..."
if ! command -v codex >/dev/null 2>&1; then
echo "Note: codex CLI was not found. The viewer still works, but Codex chat will not run until it is installed."
fi
if ! command -v claude >/dev/null 2>&1; then
echo "Note: claude CLI was not found. The viewer still works, but Claude chat will not run until it is installed."
fi
(
for _ in {1..50}; do
if curl -fsS "$HEALTH" >/dev/null 2>&1; then
echo "Opening $URL"
open "$URL"
exit 0
fi
sleep 0.2
done
echo "Server started, but the health check did not respond in time."
echo "Open manually: $URL"
) &
python3 bridge/server.py