I think this should be:
if !commandName? || !generatorCommands[commandName]?