Move api to lib
Add base cli tool