overmind-mcp 2.0.0 → 2.0.1

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.
@@ -0,0 +1,200 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * ═══════════════════════════════════════════════════════════════════════════════
4
+ * DOCKER-MANAGER - Gestion Simplifiée Docker Compose
5
+ * ═══════════════════════════════════════════════════════════════════════════════
6
+ * Gère les services Docker OverMind via des commandes simples
7
+ *
8
+ * Usage:
9
+ * overmind-infra up Démarrer les services
10
+ * overmind-infra down Arrêter les services
11
+ * overmind-infra status Vérifier l'état
12
+ * overmind-infra logs Voir les logs
13
+ * ═══════════════════════════════════════════════════════════════════════════════
14
+ */
15
+
16
+ import { execSync } from 'child_process';
17
+ import { existsSync } from 'fs';
18
+ import { join } from 'path';
19
+ import { fileURLToPath } from 'url';
20
+ import { dirname } from 'path';
21
+
22
+ const __filename = fileURLToPath(import.meta.url);
23
+ const __dirname = dirname(__filename);
24
+
25
+ // Try to find .overmind directory, fallback to current directory
26
+ let INSTALL_DIR = join(process.env.HOME || process.env.USERPROFILE || process.env.HOMEPATH, '.overmind');
27
+
28
+ // If we're running from NPM package, check the install directory
29
+ if (!existsSync(INSTALL_DIR)) {
30
+ // Try to find relative to node_modules/overmind-mcp
31
+ const possiblePath = join(__dirname, '..', '.overmind');
32
+ if (existsSync(possiblePath)) {
33
+ INSTALL_DIR = possiblePath;
34
+ } else {
35
+ // Fallback to home directory
36
+ INSTALL_DIR = join(process.env.HOME || process.env.USERPROFILE, '.overmind');
37
+ }
38
+ }
39
+
40
+ const COMPOSE_FILE = join(INSTALL_DIR, 'docker-compose.overmind.yml');
41
+
42
+ // ═══════════════════════════════════════════════════════════════════════════════
43
+ // COMMANDS
44
+ // ═══════════════════════════════════════════════════════════════════════════════
45
+
46
+ function commandUp() {
47
+ console.log('🚀 Démarrage infrastructure Docker OverMind...');
48
+ console.log('');
49
+
50
+ if (!existsSync(COMPOSE_FILE)) {
51
+ console.error('❌ Fichier non trouvé:', COMPOSE_FILE);
52
+ console.error(' → Lancez d\'abord: overmind-setup');
53
+ process.exit(1);
54
+ }
55
+
56
+ try {
57
+ execSync(`docker-compose -f "${COMPOSE_FILE}" up -d`, { stdio: 'inherit' });
58
+ console.log('');
59
+ console.log('✅ Services démarrés avec succès !');
60
+ console.log('');
61
+ console.log('🌐 Interfaces disponibles:');
62
+ console.log(' 📊 RabbitMQ Management: http://localhost:15672');
63
+ console.log(' 📈 Temporal Web: http://localhost:8088');
64
+ console.log(' 👤 User: overmind / Pass: overmind_secret_password_change_me');
65
+ console.log('');
66
+ } catch (error) {
67
+ console.error('❌ Erreur démarrage services:', error.message);
68
+ process.exit(1);
69
+ }
70
+ }
71
+
72
+ function commandDown() {
73
+ console.log('🛑 Arrêt infrastructure Docker OverMind...');
74
+ console.log('');
75
+
76
+ if (!existsSync(COMPOSE_FILE)) {
77
+ console.error('❌ Fichier non trouvé:', COMPOSE_FILE);
78
+ process.exit(1);
79
+ }
80
+
81
+ try {
82
+ execSync(`docker-compose -f "${COMPOSE_FILE}" down`, { stdio: 'inherit' });
83
+ console.log('');
84
+ console.log('✅ Services arrêtés avec succès !');
85
+ console.log('');
86
+ console.log('💡 Les données sont conservées dans les volumes Docker.');
87
+ } catch (error) {
88
+ console.error('❌ Erreur arrêt services:', error.message);
89
+ process.exit(1);
90
+ }
91
+ }
92
+
93
+ function commandStatus() {
94
+ console.log('📊 État infrastructure Docker OverMind:');
95
+ console.log('');
96
+
97
+ if (!existsSync(COMPOSE_FILE)) {
98
+ console.error('❌ Fichier non trouvé:', COMPOSE_FILE);
99
+ console.log(' → Lancez d\'abord: overmind-setup');
100
+ process.exit(1);
101
+ }
102
+
103
+ try {
104
+ execSync(`docker-compose -f "${COMPOSE_FILE}" ps`, { stdio: 'inherit' });
105
+ } catch (error) {
106
+ console.error('❌ Erreur vérification état:', error.message);
107
+ process.exit(1);
108
+ }
109
+ }
110
+
111
+ function commandLogs() {
112
+ console.log('📋 Logs infrastructure Docker OverMind:');
113
+ console.log('');
114
+ console.log(' (Ctrl+C pour sortir)');
115
+ console.log('');
116
+
117
+ if (!existsSync(COMPOSE_FILE)) {
118
+ console.error('❌ Fichier non trouvé:', COMPOSE_FILE);
119
+ process.exit(1);
120
+ }
121
+
122
+ try {
123
+ execSync(`docker-compose -f "${COMPOSE_FILE}" logs -f`, { stdio: 'inherit' });
124
+ } catch (error) {
125
+ // Ignore Ctrl+C
126
+ }
127
+ }
128
+
129
+ function commandRestart() {
130
+ console.log('🔄 Redémarrage infrastructure Docker OverMind...');
131
+ console.log('');
132
+
133
+ if (!existsSync(COMPOSE_FILE)) {
134
+ console.error('❌ Fichier non trouvé:', COMPOSE_FILE);
135
+ process.exit(1);
136
+ }
137
+
138
+ try {
139
+ execSync(`docker-compose -f "${COMPOSE_FILE}" restart`, { stdio: 'inherit' });
140
+ console.log('');
141
+ console.log('✅ Services redémarrés avec succès !');
142
+ } catch (error) {
143
+ console.error('❌ Erreur redémarrage:', error.message);
144
+ process.exit(1);
145
+ }
146
+ }
147
+
148
+ function showHelp() {
149
+ console.log('╔══════════════════════════════════════════════════════════════════╗');
150
+ console.log('║ OVERMIND-INFRA: Gestion Docker Compose OverMind ║');
151
+ console.log('╠════════════════════════════════════════════════════════════════╣');
152
+ console.log('║ Usage: ║');
153
+ console.log('║ overmind-infra up Démarrer les services ║');
154
+ console.log('║ overmind-infra down Arrêter tous les services ║');
155
+ console.log('║ overmind-infra restart Redémarrer les services ║');
156
+ console.log('║ overmind-infra status Vérifier l\'état ║');
157
+ console.log('║ overmind-infra logs Voir les logs en temps réel ║');
158
+ console.log('║ ║');
159
+ console.log('║ Services gérés: ║');
160
+ console.log('║ - RabbitMQ (Message Broker) ║');
161
+ console.log('║ - Temporal (Workflow Orchestrator) ║');
162
+ console.log('║ - Temporal Web (Interface Web) ║');
163
+ console.log('║ ║');
164
+ console.log('║ Interfaces: ║');
165
+ console.log('║ RabbitMQ: http://localhost:15672 ║');
166
+ console.log('║ Temporal: http://localhost:8088 ║');
167
+ console.log('║ ║');
168
+ console.log('║ Installation: ║');
169
+ console.log('║ Si docker-compose.overmind.yml manque: ║');
170
+ console.log('║ → overmind-setup --full ║');
171
+ console.log('╚══════════════════════════════════════════════════════════════════╝');
172
+ }
173
+
174
+ // ═══════════════════════════════════════════════════════════════════════════════
175
+ // MAIN
176
+ // ═══════════════════════════════════════════════════════════════════════════════
177
+
178
+ const command = process.argv[2] || 'help';
179
+
180
+ switch (command) {
181
+ case 'up':
182
+ commandUp();
183
+ break;
184
+ case 'down':
185
+ commandDown();
186
+ break;
187
+ case 'restart':
188
+ commandRestart();
189
+ break;
190
+ case 'status':
191
+ commandStatus();
192
+ break;
193
+ case 'logs':
194
+ commandLogs();
195
+ break;
196
+ case 'help':
197
+ default:
198
+ showHelp();
199
+ break;
200
+ }
@@ -0,0 +1,283 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * ═══════════════════════════════════════════════════════════════════════════════
4
+ * INSTALL-DEPENDENCIES SCRIPT
5
+ * ═══════════════════════════════════════════════════════════════════════════════
6
+ * Script qui installe PostgreSQL + pgvector automatiquement si absents
7
+ *
8
+ * Ce script fait partie du setup automatique d'OverMind-MCP
9
+ * ═══════════════════════════════════════════════════════════════════════════════
10
+ */
11
+
12
+ import { execSync, spawn } from 'child_process';
13
+ import { existsSync } from 'fs';
14
+ import { join } from 'path';
15
+ import { fileURLToPath } from 'url';
16
+ import { dirname } from 'path';
17
+ import { createInterface } from 'readline';
18
+
19
+ const __filename = fileURLToPath(import.meta.url);
20
+ const __dirname = dirname(__filename);
21
+
22
+ // ═══════════════════════════════════════════════════════════════════════════════
23
+ // UTILS
24
+ // ═══════════════════════════════════════════════════════════════════════════════
25
+
26
+ function logSection(title) {
27
+ console.log('\n╔══════════════════════════════════════════════════════════════════╗');
28
+ console.log(`║ ${title.padEnd(64)} ║`);
29
+ console.log('╚══════════════════════════════════════════════════════════════════╝');
30
+ }
31
+
32
+ function runCommandAsync(cmd, description) {
33
+ return new Promise((resolve, reject) => {
34
+ console.log(`🔧 ${description}`);
35
+ console.log(` $ ${cmd}`);
36
+
37
+ const child = spawn(cmd, { shell: true, stdio: 'inherit' });
38
+
39
+ child.on('close', (code) => {
40
+ if (code === 0) {
41
+ console.log(`✅ ${description} terminé`);
42
+ resolve(true);
43
+ } else {
44
+ console.error(`❌ Erreur (code ${code})`);
45
+ reject(new Error(`Command failed with code ${code}`));
46
+ }
47
+ });
48
+
49
+ child.on('error', (err) => {
50
+ console.error('❌ Erreur:', err.message);
51
+ reject(err);
52
+ });
53
+ });
54
+ }
55
+
56
+ function promptYesNo(question) {
57
+ const rl = createInterface({
58
+ input: process.stdin,
59
+ output: process.stdout,
60
+ });
61
+
62
+ return new Promise((resolve) => {
63
+ rl.question(`${question} (y/N): `, (answer) => {
64
+ rl.close();
65
+ resolve(answer.toLowerCase().startsWith('y'));
66
+ });
67
+ };
68
+ }
69
+
70
+ // ═══════════════════════════════════════════════════════════════════════════════
71
+ // INSTALLATION STEPS
72
+ // ═══════════════════════════════════════════════════════════════════════════════
73
+
74
+ async function installDocker() {
75
+ logSection('VÉRIFICATION DOCKER');
76
+
77
+ try {
78
+ execSync('docker --version', { stdio: 'pipe' });
79
+ console.log('✅ Docker est installé');
80
+ return true;
81
+ } catch {
82
+ console.log('❌ Docker non trouvé');
83
+ console.log('');
84
+ console.log('📥 Installation Docker Desktop requis:');
85
+ console.log(' - Windows: https://www.docker.com/products/docker-desktop/');
86
+ console.log(' - Mac: https://www.docker.com/products/docker-desktop/');
87
+ console.log('');
88
+ console.log('💡 Après installation de Docker, relancez ce script');
89
+
90
+ const answer = await promptYesNo('Voulez-vous ouvrir le site de téléchargement maintenant ?');
91
+ if (answer) {
92
+ const url = process.platform === 'win32'
93
+ ? 'https://www.docker.com/products/docker-desktop/'
94
+ : 'https://www.docker.com/products/docker-desktop/';
95
+
96
+ try {
97
+ execSync(`start ${url}`, { stdio: 'pipe' });
98
+ console.log('✅ Navigateur ouvert. Installez Docker, puis relancez.');
99
+ } catch {
100
+ console.log(` Ouvrez manuellement: ${url}`);
101
+ }
102
+ }
103
+
104
+ return false;
105
+ }
106
+ }
107
+
108
+ async function installPostgreSQL() {
109
+ logSection('INSTALLATION POSTGRESQL + PGVECTOR');
110
+
111
+ // Check if already running
112
+ try {
113
+ const containers = execSync(
114
+ 'docker ps --filter "name=postgres-pgvector" --format "{{.Names}}"',
115
+ { encoding: 'utf8', stdio: 'pipe' }
116
+ ).trim();
117
+
118
+ if (containers) {
119
+ console.log('✅ PostgreSQL + pgvector déjà installé (Docker)');
120
+ console.log(' Container:', containers);
121
+ return true;
122
+ }
123
+ } catch {}
124
+
125
+ // Check native PostgreSQL
126
+ try {
127
+ execSync('psql --version', { stdio: 'pipe' });
128
+ console.log('✅ PostgreSQL déjà installé (natif)');
129
+ return true;
130
+ } catch {}
131
+
132
+ // Install PostgreSQL + pgvector in Docker
133
+ console.log('🐳 Installation PostgreSQL + pgvector en Docker...');
134
+ console.log('');
135
+
136
+ try {
137
+ // Pull image
138
+ console.log('📥 Téléchargement image pgvector/pgvector:pg16...');
139
+ await runCommandAsync(
140
+ 'docker pull pgvector/pgvector:pg16',
141
+ 'Téléchargement image'
142
+ );
143
+
144
+ // Check if container name already exists
145
+ try {
146
+ execSync('docker inspect postgres-pgvector', { stdio: 'pipe' });
147
+ console.log('⚠️ Container postgres-pgvector existe déjà. Suppression...');
148
+ execSync('docker rm -f postgres-pgvector', { stdio: 'pipe' });
149
+ } catch {
150
+ // Container doesn't exist, that's fine
151
+ }
152
+
153
+ // Check if volume exists
154
+ try {
155
+ execSync('docker volume ls | grep postgres_data', { stdio: 'pipe' });
156
+ console.log('ℹ️ Volume postgres_data existe déjà (réutilisation)');
157
+ } catch {
158
+ console.log('📦 Création volume postgres_data...');
159
+ }
160
+
161
+ // Run container
162
+ console.log('🚀 Démarrage container PostgreSQL...');
163
+ const runCommand = `docker run -d --name postgres-pgvector \\
164
+ -p 5432:5432 \\
165
+ -e POSTGRES_PASSWORD=overmind_temp_password_change_me \\
166
+ -e POSTGRES_USER=postgres \\
167
+ -v postgres_data:/var/lib/postgresql/data \\
168
+ --restart unless-stopped \\
169
+ pgvector/pgvector:pg16`;
170
+
171
+ await runCommandAsync(runCommand, 'Démarrage PostgreSQL');
172
+
173
+ // Wait for PostgreSQL to be ready
174
+ console.log('⏳ Attente démarrage PostgreSQL (30s)...');
175
+ await new Promise((resolve) => setTimeout(resolve, 30000));
176
+
177
+ // Test connection
178
+ console.log('🔍 Test connexion PostgreSQL...');
179
+ await runCommandAsync(
180
+ 'docker exec postgres-pgvector psql -U postgres -c "SELECT version();"',
181
+ 'Test connexion'
182
+ );
183
+
184
+ // Enable pgvector
185
+ console.log('🔧 Activation extension pgvector...');
186
+ await runCommandAsync(
187
+ 'docker exec postgres-pgvector psql -U postgres -c "CREATE EXTENSION IF NOT EXISTS vector;"',
188
+ 'Activation pgvector'
189
+ );
190
+
191
+ // Verify pgvector
192
+ console.log('✅ Vérification pgvector...');
193
+ const result = execSync(
194
+ 'docker exec postgres-pgvector psql -U postgres -t',
195
+ { encoding: 'utf8', stdio: 'pipe'
196
+ ).trim();
197
+
198
+ if (result.includes('vector')) {
199
+ console.log('✅ pgvector installé avec succès !');
200
+ } else {
201
+ throw new Error('pgvector non trouvé');
202
+ }
203
+
204
+ console.log('');
205
+ console.log('🎉 PostgreSQL + pgvector installés !');
206
+ console.log('');
207
+ console.log('📋 Détails:');
208
+ console.log(' Container: postgres-pgvector');
209
+ console.log(' Port: 5432');
210
+ console.log(' User: postgres');
211
+ console.log(' Password: overmind_temp_password_change_me (À CHANGER !)');
212
+ console.log(' Extension: vector (pgvector)');
213
+
214
+ return true;
215
+
216
+ } catch (error) {
217
+ console.error('❌ Erreur installation PostgreSQL:', error.message);
218
+ console.error('');
219
+ console.log('💡 Solution manuelle:');
220
+ console.log(' docker run -d --name postgres-pgvector \\');
221
+ console.log(' -p 5432:5432 \\');
222
+ console.log(' -e POSTGRES_PASSWORD=votre_pass \\');
223
+ console.log(' -e POSTGRES_USER=postgres \\');
224
+ console.log(' -v postgres_data:/var/lib/postgresql/data \\');
225
+ console.log(' --restart unless-stopped \\');
226
+ console.log(' pgvector/pgvector:pg16');
227
+ return false;
228
+ }
229
+ }
230
+
231
+ // ═══════════════════════════════════════════════════════════════════════════════
232
+ // MAIN
233
+ // ═══════════════════════════════════════════════════════════════════════════════
234
+
235
+ async function main() {
236
+ console.log('╔══════════════════════════════════════════════════════════════════╗');
237
+ console.log('║ ║');
238
+ console.log('║ 🗄️️ INSTALLATION POSTGRESQL + PGVECTOR ║');
239
+ console.log('║ ║');
240
+ console.log('╚══════════════════════════════════════════════════════════════════╝');
241
+ console.log('');
242
+
243
+ // Install Docker if needed
244
+ const dockerInstalled = await installDocker();
245
+ if (!dockerInstalled) {
246
+ console.log('\n⚠️ Relancez ce script après avoir installé Docker.');
247
+ process.exit(1);
248
+ }
249
+
250
+ // Install PostgreSQL
251
+ const pgInstalled = await installPostgreSQL();
252
+ if (!pgInstalled) {
253
+ console.log('\n⚠️ Relancez ce script après avoir installé PostgreSQL.');
254
+ process.exit(1);
255
+ }
256
+
257
+ // Success
258
+ logSection('✅ INSTALLATION TERMINÉE');
259
+
260
+ console.log(`
261
+ 🎉 PostgreSQL + pgvector installés avec succès !
262
+
263
+ 📋 PROCHAINE ÉTAPE:
264
+ → Relancez: overmind-setup --full
265
+ Ou manuellement: overmind-setup
266
+
267
+ 💡 RAPPEL:
268
+ - Container: postgres-pgvector
269
+ - Port: 5432
270
+ - User: postgres
271
+ - Password: overmind_temp_password_change_me (CHANGEZ-LE !)
272
+
273
+ ═════════════════════════════════════════════════════════════════════
274
+ `);
275
+ }
276
+
277
+ // Run main
278
+ if (import.meta.url === `file://${process.argv[1]}`) {
279
+ main().catch((error) => {
280
+ console.error('\n❌ ERREUR FATALE:', error.message);
281
+ process.exit(1);
282
+ });
283
+ }