|
1 | 1 | ---
|
2 |
| -display_name: Cursor IDE |
3 |
| -description: Add a one-click button to launch Cursor IDE |
| 2 | +display_name: Cursor |
| 3 | +description: Run Cursor IDE and CLI in your workspace |
4 | 4 | icon: ../../../../.icons/cursor.svg
|
5 | 5 | verified: true
|
6 |
| -tags: [ide, cursor, ai] |
| 6 | +tags: [ide, cursor, ai, cli, agent] |
7 | 7 | ---
|
8 | 8 |
|
9 |
| -# Cursor IDE |
| 9 | +# Cursor |
10 | 10 |
|
11 |
| -Add a button to open any workspace with a single click in Cursor IDE. |
12 |
| - |
13 |
| -Uses the [Coder Remote VS Code Extension](https://github.com/coder/vscode-coder). |
| 11 | +Run [Cursor IDE](https://cursor.com) and [Cursor CLI](https://docs.cursor.com/en/cli/overview) in your workspace. Provides both desktop IDE integration and terminal-based AI coding assistance. |
14 | 12 |
|
15 | 13 | ```tf
|
16 | 14 | module "cursor" {
|
17 | 15 | count = data.coder_workspace.me.start_count
|
18 | 16 | source = "registry.coder.com/coder/cursor/coder"
|
19 |
| - version = "1.2.1" |
| 17 | + version = "2.0.0" |
20 | 18 | agent_id = coder_agent.example.id
|
| 19 | + folder = "/home/coder" |
21 | 20 | }
|
22 | 21 | ```
|
23 | 22 |
|
| 23 | +## Prerequisites |
| 24 | + |
| 25 | +- You must add the [Coder Login](https://registry.coder.com/modules/coder-login) module to your template |
| 26 | + |
| 27 | +## Features |
| 28 | + |
| 29 | +- **Desktop IDE**: One-click button to launch Cursor IDE (uses the [Coder Remote VS Code Extension](https://github.com/coder/vscode-coder)) |
| 30 | +- **CLI Agent**: Terminal-based AI coding assistant with interactive and non-interactive modes |
| 31 | +- **AgentAPI Integration**: Web interface for CLI interactions |
| 32 | +- **Interactive Mode**: Conversational sessions with text output |
| 33 | +- **Non-Interactive Mode**: Automation-friendly for scripts and CI pipelines |
| 34 | + |
24 | 35 | ## Examples
|
25 | 36 |
|
26 |
| -### Open in a specific directory |
| 37 | +### Basic setup with CLI enabled |
| 38 | + |
| 39 | +```tf |
| 40 | +module "coder-login" { |
| 41 | + count = data.coder_workspace.me.start_count |
| 42 | + source = "registry.coder.com/coder/coder-login/coder" |
| 43 | + version = "1.0.15" |
| 44 | + agent_id = coder_agent.example.id |
| 45 | +} |
| 46 | +
|
| 47 | +module "cursor" { |
| 48 | + count = data.coder_workspace.me.start_count |
| 49 | + source = "registry.coder.com/coder/cursor/coder" |
| 50 | + version = "2.0.0" |
| 51 | + agent_id = coder_agent.example.id |
| 52 | + folder = "/home/coder/project" |
| 53 | + install_cursor_cli = true |
| 54 | + install_agentapi = true |
| 55 | +} |
| 56 | +``` |
| 57 | + |
| 58 | +### Desktop IDE only (legacy mode) |
| 59 | + |
| 60 | +```tf |
| 61 | +module "cursor" { |
| 62 | + count = data.coder_workspace.me.start_count |
| 63 | + source = "registry.coder.com/coder/cursor/coder" |
| 64 | + version = "2.0.0" |
| 65 | + agent_id = coder_agent.example.id |
| 66 | + folder = "/home/coder/project" |
| 67 | + install_cursor_cli = false |
| 68 | + install_agentapi = false |
| 69 | +} |
| 70 | +``` |
| 71 | + |
| 72 | +### With custom pre-install script |
27 | 73 |
|
28 | 74 | ```tf
|
29 | 75 | module "cursor" {
|
30 | 76 | count = data.coder_workspace.me.start_count
|
31 | 77 | source = "registry.coder.com/coder/cursor/coder"
|
32 |
| - version = "1.2.1" |
| 78 | + version = "2.0.0" |
33 | 79 | agent_id = coder_agent.example.id
|
34 |
| - folder = "/home/coder/project" |
| 80 | + |
| 81 | + pre_install_script = <<-EOT |
| 82 | + # Install additional dependencies |
| 83 | + npm install -g typescript |
| 84 | + EOT |
35 | 85 | }
|
36 | 86 | ```
|
| 87 | + |
| 88 | +## Usage |
| 89 | + |
| 90 | +### Desktop IDE |
| 91 | +Click the "Cursor Desktop" button in your workspace to launch Cursor IDE. |
| 92 | + |
| 93 | +### CLI Agent |
| 94 | + |
| 95 | +#### Web Interface |
| 96 | +1. Click the "Cursor" button to access the web interface |
| 97 | +2. Start interactive sessions with text output |
| 98 | + |
| 99 | +#### Terminal Usage |
| 100 | +```bash |
| 101 | +# Interactive mode (default) |
| 102 | +cursor-agent |
| 103 | + |
| 104 | +# Interactive mode with initial prompt |
| 105 | +cursor-agent "refactor the auth module to use JWT tokens" |
| 106 | + |
| 107 | +# Non-interactive mode with text output |
| 108 | +cursor-agent -p "find and fix performance issues" --output-format text |
| 109 | + |
| 110 | +# Use specific model |
| 111 | +cursor-agent -p "add error handling" --model "gpt-5" |
| 112 | + |
| 113 | +# Session management |
| 114 | +cursor-agent ls # List all previous chats |
| 115 | +cursor-agent resume # Resume latest conversation |
| 116 | +cursor-agent --resume="chat-id" # Resume specific conversation |
| 117 | +``` |
| 118 | + |
| 119 | +#### Interactive Mode Features |
| 120 | +- Conversational sessions with the agent |
| 121 | +- Review proposed changes before applying |
| 122 | +- Real-time guidance and steering |
| 123 | +- Text-based output optimized for terminal use |
| 124 | +- Session persistence and resumption |
| 125 | + |
| 126 | +#### Non-Interactive Mode Features |
| 127 | +- Automation-friendly for scripts and CI pipelines |
| 128 | +- Direct prompt execution with text output |
| 129 | +- Model selection support |
| 130 | +- Git integration for change reviews |
| 131 | + |
| 132 | +## Configuration |
| 133 | + |
| 134 | +The module supports the same configuration options as the Cursor CLI: |
| 135 | +- **MCP (Model Context Protocol)**: Automatically detects `mcp.json` configuration |
| 136 | +- **Rules System**: Supports `.cursor/rules` directory for custom agent behavior |
| 137 | +- **Environment Variables**: Respects Cursor CLI environment settings |
| 138 | + |
| 139 | +## Troubleshooting |
| 140 | + |
| 141 | +The module creates log files in the workspace's `~/.cursor-module` directory. Check these files if you encounter issues: |
| 142 | + |
| 143 | +```bash |
| 144 | +# Check installation logs |
| 145 | +cat ~/.cursor-module/install.log |
| 146 | + |
| 147 | +# Check runtime logs |
| 148 | +cat ~/.cursor-module/runtime.log |
| 149 | + |
| 150 | +# Verify Cursor CLI installation |
| 151 | +cursor-agent --help |
| 152 | +``` |
| 153 | + |
| 154 | +### Common Issues |
| 155 | + |
| 156 | +1. **Cursor CLI not found**: Ensure `install_cursor_cli = true` or install manually: |
| 157 | + ```bash |
| 158 | + curl https://cursor.com/install -fsS | bash |
| 159 | + ``` |
| 160 | + |
| 161 | +2. **Permission issues**: Check that the installation script has proper permissions |
| 162 | + |
| 163 | +3. **Path issues**: The module automatically adds Cursor CLI to PATH, but you may need to restart your shell |
0 commit comments