name: PR CLI

on:
  pull_request:
    paths:
      - 'cli/**'
      - 'Makefile'
      - '.github/workflows/pr-cli.yml'

permissions:
  contents: read

jobs:
  cli:
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v4
        with:
          persist-credentials: false
      - uses: oven-sh/setup-bun@v2
        with:
          bun-version: 1.3.13
      - run: bun install --frozen-lockfile
        working-directory: cli
      - run: bun run lint
        working-directory: cli
      - run: bun run typecheck
        working-directory: cli
      - run: bun test
        working-directory: cli
      - run: bun run build
        working-directory: cli
      - run: node dist/index.js version
        working-directory: cli
