diff --git a/main.py b/main.py index 07cf8a8b4..4f2dfc422 100644 --- a/main.py +++ b/main.py @@ -6,41 +6,18 @@ import argparse - - -# for local testing -# python main.py --prompt "a simple JavaScript/HTML/CSS/Canvas app that is a one player game of PONG..." --generate_folder_path "generated" --debug True - if __name__ == "__main__": - prompt = """ - a simple JavaScript/HTML/CSS/Canvas app that is a one player game of PONG. - The left paddle is controlled by the player, following where the mouse goes. - The right paddle is controlled by a simple AI algorithm, which slowly moves the paddle toward the ball at every frame, with some probability of error. - Make the canvas a 400 x 400 black square and center it in the app. - Make the paddles 100px long, yellow and the ball small and red. - Make sure to render the paddles and name them so they can controlled in javascript. - Implement the collision detection and scoring as well. - Every time the ball bouncess off a paddle, the ball should move faster. - It is meant to run in Chrome browser, so dont use anything that is not supported by Chrome, and don't use the import and export keywords. - """ - if len(sys.argv) == 2: - prompt = sys.argv[1] - else: - - parser = argparse.ArgumentParser() - parser.add_argument("--prompt", type=str, help="Prompt for the app to be created.") - parser.add_argument("--model", type=str, default="gpt-4-0613", help="model to use. can also use gpt-3.5-turbo-0613") - parser.add_argument("--generate_folder_path", type=str, default="generated", help="Path of the folder for generated code.") - parser.add_argument("--debug", type=bool, default=False, help="Enable or disable debug mode.") - args = parser.parse_args() - if args.prompt: - prompt = args.prompt + parser = argparse.ArgumentParser() + parser.add_argument("--prompt", required=True, type=str, help="Prompt for the app to be created.") + parser.add_argument("--model", type=str, default="gpt-4-0613", help="model to use. can also use gpt-3.5-turbo-0613") + parser.add_argument("--generate_folder_path", type=str, default="generated", help="Path of the folder for generated code.") + parser.add_argument("--debug", type=bool, default=False, help="Enable or disable debug mode.") + args = parser.parse_args() # read file from prompt if it ends in a .md filetype - if len(prompt) < 100 and prompt.endswith(".md"): - with open(prompt, "r") as promptfile: - prompt = promptfile.read() + if len(args.prompt) < 100 and args.prompt.endswith(".md"): + with open(args.prompt, "r") as promptfile: + args.prompt = promptfile.read() - print(prompt) - - main(prompt=prompt, generate_folder_path=args.generate_folder_path, debug=args.debug, model=args.model) + print(args.prompt) + main(prompt=args.prompt, generate_folder_path=args.generate_folder_path, debug=args.debug, model=args.model) diff --git a/pyproject.toml b/pyproject.toml index a6da4f2ab..a3d8a73ca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ version = "0.0.3" description = "python module of smol developer" authors = ["swyx "] license = "MIT" -readme = "README.md" +readme = "readme.md" packages = [{ include = "smol_dev" }] [tool.poetry.dependencies] @@ -24,4 +24,4 @@ api = "smol_dev.api:main" [project.urls] "Homepage" = "https://github.com/smol-ai/developer" -"Bug Tracker" = "https://github.com/smol-ai/developer/issues" \ No newline at end of file +"Bug Tracker" = "https://github.com/smol-ai/developer/issues" diff --git a/readme.md b/readme.md index 8c5ed2c34..938600679 100644 --- a/readme.md +++ b/readme.md @@ -31,12 +31,14 @@ cd developer poetry install # install dependencies. pip install poetry if you need # run -python main.py "a HTML/JS/CSS Tic Tac Toe Game" # defaults to gpt-4-0613 -# python main.py "a HTML/JS/CSS Tic Tac Toe Game" --model=gpt-3.5-turbo-0613 - -# other cli flags -python main.py --prompt prompt.md # for longer prompts, move them into a markdown file -python main.py --prompt prompt.md --debug True # for debugging +poetry run python main.py --prompt "a HTML/JS/CSS Tic Tac Toe Game" + +# other cli flags +poetry run python main.py --prompt prompt.md # for longer prompts, move them into a markdown file +poetry run python main.py --prompt prompt.md --debug True # for debugging +poetry run python main.py --prompt prompt.md --model gpt-3.5-turbo-0613 # change model, default is gpt-4-0613 +# Change the target folder, default is generate/. Note that main will delete what is currently in the folder. +poetry run python main.py --prompt prompt.md --generate_folder_path /path/to/folder/ ```