diff --git a/scripts/build.mjs b/scripts/build.mjs index 105b877..125a2fa 100644 --- a/scripts/build.mjs +++ b/scripts/build.mjs @@ -27,6 +27,8 @@ await build({ "utf-8-validate", "zlib-sync", "erlpack", + // Puppeteer requires Chromium binary — cannot be bundled into exe + "puppeteer", ], // Define for proper environment define: { diff --git a/start_bot.bat b/start_bot.bat index ab11a51..ab85a8d 100644 --- a/start_bot.bat +++ b/start_bot.bat @@ -1,12 +1,50 @@ @echo off +setlocal enabledelayedexpansion chcp 65001 >nul 2>&1 title AI CLI Gateway Bot -if not exist node_modules ( - echo node_modules not found. Running npm install... - npm install +REM Change to the directory where this batch file is located +cd /d "%~dp0" + +echo ================================================ +echo AI CLI Gateway Bot - Starting... +echo ================================================ +echo Working Directory: %CD% +echo ================================================ +echo. + +REM Check if node_modules exists +if not exist "node_modules" ( + echo [INFO] node_modules not found. Running npm install... + call npm install + if !ERRORLEVEL! NEQ 0 ( + echo [ERROR] npm install failed! + goto :error + ) +) + +echo [INFO] Starting bot with tsx... +echo. + +call npx tsx src/bot.ts +if !ERRORLEVEL! NEQ 0 ( + echo. + echo [ERROR] Bot exited with error code: !ERRORLEVEL! + goto :error ) +goto :end + +:error +echo. +echo ================================================ +echo An error occurred! Check the messages above. +echo ================================================ +echo. +pause +exit /b 1 + +:end echo. -npx tsx src/bot.ts +echo [INFO] Bot stopped. pause