Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions crates/goose/src/providers/cursor_agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@ impl CursorAgentProvider {
})
}

/// Get authentication status from cursor-agent
async fn get_authentication_status(&self) -> bool {
Command::new(&self.command)
.arg("status")
.output()
.await
.ok()
.map(|output| String::from_utf8_lossy(&output.stdout).contains("✓ Logged in as"))
.unwrap_or(false)
}

/// Search for cursor-agent executable in common installation locations
fn find_cursor_agent_executable(command_name: &str) -> Option<String> {
let home = std::env::var("HOME").ok()?;
Expand Down Expand Up @@ -319,6 +330,11 @@ impl CursorAgentProvider {
})?;

if !exit_status.success() {
if !self.get_authentication_status().await {
return Err(ProviderError::Authentication(
"You are not logged in to cursor-agent. Please run 'cursor-agent login' to authenticate first."
.to_string()));
}
return Err(ProviderError::RequestFailed(format!(
"Command failed with exit code: {:?}",
exit_status.code()
Expand Down