WIP: refactoring external repo discovery