[refactor] move cmd to top of gem execution block