Infrared1029 / sweep

Sweep: open-source AI-powered Software Developer for small features and bug fixes.
https://sweep.dev
Other
0 stars 0 forks source link

Sweep: remove all the @command decorators from cli.py #7

Closed Infrared1029 closed 3 months ago

Infrared1029 commented 3 months ago

Details

this is part of the migration from typer to another cli library.

Branch

No response

Checklist - [X] Modify `sweepai/cli.py` ✓ https://github.com/Infrared1029/sweep/commit/4b87051241368b4969e09d11e749c5d171a85e5f [Edit](https://github.com/Infrared1029/sweep/edit/sweep/remove_all_the_command_decorators_from_c/sweepai/cli.py) - [X] Modify `sweepai/cli.py` ✓ https://github.com/Infrared1029/sweep/commit/4b87051241368b4969e09d11e749c5d171a85e5f [Edit](https://github.com/Infrared1029/sweep/edit/sweep/remove_all_the_command_decorators_from_c/sweepai/cli.py) - [X] Modify `sweepai/cli.py` ✓ https://github.com/Infrared1029/sweep/commit/4b87051241368b4969e09d11e749c5d171a85e5f [Edit](https://github.com/Infrared1029/sweep/edit/sweep/remove_all_the_command_decorators_from_c/sweepai/cli.py) - [X] Modify `sweepai/cli.py` ✓ https://github.com/Infrared1029/sweep/commit/4b87051241368b4969e09d11e749c5d171a85e5f [Edit](https://github.com/Infrared1029/sweep/edit/sweep/remove_all_the_command_decorators_from_c/sweepai/cli.py)
Infrared1029 commented 3 months ago

🚀 Here's the PR! #8

See Sweep's progress at the progress dashboard!
💎 Sweep Pro: I'm using GPT-4. You have unlimited GPT-4 tickets. (tracking ID: None)

[!TIP] I can email you next time I complete a pull request if you set up your email here!


Actions (click)


Step 1: 🔎 Searching

I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.

Some code snippets I think are relevant in decreasing order of relevance (click to expand). If some file is missing from here, you can mention the path in the ticket description. https://github.com/Infrared1029/sweep/blob/824d345caf9b18c774002b4a6423e4ec8b5fec7e/sweepai/chat/search_prompts.py#L1-L153 https://github.com/Infrared1029/sweep/blob/824d345caf9b18c774002b4a6423e4ec8b5fec7e/sweepai/agents/search_agent.py#L1-L175 https://github.com/Infrared1029/sweep/blob/824d345caf9b18c774002b4a6423e4ec8b5fec7e/sweepai/utils/multi_query.py#L1-L102 https://github.com/Infrared1029/sweep/blob/824d345caf9b18c774002b4a6423e4ec8b5fec7e/sweepai/agents/search_agent.py#L176-L343 https://github.com/Infrared1029/sweep/blob/824d345caf9b18c774002b4a6423e4ec8b5fec7e/sweepai/core/reflection_utils.py#L1-L117 https://github.com/Infrared1029/sweep/blob/824d345caf9b18c774002b4a6423e4ec8b5fec7e/sweepai/agents/question_answerer.py#L1-L326 https://github.com/Infrared1029/sweep/blob/824d345caf9b18c774002b4a6423e4ec8b5fec7e/sweepai/cli.py#L1-L244 https://github.com/Infrared1029/sweep/blob/824d345caf9b18c774002b4a6423e4ec8b5fec7e/sweepai/utils/convert_openai_anthropic.py#L1-L128 https://github.com/Infrared1029/sweep/blob/824d345caf9b18c774002b4a6423e4ec8b5fec7e/sweepai/cli.py#L245-L371 https://github.com/Infrared1029/sweep/blob/824d345caf9b18c774002b4a6423e4ec8b5fec7e/sweep_chat/backend/api.py#L1-L173 https://github.com/Infrared1029/sweep/blob/824d345caf9b18c774002b4a6423e4ec8b5fec7e/sweepai/core/reflection_utils.py#L391-L520 https://github.com/Infrared1029/sweep/blob/824d345caf9b18c774002b4a6423e4ec8b5fec7e/pyproject.toml#L1-L50 https://github.com/Infrared1029/sweep/blob/824d345caf9b18c774002b4a6423e4ec8b5fec7e/sweepai/core/context_pruning.py#L1-L199 https://github.com/Infrared1029/sweep/blob/824d345caf9b18c774002b4a6423e4ec8b5fec7e/sweepai/agents/modify_utils.py#L1-L281 https://github.com/Infrared1029/sweep/blob/824d345caf9b18c774002b4a6423e4ec8b5fec7e/sweepai/agents/issue_cleanup_agent.py#L1-L42

Step 2: ⌨️ Coding

@app.command() def test(): cprint("Sweep AI is installed correctly and ready to go!", style="yellow") def test(): cprint("Sweep AI is installed correctly and ready to go!", style="yellow")

@app.command() def watch( repo_name: str, debug: bool = False, record_events: bool = False, max_events: int = 30, ): def watch( repo_name: str, debug: bool = False, record_events: bool = False, max_events: int = 30, ):

Remove the @app.command() decorator from the init() function.

@app.command() def init(override: bool = False): # TODO: Fix telemetry if not override: if os.path.exists(config_path): with open(config_path, "r") as f: config = json.load(f) if "OPENAI_API_KEY" in config and "ANTHROPIC_API_KEY" in config and "GITHUB_PAT" in config: override = typer.confirm( f"\nConfiguration already exists at {config_path}. Override?", default=False, abort=True, ) def init(override: bool = False): # TODO: Fix telemetry if not override: if os.path.exists(config_path): with open(config_path, "r") as f: config = json.load(f) if "OPENAI_API_KEY" in config and "ANTHROPIC_API_KEY" in config and "GITHUB_PAT" in config: override = typer.confirm( f"\nConfiguration already exists at {config_path}. Override?", default=False, abort=True, )

@app.command() def run(issue_url: str): if not os.path.exists(config_path): cprint( f"\nConfiguration not found at {config_path}. Please run [green]'sweep init'[/green] to initialize the CLI.\n", style="yellow", ) raise ValueError( "Configuration not found, please run 'sweep init' to initialize the CLI." ) cprint(f"\n Running Sweep on issue: {issue_url} \n", style="bold black on white") def run(issue_url: str): if not os.path.exists(config_path): cprint( f"\nConfiguration not found at {config_path}. Please run [green]'sweep init'[/green] to initialize the CLI.\n", style="yellow", ) raise ValueError( "Configuration not found, please run 'sweep init' to initialize the CLI." ) cprint(f"\n Running Sweep on issue: {issue_url} \n", style="bold black on white")


Step 3: 🔁 Code Review

I have finished reviewing the code for completeness. I did not find errors for sweep/remove_all_the_command_decorators_from_c.


🎉 Latest improvements to Sweep:
  • New dashboard launched for real-time tracking of Sweep issues, covering all stages from search to coding.
  • Integration of OpenAI's latest Assistant API for more efficient and reliable code planning and editing, improving speed by 3x.
  • Use the GitHub issues extension for creating Sweep issues directly from your editor.

💡 To recreate the pull request edit the issue title or description. Something wrong? Let us know.

This is an automated message generated by Sweep AI.