Auto-commit extra files (#197)
Whenever Dyad does a commit from a proposal, it will automatically amend the commit with outside changes (e.g. made outside of Dyad). This helps avoid a lot of user confusion, e.g. https://github.com/dyad-sh/dyad/issues/187 https://www.reddit.com/r/dyadbuilders/comments/1kjysc0/error_pushing_images/ Edge cases: If a user adds a file outside of Dyad, and then they hit retry, it will revert these outside changes, but it's still technically in the version history, so I think it's OK. This should also be a pretty unusual situation. Fixes #164 Fixes #187
This commit is contained in:
@@ -535,7 +535,8 @@ This conversation includes one or more image attachments. When the user uploads
|
||||
event.sender.send("chat:response:end", {
|
||||
chatId: req.chatId,
|
||||
updatedFiles: status.updatedFiles ?? false,
|
||||
uncommittedFiles: status.uncommittedFiles,
|
||||
extraFiles: status.extraFiles,
|
||||
extraFilesError: status.extraFilesError,
|
||||
} satisfies ChatResponseEnd);
|
||||
} else {
|
||||
event.sender.send("chat:response:end", {
|
||||
|
||||
@@ -30,6 +30,8 @@ import { extractCodebase } from "../../utils/codebase";
|
||||
import { getDyadAppPath } from "../../paths/paths";
|
||||
import { withLock } from "../utils/lock_utils";
|
||||
import { createLoggedHandler } from "./safe_handle";
|
||||
import { ApproveProposalResult } from "../ipc_types";
|
||||
|
||||
const logger = log.scope("proposal_handlers");
|
||||
const handle = createLoggedHandler(logger);
|
||||
// Cache for codebase token counts
|
||||
@@ -317,9 +319,7 @@ const getProposalHandler = async (
|
||||
const approveProposalHandler = async (
|
||||
_event: IpcMainInvokeEvent,
|
||||
{ chatId, messageId }: { chatId: number; messageId: number },
|
||||
): Promise<{
|
||||
uncommittedFiles?: string[];
|
||||
}> => {
|
||||
): Promise<ApproveProposalResult> => {
|
||||
// 1. Fetch the specific assistant message
|
||||
const messageToApprove = await db.query.messages.findFirst({
|
||||
where: and(
|
||||
@@ -355,7 +355,10 @@ const approveProposalHandler = async (
|
||||
);
|
||||
}
|
||||
|
||||
return { uncommittedFiles: processResult.uncommittedFiles };
|
||||
return {
|
||||
extraFiles: processResult.extraFiles,
|
||||
extraFilesError: processResult.extraFilesError,
|
||||
};
|
||||
};
|
||||
|
||||
// Handler to reject a proposal (just update message state)
|
||||
|
||||
Reference in New Issue
Block a user