how to add switches to the end of the rotation that will cut off a stepper motor so I don’t damage anything at the extremes of the motion?
This is commonly done using limit switches.  These are usually microswitches that are activated at the ends of the travel.  In this case, just wire them into the microcontroller as inputs, and the rest is firmware.  The firmware stops stepping the motor in a particular direction when the limit switch for that direction has been activated.

Consider mechanical inertia when placing the limit switches, although that is usually not much of a issue with stepper motors.  For example, if the motor will go another 3 steps if running at full speed when abruptly shut off, then you need to place the limit switches at least 3 steps from the ends.