Skip to content

The open-source app everyone uses to manage agents at work

refactor: use async fs.readFile in readCursorAuthInfo for consistency

Devin Foleybd60ea4909d1
diff --git a/packages/adapters/cursor-local/src/server/test.ts b/packages/adapters/cursor-local/src/server/test.ts
index b90380f350..c8e53b9848 100644
--- a/packages/adapters/cursor-local/src/server/test.ts
+++ b/packages/adapters/cursor-local/src/server/test.ts
@@ -12,7 +12,7 @@ import {
ensurePathInEnv,
runChildProcess,
} from "@paperclipai/adapter-utils/server-utils";
-import fs from "node:fs";
+import fs from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { DEFAULT_CURSOR_LOCAL_MODEL } from "../index.js";
@@ -61,10 +61,10 @@ export function cursorConfigPath(cursorHome?: string): string {
return path.join(cursorHome ?? path.join(os.homedir(), ".cursor"), "cli-config.json");
}
-export function readCursorAuthInfo(cursorHome?: string): CursorAuthInfo | null {
+export async function readCursorAuthInfo(cursorHome?: string): Promise<CursorAuthInfo | null> {
let raw: string;
try {
- raw = fs.readFileSync(cursorConfigPath(cursorHome), "utf8");
+ raw = await fs.readFile(cursorConfigPath(cursorHome), "utf8");
} catch {
return null;
}
@@ -147,7 +147,7 @@ export async function testEnvironment(
});
} else {
const cursorHome = isNonEmpty(env.CURSOR_HOME) ? env.CURSOR_HOME : undefined;
- const cursorAuth = readCursorAuthInfo(cursorHome);
+ const cursorAuth = await readCursorAuthInfo(cursorHome).catch(() => null);
if (cursorAuth) {
checks.push({
code: "cursor_native_auth_present",