80 lines
2.0 KiB
Batchfile
80 lines
2.0 KiB
Batchfile
|
|
@echo off
|
||
|
|
REM ========================================
|
||
|
|
REM Ajarbot - Windows One-Command Launcher
|
||
|
|
REM ========================================
|
||
|
|
REM
|
||
|
|
REM This script:
|
||
|
|
REM 1. Creates/activates virtual environment
|
||
|
|
REM 2. Installs dependencies if needed
|
||
|
|
REM 3. Runs ajarbot.py
|
||
|
|
REM
|
||
|
|
REM Usage:
|
||
|
|
REM run.bat Run the bot
|
||
|
|
REM run.bat --init Generate config template
|
||
|
|
REM run.bat --health Health check
|
||
|
|
REM
|
||
|
|
|
||
|
|
echo ========================================
|
||
|
|
echo Ajarbot Windows Launcher
|
||
|
|
echo ========================================
|
||
|
|
echo.
|
||
|
|
|
||
|
|
REM Check if virtual environment exists
|
||
|
|
if not exist "venv\Scripts\activate.bat" (
|
||
|
|
echo [Setup] Creating virtual environment...
|
||
|
|
python -m venv venv
|
||
|
|
if errorlevel 1 (
|
||
|
|
echo ERROR: Failed to create virtual environment
|
||
|
|
echo Please ensure Python 3.10+ is installed and in PATH
|
||
|
|
pause
|
||
|
|
exit /b 1
|
||
|
|
)
|
||
|
|
echo [Setup] Virtual environment created
|
||
|
|
)
|
||
|
|
|
||
|
|
REM Activate virtual environment
|
||
|
|
echo [Setup] Activating virtual environment...
|
||
|
|
call venv\Scripts\activate.bat
|
||
|
|
if errorlevel 1 (
|
||
|
|
echo ERROR: Failed to activate virtual environment
|
||
|
|
pause
|
||
|
|
exit /b 1
|
||
|
|
)
|
||
|
|
|
||
|
|
REM Check if dependencies are installed (check for a key package)
|
||
|
|
python -c "import anthropic" 2>nul
|
||
|
|
if errorlevel 1 (
|
||
|
|
echo.
|
||
|
|
echo [Setup] Installing dependencies...
|
||
|
|
echo This may take a few minutes on first run...
|
||
|
|
python -m pip install --upgrade pip
|
||
|
|
pip install -r requirements.txt
|
||
|
|
if errorlevel 1 (
|
||
|
|
echo ERROR: Failed to install dependencies
|
||
|
|
pause
|
||
|
|
exit /b 1
|
||
|
|
)
|
||
|
|
echo [Setup] Dependencies installed
|
||
|
|
echo.
|
||
|
|
)
|
||
|
|
|
||
|
|
REM Run ajarbot with all arguments passed through
|
||
|
|
echo [Launch] Starting ajarbot...
|
||
|
|
echo.
|
||
|
|
python ajarbot.py %*
|
||
|
|
|
||
|
|
REM Check exit code
|
||
|
|
if errorlevel 1 (
|
||
|
|
echo.
|
||
|
|
echo ========================================
|
||
|
|
echo Ajarbot exited with an error
|
||
|
|
echo ========================================
|
||
|
|
pause
|
||
|
|
exit /b 1
|
||
|
|
)
|
||
|
|
|
||
|
|
echo.
|
||
|
|
echo ========================================
|
||
|
|
echo Ajarbot stopped cleanly
|
||
|
|
echo ========================================
|