-
Notifications
You must be signed in to change notification settings - Fork 82
Expand file tree
/
Copy pathcursor.sh
More file actions
34 lines (29 loc) · 1.02 KB
/
cursor.sh
File metadata and controls
34 lines (29 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env bash
# Cursor AI agent adapter
# Check if Cursor agent/CLI is available
ai_can_start() {
command -v cursor-agent >/dev/null 2>&1 || command -v cursor >/dev/null 2>&1
}
# Start Cursor agent in a directory
# Usage: ai_start path [args...]
ai_start() {
local path="$1"
shift
local configured_args=("${GTR_AI_CMD_ARGS[@]}")
if ! ai_can_start; then
log_error "Cursor not found. Install from https://cursor.com"
log_info "Make sure to enable the Cursor CLI/agent from the app"
return 1
fi
if [ ! -d "$path" ]; then
log_error "Directory not found: $path"
return 1
fi
# Try cursor-agent first, then fallback to cursor CLI commands
if command -v cursor-agent >/dev/null 2>&1; then
(cd "$path" && cursor-agent "${configured_args[@]}" "$@")
elif command -v cursor >/dev/null 2>&1; then
# Try various Cursor CLI patterns (implementation varies by version)
(cd "$path" && cursor cli "${configured_args[@]}" "$@") 2>/dev/null || (cd "$path" && cursor "${configured_args[@]}" "$@")
fi
}