I'm a programmer, but a total newbie with regards to fontforge and font editing in general.
I wrote this little script as a start:
Worked as expected with TTF and OTF fonts. But when I passed UFO directory path as an argument, I got Segmentation Fault. I also tried using path to any of the files in the UFO's main directory, like "metainfo.plist" or "fontinfo.plist", hoping fontforge would recognise it as some kind of root of the whole UFO data structure. None of it worked.