add hooks infrastructure
first bits of hooks docs
complete hook docs
insert hook calls
fix tests
Merge branch 'refs/heads/hooks'
fix integration test