You just kind of concatenate the entire codebase into one file, tell the model to do something and output the modified codebase into another file, diff the two and produce a patch automatically.
That codebase=>token stream=>codebase step feels like it could be lossy depending on how you encode things like file paths when concatenating everything, would be interesting to see in practice though!
or you might even be able to feed it individual files with their filenames, then ask it what modifications it would make as a diff for each of the files