---
name: Lint on Save
description: Run linter when Python or TypeScript files are saved
version: "2.0"
trigger:
  type: onSave
  filePattern: "**/*.{py,ts,tsx}"
---

When a file is saved:

1. If it's a Python file (`*.py`):
   - Run `nix-shell -p ruff --run "ruff check {filePath}"` on the saved file
   - If there are fixable issues, run `nix-shell -p ruff --run "ruff check --fix {filePath}"`
   - Report any remaining issues concisely

2. If it's a TypeScript/React file (`*.ts` or `*.tsx`) under `frontend/`:
   - Run `npx tsc --noEmit` from the `frontend/` directory to check types
   - Report any type errors concisely
