#!/bin/bash
cd "$(dirname "$0")"

echo "Starting AGI Brain..."
echo "Checking for Node.js..."
if ! command -v node &> /dev/null
then
    echo "[ERROR] Node.js is not installed!"
    echo "Please install Node.js using your package manager (e.g., sudo apt install nodejs npm) or visit https://nodejs.org/"
    exit 1
fi

echo "Installing dependencies (this may take a few minutes on first run)..."
npm install

echo "Ensuring data directories exist..."
mkdir -p data

echo "Launching AGI..."
node src/Brainstem.js
