In your package.json, include (see also package.json docs here):
package.json
{ "bin" : { "myapp" : "./cli.js" } }
Making sure the relevant script has the header:
#!/usr/bin/env node
npm link