Both are very easy to do.
Continuing from an existing replay
0. Start the replay
1. Enter cheat mode using /cheat
2. Skip to the end of the game
3. Play as a specific team by using /team [TeamID]
You will now control their units as if you were them. If you want to also be able to control all other units, use /godmode. If you also want to see the whole map, use /globallos.
If you want to continue playing not from the end of the game, you'll have to use some trick to assure your units won't be given orders from the replay file. You could try for example giving them to a different team and then switching to that team. There's probably even a command for that. Keep in mind that enemy units will still receive their orders as if the game continued normally.
Rebuilding a scenario from scratch
1. Start a local singleplayer game on the map with a NullAI (or other AI if you want them to be active) on the enemy team.
2. Enter cheat, god and spectator mode with /cheat, /godmode and /spectator.
3. Point your mouse at where you want to spawn a unit, then enter /give [Amount] [Name] [TeamID]
For example if you want to spawn an enemy stinger on a hill, you would point your cursor at the hill and enter /give 1 corhlt 1 Then you could give yourself 10 glaives to attack using /give 10 armpw 0
You can also add and remove AI control during a game using /aicontrol and /aikill
The names needed for the give command can be found here:
https://github.com/ZeroK-RTS/Zero-K/tree/master/unitsStinger is corhlt, Grizzly is amphassault.