feat: switch to uv, add check command, fix silent a11y failures

- Added pyobjc-framework-ApplicationServices to dependencies (was
  implicitly available via pyenv's system packages but missing in
  clean venvs)
- Added `cursor-flasher check` command that verifies Cursor is running
  and accessibility permissions are working
- Detector now logs a warning when a11y tree reads fail (previously
  failed silently, making permission issues invisible)
- Switched to uv for dependency management: `uv sync` + `uv run`
- Updated README with uv-based workflow and accessibility
  troubleshooting guide

Made-with: Cursor
This commit is contained in:
cottongin
2026-03-10 03:12:10 -04:00
parent 1a5de8cf8a
commit ba656291ab
9 changed files with 527 additions and 15 deletions

View File

@@ -6,29 +6,33 @@ A macOS daemon that flashes a pulsing border around Cursor IDE windows when the
- macOS
- Python 3.10+
- [uv](https://docs.astral.sh/uv/) (recommended)
- **Accessibility permission** granted to your terminal (System Settings → Privacy & Security → Accessibility)
## Installation
```bash
git clone <repo-url> && cd cursor-flasher
pip install -e ".[dev]"
uv sync
```
## Usage
```bash
# Verify accessibility permissions work from your terminal
uv run cursor-flasher check
# Start the daemon (backgrounds automatically)
cursor-flasher start
uv run cursor-flasher start
# Start in foreground (useful for debugging)
cursor-flasher start --foreground
uv run cursor-flasher start --foreground
# Check if the daemon is running
cursor-flasher status
uv run cursor-flasher status
# Stop the daemon
cursor-flasher stop
uv run cursor-flasher stop
```
## How It Works
@@ -68,27 +72,40 @@ All values are optional — defaults are used for anything not specified.
## Troubleshooting
**"Cursor is not running" / no detection:**
Make sure Cursor is open. The daemon looks for the process by bundle ID.
### "Cannot read accessibility tree" / no detection
**No overlay appears:**
Grant Accessibility permission to your terminal app: System Settings → Privacy & Security → Accessibility. You may need to restart the terminal after granting.
This is almost always an Accessibility permission issue. Run:
**Overlay appears on wrong windows:**
Detection is per-window — only windows with active approval prompts (Accept, Reject, Run, etc.) should flash. If you see false positives, the detection patterns may need tuning for your Cursor version. Check `scripts/dump_a11y_tree.py` to inspect the accessibility tree.
```bash
uv run cursor-flasher check
```
If it reports a failure, your terminal app needs Accessibility permission:
1. Open **System Settings → Privacy & Security → Accessibility**
2. Click the **+** button and add your terminal app (Terminal.app, Ghostty, iTerm2, etc.)
3. Restart the terminal after granting permission
### Cursor not detected
Make sure Cursor is running. The daemon identifies it by bundle ID (`com.todesktop.230313mzl4w4u92`).
### Overlay appears on wrong windows
Detection is per-window — only windows with active approval prompts (Accept, Reject, Run, etc.) should flash. If you see false positives, the detection patterns may need tuning for your Cursor version. Use `scripts/dump_a11y_tree.py` to inspect what the accessibility tree looks like.
## Development
```bash
# Run tests
pytest tests/ -v
uv run pytest tests/ -v
# Dump Cursor's accessibility tree (for debugging detection)
python scripts/dump_a11y_tree.py --depth 8
uv run python scripts/dump_a11y_tree.py --depth 8
# Manual overlay test (flashes all windows for 10 seconds)
python scripts/test_overlay.py
uv run python scripts/test_overlay.py
# Manual overlay test (only windows needing attention)
python scripts/test_overlay.py --per-window
uv run python scripts/test_overlay.py --per-window
```