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,223 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * ═══════════════════════════════════════════════════════════════════════════════
4
+ * POSTINSTALL SCRIPT
5
+ * ═══════════════════════════════════════════════════════════════════════════════
6
+ * Script exécuté automatiquement après `npm install -g overmind-mcp`
7
+ * Détecte l'environnement et guide l'utilisateur selon son setup
8
+ *
9
+ * Usage: (exécuté automatiquement par NPM)
10
+ * ═══════════════════════════════════════════════════════════════════════════════
11
+ */
12
+
13
+ import { execSync } from 'child_process';
14
+ import { existsSync } from 'fs';
15
+ import { platform } from 'os';
16
+ import { join, resolve } from 'path';
17
+ import { fileURLToPath } from 'url';
18
+
19
+ const __filename = fileURLToPath(import.meta.url);
20
+ const __dirname = dirname(__filename);
21
+
22
+ // ═══════════════════════════════════════════════════════════════════════════════
23
+ // DETECTION FUNCTIONS
24
+ // ═══════════════════════════════════════════════════════════════════════════════
25
+
26
+ function detectDocker() {
27
+ try {
28
+ const version = execSync('docker --version', { encoding: 'utf8', stdio: 'pipe' }).trim();
29
+ console.log('✅ Docker détecté:', version.split(',')[0]);
30
+ return true;
31
+ } catch {
32
+ console.log('❌ Docker non trouvé');
33
+ console.log(' → Installez Docker Desktop: https://www.docker.com/products/docker-desktop/');
34
+ return false;
35
+ }
36
+ }
37
+
38
+ function detectPostgreSQL() {
39
+ // Check PostgreSQL dans Docker
40
+ try {
41
+ const containers = execSync(
42
+ 'docker ps --filter "name=postgres" --format "{{.Names}}"',
43
+ { encoding: 'utf8', stdio: 'pipe' }
44
+ ).trim();
45
+
46
+ if (containers) {
47
+ console.log('✅ PostgreSQL détecté (Docker):', containers);
48
+ return { hasPG: true, type: 'docker', name: containers };
49
+ }
50
+ } catch {}
51
+
52
+ // Check PostgreSQL natif
53
+ try {
54
+ execSync('psql --version', { stdio: 'pipe' });
55
+ console.log('✅ PostgreSQL détecté (natif)');
56
+ return { hasPG: true, type: 'native' };
57
+ } catch {}
58
+
59
+ console.log('❌ PostgreSQL non trouvé');
60
+ console.log(' → Will be installed by: overmind-setup --full');
61
+ return { hasPG: false };
62
+ }
63
+
64
+ function detectPgVector() {
65
+ try {
66
+ if (platform() === 'win32') {
67
+ // Check via Docker
68
+ const result = execSync(
69
+ 'docker exec postgres pgvector -- pg_config --version',
70
+ { encoding: 'utf8', stdio: 'pipe' }
71
+ ).trim();
72
+ if (result.includes('pgvector')) {
73
+ console.log('✅ pgvector installé (Docker)');
74
+ return true;
75
+ }
76
+ } else {
77
+ // Check natif
78
+ const result = execSync('pg_config --version', { encoding: 'utf8', stdio: 'pipe' }).trim();
79
+ if (result.includes('pgvector')) {
80
+ console.log('✅ pgvector installé (natif)');
81
+ return true;
82
+ }
83
+ }
84
+ } catch {}
85
+
86
+ console.log('❌ pgvector non trouvé');
87
+ console.log(' → Will be installed by: overmind-setup --full');
88
+ return false;
89
+ }
90
+
91
+ function detectNodeVersion() {
92
+ try {
93
+ const version = execSync('node --version', { encoding: 'utf8' }).trim();
94
+ console.log('✅ Node.js:', version);
95
+ return true;
96
+ } catch {
97
+ console.log('❌ Node.js non trouvé');
98
+ return false;
99
+ }
100
+ }
101
+
102
+ // ═══════════════════════════════════════════════════════════════════════════════
103
+ // MAIN
104
+ // ═══════════════════════════════════════════════════════════════════════════════
105
+
106
+ function main() {
107
+ console.log('╔══════════════════════════════════════════════════════════════════╗');
108
+ console.log('║ ║');
109
+ console.log('║ 🧠 OVERMIND-MCP v2.0.0 - INSTALLATION ║');
110
+ console.log('║ ║');
111
+ console.log('╚══════════════════════════════════════════════════════════════════╝');
112
+ console.log('');
113
+
114
+ console.log('🔍 Détection de votre environnement...');
115
+ console.log('');
116
+
117
+ // Detect components
118
+ const hasDocker = detectDocker();
119
+ const pgInfo = detectPostgreSQL();
120
+ const hasPgVector = detectPgVector();
121
+ const hasNode = detectNodeVersion();
122
+
123
+ console.log('');
124
+ console.log('╔══════════════════════════════════════════════════════════════════╗');
125
+ console.log('║ 🎯 MODE DÉTECTÉ ║');
126
+ console.log('╠══════════════════════════════════════════════════════════════════╣');
127
+
128
+ if (hasDocker && pgInfo.hasPG && hasPgVector) {
129
+ console.log('║ 🚀 MODE COMPLET (Docker + PostgreSQL + pgvector) ║');
130
+ console.log('║ ║');
131
+ console.log('║ OverMind fonctionne avec TOUTES les features: ║');
132
+ console.log('║ ✅ Swarm Orchestration ║');
133
+ console.log('║ ✅ Workflows Long-Running ║');
134
+ console.log('║ ✅ Vector DB (4096D) ║');
135
+ console.log('║ ✅ Observabilité complète ║');
136
+ console.log('║ ║');
137
+ console.log('║ Commande: ║');
138
+ console.log('║ overmind-setup --full ║');
139
+ } else if (hasDocker) {
140
+ console.log('║ ⚡ MODE PARTIEL (Docker uniquement) ║');
141
+ console.log('║ ║');
142
+ console.log('║ OverMind installera automatiquement: ║');
143
+ console.log('║ ✅ PostgreSQL + pgvector (Docker) ║');
144
+ console.log('║ ✅ RabbitMQ (Message Broker) ║');
145
+ console.log('║ ✅ Temporal (Workflow Orchestrator) ║');
146
+ console.log('║ ║');
147
+ console.log('║ Commande: ║');
148
+ console.log('║ overmind-setup --full ║');
149
+ } else {
150
+ console.log('║ ✅ MODE SIMPLE (sans dépendances Docker) ║');
151
+ console.log('║ ║');
152
+ console.log('║ OverMind fonctionne immédiatement avec: ║');
153
+ console.log('║ ✅ Agents IA (Claude, Gemini, Kilo, etc.) ║');
154
+ console.log('║ ✅ Création/Configuration d'agents ║');
155
+ console.log('║ ✅ Exécution de tâches complexes ║');
156
+ console.log('║ ❌ Vector DB (nécessite Docker) ║');
157
+ console.log('║ ❌ Workflows Long-Running (nécessite Docker) ║');
158
+ console.log('║ ║');
159
+ console.log('║ Pour ACTIVER TOUTES les features: ║');
160
+ console.log('║ 1. Installez Docker Desktop ║');
161
+ console.log('║ 2. Relancez: overmind-setup --full ║');
162
+ }
163
+
164
+ console.log('╚══════════════════════════════════════════════════════════════════╝');
165
+ console.log('');
166
+
167
+ // Show next steps
168
+ console.log('📋 PROCHAINES ÉTAPES:');
169
+ console.log('');
170
+
171
+ if (!pgInfo.hasPG || !hasPgVector) {
172
+ console.log('🔧 Étape 1: Installer les dépendances manquantes');
173
+ console.log(' → overmind-setup --full');
174
+ console.log('');
175
+ console.log(' Cette commande va:');
176
+ console.log(' - Installer PostgreSQL + pgvector en Docker (si absent)');
177
+ console.log(' - Créer la base de données OverMind');
178
+ console.log(' - Démarrer RabbitMQ + Temporal');
179
+ console.log(' - Configurer les fichiers nécessaires');
180
+ }
181
+
182
+ console.log('📚 DOCUMENTATION:');
183
+ console.log(' → Site: https://deamondev888.github.io/overmind-mcp/');
184
+ console.log(' → GitHub: https://github.com/DeamonDev888/overmind-mcp');
185
+ console.log(' → Discord: https://discord.gg/4AR82phtBz');
186
+ console.log('');
187
+
188
+ // Show basic usage examples
189
+ console.log('🚀 UTILISATION RAPIDE:');
190
+ console.log('');
191
+
192
+ if (!hasDocker) {
193
+ console.log(' Mode Simple (sans Docker):');
194
+ console.log(' ┌─────────────────────────────────────────────────────┐');
195
+ console.log(' │ overmind create-agent --name expert --runner claude \\ │');
196
+ console.log(' │ --prompt "Tu es un expert Python..." │');
197
+ console.log(' │ │');
198
+ console.log(' │ overmind run-agent --runner claude \\ │');
199
+ console.log(' │ --prompt "Analyse ce code..." │');
200
+ console.log(' └─────────────────────────────────────────────────────┘');
201
+ } else {
202
+ console.log(' Mode Avancé (avec Docker):');
203
+ console.log(' ┌─────────────────────────────────────────────────────┐');
204
+ console.log(' │ overmind-setup --full │');
205
+ console.log(' │ │');
206
+ console.log(' │ # Après setup complet: │');
207
+ console.log(' │ overmind create-agent ... │');
208
+ console.log(' │ overmind run-agent ... │');
209
+ console.log(' │ │');
210
+ console.log(' │ # Gérer Docker: │');
211
+ console.log(' │ overmind-infra up │');
212
+ console.log(' │ overmind-infra down │');
213
+ console.log(' │ overmind-infra status │');
214
+ console.log(' └─────────────────────────────────────────────────────┘');
215
+ }
216
+
217
+ console.log('');
218
+ console.log('═════════════════════════════════════════════════════════════════');
219
+ console.log('');
220
+ }
221
+
222
+ // Run main
223
+ main();
@@ -0,0 +1,199 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * ═══════════════════════════════════════════════════════════════════════════════
4
+ * SETUP OVERMIND DATABASE (PostgreSQL Existant)
5
+ * ═══════════════════════════════════════════════════════════════════════════════
6
+ * Script qui initialise la base de données OverMind dans votre PostgreSQL existant
7
+ *
8
+ * Prérequis:
9
+ * - PostgreSQL + pgvector déjà en Docker (container: postgres-pgvector)
10
+ * - Node.js installé
11
+ *
12
+ * Usage:
13
+ * node scripts/setup-overmind-db.js
14
+ * ═══════════════════════════════════════════════════════════════════════════════
15
+ */
16
+
17
+ import { Client } from 'pg';
18
+ import { readFileSync } from 'fs';
19
+ import { dirname, join } from 'path';
20
+ import { fileURLToPath } from 'url';
21
+
22
+ const __filename = fileURLToPath(import.meta.url);
23
+ const __dirname = dirname(__filename);
24
+
25
+ // ═══════════════════════════════════════════════════════════════════════════════
26
+ // CONFIGURATION
27
+ // ═══════════════════════════════════════════════════════════════════════════════
28
+
29
+ const DB_CONFIG = {
30
+ host: process.env.POSTGRES_HOST || 'localhost',
31
+ port: parseInt(process.env.POSTGRES_PORT || '5432', 10),
32
+ user: process.env.POSTGRES_USER || 'postgres',
33
+ password: process.env.POSTGRES_PASSWORD || 'postgres',
34
+ database: 'postgres', // Se connecter à postgres pour créer la DB
35
+ };
36
+
37
+ const OVERMIND_DB_NAME = 'overmind_memory';
38
+
39
+ // ═══════════════════════════════════════════════════════════════════════════════
40
+ // FUNCTIONS
41
+ // ═══════════════════════════════════════════════════════════════════════════════
42
+
43
+ async function checkPgVectorExtension(client) {
44
+ console.log('🔍 Vérification extension pgvector...');
45
+
46
+ try {
47
+ const res = await client.query(`
48
+ SELECT 1 FROM pg_available_extensions
49
+ WHERE name = 'vector'
50
+ `);
51
+
52
+ if (res.rows.length === 0) {
53
+ console.error('❌ pgvector n\'est pas installé !');
54
+ console.error(' Installez-le avec: CREATE EXTENSION vector;');
55
+ throw new Error('pgvector extension not found');
56
+ }
57
+
58
+ console.log('✅ Extension pgvector trouvée');
59
+ } catch (error) {
60
+ console.error('❌ Erreur vérification pgvector:', error.message);
61
+ throw error;
62
+ }
63
+ }
64
+
65
+ async function createDatabase(client) {
66
+ console.log(`🔍 Vérification base de données ${OVERMIND_DB_NAME}...`);
67
+
68
+ try {
69
+ // Vérifier si la DB existe déjà
70
+ const checkRes = await client.query(
71
+ 'SELECT 1 FROM pg_database WHERE datname = $1',
72
+ [OVERMIND_DB_NAME]
73
+ );
74
+
75
+ if (checkRes.rows.length > 0) {
76
+ console.log(`ℹ️ Base de données ${OVERMIND_DB_NAME} existe déjà`);
77
+ return;
78
+ }
79
+
80
+ // Créer la DB
81
+ console.log(`🏗️ Création base de données ${OVERMIND_DB_NAME}...`);
82
+ await client.query(`CREATE DATABASE "${OVERMIND_DB_NAME}"`);
83
+ console.log(`✅ Base de données ${OVERMIND_DB_NAME} créée`);
84
+
85
+ } catch (error) {
86
+ if (error.code === '42P04') {
87
+ // Duplicate database - c'est ok
88
+ console.log(`ℹ️ Base de données ${OVERMIND_DB_NAME} existe déjà`);
89
+ return;
90
+ }
91
+ console.error('❌ Erreur création DB:', error.message);
92
+ throw error;
93
+ }
94
+ }
95
+
96
+ async function initializeOvermindDb() {
97
+ console.log(`🔍 Initialisation base de données ${OVERMIND_DB_NAME}...`);
98
+
99
+ const client = new Client({
100
+ ...DB_CONFIG,
101
+ database: OVERMIND_DB_NAME,
102
+ });
103
+
104
+ try {
105
+ await client.connect();
106
+ console.log(`✅ Connecté à ${OVERMIND_DB_NAME}`);
107
+
108
+ // Activer pgvector
109
+ console.log('🔧 Activation extension pgvector...');
110
+ await client.query('CREATE EXTENSION IF NOT EXISTS vector');
111
+ console.log('✅ Extension pgvector activée');
112
+
113
+ // Créer les tables (via init-db.sql)
114
+ const initSqlPath = join(__dirname, '../init-db.sql');
115
+ try {
116
+ const initSql = readFileSync(initSqlPath, 'utf8');
117
+ console.log('🔧 Exécution init-db.sql...');
118
+ await client.query(initSql);
119
+ console.log('✅ Tables initialisées');
120
+ } catch (error) {
121
+ console.warn('⚠️ Erreur init-db.sql (peut-être déjà exécuté):', error.message);
122
+ }
123
+
124
+ } finally {
125
+ await client.end();
126
+ console.log(`✅ Déconnecté de ${OVERMIND_DB_NAME}`);
127
+ }
128
+ }
129
+
130
+ async function main() {
131
+ console.log('╔══════════════════════════════════════════════════════════════════╗');
132
+ console.log('║ SETUP OVERMIND DATABASE (PostgreSQL Existant) ║');
133
+ console.log('╚══════════════════════════════════════════════════════════════════╝');
134
+ console.log('');
135
+
136
+ const client = new Client(DB_CONFIG);
137
+
138
+ try {
139
+ // Se connecter à postgres
140
+ console.log('🔌 Connexion à PostgreSQL...');
141
+ await client.connect();
142
+ console.log(`✅ Connecté à PostgreSQL (${DB_CONFIG.host}:${DB_CONFIG.port})`);
143
+ console.log('');
144
+
145
+ // Étape 1: Vérifier pgvector
146
+ await checkPgVectorExtension(client);
147
+ console.log('');
148
+
149
+ // Étape 2: Créer la DB
150
+ await createDatabase(client);
151
+ console.log('');
152
+
153
+ // Fermer la connexion postgres
154
+ await client.end();
155
+
156
+ // Étape 3: Initialiser la DB OverMind
157
+ await initializeOvermindDb();
158
+
159
+ console.log('');
160
+ console.log('╔══════════════════════════════════════════════════════════════════╗');
161
+ console.log('║ ✅ SETUP TERMINÉ AVEC SUCCÈS ║');
162
+ console.log('║ ║');
163
+ console.log('║ Prochaine étape: ║');
164
+ console.log('║ 1. docker-compose -f docker-compose.overmind.yml up -d ║');
165
+ console.log('║ 2. pnpm run build ║');
166
+ console.log('║ 3. pnpm run dev ║');
167
+ console.log('╚══════════════════════════════════════════════════════════════════╝');
168
+
169
+ } catch (error) {
170
+ console.error('');
171
+ console.error('╔══════════════════════════════════════════════════════════════════╗');
172
+ console.error('║ ❌ ERREUR SETUP ║');
173
+ console.error('╚══════════════════════════════════════════════════════════════════╝');
174
+ console.error('');
175
+ console.error('Erreur:', error.message);
176
+
177
+ if (error.code === 'ECONNREFUSED') {
178
+ console.error('');
179
+ console.error('💡 Assurez-vous que PostgreSQL est démarré:');
180
+ console.error(' docker ps | grep postgres-pgvector');
181
+ console.error('');
182
+ console.error('💡 Vérifiez les credentials dans .env:');
183
+ console.error(' POSTGRES_HOST=' + DB_CONFIG.host);
184
+ console.error(' POSTGRES_PORT=' + DB_CONFIG.port);
185
+ console.error(' POSTGRES_USER=' + DB_CONFIG.user);
186
+ console.error(' POSTGRES_PASSWORD=*** (votre mot de passe)');
187
+ }
188
+
189
+ process.exit(1);
190
+ }
191
+ }
192
+
193
+ // ═══════════════════════════════════════════════════════════════════════════════
194
+ // MAIN
195
+ // ═══════════════════════════════════════════════════════════════════════════════
196
+
197
+ if (import.meta.url === `file://${process.argv[1]}`) {
198
+ main();
199
+ }