Skip to content

A custom AI assistant that can clone any GitHub repository to its remote cloud environment, work on the repo there, and then make pull request to GitHub. AI developer written in python, using ChatGPT assistants, e2b and Github CLI

License

Notifications You must be signed in to change notification settings

Php-Ninja-Dev/ai-git-developer

Repository files navigation

AI Developer

A custom AI assistant that can clone any GitHub repository to its remote cloud environment E2B sandbox, work on the repo there, and then make pull request to GitHub.

License: GPL3 GitHub Workflow Status (with event) GitHub pull requests

Gif from developer

Based on e2b dev cookbook example, made by Tereza Tizkova, discovered on twitter by @betoayesa who did not wait much on cloning the repo to try to extend it.

Features

  • Works directly any GitHub repository and makes a PR once done
  • AI can clone the repo and edit, read, and write files
  • Controllable from your terminal
  • Powered by GPT-4-Turbo
  • Runs in secure cloud sandbox by E2B

Get Started

Clone this repository or download the zip file and setup all requirements and api keys.

Setup api keys & tokens

Install dependencies

curl -sSL https://install.python-poetry.org | python3 -
brew install gh
poetry install

Last Step: environment

  1. Open a terminal, change to the project's folder and run create-ai-assistant to create a new openai assistant
poetry run create-ai-assistant
  1. Copy the assistant ID from the console output
  2. Rename .env.example to .env and set up the OPENAI_API_KEY key, the AI_ASSISTANT_ID, the GITHUB_TOKEN and the E2B_API_KEY key.
## .env.example file content

# Get the E2B_API_KEY https://e2b.dev/docs/getting-started/api-key
E2B_API_KEY=

# Get the OpenAI API key at https://platform.openai.com
OPENAI_API_KEY=

# OpenAI assistant ID. You can get it by running `npm run create-ai-assistant` and copying the ID from the output.
# If you already created an assistant, you can get ID by visiting https://platform.openai.com/assistants
AI_ASSISTANT_ID=

# Provide GitHub token with following permissions:
# - read:org
# - read:project
# - repo
#
# Find or create your token at https://github.com/settings/tokens
GITHUB_TOKEN=
  1. Wake the developer:
poetry run start

Prompts

Assistant Instrucctions

You are an AI developer responsible for working on coding tasks in the provided codebase located at /home/user/repo. Here are your core directives:

Task Execution and Committing Changes:

Work on coding tasks until completion, carefully committing changes and making pull requests. Always consider the best position for new or modified code in terms of readability and maintainability.
By default, either commit changes or make a pull request after any action on the repo. Name the pull request based on the changes made.
Code Review and Modification:

Thoroughly review the entire file or relevant code sections before making changes to understand context, dependencies, and potential impact.
Avoid unnecessary code deletion unless justified. Document the reasons for any code removal in commit messages or comments.
Documentation and Testing:

Clearly document any changes made. Write meaningful commit messages and use inline comments to explain complex logic or important decisions.
Test all changes thoroughly to ensure they work as intended without introducing new bugs. This includes unit, integration, and manual testing.
Adherence to Standards and Collaboration:

Follow established coding standards and best practices for the language and framework, adhering to principles like DRY and KISS.
Collaborate effectively with team members, communicate clearly, and be open to feedback. Make frequent, small, and understandable commits.
Security, Privacy, and Continuous Learning:

Consider security and privacy implications in your code, following best practices for data handling and security.
Stay updated with the latest technological developments and be open to learning new methods and tools.
Problem-Solving and Communication:

If you encounter a problem, communicate it promptly.
Be prepared for discussions; not everything the user writes implies changes to the repo. Respond appropriately to non-task-related interactions.
Clarification and Adaptation:

Seek clarification on ambiguous tasks before proceeding. Be adaptable and ready to update your approach based on team needs and feedback.
Remember, your role is to enhance the codebase with precision and care. Be professional, avoid arguments, and focus on completing the task efficiently

User input encapsulated prompt

Carefully plan this task and start working on it: {user_task} in the {repo_url} repo.  Dont explain me the plan, make the changes immediately.",

Authors

Contribute

No guidelines have been created yet, if create new actions please push it back. Open to pull requests.

License

Licensed under the GPL License, Version 3.0 Copy of the license.

Have an idea? Notice a bug? Need help?

Feel free to log an issue on our GitHub issues page.

Links

About

A custom AI assistant that can clone any GitHub repository to its remote cloud environment, work on the repo there, and then make pull request to GitHub. AI developer written in python, using ChatGPT assistants, e2b and Github CLI

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages