#!/usr/bin/env bash
set -Eeuo pipefail
ROOT="${SHIRE_ROOT:-/home/shire3d/ARMOR}"
echo "This performs dependency installation and build checks only. It does not enable hardware, Forge export, Base44-dependent workflows or external actions."
for app in scanforge store-doctor-foundation limbforge covercanvas; do
  echo; echo "=== npm build check: $app ==="
  cd "$ROOT/agents/apps/$app"
  npm ci --no-audit --no-fund
  case "$app" in
    scanforge) npm run lint; npm run typecheck; npm run build:shire; npm run build:standalone ;;
    limbforge) npm run lint; npm run typecheck; npm run viewport-safety; npm run build ;;
    *) npm run lint; npm run typecheck; npm run build ;;
  esac
done

echo; echo "=== FlexiForge isolated Python environment ==="
cd "$ROOT/agents/apps/flexiforge"
python3 -m venv .venv
. .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -r requirements-dev.txt
PYTHONPATH=backend python -m pytest -q
npm --prefix frontend ci --no-audit --no-fund
npm --prefix frontend run build
echo "Build checks completed. No staged Agent was enabled automatically."
