How to access texts on rooted android device from terminal

How do I access text messages on my rooted device using the command line?

I specifically want to extract a text transcript, without using any cloud services and possibly exposing sensitive or personal info.