I'm close to fully automating a process of stacking bursts of pictures into one image thanks to Hugin's command-line tools, however there's one part I can't automate yet, it's converting RAW into rectilinearised TIFF, which so far I must use Lightroom for, because somehow Lightroom knows how to correct the distortion properly, however Lightroom cannot be scripted.
So far I only know of two programs that know out of the box how to correct my camera's distortion, Lightroom and Canon's DPP, both of which can't do anything from the command-line.
Before you answer "dcraw", no, DCRaw does not correct distortion. Neither does RawTherapee, at least not without providing your own distortion values or lens profile, which I'm not going to do because unless you shoot at only one focal length then this is crazy, and there's no existing profile for my camera. Lensfun's database is old and doesn't have my camera (Canon G9 X II), and it seems like all the free programs either do no correction or ask you to provide your own parameters. Why does Lightroom even know what to do when it doesn't even know about my camera model (old version, I have to convert to DNG first) and all these free programs have no idea what to do?
Does any commercial program besides Lightroom do the correction properly out of the box? Can any of them do the job from the command-line?