diff --git a/README.md b/README.md index e373a3e..e1e85ac 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ It lets an LLM use controlled local tools (screen, click, type, shell) to comple main.py screenjob.py requirements.txt -docker-compose.yml +start_backend.ps1 src/ agent.py app_main.py @@ -103,6 +103,12 @@ CLI JSON output includes both legacy and structured fields: python main.py server ``` +Or use the PowerShell launcher: + +```powershell +.\start_backend.ps1 +``` + Auth for all API routes: - `Authorization: Bearer ` @@ -164,16 +170,6 @@ Each job payload includes: `data` should contain useful structured output for the requester (text, object, list, etc.). -## Docker Compose - -Run server in container: - -```powershell -docker compose up --build -``` - -Service uses official Python image and reads `.env`. - ## Verification Local: diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 68d694d..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,17 +0,0 @@ -services: - screenjob: - image: python:3.11-slim - working_dir: /app - env_file: - - .env - environment: - SCREENJOB_HOST: 0.0.0.0 - SCREENJOB_PORT: 8787 - volumes: - - ./:/app - ports: - - "8787:8787" - command: > - sh -c "pip install --no-cache-dir -r requirements.txt && - python main.py server" - restart: unless-stopped diff --git a/start_backend.ps1 b/start_backend.ps1 new file mode 100644 index 0000000..467ecd5 --- /dev/null +++ b/start_backend.ps1 @@ -0,0 +1,35 @@ +Set-StrictMode -Version Latest +$ErrorActionPreference = "Stop" + +$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path +Set-Location $scriptDir + +function Test-EnvVarLine { + param( + [Parameter(Mandatory = $true)][string]$FilePath, + [Parameter(Mandatory = $true)][string]$Name + ) + if (-not (Test-Path -LiteralPath $FilePath)) { + return $false + } + return [bool](Select-String -Path $FilePath -Pattern ("^\s*" + [regex]::Escape($Name) + "=") -Quiet) +} + +if (-not (Get-Command python -ErrorAction SilentlyContinue)) { + throw "Python was not found in PATH. Install Python 3.11+ and retry." +} + +$envFile = Join-Path $scriptDir ".env" +if (-not (Test-Path -LiteralPath $envFile)) { + Write-Warning ".env was not found at $envFile. Server startup may fail if required vars are missing." +} else { + if (-not (Test-EnvVarLine -FilePath $envFile -Name "OPENAI_API_KEY")) { + Write-Warning ".env is missing OPENAI_API_KEY." + } + if (-not (Test-EnvVarLine -FilePath $envFile -Name "SCREENJOB_TOKEN")) { + Write-Warning ".env is missing SCREENJOB_TOKEN." + } +} + +Write-Host "Starting ScreenJob backend on configured host/port..." -ForegroundColor Cyan +python main.py server