Parse the kag file and generate a command array