add more codex logic

This commit is contained in:
Shawn Morreau
2025-11-12 19:22:48 -05:00
parent 71698d3e07
commit 7aaebe9584
9 changed files with 948 additions and 907 deletions
+27 -1
View File
@@ -1,7 +1,9 @@
import type { AgentName } from "../main.ts";
import { log } from "./cli.ts";
import type { RepoContext } from "./github.ts";
export interface RepoSettings {
defaultAgent: string | null;
defaultAgent: AgentName | null;
webAccessLevel: "full_access" | "limited";
webAccessAllowTrusted: boolean;
webAccessDomains: string;
@@ -21,6 +23,30 @@ export const DEFAULT_REPO_SETTINGS: RepoSettings = {
workflows: [],
};
/**
* Fetch repository settings with fallback handling
* Uses API if token is available, otherwise returns defaults
*/
export async function fetchRepoSettings({
token,
repoContext,
isFallbackToken,
}: {
token: string;
repoContext: RepoContext;
isFallbackToken: boolean;
}): Promise<RepoSettings> {
if (isFallbackToken) {
log.info("Using default repository settings (app not installed)");
return DEFAULT_REPO_SETTINGS;
}
log.info("Fetching repository settings...");
const settings = await getRepoSettings(token, repoContext);
log.info("Repository settings fetched");
return settings;
}
/**
* Fetch repository settings from the Pullfrog API with fallback to defaults
* Returns agent, permissions, and workflows (excludes triggers)