Cursor CLI 讓你可以直接在終端機與 AI 代理互動,用來撰寫、審查與修改程式碼。無論你偏好互動式終端介面,或是要在指令稿與 CI pipeline 中做輸出自動化,CLI 都能在你工作的地方提供強大的程式輔助。
# Install
curl https://cursor.com/install -fsS | bash

# Run interactive session
cursor-agent
Cursor CLI 目前為測試版,超想聽聽你的回饋!

互動模式

啟動與代理的對話式工作階段,描述你的目標、檢視提議的變更,並核准指令:
# Start interactive session
cursor-agent

# Start with initial prompt
cursor-agent "refactor the auth module to use JWT tokens"

非互動模式

在指令稿、CI pipeline 或自動化等非互動情境使用輸出模式:
# Run with specific prompt and model
cursor-agent -p "find and fix performance issues" --model "gpt-5"

# Use with git changes included for review
cursor-agent -p "review these changes for security issues" --output-format text

工作階段

延續先前的對話,在多次互動間維持脈絡:
# List all previous chats
cursor-agent ls

# Resume latest conversation  
cursor-agent resume

# Resume specific conversation
cursor-agent --resume="chat-id-here"