Rotating in the viewer isn't seen as modifying the image. It's the same as zooming in or out, and only changes how the image is displayed on screen.
You can add a command to the viewer which rotates the file on disk, then tells the viewer to reload the file:
Image ROTATE=90 HERE REPLACE QUALITY=100
Show VIEWERCMD=refresh
Note that JPEGs can only be losslessly rotated in some situations (width and height need to be a multiple of 8) so each rotation of the file data may degrade the image quality of a JPEG file. So you might want to have buttons for 90, 180 and 270 rotations instead of repeatedly applying a 90 rotation to the same file.
It would also be possible to add a command which does a forced save of the viewer's in-memory bitmap over the file it was loaded from, but that would always degrade image quality with JPEG files, even in situations where the file could have been rotated losslessly.
Using Opus's image converter (or Image command, to automate things) from outside of the viewer is another way to rotate image files. (If you use the image converter from inside the viewer, via the File menu, note that it works on and re-saves the image data in memory, so it can't do lossless rotations via that route.)