An open API service indexing awesome lists of open source software.

https://github.com/ucl-docaider/docAider

DocAider is an LLM-powered repository agent designed to support developers in efficiently generating documentation through a multi-agent approach. With its integrated workflows, docAider streamlines the documentation update process, making it both effective and user-friendly.
https://github.com/ucl-docaider/docAider

Last synced: 4 days ago
JSON representation

DocAider is an LLM-powered repository agent designed to support developers in efficiently generating documentation through a multi-agent approach. With its integrated workflows, docAider streamlines the documentation update process, making it both effective and user-friendly.

Awesome Lists containing this project

README

        

# docAider

`docAider` leverages Semantic Kernel and Autogen to automate the process of generating and reviewing code documentation for your repository through a multi-agent approach. Additionally, with its integrated workflows, `docAider` streamlines the documentation update process, ensuring it is both efficient and user-friendly.

## Getting Started

### Docker Setup

Add the following `Dockerfile` to your repository:

```
version: "3.8"

services:
docAider:
image: zenawang/docaider:v1
container_name: docAider
volumes:
- .:/workspace
working_dir: /workspace
env_file:
- .env
```

### Environment Variables

Create a `.env` file in your repository with the following variables:

```
GLOBAL_LLM_SERVICE="AzureOpenAI"
CHAT_DEPLOYMENT_NAME="GPT-4"
AZURE_OPENAI_API_KEY="YOUR_AZURE_OPENAI_API_KEY"
AZURE_OPENAI_ENDPOINT="YOUR_AZURE_OPENAI_ENDPOINT"
AZURE_OPENAI_API_VERSION="2023-03-15-preview"
API_TYPE="azure"
BASE_URL="YOUR_BASE_URL"

GITHUB_ACCESS_TOKEN="YOUR_GITHUB_ACCESS_TOKEN"

ROOT_FOLDER="/workspace"
```

## Run docAider

### Activate docAider Image

To activate the `docAider` Docker image and ensure it continues running (do not terminate it), use the following command:

```
docker compose up --build
```

This command will build and start the `docAider` container. It will keep running in the foreground, so you can interact with it as needed.

### Generate documentation

To generate documentation for your repository, run the following command. This process is typically done once to create initial documentation:

```
docker exec docAider python3 /docAider/repo_documentation/multi_agent_app.py
```

During execution, you can observe the interaction between multiple agents in the terminal output. The `CodeContextAgent` provides explanations for code contexts, the `documentation_generation_agent` generates documentation for specified code files, and the `review_agent` reviews and enhances the generated documentation. The `agent_manager` orchestrates the interactions between these agents, ensuring a seamless workflow from context explanation to documentation generation and review.

The generated documentation can be found in the `docs_output` folder. The `prompt_debug` folder contains the prompts for each source code file, which are fed to the agents.

Additionally, the `call_graph.json,` `cache.json`, and `graph.png` files are generated by the [code2flow](https://github.com/TomasKopunec/code2flow/tree/82b5b9f535b66c9d9f9f12bbb77f86bae0bdc248?tab=readme-ov-file) project. These files help in:

- Untangling spaghetti code
- Identifying orphaned functions
- Getting new developers up to speed

### Setup workflows
To set up workflows (update-docs.yml and update-comments.yml) for automatic documentation updates, run:

```
docker exec docAider python3 /docAider/setup_workflows.py
```

Note: Remember to manually push the generated documentation and workflows to the repository, preferably to the main branch.

### Ensure Workflow Success
Create an environment named "GPT" and add the variables from the .env file as secrets (excluding GITHUB_ACCESS_TOKEN and ROOT_FOLDER). This can be done in your repository settings under **Settings** > **Security** > **Secrets** and **Variables** > **Actions**.

## Workflows

### update-docs.yml
This workflow triggers when a pull request is opened against the main branch and updates the documentation based on the changes between the pull request branch and the main branch.

### update-comments.yml
Use this workflow to modify the documentation further if the initial update is not satisfactory. You can request changes by commenting in the following format:
```
Documentation {file_path}: {comment}
```
`file_path`: Path to the source code file for which you want to update the documentation.
`comment`: Prompt or instructions to guide the agent in updating the documentation.

## Contribution
This project includes features and improvements from a custom fork of the [code2flow](https://github.com/scottrogowski/code2flow/) project licensed under the MIT license. The code2flow project generate call graphs for dynamic programming languages and can be found [here](https://github.com/TomasKopunec/code2flow/tree/82b5b9f535b66c9d9f9f12bbb77f86bae0bdc248?tab=readme-ov-file). This fork is tailored to support Python only.