Autopilot is an AI tool that utilizes GPT to read a codebase, create context, and solve tasks that you request.
- 📚 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
- 🧩 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
- Clone the repository:
git clone https://github.com/fjrdomingues/autopilot.git
inside of an existing project where you want to use autopilot - Do
cd autopilot
to install dependencies:npm install
cd ..
to go back to the root of the project- Set up an OpenAI API key and update the
.env
file with the key:OPENAI_API_KEY=<your-api-key>
- Update
const ignoreList = ['node_modules', 'autopilot', 'coverage', 'public', '__tests__']
andconst fileExtensionsToProcess = ['.js', '.tsx', '.ts', '.jsx']
in the filecreateSummaryOfFiles.js
to match the files extension that you want AI to analyze. - Run
node ./autopilot/createSummaryOfFiles.js ./ --all
to create a summary of all files (it will also start a watcher at the end for file changes) - Run
node ./autopilot/ui.js
to input a task and get the AI to give you a solution
To use the code summarization tool, follow these steps:
- Navigate to the
ui.js
file and run it:node ui.js
- Follow the prompts to provide the necessary input, including the task to complete and the relevant files
- The summarization tool will process the selected files and provide suggestions for the given task
- Solutions will be saved in a
suggestions
folder inside the project directory. You can view them with a .md viewer tool.
- createSummaryOfFiles.js: Manages the code summarization process for JavaScript and TypeScript files
- gpt.js: Implements the interaction with the OpenAI API to generate responses based on provided prompts
- ui.js: Handles the user interface (UI) interaction and utilizes the GPT-based summaries to complete tasks
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!