Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 0 additions & 50 deletions main.py

This file was deleted.

36 changes: 16 additions & 20 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
[tool.poetry]
[project]
authors = [
{name = "swyx", email = "[email protected]"},
]
license = "MIT"
requires-python = "<4.0.0,>=3.10"
dependencies = [
"openai<1.0.0,>=0.27.8",
"openai-function-call<1.0.0,>=0.0.5",
"tenacity<9.0.0,>=8.2.2",
"agent-protocol<2.0.0,>=1.0.0",
]
name = "smol_dev"
version = "0.0.3"
description = "python module of smol developer"
authors = ["swyx <[email protected]>"]
license = "MIT"
readme = "readme.md"
packages = [{ include = "smol_dev" }]

[tool.poetry.dependencies]
python = ">=3.10,<4.0.0"
openai = "^0.27.8"
openai-function-call = "^0.0.5"
tenacity = "^8.2.2"
agent-protocol = "^1.0.0"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.scripts]
src = "src.__main__:main"
api = "smol_dev.api:main"

[project.urls]
"Homepage" = "https://github.com/smol-ai/developer"
"Bug Tracker" = "https://github.com/smol-ai/developer/issues"

[project.scripts]
smol-dev-api = "smol_dev.api:main"
smol-dev = "smol_dev.main:main"
18 changes: 9 additions & 9 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ After the [successful initial v0 launch](https://twitter.com/swyx/status/1657578

```bash
# install
git clone https://github.com/smol-ai/developer.git
cd developer
poetry install # install dependencies. pip install poetry if you need
uv tool install https://github.com/smol-ai/developer.git

# 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
smol-dev -h

# alternatively, without installing to a fixed location
# uvx --from https://github.com/smol-ai/developer.git smol-dev --prompt asdfasdf

# 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
smol-dev --prompt prompt.md # for longer prompts, move them into a markdown file
smol-dev --prompt prompt.md --debug True # for debugging
```

<details>
Expand All @@ -58,7 +58,7 @@ This lets you develop apps as a human in the loop, as per the original version o
The demo example in `prompt.md` shows the potential of AI-enabled, but still firmly human developer centric, workflow:

- Human writes a basic prompt for the app they want to build
- `main.py` generates code
- `smoll-dev` generates code
- Human runs/reads the code
- Human can:
- simply add to the prompt as they discover underspecified parts of the prompt
Expand All @@ -80,7 +80,7 @@ This is the new thing in smol developer v1! Add `smol developer` to your own pro
pip install smol_dev
```

Here you can basically look at the contents of `main.py` as our "documentation" of how you can use these functions and prompts in your own app:
Here you can basically look at the contents of `src/smoll_dev/main.py` as our "documentation" of how you can use these functions and prompts in your own app:

```python
from smol_dev.prompts import plan, specify_file_paths, generate_code_sync
Expand Down
File renamed without changes.
File renamed without changes.
27 changes: 13 additions & 14 deletions smol_dev/main.py → src/smol_dev/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# model = "gpt-3.5-turbo-0613"
defaultmodel = "gpt-4-0613"

def main(prompt, generate_folder_path="generated", debug=False, model: str = defaultmodel):
def _main(prompt, generate_folder_path="generated", debug=False, model: str = defaultmodel):
# create generateFolder folder if doesnt exist
generate_folder(generate_folder_path)

Expand Down Expand Up @@ -75,7 +75,7 @@ def stream_handler(chunk):
# 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__":
def 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.
Expand All @@ -87,18 +87,17 @@ def stream_handler(chunk):
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, required=True, help="Prompt for the app to be created.")
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", type=str, required=True, help="Prompt for the app to be created.")
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

print(prompt)

main(prompt=prompt, generate_folder_path=args.generate_folder_path, debug=args.debug)
_main(prompt=prompt, generate_folder_path=args.generate_folder_path, debug=args.debug)

if __name__ == "__main__":
main()
File renamed without changes.
File renamed without changes.