Skip to content

Commit ae5c53a

Browse files
committed
fix: use [] for ignore_list default value
- Rename `repo_agent` to `repoagent`. - Fix settings attribute for max tokens in ChatEngine. - Update README to use correct command. - bump version to v0.1.2
1 parent 7ffcc1b commit ae5c53a

File tree

11 files changed

+111
-96
lines changed

11 files changed

+111
-96
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<h1 align="center"><em> RepoAgent: An LLM-Powered Open-Source Framework for Repository-level Code Documentation Generation.</em></h1>
1+
<h1 align="center"><em> RepoAgent: An LLM-Powered Framework for Repository-level Code Documentation Generation.</em></h1>
22

33
<p align="center">
44
<img src="https://img.shields.io/pypi/dm/repoagent" alt="PyPI - Downloads"/>
@@ -123,7 +123,7 @@ Enter the base URL [https://api.openai.com/v1]:
123123

124124
Enter the root directory of RepoAgent and try the following command in the terminal:
125125
```sh
126-
repo_agent run #this command will generate doc, or update docs(pre-commit-hook will automatically call this)
126+
repoagent run #this command will generate doc, or update docs(pre-commit-hook will automatically call this)
127127
```
128128

129129
The run command supports the following optional flags (if set, will override config defaults):
@@ -174,7 +174,7 @@ repos:
174174
hooks:
175175
- id: repo-agent
176176
name: RepoAgent
177-
entry: python path/to/your/repo_agent/runner.py
177+
entry: repoagent
178178
language: system
179179
# You can specify the file types that trigger the hook, but currently only python is supported.
180180
types: [python]

README_CN.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<h1 align="center"><em>RepoAgent:一个用于代码库级别代码文档生成的LLM驱动开源框架</em></h1>
1+
<h1 align="center"><em>RepoAgent:一个用于代码库级别代码文档生成的LLM驱动框架</em></h1>
22

33
<p align="center">
44
<img src="https://img.shields.io/pypi/dm/repoagent" alt="PyPI - 下载量"/>
@@ -21,7 +21,7 @@
2121
</p>
2222

2323
<p align="center">
24-
<a href="https://github.com/LOGIC-10/RepoAgent/blob/main/README.md">英文说明</a>
24+
<a href="https://github.com/LOGIC-10/RepoAgent/blob/main/README.md">English README</a>
2525
2626
<a href="https://github.com/LOGIC-10/RepoAgent/blob/main/README_CN.md">简体中文说明</a>
2727
</p>
@@ -134,9 +134,9 @@ run 命令支持以下可选标志(如果设置,将覆盖配置默认值)
134134
你也可以尝试以下功能
135135

136136
```sh
137-
python -m repo_agent clean # 此命令将删除与repoagent相关的缓存
138-
python -m repo_agent print # 此命令将打印repo-agent如何解析目标仓库
139-
python -m repo_agent diff # 此命令将检查基于当前代码更改将更新/生成哪些文档
137+
repoagent clean # 此命令将删除与repoagent相关的缓存
138+
repoagent print # 此命令将打印repo-agent如何解析目标仓库
139+
repoagent diff # 此命令将检查基于当前代码更改将更新/生成哪些文档
140140
```
141141

142142
如果您是第一次对目标仓库生成文档,此时RepoAgent会自动生成一个维护全局结构信息的json文件,并在目标仓库根目录下创建一个名为Markdown_Docs的文件夹,用于存放文档。
@@ -163,7 +163,7 @@ repos:
163163
hooks:
164164
- id: repo-agent
165165
name: RepoAgent
166-
entry: python path/to/your/repo_agent/runner.py
166+
entry: repoagent
167167
language: system
168168
# 可以指定钩子触发的文件类型,但是目前只支持python
169169
types: [python]

pdm.lock

Lines changed: 38 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,25 @@ dependencies = [
1515
"pyyaml>=6.0.1",
1616
"jedi>=0.19.1",
1717
"GitPython>=3.1.41",
18-
"llama-index<0.10.0",
1918
"chromadb>=0.4.22",
2019
"prettytable>=3.9.0",
2120
"python-iso639>=2024.2.7",
2221
"pydantic-settings>=2.2.1",
2322
"tomli>=2.0.1",
2423
"tomli-w>=1.0.0",
24+
"llama-index<0.10.0",
2525
]
2626
name = "repoagent"
27-
version = "0.1.0"
28-
description = "An Agent designed to offer an intelligent approach for generating project documentation."
27+
version = "0.1.2"
28+
description = "An LLM-Powered Framework for Repository-level Code Documentation Generation."
2929
readme = "README.md"
30+
classifiers = [
31+
"Programming Language :: Python :: 3",
32+
"Programming Language :: Python :: 3.10",
33+
"Programming Language :: Python :: 3.11",
34+
"Programming Language :: Python :: 3.12",
35+
"Topic :: Scientific/Engineering :: Artificial Intelligence"
36+
]
3037

3138
[project.urls]
3239
repository = "https://github.com/LOGIC-10/RepoAgent"
@@ -47,6 +54,7 @@ test = [
4754
[tool.pdm.build]
4855
includes = [
4956
"repo_agent",
57+
"assets/images/*.png"
5058
]
5159

5260

repo_agent/chat_engine.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ def get_relationship_description(referencer_content, reference_letter):
196196
else:
197197
return ""
198198

199-
max_tokens = setting.chat_completion.max_document_tokens
199+
max_tokens = setting.project.max_document_tokens
200200

201201
code_type_tell = "Class" if code_type == "ClassDef" else "Function"
202202
parameters_or_attribute = (

repo_agent/chat_with_repo/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# repo_agent/chat_with_repo/__init__.py
22

3-
from .main import main
3+
from .main import main

repo_agent/config_manager.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ def get_config_path() -> Path:
2020
os_name = os.name
2121
if os_name == 'posix':
2222
# 对于 Unix 和 macOS,使用家目录
23-
home_config_path = Path.home() / '.repo_agent'
23+
home_config_path = Path.home() / '.repoagent'
2424
elif os_name == 'nt':
2525
# 对于 Windows,使用 APPDATA 目录
26-
home_config_path = Path(os.getenv('APPDATA')) / 'repo_agent' # type: ignore
26+
home_config_path = Path(os.getenv('APPDATA')) / 'repoagent' # type: ignore
2727
else:
2828
# 如果操作系统检测失败,默认使用一个本地目录
29-
home_config_path = Path.cwd() / 'repo_agent'
29+
home_config_path = Path.cwd() / 'repoagent'
3030

3131
# 确保配置目录存在
3232
home_config_path.mkdir(parents=True, exist_ok=True)

repo_agent/doc_meta_info.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class DocItemStatus(Enum):
8080
referencer_not_exist = auto() # 曾经引用他的obj被删除了,或者不再引用他了
8181

8282

83-
def need_to_generate(doc_item: DocItem, ignore_list: List = []) -> bool:
83+
def need_to_generate(doc_item: DocItem, ignore_list: List[str] = []) -> bool:
8484
"""只生成item的,文件及更高粒度都跳过。另外如果属于一个blacklist的文件也跳过"""
8585
if doc_item.item_status == DocItemStatus.doc_up_to_date:
8686
return False
@@ -236,14 +236,14 @@ def find(self, recursive_file_path: list) -> Optional[DocItem]:
236236
return now
237237

238238
@staticmethod
239-
def check_has_task(now_item: DocItem, ignore_list: List = []):
239+
def check_has_task(now_item: DocItem, ignore_list: List[str] = []):
240240
if need_to_generate(now_item, ignore_list=ignore_list):
241241
now_item.has_task = True
242242
for _, child in now_item.children.items():
243243
DocItem.check_has_task(child, ignore_list)
244244
now_item.has_task = child.has_task or now_item.has_task
245245

246-
def print_recursive(self, indent=0, print_content=False, diff_status = False, ignore_list = []):
246+
def print_recursive(self, indent=0, print_content=False, diff_status = False, ignore_list: List[str] = []):
247247
"""递归打印repo对象"""
248248

249249
def print_indent(indent=0):

repo_agent/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def language_prompt(default_language):
5858
@click.group()
5959
@click.version_option(version_number)
6060
def cli():
61-
"""An LLM-Powered Open-Source Framework for Repository-level Code Documentation Generation."""
61+
"""An LLM-Powered Framework for Repository-level Code Documentation Generation."""
6262
pass
6363

6464

@@ -81,7 +81,7 @@ def configure():
8181
ignore_list=click.prompt(
8282
"Enter files or directories to ignore, separated by commas",
8383
default=",".join(
84-
str(path) for path in project_settings_default_instance.ignore_list
84+
str(path) for path in []
8585
),
8686
).split(","),
8787
language=language_prompt(

repo_agent/settings.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ class ProjectSettings(BaseSettings):
3434
max_document_tokens: PositiveInt = 1024
3535
log_level: LogLevel = LogLevel.INFO
3636

37+
@field_serializer("ignore_list")
38+
def serialize_ignore_list(self, ignore_list: list[str] = []):
39+
if ignore_list == [""]:
40+
self.ignore_list = [] # If the ignore_list is empty, set it to an empty list
41+
return []
42+
return ignore_list
43+
3744
@field_validator("language")
3845
@classmethod
3946
def validate_language_code(cls, v: str) -> str:

0 commit comments

Comments
 (0)