Add proper CLI

Just wanted to do a little change, but it ended up being a little bit more than that. :open_mouth:

- Add separate cli.js
- bin script in `package.json`
- slightly cleaner code that's easier to test

Let me know if you want me to rebase some of the commits.

----
Should probably add some tests, but I'll wait and see if you want these changes first.