#!/usr/bin/env bash
set -euo pipefail

RUNTIME="${SPOON_AGENT_CONTAINER_RUNTIME:-}"
IMAGE="${SPOON_AGENT_LOCAL_JOB_IMAGE:-${SPOON_AGENT_JOB_IMAGE:-spoon-agent-job:latest}}"

if [[ -z "$RUNTIME" ]]; then
  if command -v podman >/dev/null 2>&1; then
    RUNTIME=podman
  elif command -v docker >/dev/null 2>&1; then
    RUNTIME=docker
  else
    printf 'smoke-agent-container: podman or docker is required.\n' >&2
    exit 1
  fi
fi

"$RUNTIME" run --rm "$IMAGE" bash -lc '
  set -euo pipefail
  node --version
  bun --version
  pnpm --version
  yarn --version
  npm --version
  git --version
  rg --version >/dev/null
  jq --version
  python3 --version
  opencode --version
  codex --version
'
