There is an inconsistency in the metalsmith CLI vs JS approach: in the CLI Metalsmith.directory is defaulted to process.cwd(). In the JS approach there is no default and __dirname needs to be passed explicitly. Solution:A) force specifying a directory option in metalsmith.json (breaking) or B) Make __dirname also the default for the JS solution (backwards-compatible)