Successfully emerged from the rabbit hole of trying to use CoreData in an command line tool that’s built using the Swift Package Manager. It was not straightforward, but I’m happy I got it working. (Thanks, @NeoNacho!)
https://adrian.schoenig.me/blog/2021/08/18/core-data-and-spm/