Hey, I am not sure if you know it, but there is a fully client-side webapp https://www.Photopea.com, that can open, edit and save PSD files. You can also write scripts, which will process a PSD document and e.g. export necessary layers.
I can't quite tell - but it seems like you have to hit their servers in order to run this from the command line and the code isn't fully open source?
Regardless - thanks a lot for sharing!