So I've done that sort of refactoring a lot, albeit on real code in much bigger systems, not a script. Lots of coders won't do this, they'll just keep adding to the crap, crazy big module.

I always end up with a vastly smaller code base. Like 2000 lines turns into 800 lines or something like that.

Did that happen too or did the AI just do a glorified 'extract method', that any decent IDE can already do without AI?

I use AI, I'm not anti it, but on the other hand I keep seeing these gushing posts where I'm like 'but your ide could already do that, just click the quick refactoring button'.

It ended up being less, yeah, but not by that much, maybe 15%. Thing is, there was no "extract methods" possible. It was an old user script creation tool that had been modified over the last 10 years. If it were that easy, I would have just done it myself.

What this shows me is that it truly understands all the things this script was supposed to do and was able to organize it better, while not breaking any functionality.

Fair enough, I think it's positive that it did reduce it down to an extent.