Support supabase function deployment
This commit is contained in:
@@ -19,6 +19,7 @@ import {
|
||||
processFullResponseActions,
|
||||
} from "../processors/response_processor";
|
||||
import log from "electron-log";
|
||||
import { isServerFunction } from "../../supabase_admin/supabase_utils";
|
||||
|
||||
const logger = log.scope("proposal_handlers");
|
||||
|
||||
@@ -86,18 +87,21 @@ const getProposalHandler = async (
|
||||
path: tag.path,
|
||||
summary: tag.description ?? "(no change summary found)", // Generic summary
|
||||
type: "write" as const,
|
||||
isServerFunction: isServerFunction(tag.path),
|
||||
})),
|
||||
...proposalRenameFiles.map((tag) => ({
|
||||
name: path.basename(tag.to),
|
||||
path: tag.to,
|
||||
summary: `Rename from ${tag.from} to ${tag.to}`,
|
||||
type: "rename" as const,
|
||||
isServerFunction: isServerFunction(tag.to),
|
||||
})),
|
||||
...proposalDeleteFiles.map((tag) => ({
|
||||
name: path.basename(tag),
|
||||
path: tag,
|
||||
summary: `Delete file`,
|
||||
type: "delete" as const,
|
||||
isServerFunction: isServerFunction(tag),
|
||||
})),
|
||||
];
|
||||
// Check if we have enough information to create a proposal
|
||||
|
||||
@@ -9,7 +9,11 @@ import { getGithubUser } from "../handlers/github_handlers";
|
||||
import { getGitAuthor } from "../utils/git_author";
|
||||
import log from "electron-log";
|
||||
import { executeAddDependency } from "./executeAddDependency";
|
||||
import { executeSupabaseSql } from "../../supabase_admin/supabase_management_client";
|
||||
import {
|
||||
deploySupabaseFunctions,
|
||||
executeSupabaseSql,
|
||||
} from "../../supabase_admin/supabase_management_client";
|
||||
import { isServerFunction } from "../../supabase_admin/supabase_utils";
|
||||
|
||||
const logger = log.scope("response_processor");
|
||||
|
||||
@@ -220,6 +224,13 @@ export async function processFullResponseActions(
|
||||
fs.writeFileSync(fullFilePath, content);
|
||||
logger.log(`Successfully wrote file: ${fullFilePath}`);
|
||||
writtenFiles.push(filePath);
|
||||
if (isServerFunction(filePath)) {
|
||||
await deploySupabaseFunctions({
|
||||
supabaseProjectId: chatWithApp.app.supabaseProjectId!,
|
||||
functionName: path.basename(path.dirname(filePath)),
|
||||
content: content,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Process all file renames
|
||||
|
||||
Reference in New Issue
Block a user