name: CI and Production Smoke

on:
  push:
    branches:
      - main

jobs:
  smoke:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v3

      - name: Validate shell scripts
        run: |
          set -euo pipefail
          find scripts -name '*.sh' -print0 | xargs -0 -n1 bash -n

      - name: Validate production compose contract
        run: |
          set -euo pipefail
          test -f docker-compose.yml
          grep -q 'ADMIN_USERNAME' docker-compose.yml
          grep -q 'ADMIN_PASSWORD' docker-compose.yml
          grep -q 'TRAFFIC_MONITOR_TOKEN' docker-compose.yml
          grep -q 'VIBEWORK_TREASURY_USDC_ADDRESS' docker-compose.yml

      - name: Smoke production health
        run: |
          set -euo pipefail
          curl -fsS https://agent.wooo.work/api/v1/health | grep -q '"status":"ok"'
          curl -fsS https://agent.wooo.work/api/open-tasks >/tmp/open-tasks.json
          curl -fsS 'https://agent.wooo.work/api/a2a/growth/kit?agent_id=ci-smoke&register=false' | grep -q 'vibework.wooo.work/propose'
