Repository navigation
Expand file tree
/
Copy pathbootstrap.sh
More file actions
executable file
·151 lines (133 loc) · 5.35 KB
/
Copy pathbootstrap.sh
File metadata and controls
executable file
·151 lines (133 loc) · 5.35 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
#!/bin/bash
# Continuum Bootstrap — One command to install and launch.
#
# Usage (from anywhere):
# curl -fsSL https://raw.githubusercontent.com/CambrianTech/continuum/main/bootstrap.sh | bash
#
# Or with options:
# curl -fsSL ... | bash -s -- --mode=headless
# curl -fsSL ... | bash -s -- --mode=cli
# curl -fsSL ... | bash -s -- --mode=browser (default)
#
# What it does:
# 1. Clones the repo (or pulls if already cloned)
# 2. Runs install.sh (installs Node, Rust, Python ML, Postgres, system deps)
# 3. Runs npm start (builds, seeds, creates personas, opens browser)
#
# Works on: macOS (Apple Silicon), Ubuntu/Debian (x86_64), WSL2
# Windows: Use bootstrap.ps1 instead — it installs WSL2 then calls this script.
set -e
# Colors
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
BLUE='\033[0;34m'
NC='\033[0m'
# Parse arguments
MODE="browser"
INSTALL_DIR="${CONTINUUM_DIR:-$HOME/continuum}"
for arg in "$@"; do
case "$arg" in
--mode=*) MODE="${arg#*=}" ;;
--dir=*) INSTALL_DIR="${arg#*=}" ;;
--help|-h)
echo "Continuum Bootstrap"
echo ""
echo "Usage: curl -fsSL <url> | bash -s -- [options]"
echo ""
echo "Options:"
echo " --mode=browser Full web UI (default)"
echo " --mode=cli Cyberpunk terminal interface"
echo " --mode=headless No UI, server only (training towers)"
echo " --dir=PATH Install directory (default: ~/continuum)"
echo ""
exit 0
;;
esac
done
# Validate mode
case "$MODE" in
browser|cli|headless) ;;
*)
echo -e "${RED}Unknown mode: $MODE. Use browser, cli, or headless.${NC}"
exit 1
;;
esac
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${BLUE} Continuum Bootstrap${NC}"
echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo ""
echo -e " Mode: ${GREEN}${MODE}${NC}"
echo -e " Directory: ${GREEN}${INSTALL_DIR}${NC}"
echo ""
# ============================================================================
# Step 1: Ensure git is available
# ============================================================================
if ! command -v git &>/dev/null; then
echo -e "${YELLOW}Installing git...${NC}"
if command -v apt-get &>/dev/null; then
sudo apt-get update -qq && sudo apt-get install -y git
elif command -v brew &>/dev/null; then
brew install git
elif command -v dnf &>/dev/null; then
sudo dnf install -y git
else
echo -e "${RED}Cannot install git automatically. Install git and try again.${NC}"
exit 1
fi
fi
# ============================================================================
# Step 2: Clone or update repository
# ============================================================================
echo -e "${YELLOW}[1/3] Repository${NC}"
if [ -d "$INSTALL_DIR/tools/scripts/install.sh" ] || [ -f "$INSTALL_DIR/tools/scripts/install.sh" ]; then
echo -e " Existing installation found — pulling latest..."
cd "$INSTALL_DIR"
git pull --ff-only 2>/dev/null || {
echo -e " ${YELLOW}Pull failed (local changes?) — continuing with current version${NC}"
}
else
# CONTINUUM_REF env override: clone a specific ref instead of HEAD.
# Matches root install.sh's behavior — used by CI to validate PR src/.
# Without it, Windows-via-WSL installs always cloned main (same
# chicken-and-egg loop the Linux smoke had).
if [ -n "${CONTINUUM_REF:-}" ]; then
echo -e " Cloning Continuum at ref ${CONTINUUM_REF}..."
git clone --branch "$CONTINUUM_REF" --depth 1 https://github.com/CambrianTech/continuum.git "$INSTALL_DIR" 2>/dev/null \
|| (git clone https://github.com/CambrianTech/continuum.git "$INSTALL_DIR" && cd "$INSTALL_DIR" && git checkout "$CONTINUUM_REF")
else
echo -e " Cloning Continuum..."
git clone https://github.com/CambrianTech/continuum.git "$INSTALL_DIR"
fi
cd "$INSTALL_DIR"
fi
echo -e " ${GREEN}Repository ready${NC}"
# ============================================================================
# Step 3: Run install.sh
# ============================================================================
echo -e "\n${YELLOW}[2/2] Installing + launching${NC}"
cd src
# Export mode so npm start and the orchestrator can read it
export CONTINUUM_UI_MODE="$MODE"
# Tell install.sh to auto-launch after install
export CONTINUUM_AUTO_LAUNCH=1
bash scripts/install.sh
echo ""
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${GREEN} Continuum is running!${NC}"
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo ""
case "$MODE" in
browser)
echo -e " UI: ${GREEN}http://localhost:9003${NC}"
;;
cli)
echo -e " CLI: ${GREEN}./jtag${NC}"
;;
headless)
echo -e " Server: ${GREEN}http://localhost:9003${NC} (API only)"
;;
esac
echo -e " Stop: ${GREEN}cd $INSTALL_DIR/src && npm stop${NC}"
echo -e " Uninstall: ${GREEN}cd $INSTALL_DIR/src && bash scripts/uninstall.sh${NC}"
echo ""