@echo off
REM netabrowser-cli wrapper for Windows
REM Resolves CLI entrypoint relative to this script (skill dir → monorepo root → packages/netabrowser-cli)
setlocal
set "SCRIPT_DIR=%~dp0"
set "CLI_JS=%SCRIPT_DIR%..\..\..\..\netabrowser-cli\dist\bin\main.js"

REM Ensure Chromium binary is present (auto-download on first run)
node "%SCRIPT_DIR%ensure-chromium.cjs"
if errorlevel 1 (
  echo ERROR: chromium setup failed 1>&2
  exit /b 1
)

if not exist "%CLI_JS%" (
  echo ERROR: netabrowser-cli not built. Run: pnpm --filter @neta/netabrowser-cli build 1>&2
  exit /b 1
)
node "%CLI_JS%" %*
