-what the point to have a doIt function if finally the main function, at least the one that take
in consideration the history stack, is the redoIt one?
Well, it may be that doit need to do some preliminary work before you can do what your doing. Say that your actually calcuating something relatively heavy based on something. Now to redo what you need to do can just retrieve the result of the calculation but since the first time the command is to be executed something has to calculate this you do it in doit, you can then call redoit at the end of your doint calculation preparation is done.
Alternative solution is to do it the other way around and call doit in redoit.
-how do you guys pass the indices and position to the redoIt function
You could store the selectionstring/selectionobjecthandle passed to the command or the original data that makes your decision.
Usually you would not do it at all. See, in reality this is a bit pointless to directly manipulate shapes in commands. First of all doing that would just get overridden by any shape history, so it wouldn't end up doing anything in most situations. So you would rather either just manipulate dg inputs, or implement your own node. The result of this would be that your stuff would work better and you wouldn't need to implement this in the undo. Also its less code to write in general as nodes are much more straightfoward to wirte.