---
name: CI/CD Type Checking Integration
status: closed
created: 2025-10-13T11:02:21Z
updated: 2025-10-14T08:37:16Z
github: https://github.com/BuzzTrail/video-extension/issues/136
depends_on: [005, 006, 007]
parallel: false
conflicts_with: []
---
When changing versions or addding or subtracking packages always use pnpm commands.  Don't just edit the package.json directly.

# Task: CI/CD Type Checking Integration

## Description

Integrate TypeScript type checking, ESLint linting, and Python mypy checks into the CI/CD pipeline. Configure the pipeline to fail builds when type errors are detected, preventing bad code from reaching production.

## Acceptance Criteria

- [ ] TypeScript type checking added to CI pipeline
- [ ] ESLint type-aware linting added to CI pipeline
- [ ] Python mypy checks added for both bots
- [ ] CI fails on type errors (non-zero exit code)
- [ ] Clear error messages guide developers to fixes
- [ ] Pre-commit hooks configured (optional but recommended)
- [ ] Documentation updated with CI/CD requirements

## Technical Details

**Phase 1: Update CI Configuration**

For GitHub Actions (`.github/workflows/ci.yml`):
```yaml
name: CI

on: [push, pull_request]

jobs:
  typecheck:
    name: Type Checking
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - name: Setup Node.js
        uses: actions/setup-node@v3
        with:
          node-version: '22'

      - name: Install pnpm
        run: npm install -g pnpm

      - name: Install dependencies
        run: pnpm install

      - name: TypeScript Type Check
        run: pnpm nx affected:typecheck --base=origin/main

      - name: ESLint Type-Aware Rules
        run: pnpm nx affected:lint --base=origin/main

  python-typecheck:
    name: Python Type Checking
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - name: Setup Python
        uses: actions/setup-python@v4
        with:
          python-version: '3.11'

      - name: Install uv
        run: pip install uv

      - name: Screenshare Bot Type Check
        run: |
          cd apps/slide-system/bots/screenshare-bot
          uv venv
          source .venv/bin/activate
          uv pip install mypy types-aiohttp types-requests
          mypy bot.py

      - name: Tool Forwarder Bot Type Check
        run: |
          cd apps/slide-system/bots/tavus-tool-forwarder
          uv venv
          source .venv/bin/activate
          uv pip install mypy types-aiohttp types-requests
          mypy bot.py
```

For Railway deployment (if applicable), update `railway.toml` or deployment scripts.

**Phase 2: Configure Pre-commit Hooks (Optional)**

Install Husky for Git hooks:
```bash
pnpm add -D husky
pnpm exec husky init
```

Create `.husky/pre-commit`:
```bash
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

# TypeScript type check (affected files only)
pnpm nx affected:typecheck --base=HEAD~1

# Python type check (if Python files changed)
if git diff --cached --name-only | grep -q "\.py$"; then
  echo "Running Python type checks..."
  cd apps/slide-system/bots/screenshare-bot && source .venv/bin/activate && mypy .
  cd ../tavus-tool-forwarder && source .venv/bin/activate && mypy .
fi
```

Allow bypass with `--no-verify`:
```bash
git commit --no-verify -m "Emergency fix"
```

**Phase 3: Update Documentation**

Add to `README.md`:
```markdown
## Type Checking

### Local Development
```bash
# Check TypeScript types
pnpm nx affected:typecheck

# Check ESLint (type-aware rules)
pnpm nx affected:lint

# Check Python types
cd apps/slide-system/bots/screenshare-bot
source .venv/bin/activate
mypy .
```

### CI Pipeline
Type checking runs automatically on:
- Push to any branch
- Pull request creation
- Pull request updates

Builds will fail if type errors are detected.
```

**Phase 4: Error Reporting**

Configure CI to provide clear error messages:
- Show which files have type errors
- Display error counts
- Link to documentation on fixing common errors
- Provide command to reproduce locally

## Dependencies

- [ ] Task 005 completed (ESLint violations fixed)
- [ ] Task 006 completed (Screenshare bot types ready)
- [ ] Task 007 completed (Tool forwarder bot types ready)

## Effort Estimate

- **Size**: M
- **Hours**: 6 hours
- **Parallel**: false (needs all type checking to be working)

## Definition of Done

- [ ] CI pipeline includes TypeScript type checking
- [ ] CI pipeline includes ESLint type-aware linting
- [ ] CI pipeline includes Python mypy checks
- [ ] CI fails on type errors
- [ ] Error messages are clear and actionable
- [ ] Pre-commit hooks configured (optional)
- [ ] Documentation updated
- [ ] Team notified of new CI requirements
- [ ] At least one successful CI run with all checks passing
