-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.js
More file actions
88 lines (73 loc) · 3.08 KB
/
Copy pathinstall.js
File metadata and controls
88 lines (73 loc) · 3.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/usr/bin/env node
/**
* Installation and setup script for MCP2OSC
* Installs dependencies and sets up the system
*/
import { spawn } from 'child_process';
import { existsSync } from 'fs';
import { mkdir } from 'fs/promises';
console.log('📦 MCP2OSC Installation Setup');
console.log('=============================\n');
async function install() {
try {
// Step 1: Install dependencies
console.log('1. Installing dependencies...');
await runCommand('npm', ['install']);
// Step 1.5: Install pattern extraction dependencies
console.log('1.5. Installing pattern extraction dependencies...');
const patternDeps = ['express', 'multer', 'pdf-parse', 'mammoth', 'xlsx'];
await runCommand('npm', ['install', ...patternDeps]);
// Step 1.6: Verify critical dependencies are working
console.log('1.6. Verifying pattern extraction dependencies...');
try {
await import('pdf-parse');
console.log(' ✅ pdf-parse working correctly');
} catch (error) {
console.log(' ⚠️ pdf-parse verification failed, trying alternative install...');
await runCommand('npm', ['install', 'pdf-parse', '--force']);
}
console.log(' ✅ Pattern extraction dependencies installed');
// Step 2: Create directories
console.log('\n2. Creating directories...');
const dirs = ['logs', 'uploads'];
for (const dir of dirs) {
if (!existsSync(dir)) {
await mkdir(dir, { recursive: true });
console.log(` ✅ Created ${dir}/`);
} else {
console.log(` ✅ ${dir}/ already exists`);
}
}
// Step 3: Run verification
console.log('\n3. Running verification...');
await runCommand('node', ['verify-startup.js']);
console.log('\n✅ Installation complete!');
console.log('\n🚀 Quick start:');
console.log('- MCP + dashboard: npm start (or: npm run mcp)');
console.log('- Claude Desktop only: point MCP config at node mcp-server.js (see README)');
console.log('\n📖 Optional pattern upload (dashboard):');
console.log('1. Start services, then visit http://localhost:3001/upload');
console.log('2. Upload manuals (PDF, Word, TXT, Excel) if using extraction features');
console.log('3. Ask your LLM for pattern summary / search as needed');
} catch (error) {
console.error('❌ Installation failed:', error.message);
process.exit(1);
}
}
function runCommand(command, args) {
return new Promise((resolve, reject) => {
const proc = spawn(command, args, {
stdio: ['inherit', 'inherit', 'inherit'],
shell: process.platform === 'win32'
});
proc.on('exit', (code) => {
if (code === 0) {
resolve();
} else {
reject(new Error(`Command failed with exit code ${code}`));
}
});
proc.on('error', reject);
});
}
install();