Factor out almost all fs. and path. calls in the tool

This will be useful when we want to be smart with windows file paths later
Also, all of the file calls are asynchronous with fibers now, which comes with
many benefits.
I think you need to account for escaped `\` characters here (that is, backslashes with backslashes before them, which don't actually count as path separators). It might be safer to rely on repeatedly calling `path.dirname` to figure out the path segments.