Skip to content

Commit 7ffcc1b

Browse files
committed
docs: update README.md and README_CN.md
- Add `chat-with-repo` to cli
1 parent 0bf63d3 commit 7ffcc1b

File tree

6 files changed

+248
-238
lines changed

6 files changed

+248
-238
lines changed

README.md

Lines changed: 92 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,33 @@
1-
[中文](README_CN.md) | [Background](#-background) | [Features](#-features) | [Getting Started](#-getting-started) | [Future Work](#-future-work) | [Supported Language](#-supported-language) | [Citation](#-citation)
2-
3-
# 🤗 Introduction
4-
5-
RepoAgent is an Open-Source project driven by Large Language Models(LLMs) that aims to provide an intelligent way to document projects.
6-
It is designed to be a handy tool for developers who need to organize their code and cooperate with teammates.
7-
8-
**Paper:** http://arxiv.org/abs/2402.16667
9-
10-
![RepoAgent](assets/images/RepoAgent.png)
1+
<h1 align="center"><em> RepoAgent: An LLM-Powered Open-Source Framework for Repository-level Code Documentation Generation.</em></h1>
2+
3+
<p align="center">
4+
<img src="https://img.shields.io/pypi/dm/repoagent" alt="PyPI - Downloads"/>
5+
<a href="https://pypi.org/project/repoagent/">
6+
<img src="https://img.shields.io/pypi/v/repoagent" alt="PyPI - Version"/>
7+
</a>
8+
<a href="Pypi">
9+
<img src="https://img.shields.io/pypi/pyversions/repoagent" alt="PyPI - Python Version"/>
10+
</a>
11+
<img alt="GitHub License" src="https://img.shields.io/github/license/LOGIC-10/RepoAgent">
12+
<img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/LOGIC-10/RepoAgent?style=social">
13+
<img alt="GitHub issues" src="https://img.shields.io/github/issues/LOGIC-10/RepoAgent">
14+
<a href="https://arxiv.org/abs/2402.16667v1">
15+
<img src="https://img.shields.io/badge/cs.CL-2402.16667-b31b1b?logo=arxiv&logoColor=red" alt="arXiv"/>
16+
</a>
17+
</p>
18+
19+
<p align="center">
20+
<img src="assets/images/RepoAgent.png" alt="RepoAgent"/>
21+
</p>
22+
23+
<p align="center">
24+
<a href="https://github.com/LOGIC-10/RepoAgent/blob/main/README.md">English readme</a>
25+
26+
<a href="https://github.com/LOGIC-10/RepoAgent/blob/main/README_CN.md">简体中文 readme</a>
27+
</p>
1128

1229
## 👾 Background
30+
1331
In the realm of computer programming, the significance of comprehensive project documentation, including detailed explanations for each Python file, cannot be overstated. Such documentation serves as the cornerstone for understanding, maintaining, and enhancing the codebase. It provides essential context and rationale for the code, making it easier for current and future developers to comprehend the purpose, functionality, and structure of the software. It not only facilitates current and future developers in grasping the project's purpose and structure but also ensures that the project remains accessible and modifiable over time, significantly easing the learning curve for new team members.
1432

1533
Traditionally, creating and maintaining software documentation demanded significant human effort and expertise, a challenge for small teams without dedicated personnel. The introduction of Large Language Models (LLMs) like GPT has transformed this, enabling AI to handle much of the documentation process. This shift allows human developers to focus on verification and fine-tuning, greatly reducing the manual burden of documentation.
@@ -31,13 +49,13 @@ Traditionally, creating and maintaining software documentation demanded signific
3149

3250
### Installation Method
3351

34-
<!-- #### Using pip (Recommended for Users)
52+
#### Using pip (Recommended for Users)
3553

3654
Install the `repoagent` package directly using pip:
3755

3856
```bash
3957
pip install repoagent
40-
``` -->
58+
```
4159

4260
#### Development Setup Using PDM
4361

@@ -56,7 +74,7 @@ If you're looking to contribute or set up a development environment:
5674
```bash
5775
git clone https://github.com/LOGIC-10/RepoAgent.git
5876
cd RepoAgent
59-
```
77+
```
6078

6179
- **Setup with PDM**
6280

@@ -76,75 +94,81 @@ If you're looking to contribute or set up a development environment:
7694

7795
### Configuring RepoAgent
7896

79-
First, configure the OpenAI API parameters in the config.yml file.
80-
For details on obtaining these, please refer to [OpenAI API](https://beta.openai.com/docs/developer-quickstart/your-api-keys).
81-
82-
In the `config.yml` file, configure other parameters like OpenAI API, the destination repository path, document language, and so on:
83-
84-
```yaml
85-
api_keys:
86-
gpt-3.5-turbo-16k:
87-
- api_key: sk-XXXX
88-
base_url: https://example.com/v1/
89-
api_type: azure
90-
api_version: XXX
91-
engine: GPT-35-Turbo-16k
92-
# you can use any kwargs supported by openai.ChatCompletion here
93-
- api_key: sk-xxxxx
94-
organization: org-xxxxxx
95-
model: gpt-3.5-turbo-16k
96-
...
97-
98-
default_completion_kwargs:
99-
model: gpt-4-1106
100-
temperature: 0.2
101-
request_timeout: 60
102-
103-
repo_path: /path/to/your/repo
104-
project_hierarchy: .project_hierarchy # This is a folder, where we store the project hierarchy and metainfo. This can be shared with your team members.
105-
Markdown_Docs_folder: Markdown_Docs # The folder in the root directory of your target repository to store the documentation.
106-
ignore_list: ["ignore_file1.py", "ignore_file2.py", "ignore_directory"] # Ignore some py files or folders that you don't want to generate documentation for by giving relative paths in ignore_list.
107-
108-
language: en # Two-letter language codes (ISO 639-1 codes), e.g. `language: en` for English. Refer to Supported Language for more languages.
109-
max_thread_count: 10 # We support multiprocessing to speedup the process
110-
max_document_tokens: 1024 # the maximum number of tokens in a document generated
111-
log_level: info
97+
You can use RepoAgent with OpenAI API for the moment.
98+
99+
```sh
100+
export OPENAI_API_KEY=YOUR_API_KEY # on Linux/Mac
101+
set OPENAI_API_KEY=YOUR_API_KEY # on Windows
102+
$Env:OPENAI_API_KEY = "YOUR_API_KEY" # on Windows (PowerShell)
103+
```
104+
105+
Use `repoagent configure` if you need to running parameters.
106+
107+
```sh
108+
Enter the path to target repository:
109+
Enter the project hierarchy file name [.project_doc_record]:
110+
Enter the Markdown documents folder name [markdown_docs]:
111+
Enter files or directories to ignore, separated by commas []:
112+
Enter the language (ISO 639 code or language name, e.g., 'en', 'eng', 'English') [Chinese]:
113+
Enter the maximum number of threads [4]:
114+
Enter the maximum number of document tokens [1024]:
115+
Enter the log level (DEBUG, INFO, WARNING, ERROR, CRITICAL) [INFO]:
116+
Enter the model [gpt-3.5-turbo]:
117+
Enter the temperature [0.2]:
118+
Enter the request timeout (seconds) [60.0]:
119+
Enter the base URL [https://api.openai.com/v1]:
112120
```
113121

114-
### Run RepoAgent
122+
## Run RepoAgent
115123

116124
Enter the root directory of RepoAgent and try the following command in the terminal:
117125
```sh
118-
python -m repo_agent #this command will generate doc, or update docs(pre-commit-hook will automatically call this)
126+
repo_agent run #this command will generate doc, or update docs(pre-commit-hook will automatically call this)
127+
```
128+
129+
The run command supports the following optional flags (if set, will override config defaults):
130+
131+
- `-m`, `--model` TEXT: Specifies the model to use for completion. Default: `gpt-3.5-turbo`
132+
- `-t`, `--temperature` FLOAT: Sets the generation temperature for the model. Lower values make the model more deterministic. Default: `0.2`
133+
- `-r`, `--request-timeout` INTEGER: Defines the timeout in seconds for the API request. Default: `60`
134+
- `-b`, `--base-url` TEXT: The base URL for the API calls. Default: `https://api.openai.com/v1`
135+
- `-tp`, `--target-repo-path` PATH: The file system path to the target repository. Used as the root for documentation generation. Default: `/home/test/arno`
136+
- `-hp`, `--hierarchy-path` TEXT: The name or path for the project hierarchy file, used to organize documentation structure. Default: `.project_doc_record`
137+
- `-mdp`, `--markdown-docs-path` TEXT: The folder path where Markdown documentation will be stored or generated. Default: `markdown_docs`
138+
- `-i`, `--ignore-list` TEXT: A list of files or directories to ignore during documentation generation, separated by commas.
139+
- `-l`, `--language` TEXT: The ISO 639 code or language name for the documentation. Default: `Chinese`
140+
- `-ll`, `--log-level` [DEBUG|INFO|WARNING|ERROR|CRITICAL]: Sets the logging level for the application. Default: `INFO`
141+
142+
143+
You can also try the following feature
119144

120-
# you can also try the follow feature
121-
python -m repo_agent clean #this command will remove repoagent-related cache
122-
python -m repo_agent print #this command will print how repo-agent parse the target repo
123-
python -m repo_agent diff #this command will check what docs will be updated/generated based on current code change
145+
```sh
146+
repo_agent clean # Remove repoagent-related cache
147+
repo_agent print-hierarchy # Print how repo-agent parse the target repo
148+
repo_agent diff # Check what docs will be updated/generated based on current code change
124149
```
125150

126151
If it's your first time generating documentation for the target repository, RepoAgent will automatically create a JSON file maintaining the global structure information and a folder named Markdown_Docs in the root directory of the target repository for storing documents.
127152
128-
The paths of the global structure information json file and the documentation folder can be configured in `config.yml`.
129-
130-
Once you have initially generated the global documentation for the target repository, or if the project you cloned already contains global documentation information, you can then seamlessly and automatically maintain internal project documentation with your team by configuring the **pre-commit hook** in the target repository!
153+
Once you have initially generated the global documentation for the target repository, or if the project you cloned already contains global documentation information, you can then seamlessly and automatically maintain internal project documentation with your team by configuring the **pre-commit hook** in the target repository!
131154
132-
### Configuring the Target Repository
155+
### Use `pre-commit`
133156
134157
RepoAgent currently supports generating documentation for projects, which requires some configuration in the target repository.
135158
136159
First, ensure that the target repository is a git repository and has been initialized.
137-
```
160+
161+
```sh
138162
git init
139163
```
140164
Install pre-commit in the target repository to detect changes in the git repository.
141165
142-
```
166+
```sh
143167
pip install pre-commit
144168
```
145169
Create a file named `.pre-commit-config.yaml` in the root directory of the target repository. An example is as follows:
146170
147-
```
171+
```yml
148172
repos:
149173
- repo: local
150174
hooks:
@@ -155,11 +179,14 @@ repos:
155179
# You can specify the file types that trigger the hook, but currently only python is supported.
156180
types: [python]
157181
```
182+
158183
For specific configuration methods of hooks, please refer to [pre-commit](https://pre-commit.com/#plugins).
159184
After configuring the yaml file, execute the following command to install the hook.
160-
```
185+
186+
```sh
161187
pre-commit install
162188
```
189+
163190
In this way, each git commit will trigger the RepoAgent's hook, automatically detecting changes in the target repository and generating corresponding documents.
164191
Next, you can make some modifications to the target repository, such as adding a new file to the target repository, or modifying an existing file.
165192
You just need to follow the normal git workflow: git add, git commit -m "your commit message", git push
@@ -177,25 +204,21 @@ We utilized the default model **gpt-3.5-turbo** to generate documentation for th
177204
**In the end, you can flexibly adjust the output format, template, and other aspects of the document by customizing the prompt. We are excited about your exploration of a more scientific approach to Automated Technical Writing and your contributions to the community.**
178205

179206
### Exploring chat with repo
207+
180208
We conceptualize **Chat With Repo** as a unified gateway for these downstream applications, acting as a connector that links RepoAgent to human users and other AI agents. Our future research will focus on adapting the interface to various downstream applications and customizing it to meet their unique characteristics and implementation requirements.
181209

182210
Here we demonstrate a preliminary prototype of one of our downstream tasks: Automatic Q&A for Issues and Code Explanation. You can start the server by running the following code.
183-
```bash
184-
python -m repo_agent.chat_with_repo
211+
212+
```sh
213+
repoagent chat-with-repo
185214
```
186215

187216
## ✅ Future Work
188217

189-
- [x] Identification and maintenance of parent-child relationship hierarchy structure between objects
190-
- [x] Implement Black commit
191-
- [x] **Bi-direct reference** Construct Bi-directional reference topology
192-
- [x] **chat with repo** Chat with the repository by giving code and document at the same time
193-
- [x] Automatically generate better visualizations such as Gitbook
218+
- [x] Support install and configure via `pip install repoagent`
194219
- [ ] Generate README.md automatically combining with the global documentation
195220
- [ ] **Multi-programming-language support** Support more programming languages like Java, C or C++, etc.
196221
- [ ] Local model support like Llama, chatGLM, Qwen, GLM4, etc.
197-
- [ ] Support install and configure via `pip install repoagent`
198-
- [X] Automatically generate Gitbook for better visualization effects
199222

200223
## 🥰 Featured Cases
201224

@@ -205,45 +228,6 @@ Here are featured cases that have adopted RepoAgent.
205228
- [ChatDev](https://github.com/OpenBMB/ChatDev): Collaborative AI agents for software development.
206229
- [XAgent](https://github.com/OpenBMB/XAgent): An Autonomous LLM Agent for Complex Task Solving.
207230

208-
## 🇺🇳 Supported Language
209-
210-
Set the target language with the two-letter language codes (ISO 639-1 codes), Click on the 'Languages List' section below to expand the list of supported languages.
211-
212-
<details>
213-
<summary>Languages List</summary>
214-
215-
| Flag | Code | Language |
216-
|------|------|------------|
217-
| 🇬🇧 | en | English |
218-
| 🇪🇸 | es | Spanish |
219-
| 🇫🇷 | fr | French |
220-
| 🇩🇪 | de | German |
221-
| 🇨🇳 | zh | Chinese |
222-
| 🇯🇵 | ja | Japanese |
223-
| 🇷🇺 | ru | Russian |
224-
| 🇮🇹 | it | Italian |
225-
| 🇰🇷 | ko | Korean |
226-
| 🇳🇱 | nl | Dutch |
227-
| 🇵🇹 | pt | Portuguese |
228-
| 🇸🇦 | ar | Arabic |
229-
| 🇹🇷 | tr | Turkish |
230-
| 🇸🇪 | sv | Swedish |
231-
| 🇩🇰 | da | Danish |
232-
| 🇫🇮 | fi | Finnish |
233-
| 🇳🇴 | no | Norwegian |
234-
| 🇵🇱 | pl | Polish |
235-
| 🇨🇿 | cs | Czech |
236-
| 🇭🇺 | hu | Hungarian |
237-
| 🇬🇷 | el | Greek |
238-
| 🇮🇱 | he | Hebrew |
239-
| 🇹🇭 | th | Thai |
240-
| 🇮🇳 | hi | Hindi |
241-
| 🇧🇩 | bn | Bengali |
242-
243-
</details>
244-
245-
> e.g., `language: en` for English.
246-
247231
## 📊 Citation
248232

249233
```bibtex

0 commit comments

Comments
 (0)