fix pnpm play
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
import type { McpServerConfig } from "@anthropic-ai/claude-agent-sdk";
|
||||
import { workflows } from "../../lib/workflows.ts";
|
||||
import { ghPullfrogMcpName } from "../mcp/config.ts";
|
||||
import { workflows } from "../workflows.ts";
|
||||
|
||||
/**
|
||||
* Result returned by agent execution
|
||||
|
||||
@@ -33,8 +33,8 @@ export async function main(inputs: Inputs): Promise<MainResult> {
|
||||
|
||||
// Fetch repo settings (agent, permissions, workflows) from API
|
||||
const repoSettings = await getRepoSettings(githubInstallationToken, repoContext);
|
||||
if (repoSettings.defaultAgent !== "claude")
|
||||
throw new Error(`Unsupported agent: ${repoSettings.defaultAgent}`);
|
||||
const agent = repoSettings.defaultAgent || "claude";
|
||||
if (agent !== "claude") throw new Error(`Unsupported agent: ${agent}`);
|
||||
|
||||
setupGitAuth(githubInstallationToken, repoContext);
|
||||
|
||||
|
||||
+6749
-7729
File diff suppressed because one or more lines are too long
+25
-22
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user