potpie icon indicating copy to clipboard operation
potpie copied to clipboard

Create a CLI for using potpie locally

Open dhirenmathur opened this issue 11 months ago • 13 comments

Create Development CLI for Local PotPie Usage

Objective

Create a command-line interface for local development interactions with PotPie.

Commands

0. init

potpie start

and

potpie stop

commands to turn on and off the server.

1. parse

potpie parse <repo-path> [--branch <branch-name>]
  • Submit repository for parsing
  • Poll status until complete
  • Display progress/status
  • Block until ready

2. chat

potpie chat <project-id> --agent <agent-name> [--branch <branch-name>]
  • Validate project readiness
  • Initialize conversation with specified agent
  • Interactive console for messages
  • Display responses

Requirements

  • Input validation for repo paths and branches
  • Status feedback during parsing
  • Error handling for invalid inputs
  • Clean console output formatting
  • Session management for chat

Success Criteria

  • [ ] Successfully parses repositories
  • [ ] Shows parse status clearly
  • [ ] Validates project status
  • [ ] Handles errors gracefully

dhirenmathur avatar Jan 09 '25 09:01 dhirenmathur

/bounty 10

dhirenmathur avatar Jan 09 '25 09:01 dhirenmathur

💎 $10 bounty • potpie.ai

Steps to solve:

  1. Start working: Comment /attempt #224 with your implementation plan
  2. Submit work: Create a pull request including /claim #224 in the PR body to claim the bounty
  3. Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts

Thank you for contributing to potpie-ai/potpie!

Add a bountyShare on socials

Attempt Started (GMT+0) Solution
🟢 @aayushdhiman01 Jan 10, 2025, 12:37:54 PM WIP
🟢 @DeepeshKalura Jan 20, 2025, 4:47:15 PM WIP
🟢 @riturajFi Feb 11, 2025, 4:39:14 PM WIP

algora-pbc[bot] avatar Jan 09 '25 09:01 algora-pbc[bot]

/attempt #224

Hey I am solving this issue but I will project structure refactoring, @dhirenmathur will go to need your help to improve

Options

DeepeshKalura avatar Jan 20 '25 16:01 DeepeshKalura

@DeepeshKalura go for it! Please share a plan before implementing! Thank you for your contribution!

dhirenmathur avatar Jan 20 '25 16:01 dhirenmathur

@dhirenmathur Yeah, I was going to tell you that.

So, Currently, I see that we manage the server startup with ./start.sh.

Let's start the I will use click to create CLI as it pre-install the package with fastAPI. And super easy to use. ( If you want i don't mind using a more traditional argparse to build CLI.

So, If I see this PR and just focus that thing in mind then. I will add the click code on the server code. For example, would be.

in app > main.py.


def start_server():
    uvicorn.run(app, host="0.0.0.0", port=8034,)

def stop_server():
    pass

@click.group()
def cli():
    pass

@cli.command()
def start():
    start_server()

@cli.command()
def stop():
    stop_server()

if __name__ == "__main__":
    cli()

Just add these lines on the end. Yes all of these will work, Similarly then I will create singletion instance of cli and pass where I need from the serve code as the reference and make a wrapper similar code with cli. I think it work for small projects. ( Yeah I know it destroys the separate of concern case here )

but it will work.

Key points will 1. Single Instance of CLI and use the server ( fastapi ) wrapper around the CLI if needed.

I think you will avoid such code. I will also avoid it.

So, I was thinking to create a separate CLI logic that will be the same but it will separate instance.

More like one file or folder.

Maybe I am in right directions of thinking.

DeepeshKalura avatar Jan 20 '25 17:01 DeepeshKalura

Would like to give it a try as I have worked on CLI's before...

Savio629 avatar Jan 22 '25 12:01 Savio629

/attempt https://github.com/potpie-ai/potpie/issues/224

Savio629 avatar Jan 22 '25 12:01 Savio629

Hey @Savio629 I think @DeepeshKalura is already working on this issue. You are welcome to give it a try parallelly if you want, but the bounty will be awarded to the solution that will best suit the requirements in the end.

dhirenmathur avatar Jan 23 '25 07:01 dhirenmathur

Hey @DeepeshKalura . Using click is good. Please DM me on discord if you're still working on this, I would like to understand your proposal better.

dhirenmathur avatar Jan 23 '25 07:01 dhirenmathur

@dhirenmathur yes I am working on this can, Ok joining discord

DeepeshKalura avatar Jan 23 '25 08:01 DeepeshKalura

@dhirenmathur I read the requirement "Poll status until complete" I don't think it good idea ( because we cannot tell how much time it will take as API is not telling it. I will have a better idea. I just dm you.

DeepeshKalura avatar Jan 24 '25 18:01 DeepeshKalura

/attempt #224

Options

riturajFi avatar Feb 11 '25 16:02 riturajFi

@riturajFi bro you are super late for this. I think Fulfil the requirements currently writing tests. So, I think you waste time on this issue. Just a warning bro!

DeepeshKalura avatar Feb 11 '25 18:02 DeepeshKalura