UNPKG

mira-consciousness

Version:

Memory & Intelligence Retention Archive - Preserving The Spark

66 lines (53 loc) 1.86 kB
#!/usr/bin/env node import fs from 'fs-extra'; import path from 'path'; import { execSync } from 'child_process'; import { fileURLToPath } from 'url'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); console.log('Building MIRA Memory...'); // Run TypeScript compiler from parent directory console.log('Compiling TypeScript...'); // Use build config if it exists, otherwise use default const tsconfigPath = path.join(__dirname, '../../tsconfig.build.json'); const tscCommand = fs.existsSync(tsconfigPath) ? `npx tsc -p ${tsconfigPath}` : 'npx tsc'; execSync(tscCommand, { stdio: 'inherit', cwd: path.join(__dirname, '../..') }); // Copy Python files to dist console.log('Copying Python memory system...'); const distDir = path.join(__dirname, '../dist'); // Copy python-memory directory fs.copySync( path.join(__dirname, '../python-memory'), path.join(distDir, 'python-memory'), { filter: (src) => !src.includes('__pycache__') } ); // Skip python-system for now - not needed in npm package // Copy templates fs.copySync( path.join(__dirname, '../templates'), path.join(distDir, 'templates') ); // Copy scripts fs.copySync( path.join(__dirname, '../scripts'), path.join(distDir, 'scripts') ); // Copy Claude bridge Python files to a specific location console.log('Copying Claude bridge files...'); const claudeBridgeDir = path.join(distDir, 'claude-bridge'); fs.ensureDirSync(claudeBridgeDir); // Copy the essential bridge files const bridgeFiles = [ 'enhanced_bridge_server.py', 'bridge_server.py' ]; const sourcePath = path.join(__dirname, '../src/services/claude'); bridgeFiles.forEach(file => { const srcFile = path.join(sourcePath, file); if (fs.existsSync(srcFile)) { fs.copySync(srcFile, path.join(claudeBridgeDir, file)); } }); console.log('Build complete!');