refactor: use async fs.readFile in readCursorAuthInfo for consistency
Match the async pattern used by readCodexAuthInfo in the Codex adapter.
This commit is contained in:
parent
083d7c9ac4
commit
bd60ea4909
1 changed files with 4 additions and 4 deletions
|
|
@ -12,7 +12,7 @@ import {
|
||||||
ensurePathInEnv,
|
ensurePathInEnv,
|
||||||
runChildProcess,
|
runChildProcess,
|
||||||
} from "@paperclipai/adapter-utils/server-utils";
|
} from "@paperclipai/adapter-utils/server-utils";
|
||||||
import fs from "node:fs";
|
import fs from "node:fs/promises";
|
||||||
import os from "node:os";
|
import os from "node:os";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
import { DEFAULT_CURSOR_LOCAL_MODEL } from "../index.js";
|
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");
|
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;
|
let raw: string;
|
||||||
try {
|
try {
|
||||||
raw = fs.readFileSync(cursorConfigPath(cursorHome), "utf8");
|
raw = await fs.readFile(cursorConfigPath(cursorHome), "utf8");
|
||||||
} catch {
|
} catch {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -147,7 +147,7 @@ export async function testEnvironment(
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
const cursorHome = isNonEmpty(env.CURSOR_HOME) ? env.CURSOR_HOME : undefined;
|
const cursorHome = isNonEmpty(env.CURSOR_HOME) ? env.CURSOR_HOME : undefined;
|
||||||
const cursorAuth = readCursorAuthInfo(cursorHome);
|
const cursorAuth = await readCursorAuthInfo(cursorHome).catch(() => null);
|
||||||
if (cursorAuth) {
|
if (cursorAuth) {
|
||||||
checks.push({
|
checks.push({
|
||||||
code: "cursor_native_auth_present",
|
code: "cursor_native_auth_present",
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue