Skip to content

Commit d61a377

Browse files
committed
fix: add structure files automatically add to git
1 parent ae5c53a commit d61a377

File tree

3 files changed

+33
-33
lines changed

3 files changed

+33
-33
lines changed

pdm.lock

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

repo_agent/change_detector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def get_to_be_staged_files(self):
213213

214214
for unstaged_file in unstaged_files:
215215
# 连接repo_path和unstaged_file以获取完整的绝对路径
216-
if unstaged_file.startswith(setting.project.markdown_docs_name):
216+
if unstaged_file.startswith(setting.project.markdown_docs_name) or unstaged_file.startswith(setting.project.hierarchy_name):
217217
# abs_unstaged_file = os.path.join(self.repo_path, unstaged_file)
218218
# # # 获取相对于仓库根目录的相对路径
219219
# # rel_unstaged_file = os.path.relpath(abs_unstaged_file, self.repo_path)

repo_agent/runner.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ def generate_doc_for_a_single_item(self, doc_item: DocItem):
7373
rel_file_path = doc_item.get_full_name()
7474

7575
if not need_to_generate(doc_item, setting.project.ignore_list):
76-
print(f"内容被忽略/文档已生成,跳过:{doc_item.get_full_name()}")
76+
print(f"Content ignored/Document generated, skipping: {doc_item.get_full_name()}")
7777
else:
78-
print(f" -- 正在生成文档 {Fore.LIGHTYELLOW_EX}{doc_item.item_type.name}: {doc_item.get_full_name()}{Style.RESET_ALL}")
78+
print(f" -- Generating document {Fore.LIGHTYELLOW_EX}{doc_item.item_type.name}: {doc_item.get_full_name()}{Style.RESET_ALL}")
7979
file_handler = FileHandler(setting.project.target_repo, rel_file_path)
8080
response_message = self.chat_engine.generate_doc(
8181
doc_item=doc_item,
@@ -135,7 +135,7 @@ def first_generate(self):
135135
target_dir_path=self.absolute_project_hierarchy_path
136136
)
137137
logger.info(
138-
f"成功生成了 {before_task_len - len(task_manager.task_dict)} 个文档"
138+
f"Successfully generated {before_task_len - len(task_manager.task_dict)} documents."
139139
)
140140

141141
except BaseException as e:
@@ -191,7 +191,7 @@ def to_markdown(item: DocItem, now_level: int) -> str:
191191
markdown = ""
192192
for _, child in file_item.children.items():
193193
markdown += to_markdown(child, 2)
194-
assert markdown != None, f"markdown内容为空,文件路径为{rel_file_path}"
194+
assert markdown != None, f"Markdown content is empty, the file path is: {rel_file_path}"
195195
# 写入markdown内容到.md文件
196196
file_path = os.path.join(
197197
setting.project.markdown_docs_name,
@@ -256,7 +256,7 @@ def run(self):
256256
new_meta_info.load_doc_from_older_meta(self.meta_info)
257257

258258
self.meta_info = new_meta_info # 更新自身的meta_info信息为new的信息
259-
self.meta_info.in_generation_process = True # 将in_generation_process设置为True,表示检测到变更后正在生成文档的过程中
259+
self.meta_info.in_generation_process = True # 将in_generation_process设置为True,表示检测到变更后Generating document 的过程中
260260

261261
# 处理任务队列
262262
check_task_available_func = partial(need_to_generate, ignore_list=setting.project.ignore_list)
@@ -301,7 +301,7 @@ def run(self):
301301
git_add_result = self.change_detector.add_unstaged_files()
302302

303303
if len(git_add_result) > 0:
304-
logger.info(f"已添加 {[file for file in git_add_result]} 到暂存区")
304+
logger.info(f"Added {[file for file in git_add_result]} to the staging area.")
305305

306306
# self.git_commit(f"Update documentation for {file_handler.file_path}") # 提交变更
307307

@@ -339,7 +339,7 @@ def add_new_item(self, file_handler, json_data):
339339
# 将新的项写入json文件
340340
with open(self.project_manager.project_hierarchy, "w", encoding="utf-8") as f:
341341
json.dump(json_data, f, indent=4, ensure_ascii=False)
342-
logger.info(f"已将新增文件 {file_handler.file_path} 的结构信息写入json文件。")
342+
logger.info(f"The structural information of the newly added file {file_handler.file_path} has been written into a JSON file.")
343343
# 将变更部分的json文件内容转换成markdown内容
344344
markdown = file_handler.convert_to_markdown_file(
345345
file_path=file_handler.file_path

0 commit comments

Comments
 (0)