How to use AccelStepper to reverse direction when physical resistance is met?

My project requires a stepper motor to drive, basically, a one dimensional CNC or 3D printer type "track" contraption.
I need the motor to drive the track forward until resistance is met. Like hitting a wall.
Once this resistance is met, I need the motor to reverse direction for a few seconds before re-engaging.

I need this process to automatically carry out until manually stopped.

I am new and need some example code/tips.

Parts: NEMA 42 wallpower compatable stepper motor, compatable Driver, arduino mega,
DFRobot 50A Current Sensor

That's a bad way. Change the goal. Use end switches telling "close to end".

New to me. What would that be? Datasheets would tell......

Stepper motor current draw is mostly independent of whether the shaft actually rotates, so stall conditions are hard to detect. It does not damage a stepper if it stalls.

As mentioned above, most people use a limit switch to detect a motion endpoint. Example:

Capture

For questions about a particular motor/driver, post links to the product pages. "NEMA 42" specifies only the size of the motor mounting plate.

There is plasma cutting involved at the tip. a current sensor needs to be used

Current sensors will only work for brushed motors, not for stepper motors.

Then use a brushed DC motor to drive the tip.