Refactor cli to use AppState

Fixed issues:
- charm foreground issue with console
- custom config, logger, etc.
Add config command