Check AI credentials during app init
What does this MR do and why?
Split the main application into 3 top level functions such as Init, Run, and Done to structure the flow of the application.
Move AI/GitLab credentials validation into Init function and exit earlier when the credentials are missing. If there are no credentials, then there is no need to proceed withscans.