repository: Marry `OptimizeRepository` and housekeeping
This MR marries both the OptimizeRepository()
RPC and the housekeeping tasks such that both profit: OptimizeRepository()
learns to do housekeeping tasks, and the housekeeping tasks get extended such that they know to clean up stale configuration and prune empty ref directories.