1414import urllib .parse
1515import webbrowser
1616
17- import click
1817import requests
1918
2019from codeflash .api .cfapi import get_cfapi_base_urls
20+ from codeflash .cli_cmds .console import console
2121
2222
2323class OAuthHandler :
@@ -737,19 +737,19 @@ def perform_oauth_signin() -> str | None:
737737 try :
738738 httpd = oauth .start_local_server (port )
739739 except Exception :
740- click . echo ("❌ Failed to start local server." )
740+ console . print ("❌ Failed to start local server." )
741741 return None
742742
743743 if should_attempt_browser_launch ():
744744 # Try to open browser
745- click . echo ("🌐 Opening browser to sign in to CodeFlash…" )
745+ console . print ("🌐 Opening browser to sign in to CodeFlash…" )
746746 with contextlib .suppress (Exception ):
747747 webbrowser .open (local_auth_url )
748748
749749 # Show remote URL and start input thread
750- click . echo ("\n 📋 If browser didn't open, visit this URL:" )
751- click . echo (f"\n { remote_auth_url } \n " )
752- click . echo ("Paste code here if prompted > " , nl = False )
750+ console . print ("\n 📋 If browser didn't open, visit this URL:" )
751+ console . print (f"\n { remote_auth_url } \n " )
752+ console . print ("Paste code here if prompted > " , end = "" )
753753
754754 # Start thread to wait for manual input
755755 input_thread = threading .Thread (target = _wait_for_manual_code_input , args = (oauth ,))
@@ -763,7 +763,7 @@ def perform_oauth_signin() -> str | None:
763763
764764 if not oauth .is_complete :
765765 httpd .shutdown ()
766- click . echo ("\n ❌ Authentication timed out." )
766+ console . print ("\n ❌ Authentication timed out." )
767767 return None
768768
769769 # Check which method completed
@@ -776,7 +776,7 @@ def perform_oauth_signin() -> str | None:
776776 # Browser callback received
777777 if oauth .error or not oauth .state or oauth .state != state :
778778 httpd .shutdown ()
779- click . echo ("\n ❌ Unauthorized." )
779+ console . print ("\n ❌ Unauthorized." )
780780 return None
781781
782782 api_key = oauth .exchange_code_for_token (oauth .code , code_verifier , local_redirect_uri )
@@ -786,6 +786,6 @@ def perform_oauth_signin() -> str | None:
786786 httpd .shutdown ()
787787
788788 if not api_key :
789- click . echo ("\n ❌ Authentication failed." )
790- click . echo ("\n " )
789+ console . print ("\n ❌ Authentication failed." )
790+ console . print ("\n " )
791791 return api_key
0 commit comments