Hook update

I rewrote the hooks to:
* use the arguments and environment variables passed to hooks so they are less dependent on filesystem location
* use node.js rather than shell scripts, so they are cross platform compatible