Skip to content

Dev Autopilot, a tool that uses GPT to read a codebase, create context and solve tasks.

Notifications You must be signed in to change notification settings

Soham1803/autopilot

 
 

Repository files navigation

Autopilot Logo

Autopilot - Using GPT to Work on Entire Codebases

Autopilot is an AI tool that utilizes GPT to read a codebase, create context, and solve tasks that you request.

Autopilot Demo

How it works

(Generated by autopilot)

Task: Create a diagram explaining what this project and the process

+----------------------+     +----------------------+     +----------------------+
|  User inputs TASK    |     |  Read summaries of   |     | Identify relevant    |
|                      | --->|  all the files in    | --->| files for the task   |
|                      |     |  codebase            |     | using GPT AI         |
+----------------------+     +----------------------+     +----------------------+
                                                       |
                                                       v
                                           +-----------------------+
                                           | Extract relevant       |
                                           | context from files     |
                                           | using GPT AI           |
                                           +-----------------------+
                                                       |
                                                       v
                                           +-----------------------+
                                           | Suggest changes based  |
                                           | on context & task      |
                                           | using GPT AI           |
                                           +-----------------------+
                                                       |
                                                       v
                                           +-----------------------+
                                           | Display suggested      |
                                           | changes to the user    |
                                           +-----------------------+

Features

CreateSummaries script:

  • 📚 Reads all relevant files in the project (you can choose what file extensions you want)
  • 🧠 Creates a summary (using GPT AI API) representing a mental model for each file, allowing the app to work on larger codebases that wouldn't fit GPT's context window
  • 💾 Saves the summary next to each file with a .ai.txt extension for later use
  • 👀 A watcher continuously updates files that have been modified

🖥️ UI script:

  • 🧩 Takes into account the TASK and retrieves all the summary files (.ai.txt)
  • 🤖 Uses GPT AI API to identify relevant files for the task based on the summaries
  • 📁 Retrieves the source code of each relevant file and sends it to GPT to obtain the necessary context
  • 💾 Temporarily saves the output of each file
  • 🔧 Sends the saved output to GPT and requests the required changes to complete the TASK
  • 📋 Creates a .md file containing the suggestions to accomplish the TASK, along with the source code that can be used

🛠️ Installation

  1. Clone the repository: git clone https://github.com/fjrdomingues/autopilot.git
  2. Do cd autopilot to install dependencies: npm install
  3. Create the .env file and set up the environment variables:
    1. Copy the .env.example file to .env: cp .env.template .env
    2. Set up an OpenAI API key and file with the key: OPENAI_API_KEY=<your-api-key>
    3. Set the path to your code CODE_DIR=<path-to-your-code>
    4. Update IGNORE_LIST=node_modules,coverage,public,__tests__
    5. Update FILE_EXTENSIONS_TO_PROCESS=.js,.tsx,.ts,.jsx
  4. Run node createSummaryOfFiles.js --all to create a summary of all files (it will also start a watcher at the end for file changes)
  5. Run node ui.js to input a task and get the AI to give you a solution
  6. Solutions will be saved in a suggestions folder inside the project directory.

Test/Interactive mode

This project is still in alpha stage. It's recommended that you use node ui -i for an interactive mode here you can review the output of every step before proceeding.

Components

  • createSummaryOfFiles.js: Manages the code summarization process for JavaScript and TypeScript files
  • ui.js: Handles the user interface (UI) interaction and utilizes the GPT-based summaries to complete tasks

🤝 Contributing

We welcome contributions! Please submit pull requests to the repository, and ensure your changes align with the project's goals and guidelines. Together, we can make Autopilot an even more powerful and efficient tool for developers!

About

Dev Autopilot, a tool that uses GPT to read a codebase, create context and solve tasks.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%