I believe for formation changes you will not need touch C++ code mostly you would need to change unitAI and Formation what are js.
Small hint for formation ( dont have to read) :
Some time ago I have tried to deal with formations and I can tell that they works pretty good in standground but as long as they are attacked while Idle. If you really want to make formation fights possible, you should think a about formation movement - there is patch in progress about it but dont know if it solve eveyrthing. Next you have to think about order to attack from player, as currently whole formation attacks one single selected unit if the unit is not in own formation what is fine but if they cannot get to it things are nasty, especially when other enemy single foghting units are blocking the way. So you probably will need to implement stop whole formation on member melee attacked.
We have also prepared patch for formation aura but it is for whole formation so no diffrence if unit is fighting or not. But as formations are not working now, formation aura is not implemented in the game.