You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some new console.print calls use parameters like end="" or rely on implicit newline behavior previously provided by click.echo(nl=False). Verify the Rich console wrapper supports these signatures and intended output formatting, especially where prompts and carriage returns were used.
defcheck_for_toml_or_setup_file() ->str|None:
console.print()
console.print("Checking for pyproject.toml or setup.py…\r")
curdir=Path.cwd()
Replaced click.launch with webbrowser.open, which may not respect environment specifics or return success. Consider handling failures or providing fallback messaging consistently across all openings.
Replaced click-based prompts with console.print plus manual input thread; ensure that console.print("... ", end="") and the threaded input approach work reliably in non-interactive terminals and that console is thread-safe in this context.
# Show remote URL and start input threadconsole.print("\n📋 If browser didn't open, visit this URL:")
console.print(f"\n{remote_auth_url}\n")
console.print("Paste code here if prompted > ", end="")
# Start thread to wait for manual inputinput_thread=threading.Thread(target=_wait_for_manual_code_input, args=(oauth,))
input_thread.daemon=True
console.print may not support the end parameter and could break the prompt rendering. Use console.print followed by console.input() or write directly via console.print then prompt for input separately to ensure compatibility.
-console.print("Paste code here if prompted > ", end="")+console.print("Paste code here if prompted > ")
Suggestion importance[1-10]: 8
__
Why: The new code uses console.print with an end parameter, which Rich's console.print doesn't support; removing it avoids a runtime error and preserves prompt flow.
Medium
Safely create test directory
Creating directories without handling existence can crash if the path already exists. Use parents=True and exist_ok=True to avoid race conditions and missing parent dirs. Add error handling to surface permission issues gracefully.
tests_root = Path(curdir) / (default_tests_subdir or "tests")
-tests_root.mkdir()-console.print(f"✅ Created directory {tests_root}{os.path.sep}{LF}")+try:+ tests_root.mkdir(parents=True, exist_ok=True)+ console.print(f"✅ Created directory {tests_root}{os.path.sep}{LF}")+except OSError as e:+ console.print(f"❌ Failed to create test directory '{tests_root}': {e}")+ apologize_and_exit()
Suggestion importance[1-10]: 7
__
Why: Using mkdir without exist_ok can fail if the directory exists or parents are missing; adding parents=True, exist_ok=True and handling OSError improves robustness without altering behavior significantly.
Medium
General
Guard browser launch failures
Opening a browser can raise exceptions in headless or restricted environments. Wrap webbrowser.open in a try/except and provide the URL fallback so the flow continues without crashing.
console.input(">>> ")
-webbrowser.open("https://github.com/apps/codeflash-ai/installations/select_target")+try:+ webbrowser.open("https://github.com/apps/codeflash-ai/installations/select_target")+except Exception:+ console.print("⚠️ Unable to open browser automatically. Please open the URL manually:")+ console.print("https://github.com/apps/codeflash-ai/installations/select_target")
console.print(
f"Please, press ENTER once you've finished installing the github app from https://github.com/apps/codeflash-ai/installations/select_target{LF}"
)
console.input(">>> ")
Suggestion importance[1-10]: 6
__
Why: Wrapping webbrowser.open in try/except improves resilience in headless environments and provides a clear manual fallback; it's a sensible minor robustness enhancement.
Low
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Type
Enhancement, Bug fix
Description
Replace Click with Rich console I/O
Use webbrowser for URL launching
Improve API key validation flow
Update OAuth messages without Click
Diagram Walkthrough
File Walkthrough
cmd_init.py
Replace Click with Rich console and webbrowser in init flowcodeflash/cli_cmds/cmd_init.py
webbrowser.open
oauth_handler.py
OAuth messaging migrated from Click to Rich consolecodeflash/code_utils/oauth_handler.py
pyproject.toml
Drop Click from project dependenciespyproject.toml