This should be done by traversing the folder structure of the repo. Each menu item would correspond to a a file nested in the directories.