name: test-vscode

on:
  push:
    branches:
      - main
      - dev
    paths:
      - "packages/kilo-vscode/**"
      - "packages/ui/**"
      - "packages/kilo-ui/**"
      - ".github/workflows/test-vscode.yml"
  pull_request:
    paths:
      - "packages/kilo-vscode/**"
      - "packages/ui/**"
      - "packages/kilo-ui/**"
      - ".github/workflows/test-vscode.yml"
  workflow_dispatch:

jobs:
  unit:
    name: unit tests
    runs-on: blacksmith-4vcpu-ubuntu-2404
    defaults:
      run:
        shell: bash
    steps:
      - name: Checkout repository
        uses: actions/checkout@v6 # kilocode_change
        with:
          token: ${{ secrets.GITHUB_TOKEN }}

      - name: Setup Bun
        uses: ./.github/actions/setup-bun

      - name: Run unit tests
        working-directory: packages/kilo-vscode
        run: bun run test:unit

      - name: Check lint (ESLint)
        working-directory: packages/kilo-vscode
        run: bun run lint

      - name: Check formatting (prettier)
        working-directory: packages/kilo-vscode
        run: bun run format:check

      - name: Check for dead code (knip)
        working-directory: packages/kilo-vscode
        run: bun run knip

      - name: Check for kilocode_change markers
        working-directory: packages/kilo-vscode
        run: bun run check-kilocode-change
