fix pnpm play

This commit is contained in:
David Blass
2025-11-11 16:42:30 -05:00
parent e8ca1d87ef
commit 0bf456b6dc
5 changed files with 7174 additions and 8151 deletions
+25 -22
View File
@@ -24,7 +24,7 @@ const DEFAULT_REPO_SETTINGS: RepoSettings = {
/**
* Fetch repository settings from the Pullfrog API with fallback to defaults
* Returns agent, permissions, and workflows (excludes triggers)
* Returns null if repo doesn't exist, defaults if fetch fails
* Returns defaults if repo doesn't exist or fetch fails
*/
export async function getRepoSettings(
token: string,
@@ -32,30 +32,33 @@ export async function getRepoSettings(
): Promise<RepoSettings> {
const apiUrl = process.env.API_URL || "https://pullfrog.ai";
const response = await fetch(
`${apiUrl}/api/repo/${repoContext.owner}/${repoContext.name}/settings`,
{
method: "GET",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
},
}
);
if (!response.ok) {
const errorText = await response.text();
throw new Error(
`Failed to fetch repo settings: ${response.status} ${response.statusText} - ${errorText}`
try {
const response = await fetch(
`${apiUrl}/api/repo/${repoContext.owner}/${repoContext.name}/settings`,
{
method: "GET",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
},
}
);
}
const settings = (await response.json()) as RepoSettings | null;
if (!response.ok) {
// If API returns 404 or other error, fall back to defaults
return DEFAULT_REPO_SETTINGS;
}
// If API returns null (repo doesn't exist), return defaults
if (settings === null) {
const settings = (await response.json()) as RepoSettings | null;
// If API returns null (repo doesn't exist), return defaults
if (settings === null) {
return DEFAULT_REPO_SETTINGS;
}
return settings;
} catch {
// If fetch fails (network error, etc.), fall back to defaults
return DEFAULT_REPO_SETTINGS;
}
return settings;
}