From 8312af79a414713b4cd1823972ac0f9efeadcd5a Mon Sep 17 00:00:00 2001 From: Ibrahim Ryan Date: Mon, 23 Mar 2026 10:31:29 +0700 Subject: [PATCH] fix(cursor): verify Cursor installation on Linux before auto-import On Linux, verify that Cursor IDE is actually installed before importing tokens. Previously, leftover config files from a removed Cursor installation would trigger a false positive, creating a phantom Cursor provider connection. The check uses `which cursor` and falls back to checking for a .desktop file in ~/.local/share/applications/ Fixes #313 Co-authored-by: Ibrahim Ryan Made-with: Cursor --- src/app/api/oauth/cursor/auto-import/route.js | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/app/api/oauth/cursor/auto-import/route.js b/src/app/api/oauth/cursor/auto-import/route.js index 0894941..f866e21 100644 --- a/src/app/api/oauth/cursor/auto-import/route.js +++ b/src/app/api/oauth/cursor/auto-import/route.js @@ -156,6 +156,27 @@ export async function GET() { }); } + // On Linux, verify Cursor is actually installed (not just leftover config) + if (platform === "linux") { + let cursorInstalled = false; + try { + await execFileAsync("which", ["cursor"], { timeout: 5000 }); + cursorInstalled = true; + } catch { + try { + const desktopFile = join(homedir(), ".local/share/applications/cursor.desktop"); + await access(desktopFile, constants.R_OK); + cursorInstalled = true; + } catch { /* not found */ } + } + if (!cursorInstalled) { + return NextResponse.json({ + found: false, + error: "Cursor config files found but Cursor IDE does not appear to be installed. Skipping auto-import.", + }); + } + } + // Strategy 1: sqlite3 CLI try { const tokens = await extractTokensViaCLI(dbPath);