Add support for app dir
Detect git root and make more robust