Importing symbol and footprint libraries via the CLI?

Howdy! I’m currently working on setting up some CI runners using the KiCAD CLI using the KiCAD docker image. One thing that I’ve noticed is that if the ERC and DRC checks are failing when run from the CLI, since the instance of KiCAD within the Docker container doesn’t have my custom symbol and footprint libraries installed.

Does anyone have some tips for installing symbol and footprint libraries on KiCAD via the CLI, or working around this issue in another way? I know that the symbols and footprints are cached within the KiCAD files (so exporting still works), but I’d like to be able to enforce an ERC / DRC pass as a condition for a CI job completing successfully.

I ended up figuring this out! It was relatively straightforward to edit KiCAD’s global sym-lib-table and fp-lib-table files with a bash script in order to add my desired symbol and footprint libraries to the end of the tables. CI is working great!