Smart build

**not ready for merging yet**
Sounds good. But maybe we should also cover the case where the file/project isn't following the pub conventions and files may be located outside of either folder. Or should we enforce here the adherence to pub conventions? I see the lax approach to folder structure acceptable if you're trying things out in a throwaway file?

Anyway, I agree that looking at text lines only isn't great.