overmind-mcp 3.2.2 → 3.2.3

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.
@@ -48,29 +48,71 @@ NODE_MAJ=$(node -p "process.versions.node.split('.')[0]")
48
48
  ok "Node $(node -v) / npm $(npm -v)"
49
49
 
50
50
  # ============================================================
51
- # STEP 2/6 — PostgreSQL 18 + pgvector
51
+ # STEP 2/6 — PostgreSQL + pgvector (multi-OS)
52
52
  # ============================================================
53
53
  log "STEP 2/6 : PostgreSQL + pgvector"
54
- if ! dpkg -l postgresql-18-pgvector 2>/dev/null | grep -q '^ii'; then
55
- log "Installation postgresql-18-pgvector..."
56
- apt update -qq
57
- DEBIAN_FRONTEND=noninteractive apt install -y postgresql-18-pgvector postgresql-client-18
54
+
55
+ OS_TYPE="$(uname -s)"
56
+
57
+ if [ "$OS_TYPE" = "Darwin" ]; then
58
+ # ─── macOS (Homebrew) ───────────────────────────────────────────────
59
+ if ! command -v brew >/dev/null 2>&1; then
60
+ die "Homebrew non trouvé. Installez-le: /bin/bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\""
61
+ fi
62
+ if ! brew list postgresql@18 >/dev/null 2>&1; then
63
+ log "Installation postgresql@18 via brew..."
64
+ brew install postgresql@18
65
+ fi
66
+ if ! brew list pgvector >/dev/null 2>&1; then
67
+ log "Installation pgvector via brew..."
68
+ brew install pgvector
69
+ fi
70
+ # Démarrer le service
71
+ brew services start postgresql@18 2>/dev/null || true
72
+ sleep 3
73
+ ok "postgresql@18 + pgvector installés via brew"
74
+
75
+ elif [ "$OS_TYPE" = "Linux" ]; then
76
+ # ─── Linux (apt / yum / pacman) ────────────────────────────────────
77
+ if command -v apt >/dev/null 2>&1; then
78
+ if ! dpkg -l postgresql-18-pgvector 2>/dev/null | grep -q '^ii'; then
79
+ log "Installation postgresql-18-pgvector via apt..."
80
+ apt update -qq
81
+ DEBIAN_FRONTEND=noninteractive apt install -y postgresql-18-pgvector postgresql-client-18
82
+ fi
83
+ elif command -v yum >/dev/null 2>&1; then
84
+ log "Installation postgresql + pgvector via yum..."
85
+ yum install -y postgresql-server postgresql-contrib pgvector
86
+ postgresql-setup --initdb 2>/dev/null || true
87
+ elif command -v pacman >/dev/null 2>&1; then
88
+ log "Installation postgresql + pgvector via pacman..."
89
+ pacman -S --noconfirm postgresql pgvector
90
+ su - postgres -c "initdb -D /var/lib/postgres/data" 2>/dev/null || true
91
+ else
92
+ die "Gestionnaire de paquets non supporté. Installez PostgreSQL + pgvector manuellement."
93
+ fi
94
+
95
+ # Service systemd
96
+ if command -v systemctl >/dev/null 2>&1; then
97
+ if ! systemctl is-active --quiet postgresql; then
98
+ systemctl enable --now postgresql
99
+ fi
100
+ ok "postgresql.service: $(systemctl is-active postgresql)"
101
+ fi
58
102
  fi
59
- ok "postgresql-18-pgvector $(dpkg -s postgresql-18-pgvector | awk '/Version:/ {print $2}')"
60
103
 
61
- # Service postgresql actif
62
- if ! systemctl is-active --quiet postgresql; then
63
- systemctl enable --now postgresql
104
+ # DB + extension vector (multi-OS)
105
+ PG_SUPERUSER="postgres"
106
+ if [ "$OS_TYPE" = "Darwin" ]; then
107
+ PG_SUPERUSER="$(whoami)"
64
108
  fi
65
- ok "postgresql.service: $(systemctl is-active postgresql)"
66
109
 
67
- # DB + extension vector
68
- if ! sudo -u postgres psql -tAc "SELECT 1 FROM pg_database WHERE datname='$PG_DB'" | grep -q 1; then
110
+ if ! psql -U "$PG_SUPERUSER" -d postgres -tAc "SELECT 1 FROM pg_database WHERE datname='$PG_DB'" 2>/dev/null | grep -q 1; then
69
111
  log "Création DB $PG_DB..."
70
- sudo -u postgres createdb "$PG_DB"
112
+ createdb -U "$PG_SUPERUSER" "$PG_DB" 2>/dev/null || sudo -u postgres createdb "$PG_DB"
71
113
  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'")
114
+ psql -U "$PG_SUPERUSER" -d "$PG_DB" -c "CREATE EXTENSION IF NOT EXISTS vector;" >/dev/null 2>&1 || sudo -u postgres psql -d "$PG_DB" -c "CREATE EXTENSION IF NOT EXISTS vector;" >/dev/null
115
+ PGV=$(psql -U "$PG_SUPERUSER" -d "$PG_DB" -tAc "SELECT extversion FROM pg_extension WHERE extname='vector'" 2>/dev/null || echo "?")
74
116
  ok "DB $PG_DB prête, pgvector v$PGV"
75
117
 
76
118
  # ============================================================
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "overmind-mcp",
3
- "version": "3.2.2",
3
+ "version": "3.2.3",
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 COMPOSE_FILE = join(PROJECT_ROOT, 'docker', 'docker-compose.yml');
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
- if (!existsSync(COMPOSE_FILE)) {
55
- console.error(' Fichier docker-compose.yml non trouvé');
56
- process.exit(1);
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
- try {
60
- runCommand(`docker-compose -f "${COMPOSE_FILE}" up -d`);
61
- console.log('');
62
- console.log(' PostgreSQL + pgvector démarré avec succès !');
63
- console.log('');
64
- console.log('📊 Connexion:');
65
- console.log(' Host: localhost:5432');
66
- console.log(' Database: overmind_memory');
67
- console.log(' User: postgres');
68
- console.log(' Password: overmind_temp_password_change_me');
69
- console.log('');
70
- console.log('💪 Extensions: pgvector (4096D) activé');
71
- console.log('');
72
- } catch (error) {
73
- console.error('❌ Erreur démarrage PostgreSQL:', error.message);
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
- if (!existsSync(COMPOSE_FILE)) {
82
- console.error('❌ Fichier docker-compose.yml non trouvé');
83
- process.exit(1);
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é avec succès !');
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
- if (!existsSync(COMPOSE_FILE)) {
103
- console.error(' Fichier docker-compose.yml non trouvé');
104
- process.exit(1);
105
- }
106
-
107
- try {
108
- runCommand(`docker-compose -f "${COMPOSE_FILE}" ps`);
109
- } catch (error) {
110
- console.error('❌ Erreur vérification état:', error.message);
111
- process.exit(1);
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(`docker-compose -f "${COMPOSE_FILE}" logs -f`);
127
- } catch (error) {
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 { confirm } = require('minimist')(process.argv.slice(2));
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(`docker-compose -f "${COMPOSE_FILE}" down -v`);
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 overmind-postgres-data', { stdio: 'inherit' });
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 !');
@@ -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