Extra context: API + CLI

Fixes #12
Synthesizes parts of: #75, #100, #116, #161 and #199.
Thanks @fcurella, @aventurella, @emonty, @schacki, @ryanolson!
Please add an explicit encoding here. I missed this when switching to io.open, and it needs review. Note that you have introduced a (minor, probably bugfix) behaviour change here as the existing code reads the file using the system default encoding and you now use UTF8. This could affect Windows users...

Note for myself, it is probably worth adding tests to (somehow) spot this change in behaviour!