No magic - it just finds the nearest parent (ancestor?) directory containing both a
package.json file and a node_modules folder. 99% of the time this will be the project root of
the file doing the lookup.
If it ever gives you the wrong directory, definitely file an issue, I'd be more than
happy to fix it