Skip to content

armgit / Orkas

Public Imported from GitHub
0

Orkas is an open-source (MIT), local-first AI team for your desktop: a Commander turns your goal into to-dos and coordinates 16 built-in specialist agents plus Claude Code, Codex, OpenCode, OpenClaw and Hermes, with projects, scheduled automations and connectors. Free app for macOS & Windows; built-in models or your own keys.

2.1 KB
Raw Blame
@echo off
REM Windows counterpart of run.sh. An in-app relaunch waits for its exact
REM owner process. A direct launch closes only the previous source instance
REM owned by this checkout.
setlocal EnableExtensions EnableDelayedExpansion
set "APP_DIR=%~dp0"
if "%APP_DIR:~-1%"=="\" set "APP_DIR=%APP_DIR:~0,-1%"

if not exist "%APP_DIR%\package.json" (
  echo [Orkas] %APP_DIR%\package.json not found; check the project directory layout. 1>&2
  exit /b 1
)

echo [Orkas] Starting Orkas

node --version >nul 2>nul
if errorlevel 1 (
  echo [Orkas] Node.js is unavailable; preparing the pinned bundled runtime...
  powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -File "%APP_DIR%\scripts\bootstrap-node.ps1"
  if errorlevel 1 exit /b 1
  set "RUNTIME_KEY=win32-x64"
  if /I "%PROCESSOR_ARCHITECTURE%"=="ARM64" set "RUNTIME_KEY=win32-arm64"
  if /I "%PROCESSOR_ARCHITEW6432%"=="ARM64" set "RUNTIME_KEY=win32-arm64"
  set "PATH=%APP_DIR%\resources\runtime\node\!RUNTIME_KEY!;%PATH%"
)
node --version >nul 2>nul
if errorlevel 1 (
  echo [Orkas] Node.js is still unavailable after bootstrap. 1>&2
  exit /b 1
)

if defined ORKAS_RELAUNCH_OWNER_PID (
  powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -Command ^
    "$owner = 0; if (-not [int]::TryParse($env:ORKAS_RELAUNCH_OWNER_PID, [ref]$owner) -or $owner -le 0) { exit 2 }; try { Wait-Process -Id $owner -Timeout 15 -ErrorAction Stop } catch { if (Get-Process -Id $owner -ErrorAction SilentlyContinue) { exit 3 } }"
  if errorlevel 1 (
    echo [Orkas] Relaunch owner did not exit within 15 seconds; refusing to terminate unrelated processes. 1>&2
    exit /b 1
  )
  set "ORKAS_RELAUNCH_OWNER_PID="
)

call node "%APP_DIR%\scripts\stop-source-instance.cjs" --root "%APP_DIR%"
if errorlevel 1 exit /b 1

call node "%APP_DIR%\scripts\ensure-deps.cjs"
if errorlevel 1 exit /b 1
call node "%APP_DIR%\scripts\ensure-dev-dependencies.cjs"
if errorlevel 1 exit /b 1

pushd "%APP_DIR%"
REM Dependencies were prepared above; avoid repeating npm prestart:electron.
node "%APP_DIR%\node_modules\electron\cli.js" .
set "RC=%ERRORLEVEL%"
popd
exit /b %RC%