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:
Will Chen
2025-05-19 13:42:27 -07:00
committed by GitHub
parent 648724b4e9
commit b5671c0a59
8 changed files with 95 additions and 33 deletions

View File

@@ -58,11 +58,23 @@ export const showLoading = <T>(
});
};
export const showUncommittedFilesWarning = (files: string[]) => {
showWarning(
`Some changed files were not committed. Please use git to manually commit them.
export const showExtraFilesToast = ({
files,
error,
}: {
files: string[];
error?: string;
}) => {
if (error) {
showError(
`Error committing files ${files.join(", ")} changed outside of Dyad: ${error}`,
);
} else {
showWarning(
`Files changed outside of Dyad have automatically been committed:
\n\n${files.join("\n")}`,
);
);
}
};
// Re-export for direct use