I've taken a look into this for you. Next version will have a properly aligned local axis that's oriented with the object (Z normal for plane, Z along long-axis of cylinder, obviously not applicable to sphere).
However, turns out the maths for cube-fitting is really complex (more so than the shapes already covered), and possibly not doable in blender without relying on external dependancies (which I don't want to do).
I implemented a couple of algorithms for fitting cubes/cuboids and they were, to be frank, rubbish, and it'd be way quicker to just hand align a cube. I'll keep an eye out, but don't expect cube fitting anytime soon, sorry.
v1.2 with oriented local axes uploaded
it's nice but.. please, add cube as an option for shape, and local/global orientation parameter...