I just added Apache 2.0. Thanks for the reminder, I've been meaning to add a license.
I tried `sed` as well, every variant of `diff` output, various json structured formats, etc. The edit block syntax I chose is modeled after the conflict resolution markup you get from a failed `git merge`. I find it's very helpful to ask GPT to output in a format that is already in popular use. It has probably seen plenty of examples in its training data.
Asking GPT to output edits really only works ~reliably in GPT-4. Even then, my parser has to be permissive and go with the flow. GPT-3.5 was a lost cause for outputting any editing syntax -- it only worked reliably by outputting the entire modified source file. Which was slow and wasted the small context window.
Both 3.5 and 4 seem to be able to think more clearly about the actual coding task when you allow them to use an output format they're comfortable with. If you require them to output a bespoke format, or try too hard to ask for "minimal" edits... the quality of the actual code changes suffers. The models are used to seeing uninterrupted blocks of code in plain text, and so they seem to do best if you choose an output format that embraces that.