Just so you know, the reference files with forge tools are out of date.
I have never done this but it should be possible with the communities help but I will get you started. Well I thought that building ships would have been an ability but its not.
All the file you should need are .entity inside the GameInfo folder. Look for StarBaseTech.entity. In that file you will see abilities and upgrades. These link to other ,entity files of that name.
UpgradeTypeCount 8
UpgradeType "StarBaseUpgradeTechWeapons"
UpgradeType "StarBaseUpgradeTechToughness"
UpgradeType "StarBaseUpgradeTechHangar"
UpgradeType "StarBaseUpgradeTechTradePort"
UpgradeType "StarBaseUpgradeTechBlockColonize"
UpgradeType "StarBaseUpgradeTechFactory"
UpgradeType "StarBaseUpgradeTechResupply"
UpgradeType "StarBaseUpgradeTechSelfDestruct"
UpgradeType "StarBaseUpgradeTechFactory" is colose to what you want so open StarBaseUpgradeTechFactory.entity and take a look. This is where you pay for the upgrade.
You can also look at PLANETMODULE_TECHORBITALCAPITALSHIPFACTORY.entity. The only thing I see that would allow the building is the top line entityType "PlanetModuleShipFactory" so I am stumped.
Now we need someone with more experience if its even possible to do.