harshitsinghbhandari
|
464f771a76
|
feat: add Cursor agent CLI support (#1060)
Implement a new agent plugin for Cursor CLI following the existing agent plugin pattern.
## Changes
- Create `packages/plugins/agent-cursor/` with full Agent interface implementation
- Add Cursor plugin to CLI dependencies
- Implement all required methods:
- getLaunchCommand - command to start Cursor CLI with flags
- getEnvironment - env vars including ~/.ao/bin in PATH
- detectActivity - terminal output classification for Cursor prompts
- getActivityState - JSONL/activity-based state detection with fallbacks
- isProcessRunning - process liveness check (tmux TTY + PID)
- setupWorkspaceHooks - PATH wrappers for git/gh metadata capture
- getSessionInfo - extract summary from .cursor directory if available
- recordActivity - delegate to shared recordTerminalActivity
- postLaunchSetup - ensure hooks are installed post-launch
- getRestoreCommand - returns null (Cursor doesn't support session resume)
## Testing
- Comprehensive test suite with 52 passing tests covering:
- Manifest validation
- Command generation with permission modes
- Process detection (tmux + process runtime)
- Activity detection from terminal output
- Activity state cascade (JSONL → git commits → session mtime → fallback)
- All required getActivityState contract states (exited, waiting_input, blocked, active, idle)
- Session info extraction
- Environment setup
## Pattern
Follows the Aider agent pattern using:
- PATH wrappers (`~/.ao/bin/gh`, `~/.ao/bin/git`) for metadata capture
- AO Activity JSONL for terminal-derived activity detection
- Age-based decay for active/ready/idle state transitions
- Process name regex matching both `cursor` and `.cursor` (dot-prefixed)
Closes #1060
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
2026-04-09 18:51:33 +05:30 |