overmind-mcp 3.2.2 → 3.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/install-overmind-native.sh +497 -145
- package/package.json +1 -1
- package/scripts/postgres-manager.mjs +91 -59
- package/scripts/postinstall.mjs +11 -0
|
@@ -1,150 +1,426 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# ============================================================
|
|
3
|
-
# install-overmind-native.sh
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
3
|
+
# install-overmind-native.sh — Installation NATIVE OverMind-MCP
|
|
4
|
+
# Multi-OS: Linux (apt/dnf/pacman) + macOS (Homebrew)
|
|
5
|
+
# Idempotent: peut être ré-exécuté sans casser l'existant.
|
|
6
|
+
# Anti-cassure: chaque step est gardé, erreurs non-fatales Continuent.
|
|
7
7
|
# ============================================================
|
|
8
8
|
|
|
9
|
-
set -
|
|
9
|
+
set -uo pipefail # PAS de set -e — on gère les erreurs manuellement
|
|
10
10
|
|
|
11
|
-
#
|
|
12
|
-
R='\033[0;31m'; G='\033[0;32m'; Y='\033[1;33m'; C='\033[0;36m'; N='\033[0m'
|
|
11
|
+
# ─── Couleurs + helpers ──────────────────────────────────────
|
|
12
|
+
R='\033[0;31m'; G='\033[0;32m'; Y='\033[1;33m'; C='\033[0;36m'; B='\033[1m'; D='\033[2m'; N='\033[0m'
|
|
13
|
+
STEPS_TOTAL=8
|
|
14
|
+
STEP=0
|
|
13
15
|
|
|
14
|
-
log()
|
|
15
|
-
ok()
|
|
16
|
-
warn()
|
|
17
|
-
|
|
16
|
+
log() { echo -e "${C}[$(date +%H:%M:%S)]${N} ${D}$*${N}"; }
|
|
17
|
+
ok() { echo -e " ${G}✓${N} $*"; }
|
|
18
|
+
warn() { echo -e " ${Y}⚠${N} $*"; }
|
|
19
|
+
fail() { echo -e " ${R}✗${N} $*"; }
|
|
20
|
+
die() { echo -e "${R}[FATAL]${N} $*"; exit 1; }
|
|
21
|
+
step() { STEP=$((STEP+1)); echo; echo -e "${B}${C}━━━ STEP $STEP/$STEPS_TOTAL — $* ━━━${N}"; }
|
|
22
|
+
have() { command -v "$1" >/dev/null 2>&1; }
|
|
18
23
|
|
|
19
|
-
#
|
|
24
|
+
# ─── Détection OS ────────────────────────────────────────────
|
|
25
|
+
OS="$(uname -s)"
|
|
26
|
+
ARCH="$(uname -m)"
|
|
27
|
+
case "$OS" in
|
|
28
|
+
Darwin) OS_NAME="macOS $ARCH";;
|
|
29
|
+
Linux) OS_NAME="Linux $ARCH";;
|
|
30
|
+
*) OS_NAME="$OS $ARCH";;
|
|
31
|
+
esac
|
|
32
|
+
echo
|
|
33
|
+
echo -e "${B}${C}╔════════════════════════════════════════════════════════════╗${N}"
|
|
34
|
+
echo -e "${B}${C}║ 🚀 OverMind-MCP — Installation NATIVE ║${N}"
|
|
35
|
+
echo -e "${B}${C}║ Multi-OS: $OS_NAME$(printf '%*s' $((24-${#OS_NAME})) '')║${N}"
|
|
36
|
+
echo -e "${B}${C}╚════════════════════════════════════════════════════════════╝${N}"
|
|
37
|
+
echo
|
|
38
|
+
|
|
39
|
+
# ─── Détection utilisateur + home ────────────────────────────
|
|
20
40
|
OM_USER="${SUDO_USER:-$(whoami)}"
|
|
21
|
-
|
|
22
|
-
if command -v getent >/dev/null 2>&1; then
|
|
41
|
+
if have getent; then
|
|
23
42
|
OM_HOME="$(getent passwd "$OM_USER" | cut -d: -f6)"
|
|
24
|
-
elif
|
|
43
|
+
elif have dscl; then
|
|
25
44
|
OM_HOME="$(dscl . -read "/Users/$OM_USER" NFSHomeDirectory | awk '{print $2}')"
|
|
26
45
|
else
|
|
27
46
|
OM_HOME="$(eval echo "~$OM_USER")"
|
|
28
47
|
fi
|
|
29
48
|
OM_DIR="$OM_HOME/.overmind"
|
|
30
49
|
LOG_DIR="$OM_DIR/logs"
|
|
50
|
+
|
|
51
|
+
# ─── Constantes ──────────────────────────────────────────────
|
|
31
52
|
PG_DB="overmind_memory"
|
|
32
53
|
PG_PORT=5432
|
|
33
54
|
MCP_PORT_CORE=3099
|
|
34
55
|
MCP_PORT_PG=5433
|
|
56
|
+
ERRORS=0
|
|
57
|
+
WARNINGS=0
|
|
35
58
|
|
|
36
|
-
|
|
37
|
-
|
|
59
|
+
track_error() { fail "$*"; ERRORS=$((ERRORS+1)); }
|
|
60
|
+
track_warn() { warn "$*"; WARNINGS=$((WARNINGS+1)); }
|
|
38
61
|
|
|
39
|
-
|
|
62
|
+
# ================================================================
|
|
63
|
+
# STEP 1/8 — Vérifications préalables (root, OS, arch)
|
|
64
|
+
# ================================================================
|
|
65
|
+
step "Vérifications préalables"
|
|
40
66
|
|
|
41
|
-
#
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
67
|
+
# Vérifier root/sudo
|
|
68
|
+
if [ "$(id -u)" -ne 0 ]; then
|
|
69
|
+
echo -e " ${Y}ℹ${N} Lancement en mode non-root — sudo requis pour certaines étapes"
|
|
70
|
+
if ! have sudo; then
|
|
71
|
+
die "sudo non disponible. Lancez en root: sudo $0"
|
|
72
|
+
fi
|
|
73
|
+
SUDO="sudo"
|
|
74
|
+
else
|
|
75
|
+
SUDO=""
|
|
76
|
+
fi
|
|
77
|
+
ok "Privilèges: OK (${OM_USER})"
|
|
49
78
|
|
|
50
|
-
#
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
79
|
+
# Vérifier OS supporté
|
|
80
|
+
if [ "$OS" != "Darwin" ] && [ "$OS" != "Linux" ]; then
|
|
81
|
+
die "OS non supporté: $OS. Utilisez le mode Docker: npm i -g overmind-mcp && overmind-postgres-mcp up"
|
|
82
|
+
fi
|
|
83
|
+
ok "OS: $OS_NAME"
|
|
84
|
+
|
|
85
|
+
# ================================================================
|
|
86
|
+
# STEP 2/8 — Node.js + npm
|
|
87
|
+
# ================================================================
|
|
88
|
+
step "Node.js + npm"
|
|
89
|
+
|
|
90
|
+
if ! have node; then
|
|
91
|
+
fail "Node.js non trouvé"
|
|
92
|
+
log "Installation automatique de Node.js LTS..."
|
|
93
|
+
if [ "$OS" = "Darwin" ]; then
|
|
94
|
+
if have brew; then
|
|
95
|
+
brew install node@24 || track_error "brew install node@24 a échoué"
|
|
96
|
+
else
|
|
97
|
+
track_error "Homebrew manquant. Installez Node: https://nodejs.org/"
|
|
98
|
+
fi
|
|
99
|
+
else
|
|
100
|
+
if have curl; then
|
|
101
|
+
curl -fsSL https://deb.nodesource.com/setup_lts.x | $SUDO -E bash - 2>/dev/null || true
|
|
102
|
+
$SUDO apt install -y nodejs 2>/dev/null || track_error "apt install nodejs a échoué"
|
|
103
|
+
else
|
|
104
|
+
track_error "curl manquant pour installer Node.js"
|
|
105
|
+
fi
|
|
106
|
+
fi
|
|
58
107
|
fi
|
|
59
|
-
ok "postgresql-18-pgvector $(dpkg -s postgresql-18-pgvector | awk '/Version:/ {print $2}')"
|
|
60
108
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
109
|
+
if have node; then
|
|
110
|
+
NODE_VER="$(node -v)"
|
|
111
|
+
NODE_MAJ="${NODE_VER#v}"
|
|
112
|
+
NODE_MAJ="${NODE_MAJ%%.*}"
|
|
113
|
+
ok "Node.js: ${NODE_VER}"
|
|
114
|
+
if [ "$NODE_MAJ" -lt 20 ]; then
|
|
115
|
+
track_error "Node >= 20 requis (vous avez ${NODE_VER})"
|
|
116
|
+
elif [ "$NODE_MAJ" -ge 25 ]; then
|
|
117
|
+
track_warn "Node ${NODE_VER} — overmind-postgres-mcp préfère Node 24"
|
|
118
|
+
if [ -d "$OM_HOME/.nvm" ]; then
|
|
119
|
+
log "Bascule nvm → Node 24..."
|
|
120
|
+
\. "$OM_HOME/.nvm/nvm.sh" 2>/dev/null || true
|
|
121
|
+
nvm install 24 2>/dev/null && nvm use 24 2>/dev/null && hash -r || true
|
|
122
|
+
ok "Node $(node -v) actif via nvm"
|
|
123
|
+
fi
|
|
124
|
+
fi
|
|
125
|
+
else
|
|
126
|
+
die "Node.js toujours manquant après tentative d'installation"
|
|
64
127
|
fi
|
|
65
|
-
ok "postgresql.service: $(systemctl is-active postgresql)"
|
|
66
128
|
|
|
67
|
-
|
|
68
|
-
|
|
129
|
+
if have npm; then
|
|
130
|
+
ok "npm: $(npm -v)"
|
|
131
|
+
else
|
|
132
|
+
die "npm non trouvé"
|
|
133
|
+
fi
|
|
134
|
+
|
|
135
|
+
# ================================================================
|
|
136
|
+
# STEP 3/8 — PostgreSQL + pgvector
|
|
137
|
+
# ================================================================
|
|
138
|
+
step "PostgreSQL + pgvector"
|
|
139
|
+
|
|
140
|
+
PG_INSTALLED=false
|
|
141
|
+
PG_SUPERUSER="postgres"
|
|
142
|
+
|
|
143
|
+
if [ "$OS" = "Darwin" ]; then
|
|
144
|
+
# ─── macOS: Homebrew ─────────────────────────────────────────
|
|
145
|
+
PG_SUPERUSER="$(whoami)"
|
|
146
|
+
|
|
147
|
+
if ! have brew; then
|
|
148
|
+
track_warn "Homebrew non trouvé — installez: https://brew.sh"
|
|
149
|
+
track_warn "Bypass: installez Docker et utilisez overmind-postgres-mcp up"
|
|
150
|
+
else
|
|
151
|
+
# PostgreSQL
|
|
152
|
+
if brew list postgresql@18 >/dev/null 2>&1; then
|
|
153
|
+
ok "postgresql@18 déjà installé"
|
|
154
|
+
else
|
|
155
|
+
log "Installation postgresql@18 via brew..."
|
|
156
|
+
brew install postgresql@18 2>/dev/null || {
|
|
157
|
+
track_warn "postgresql@18 non disponible, fallback postgresql@16"
|
|
158
|
+
brew install postgresql@16 2>/dev/null || track_error "brew install postgresql a échoué"
|
|
159
|
+
}
|
|
160
|
+
fi
|
|
161
|
+
|
|
162
|
+
# pgvector
|
|
163
|
+
if brew list pgvector >/dev/null 2>&1; then
|
|
164
|
+
ok "pgvector déjà installé"
|
|
165
|
+
else
|
|
166
|
+
log "Installation pgvector via brew..."
|
|
167
|
+
brew install pgvector 2>/dev/null || track_warn "pgvector non disponible via brew — installez manuellement"
|
|
168
|
+
fi
|
|
169
|
+
|
|
170
|
+
# Démarrer le service
|
|
171
|
+
brew services start postgresql@18 2>/dev/null || brew services start postgresql@16 2>/dev/null || true
|
|
172
|
+
sleep 3
|
|
173
|
+
PG_INSTALLED=true
|
|
174
|
+
ok "Service PostgreSQL démarré via brew"
|
|
175
|
+
fi
|
|
176
|
+
|
|
177
|
+
elif [ "$OS" = "Linux" ]; then
|
|
178
|
+
# ─── Linux: apt / dnf / pacman ──────────────────────────────
|
|
179
|
+
if have apt; then
|
|
180
|
+
log "Gestionnaire: apt (Debian/Ubuntu)"
|
|
181
|
+
$SUDO apt update -qq 2>/dev/null || true
|
|
182
|
+
if dpkg -l 2>/dev/null | grep -q 'postgresql.*18.*pgvector'; then
|
|
183
|
+
ok "postgresql-18-pgvector déjà installé"
|
|
184
|
+
PG_INSTALLED=true
|
|
185
|
+
else
|
|
186
|
+
log "Installation postgresql + pgvector..."
|
|
187
|
+
DEBIAN_FRONTEND=noninteractive $SUDO apt install -y postgresql postgresql-contrib 2>/dev/null || track_error "apt install postgresql"
|
|
188
|
+
# pgvector (peut nécessiter un PPA)
|
|
189
|
+
DEBIAN_FRONTEND=noninteractive $SUDO apt install -y postgresql-18-pgvector 2>/dev/null || {
|
|
190
|
+
track_warn "postgresql-18-pgvector non disponible via apt"
|
|
191
|
+
log "Tentative compilation pgvector depuis source..."
|
|
192
|
+
$SUDO apt install -y build-essential postgresql-server-dev-all git 2>/dev/null || true
|
|
193
|
+
(
|
|
194
|
+
cd /tmp && git clone --depth 1 https://github.com/pgvector/pgvector.git 2>/dev/null && \
|
|
195
|
+
cd pgvector && make 2>/dev/null && $SUDO make install 2>/dev/null
|
|
196
|
+
) || track_warn "Compilation pgvector échouée — voir docs"
|
|
197
|
+
}
|
|
198
|
+
PG_INSTALLED=true
|
|
199
|
+
fi
|
|
200
|
+
|
|
201
|
+
elif have dnf; then
|
|
202
|
+
log "Gestionnaire: dnf (Fedora/RHEL)"
|
|
203
|
+
$SUDO dnf install -y postgresql-server postgresql-contrib 2>/dev/null || track_error "dnf install postgresql"
|
|
204
|
+
$SUDO postgresql-setup --initdb 2>/dev/null || true
|
|
205
|
+
PG_INSTALLED=true
|
|
206
|
+
# pgvector
|
|
207
|
+
$SUDO dnf install -y pgvector 2>/dev/null || track_warn "pgvector non disponible via dnf"
|
|
208
|
+
|
|
209
|
+
elif have pacman; then
|
|
210
|
+
log "Gestionnaire: pacman (Arch)"
|
|
211
|
+
$SUDO pacman -S --noconfirm postgresql 2>/dev/null || track_error "pacman install postgresql"
|
|
212
|
+
$SUDO pacman -S --noconfirm pgvector 2>/dev/null || track_warn "pgvector non disponible via pacman"
|
|
213
|
+
$SUDO su - postgres -c "initdb -D /var/lib/postgres/data" 2>/dev/null || true
|
|
214
|
+
PG_INSTALLED=true
|
|
215
|
+
|
|
216
|
+
elif have apk; then
|
|
217
|
+
log "Gestionnaire: apk (Alpine)"
|
|
218
|
+
$SUDO apk add postgresql postgresql-contrib 2>/dev/null || track_error "apk install postgresql"
|
|
219
|
+
PG_INSTALLED=true
|
|
220
|
+
|
|
221
|
+
else
|
|
222
|
+
track_error "Gestionnaire de paquets non supporté. Installez PostgreSQL manuellement."
|
|
223
|
+
fi
|
|
224
|
+
|
|
225
|
+
# Service systemd
|
|
226
|
+
if have systemctl; then
|
|
227
|
+
if ! $SUDO systemctl is-active --quiet postgresql 2>/dev/null; then
|
|
228
|
+
log "Démarrage postgresql.service..."
|
|
229
|
+
$SUDO systemctl enable --now postgresql 2>/dev/null || track_warn "systemctl start postgresql"
|
|
230
|
+
sleep 2
|
|
231
|
+
fi
|
|
232
|
+
ok "postgresql.service: $($SUDO systemctl is-active postgresql 2>/dev/null || echo '?')"
|
|
233
|
+
fi
|
|
234
|
+
fi
|
|
235
|
+
|
|
236
|
+
# ================================================================
|
|
237
|
+
# STEP 4/8 — Base de données + extension pgvector
|
|
238
|
+
# ================================================================
|
|
239
|
+
step "Base de données + pgvector"
|
|
240
|
+
|
|
241
|
+
if [ "$PG_INSTALLED" = "true" ]; then
|
|
242
|
+
sleep 2 # Laisser PG démarrer
|
|
243
|
+
|
|
244
|
+
# Créer la DB si elle n'existe pas
|
|
245
|
+
DB_EXISTS=false
|
|
246
|
+
if [ "$OS" = "Darwin" ]; then
|
|
247
|
+
if psql -U "$PG_SUPERUSER" -d postgres -tAc "SELECT 1 FROM pg_database WHERE datname='$PG_DB'" 2>/dev/null | grep -q 1; then
|
|
248
|
+
DB_EXISTS=true
|
|
249
|
+
fi
|
|
250
|
+
else
|
|
251
|
+
if $SUDO -u postgres psql -tAc "SELECT 1 FROM pg_database WHERE datname='$PG_DB'" 2>/dev/null | grep -q 1; then
|
|
252
|
+
DB_EXISTS=true
|
|
253
|
+
fi
|
|
254
|
+
fi
|
|
255
|
+
|
|
256
|
+
if [ "$DB_EXISTS" = "false" ]; then
|
|
69
257
|
log "Création DB $PG_DB..."
|
|
70
|
-
|
|
258
|
+
if [ "$OS" = "Darwin" ]; then
|
|
259
|
+
createdb -U "$PG_SUPERUSER" "$PG_DB" 2>/dev/null || track_warn "createdb échoué"
|
|
260
|
+
else
|
|
261
|
+
$SUDO -u postgres createdb "$PG_DB" 2>/dev/null || track_warn "createdb échoué"
|
|
262
|
+
fi
|
|
263
|
+
else
|
|
264
|
+
ok "DB $PG_DB existe déjà"
|
|
265
|
+
fi
|
|
266
|
+
|
|
267
|
+
# Activer pgvector
|
|
268
|
+
if [ "$OS" = "Darwin" ]; then
|
|
269
|
+
psql -U "$PG_SUPERUSER" -d "$PG_DB" -c "CREATE EXTENSION IF NOT EXISTS vector;" >/dev/null 2>&1 || track_warn "CREATE EXTENSION vector échoué"
|
|
270
|
+
PGV="$(psql -U "$PG_SUPERUSER" -d "$PG_DB" -tAc "SELECT extversion FROM pg_extension WHERE extname='vector'" 2>/dev/null || echo '?')"
|
|
271
|
+
else
|
|
272
|
+
$SUDO -u postgres psql -d "$PG_DB" -c "CREATE EXTENSION IF NOT EXISTS vector;" >/dev/null 2>&1 || track_warn "CREATE EXTENSION vector échoué"
|
|
273
|
+
PGV="$($SUDO -u postgres psql -d "$PG_DB" -tAc "SELECT extversion FROM pg_extension WHERE extname='vector'" 2>/dev/null || echo '?')"
|
|
274
|
+
fi
|
|
275
|
+
|
|
276
|
+
if [ "$PGV" != "?" ]; then
|
|
277
|
+
ok "pgvector v${PGV} activé sur $PG_DB"
|
|
278
|
+
else
|
|
279
|
+
track_warn "pgvector non détecté — extension vector peut nécessiter une installation manuelle"
|
|
280
|
+
fi
|
|
281
|
+
|
|
282
|
+
# Tester la connexion
|
|
283
|
+
if [ "$OS" = "Darwin" ]; then
|
|
284
|
+
if psql -U "$PG_SUPERUSER" -d "$PG_DB" -c "SELECT 1" >/dev/null 2>&1; then
|
|
285
|
+
ok "Connexion PostgreSQL: OK (user=$PG_SUPERUSER)"
|
|
286
|
+
else
|
|
287
|
+
track_warn "Connexion PostgreSQL échouée en local"
|
|
288
|
+
fi
|
|
289
|
+
else
|
|
290
|
+
if $SUDO -u postgres psql -d "$PG_DB" -c "SELECT 1" >/dev/null 2>&1; then
|
|
291
|
+
ok "Connexion PostgreSQL: OK (user=postgres)"
|
|
292
|
+
else
|
|
293
|
+
track_warn "Connexion PostgreSQL échouée"
|
|
294
|
+
fi
|
|
295
|
+
fi
|
|
296
|
+
else
|
|
297
|
+
track_warn "PostgreSQL non installé — utilisez Docker: overmind-postgres-mcp up"
|
|
71
298
|
fi
|
|
72
|
-
sudo -u postgres psql -d "$PG_DB" -c "CREATE EXTENSION IF NOT EXISTS vector;" >/dev/null
|
|
73
|
-
PGV=$(sudo -u postgres psql -d "$PG_DB" -tAc "SELECT extversion FROM pg_extension WHERE extname='vector'")
|
|
74
|
-
ok "DB $PG_DB prête, pgvector v$PGV"
|
|
75
299
|
|
|
76
|
-
#
|
|
77
|
-
# STEP
|
|
78
|
-
#
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
300
|
+
# ================================================================
|
|
301
|
+
# STEP 5/8 — Packages npm globaux
|
|
302
|
+
# ================================================================
|
|
303
|
+
step "Packages npm globaux"
|
|
304
|
+
|
|
305
|
+
log "Vérification overmind-mcp..."
|
|
306
|
+
if npm list -g overmind-mcp >/dev/null 2>&1; then
|
|
307
|
+
ok "overmind-mcp: $(npm list -g overmind-mcp --depth=0 2>/dev/null | grep overmind-mcp | head -1 | awk -F@ '{print $NF}')"
|
|
308
|
+
else
|
|
309
|
+
log "Installation overmind-mcp..."
|
|
310
|
+
$SUDO npm install -g overmind-mcp@latest 2>/dev/null || npm install -g overmind-mcp@latest 2>/dev/null || track_error "npm install overmind-mcp"
|
|
82
311
|
fi
|
|
83
|
-
|
|
84
|
-
|
|
312
|
+
|
|
313
|
+
log "Vérification overmind-postgres-mcp..."
|
|
314
|
+
if npm list -g overmind-postgres-mcp >/dev/null 2>&1; then
|
|
315
|
+
ok "overmind-postgres-mcp: installé"
|
|
316
|
+
else
|
|
317
|
+
log "Installation overmind-postgres-mcp..."
|
|
318
|
+
$SUDO npm install -g overmind-postgres-mcp@latest 2>/dev/null || npm install -g overmind-postgres-mcp@latest 2>/dev/null || track_warn "overmind-postgres-mcp (non bloquant)"
|
|
85
319
|
fi
|
|
86
|
-
ok "overmind-mcp $(npm list -g overmind-mcp --depth=0 | awk '/overmind-mcp@/ {print $2}')"
|
|
87
|
-
ok "overmind-postgres-mcp $(npm list -g overmind-postgres-mcp --depth=0 | awk '/overmind-postgres-mcp@/ {print $2}')"
|
|
88
320
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
#
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
321
|
+
ok "Packages npm globaux: vérifiés"
|
|
322
|
+
|
|
323
|
+
# ================================================================
|
|
324
|
+
# STEP 6/8 — Arborescence ~/.overmind/ + .env
|
|
325
|
+
# ================================================================
|
|
326
|
+
step "Arborescence ~/.overmind/"
|
|
95
327
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
cat > "$OM_DIR/.env" <<'EOF'
|
|
99
|
-
# OverMind - Configuration principale (mode natif sans Docker)
|
|
328
|
+
mkdir -p "$OM_DIR/logs" "$OM_DIR/config" "$OM_DIR/bridge/wrappers" 2>/dev/null || true
|
|
329
|
+
ok "Dossiers créés: $OM_DIR"
|
|
100
330
|
|
|
101
|
-
#
|
|
331
|
+
# .env
|
|
332
|
+
ENV_FILE="$OM_DIR/.env"
|
|
333
|
+
ENV_PASSWORD=""
|
|
334
|
+
if [ ! -f "$ENV_FILE" ]; then
|
|
335
|
+
log "Création .env avec password aléatoire..."
|
|
336
|
+
ENV_PASSWORD="$(openssl rand -base64 24 | tr -d '/+=' | head -c 24 2>/dev/null || echo 'overmind_temp_'$RANDOM)"
|
|
337
|
+
cat > "$ENV_FILE" <<ENVEOF
|
|
338
|
+
# OverMind-MCP — Configuration (mode natif)
|
|
339
|
+
# Généré le $(date)
|
|
340
|
+
|
|
341
|
+
# ─── PostgreSQL ───
|
|
102
342
|
POSTGRES_HOST=127.0.0.1
|
|
103
|
-
POSTGRES_PORT
|
|
104
|
-
POSTGRES_USER
|
|
105
|
-
POSTGRES_PASSWORD
|
|
106
|
-
POSTGRES_DATABASE
|
|
343
|
+
POSTGRES_PORT=${PG_PORT}
|
|
344
|
+
POSTGRES_USER=${PG_SUPERUSER}
|
|
345
|
+
POSTGRES_PASSWORD=${ENV_PASSWORD}
|
|
346
|
+
POSTGRES_DATABASE=${PG_DB}
|
|
107
347
|
POSTGRES_SSL=false
|
|
108
|
-
POSTGRES_MAX_CONNECTIONS=10
|
|
109
|
-
|
|
110
|
-
# --- Provider LLM par défaut ---
|
|
111
|
-
OVERMIND_DEFAULT_PROVIDER=anthropic
|
|
112
348
|
|
|
113
|
-
#
|
|
349
|
+
# ─── OverMind Core ───
|
|
350
|
+
OVERMIND_WORKSPACE=${OM_DIR}
|
|
114
351
|
OVERMIND_MEMORY_TYPE=postgres
|
|
115
|
-
|
|
352
|
+
OVERMIND_LOG_LEVEL=info
|
|
353
|
+
|
|
354
|
+
# ─── Ports MCP ───
|
|
355
|
+
MEMORY_HTTP_PORT=${MCP_PORT_CORE}
|
|
116
356
|
OVERMIND_HTTP_MODE=false
|
|
117
|
-
OVERMIND_HTTP_PORT
|
|
357
|
+
OVERMIND_HTTP_PORT=${MCP_PORT_CORE}
|
|
118
358
|
|
|
119
|
-
#
|
|
359
|
+
# ─── Embeddings (Qwen 8B, 4096D) ───
|
|
120
360
|
OVERMIND_EMBEDDING_DIMENSIONS=4096
|
|
121
361
|
OVERMIND_EMBEDDING_MODEL=qwen/qwen3-embedding-8b
|
|
122
|
-
OVERMIND_EMBEDDING_URL=https://openrouter.ai/api/v1
|
|
362
|
+
# OVERMIND_EMBEDDING_URL=https://openrouter.ai/api/v1
|
|
123
363
|
# OVERMIND_EMBEDDING_KEY=sk-or-...
|
|
124
364
|
|
|
125
|
-
#
|
|
365
|
+
# ─── Clés LLM (à remplir) ───
|
|
126
366
|
# ANTHROPIC_AUTH_TOKEN=...
|
|
127
367
|
# ANTHROPIC_BASE_URL=https://api.anthropic.com
|
|
128
368
|
# ANTHROPIC_MODEL=claude-sonnet-4-6
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
chown "$OM_USER:$OM_USER" "$OM_DIR/.env"
|
|
134
|
-
chmod 600 "$OM_DIR/.env"
|
|
135
|
-
warn "Éditer $OM_DIR/.env et remplir POSTGRES_PASSWORD + clés LLM"
|
|
369
|
+
ENVEOF
|
|
370
|
+
chmod 600 "$ENV_FILE" 2>/dev/null || true
|
|
371
|
+
ok ".env créé avec password aléatoire"
|
|
372
|
+
warn "⚠️ POSTGRES_PASSWORD stocké dans $ENV_FILE"
|
|
136
373
|
else
|
|
137
|
-
|
|
374
|
+
ok ".env existant conservé"
|
|
375
|
+
ENV_PASSWORD="$(grep '^POSTGRES_PASSWORD=' "$ENV_FILE" | cut -d= -f2-)"
|
|
376
|
+
if [ -z "$ENV_PASSWORD" ] || echo "$ENV_PASSWORD" | grep -qi 'change'; then
|
|
377
|
+
track_warn "POSTGRES_PASSWORD vide ou 'change_me' dans .env"
|
|
378
|
+
fi
|
|
138
379
|
fi
|
|
139
380
|
|
|
140
|
-
#
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
log "
|
|
381
|
+
# .mcp.json (minimal si absent)
|
|
382
|
+
MCP_FILE="$OM_DIR/.mcp.json"
|
|
383
|
+
if [ ! -f "$MCP_FILE" ]; then
|
|
384
|
+
log "Création .mcp.json..."
|
|
385
|
+
cat > "$MCP_FILE" <<MCPEOF
|
|
386
|
+
{
|
|
387
|
+
"mcpServers": {
|
|
388
|
+
"memory": {
|
|
389
|
+
"transport": "httpStream",
|
|
390
|
+
"url": "http://localhost:${MCP_PORT_CORE}/mcp"
|
|
391
|
+
},
|
|
392
|
+
"postgres": {
|
|
393
|
+
"transport": "httpStream",
|
|
394
|
+
"url": "http://localhost:${MCP_PORT_PG}/mcp"
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
MCPEOF
|
|
399
|
+
ok ".mcp.json créé"
|
|
400
|
+
else
|
|
401
|
+
ok ".mcp.json existant"
|
|
402
|
+
fi
|
|
403
|
+
|
|
404
|
+
# Permissions
|
|
405
|
+
if [ "$OS" = "Darwin" ]; then
|
|
406
|
+
chown -R "$OM_USER:staff" "$OM_DIR" 2>/dev/null || true
|
|
407
|
+
else
|
|
408
|
+
chown -R "$OM_USER:$OM_USER" "$OM_DIR" 2>/dev/null || true
|
|
409
|
+
fi
|
|
144
410
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
411
|
+
# ================================================================
|
|
412
|
+
# STEP 7/8 — Services système (systemd / launchd)
|
|
413
|
+
# ================================================================
|
|
414
|
+
step "Services système"
|
|
415
|
+
|
|
416
|
+
if [ "$OS" = "Linux" ] && have systemctl; then
|
|
417
|
+
# ─── Linux: systemd units ───────────────────────────────────
|
|
418
|
+
NODE_BIN="$(which node)"
|
|
419
|
+
NPM_GLOBAL="$(npm root -g 2>/dev/null || echo /usr/lib/node_modules)"
|
|
420
|
+
|
|
421
|
+
write_unit() {
|
|
422
|
+
local name="$1" entry="$2"
|
|
423
|
+
cat > "/etc/systemd/system/$name" <<UNIT
|
|
148
424
|
[Unit]
|
|
149
425
|
Description=$name (OverMind)
|
|
150
426
|
After=network-online.target postgresql.service
|
|
@@ -157,71 +433,147 @@ User=$OM_USER
|
|
|
157
433
|
Group=$OM_USER
|
|
158
434
|
WorkingDirectory=$OM_DIR
|
|
159
435
|
EnvironmentFile=$OM_DIR/.env
|
|
160
|
-
ExecStart
|
|
436
|
+
ExecStart=$NODE_BIN --max-old-space-size=256 --no-warnings $entry
|
|
161
437
|
Restart=on-failure
|
|
162
438
|
RestartSec=5
|
|
163
|
-
StandardOutput=append:$LOG_DIR/$name.log
|
|
164
|
-
StandardError=append:$LOG_DIR/$name.err
|
|
439
|
+
StandardOutput=append:$LOG_DIR/${name%.service}.log
|
|
440
|
+
StandardError=append:$LOG_DIR/${name%.service}.err
|
|
165
441
|
|
|
166
442
|
[Install]
|
|
167
443
|
WantedBy=multi-user.target
|
|
168
|
-
|
|
169
|
-
|
|
444
|
+
UNIT
|
|
445
|
+
ok "Unit $name écrit"
|
|
446
|
+
}
|
|
170
447
|
|
|
171
|
-
write_unit "overmind-mcp.service"
|
|
172
|
-
"/
|
|
448
|
+
write_unit "overmind-mcp.service" \
|
|
449
|
+
"$NPM_GLOBAL/overmind-mcp/dist/bin/cli.js --transport httpStream --port $MCP_PORT_CORE"
|
|
173
450
|
|
|
174
|
-
|
|
175
|
-
"
|
|
451
|
+
if npm list -g overmind-postgres-mcp >/dev/null 2>&1; then
|
|
452
|
+
write_unit "overmind-postgres-mcp.service" \
|
|
453
|
+
"$NPM_GLOBAL/overmind-postgres-mcp/dist/index.js"
|
|
454
|
+
fi
|
|
176
455
|
|
|
177
|
-
systemctl daemon-reload
|
|
178
|
-
systemctl enable --now overmind-mcp.service overmind-
|
|
179
|
-
ok "
|
|
456
|
+
$SUDO systemctl daemon-reload
|
|
457
|
+
$SUDO systemctl enable --now overmind-mcp.service 2>/dev/null || track_warn "systemctl enable overmind-mcp"
|
|
458
|
+
ok "overmind-mcp.service: $($SUDO systemctl is-active overmind-mcp.service 2>/dev/null || echo '?')"
|
|
180
459
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
460
|
+
if npm list -g overmind-postgres-mcp >/dev/null 2>&1; then
|
|
461
|
+
$SUDO systemctl enable --now overmind-postgres-mcp.service 2>/dev/null || track_warn "systemctl enable overmind-postgres-mcp"
|
|
462
|
+
ok "overmind-postgres-mcp.service: $($SUDO systemctl is-active overmind-postgres-mcp.service 2>/dev/null || echo '?')"
|
|
463
|
+
fi
|
|
464
|
+
|
|
465
|
+
elif [ "$OS" = "Darwin" ]; then
|
|
466
|
+
# ─── macOS: launchd plist ───────────────────────────────────
|
|
467
|
+
NODE_BIN="$(which node)"
|
|
468
|
+
NPM_GLOBAL="$(npm root -g 2>/dev/null || echo /usr/local/lib/node_modules)"
|
|
469
|
+
LAUNCH_DIR="$OM_HOME/Library/LaunchAgents"
|
|
470
|
+
mkdir -p "$LAUNCH_DIR" 2>/dev/null || true
|
|
471
|
+
|
|
472
|
+
write_plist() {
|
|
473
|
+
local name="$1" entry="$2" port="$3"
|
|
474
|
+
local plist="$LAUNCH_DIR/com.overmind.${name}.plist"
|
|
475
|
+
cat > "$plist" <<PLIST
|
|
476
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
477
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
478
|
+
<plist version="1.0">
|
|
479
|
+
<dict>
|
|
480
|
+
<key>Label</key><string>com.overmind.${name}</string>
|
|
481
|
+
<key>ProgramArguments</key>
|
|
482
|
+
<array>
|
|
483
|
+
<string>${NODE_BIN}</string>
|
|
484
|
+
<string>--max-old-space-size=256</string>
|
|
485
|
+
<string>--no-warnings</string>
|
|
486
|
+
<string>${entry}</string>
|
|
487
|
+
<string>--transport</string>
|
|
488
|
+
<string>httpStream</string>
|
|
489
|
+
<string>--port</string>
|
|
490
|
+
<string>${port}</string>
|
|
491
|
+
</array>
|
|
492
|
+
<key>WorkingDirectory</key><string>${OM_DIR}</string>
|
|
493
|
+
<key>EnvironmentVariables</key>
|
|
494
|
+
<dict>
|
|
495
|
+
<key>HOME</key><string>${OM_HOME}</string>
|
|
496
|
+
</dict>
|
|
497
|
+
<key>KeepAlive</key><dict><key>SuccessfulExit</key><false/></dict>
|
|
498
|
+
<key>StandardOutPath</key><string>${LOG_DIR}/${name}.log</string>
|
|
499
|
+
<key>StandardErrorPath</key><string>${LOG_DIR}/${name}.err</string>
|
|
500
|
+
</dict>
|
|
501
|
+
</plist>
|
|
502
|
+
PLIST
|
|
503
|
+
launchctl bootout gui/$(id -u) "$plist" 2>/dev/null || true
|
|
504
|
+
launchctl bootstrap gui/$(id -u) "$plist" 2>/dev/null || true
|
|
505
|
+
ok "launchd: com.overmind.${name} chargé"
|
|
506
|
+
}
|
|
201
507
|
|
|
202
|
-
|
|
203
|
-
|
|
508
|
+
write_plist "overmind-mcp" \
|
|
509
|
+
"$NPM_GLOBAL/overmind-mcp/dist/bin/cli.js" "$MCP_PORT_CORE"
|
|
510
|
+
|
|
511
|
+
if npm list -g overmind-postgres-mcp >/dev/null 2>&1; then
|
|
512
|
+
write_plist "overmind-postgres-mcp" \
|
|
513
|
+
"$NPM_GLOBAL/overmind-postgres-mcp/dist/index.js" "$MCP_PORT_PG"
|
|
514
|
+
fi
|
|
204
515
|
|
|
205
|
-
# Test SQL direct
|
|
206
|
-
if sudo -u postgres psql -d "$PG_DB" -c "SELECT 1" >/dev/null 2>&1; then
|
|
207
|
-
ok "PostgreSQL $PG_DB accessible en local"
|
|
208
516
|
else
|
|
209
|
-
|
|
517
|
+
warn "OS non Linux/macOS — pas de service système. Démarrez manuellement:"
|
|
518
|
+
echo " node $NPM_GLOBAL/overmind-mcp/dist/bin/cli.js --transport httpStream --port $MCP_PORT_CORE"
|
|
210
519
|
fi
|
|
211
520
|
|
|
521
|
+
# ================================================================
|
|
522
|
+
# STEP 8/8 — Validation finale
|
|
523
|
+
# ================================================================
|
|
524
|
+
step "Validation finale"
|
|
525
|
+
|
|
526
|
+
sleep 3 # Laisser les services démarrer
|
|
527
|
+
|
|
528
|
+
# Test MCP :3099
|
|
529
|
+
MCP_CODE="$(curl -s -o /dev/null -w '%{http_code}' -m 5 \
|
|
530
|
+
-H 'Content-Type: application/json' \
|
|
531
|
+
-X POST "http://127.0.0.1:$MCP_PORT_CORE/mcp" \
|
|
532
|
+
-d '{"jsonrpc":"2.0","method":"ping","params":{}}' 2>/dev/null || echo '000')"
|
|
533
|
+
if [ "$MCP_CODE" = "200" ] || [ "$MCP_CODE" = "202" ]; then
|
|
534
|
+
ok "OverMind MCP :${MCP_PORT_CORE} → HTTP ${MCP_CODE}"
|
|
535
|
+
else
|
|
536
|
+
track_warn "OverMind MCP :${MCP_PORT_CORE} → HTTP ${MCP_CODE} (peut nécessiter un redémarrage)"
|
|
537
|
+
fi
|
|
538
|
+
|
|
539
|
+
# Test PostgreSQL
|
|
540
|
+
if [ "$OS" = "Darwin" ]; then
|
|
541
|
+
PG_TEST="$(psql -U "$PG_SUPERUSER" -d "$PG_DB" -tAc 'SELECT 1' 2>/dev/null || echo '0')"
|
|
542
|
+
else
|
|
543
|
+
PG_TEST="$($SUDO -u postgres psql -d "$PG_DB" -tAc 'SELECT 1' 2>/dev/null || echo '0')"
|
|
544
|
+
fi
|
|
545
|
+
if [ "$PG_TEST" = "1" ]; then
|
|
546
|
+
ok "PostgreSQL DB '$PG_DB' → accessible"
|
|
547
|
+
else
|
|
548
|
+
track_warn "PostgreSQL DB '$PG_DB' → connexion échouée"
|
|
549
|
+
fi
|
|
550
|
+
|
|
551
|
+
# ─── Résumé ──────────────────────────────────────────────────
|
|
552
|
+
echo
|
|
553
|
+
echo -e "${B}═══════════════════════════════════════════════════════════════${N}"
|
|
554
|
+
if [ "$ERRORS" -eq 0 ]; then
|
|
555
|
+
echo -e "${G}${B} ✅ Installation terminée${N} (${WARNINGS} warning(s))"
|
|
556
|
+
else
|
|
557
|
+
echo -e "${Y}${B} ⚠️ Installation terminée avec ${ERRORS} erreur(s)${N}"
|
|
558
|
+
fi
|
|
559
|
+
echo -e "${B}═══════════════════════════════════════════════════════════════${N}"
|
|
212
560
|
echo
|
|
213
|
-
echo -e "
|
|
214
|
-
echo -e "${
|
|
215
|
-
echo -e "${
|
|
561
|
+
echo -e "Endpoints (loopback):"
|
|
562
|
+
echo -e " ${C}OverMind MCP${N} → http://127.0.0.1:${MCP_PORT_CORE}"
|
|
563
|
+
echo -e " ${C}OverMind PostgreSQL MCP${N} → http://127.0.0.1:${MCP_PORT_PG}"
|
|
216
564
|
echo
|
|
217
|
-
echo "
|
|
218
|
-
echo "
|
|
219
|
-
echo "
|
|
565
|
+
echo -e "Fichiers de config:"
|
|
566
|
+
echo -e " ${D}.env${N} $ENV_FILE"
|
|
567
|
+
echo -e " ${D}.mcp.json${N} $MCP_FILE"
|
|
568
|
+
echo -e " ${D}logs/${N} $LOG_DIR/"
|
|
220
569
|
echo
|
|
221
|
-
|
|
222
|
-
echo "
|
|
570
|
+
if [ -n "$ENV_PASSWORD" ] && [ "$ENV_PASSWORD" != "" ]; then
|
|
571
|
+
echo -e "${Y}⚠️ POSTGRES_PASSWORD généré automatiquement${N}"
|
|
572
|
+
echo -e " Il est stocké dans $ENV_FILE"
|
|
573
|
+
echo -e " Sauvegardez-le dans Keychain/1Password maintenant."
|
|
574
|
+
echo
|
|
575
|
+
fi
|
|
576
|
+
echo -e "Actions restantes:"
|
|
577
|
+
echo -e " 1. Éditer ${C}$ENV_FILE${N} et remplir les clés LLM"
|
|
578
|
+
echo -e " 2. Redémarrer les services (${D}systemctl restart overmind-*${N} ou ${D}launchctl kickstart ${N})"
|
|
223
579
|
echo
|
|
224
|
-
echo "Actions manuelles restantes :"
|
|
225
|
-
echo " 1. Éditer $OM_DIR/.env et remplir POSTGRES_PASSWORD + clés LLM"
|
|
226
|
-
echo " 2. sudo systemctl restart overmind-mcp overmind-postgres-mcp"
|
|
227
|
-
echo " 3. (Optionnel) Créer un user Postgres dédié et restreindre pg_hba.conf"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "overmind-mcp",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.4",
|
|
4
4
|
"description": "Orchestrateur universel agents IA multi-modeles via MCP. Inclut le protocole 'Custom-Nickname' pour identifier vos agents avec des surnoms originaux (The Chaos Prophet, Shadow Sniper, etc.), l'isolation mémoire (Private Memory Context) et le support pour QwenCli et Nous Hermes. Installation automatique des dépendances Docker (PostgreSQL, pgvector) inclus.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
1
|
+
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
3
|
* ═══════════════════════════════════════════════════════════════════════════════
|
|
4
4
|
* POSTGRES-MANAGER - Gestion PostgreSQL OverMind
|
|
@@ -15,16 +15,21 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { execSync } from 'child_process';
|
|
18
|
-
import { existsSync } from 'fs';
|
|
18
|
+
import { existsSync, readFileSync } from 'fs';
|
|
19
19
|
import { join } from 'path';
|
|
20
20
|
import { fileURLToPath } from 'url';
|
|
21
21
|
import { dirname } from 'path';
|
|
22
|
+
import { randomBytes } from 'crypto';
|
|
22
23
|
|
|
23
24
|
const __filename = fileURLToPath(import.meta.url);
|
|
24
25
|
const __dirname = dirname(__filename);
|
|
25
26
|
|
|
26
27
|
const PROJECT_ROOT = join(__dirname, '..');
|
|
27
|
-
const
|
|
28
|
+
const OVERMIND_DIR = join(
|
|
29
|
+
process.env.HOME || process.env.USERPROFILE || process.env.HOMEPATH || '',
|
|
30
|
+
'.overmind'
|
|
31
|
+
);
|
|
32
|
+
const ENV_FILE = join(OVERMIND_DIR, '.env');
|
|
28
33
|
|
|
29
34
|
// ═══════════════════════════════════════════════════════════════════════════════
|
|
30
35
|
// UTILS
|
|
@@ -48,67 +53,104 @@ function runCommand(cmd, options = {}) {
|
|
|
48
53
|
// COMMANDS
|
|
49
54
|
// ═══════════════════════════════════════════════════════════════════════════════
|
|
50
55
|
|
|
56
|
+
function getEnvVar(name) {
|
|
57
|
+
if (!existsSync(ENV_FILE)) return null;
|
|
58
|
+
const content = readFileSync(ENV_FILE, 'utf8');
|
|
59
|
+
const match = content.match(new RegExp(`^${name}=(.+)$`, 'm'));
|
|
60
|
+
return match ? match[1].trim() : null;
|
|
61
|
+
}
|
|
62
|
+
|
|
51
63
|
function commandUp() {
|
|
52
64
|
logSection('DÉMARRAGE POSTGRESQL OVERMIND');
|
|
53
65
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
66
|
+
// Check si PG est déjà en cours
|
|
67
|
+
const running = runCommand('docker ps --filter "name=overmind-postgres" --format "{{.Names}}"', { stdio: 'pipe' });
|
|
68
|
+
if (running && running.trim().length > 0) {
|
|
69
|
+
console.log('✅ PostgreSQL déjà en cours: ' + running.trim());
|
|
70
|
+
return;
|
|
57
71
|
}
|
|
58
72
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
console.log('
|
|
63
|
-
console.log('');
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
// Lire le password depuis .env ou générer un temporaire
|
|
74
|
+
let pgPassword = getEnvVar('POSTGRES_PASSWORD');
|
|
75
|
+
if (!pgPassword || pgPassword.includes('change_me')) {
|
|
76
|
+
console.log('⚠️ POSTGRES_PASSWORD non trouvé dans ~/.overmind/.env');
|
|
77
|
+
console.log(' Génération d\'un password temporaire...');
|
|
78
|
+
pgPassword = randomBytes(18).toString('base64url');
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const pgUser = getEnvVar('POSTGRES_USER') || 'postgres';
|
|
82
|
+
const pgDb = getEnvVar('POSTGRES_DATABASE') || getEnvVar('POSTGRES_DB') || 'overmind_memory';
|
|
83
|
+
const pgPort = getEnvVar('POSTGRES_PORT') || '5432';
|
|
84
|
+
|
|
85
|
+
// Remove ancien container stopped
|
|
86
|
+
runCommand('docker rm -f overmind-postgres-pgvector 2>/dev/null', { stdio: 'pipe' });
|
|
87
|
+
|
|
88
|
+
console.log('🚀 Démarrage PostgreSQL + pgvector...');
|
|
89
|
+
const result = runCommand(
|
|
90
|
+
`docker run -d --name overmind-postgres-pgvector ` +
|
|
91
|
+
`-p ${pgPort}:5432 ` +
|
|
92
|
+
`-e POSTGRES_PASSWORD=${pgPassword} ` +
|
|
93
|
+
`-e POSTGRES_USER=${pgUser} ` +
|
|
94
|
+
`-e POSTGRES_DB=${pgDb} ` +
|
|
95
|
+
`-v overmind_postgres_data:/var/lib/postgresql/data ` +
|
|
96
|
+
`--restart unless-stopped ` +
|
|
97
|
+
`pgvector/pgvector:pg16`,
|
|
98
|
+
{ stdio: 'pipe' }
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
if (!result) {
|
|
102
|
+
console.error('❌ Erreur démarrage PostgreSQL');
|
|
103
|
+
console.error(' Vérifiez que Docker est en cours: docker info');
|
|
74
104
|
process.exit(1);
|
|
75
105
|
}
|
|
106
|
+
|
|
107
|
+
console.log('⏳ Attente démarrage (8s)...');
|
|
108
|
+
execSync('sleep 8', { stdio: 'inherit' });
|
|
109
|
+
|
|
110
|
+
// Activer pgvector
|
|
111
|
+
runCommand(`docker exec overmind-postgres-pgvector psql -U ${pgUser} -d ${pgDb} -c "CREATE EXTENSION IF NOT EXISTS vector;"`, { stdio: 'pipe' });
|
|
112
|
+
|
|
113
|
+
console.log('');
|
|
114
|
+
console.log('✅ PostgreSQL + pgvector démarré !');
|
|
115
|
+
console.log('');
|
|
116
|
+
console.log('📊 Connexion:');
|
|
117
|
+
console.log(` Host: localhost:${pgPort}`);
|
|
118
|
+
console.log(` Database: ${pgDb}`);
|
|
119
|
+
console.log(` User: ${pgUser}`);
|
|
120
|
+
console.log(` Password: ${pgPassword.substring(0, 8)}... (voir ~/.overmind/.env)`);
|
|
121
|
+
console.log(' Image: pgvector/pgvector:pg16');
|
|
122
|
+
console.log('');
|
|
76
123
|
}
|
|
77
124
|
|
|
78
125
|
function commandDown() {
|
|
79
126
|
logSection('ARRÊT POSTGRESQL OVERMIND');
|
|
80
127
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
try {
|
|
87
|
-
runCommand(`docker-compose -f "${COMPOSE_FILE}" down`);
|
|
128
|
+
const result = runCommand('docker stop overmind-postgres-pgvector 2>/dev/null', { stdio: 'pipe' });
|
|
129
|
+
if (result === null) {
|
|
130
|
+
console.log('⚠️ Container overmind-postgres-pgvector non trouvé ou déjà arrêté');
|
|
131
|
+
} else {
|
|
88
132
|
console.log('');
|
|
89
|
-
console.log('✅ PostgreSQL arrêté
|
|
133
|
+
console.log('✅ PostgreSQL arrêté !');
|
|
90
134
|
console.log('');
|
|
91
135
|
console.log('💡 Les données sont conservées dans le volume Docker.');
|
|
92
136
|
console.log('');
|
|
93
|
-
} catch (error) {
|
|
94
|
-
console.error('❌ Erreur arrêt PostgreSQL:', error.message);
|
|
95
|
-
process.exit(1);
|
|
96
137
|
}
|
|
97
138
|
}
|
|
98
139
|
|
|
99
140
|
function commandStatus() {
|
|
100
141
|
logSection('ÉTAT POSTGRESQL OVERMIND');
|
|
101
142
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
143
|
+
const running = runCommand('docker ps --filter "name=overmind-postgres" --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"', { stdio: 'pipe' });
|
|
144
|
+
const stopped = runCommand('docker ps -a --filter "name=overmind-postgres" --filter "status=exited" --format "{{.Names}}"', { stdio: 'pipe' });
|
|
145
|
+
|
|
146
|
+
if (running && running.trim().length > 0) {
|
|
147
|
+
console.log(running);
|
|
148
|
+
} else if (stopped && stopped.trim().length > 0) {
|
|
149
|
+
console.log('⚠️ Container arrêté: ' + stopped.trim());
|
|
150
|
+
console.log(' Démarrez avec: overmind-postgres-mcp up');
|
|
151
|
+
} else {
|
|
152
|
+
console.log('❌ Aucun container PostgreSQL OverMind trouvé');
|
|
153
|
+
console.log(' Démarrez avec: overmind-postgres-mcp up');
|
|
112
154
|
}
|
|
113
155
|
}
|
|
114
156
|
|
|
@@ -117,14 +159,9 @@ function commandLogs() {
|
|
|
117
159
|
console.log(' (Ctrl+C pour sortir)');
|
|
118
160
|
console.log('');
|
|
119
161
|
|
|
120
|
-
if (!existsSync(COMPOSE_FILE)) {
|
|
121
|
-
console.error('❌ Fichier docker-compose.yml non trouvé');
|
|
122
|
-
process.exit(1);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
162
|
try {
|
|
126
|
-
runCommand(
|
|
127
|
-
} catch
|
|
163
|
+
runCommand('docker logs -f overmind-postgres-pgvector');
|
|
164
|
+
} catch {
|
|
128
165
|
// Ignore Ctrl+C
|
|
129
166
|
}
|
|
130
167
|
}
|
|
@@ -135,24 +172,19 @@ function commandReset() {
|
|
|
135
172
|
console.log('⚠️ ATTENTION: Cette commande va SUPPRIMER TOUTES LES DONNÉES !');
|
|
136
173
|
console.log('');
|
|
137
174
|
|
|
138
|
-
const
|
|
139
|
-
if (!confirm) {
|
|
175
|
+
const args = process.argv.slice(2);
|
|
176
|
+
if (!args.includes('--confirm')) {
|
|
140
177
|
console.log('❌ Annulé. Pour confirmer, utilisez: --confirm');
|
|
141
|
-
console.log(' overmind-postgres reset --confirm');
|
|
178
|
+
console.log(' overmind-postgres-mcp reset --confirm');
|
|
142
179
|
process.exit(0);
|
|
143
180
|
}
|
|
144
181
|
|
|
145
|
-
if (!existsSync(COMPOSE_FILE)) {
|
|
146
|
-
console.error('❌ Fichier docker-compose.yml non trouvé');
|
|
147
|
-
process.exit(1);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
182
|
try {
|
|
151
183
|
console.log('🛑 Arrêt PostgreSQL...');
|
|
152
|
-
runCommand(
|
|
184
|
+
runCommand('docker rm -f overmind-postgres-pgvector 2>/dev/null');
|
|
153
185
|
|
|
154
186
|
console.log('🗑️ Suppression du volume Docker...');
|
|
155
|
-
runCommand('docker volume rm
|
|
187
|
+
runCommand('docker volume rm overmind_postgres_data 2>/dev/null', { stdio: 'inherit' });
|
|
156
188
|
|
|
157
189
|
console.log('');
|
|
158
190
|
console.log('✅ PostgreSQL réinitialisé avec succès !');
|
package/scripts/postinstall.mjs
CHANGED
|
@@ -589,6 +589,17 @@ async function main() {
|
|
|
589
589
|
|
|
590
590
|
// Show final summary
|
|
591
591
|
showSummary();
|
|
592
|
+
|
|
593
|
+
// Auto-verify to show user what's ready/missing
|
|
594
|
+
logSection('🔍 VÉRIFICATION POST-INSTALL');
|
|
595
|
+
try {
|
|
596
|
+
const verifyScript = join(__dirname, 'verify-install.mjs');
|
|
597
|
+
if (existsSync(verifyScript)) {
|
|
598
|
+
await runCommandAsync(`node "${verifyScript}"`, 'Smoke test');
|
|
599
|
+
}
|
|
600
|
+
} catch {
|
|
601
|
+
// Non-blocking
|
|
602
|
+
}
|
|
592
603
|
}
|
|
593
604
|
|
|
594
605
|
// Run main
|