I believe the 99 ECU will work with your 97 harness, but not 100% sure. You'll want to get FSMs for both years and compare the pin-outs for the two. The most important part is - count the O2 sensors on both jeeps, make sure they are the same, there should be one upstream and one downstream on each. Everything else *should* be mostly the same between a 97 and a 99, though I'm sure there are minor wiring harness differences.
You got lucky, one year earlier on the recipient or one year later on the donor and it would not have worked at all.
Everything mechanically should simply bolt up. You'll need the trans, hydraulics, flywheel, flywheel bolts (the AW4 flexplate bolts are shorter), an FC69907 pilot bearing (iirc), all clutch parts, the pedal assembly, the transfer case shifter linkage and the bracket off the transmission from the donor, the transmission itself of course, possibly the crossmember, and the driveshafts. I'm sure there are other things I'm forgetting.
The centers of the holes that must be drilled for the clutch master to mount to the firewall are all center punched, but from the interior side, so you will have to get real comfortable under the dash or drop / disassemble portions of the dash to get to it properly. Drilling the main hole can be kinda annoying, I ended up drilling a series of smaller holes around the periphery of the actual hole and then dremeled between them and cleaned up with a half round file.
You'll want to unplug the TCU (it may or may not set off a CEL otherwise - I don't think the manual ECU will pay attention to the TCU, but not sure) and will need to jump the NSS harness for the P/N pins so that the jeep can be started. I ended up cutting a connector off an old junk NSS I had and connecting the pins so that I had a "dongle" to plug in instead of hacking up the engine bay harness. That connector also has the pins for the reverse light switch (part of the NSS on the autos) so I used a bunch of wire and the reverse light connector off a manual wiring harness to build a custom NSS to reverse light + P/N bypass cable.