overmind-mcp 2.0.3 → 2.0.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "overmind-mcp",
3
- "version": "2.0.3",
3
+ "version": "2.0.5",
4
4
  "preferGlobal": true,
5
5
  "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.",
6
6
  "type": "module",
@@ -0,0 +1,327 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * ═══════════════════════════════════════════════════════════════════════════════
4
+ * OVERMIND-MCP - INSTALLATION AUTOMATIQUE (POST-INSTALL)
5
+ * ═══════════════════════════════════════════════════════════════════════════════
6
+ * Ce script est exécuté automatiquement après npm install -g
7
+ * Il installe et configure TOUT :
8
+ * - Docker Desktop (vérification)
9
+ * - PostgreSQL + pgvector (si absent)
10
+ * - Infrastructure complète
11
+ * - Invite l'utilisateur à voir les services dans Docker Desktop
12
+ * ═══════════════════════════════════════════════════════════════════════════════
13
+ */
14
+
15
+ import { execSync, spawn } from 'child_process';
16
+ import { existsSync, mkdirSync, writeFileSync } from 'fs';
17
+ import { join } from 'path';
18
+ import { fileURLToPath } from 'url';
19
+ import { dirname } from 'path';
20
+ import { createInterface } from 'readline';
21
+
22
+ const __filename = fileURLToPath(import.meta.url);
23
+ const __dirname = dirname(__filename);
24
+
25
+ // ═══════════════════════════════════════════════════════════════════════════════
26
+ // CONFIG
27
+ // ═══════════════════════════════════════════════════════════════════════════════
28
+
29
+ const INSTALL_DIR = join(
30
+ process.env.HOME || process.env.USERPROFILE || process.env.HOMEPATH,
31
+ '.overmind'
32
+ );
33
+
34
+ // ═══════════════════════════════════════════════════════════════════════════════
35
+ // UTILS
36
+ // ═══════════════════════════════════════════════════════════════════════════════
37
+
38
+ function logSection(title) {
39
+ console.log('\n╔══════════════════════════════════════════════════════════════════╗');
40
+ console.log(`║ ${title.padEnd(64)} ║`);
41
+ console.log('╚══════════════════════════════════════════════════════════════════╝');
42
+ }
43
+
44
+ function runCommand(cmd, options = {}) {
45
+ try {
46
+ return execSync(cmd, { stdio: 'pipe', encoding: 'utf8', ...options });
47
+ } catch {
48
+ return null;
49
+ }
50
+ }
51
+
52
+ async function promptYesNo(question) {
53
+ const rl = createInterface({
54
+ input: process.stdin,
55
+ output: process.stdout,
56
+ });
57
+
58
+ return new Promise((resolve) => {
59
+ rl.question(`${question} (y/N): `, (answer) => {
60
+ rl.close();
61
+ resolve(answer.toLowerCase().startsWith('y'));
62
+ });
63
+ });
64
+ }
65
+
66
+ async function runCommandAsync(cmd, description) {
67
+ return new Promise((resolve, reject) => {
68
+ console.log(`🔧 ${description}`);
69
+ console.log(` $ ${cmd}`);
70
+
71
+ const child = spawn(cmd, { shell: true, stdio: 'inherit' });
72
+
73
+ child.on('close', (code) => {
74
+ if (code === 0) {
75
+ console.log(`✅ ${description} terminé`);
76
+ resolve(true);
77
+ } else {
78
+ console.error(`❌ Erreur (code ${code})`);
79
+ reject(new Error(`Command failed with code ${code}`));
80
+ }
81
+ });
82
+
83
+ child.on('error', (err) => {
84
+ console.error('❌ Erreur:', err.message);
85
+ reject(err);
86
+ });
87
+ });
88
+ }
89
+
90
+ // ═══════════════════════════════════════════════════════════════════════════════
91
+ // INSTALLATION STEPS
92
+ // ═══════════════════════════════════════════════════════════════════════════════
93
+
94
+ async function checkDocker() {
95
+ logSection('VÉRIFICATION DOCKER');
96
+
97
+ const version = runCommand('docker --version');
98
+ if (!version) {
99
+ console.log('❌ Docker non trouvé');
100
+ console.log('');
101
+ console.log('📥 Installation Docker requise:');
102
+
103
+ const platform = process.platform;
104
+ if (platform === 'win32') {
105
+ console.log(' Windows: https://www.docker.com/products/docker-desktop/');
106
+ } else if (platform === 'darwin') {
107
+ console.log(' macOS: https://www.docker.com/products/docker-desktop/');
108
+ } else {
109
+ console.log(' Linux: https://docs.docker.com/engine/install/');
110
+ }
111
+
112
+ const answer = await promptYesNo('Voulez-vous ouvrir le site de téléchargement ?');
113
+ if (answer) {
114
+ const url = 'https://www.docker.com/products/docker-desktop/';
115
+ const openCmd = process.platform === 'win32' ? 'start' :
116
+ process.platform === 'darwin' ? 'open' : 'xdg-open';
117
+ runCommand(`${openCmd} ${url}`, { stdio: 'ignore' });
118
+ console.log('✅ Navigateur ouvert. Installez Docker, puis relancez: npm install -g overmind-mcp');
119
+ }
120
+
121
+ return false;
122
+ }
123
+
124
+ console.log('✅ Docker détecté:', version.trim());
125
+ return true;
126
+ }
127
+
128
+ async function setupInfrastructure() {
129
+ logSection('TÉLÉCHARGEMENT INFRASTRUCTURE');
130
+
131
+ mkdirSync(INSTALL_DIR, { recursive: true });
132
+
133
+ console.log('📥 Téléchargement docker-compose.yml...');
134
+
135
+ const composeUrl = 'https://raw.githubusercontent.com/DeamonDev888/overmind-mcp/main/docker-compose.yml';
136
+ const exportersUrl = 'https://raw.githubusercontent.com/DeamonDev888/overmind-mcp/main/docker-compose.exporters.yml';
137
+
138
+ try {
139
+ const composeData = runCommand(`curl -sL ${composeUrl}`);
140
+ if (composeData) {
141
+ writeFileSync(join(INSTALL_DIR, 'docker-compose.yml'), composeData);
142
+ console.log('✅ docker-compose.yml téléchargé');
143
+ }
144
+
145
+ const exportersData = runCommand(`curl -sL ${exportersUrl}`);
146
+ if (exportersData) {
147
+ writeFileSync(join(INSTALL_DIR, 'docker-compose.exporters.yml'), exportersData);
148
+ console.log('✅ docker-compose.exporters.yml téléchargé');
149
+ }
150
+
151
+ return true;
152
+ } catch (error) {
153
+ console.error('❌ Erreur téléchargement:', error.message);
154
+ return false;
155
+ }
156
+ }
157
+
158
+ async function startInfrastructure() {
159
+ logSection('DÉMARRAGE INFRASTRUCTURE DOCKER');
160
+
161
+ const composeFile = join(INSTALL_DIR, 'docker-compose.yml');
162
+
163
+ if (!existsSync(composeFile)) {
164
+ console.log('⚠️ docker-compose.yml non trouvé. Installation infrastructure skippée.');
165
+ return false;
166
+ }
167
+
168
+ try {
169
+ console.log('🚀 Démarrage des services...');
170
+ await runCommandAsync(
171
+ `cd "${INSTALL_DIR}" && docker-compose -f docker-compose.yml up -d`,
172
+ 'Démarrage infrastructure'
173
+ );
174
+
175
+ console.log('');
176
+ console.log('⏳ Attente démarrage des services (15s)...');
177
+ await new Promise(resolve => setTimeout(resolve, 15000));
178
+
179
+ return true;
180
+ } catch (error) {
181
+ console.error('❌ Erreur démarrage:', error.message);
182
+ return false;
183
+ }
184
+ }
185
+
186
+ async function validateServices() {
187
+ logSection('VALIDATION DES SERVICES');
188
+
189
+ console.log('🔍 Vérification des containers...');
190
+ console.log('');
191
+
192
+ const services = [
193
+ { name: 'PostgreSQL', filter: 'postgres', check: 'pg_isready' },
194
+ { name: 'RabbitMQ', filter: 'rabbitmq', check: null },
195
+ { name: 'Temporal', filter: 'temporal', check: null },
196
+ { name: 'Prometheus', filter: 'prometheus', check: null },
197
+ { name: 'Grafana', filter: 'grafana', check: null },
198
+ { name: 'Jaeger', filter: 'jaeger', check: null },
199
+ ];
200
+
201
+ let allRunning = true;
202
+
203
+ for (const service of services) {
204
+ const containerName = runCommand(
205
+ `docker ps --filter "name=${service.filter}" --format "{{.Names}}"`,
206
+ { stdio: 'pipe' }
207
+ );
208
+
209
+ if (containerName) {
210
+ const name = containerName.trim();
211
+ console.log(`✅ ${service.name}: ${name}`);
212
+ } else {
213
+ console.log(`❌ ${service.name}: Non trouvé`);
214
+ allRunning = false;
215
+ }
216
+ }
217
+
218
+ return allRunning;
219
+ }
220
+
221
+ async function createEnvConfig() {
222
+ const envFile = join(INSTALL_DIR, '.env');
223
+
224
+ if (!existsSync(envFile)) {
225
+ logSection('CRÉATION CONFIGURATION');
226
+
227
+ const envContent = `# OverMind-MCP Environment Configuration
228
+ # Généré automatiquement par npm install
229
+
230
+ # PostgreSQL
231
+ POSTGRES_HOST=localhost
232
+ POSTGRES_PORT=5432
233
+ POSTGRES_USER=postgres
234
+ POSTGRES_PASSWORD=overmind_temp_password_change_me
235
+ POSTGRES_DB=overmind
236
+
237
+ # OpenTelemetry (optionnel)
238
+ OTEL_ENABLED=false
239
+
240
+ # Workspace
241
+ OVERMIND_WORKSPACE=${INSTALL_DIR}
242
+ `;
243
+
244
+ writeFileSync(envFile, envContent);
245
+ console.log('✅ Configuration créée:', envFile);
246
+ }
247
+ }
248
+
249
+ function showSummary() {
250
+ console.log('\n╔══════════════════════════════════════════════════════════════════╗');
251
+ console.log('║ ✅ INSTALLATION TERMINÉE ! ║');
252
+ console.log('╚══════════════════════════════════════════════════════════════════╝');
253
+ console.log('');
254
+ console.log('📋 SERVICES DISPONIBLES:');
255
+ console.log('');
256
+ console.log('┌─────────────────────────────────────────────────────────────────┐');
257
+ console.log('│ Ouvrez Docker Desktop pour voir tous les containers │');
258
+ console.log('│ │');
259
+ console.log('│ URLs utiles: │');
260
+ console.log('│ • Prometheus: http://localhost:9090 │');
261
+ console.log('│ • Grafana: http://localhost:3000 (admin/admin) │');
262
+ console.log('│ • Jaeger: http://localhost:16686 │');
263
+ console.log('│ • RabbitMQ: http://localhost:15672 (guest/guest) │');
264
+ console.log('│ • Temporal: http://localhost:8233 │');
265
+ console.log('└─────────────────────────────────────────────────────────────────┘');
266
+ console.log('');
267
+ console.log('📚 DOCUMENTATION:');
268
+ console.log(' • https://github.com/DeamonDev888/overmind-mcp');
269
+ console.log(' • https://www.npmjs.com/package/overmind-mcp');
270
+ console.log('');
271
+ console.log('🎉 PROCHAINE ÉTAPE:');
272
+ console.log(' • Créez votre premier agent: overmind create-agent');
273
+ console.log(' • Ou utilisez: overmind-setup --full');
274
+ console.log('');
275
+ }
276
+
277
+ // ═══════════════════════════════════════════════════════════════════════════════
278
+ // MAIN
279
+ // ═══════════════════════════════════════════════════════════════════════════════
280
+
281
+ async function main() {
282
+ console.log('╔══════════════════════════════════════════════════════════════════╗');
283
+ console.log('║ ║');
284
+ console.log('║ 🚀 OVERMIND-MCP - INSTALLATION AUTOMATIQUE ║');
285
+ console.log('║ npm install -g overmind-mcp ║');
286
+ console.log('║ ║');
287
+ console.log('╚══════════════════════════════════════════════════════════════════╝');
288
+ console.log('');
289
+
290
+ // Step 1: Check Docker
291
+ const dockerOk = await checkDocker();
292
+ if (!dockerOk) {
293
+ console.log('\n⚠️ Relancez après installation de Docker: npm install -g overmind-mcp');
294
+ return;
295
+ }
296
+
297
+ // Step 2: Setup .env
298
+ await createEnvConfig();
299
+
300
+ // Step 3: Download docker-compose files
301
+ const downloaded = await setupInfrastructure();
302
+ if (!downloaded) {
303
+ console.log('\n⚠️ Impossible de télécharger l\'infrastructure. Continue en mode minimal.');
304
+ showSummary();
305
+ return;
306
+ }
307
+
308
+ // Step 4: Start infrastructure
309
+ const started = await startInfrastructure();
310
+ if (!started) {
311
+ console.log('\n⚠️ Infrastructure non démarrée. Continue en mode minimal.');
312
+ showSummary();
313
+ return;
314
+ }
315
+
316
+ // Step 5: Validate services
317
+ await validateServices();
318
+
319
+ // Show summary
320
+ showSummary();
321
+ }
322
+
323
+ // Run main
324
+ main().catch((error) => {
325
+ console.error('\n❌ ERREUR FATALE:', error.message);
326
+ process.exit(1);
327
+ });
@@ -1,192 +1,368 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * POSTINSTALL SCRIPT — OverMind-MCP
4
- * Executeur apres `npm install -g overmind-mcp`
5
- * Detecte l'environnement et affiche les prochaines etapes.
3
+ * ═══════════════════════════════════════════════════════════════════════════════
4
+ * OVERMIND-MCP - POST-INSTALL AUTOMATIQUE
5
+ * ═══════════════════════════════════════════════════════════════════════════════
6
+ * Script exécuté automatiquement après npm install -g overmind-mcp
7
+ * Installe et configure TOUT :
8
+ * - Vérifie Docker
9
+ * - Installe PostgreSQL + pgvector (si absent)
10
+ * - Télécharge et lance l'infrastructure Docker complète
11
+ * - Valide tous les services
12
+ * - Montre à l'utilisateur où voir les services dans Docker Desktop
13
+ * ═══════════════════════════════════════════════════════════════════════════════
6
14
  */
7
15
 
8
- import { execSync } from 'child_process';
9
- import { platform } from 'os';
10
- import { dirname } from 'path';
16
+ import { execSync, spawn } from 'child_process';
17
+ import { existsSync, mkdirSync, writeFileSync } from 'fs';
18
+ import { join } from 'path';
11
19
  import { fileURLToPath } from 'url';
20
+ import { dirname } from 'path';
12
21
 
13
22
  const __filename = fileURLToPath(import.meta.url);
14
23
  const __dirname = dirname(__filename);
15
24
 
16
- function detectDocker() {
25
+ const INSTALL_DIR = join(
26
+ process.env.HOME || process.env.USERPROFILE || process.env.HOMEPATH,
27
+ '.overmind'
28
+ );
29
+
30
+ // ═══════════════════════════════════════════════════════════════════════════════
31
+ // CONFIG & COLORS
32
+ // ═══════════════════════════════════════════════════════════════════════════════
33
+
34
+ const COLORS = {
35
+ cyan: '\x1b[36m',
36
+ green: '\x1b[32m',
37
+ yellow: '\x1b[33m',
38
+ red: '\x1b[31m',
39
+ white: '\x1b[37m',
40
+ reset: '\x1b[0m'
41
+ };
42
+
43
+ function log(color, str) {
44
+ console.log(`${color}${str}${COLORS.reset}`);
45
+ }
46
+
47
+ function logSection(title) {
48
+ console.log('\n╔══════════════════════════════════════════════════════════════════╗');
49
+ console.log(`║ ${title.padEnd(64)} ║`);
50
+ console.log('╚══════════════════════════════════════════════════════════════════╝');
51
+ }
52
+
53
+ function runCommand(cmd, options = {}) {
17
54
  try {
18
- const version = execSync('docker --version', { encoding: 'utf8', stdio: 'pipe' }).trim();
19
- console.log('[OK] Docker detecte: ' + version.split(',')[0]);
20
- return true;
55
+ return execSync(cmd, { stdio: 'pipe', encoding: 'utf8', ...options });
21
56
  } catch {
22
- console.log('[ERR] Docker non trouve');
23
- console.log(' -> Installez Docker Desktop: https://www.docker.com/products/docker-desktop/');
24
- return false;
57
+ return null;
25
58
  }
26
59
  }
27
60
 
28
- function detectPostgreSQL() {
29
- try {
30
- const containers = execSync(
31
- 'docker ps --filter "name=postgres-pgvector" --format "{{.Names}}"',
32
- { encoding: 'utf8', stdio: 'pipe' }
33
- ).trim();
34
- if (containers) {
35
- console.log('[OK] PostgreSQL detecte (Docker): ' + containers);
36
- return { hasPG: true, type: 'docker', name: containers };
37
- }
38
- } catch {}
61
+ async function runCommandAsync(cmd, description) {
62
+ return new Promise((resolve, reject) => {
63
+ console.log(`🔧 ${description}`);
64
+ console.log(` $ ${cmd}`);
39
65
 
40
- try {
41
- execSync('psql --version', { stdio: 'pipe' });
42
- console.log('[OK] PostgreSQL detecte (natif)');
43
- return { hasPG: true, type: 'native' };
44
- } catch {}
45
-
46
- console.log('[ERR] PostgreSQL non trouve');
47
- console.log(' -> Installe par: overmind-setup --full');
48
- return { hasPG: false };
66
+ const child = spawn(cmd, { shell: true, stdio: 'inherit' });
67
+
68
+ child.on('close', (code) => {
69
+ if (code === 0) {
70
+ console.log(`✅ ${description} terminé`);
71
+ resolve(true);
72
+ } else {
73
+ console.error(`❌ Erreur (code ${code})`);
74
+ reject(new Error(`Command failed with code ${code}`));
75
+ }
76
+ });
77
+
78
+ child.on('error', (err) => {
79
+ console.error('❌ Erreur:', err.message);
80
+ reject(err);
81
+ });
82
+ });
49
83
  }
50
84
 
51
- function detectPgVector() {
52
- try {
53
- if (platform() === 'win32') {
54
- const r = execSync(
55
- "docker exec postgres-pgvector psql -U postgres -t -c \"SELECT 1 FROM pg_extension WHERE extname='vector';\"",
56
- { encoding: 'utf8', stdio: 'pipe' }
57
- ).trim();
58
- if (r === '1') { console.log('[OK] pgvector installe (Docker)'); return true; }
85
+ // ═══════════════════════════════════════════════════════════════════════════════
86
+ // INSTALLATION STEPS
87
+ // ═══════════════════════════════════════════════════════════════════════════════
88
+
89
+ async function checkDocker() {
90
+ logSection('VÉRIFICATION DOCKER');
91
+
92
+ const version = runCommand('docker --version');
93
+ if (!version) {
94
+ log(COLORS.red, '❌ Docker non trouvé');
95
+ console.log('');
96
+ log(COLORS.yellow, '📥 Installation Docker requise:');
97
+
98
+ const platform = process.platform;
99
+ if (platform === 'win32') {
100
+ console.log(' Windows: https://www.docker.com/products/docker-desktop/');
101
+ } else if (platform === 'darwin') {
102
+ console.log(' macOS: https://www.docker.com/products/docker-desktop/');
59
103
  } else {
60
- try {
61
- const r = execSync('pg_config --version', { encoding: 'utf8', stdio: 'pipe' }).trim();
62
- if (r.includes('pgvector')) { console.log('[OK] pgvector installe (natif)'); return true; }
63
- } catch {}
64
- try {
65
- const r = execSync(
66
- "psql -U postgres -t -c \"SELECT 1 FROM pg_extension WHERE extname='vector';\"",
67
- { encoding: 'utf8', stdio: 'pipe' }
68
- ).trim();
69
- if (r === '1') { console.log('[OK] pgvector installe (natif)'); return true; }
70
- } catch {}
104
+ console.log(' Linux: https://docs.docker.com/engine/install/');
71
105
  }
72
- } catch {}
73
106
 
74
- console.log('[ERR] pgvector non trouve');
75
- console.log(' -> Installe par: overmind-setup --full');
76
- return false;
107
+ log(COLORS.cyan, '\n📥 Après installation de Docker, relancez: npm install -g overmind-mcp');
108
+ return false;
109
+ }
110
+
111
+ log(COLORS.green, '✅ Docker détecté: ' + version.trim());
112
+ return true;
77
113
  }
78
114
 
79
- function detectNodeVersion() {
115
+ async function setupPostgreSQL() {
116
+ logSection('INSTALLATION POSTGRESQL + PGVECTOR');
117
+
118
+ // Check if already exists
119
+ const existingContainer = runCommand(
120
+ 'docker ps --filter "name=postgres-pgvector" --format "{{.Names}}"',
121
+ { stdio: 'pipe' }
122
+ );
123
+
124
+ if (existingContainer) {
125
+ log(COLORS.green, '✅ PostgreSQL + pgvector déjà installé');
126
+ log(COLORS.cyan, ' Container: ' + existingContainer.trim());
127
+ return true;
128
+ }
129
+
130
+ log(COLORS.yellow, '📦 Installation PostgreSQL + pgvector...');
131
+
80
132
  try {
81
- console.log('[OK] Node.js: ' + execSync('node --version', { encoding: 'utf8' }).trim());
133
+ await runCommandAsync(
134
+ 'docker pull pgvector/pgvector:pg16',
135
+ 'Téléchargement image'
136
+ );
137
+
138
+ // Remove existing if stopped
139
+ runCommand('docker rm -f overmind-postgres-pgvector', { stdio: 'pipe' });
140
+
141
+ const runCmd = [
142
+ 'docker', 'run', '-d',
143
+ '--name', 'overmind-postgres-pgvector',
144
+ '-p', '5432:5432',
145
+ '-e', 'POSTGRES_PASSWORD=overmind_temp_password_change_me',
146
+ '-e', 'POSTGRES_USER=postgres',
147
+ '-v', 'overmind_postgres_data:/var/lib/postgresql/data',
148
+ '--restart', 'unless-stopped',
149
+ 'pgvector/pgvector:pg16'
150
+ ].join(' ');
151
+
152
+ await runCommandAsync(runCmd, 'Démarrage PostgreSQL');
153
+
154
+ log(COLORS.cyan, '\n⏳ Attente démarrage PostgreSQL (20s)...');
155
+ await new Promise(resolve => setTimeout(resolve, 20000));
156
+
157
+ // Enable pgvector
158
+ await runCommandAsync(
159
+ `docker exec overmind-postgres-pgvector psql -U postgres -c "CREATE EXTENSION IF NOT EXISTS vector;"`,
160
+ 'Activation pgvector'
161
+ );
162
+
163
+ log(COLORS.green, '\n✅ PostgreSQL + pgvector installés !');
82
164
  return true;
83
- } catch {
84
- console.log('[ERR] Node.js non trouve');
165
+ } catch (error) {
166
+ log(COLORS.red, ' Erreur installation PostgreSQL: ' + error.message);
167
+ return false;
168
+ }
169
+ }
170
+
171
+ async function setupInfrastructure() {
172
+ logSection('TÉLÉCHARGEMENT INFRASTRUCTURE DOCKER');
173
+
174
+ mkdirSync(INSTALL_DIR, { recursive: true });
175
+
176
+ log(COLORS.yellow, '📥 Téléchargement docker-compose.yml...');
177
+
178
+ const composeUrl = 'https://raw.githubusercontent.com/DeamonDev888/overmind-mcp/main/docker-compose.yml';
179
+ const exportersUrl = 'https://raw.githubusercontent.com/DeamonDev888/overmind-mcp/main/docker-compose.exporters.yml';
180
+
181
+ try {
182
+ const composeData = runCommand(`curl -sL ${composeUrl}`);
183
+ if (composeData) {
184
+ writeFileSync(join(INSTALL_DIR, 'docker-compose.yml'), composeData);
185
+ log(COLORS.green, '✅ docker-compose.yml téléchargé');
186
+ }
187
+
188
+ const exportersData = runCommand(`curl -sL ${exportersUrl}`);
189
+ if (exportersData) {
190
+ writeFileSync(join(INSTALL_DIR, 'docker-compose.exporters.yml'), exportersData);
191
+ log(COLORS.green, '✅ docker-compose.exporters.yml téléchargé');
192
+ }
193
+
194
+ return true;
195
+ } catch (error) {
196
+ log(COLORS.red, '❌ Erreur téléchargement: ' + error.message);
85
197
  return false;
86
198
  }
87
199
  }
88
200
 
89
- function bar(label, ok) {
90
- const pad = (s) => (' ' + s).slice(-18);
91
- const okStr = ok ? '[OK]' : '[ERR]';
92
- console.log(' ' + okStr + ' ' + pad(label));
201
+ async function startInfrastructure() {
202
+ logSection('DÉMARRAGE INFRASTRUCTURE');
203
+
204
+ const composeFile = join(INSTALL_DIR, 'docker-compose.yml');
205
+
206
+ if (!existsSync(composeFile)) {
207
+ log(COLORS.yellow, '⚠️ docker-compose.yml non trouvé. Téléchargement...');
208
+ return false;
209
+ }
210
+
211
+ log(COLORS.cyan, '💡 Infrastructure Docker téléchargée.');
212
+ log(COLORS.yellow, '⚠️ Pour démarrer tous les services (RabbitMQ, Temporal, Prometheus, Grafana, Jaeger):');
213
+ log(COLORS.white, ' → overmind-setup --full');
214
+ log(COLORS.white, ' → Ou manuellement: cd ~/.overmind && docker-compose up -d');
215
+ log(COLORS.white, ' ');
216
+ log(COLORS.green, '✅ PostgreSQL + pgvector sont déjà prêts !');
217
+
218
+ return true;
93
219
  }
94
220
 
95
- function main() {
96
- console.log('');
97
- console.log('================================================================');
98
- console.log(' BRAIN OVERMIND-MCP v2.0.0 - INSTALLATION');
99
- console.log('================================================================');
100
- console.log('');
221
+ async function validateServices() {
222
+ logSection('VALIDATION DES SERVICES');
101
223
 
102
- console.log('[CHECK] Detection de votre environnement...');
103
- console.log('');
224
+ log(COLORS.yellow, '🔍 Vérification des containers...\n');
104
225
 
105
- const hasDocker = detectDocker();
106
- const pgInfo = detectPostgreSQL();
107
- const hasPgVector = detectPgVector();
108
- detectNodeVersion();
226
+ const services = [
227
+ { name: 'PostgreSQL + pgvector', filter: 'postgres', color: COLORS.green },
228
+ { name: 'RabbitMQ', filter: 'rabbitmq', color: COLORS.green },
229
+ { name: 'Temporal', filter: 'temporal', color: COLORS.green },
230
+ { name: 'Prometheus', filter: 'prometheus', color: COLORS.green },
231
+ { name: 'Grafana', filter: 'grafana', color: COLORS.green },
232
+ { name: 'Jaeger', filter: 'jaeger', color: COLORS.green },
233
+ ];
109
234
 
110
- console.log('');
111
- console.log('================================================================');
112
- console.log(' MODE DETECTE');
113
- console.log('================================================================');
235
+ let allRunning = true;
114
236
 
115
- if (hasDocker && pgInfo.hasPG && hasPgVector) {
116
- console.log(' [GO] MODE COMPLET (Docker + PostgreSQL + pgvector)');
117
- console.log('');
118
- console.log(' OverMind fonctionne avec TOUTES les features:');
119
- bar('Swarm Orchestration', true);
120
- bar('Workflows Long-Running', true);
121
- bar('Vector DB (4096D)', true);
122
- bar('Observabilite complete', true);
123
- console.log('');
124
- console.log(' Commande: overmind-setup --full');
125
- } else if (hasDocker) {
126
- console.log(' [FAST] MODE PARTIEL (Docker uniquement)');
127
- console.log('');
128
- console.log(' OverMind installera automatiquement:');
129
- bar('PostgreSQL + pgvector', true);
130
- bar('RabbitMQ (Broker)', true);
131
- bar('Temporal (Workflows)', true);
132
- console.log('');
133
- console.log(' Commande: overmind-setup --full');
134
- } else {
135
- console.log(' [OK] MODE SIMPLE (sans Docker)');
136
- console.log('');
137
- console.log(' OverMind fonctionne immediatement avec:');
138
- bar('Agents IA (Claude, Gemini...)', true);
139
- bar('Creation/Config agents', true);
140
- bar('Execution taches complexes', true);
141
- bar('Vector DB', false);
142
- bar('Workflows Long-Running', false);
143
- console.log('');
144
- console.log(' Pour activer toutes les features:');
145
- console.log(' 1. Installez Docker Desktop');
146
- console.log(' 2. Relancez: overmind-setup --full');
237
+ for (const service of services) {
238
+ const containerName = runCommand(
239
+ `docker ps --filter "name=${service.filter}" --format "{{.Names}}"`,
240
+ { stdio: 'pipe' }
241
+ );
242
+
243
+ if (containerName) {
244
+ log(service.color, ` ✅ ${service.name}: ${containerName.trim()}`);
245
+ } else {
246
+ log(COLORS.red, ` ❌ ${service.name}: Non trouvé`);
247
+ allRunning = false;
248
+ }
147
249
  }
148
250
 
149
- console.log('');
150
- console.log('================================================================');
151
- console.log(' PROCHAINES ETAPES');
152
- console.log('================================================================');
153
- console.log('');
251
+ return allRunning;
252
+ }
154
253
 
155
- if (!pgInfo.hasPG || !hasPgVector) {
156
- console.log(' Etape 1: Installer les dependances manquantes');
157
- console.log(' -> overmind-setup --full');
158
- console.log('');
159
- console.log(' Cette commande va:');
160
- console.log(' - Installer PostgreSQL + pgvector en Docker');
161
- console.log(' - Creer la base de donnees OverMind');
162
- console.log(' - Demarrer RabbitMQ + Temporal');
163
- console.log(' - Configurer les fichiers necessaires');
164
- console.log('');
254
+ function createEnvConfig() {
255
+ mkdirSync(INSTALL_DIR, { recursive: true });
256
+
257
+ const envFile = join(INSTALL_DIR, '.env');
258
+
259
+ if (!existsSync(envFile)) {
260
+ const envContent = `# OverMind-MCP Environment Configuration
261
+ # Généré automatiquement par npm install
262
+
263
+ # PostgreSQL
264
+ POSTGRES_HOST=localhost
265
+ POSTGRES_PORT=5432
266
+ POSTGRES_USER=postgres
267
+ POSTGRES_PASSWORD=overmind_temp_password_change_me
268
+ POSTGRES_DB=overmind
269
+
270
+ # OpenTelemetry (optionnel)
271
+ OTEL_ENABLED=false
272
+
273
+ # Workspace
274
+ OVERMIND_WORKSPACE=${INSTALL_DIR}
275
+ `;
276
+
277
+ writeFileSync(envFile, envContent);
278
+ log(COLORS.green, '✅ Configuration créée: ' + envFile);
165
279
  }
280
+ }
166
281
 
167
- console.log(' DOCUMENTATION:');
168
- console.log(' -> https://deamondev888.github.io/overmind-mcp/');
169
- console.log(' -> https://github.com/DeamonDev888/overmind-mcp');
170
- console.log(' -> Discord: https://discord.gg/4AR82phtBz');
282
+ function showSummary() {
283
+ console.log('\n╔══════════════════════════════════════════════════════════════════╗');
284
+ console.log('║' + ' '.repeat(64) + '║');
285
+ console.log('║' + COLORS.green + ' ✅ INSTALLATION TERMINÉE !' + COLORS.reset + ' '.repeat(33) + '║');
286
+ console.log('║' + ' '.repeat(64) + '║');
287
+ console.log('╚══════════════════════════════════════════════════════════════════╝');
288
+ console.log('');
289
+ log(COLORS.yellow, '📋 SERVICES DISPONIBLES:');
290
+ console.log('');
291
+ console.log('┌─────────────────────────────────────────────────────────────────┐');
292
+ console.log('│ ' + COLORS.cyan + 'Ouvrez Docker Desktop pour voir tous les containers' + COLORS.reset + ' │');
293
+ console.log('│ │');
294
+ console.log('│ ' + COLORS.yellow + 'URLs utiles:' + COLORS.reset + ' │');
295
+ console.log('│ • Prometheus: ' + COLORS.cyan + 'http://localhost:9090' + COLORS.reset + ' │');
296
+ console.log('│ • Grafana: ' + COLORS.cyan + 'http://localhost:3000' + COLORS.reset + ' (admin/admin)' + ' │');
297
+ console.log('│ • Jaeger: ' + COLORS.cyan + 'http://localhost:16686' + COLORS.reset + ' │');
298
+ console.log('│ • RabbitMQ: ' + COLORS.cyan + 'http://localhost:15672' + COLORS.reset + ' (guest/guest)' + ' │');
299
+ console.log('│ • Temporal: ' + COLORS.cyan + 'http://localhost:8233' + COLORS.reset + ' │');
300
+ console.log('└─────────────────────────────────────────────────────────────────┘');
171
301
  console.log('');
172
- console.log(' UTILISATION RAPIDE:');
302
+ log(COLORS.yellow, '📚 DOCUMENTATION:');
303
+ console.log(' • https://github.com/DeamonDev888/overmind-mcp');
304
+ console.log(' • https://www.npmjs.com/package/overmind-mcp');
173
305
  console.log('');
306
+ log(COLORS.yellow, '🎉 PROCHAINE ÉTAPE:');
307
+ console.log(' • Créez votre premier agent: overmind create-agent');
308
+ console.log(' • Ou listez les agents: overmind list-agents');
309
+ console.log('');
310
+ }
174
311
 
175
- if (!hasDocker) {
176
- console.log(' Mode Simple (sans Docker):');
177
- console.log(' $ overmind create-agent --name expert --runner claude --prompt "Tu es un expert..."');
178
- console.log(' $ overmind run-agent --runner claude --prompt "Analyse ce code..."');
179
- } else {
180
- console.log(' Mode Avance (avec Docker):');
181
- console.log(' $ overmind-setup --full');
182
- console.log(' $ overmind create-agent ...');
183
- console.log(' $ overmind run-agent ...');
184
- console.log(' $ overmind-infra up/down/status');
185
- }
312
+ // ═══════════════════════════════════════════════════════════════════════════════
313
+ // MAIN
314
+ // ═══════════════════════════════════════════════════════════════════════════════
186
315
 
316
+ async function main() {
317
+ console.log('╔══════════════════════════════════════════════════════════════════╗');
318
+ console.log('║' + ' '.repeat(64) + '║');
319
+ console.log('║' + COLORS.cyan + ' 🚀 OVERMIND-MCP - INSTALLATION AUTOMATIQUE' + COLORS.reset + ' '.repeat(25) + '║');
320
+ console.log('║' + ' '.repeat(64) + '║');
321
+ console.log('╚══════════════════════════════════════════════════════════════════╝');
187
322
  console.log('');
188
- console.log('================================================================');
323
+
324
+ // Banner
325
+ console.log(COLORS.cyan + 'Ce script va:' + COLORS.reset);
326
+ console.log(' ✓ Vérifier Docker');
327
+ console.log(' ✓ Installer PostgreSQL + pgvector (si absent)');
328
+ console.log(' ✓ Télécharger l\'infrastructure Docker');
329
+ console.log(' ✓ Démarrer tous les services');
330
+ console.log(' ✓ Valider l\'installation');
189
331
  console.log('');
332
+
333
+ // Step 1: Check Docker
334
+ const dockerOk = await checkDocker();
335
+ if (!dockerOk) {
336
+ return;
337
+ }
338
+
339
+ // Step 2: Setup .env
340
+ createEnvConfig();
341
+
342
+ // Step 3: Install PostgreSQL if needed
343
+ await setupPostgreSQL();
344
+
345
+ // Step 4: Download infrastructure files
346
+ await setupInfrastructure();
347
+
348
+ // Step 5: Show how to start full infrastructure
349
+ await startInfrastructure();
350
+
351
+ // Step 6: Show PostgreSQL is ready
352
+ logSection('POSTGRESQL PRÊT');
353
+ log(COLORS.green, '✅ PostgreSQL + pgvector sont installés et prêts !');
354
+ log(COLORS.cyan, '');
355
+ log(COLORS.yellow, '🚀 Pour activer toutes les features (Swarm, Workflows, Observabilité):');
356
+ log(COLORS.white, ' Option 1: overmind-setup --full');
357
+ log(COLORS.white, ' Option 2: cd ~/.overmind && docker-compose up -d');
358
+ log(COLORS.white, '');
359
+
360
+ // Show summary
361
+ showSummary();
190
362
  }
191
363
 
192
- main();
364
+ // Run main
365
+ main().catch((error) => {
366
+ console.error('\n❌ ERREUR FATALE:', error.message);
367
+ process.exit(1);
368
+ });